1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-12 20:13:47 +00:00

Fix most actor compiler warnings (#656)

* functions.h

* Bg_Hidan_Kowarerukabe

* Demo_Geff

* Arrow_Fire

* Demo_Sa

* Arms_Hook

* En_Okarina_Effect

* Demo_Im

* Bg_Menkuri_Kaiten

* Bg_Spot09_Obj (minus CollisionHeader)

* Obj_Hsblock

* Obj_Elevator

* En_Anubice_Tag

* Bg_Ydan_Hasi
(minus BgYdanHasi_MoveWater return shenanigans)

* En_Heishi4

* Demo_Go

* Bg_Spot00_Break

* Bg_Hidan_Kousi

* Bg_Spot17_Bakudankabe

* Bg_Spot18_Basket

* En_Dha

* Bg_Jya_Goroiwa

* En_Js

* Bg_Mori_Hineri

* Bg_Spot18_Shutter

* Bg_Jya_Bombchuiwa

* Bg_Bdan_Objects

* Bg_Jya_Amishutter

* Bg_Toki_Swd

* En_Heishi2

* En_Fu

* Bg_Jya_Kanaami

* Bg_Pushbox

* Bg_Spot12_Saku

* En_Ani

* En_Zl1

* En_Vase

* Bg_Spot05_Soko

* En_Crow (and a rename in En_Firefly)

* Bg_Hidan_Fslift

* En_Dog

* Bg_Heavy_Block

* En_Boom

* Bg_Ddan_Kd

* Bg_Spot16_Bombstone

* Demo_Effect

* Bg_Hidan_Syoku

* En_Firefly

* En_Fw

* Bg_Jya_Bombiwa

* En_Fd

* ovl_Bg_Spot15_Saku

* En_Mb

* Bg_Spot18_Obj

* Bg_Zg

* Bg_Bdan_Switch

* En_Md

* En_Box

* En_Bw

* En_Viewer

* En_Hs2

* Bg_Ydan_Maruta

* En_St

* En_Ru1

* Bg_Ddan_Jd

* En_Sb

* Bg_Jya_Cobra

* Bg_Spot12_Gate

* Bg_Haka_Trap

* En_Ms

* En_Kakasi2

* En_Horse_Link_Child

* Obj_Bombiwa

* En_Ds

* En_Kz

* Bg_Umajump

* Bg_Spot03_Taki

* Door_Toki

* Item_Etcetera

* En_Ru2

* En_Niw

* Bg_Spot15_Rrbox

* Demo_Tre_Lgt

* Obj_Oshihiki

* Bg_Mjin

* Bg_Spot18_Futa

* Bg_Spot01_Idosoko

* En_Arow_Trap

* Bg_Mizu_Uzu

* En_Horse_Zelda

* Player

* fix func_800358DC to work in functions.h

* fix fix to functions.h

* enum fixes

* Some review comments addressed

* DynaPoly_GetActor standardisation

* ovl_Daiku_Kakariko

* ovl_En_Vase

* ovl_En_Mk

* ovl_Bg_Spot00_Hanebasi

* ovl_Bg_Spot06_Objects

* ovl_En_Go

* ovl_En_Go2

* ovl_Bg_Jya_Bombiwa

* ovl_En_Cs

* ovl_En_Dodojr

* ovl_En_Ny

* ovl_En_Mm2

* Apply review suggestion
This commit is contained in:
EllipticEllipsis 2021-02-02 23:44:24 +00:00 committed by GitHub
parent ced724fb9b
commit 02b3640bde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
122 changed files with 1129 additions and 1125 deletions

View file

@ -472,6 +472,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player); Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player);
Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory); Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory);
void func_80032C7C(GlobalContext* globalCtx, Actor* actor); void func_80032C7C(GlobalContext* globalCtx, Actor* actor);
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3);
void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx); void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx);
void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, Gfx** dList, s16 arg6); void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, Gfx** dList, s16 arg6);
s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params); s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params);
@ -521,6 +522,8 @@ u8 Actor_ApplyDamage(Actor* actor);
void func_80035650(Actor* actor, ColliderInfo* colBody, s32 freezeFlag); void func_80035650(Actor* actor, ColliderInfo* colBody, s32 freezeFlag);
void func_8003573C(Actor* actor, ColliderJntSph* colBody, s32 freezeFlag); void func_8003573C(Actor* actor, ColliderJntSph* colBody, s32 freezeFlag);
void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3); void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3);
Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused,
GlobalContext* globalCtx, s16 params, s32 arg8);
void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2); void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2);
s32 Flags_GetEventChkInf(s32 flag); s32 Flags_GetEventChkInf(s32 flag);
void Flags_SetEventChkInf(s32 flag); void Flags_SetEventChkInf(s32 flag);
@ -755,6 +758,7 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status);
Vec3s* Camera_Update(Vec3s* outDir, Camera* camera); Vec3s* Camera_Update(Vec3s* outDir, Camera* camera);
void Camera_Finish(Camera* camera); void Camera_Finish(Camera* camera);
s32 Camera_ChangeMode(Camera* camera, s16 mode); s32 Camera_ChangeMode(Camera* camera, s16 mode);
s32 Camera_CheckValidMode(Camera* camera, s16 mode);
s32 Camera_ChangeSetting(Camera* camera, s16 setting); s32 Camera_ChangeSetting(Camera* camera, s16 setting);
s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx); s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx);
s16 Camera_GetInputDirYaw(Camera* camera); s16 Camera_GetInputDirYaw(Camera* camera);
@ -764,6 +768,8 @@ s16 Camera_GetCamDirYaw(Camera* camera);
s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown); s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown);
s32 Camera_SetParam(Camera* camera, s32 param, void* value); s32 Camera_SetParam(Camera* camera, s32 param, void* value);
s32 func_8005AC48(Camera* camera, s16 arg1); s32 func_8005AC48(Camera* camera, s16 arg1);
s16 func_8005ACFC(Camera* camera, s16 arg1);
s16 func_8005AD1C(Camera* camera, s16 arg1);
s32 Camera_ResetAnim(Camera* camera); s32 Camera_ResetAnim(Camera* camera);
s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints, Player* player, s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints, Player* player,
s16 relativeToPlayer); s16 relativeToPlayer);
@ -773,6 +779,7 @@ s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera);
Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera); Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera);
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3, void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3,
UNK_TYPE arg6); UNK_TYPE arg6);
s32 func_8005B198(void);
s16 func_8005B1A4(Camera* camera); s16 func_8005B1A4(Camera* camera);
DamageTable* DamageTable_Get(s32 index); DamageTable* DamageTable_Get(s32 index);
void DamageTable_Clear(DamageTable* table); void DamageTable_Clear(DamageTable* table);
@ -964,6 +971,8 @@ void func_800775D8();
s32 func_800775E4(); s32 func_800775E4();
void func_800775F0(u16); void func_800775F0(u16);
// ? func_80077600(?); // ? func_80077600(?);
void func_80077624(GlobalContext* globalCtx);
void func_80077684(GlobalContext* globalCtx);
void func_800776E4(GlobalContext* globalCtx); void func_800776E4(GlobalContext* globalCtx);
void Lib_MemSet(u8* dest, size_t size, u8 val); void Lib_MemSet(u8* dest, size_t size, u8 val);
f32 Math_CosS(s16 angle); f32 Math_CosS(s16 angle);
@ -1206,10 +1215,13 @@ Gfx* func_80093F34(Gfx* gfx);
Gfx* func_80093F58(Gfx* gfx); Gfx* func_80093F58(Gfx* gfx);
void func_80094044(GraphicsContext* gfxCtx); void func_80094044(GraphicsContext* gfxCtx);
void func_800940B0(GraphicsContext* gfxCtx); void func_800940B0(GraphicsContext* gfxCtx);
void func_80094140(GraphicsContext* gfxCtx);
Gfx* func_8009411C(Gfx* gfx);
void func_800942F0(GraphicsContext* gfxCtx); void func_800942F0(GraphicsContext* gfxCtx);
void func_8009435C(GraphicsContext* gfxCtx); void func_8009435C(GraphicsContext* gfxCtx);
void func_800943C8(GraphicsContext* gfxCtx); void func_800943C8(GraphicsContext* gfxCtx);
Gfx* func_800944A0(Gfx* gfx); Gfx* func_800944A0(Gfx* gfx);
void func_800944C4(GraphicsContext* gfxCtx);
void func_80094520(GraphicsContext* gfxCtx); void func_80094520(GraphicsContext* gfxCtx);
void func_8009457C(Gfx** gfxp); void func_8009457C(Gfx** gfxp);
void func_800945A0(GraphicsContext* gfxCtx); void func_800945A0(GraphicsContext* gfxCtx);
@ -1344,6 +1356,8 @@ void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx*
void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4, void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7); s32 arg5, s32 arg6, s32 arg7);
void func_800A6330(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4); void func_800A6330(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4);
void func_800A6360(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5);
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4, void func_800A63CC(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7); s32 arg5, s32 arg6, s32 arg7);
void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3); void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3);
@ -2245,6 +2259,7 @@ void func_800F46E0(Vec3f* pos, f32 arg0);
// ? func_800F4784(?); // ? func_800F4784(?);
void func_800F47BC(void); void func_800F47BC(void);
void func_800F47FC(void); void func_800F47FC(void);
void func_800F483C(UNK_TYPE arg0, UNK_TYPE arg1);
// ? func_800F491C(?); // ? func_800F491C(?);
// ? func_800F4A70(?); // ? func_800F4A70(?);
void func_800F4BF4(Vec3f*, u16 sfxId, s8); void func_800F4BF4(Vec3f*, u16 sfxId, s8);
@ -2284,7 +2299,7 @@ void func_800F6AB0(u8);
// ? func_800F6BB8(?); // ? func_800F6BB8(?);
void func_800F6C14(); void func_800F6C14();
// ? func_800F6C34(?); // ? func_800F6C34(?);
void func_800F6D58(u8, u8, u8); void func_800F6D58(u8 arg0, u8 arg1, u8 arg2);
// ? func_800F6E7C(?); // ? func_800F6E7C(?);
// ? func_800F6FB4(?); // ? func_800F6FB4(?);
void func_800F70F8(); void func_800F70F8();

View file

@ -4090,7 +4090,7 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) {
/** /**
* Spawns En_Part (Dissipating Flames) actor as a child of the given actor. * Spawns En_Part (Dissipating Flames) actor as a child of the given actor.
*/ */
EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused,
GlobalContext* globalCtx, s16 params, s32 arg8) { GlobalContext* globalCtx, s16 params, s32 arg8) {
EnPart* spawnedEnPart; EnPart* spawnedEnPart;
@ -4105,7 +4105,7 @@ EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3,
spawnedEnPart->timer = timer; spawnedEnPart->timer = timer;
spawnedEnPart->rotZ = arg3[1]; spawnedEnPart->rotZ = arg3[1];
spawnedEnPart->rotZSpeed = arg3[2]; spawnedEnPart->rotZSpeed = arg3[2];
return spawnedEnPart; return &spawnedEnPart->actor;
} }
return NULL; return NULL;

View file

@ -41,7 +41,7 @@ ColliderQuadInit sQuadInit = {
BUMP_NONE, BUMP_NONE,
OCELEM_NONE, OCELEM_NONE,
}, },
{ 0 }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
}; };
static Vec3f sUnusedVec1 = { 0.0f, 0.5f, 0.0f }; static Vec3f sUnusedVec1 = { 0.0f, 0.5f, 0.0f };
@ -200,7 +200,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
this->grabbed = NULL; this->grabbed = NULL;
} else { } else {
if (this->actor.child != NULL) { if (this->actor.child != NULL) {
sp94 = Actor_WorldDistXYZToActor(this, grabbed); sp94 = Actor_WorldDistXYZToActor(&this->actor, grabbed);
sp90 = sp90 =
sqrtf(SQ(this->grabbedDistDiff.x) + SQ(this->grabbedDistDiff.y) + SQ(this->grabbedDistDiff.z)); sqrtf(SQ(this->grabbedDistDiff.x) + SQ(this->grabbedDistDiff.y) + SQ(this->grabbedDistDiff.z));
Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos); Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos);

View file

@ -48,7 +48,7 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->actor, sInitChain);
this->radius = 0; this->radius = 0;
this->unk_158 = 1.0f; this->unk_158 = 1.0f;
ArrowFire_SetupAction(&this->actor, ArrowFire_Charge); ArrowFire_SetupAction(this, ArrowFire_Charge);
Actor_SetScale(&this->actor, 0.01f); Actor_SetScale(&this->actor, 0.01f);
this->alpha = 160; this->alpha = 160;
this->timer = 0; this->timer = 0;

View file

@ -111,12 +111,12 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) {
} }
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
BgBdanObjects* this = THIS;
s32 pad; s32 pad;
BgBdanObjects* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(this, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(this, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
this->unk_168 = (thisx->params >> 8) & 0x3F; this->unk_168 = (thisx->params >> 8) & 0x3F;
thisx->params &= 0xFF; thisx->params &= 0xFF;
if (thisx->params == 2) { if (thisx->params == 2) {
@ -128,16 +128,16 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == 0) { if (thisx->params == 0) {
CollisionHeader_GetVirtual(&D_06008CE0, &colHeader); CollisionHeader_GetVirtual(&D_06008CE0, &colHeader);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, this, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
thisx->world.pos.y = (f32)(thisx->world.pos.y + -79.0f); thisx->world.pos.y += -79.0f;
if (Flags_GetClear(globalCtx, thisx->room)) { if (Flags_GetClear(globalCtx, thisx->room)) {
Flags_SetSwitch(globalCtx, this->unk_168); Flags_SetSwitch(globalCtx, this->unk_168);
this->actionFunc = func_8086C6EC; this->actionFunc = func_8086C6EC;
} else { } else {
if (BgBdanObjects_GetContactRu1(this, 4)) { if (BgBdanObjects_GetContactRu1(this, 4)) {
if (Actor_SpawnAsChild(&globalCtx->actorCtx, this, globalCtx, ACTOR_EN_BIGOKUTA, thisx->home.pos.x, if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA,
thisx->home.pos.y, thisx->home.pos.z, 0, thisx->shape.rot.y + 0x8000, 0, thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0,
3) != NULL) { thisx->shape.rot.y + 0x8000, 0, 3) != NULL) {
thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f; thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f;
} }
thisx->world.rot.y = 0; thisx->world.rot.y = 0;
@ -145,14 +145,14 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->world.pos.y = thisx->home.pos.y + -70.0f; thisx->world.pos.y = thisx->home.pos.y + -70.0f;
} else { } else {
Flags_SetSwitch(globalCtx, this->unk_168); Flags_SetSwitch(globalCtx, this->unk_168);
this->unk_16A = 0; this->timer = 0;
this->actionFunc = func_8086C054; this->actionFunc = func_8086C054;
} }
} }
} else { } else {
if (thisx->params == 1) { if (thisx->params == 1) {
CollisionHeader_GetVirtual(&D_06005048, &colHeader); CollisionHeader_GetVirtual(&D_06005048, &colHeader);
this->unk_16A = 0x200; this->timer = 512;
this->unk_168 = 0; this->unk_168 = 0;
this->actionFunc = func_8086C874; this->actionFunc = func_8086C874;
} else { } else {
@ -183,23 +183,21 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
if (BgBdanObjects_GetContactRu1(this, 0)) { if (BgBdanObjects_GetContactRu1(this, 0)) {
if (this->dyna.actor.xzDistToPlayer < 250.0f) { if (this->dyna.actor.xzDistToPlayer < 250.0f) {
BgBdanObjects_SetContactRu1(this, 1); BgBdanObjects_SetContactRu1(this, 1);
this->unk_16A = 0x14; this->timer = 20;
func_800800F8(globalCtx, 0xBFE, -0x63, &this->dyna.actor, 0); func_800800F8(globalCtx, 0xBFE, -0x63, &this->dyna.actor, 0);
player->actor.world.pos.x = -1130.0f; player->actor.world.pos.x = -1130.0f;
player->actor.world.pos.y = -1025.0f; player->actor.world.pos.y = -1025.0f;
player->actor.world.pos.z = -3300.0f; player->actor.world.pos.z = -3300.0f;
func_800AA000(0.0f, 0xFF, 0x14, 0x96); func_800AA000(0.0f, 0xFF, 0x14, 0x96);
} }
} else { } else if (this->timer != 0) {
if (this->unk_16A != 0) { if (this->timer != 0) {
if (this->unk_16A != 0) { this->timer--;
this->unk_16A -= 1;
} }
if (this->unk_16A == 0) { if (this->timer == 0) {
this->actionFunc = func_8086C1A0; this->actionFunc = func_8086C1A0;
} }
} }
}
if (!Gameplay_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) { if (!Gameplay_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f;
@ -213,16 +211,16 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
0.1f) { 0.1f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
this->actionFunc = func_8086C29C; this->actionFunc = func_8086C29C;
this->unk_16A = 0x1E; this->timer = 30;
BgBdanObjects_SetContactRu1(this, 2); BgBdanObjects_SetContactRu1(this, 2);
func_800AA000(0.0f, 0xFF, 0x14, 0x96); func_800AA000(0.0f, 0xFF, 0x14, 0x96);
} else { } else {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
if (this->unk_16A == 0) { if (this->timer == 0) {
func_800AA000(0.0f, 0x78, 0x14, 0xA); func_800AA000(0.0f, 0x78, 0x14, 0xA);
this->unk_16A = 0xB; this->timer = 11;
} }
func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_RISING - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_RISING - SFX_FLAG);
} }
@ -231,9 +229,9 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
s32 temp; s32 temp;
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
if (this->unk_16A == 0) { if (this->timer == 0) {
temp = Quake_Add(ACTIVE_CAM, 1); temp = Quake_Add(ACTIVE_CAM, 1);
Quake_SetSpeed(temp, 0x3A98); Quake_SetSpeed(temp, 0x3A98);
Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1); Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
@ -246,7 +244,7 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f,
this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0); this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0);
BgBdanObjects_SetContactRu1(this, 4); BgBdanObjects_SetContactRu1(this, 4);
this->unk_16A = 0xA; this->timer = 10;
this->actionFunc = func_8086C55C; this->actionFunc = func_8086C55C;
func_8005B1A4(ACTIVE_CAM); func_8005B1A4(ACTIVE_CAM);
} }
@ -259,7 +257,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f, if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f,
this->dyna.actor.velocity.y)) { this->dyna.actor.velocity.y)) {
this->dyna.actor.world.rot.y = 0; this->dyna.actor.world.rot.y = 0;
this->unk_16A = 0x3C; this->timer = 60;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f;
this->actionFunc = func_8086C5BC; this->actionFunc = func_8086C5BC;
@ -272,12 +270,12 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
func_800AA000(0.0f, 0xFF, 0x1E, 0x96); func_800AA000(0.0f, 0xFF, 0x1E, 0x96);
} else { } else {
func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG);
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
if (this->unk_16A == 0) { if (this->timer == 0) {
func_800AA000(0.0f, 0x78, 0x14, 0xA); func_800AA000(0.0f, 0x78, 0x14, 0xA);
this->unk_16A = 0xB; this->timer = 11;
} }
if (this->dyna.actor.child != NULL) { if (this->dyna.actor.child != NULL) {
this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f;
@ -286,22 +284,21 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) {
this->unk_16A -= 1; this->timer--;
if (this->unk_16A == 0) { if (this->timer == 0) {
Flags_UnsetSwitch(globalCtx, this->unk_168); Flags_UnsetSwitch(globalCtx, this->unk_168);
} else if (this->unk_16A == -0x28) { } else if (this->timer == -40) {
this->unk_16A = 0; this->timer = 0;
this->actionFunc = func_8086C3D8; this->actionFunc = func_8086C3D8;
} }
} }
void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
if (this->unk_16A == 0) { if ((this->timer == 0) && (this->dyna.actor.child != NULL)) {
if (this->dyna.actor.child != NULL) {
if (this->dyna.actor.child->params == 2) { if (this->dyna.actor.child->params == 2) {
this->actionFunc = func_8086C618; this->actionFunc = func_8086C618;
} else if (this->dyna.actor.child->params == 0) { } else if (this->dyna.actor.child->params == 0) {
@ -309,7 +306,6 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
} }
} }
}
void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
Collider_UpdateCylinder(&this->dyna.actor, &this->collider); Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
@ -335,7 +331,7 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
if (func_8004356C(&this->dyna.actor)) { if (func_8004356C(&this->dyna)) {
if (this->dyna.actor.xzDistToPlayer < 120.0f) { if (this->dyna.actor.xzDistToPlayer < 120.0f) {
this->actionFunc = func_8086C7D0; this->actionFunc = func_8086C7D0;
func_800800F8(globalCtx, 0xC12, -0x63, &this->dyna.actor, 0); func_800800F8(globalCtx, 0xC12, -0x63, &this->dyna.actor, 0);
@ -357,11 +353,11 @@ void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
if (this->unk_168 == 0) { if (this->unk_168 == 0) {
if (func_8004356C(&this->dyna.actor)) { if (func_8004356C(&this->dyna)) {
this->cameraSetting = globalCtx->cameraPtrs[0]->setting; this->cameraSetting = globalCtx->cameraPtrs[0]->setting;
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2);
func_8005AD1C(globalCtx->cameraPtrs[0], 4); func_8005AD1C(globalCtx->cameraPtrs[0], 4);
@ -369,62 +365,62 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
} else { } else {
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2);
if (!func_8004356C(&this->dyna.actor)) { if (!func_8004356C(&this->dyna)) {
if (this->unk_168 != 0) { if (this->unk_168 != 0) {
this->unk_168 -= 1; this->unk_168--;
} }
} }
if (this->unk_168 == 0) { if (this->unk_168 == 0) {
do { do {
} while (0); } while (0);
Camera_ChangeSetting(globalCtx->cameraPtrs[0], (s16)this->cameraSetting); Camera_ChangeSetting(globalCtx->cameraPtrs[0], this->cameraSetting);
func_8005ACFC(globalCtx->cameraPtrs[0], 4); func_8005ACFC(globalCtx->cameraPtrs[0], 4);
} }
} }
this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y =
this->dyna.actor.home.pos.y - (sinf((f32)this->unk_16A * (M_PI / 256.0f)) * 471.239990234375f); // pi * 150 this->dyna.actor.home.pos.y - (sinf(this->timer * (M_PI / 256.0f)) * 471.239990234375f); // pi * 150
if (this->unk_16A == 0) { if (this->timer == 0) {
this->unk_16A = 0x200; this->timer = 512;
} }
} }
void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->unk_168)) { if (Flags_GetSwitch(globalCtx, this->unk_168)) {
this->unk_16A = 0x64; this->timer = 100;
this->actionFunc = func_8086C9F0; this->actionFunc = func_8086C9F0;
} }
} }
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A == 0) { if (this->timer == 0) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) {
Flags_UnsetSwitch(globalCtx, this->unk_168); Flags_UnsetSwitch(globalCtx, this->unk_168);
this->actionFunc = func_8086C9A8; this->actionFunc = func_8086C9A8;
} }
func_8002F948(this, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
} else { } else {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 75.0f, 0.5f)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 75.0f, 0.5f)) {
this->actionFunc = func_8086CABC; this->actionFunc = func_8086CABC;
} }
func_8002F948(this, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
} }
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y; globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y;
} }
void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
func_8002F994(&this->dyna.actor, this->unk_16A); func_8002F994(&this->dyna.actor, this->timer);
if (this->unk_16A == 0) { if (this->timer == 0) {
this->actionFunc = func_8086C9F0; this->actionFunc = func_8086C9F0;
} }
} }
void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) {
if (func_8004356C(&this->dyna.actor)) { if (func_8004356C(&this->dyna)) {
Flags_SetSwitch(globalCtx, this->unk_168); Flags_SetSwitch(globalCtx, this->unk_168);
this->unk_16A = 0x32; this->timer = 50;
this->actionFunc = func_8086CB8C; this->actionFunc = func_8086CB8C;
this->dyna.actor.home.pos.y -= 200.0f; this->dyna.actor.home.pos.y -= 200.0f;
func_800800F8(globalCtx, 0xC1C, 0x33, &this->dyna.actor, 0); func_800800F8(globalCtx, 0xC1C, 0x33, &this->dyna.actor, 0);
@ -432,12 +428,14 @@ void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) {
} }
void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->unk_16A * (M_PI / 50.0f)) * 200.0f);
if (this->unk_16A == 0) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 50.0f)) * 200.0f);
Audio_PlayActorSound2(this, NA_SE_EV_BUYOSTAND_STOP_U);
if (this->timer == 0) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->actionFunc = BgBdanObjects_DoNothing; this->actionFunc = BgBdanObjects_DoNothing;
Gameplay_CopyCamera(globalCtx, 0, -1); Gameplay_CopyCamera(globalCtx, 0, -1);
} else { } else {

View file

@ -12,7 +12,7 @@ typedef struct BgBdanObjects {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgBdanObjectsActionFunc actionFunc; /* 0x0164 */ BgBdanObjectsActionFunc actionFunc;
/* 0x0168 */ u8 unk_168; /* 0x0168 */ u8 unk_168;
/* 0x016A */ s16 unk_16A; /* 0x016A */ s16 timer;
/* 0x016C */ ColliderCylinder collider; /* 0x016C */ ColliderCylinder collider;
/* 0x01B8 */ s32 cameraSetting; /* 0x01B8 */ s32 cameraSetting;
} BgBdanObjects; // size = 0x01BC } BgBdanObjects; // size = 0x01BC

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_bdan_switch.c * File: z_bg_bdan_switch.c
* Overlay: Bg_Bdan_Switch * Overlay: ovl_Bg_Bdan_Switch
* Description: Switches Inside Lord Jabu-Jabu * Description: Switches Inside Lord Jabu-Jabu
*/ */

View file

@ -38,10 +38,10 @@ static InitChainEntry sInitChain[] = {
}; };
typedef enum { typedef enum {
STATE_GO_BOTTOM, /* 0 */ STATE_GO_BOTTOM,
STATE_GO_MIDDLE_FROM_BOTTOM, /* 1 */ STATE_GO_MIDDLE_FROM_BOTTOM,
STATE_GO_MIDDLE_FROM_TOP, /* 2 */ STATE_GO_MIDDLE_FROM_TOP,
STATE_GO_TOP, /* 3 */ STATE_GO_TOP
} BgDdanJdState; } BgDdanJdState;
#define MOVE_HEIGHT_MIDDLE 140.0f #define MOVE_HEIGHT_MIDDLE 140.0f
@ -55,14 +55,14 @@ typedef enum {
#define SHORTCUT_Y_SPEED 5 #define SHORTCUT_Y_SPEED 5
void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
BgDdanJd* this = THIS;
s32 pad; s32 pad;
BgDdanJd* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(thisx, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
CollisionHeader_GetVirtual(&D_06003CE0, &colHeader); CollisionHeader_GetVirtual(&D_06003CE0, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->idleTimer = IDLE_FRAMES; this->idleTimer = IDLE_FRAMES;
this->state = STATE_GO_BOTTOM; this->state = STATE_GO_BOTTOM;

View file

@ -58,10 +58,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 32767, ICHAIN_STOP), ICHAIN_F32(uncullZoneForward, 32767, ICHAIN_STOP),
}; };
static f32 D_808718FC[] = { 0.0f, 5.0f };
static f32 D_80871904[] = { 0.0f };
static f32 D_80871908[] = { 0.0f, -0.45f, 0.0f, 0.0f, 0.0f, 0.0f };
extern CollisionHeader D_06004F30; extern CollisionHeader D_06004F30;
extern Gfx D_060048A8[]; extern Gfx D_060048A8[];
@ -77,7 +73,7 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
this->prevExplosive = NULL; this->prevExplosive = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna.actor, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
CollisionHeader_GetVirtual(&D_06004F30, &colHeader); CollisionHeader_GetVirtual(&D_06004F30, &colHeader);
@ -102,7 +98,7 @@ void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
Actor* explosive; Actor* explosive;
explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider); explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider.base);
if (explosive != NULL) { if (explosive != NULL) {
osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage); osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage);
explosive->params = 2; explosive->params = 2;
@ -110,7 +106,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) && if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) &&
(Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) { (Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) {
BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs); BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs);
func_800800F8(globalCtx, 0xBEA, 0x3E7, this, 0); func_800800F8(globalCtx, 0xBEA, 0x3E7, &this->dyna.actor, 0);
} else { } else {
if (this->timer != 0) { if (this->timer != 0) {
this->timer -= 1; this->timer -= 1;
@ -127,6 +123,8 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
} }
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
static Vec3f D_808718FC = { 0.0f, 5.0f, 0.0f };
static Vec3f D_80871908 = { 0.0f, -0.45f, 0.0f };
Vec3f sp5C; Vec3f sp5C;
Vec3f sp50; Vec3f sp50;
f32 sp4C; f32 sp4C;
@ -159,8 +157,8 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1); func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1);
func_80033480(globalCtx, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1); func_80033480(globalCtx, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1);
D_808718FC[0] = Rand_CenteredFloat(3.0f); D_808718FC.x = Rand_CenteredFloat(3.0f);
D_80871904[0] = Rand_CenteredFloat(3.0f); D_808718FC.z = Rand_CenteredFloat(3.0f);
func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908); func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908);
func_8003555C(globalCtx, &sp50, &D_808718FC, &D_80871908); func_8003555C(globalCtx, &sp50, &D_808718FC, &D_80871908);
@ -189,5 +187,5 @@ void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, &D_060048A8); Gfx_DrawDListOpa(globalCtx, D_060048A8);
} }

View file

@ -112,7 +112,6 @@ extern CollisionHeader D_06009CD0;
void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
static UNK_TYPE D_80881014 = 0; static UNK_TYPE D_80881014 = 0;
BgHakaTrap* this = THIS; BgHakaTrap* this = THIS;
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
@ -167,7 +166,7 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
} }
Collider_InitTris(globalCtx, &this->colliderSpikes); Collider_InitTris(globalCtx, &this->colliderSpikes);
Collider_SetTris(globalCtx, &this->colliderSpikes, thisx, &sTrisInit, &this->colliderSpikesItem); Collider_SetTris(globalCtx, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem);
this->colliderCylinder.dim.radius = 18; this->colliderCylinder.dim.radius = 18;
this->colliderCylinder.dim.height = 115; this->colliderCylinder.dim.height = 115;
@ -192,10 +191,10 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgHakaTrap* this = THIS; BgHakaTrap* this = THIS;
if (thisx->params != HAKA_TRAP_PROPELLER) { if (this->dyna.actor.params != HAKA_TRAP_PROPELLER) {
if (thisx->params != HAKA_TRAP_GUILLOTINE_SLOW) { if (this->dyna.actor.params != HAKA_TRAP_GUILLOTINE_SLOW) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
if ((thisx->params == HAKA_TRAP_SPIKED_WALL) || (thisx->params == HAKA_TRAP_SPIKED_WALL_2)) { if ((this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) || (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_2)) {
Collider_DestroyTris(globalCtx, &this->colliderSpikes); Collider_DestroyTris(globalCtx, &this->colliderSpikes);
} }
} }
@ -485,11 +484,11 @@ void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) {
void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
BgHakaTrap* this = THIS; BgHakaTrap* this = THIS;
Vec3f* actorPos = &thisx->world.pos; Vec3f* actorPos = &this->dyna.actor.world.pos;
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
if ((thisx->params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) { if ((this->dyna.actor.params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) {
this->colliderCylinder.dim.pos.y = actorPos->y; this->colliderCylinder.dim.pos.y = actorPos->y;
if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) {
@ -532,7 +531,7 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80026230(globalCtx, &D_8088103C, this->timer + 20, 0x28); func_80026230(globalCtx, &D_8088103C, this->timer + 20, 0x28);
} }
Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]);
if (this->actionFunc == func_808801B8) { if (this->actionFunc == func_808801B8) {
func_80880D68(this); func_80880D68(this);
@ -543,9 +542,9 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
if ((this->actionFunc == func_808808F4) && !this->unk_169) { if ((this->actionFunc == func_808808F4) && !this->unk_169) {
sp2C.x = thisx->world.pos.x; sp2C.x = this->dyna.actor.world.pos.x;
sp2C.z = thisx->world.pos.z; sp2C.z = this->dyna.actor.world.pos.z;
sp2C.y = thisx->world.pos.y + 110.0f; sp2C.y = this->dyna.actor.world.pos.y + 110.0f;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &sp2C, &this->unk_16C); SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &sp2C, &this->unk_16C);
func_80078914(&this->unk_16C, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); func_80078914(&this->unk_16C, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG);

View file

@ -10,7 +10,7 @@ typedef enum {
/* 0x02 */ HAKA_TRAP_SPIKED_WALL, /* 0x02 */ HAKA_TRAP_SPIKED_WALL,
/* 0x03 */ HAKA_TRAP_SPIKED_WALL_2, /* 0x03 */ HAKA_TRAP_SPIKED_WALL_2,
/* 0x04 */ HAKA_TRAP_PROPELLER, /* 0x04 */ HAKA_TRAP_PROPELLER,
/* 0x05 */ HAKA_TRAP_GUILLOTINE_FAST, /* 0x05 */ HAKA_TRAP_GUILLOTINE_FAST
} HakaTrapType; } HakaTrapType;
struct BgHakaTrap; struct BgHakaTrap;

View file

@ -355,7 +355,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) {
if (this->timer == 11) { if (this->timer == 11) {
func_800AA000(0.0f, 0xFF, 0x14, 0x14); func_800AA000(0.0f, 0xFF, 0x14, 0x14);
func_8002F7DC(player, NA_SE_PL_PULL_UP_BIGROCK); func_8002F7DC(&player->actor, NA_SE_PL_PULL_UP_BIGROCK);
LOG_STRING("NA_SE_PL_PULL_UP_BIGROCK", "../z_bg_heavy_block.c", 691); LOG_STRING("NA_SE_PL_PULL_UP_BIGROCK", "../z_bg_heavy_block.c", 691);
} }
@ -372,7 +372,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) {
this->timer++; this->timer++;
func_8002DF54(globalCtx, player, 8); func_8002DF54(globalCtx, &player->actor, 8);
// if parent is NULL, link threw it // if parent is NULL, link threw it
if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) { if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) {

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_hidan_fslift.c * File: z_bg_hidan_fslift.c
* Overlay: Bg_Hidan_Fslift * Overlay: ovl_Bg_Hidan_Fslift
* Description: Hookshot Elevator * Description: Hookshot Elevator
*/ */
@ -42,33 +42,32 @@ static InitChainEntry sInitChain[] = {
}; };
void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgHidanFslift* this = THIS;
s32 pad1; s32 pad1;
BgHidanFslift* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(thisx, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
CollisionHeader_GetVirtual(&D_0600E1E8, &colHeader); CollisionHeader_GetVirtual(&D_0600E1E8, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
if (Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_HSBLOCK, thisx->world.pos.x, if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_HSBLOCK,
thisx->world.pos.y + 40.0f, thisx->world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 40.0f,
Actor_Kill(thisx); this->dyna.actor.world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) {
Actor_Kill(&this->dyna.actor);
return; return;
} }
this->actionFunc = func_80886FCC; this->actionFunc = func_80886FCC;
} }
void func_80886F24(BgHidanFslift* this) { void func_80886F24(BgHidanFslift* this) {
Actor* thisx = &this->dyna.actor; if (this->dyna.actor.child != NULL && this->dyna.actor.child->update != NULL) {
this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x;
if (thisx->child != NULL && thisx->child->update != NULL) { this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 40.0f;
thisx->child->world.pos.x = thisx->world.pos.x; this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z + -28.0f;
thisx->child->world.pos.y = thisx->world.pos.y + 40.0f; } else {
thisx->child->world.pos.z = thisx->world.pos.z + -28.0f; this->dyna.actor.child = NULL;
return;
} }
thisx->child = NULL;
} }
void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -78,54 +77,47 @@ void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
} }
void func_80886FB4(BgHidanFslift* this) { void func_80886FB4(BgHidanFslift* this) {
this->unk_168 = 0x28; this->timer = 40;
this->actionFunc = func_80886FCC; this->actionFunc = func_80886FCC;
} }
void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) {
s32 heightBool; s32 heightBool;
Actor* thisx = &this->dyna.actor;
DECR(this->unk_168); if (this->timer) {
this->timer--;
}
if (this->unk_168 == 0) { if (this->timer == 0) {
heightBool = false; heightBool = false;
if ((thisx->world.pos.y - thisx->home.pos.y) < 0.5f) { if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) < 0.5f) {
heightBool = true; heightBool = true;
} }
if (func_80043590(thisx)) { if (func_80043590(&this->dyna) && (heightBool)) {
if (heightBool) {
this->actionFunc = func_808870D8; this->actionFunc = func_808870D8;
return; } else if (!heightBool) {
}
}
if (!heightBool) {
this->actionFunc = func_8088706C; this->actionFunc = func_8088706C;
} }
} }
} }
void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.0f)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y, 4.0f)) {
Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND);
func_80886FB4(this); func_80886FB4(this);
} else { } else {
func_8002F974(thisx, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG);
} }
func_80886F24(this); func_80886F24(this);
} }
void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (func_80043590(&this->dyna)) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) {
if (func_80043590(thisx)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 790.0f, 4.0f)) {
Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND);
func_80886FB4(this); func_80886FB4(this);
} else { } else {
func_8002F974(thisx, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG);
} }
} else { } else {
func_80886FB4(this); func_80886FB4(this);
@ -137,12 +129,12 @@ void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx) {
BgHidanFslift* this = THIS; BgHidanFslift* this = THIS;
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
if (func_8004356C(thisx)) { if (func_8004356C(&this->dyna)) {
if (this->unk_16A == 0) { if (this->unk_16A == 0) {
this->unk_16A = 3; this->unk_16A = 3;
} }
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_HIDAN1); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_HIDAN1);
} else if (func_8004356C(thisx) == 0) { } else if (!func_8004356C(&this->dyna)) {
if (this->unk_16A != 0) { if (this->unk_16A != 0) {
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0);
} }

View file

@ -11,7 +11,7 @@ typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, GlobalContext*);
typedef struct BgHidanFslift { typedef struct BgHidanFslift {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHidanFsliftActionFunc actionFunc; /* 0x0164 */ BgHidanFsliftActionFunc actionFunc;
/* 0x0168 */ s16 unk_168; /* 0x0168 */ s16 timer;
/* 0x016A */ s16 unk_16A; /* 0x016A */ s16 unk_16A;
} BgHidanFslift; // size = 0x016C } BgHidanFslift; // size = 0x016C

View file

@ -40,7 +40,9 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
}; };
extern CollisionHeader D_0600E2CC, D_0600E380, D_0600E430; extern CollisionHeader D_0600E2CC;
extern CollisionHeader D_0600E380;
extern CollisionHeader D_0600E430;
static CollisionHeader* D_80889E70[] = { static CollisionHeader* D_80889E70[] = {
&D_0600E2CC, &D_0600E2CC,
@ -55,7 +57,7 @@ static s16 D_80889E7C[] = {
0x0000, 0x0000,
}; };
static Gfx (*D_80889E84[])[] = { static Gfx* D_80889E84[] = {
0x0600C798, 0x0600C798,
0x0600BFA8, 0x0600BFA8,
0x0600BB58, 0x0600BB58,
@ -101,10 +103,9 @@ void func_80889ACC(BgHidanKousi* this) {
Vec3s* rot = &this->dyna.actor.world.rot; Vec3s* rot = &this->dyna.actor.world.rot;
f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_SinS(rot->y); f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_SinS(rot->y);
f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_CosS(rot->y); f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_CosS(rot->y);
Vec3f* initPos = &this->dyna.actor.home.pos;
this->dyna.actor.world.pos.x = initPos->x + temp1; this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp1;
this->dyna.actor.world.pos.z = initPos->z + temp2; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2;
} }
void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) { void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) {

View file

@ -271,7 +271,7 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext
arg5 |= 1; arg5 |= 1;
} }
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world, -650, arg5, 20, 20, 0, arg9, 2, 32, 100, EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &thisx->world.pos, -650, arg5, 20, 20, 0, arg9, 2, 32, 100,
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, D_05000530); KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_DANGEON_KEEP, D_05000530);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_hidan_syoku.c * File: z_bg_hidan_syoku.c
* Overlay: Bg_Hidan_Syoku * Overlay: ovl_Bg_Hidan_Syoku
* Description: Stone Elevator in the Fire Temple * Description: Stone Elevator in the Fire Temple
*/ */
@ -39,8 +39,8 @@ extern Gfx D_0600A7E0[];
extern CollisionHeader* D_0600E568; extern CollisionHeader* D_0600E568;
void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) {
BgHidanSyoku* this = THIS;
s32 pad; s32 pad;
BgHidanSyoku* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
@ -58,24 +58,24 @@ void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx) {
} }
void func_8088F47C(BgHidanSyoku* this) { void func_8088F47C(BgHidanSyoku* this) {
this->unk_16A = 0x3C; this->timer = 60;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
this->actionFunc = func_8088F62C; this->actionFunc = func_8088F62C;
} }
void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx) { void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx) {
if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna.actor)) { if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna)) {
this->unk_16A = 0x8C; this->timer = 140;
this->actionFunc = func_8088F514; this->actionFunc = func_8088F514;
} }
} }
void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
this->dyna.actor.world.pos.y = (cosf(this->unk_16A * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y; this->dyna.actor.world.pos.y = (cosf(this->timer * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y;
if (this->unk_16A == 0) { if (this->timer == 0) {
func_8088F47C(this); func_8088F47C(this);
} else { } else {
func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG);
@ -83,11 +83,11 @@ void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) {
} }
void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) { void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->unk_16A * (M_PI / 140)) * 540.0f); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 140)) * 540.0f);
if (this->unk_16A == 0) { if (this->timer == 0) {
func_8088F47C(this); func_8088F47C(this);
} else { } else {
func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG);
@ -95,11 +95,11 @@ void func_8088F5A0(BgHidanSyoku* this, GlobalContext* globalCtx) {
} }
void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) { void func_8088F62C(BgHidanSyoku* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) { if (this->timer != 0) {
this->unk_16A -= 1; this->timer--;
} }
if (this->unk_16A == 0) { if (this->timer == 0) {
this->unk_16A = 0x8c; this->timer = 140;
if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y) { if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y) {
this->actionFunc = func_8088F514; this->actionFunc = func_8088F514;
} else { } else {
@ -112,12 +112,12 @@ void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx) {
BgHidanSyoku* this = THIS; BgHidanSyoku* this = THIS;
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
if (func_8004356C(&this->dyna.actor)) { if (func_8004356C(&this->dyna)) {
if (this->unk_168 == 0) { if (this->unk_168 == 0) {
this->unk_168 = 3; this->unk_168 = 3;
} }
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_HIDAN1); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_HIDAN1);
} else if (!func_8004356C(&this->dyna.actor)) { } else if (!func_8004356C(&this->dyna)) {
if (this->unk_168 != 0) { if (this->unk_168 != 0) {
Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0); Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0);
} }

View file

@ -12,9 +12,9 @@ typedef struct BgHidanSyoku {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHidanSyokuActionFunc actionFunc; /* 0x0164 */ BgHidanSyokuActionFunc actionFunc;
/* 0x0168 */ s16 unk_168; /* 0x0168 */ s16 unk_168;
/* 0x016A */ s16 unk_16A; /* 0x016A */ s16 timer;
} BgHidanSyoku; // size = 0x016C } BgHidanSyoku; // size = 0x016C
extern const ActorInit Bg_Hidan_Syoku_InitVars; extern const ActorInit Bg_Hidan_Syoku_InitVars;
#endif; #endif

View file

@ -51,12 +51,12 @@ void func_808932C0(BgJyaAmishutter* this, GlobalContext* globalCtx, CollisionHea
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s16 pad2; s16 pad2;
DynaPolyActor_Init(&this->actor, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129,
this->actor.id, this->actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
} }
@ -64,14 +64,14 @@ void BgJyaAmishutter_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaAmishutter* this = THIS; BgJyaAmishutter* this = THIS;
func_808932C0(this, globalCtx, &D_0600C4C8, DPM_UNK); func_808932C0(this, globalCtx, &D_0600C4C8, DPM_UNK);
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
func_808933BC(this); func_808933BC(this);
} }
void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgJyaAmishutter* this = THIS; BgJyaAmishutter* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void func_808933BC(BgJyaAmishutter* this) { void func_808933BC(BgJyaAmishutter* this) {
@ -79,8 +79,8 @@ void func_808933BC(BgJyaAmishutter* this) {
} }
void func_808933CC(BgJyaAmishutter* this) { void func_808933CC(BgJyaAmishutter* this) {
if (this->actor.xzDistToPlayer < 60.0f) { if (this->dyna.actor.xzDistToPlayer < 60.0f) {
if (fabsf(this->actor.yDistToPlayer) < 30.0f) { if (fabsf(this->dyna.actor.yDistToPlayer) < 30.0f) {
func_80893428(this); func_80893428(this);
} }
} }
@ -91,11 +91,11 @@ void func_80893428(BgJyaAmishutter* this) {
} }
void func_80893438(BgJyaAmishutter* this) { void func_80893438(BgJyaAmishutter* this) {
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 100.0f, 3.0f)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 100.0f, 3.0f)) {
func_808934B0(this); func_808934B0(this);
Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP);
} else { } else {
func_8002F974(&this->actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG);
} }
} }
@ -104,7 +104,7 @@ void func_808934B0(BgJyaAmishutter* this) {
} }
void func_808934C0(BgJyaAmishutter* this) { void func_808934C0(BgJyaAmishutter* this) {
if (this->actor.xzDistToPlayer > 300.0f) { if (this->dyna.actor.xzDistToPlayer > 300.0f) {
func_808934FC(this); func_808934FC(this);
} }
} }
@ -114,11 +114,11 @@ void func_808934FC(BgJyaAmishutter* this) {
} }
void func_8089350C(BgJyaAmishutter* this) { void func_8089350C(BgJyaAmishutter* this) {
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 3.0f)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.0f)) {
func_808933BC(this); func_808933BC(this);
Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP);
} else { } else {
func_8002F974(&this->actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG);
} }
} }

View file

@ -9,9 +9,7 @@ struct BgJyaAmishutter;
typedef void (*BgJyaAmishutterActionFunc)(struct BgJyaAmishutter*); typedef void (*BgJyaAmishutterActionFunc)(struct BgJyaAmishutter*);
typedef struct BgJyaAmishutter { typedef struct BgJyaAmishutter {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId;
/* 0x0150 */ char unk_150[0x14];
/* 0x0164 */ BgJyaAmishutterActionFunc actionFunc; /* 0x0164 */ BgJyaAmishutterActionFunc actionFunc;
} BgJyaAmishutter; // size = 0x0168 } BgJyaAmishutter; // size = 0x0168

View file

@ -84,14 +84,14 @@ void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) {
void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) { void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaBombchuiwa* this = THIS; BgJyaBombchuiwa* this = THIS;
Actor_ProcessInitChain(thisx, &sInitChain); Actor_ProcessInitChain(&this->actor, sInitChain);
BgJyaBombchuiwa_SetupCollider(thisx, globalCtx); BgJyaBombchuiwa_SetupCollider(this, globalCtx);
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) {
BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); BgJyaBombchuiwa_SpawnLightRay(this, globalCtx);
} else { } else {
BgJyaBombchuiwa_SetupWaitForExplosion(this, globalCtx); BgJyaBombchuiwa_SetupWaitForExplosion(this, globalCtx);
} }
Actor_SetFocus(thisx, 0.0f); Actor_SetFocus(&this->actor, 0.0f);
} }
void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
@ -233,7 +233,7 @@ void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgJyaBombchuiwa* this = THIS; BgJyaBombchuiwa* this = THIS;
if (this->drawFlags & 1) { if (this->drawFlags & 1) {
Gfx_DrawDListOpa(globalCtx, &D_0600E8D0); Gfx_DrawDListOpa(globalCtx, D_0600E8D0);
Collider_UpdateSpheres(0, &this->collider); Collider_UpdateSpheres(0, &this->collider);
} }

View file

@ -1,3 +1,9 @@
/*
* File: z_bg_jya_bombiwa.c
* Overlay: ovl_Bg_Jya_Bombiwa
* Description: Spirit Temple top room bombable wall
*/
#include "z_bg_jya_bombiwa.h" #include "z_bg_jya_bombiwa.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "vt.h" #include "vt.h"
@ -46,7 +52,7 @@ static ColliderJntSphInit sJntSphInit = {
COLSHAPE_JNTSPH, COLSHAPE_JNTSPH,
}, },
1, 1,
&sJntSphElementsInit, sJntSphElementsInit,
}; };
static InitChainEntry sInitChain[] = { static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
@ -76,30 +82,32 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, GlobalContext* globalCtx, vo
} }
void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, GlobalContext* globalCtx) { void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; s32 pad;
Collider_InitJntSph(globalCtx, &this->collider); Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, &this->colliderItems); Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems);
} }
void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
if ((thisx->params & 0x3F) != 0x29) { BgJyaBombiwa* this = THIS;
if ((this->dyna.actor.params & 0x3F) != 0x29) {
osSyncPrintf(VT_COL(YELLOW, BLACK)); osSyncPrintf(VT_COL(YELLOW, BLACK));
// Warning: Switch Number changed (%s %d)(SW %d // Warning: Switch Number changed (%s %d)(SW %d
osSyncPrintf(" : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218, osSyncPrintf(" : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218,
thisx->params & 0x3F); this->dyna.actor.params & 0x3F);
osSyncPrintf(VT_SGR()); osSyncPrintf(VT_RST);
} }
BgJyaBombiwa_SetupDynaPoly(thisx, globalCtx, &D_0600E710, DPM_UNK); BgJyaBombiwa_SetupDynaPoly(this, globalCtx, &D_0600E710, DPM_UNK);
BgJyaBombiwa_InitCollider(thisx, globalCtx); BgJyaBombiwa_InitCollider(this, globalCtx);
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
Actor_Kill(thisx); Actor_Kill(&this->dyna.actor);
} else { } else {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
// Rock destroyed by jya bomb // Rock destroyed by jya bomb
osSyncPrintf("(jya 爆弾で破壊岩)(arg_data 0x%04x)\n", thisx->params); osSyncPrintf("(jya 爆弾で破壊岩)(arg_data 0x%04x)\n", this->dyna.actor.params);
} }
} }
@ -160,7 +168,7 @@ void BgJyaBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) { if (this->collider.base.acFlags & AC_HIT) {
BgJyaBombiwa_Break(this, globalCtx); BgJyaBombiwa_Break(this, globalCtx);
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world, 40, NA_SE_EV_WALL_BROKEN); Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN);
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);
} else { } else {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);

View file

@ -11,7 +11,7 @@ typedef struct BgJyaBombiwa {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ s32 unk_164; /* 0x0164 */ s32 unk_164;
/* 0x0168 */ ColliderJntSph collider; /* 0x0168 */ ColliderJntSph collider;
/* 0x0188 */ ColliderJntSphElement colliderItems; /* 0x0188 */ ColliderJntSphElement colliderItems[1];
} BgJyaBombiwa; // size = 0x01C8 } BgJyaBombiwa; // size = 0x01C8
extern const ActorInit Bg_Jya_Bombiwa_InitVars; extern const ActorInit Bg_Jya_Bombiwa_InitVars;

View file

@ -189,13 +189,13 @@ void func_80895A70(BgJyaCobra* this) {
} }
break; break;
case 1: case 1:
phi_v0 = temp_v1->lightBeams[1]; phi_v0 = (MirRay*)temp_v1->lightBeams[1];
if (phi_v0 == NULL) { if (phi_v0 == NULL) {
return; return;
} }
break; break;
case 2: case 2:
phi_v0 = temp_v1->lightBeams[2]; phi_v0 = (MirRay*)temp_v1->lightBeams[2];
if (phi_v0 == NULL) { if (phi_v0 == NULL) {
return; return;
} }

View file

@ -151,7 +151,7 @@ void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
this->collider.base.atFlags &= ~AT_HIT & ~AT_ON; this->collider.base.atFlags &= ~AT_HIT & ~AT_ON;
tmp16 = thisx->yawTowardsPlayer - thisx->world.rot.y; tmp16 = thisx->yawTowardsPlayer - thisx->world.rot.y;
if ((tmp16 >= -0x3FFF) && (tmp16 < 0x4000)) { if ((tmp16 > -0x4000) && (tmp16 < 0x4000)) {
thisx->world.rot.y += 0x8000; thisx->world.rot.y += 0x8000;
} }
@ -197,10 +197,10 @@ void func_80897DF0(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
} }
void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 pad; s32 pad;
BgJyaGoroiwa* this = THIS; BgJyaGoroiwa* this = THIS;
UNK_PTR sp38; Player* player = PLAYER;
s32 bgId;
Vec3f pos; Vec3f pos;
if (!(player->stateFlags1 & 0x300000C0)) { if (!(player->stateFlags1 & 0x300000C0)) {
@ -210,7 +210,7 @@ void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
pos.y = this->actor.world.pos.y + 59.5f; pos.y = this->actor.world.pos.y + 59.5f;
pos.z = this->actor.world.pos.z; pos.z = this->actor.world.pos.z;
this->actor.floorHeight = this->actor.floorHeight =
BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &pos); BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos);
func_80897970(this); func_80897970(this);
if (this->collider.base.atFlags & AT_ON) { if (this->collider.base.atFlags & AT_ON) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);

View file

@ -1,7 +1,7 @@
/* /*
* File: z_bg_jya_kanaami.c * File: z_bg_jya_kanaami.c
* Overlay: Bg_Jya_Kanaami * Overlay: ovl_Bg_Jya_Kanaami
* Description: Climbable Metal Grating (Fire Temple) * Description: Climbable grating/bridge (Spirit Temple)
*/ */
#include "z_bg_jya_kanaami.h" #include "z_bg_jya_kanaami.h"
@ -48,12 +48,12 @@ void func_80899740(BgJyaKanaami* this, GlobalContext* globalCtx, CollisionHeader
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
DynaPolyActor_Init(&this->actor, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145,
this->actor.id, this->actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
} }
@ -61,19 +61,19 @@ void BgJyaKanaami_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaKanaami* this = THIS; BgJyaKanaami* this = THIS;
func_80899740(this, globalCtx, &D_0600F208, 0); func_80899740(this, globalCtx, &D_0600F208, 0);
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
func_80899A08(this); func_80899A08(this);
} else { } else {
func_80899880(this); func_80899880(this);
} }
osSyncPrintf("(jya 金網)(arg_data 0x%04x)\n", this->actor.params); osSyncPrintf("(jya 金網)(arg_data 0x%04x)\n", this->dyna.actor.params);
} }
void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgJyaKanaami_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgJyaKanaami* this = THIS; BgJyaKanaami* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void func_80899880(BgJyaKanaami* this) { void func_80899880(BgJyaKanaami* this) {
@ -82,9 +82,9 @@ void func_80899880(BgJyaKanaami* this) {
} }
void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) || this->unk_16A > 0) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) {
if (this->actor.world.pos.x > -1000.0f && this->unk_16A == 0) { if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) {
func_800800F8(globalCtx, 0xD7A, -0x63, &this->actor, 0); func_800800F8(globalCtx, 0xD7A, -0x63, &this->dyna.actor, 0);
} }
this->unk_16A += 1; this->unk_16A += 1;
if (this->unk_16A >= 0xA) { if (this->unk_16A >= 0xA) {
@ -101,10 +101,11 @@ void func_8089993C(BgJyaKanaami* this) {
void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) {
s32 pad[2]; s32 pad[2];
s32 var; s32 var;
this->unk_168 += 0x20; this->unk_168 += 0x20;
if (Math_ScaledStepToS(&this->actor.world.rot.x, 0x4000, this->unk_168)) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) {
func_80899A08(this); func_80899A08(this);
Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRAP_BOUND); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND);
var = Quake_Add(ACTIVE_CAM, 3); var = Quake_Add(ACTIVE_CAM, 3);
Quake_SetSpeed(var, 25000); Quake_SetSpeed(var, 25000);
Quake_SetQuakeValues(var, 2, 0, 0, 0); Quake_SetQuakeValues(var, 2, 0, 0, 0);
@ -114,7 +115,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) {
void func_80899A08(BgJyaKanaami* this) { void func_80899A08(BgJyaKanaami* this) {
this->actionFunc = 0; this->actionFunc = 0;
this->actor.world.rot.x = 0x4000; this->dyna.actor.world.rot.x = 0x4000;
} }
void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) { void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) {
@ -123,7 +124,7 @@ void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actionFunc != NULL) { if (this->actionFunc != NULL) {
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
} }
this->actor.shape.rot.x = this->actor.world.rot.x; this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x;
} }
void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgJyaKanaami_Draw(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -9,9 +9,7 @@ struct BgJyaKanaami;
typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, GlobalContext*); typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, GlobalContext*);
typedef struct BgJyaKanaami { typedef struct BgJyaKanaami {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId;
/* 0x014C */ char unk_150[0x14];
/* 0x0164 */ BgJyaKanaamiActionFunc actionFunc; /* 0x0164 */ BgJyaKanaamiActionFunc actionFunc;
/* 0x0168 */ s16 unk_168; /* 0x0168 */ s16 unk_168;
/* 0x016A */ s16 unk_16A; /* 0x016A */ s16 unk_16A;

View file

@ -39,24 +39,24 @@ void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->actor, DPM_UNK3); DynaPolyActor_Init(&this->dyna, DPM_UNK3);
CollisionHeader_GetVirtual(&D_060042D8, &colHeader); CollisionHeader_GetVirtual(&D_060042D8, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
} }
void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgMenkuriKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriKaiten* this = THIS; BgMenkuriKaiten* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx) { void BgMenkuriKaiten_Update(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriKaiten* this = THIS; BgMenkuriKaiten* this = THIS;
if (!Flags_GetSwitch(globalCtx, this->actor.params) && func_80043590(&this->actor)) { if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params) && func_80043590(&this->dyna)) {
func_8002F974(&this->actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
this->actor.shape.rot.y += 0x80; this->dyna.actor.shape.rot.y += 0x80;
} }
} }

View file

@ -7,9 +7,7 @@
struct BgMenkuriKaiten; struct BgMenkuriKaiten;
typedef struct BgMenkuriKaiten { typedef struct BgMenkuriKaiten {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId;
/* 0x0150 */ char unk_150[0x14];
} BgMenkuriKaiten; // size = 0x0164 } BgMenkuriKaiten; // size = 0x0164
extern const ActorInit Bg_Menkuri_Kaiten_InitVars; extern const ActorInit Bg_Menkuri_Kaiten_InitVars;

View file

@ -15,6 +15,8 @@ void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx); void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx);
void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx); void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx);
const ActorInit Bg_Mizu_Uzu_InitVars = { const ActorInit Bg_Mizu_Uzu_InitVars = {
ACTOR_BG_MIZU_UZU, ACTOR_BG_MIZU_UZU,
ACTORCAT_PROP, ACTORCAT_PROP,
@ -35,18 +37,17 @@ static InitChainEntry sInitChain[] = {
extern CollisionHeader D_060074EC; extern CollisionHeader D_060074EC;
void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx);
void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) {
BgMizuUzu* this = THIS;
s32 pad; s32 pad;
BgMizuUzu* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_060074EC, &colHeader); CollisionHeader_GetVirtual(&D_060074EC, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = func_8089F788; this->actionFunc = func_8089F788;
} }

View file

@ -79,7 +79,7 @@ void func_808A0850(BgMjin* this, GlobalContext* globalCtx) {
this->dyna.actor.flags &= ~0x10; this->dyna.actor.flags &= ~0x10;
this->dyna.actor.objBankIndex = this->objBankIndex; this->dyna.actor.objBankIndex = this->objBankIndex;
Actor_SetObjectDependency(globalCtx, &this->dyna.actor); Actor_SetObjectDependency(globalCtx, &this->dyna.actor);
DynaPolyActor_Init(&this->dyna.actor, 0); DynaPolyActor_Init(&this->dyna, 0);
collision = this->dyna.actor.params != 0 ? &D_06000658 : &D_06000330_; collision = this->dyna.actor.params != 0 ? &D_06000658 : &D_06000330_;
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -62,7 +62,7 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 t6; s32 t6;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna.actor, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
switchFlagParam = this->dyna.actor.params & 0x3F; switchFlagParam = this->dyna.actor.params & 0x3F;
t6 = this->dyna.actor.params & 0x4000; t6 = this->dyna.actor.params & 0x4000;

View file

@ -41,16 +41,16 @@ void BgPushbox_SetupAction(BgPushbox* this, BgPushboxActionFunc actionFunc) {
} }
void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) {
BgPushbox* this = THIS;
s32 pad; s32 pad;
BgPushbox* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06000350, &colHeader); CollisionHeader_GetVirtual(&D_06000350, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
BgPushbox_SetupAction(this, func_808A8BAC); BgPushbox_SetupAction(this, func_808A8BAC);
} }
@ -61,21 +61,19 @@ void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx) {
} }
void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) { void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; this->dyna.actor.speedXZ += this->dyna.unk_150 * 0.2f;
this->dyna.actor.speedXZ = (this->dyna.actor.speedXZ < -1.0f) ? -1.0f : ((this->dyna.actor.speedXZ > 1.0f) ? 1.0f : this->dyna.actor.speedXZ);
thisx->speedXZ += this->dyna.unk_150 * 0.2f; Math_StepToF(&this->dyna.actor.speedXZ, 0.0f, 0.2f);
thisx->speedXZ = (thisx->speedXZ < -1.0f) ? -1.0f : ((thisx->speedXZ > 1.0f) ? 1.0f : thisx->speedXZ); this->dyna.actor.world.rot.y = this->dyna.unk_158;
Math_StepToF(&thisx->speedXZ, 0.0f, 0.2f); Actor_MoveForward(&this->dyna.actor);
thisx->world.rot.y = this->dyna.unk_158; Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 40.0f, 40.0f, 0x1D);
Actor_MoveForward(thisx);
Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 40.0f, 40.0f, 0x1D);
} }
void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) { void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) {
BgPushbox* this = THIS; BgPushbox* this = THIS;
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
func_8002DF90(this); func_8002DF90(&this->dyna);
} }
void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -44,26 +44,26 @@ void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
if (this->actor.params == 1) { if (this->dyna.actor.params == 1) {
CollisionHeader_GetVirtual(&D_06000AF0, &colHeader); CollisionHeader_GetVirtual(&D_06000AF0, &colHeader);
} else { } else {
CollisionHeader_GetVirtual(&D_06000908, &colHeader); CollisionHeader_GetVirtual(&D_06000908, &colHeader);
} }
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (LINK_IS_CHILD) { if (LINK_IS_CHILD) {
Actor_Kill(&this->actor); Actor_Kill(&this->dyna.actor);
} }
} }
void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgSpot00Break* this = THIS; BgSpot00Break* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) {
@ -72,7 +72,7 @@ void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgSpot00Break* this = THIS; BgSpot00Break* this = THIS;
if (this->actor.params == 1) { if (this->dyna.actor.params == 1) {
Gfx_DrawDListOpa(globalCtx, D_06000980); Gfx_DrawDListOpa(globalCtx, D_06000980);
} else { } else {
Gfx_DrawDListOpa(globalCtx, D_06000440); Gfx_DrawDListOpa(globalCtx, D_06000440);

View file

@ -8,9 +8,7 @@
struct BgSpot00Break; struct BgSpot00Break;
typedef struct BgSpot00Break { typedef struct BgSpot00Break {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId;
/* 0x0150 */ char unk_150[0x14];
} BgSpot00Break; // size = 0x0164 } BgSpot00Break; // size = 0x0164
#endif #endif

View file

@ -59,7 +59,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna.actor, 1); DynaPolyActor_Init(&this->dyna, 1);
if (this->dyna.actor.params == DT_DRAWBRIDGE) { if (this->dyna.actor.params == DT_DRAWBRIDGE) {
CollisionHeader_GetVirtual(&D_060005E0, &colHeader); CollisionHeader_GetVirtual(&D_060005E0, &colHeader);
@ -175,12 +175,12 @@ void BgSpot00Hanebasi_DrawBridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContex
Actor* childsChild; Actor* childsChild;
s16 angle = 80; s16 angle = 80;
if (Math_ScaledStepToS(&this->dyna.actor.shape, this->destAngle, 80)) { if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, this->destAngle, 80)) {
this->actionFunc = BgSpot00Hanebasi_DrawBridgeWait; this->actionFunc = BgSpot00Hanebasi_DrawBridgeWait;
} }
if (this->dyna.actor.shape.rot.x >= -0x27D8) { if (this->dyna.actor.shape.rot.x >= -0x27D8) {
child = this->dyna.actor.child; child = (BgSpot00Hanebasi*)this->dyna.actor.child;
angle *= 0.4f; angle *= 0.4f;
Math_ScaledStepToS(&child->dyna.actor.shape.rot.x, child->destAngle, angle); Math_ScaledStepToS(&child->dyna.actor.shape.rot.x, child->destAngle, angle);
childsChild = child->dyna.actor.child; childsChild = child->dyna.actor.child;
@ -229,7 +229,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) {
gSaveContext.eventChkInf[8] |= 1; gSaveContext.eventChkInf[8] |= 1;
Flags_SetEventChkInf(0x82); Flags_SetEventChkInf(0x82);
this->actionFunc = BgSpot00Hanebasi_DoNothing; this->actionFunc = BgSpot00Hanebasi_DoNothing;
func_8002DF54(globalCtx, player, 8); func_8002DF54(globalCtx, &player->actor, 8);
globalCtx->nextEntranceIndex = 0x00CD; globalCtx->nextEntranceIndex = 0x00CD;
gSaveContext.nextCutsceneIndex = 0xFFF1; gSaveContext.nextCutsceneIndex = 0xFFF1;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_spot01_idosoko.c * File: z_bg_spot01_idosoko.c
* Overlay: Bg_Spot01_Idosoko * Overlay: ovl_Bg_Spot01_Idosoko
* Description: Stone that blocks the entrance to Bottom of the Well * Description: Stone that blocks the entrance to Bottom of the Well
*/ */
@ -40,17 +40,17 @@ void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, BgSpot01IdosokoActionFun
} }
void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot01Idosoko* this = THIS;
s32 pad; s32 pad;
BgSpot01Idosoko* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
DynaPolyActor_Init(thisx, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
CollisionHeader_GetVirtual(&D_06003C64, &colHeader); CollisionHeader_GetVirtual(&D_06003C64, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (LINK_IS_CHILD) { if (LINK_IS_CHILD) {
Actor_Kill(thisx); Actor_Kill(&this->dyna.actor);
} else { } else {
BgSpot01Idosoko_SetupAction(this, func_808ABF54); BgSpot01Idosoko_SetupAction(this, func_808ABF54);
} }

View file

@ -9,7 +9,7 @@ typedef enum {
WATERFALL_OPENING_IDLE, WATERFALL_OPENING_IDLE,
WATERFALL_OPENING_ANIMATED, WATERFALL_OPENING_ANIMATED,
WATERFALL_OPENED, WATERFALL_OPENED,
WATERFALL_CLOSING, WATERFALL_CLOSING
} BgSpot03TakiState; } BgSpot03TakiState;
struct BgSpot03Taki; struct BgSpot03Taki;

View file

@ -43,16 +43,15 @@ static Gfx* sDLists[] = {
}; };
void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad1;
BgSpot05Soko* this = THIS; BgSpot05Soko* this = THIS;
u32 pad1; CollisionHeader* colHeader = NULL;
CollisionHeader* colHeader; s32 pad2;
u32 pad2;
colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF; this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF; thisx->params &= 0xFF;
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
if (thisx->params == 0) { if (thisx->params == 0) {
CollisionHeader_GetVirtual(&D_06000918, &colHeader); CollisionHeader_GetVirtual(&D_06000918, &colHeader);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
@ -82,23 +81,19 @@ void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx) {
} }
void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) { void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) { if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
Audio_PlaySoundAtPosition(globalCtx, &thisx->world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE);
Actor_SetFocus(thisx, 50.0f); Actor_SetFocus(&this->dyna.actor, 50.0f);
func_80080480(globalCtx, &this->dyna.actor); func_80080480(globalCtx, &this->dyna.actor);
this->actionFunc = func_808AE630; this->actionFunc = func_808AE630;
thisx->speedXZ = 0.5f; this->dyna.actor.speedXZ = 0.5f;
} }
} }
void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; this->dyna.actor.speedXZ *= 1.5f;
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 120.0f, this->dyna.actor.speedXZ) != 0) {
thisx->speedXZ *= 1.5f; Actor_Kill(&this->dyna.actor);
if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 120.0f, thisx->speedXZ) != 0) {
Actor_Kill(thisx);
} }
} }

View file

@ -113,7 +113,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (thisx->params) { switch (thisx->params) {
case LHO_WATER_TEMPLE_ENTRACE_GATE: case LHO_WATER_TEMPLE_ENTRACE_GATE:
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06000EE8, &colHeader); CollisionHeader_GetVirtual(&D_06000EE8, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
@ -129,7 +129,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) {
case LHO_WATER_TEMPLE_ENTRANCE_LOCK: case LHO_WATER_TEMPLE_ENTRANCE_LOCK:
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
Collider_InitJntSph(globalCtx, &this->collider); Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, &this->colliderItem); Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, this->colliderItem);
if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) { if (LINK_IS_ADULT && Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (!(gSaveContext.eventChkInf[6] & 0x200)) { if (!(gSaveContext.eventChkInf[6] & 0x200)) {
@ -179,7 +179,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) {
break; break;
case LHO_ICE_BLOCK: case LHO_ICE_BLOCK:
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06001238, &colHeader); CollisionHeader_GetVirtual(&D_06001238, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->actionFunc = BgSpot06Objects_DoNothing; this->actionFunc = BgSpot06Objects_DoNothing;
@ -200,7 +200,7 @@ void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
break; break;
case LHO_WATER_TEMPLE_ENTRANCE_LOCK: case LHO_WATER_TEMPLE_ENTRANCE_LOCK:
Collider_DestroyJntSph(globalCtx, &this->collider.base); Collider_DestroyJntSph(globalCtx, &this->collider);
break; break;
case LHO_WATER_PLANE: case LHO_WATER_PLANE:
break; break;
@ -219,7 +219,7 @@ void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, GlobalContext* glob
sp34.x = (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.x; sp34.x = (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.x;
sp34.y = this->dyna.actor.world.pos.y; sp34.y = this->dyna.actor.world.pos.y;
sp34.z = (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.z; sp34.z = (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * tmp) + this->dyna.actor.world.pos.z;
EffectSsBubble_Spawn(globalCtx, &sp34.x, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); EffectSsBubble_Spawn(globalCtx, &sp34, 50.0f, 70.0f, 10.0f, (Rand_ZeroOne() * 0.05f) + 0.175f);
} }
} }
@ -276,13 +276,13 @@ void BgSpot06Objects_DoNothing(BgSpot06Objects* this, GlobalContext* globalCtx)
*/ */
void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { void BgSpot06Objects_LockSpawnWaterRipples(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) {
if (flag || !(globalCtx->gameplayFrames % 7)) { if (flag || !(globalCtx->gameplayFrames % 7)) {
EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.home, 300, 700, 0); EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.home.pos, 300, 700, 0);
} }
} }
void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) { void BgSpot06Objects_LockSpawnBubbles(BgSpot06Objects* this, GlobalContext* globalCtx, s32 flag) {
if (!(globalCtx->gameplayFrames % 7) || flag) { if (!(globalCtx->gameplayFrames % 7) || flag) {
EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world, 0.0f, 40.0f, 30.0f, (Rand_ZeroOne() * 0.05f) + 0.175f); EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 0.0f, 40.0f, 30.0f, (Rand_ZeroOne() * 0.05f) + 0.175f);
} }
} }
@ -317,14 +317,14 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) {
EffectSsBubble_Spawn(globalCtx, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f); EffectSsBubble_Spawn(globalCtx, &effectPos, 0.0f, 20.0f, 20.0f, (Rand_ZeroOne() * 0.1f) + 0.7f);
} }
EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.world, NULL, NULL, 1, 700); EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.world.pos, NULL, NULL, 1, 700);
this->collider.elements->dim.worldSphere.radius = 45; this->collider.elements->dim.worldSphere.radius = 45;
this->actionFunc = BgSpot06Objects_LockPullOutward; this->actionFunc = BgSpot06Objects_LockPullOutward;
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
Flags_SetSwitch(globalCtx, this->switchFlag); Flags_SetSwitch(globalCtx, this->switchFlag);
func_800800F8(globalCtx, 0x1018, 170, &this->dyna.actor, 0); func_800800F8(globalCtx, 0x1018, 170, &this->dyna.actor, 0);
} else { } else {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} }
} }
@ -365,7 +365,7 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo
this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y - 1.3f; this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y - 1.3f;
BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0); BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 0);
if (Math_ScaledStepToS(&this->dyna.actor.shape, 0, 0x260) != 0) { if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, 0, 0x260) != 0) {
this->dyna.actor.home.pos.x = this->dyna.actor.home.pos.x =
this->dyna.actor.world.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y) * 16.0f); this->dyna.actor.world.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y) * 16.0f);
this->dyna.actor.home.pos.z = this->dyna.actor.home.pos.z =
@ -380,7 +380,7 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, GlobalContext* glo
if (this->dyna.actor.world.pos.y >= -1973.0f) { if (this->dyna.actor.world.pos.y >= -1973.0f) {
this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.y = 0.0f;
BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 1); BgSpot06Objects_LockSpawnWaterRipples(this, globalCtx, 1);
EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.home, NULL, NULL, 1, 700); EffectSsGSplash_Spawn(globalCtx, &this->dyna.actor.home.pos, NULL, NULL, 1, 700);
} else if (this->dyna.actor.shape.rot.x == -0x4000) { } else if (this->dyna.actor.shape.rot.x == -0x4000) {
this->dyna.actor.velocity.y += 0.02f; this->dyna.actor.velocity.y += 0.02f;
this->dyna.actor.world.pos.x = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.x = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.x;

View file

@ -60,16 +60,15 @@ static Gfx* sDLists[] = {
s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
s32 carpentersRescued; s32 carpentersRescued;
Actor* thisx = &this->dyna.actor;
if (gSaveContext.sceneSetupIndex >= 4) { if (gSaveContext.sceneSetupIndex >= 4) {
return thisx->params == 0; return this->dyna.actor.params == 0;
} }
carpentersRescued = (gSaveContext.eventChkInf[9] & 0xF) == 0xF; carpentersRescued = (gSaveContext.eventChkInf[9] & 0xF) == 0xF;
if (LINK_AGE_IN_YEARS == YEARS_ADULT) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
switch (thisx->params) { switch (this->dyna.actor.params) {
case 0: case 0:
return 0; return 0;
case 1: case 1:
@ -80,34 +79,32 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
return 1; return 1;
} }
} else { } else {
return thisx->params == 2; return this->dyna.actor.params == 2;
} }
return 0; return 0;
} }
s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (this->dyna.actor.params == 3) {
Actor_SetScale(&this->dyna.actor, 0.1f);
if (thisx->params == 3) {
Actor_SetScale(thisx, 0.1f);
} else { } else {
Actor_SetScale(thisx, 1.0f); Actor_SetScale(&this->dyna.actor, 1.0f);
} }
return 1; return 1;
} }
s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad[2]; s32 pad2[2];
if (D_808B1F90[thisx->params] != NULL) { if (D_808B1F90[this->dyna.actor.params] != NULL) {
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(D_808B1F90[thisx->params], &colHeader); CollisionHeader_GetVirtual(D_808B1F90[this->dyna.actor.params], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
} }
return 1; return true;
} }
s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) {
@ -115,20 +112,20 @@ s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) {
for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) {
if (!D_808B1FA4[i](this, globalCtx)) { if (!D_808B1FA4[i](this, globalCtx)) {
return 0; return false;
} }
} }
return 1; return true;
} }
s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); Actor_ProcessInitChain(&this->dyna.actor, sInitChain1);
return 1; return true;
} }
s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); Actor_ProcessInitChain(&this->dyna.actor, sInitChain2);
return 1; return true;
} }
s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) {
@ -142,18 +139,18 @@ s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) {
void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot09Obj* this = THIS; BgSpot09Obj* this = THIS;
osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params, osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params,
gSaveContext.eventChkInf[9] & 0xF); gSaveContext.eventChkInf[9] & 0xF);
thisx->params &= 0xFF; this->dyna.actor.params &= 0xFF;
if ((thisx->params < 0) || (thisx->params >= 5)) { if ((this->dyna.actor.params < 0) || (this->dyna.actor.params >= 5)) {
osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n",
"../z_bg_spot09_obj.c", 322, thisx->params); "../z_bg_spot09_obj.c", 322, this->dyna.actor.params);
} }
if (!func_808B1C70(this, globalCtx)) { if (!func_808B1C70(this, globalCtx)) {
Actor_Kill(thisx); Actor_Kill(&this->dyna.actor);
} else if (!func_808B1D44(this, globalCtx)) { } else if (!func_808B1D44(this, globalCtx)) {
Actor_Kill(thisx); Actor_Kill(&this->dyna.actor);
} }
} }
@ -161,7 +158,7 @@ void BgSpot09Obj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna; DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna;
BgSpot09Obj* this = THIS; BgSpot09Obj* this = THIS;
if (thisx->params != 0) { if (this->dyna.actor.params != 0) {
DynaPoly_DeleteBgActor(globalCtx, dynaColCtx, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, dynaColCtx, this->dyna.bgId);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_spot12_gate.c * File: z_bg_spot12_gate.c
* Overlay: Bg_Spot12_Gate * Overlay: ovl_Bg_Spot12_Gate
* Description: Haunted Wasteland Gate * Description: Haunted Wasteland Gate
*/ */
@ -46,27 +46,27 @@ static InitChainEntry sInitChain[] = {
extern Gfx D_06001080[]; extern Gfx D_06001080[];
extern CollisionHeader D_060011EC; extern CollisionHeader D_060011EC;
void func_808B2F90(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) { void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) {
Actor* thisx = &this->dyna.actor; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad[2]; s32 pad2;
DynaPolyActor_Init(thisx, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145,
thisx->id, thisx->params); this->dyna.actor.id, this->dyna.actor.params);
} }
} }
void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot12Gate_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot12Gate* this = THIS; BgSpot12Gate* this = THIS;
func_808B2F90(this, globalCtx, &D_060011EC, DPM_UNK); BgSpot12Gate_InitDynaPoly(this, globalCtx, &D_060011EC, DPM_UNK);
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
func_808B3274(this); func_808B3274(this);
} else { } else {
func_808B30C0(this); func_808B30C0(this);
@ -80,24 +80,20 @@ void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx) {
} }
void func_808B30C0(BgSpot12Gate* this) { void func_808B30C0(BgSpot12Gate* this) {
Actor* thisx = &this->dyna.actor;
this->actionFunc = func_808B30D8; this->actionFunc = func_808B30D8;
thisx->world.pos.y = thisx->home.pos.y; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
} }
void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) {
func_808B3134(this); func_808B3134(this);
func_800800F8(globalCtx, 0x1040, -0x63, thisx, 0); func_800800F8(globalCtx, 0x1040, -0x63, &this->dyna.actor, 0);
} }
} }
void func_808B3134(BgSpot12Gate* this) { void func_808B3134(BgSpot12Gate* this) {
this->actionFunc = func_808B314C; this->actionFunc = func_808B314C;
this->unk_168 = 0x28; this->unk_168 = 40;
} }
void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) {
@ -111,27 +107,25 @@ void func_808B317C(BgSpot12Gate* this) {
} }
void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; s32 pad;
s32 var; s32 var;
Math_StepToF(&thisx->velocity.y, 1.6f, 0.03f); Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f);
if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 200.0f, thisx->velocity.y)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y)) {
func_808B3274(this); func_808B3274(this);
var = Quake_Add(ACTIVE_CAM, 3); var = Quake_Add(ACTIVE_CAM, 3);
Quake_SetSpeed(var, -0x3CB0); Quake_SetSpeed(var, -0x3CB0);
Quake_SetQuakeValues(var, 3, 0, 0, 0); Quake_SetQuakeValues(var, 3, 0, 0, 0);
Quake_SetCountdown(var, 0xC); Quake_SetCountdown(var, 0xC);
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
} else { } else {
func_8002F974(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);
} }
} }
void func_808B3274(BgSpot12Gate* this) { void func_808B3274(BgSpot12Gate* this) {
Actor* thisx = &this->dyna.actor;
this->actionFunc = func_808B3298; this->actionFunc = func_808B3298;
thisx->world.pos.y = thisx->home.pos.y + 200.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 200.0f;
} }
void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) { void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) {
@ -141,7 +135,7 @@ void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot12Gate* this = THIS; BgSpot12Gate* this = THIS;
if (this->unk_168 > 0) { if (this->unk_168 > 0) {
this->unk_168 -= 1; this->unk_168--;
} }
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
} }

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_spot12_saku.c * File: z_bg_spot12_saku.c
* Overlay: Bg_Spot12_Saku * Overlay: ovl_Bg_Spot12_Saku
* Description: * Description:
*/ */
@ -45,16 +45,16 @@ extern Gfx D_06002260[];
extern CollisionHeader D_0600238C; extern CollisionHeader D_0600238C;
void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) { void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) {
Actor* thisx = &this->dyna.actor; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad[2]; s32 pad2;
DynaPolyActor_Init(thisx, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140,
thisx->id, thisx->params); this->dyna.actor.id, this->dyna.actor.params);
} }
} }
@ -62,8 +62,8 @@ void BgSpot12Saku_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot12Saku* this = THIS; BgSpot12Saku* this = THIS;
func_808B3420(this, globalCtx, &D_0600238C, DPM_UNK); func_808B3420(this, globalCtx, &D_0600238C, DPM_UNK);
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
func_808B3714(this); func_808B3714(this);
} else { } else {
func_808B3550(this); func_808B3550(this);
@ -77,26 +77,22 @@ void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) {
} }
void func_808B3550(BgSpot12Saku* this) { void func_808B3550(BgSpot12Saku* this) {
Actor* thisx = &this->dyna.actor;
this->actionFunc = func_808B357C; this->actionFunc = func_808B357C;
thisx->scale.x = 0.1f; this->dyna.actor.scale.x = 0.1f;
thisx->world.pos.x = thisx->home.pos.x; this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
thisx->world.pos.z = thisx->home.pos.z; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z;
} }
void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) {
func_808B35E4(this); func_808B35E4(this);
this->unk_168 = 0x14; this->timer = 20;
func_800800F8(globalCtx, 0x104A, -0x63, thisx, 0); func_800800F8(globalCtx, 0x104A, -0x63, &this->dyna.actor, 0);
} }
} }
void func_808B35E4(BgSpot12Saku* this) { void func_808B35E4(BgSpot12Saku* this) {
if (this->unk_168 == 0) { if (this->timer == 0) {
this->actionFunc = func_808B3604; this->actionFunc = func_808B3604;
} }
} }
@ -118,12 +114,10 @@ void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) {
} }
void func_808B3714(BgSpot12Saku* this) { void func_808B3714(BgSpot12Saku* this) {
Actor* thisx = &this->dyna.actor;
this->actionFunc = func_808B37AC; this->actionFunc = func_808B37AC;
thisx->scale.x = 0.001f / 0.14f; this->dyna.actor.scale.x = 0.001f / 0.14f;
thisx->world.pos.x = thisx->home.pos.x - (Math_SinS(thisx->shape.rot.y + 0x4000) * 78.0f); this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f);
thisx->world.pos.z = thisx->home.pos.z - (Math_CosS(thisx->shape.rot.y + 0x4000) * 78.0f); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z - (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f);
} }
void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) { void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) {
@ -132,8 +126,8 @@ void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) {
void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot12Saku* this = THIS; BgSpot12Saku* this = THIS;
if (this->unk_168 > 0) { if (this->timer > 0) {
this->unk_168 -= 1; this->timer--;
} }
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
} }

View file

@ -11,7 +11,7 @@ typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, GlobalContext*);
typedef struct BgSpot12Saku { typedef struct BgSpot12Saku {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgSpot12SakuActionFunc actionFunc; /* 0x0164 */ BgSpot12SakuActionFunc actionFunc;
/* 0x0168 */ s16 unk_168; /* 0x0168 */ s16 timer;
} BgSpot12Saku; // size = 0x016C } BgSpot12Saku; // size = 0x016C
extern const ActorInit Bg_Spot12_Saku_InitVars; extern const ActorInit Bg_Spot12_Saku_InitVars;

View file

@ -1,3 +1,9 @@
/*
* File: z_bg_spot15_rrbox.c
* Overlay: ovl_Bg_Spot15_Rrbox
* Description: Milk Crate
*/
#include "z_bg_spot15_rrbox.h" #include "z_bg_spot15_rrbox.h"
#define FLAGS 0x00000000 #define FLAGS 0x00000000
@ -81,7 +87,7 @@ void func_808B3A34(BgSpot15Rrbox* this) {
s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) {
DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->bgId); DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->bgId);
if (dynaPolyActor != NULL && Math3D_Dist2DSq(dynaPolyActor->actor.world.pos.x, dynaPolyActor->actor.world.pos.z, if ((dynaPolyActor != NULL) && Math3D_Dist2DSq(dynaPolyActor->actor.world.pos.x, dynaPolyActor->actor.world.pos.z,
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z) < 0.01f) { this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z) < 0.01f) {
return true; return true;
} }

View file

@ -35,21 +35,22 @@ extern Gfx D_060003C0[];
extern CollisionHeader D_060004D0; extern CollisionHeader D_060004D0;
void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgSpot15Saku* this = THIS; BgSpot15Saku* this = THIS;
s32 pad[2]; s32 pad2;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_060004D0, &colHeader); CollisionHeader_GetVirtual(&D_060004D0, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
thisx->scale.x = 0.1f; this->dyna.actor.scale.x = 0.1f;
thisx->scale.y = 0.1f; this->dyna.actor.scale.y = 0.1f;
thisx->scale.z = 0.1f; this->dyna.actor.scale.z = 0.1f;
this->unk_170 = thisx->world.pos.x; this->unk_170.x = this->dyna.actor.world.pos.x;
this->unk_174 = thisx->world.pos.y; this->unk_170.y = this->dyna.actor.world.pos.y;
this->unk_178 = thisx->world.pos.z; this->unk_170.z = this->dyna.actor.world.pos.z;
if ((gSaveContext.infTable[7] & 2) != 0) { if (gSaveContext.infTable[7] & 2) {
thisx->world.pos.z = 2659.0f; this->dyna.actor.world.pos.z = 2659.0f;
} }
this->actionFunc = func_808B4930; this->actionFunc = func_808B4930;
} }
@ -62,26 +63,25 @@ void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) {
if (this->unk_168 && !(gSaveContext.infTable[7] & 2)) { if (this->unk_168 && !(gSaveContext.infTable[7] & 2)) {
this->unk_17C = 2; this->timer = 2;
this->actionFunc = func_808B4978; this->actionFunc = func_808B4978;
} }
} }
void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; if (this->timer == 0) {
if (!this->unk_17C) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);
Audio_PlayActorSound2(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); this->dyna.actor.world.pos.z -= 2.0f;
thisx->world.pos.z -= 2.0f; if (this->dyna.actor.world.pos.z < 2660.0f) {
if (thisx->world.pos.z < 2660.0f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); this->timer = 30;
this->unk_17C = 0x1E;
this->actionFunc = func_808B4A04; this->actionFunc = func_808B4A04;
} }
} }
} }
void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) {
if (!this->unk_17C) { if (this->timer == 0) {
this->unk_168 = 0; this->unk_168 = 0;
this->actionFunc = func_808B4930; this->actionFunc = func_808B4930;
} }
@ -90,7 +90,10 @@ void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) {
void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot15Saku* this = THIS; BgSpot15Saku* this = THIS;
DECR(this->unk_17C); if (this->timer != 0) {
this->timer--;
}
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
} }

View file

@ -12,10 +12,8 @@ typedef struct BgSpot15Saku {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgSpot15SakuActionFunc actionFunc; /* 0x0164 */ BgSpot15SakuActionFunc actionFunc;
/* 0x0168 */ u64 unk_168; /* 0x0168 */ u64 unk_168;
/* 0x0170 */ f32 unk_170; /* 0x0170 */ Vec3f unk_170;
/* 0x0174 */ f32 unk_174; /* 0x017C */ s16 timer;
/* 0x0174 */ f32 unk_178;
/* 0x017C */ s16 unk_17C;
} BgSpot15Saku; // size = 0x0180 } BgSpot15Saku; // size = 0x0180
extern const ActorInit Bg_Spot15_Saku_InitVars; extern const ActorInit Bg_Spot15_Saku_InitVars;

View file

@ -301,7 +301,7 @@ void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) {
// for(;this->unk_158 < ARRAY_COUNTU(D_808B5EB0); this->unk_158++) // for(;this->unk_158 < ARRAY_COUNTU(D_808B5EB0); this->unk_158++)
while (true) { while (true) {
if (this->unk_158 >= ARRAY_COUNTU(D_808B5EB0) || this->unk_154 < D_808B5EB0[this->unk_158][0]) { if ((u32)this->unk_158 >= ARRAY_COUNTU(D_808B5EB0) || this->unk_154 < D_808B5EB0[this->unk_158][0]) {
break; break;
} }

View file

@ -98,7 +98,7 @@ void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna.actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) { if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) {
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);
return; return;

View file

@ -83,7 +83,7 @@ void func_808B7710(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitJntSph(globalCtx, &this->colliderJntSph); Collider_InitJntSph(globalCtx, &this->colliderJntSph);
Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit,
&this->ColliderJntSphElements); this->ColliderJntSphElements);
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
} }
@ -134,36 +134,36 @@ static InitChainEntry sInitChain[] = {
}; };
void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgSpot18Basket* this = THIS; BgSpot18Basket* this = THIS;
Actor* actor = &this->dyna.actor;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK3); DynaPolyActor_Init(&this->dyna, DPM_UNK3);
func_808B7710(this, globalCtx); func_808B7710(&this->dyna.actor, globalCtx);
CollisionHeader_GetVirtual(&D_06002154, &colHeader); CollisionHeader_GetVirtual(&D_06002154, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
Actor_ProcessInitChain(actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
ActorShape_Init(&actor->shape, 0.0f, ActorShadow_DrawCircle, 15.0f); ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f);
actor->home.pos.y += 0.01f; this->dyna.actor.home.pos.y += 0.01f;
actor->world.pos.y = actor->home.pos.y; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
if (Flags_GetSwitch(globalCtx, (actor->params >> 8) & 0x3F)) { if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
func_808B7BB0(this); func_808B7BB0(this);
return; return;
} }
func_808B7AEC(this); func_808B7AEC(this);
Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_BG_SPOT18_FUTA, actor->world.pos.x, Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT18_FUTA, this->dyna.actor.world.pos.x,
actor->world.pos.y, actor->world.pos.z, actor->shape.rot.x, actor->shape.rot.y + 0x1555, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y + 0x1555,
actor->shape.rot.z, -1); this->dyna.actor.shape.rot.z, -1);
if (actor->child == NULL) { if (this->dyna.actor.child == NULL) {
osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf(" : 変化壷蓋発生失敗(%s %d)\n", "../z_bg_spot18_basket.c", 351); osSyncPrintf(" : 変化壷蓋発生失敗(%s %d)\n", "../z_bg_spot18_basket.c", 351);
osSyncPrintf(VT_RST); osSyncPrintf(VT_RST);
Actor_Kill(actor); Actor_Kill(&this->dyna.actor);
} }
} }
@ -180,7 +180,7 @@ void func_808B7AEC(BgSpot18Basket* this) {
void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx) { void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
func_800800F8(globalCtx, 4220, 80, this, 0); func_800800F8(globalCtx, 4220, 80, &this->dyna.actor, 0);
func_808B7B58(this); func_808B7B58(this);
} }
} }
@ -228,14 +228,14 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) {
if (positionDiff > 120.0f && positionDiff < 200.0f) { if (positionDiff > 120.0f && positionDiff < 200.0f) {
if (Math3D_Dist2DSq(colliderBaseAc->world.pos.z, this->colliderJntSph.base.ac->world.pos.x, if (Math3D_Dist2DSq(colliderBaseAc->world.pos.z, this->colliderJntSph.base.ac->world.pos.x,
this->dyna.actor.world.pos.z, this->dyna.actor.world.pos.x) < SQ(32.0f)) { this->dyna.actor.world.pos.z, this->dyna.actor.world.pos.x) < SQ(32.0f)) {
func_800800F8(globalCtx, 4210, 240, this, 0); func_800800F8(globalCtx, 4210, 240, &this->dyna.actor, 0);
func_808B7D38(this); func_808B7D38(this);
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
} }
} }
} }
func_8002F974(this, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
} }
void func_808B7D38(BgSpot18Basket* this) { void func_808B7D38(BgSpot18Basket* this) {
@ -430,18 +430,19 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) {
} }
void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgSpot18Basket* this = THIS; BgSpot18Basket* this = THIS;
Vec3s temp; s32 bgId;
this->unk_216++; this->unk_216++;
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &temp, this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId,
&this->dyna.actor, &this->dyna.actor.world); &this->dyna.actor, &this->dyna.actor.world.pos);
if (this->actionFunc != func_808B7AFC) { if (this->actionFunc != func_808B7AFC) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base);
if (this->actionFunc != func_808B7B6C) { if (this->actionFunc != func_808B7B6C) {
this->colliderJntSph.base.acFlags &= ~AC_HIT; this->colliderJntSph.base.acFlags &= ~AC_HIT;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base);
} }
} }
} }

View file

@ -42,30 +42,30 @@ void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06000368, &colHeader); CollisionHeader_GetVirtual(&D_06000368, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
} }
void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgSpot18Futa* this = THIS; BgSpot18Futa* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot18Futa* this = THIS; BgSpot18Futa* this = THIS;
s32 iVar1; s32 iVar1;
if (this->actor.parent == NULL) { if (this->dyna.actor.parent == NULL) {
iVar1 = Math_StepToF(&this->actor.scale.x, 0, 0.005); iVar1 = Math_StepToF(&this->dyna.actor.scale.x, 0, 0.005);
if (iVar1 != 0) { if (iVar1 != 0) {
Actor_Kill(&this->actor); Actor_Kill(&this->dyna.actor);
} else { } else {
this->actor.scale.z = this->actor.scale.x; this->dyna.actor.scale.z = this->dyna.actor.scale.x;
this->actor.scale.y = this->actor.scale.x; this->dyna.actor.scale.y = this->dyna.actor.scale.x;
} }
} }
} }

View file

@ -7,10 +7,8 @@
struct BgSpot18Futa; struct BgSpot18Futa;
typedef struct BgSpot18Futa { typedef struct BgSpot18Futa {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId; } BgSpot18Futa; // size = 0x0164
/* 0x0150 */ u32 unk_150[0x5];
} BgSpot18Futa; // size = 0x0154
extern const ActorInit Bg_Spot18_Futa_InitVars; extern const ActorInit Bg_Spot18_Futa_InitVars;
#endif #endif

View file

@ -1,6 +1,6 @@
/* /*
* File: z_bg_spot18_obj.c * File: z_bg_spot18_obj.c
* Overlay: Bg_Spot18_Obj * Overlay: ovl_Bg_Spot18_Obj
* Description: * Description:
*/ */
@ -134,7 +134,7 @@ s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx) {
s32 pad[2]; s32 pad[2];
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna.actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader); CollisionHeader_GetVirtual(D_808B90FC[this->dyna.actor.params & 0xF], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
return 1; return 1;

View file

@ -91,7 +91,7 @@ void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx) {
void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) { void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
Actor_SetFocus(&this->dyna.actor, 70.0f); Actor_SetFocus(&this->dyna.actor, 70.0f);
func_80080480(globalCtx, this); func_80080480(globalCtx, &this->dyna.actor);
this->actionFunc = func_808B9698; this->actionFunc = func_808B9698;
} }
} }

View file

@ -37,7 +37,8 @@ const ActorInit Bg_Toki_Swd_InitVars = {
(ActorFunc)BgTokiSwd_Draw, (ActorFunc)BgTokiSwd_Draw,
}; };
static ColliderCylinderInit sCylinderInit = { { static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE, COLTYPE_NONE,
AT_NONE, AT_NONE,
AC_NONE, AC_NONE,
@ -53,12 +54,13 @@ static ColliderCylinderInit sCylinderInit = { {
BUMP_NONE, BUMP_NONE,
OCELEM_ON, OCELEM_ON,
}, },
{ 10, 70, 0, { 0 } } }; { 10, 70, 0, { 0 } },
};
static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_IMMOVABLE }; static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_IMMOVABLE };
static InitChainEntry sInitChain[] = { static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 0x19, ICHAIN_STOP), ICHAIN_VEC3F_DIV1000(scale, 25, ICHAIN_STOP),
}; };
void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) { void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) {
@ -66,15 +68,15 @@ void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) {
} }
void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) {
BgTokiSwd* this = THIS;
s32 pad; s32 pad;
BgTokiSwd* this = THIS;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->actor, sInitChain);
this->actor.shape.yOffset = 800.0f; this->actor.shape.yOffset = 800.0f;
BgTokiSwd_SetupAction(thisx, func_808BAF40); BgTokiSwd_SetupAction(this, func_808BAF40);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
thisx->draw = NULL; this->actor.draw = NULL;
} }
if (gSaveContext.sceneSetupIndex == 5) { if (gSaveContext.sceneSetupIndex == 5) {
@ -83,8 +85,8 @@ void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
Collider_UpdateCylinder(thisx, &this->collider); Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
} }
void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -35,28 +35,28 @@ static InitChainEntry sInitChain[] = {
}; };
void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) {
BgUmaJump* this = THIS;
s32 pad; s32 pad;
BgUmaJump* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06001438, &colHeader); CollisionHeader_GetVirtual(&D_06001438, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->actor.params == 1) { if (this->dyna.actor.params == 1) {
if ((!Flags_GetEventChkInf(0x18)) && (DREG(1) == 0)) { if (!Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) {
Actor_Kill(&this->actor); Actor_Kill(&this->dyna.actor);
return; return;
} }
this->actor.flags |= 0x30; this->dyna.actor.flags |= 0x30;
} }
} }
void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgUmaJump* this = THIS; BgUmaJump* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx) { void BgUmaJump_Update(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -7,9 +7,7 @@
struct BgUmaJump; struct BgUmaJump;
typedef struct BgUmaJump { typedef struct BgUmaJump {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId;
/* 0x0150 */ char unk_150[0x14];
} BgUmaJump; // size = 0x0164 } BgUmaJump; // size = 0x0164
extern const ActorInit Bg_Uma_Jump_InitVars; extern const ActorInit Bg_Uma_Jump_InitVars;

View file

@ -3,6 +3,7 @@
* Overlay: ovl_Bg_Ydan_Hasi * Overlay: ovl_Bg_Ydan_Hasi
* Description: Deku Tree Puzzle elements. Water plane and floating block in B1, and 3 blocks on 2F * Description: Deku Tree Puzzle elements. Water plane and floating block in B1, and 3 blocks on 2F
*/ */
#include "z_bg_ydan_hasi.h" #include "z_bg_ydan_hasi.h"
#define FLAGS 0x00000030 #define FLAGS 0x00000030
@ -199,7 +200,7 @@ void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx); func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08, gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (0 - globalCtx->gameplayFrames & 0x7F), Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, - globalCtx->gameplayFrames & 0x7F,
globalCtx->gameplayFrames & 0x7F, 0x20, 0x20, 1, globalCtx->gameplayFrames & 0x7F, globalCtx->gameplayFrames & 0x7F, 0x20, 0x20, 1, globalCtx->gameplayFrames & 0x7F,
globalCtx->gameplayFrames & 0x7F, 0x20, 0x20)); globalCtx->gameplayFrames & 0x7F, 0x20, 0x20));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592),

View file

@ -6,7 +6,7 @@
struct BgYdanHasi; struct BgYdanHasi;
typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, struct GlobalCtx*); typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, GlobalContext*);
typedef struct BgYdanHasi { typedef struct BgYdanHasi {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;

View file

@ -91,7 +91,7 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
Collider_InitTris(globalCtx, &this->collider); Collider_InitTris(globalCtx, &this->collider);
Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, &this->elements); Collider_SetTris(globalCtx, &this->collider, thisx, &sTrisInit, this->elements);
this->unk_168 = thisx->params & 0xFFFF; this->unk_168 = thisx->params & 0xFFFF;
thisx->params = (thisx->params >> 8) & 0xFF; thisx->params = (thisx->params >> 8) & 0xFF;
@ -135,7 +135,7 @@ void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgYdanMaruta* this = THIS; BgYdanMaruta* this = THIS;
Collider_DestroyTris(globalCtx, &this->collider); Collider_DestroyTris(globalCtx, &this->collider);
if (thisx->params == 1) { if (this->dyna.actor.params == 1) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
} }
@ -204,7 +204,9 @@ void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == 0) { BgYdanMaruta* this = THIS;
if (this->dyna.actor.params == 0) {
Gfx_DrawDListOpa(globalCtx, D_06008D88); Gfx_DrawDListOpa(globalCtx, D_06008D88);
} else { } else {
Gfx_DrawDListOpa(globalCtx, D_06006570); Gfx_DrawDListOpa(globalCtx, D_06006570);

View file

@ -63,8 +63,7 @@ void func_808C0C50(BgZg* this) {
} }
s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) { s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; s32 flag = (this->dyna.actor.params >> 8) & 0xFF;
s32 flag = (thisx->params >> 8) & 0xFF;
return Flags_GetSwitch(globalCtx, flag); return Flags_GetSwitch(globalCtx, flag);
} }
@ -83,11 +82,9 @@ void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) {
} }
void func_808C0D08(BgZg* this, GlobalContext* globalCtx) { void func_808C0D08(BgZg* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; this->dyna.actor.world.pos.y += (kREG(16) + 20.0f) * 1.2f;
if ((((kREG(17) + 200.0f) * 1.2f) + this->dyna.actor.home.pos.y) <= this->dyna.actor.world.pos.y) {
thisx->world.pos.y += (kREG(16) + 20.0f) * 1.2f; Actor_Kill(&this->dyna.actor);
if ((((kREG(17) + 200.0f) * 1.2f) + thisx->home.pos.y) <= thisx->world.pos.y) {
Actor_Kill(thisx);
} }
} }
@ -99,30 +96,30 @@ void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) {
// Translates to: "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" // Translates to: "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!"
osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
} else { } else {
sActionFuncs[action](&this->dyna.actor, globalCtx); sActionFuncs[action](this, globalCtx);
} }
} }
void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) {
BgZg* this = THIS;
s32 pad[2]; s32 pad[2];
BgZg* this = THIS;
CollisionHeader* colHeader; CollisionHeader* colHeader;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(thisx, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
colHeader = NULL; colHeader = NULL;
CollisionHeader_GetVirtual(&D_060011D4, &colHeader); CollisionHeader_GetVirtual(&D_060011D4, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) { if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) {
thisx->scale.x = thisx->scale.x * 1.3f; this->dyna.actor.scale.x = this->dyna.actor.scale.x * 1.3f;
thisx->scale.z = thisx->scale.z * 1.3f; this->dyna.actor.scale.z = this->dyna.actor.scale.z * 1.3f;
thisx->scale.y = thisx->scale.y * 1.2f; this->dyna.actor.scale.y = this->dyna.actor.scale.y * 1.2f;
} }
this->action = 0; this->action = 0;
this->drawConfig = 0; this->drawConfig = 0;
if (func_808C0C98(this, globalCtx) != 0) { if (func_808C0C98(this, globalCtx)) {
Actor_Kill(thisx); Actor_Kill(&this->dyna.actor);
} }
} }

View file

@ -6,7 +6,7 @@
struct DemoEffect; struct DemoEffect;
typedef void (*DemoEffectFunc)(struct DemoEffect* this, GlobalContext* globalCtx); typedef void (*DemoEffectFunc)(struct DemoEffect*, GlobalContext*);
typedef struct { typedef struct {
/* 0x00 */ u8 timer; /* 0x00 */ u8 timer;
@ -76,7 +76,7 @@ typedef struct {
/* 0x00 */ u8 timer; /* 0x00 */ u8 timer;
} DemoEffectDust; } DemoEffectDust;
typedef struct { typedef struct DemoEffect {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnimeCurve skelCurve; /* 0x014C */ SkelAnimeCurve skelCurve;
/* 0x016C */ u8 initObjectBankIndex; /* 0x016C */ u8 initObjectBankIndex;

View file

@ -148,7 +148,7 @@ void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) {
this->deltaPosX = this->actor.world.pos.x - propIt->world.pos.x; this->deltaPosX = this->actor.world.pos.x - propIt->world.pos.x;
this->deltaPosY = this->actor.world.pos.y - propIt->world.pos.y; this->deltaPosY = this->actor.world.pos.y - propIt->world.pos.y;
this->deltaPosZ = this->actor.world.pos.z - propIt->world.pos.z; this->deltaPosZ = this->actor.world.pos.z - propIt->world.pos.z;
this->demoGt = propIt; this->demoGt = (DemoGt*)propIt;
} }
propIt = propIt->next; propIt = propIt->next;
} }

View file

@ -27,7 +27,7 @@ void func_8097D130(DemoGo* this, GlobalContext* globalCtx);
void func_8097D290(DemoGo* this, GlobalContext* globalCtx); void func_8097D290(DemoGo* this, GlobalContext* globalCtx);
void func_8097D29C(DemoGo* this, GlobalContext* globalCtx); void func_8097D29C(DemoGo* this, GlobalContext* globalCtx);
static UNK_PTR D_8097D440[] = { 0x0600CE80, 0x0600D280, 0x0600D680 }; static u64* D_8097D440[] = { 0x0600CE80, 0x0600D280, 0x0600D680 };
static DemoGoActionFunc D_8097D44C[] = { static DemoGoActionFunc D_8097D44C[] = {
func_8097CFDC, func_8097CFFC, func_8097D01C, func_8097D058, func_8097D088, func_8097D0D0, func_8097D130, func_8097CFDC, func_8097CFFC, func_8097D01C, func_8097D058, func_8097D088, func_8097D0D0, func_8097D130,
@ -52,10 +52,10 @@ const ActorInit Demo_Go_InitVars = {
extern AnimationHeader D_060029A8; extern AnimationHeader D_060029A8;
extern AnimationHeader D_06004930; extern AnimationHeader D_06004930;
extern UNK_TYPE D_0600E680; extern u64 D_0600E680[];
extern FlexSkeletonHeader D_0600FEF0; extern FlexSkeletonHeader D_0600FEF0;
UNK_TYPE func_8097C870(DemoGo* this) { s32 func_8097C870(DemoGo* this) {
s32 ret; s32 ret;
switch (this->actor.params) { switch (this->actor.params) {
@ -75,10 +75,9 @@ UNK_TYPE func_8097C870(DemoGo* this) {
} }
void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) { void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) {
s32 pad[2];
Actor* thisx = &this->actor; Actor* thisx = &this->actor;
Vec3f* sp20; Vec3f sp20;
Vec3f* sp1C; f32 sp1C;
if ((thisx->params == 0) || (thisx->params == 1)) { if ((thisx->params == 0) || (thisx->params == 1)) {
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &thisx->world.pos, &sp20, &sp1C); SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &thisx->world.pos, &sp20, &sp1C);
@ -98,7 +97,7 @@ void func_8097C930(DemoGo* this) {
s32 pad[3]; s32 pad[3];
if (DECR(*something) == 0) { if (DECR(*something) == 0) {
*something = Rand_S16Offset(0x3C, 0x3C); *something = Rand_S16Offset(60, 60);
} }
*other = *something; *other = *something;
if (*other >= 3) { if (*other >= 3) {
@ -349,7 +348,7 @@ void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) {
void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) { void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) {
DemoGo* this = THIS; DemoGo* this = THIS;
if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == 0) { if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return; return;
} }

View file

@ -1140,7 +1140,7 @@ void DemoIm_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_80984D4C(thisx, globalCtx); func_80984D4C(thisx, globalCtx);
} }
s32 func_80987514(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
DemoIm* this = THIS; DemoIm* this = THIS;
s32* unk_2D0 = &this->unk_2D0; s32* unk_2D0 = &this->unk_2D0;
@ -1162,13 +1162,13 @@ s32 func_80987514(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
if (*unk_2D0 != 0) { if (*unk_2D0 != 0) {
if (limbIndex == 15) { if (limbIndex == 15) {
*dList = &D_0600EDE8; *dList = D_0600EDE8;
} }
} }
return 0; return false;
} }
void func_809875C0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
DemoIm* this = THIS; DemoIm* this = THIS;
if (limbIndex == 0x10) { if (limbIndex == 0x10) {
@ -1203,8 +1203,8 @@ void func_80987658(DemoIm* this, GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]);
SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80987514, SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIm_OverrideLimbDraw,
func_809875C0, this); DemoIm_PostLimbDraw, this);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 925); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 925);
} }

View file

@ -780,7 +780,7 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
DemoSa* this = THIS; DemoSa* this = THIS;
if ((limbIndex == 15) && (this->unk_1B0 != 0)) { if ((limbIndex == 15) && (this->unk_1B0 != 0)) {
*dList = &D_06007B80; *dList = D_06007B80;
} }
return false; return false;
} }

View file

@ -99,24 +99,24 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame)
void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
f32 currentFrame = this->skelCurve.animCurFrame; f32 currentFrame = this->skelCurve.animCurFrame;
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame) { if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame) {
this->unk_170 = 255; this->unk_170 = 255;
} else { } else {
if (currentFrame <= if (currentFrame <=
(sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) { (sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_08)) {
this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame - currentFrame) / this->unk_170 = ((((sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame - currentFrame) /
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08) * sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_08) *
255.0f) + 255.0f) +
255.0f); 255.0f);
} else { } else {
this->unk_170 = 0; this->unk_170 = 0;
} }
} }
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C) { if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_0C) {
this->unk_174 = 255; this->unk_174 = 255;
} else if (currentFrame < (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C + 10.0f)) { } else if (currentFrame < (sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_0C + 10.0f)) {
this->unk_174 = this->unk_174 =
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + 255.0f); ((((sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + 255.0f);
} else { } else {
this->unk_174 = 0; this->unk_174 = 0;
} }

View file

@ -33,28 +33,28 @@ static InitChainEntry sInitChain[] = {
}; };
void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) {
DoorToki* this = THIS;
s32 pad; s32 pad;
DoorToki* this = THIS;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->actor, DPM_UNK); DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06007888, &colHeader); CollisionHeader_GetVirtual(&D_06007888, &colHeader);
this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
} }
void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx) { void DoorToki_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DoorToki* this = THIS; DoorToki* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx) { void DoorToki_Update(Actor* thisx, GlobalContext* globalCtx) {
DoorToki* this = THIS; DoorToki* this = THIS;
if (gSaveContext.eventChkInf[4] & 0x800) { if (gSaveContext.eventChkInf[4] & 0x800) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->bgId); func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} else { } else {
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->bgId); func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
} }

View file

@ -7,9 +7,8 @@
struct DoorToki; struct DoorToki;
typedef struct DoorToki { typedef struct DoorToki {
/* 0x0000 */ Actor actor; /* 0x0000 */ DynaPolyActor dyna;
/* 0x014C */ s32 bgId; /* 0x0164 */ char unk_164[0x4];
/* 0x0150 */ u8 unk_150[0x18];
} DoorToki; // size = 0x0168 } DoorToki; // size = 0x0168
extern const ActorInit Door_Toki_InitVars; extern const ActorInit Door_Toki_InitVars;

View file

@ -64,26 +64,20 @@ static ColliderCylinderInit sCylinderInit = {
{ 30, 40, 0, { 0 } }, { 30, 40, 0, { 0 } },
}; };
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 850, ICHAIN_STOP),
};
static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f };
static UNK_PTR D_809B0F80[] = {
0x06000408,
0x06001518,
0x06001D18,
};
void EnAni_SetupAction(EnAni* this, EnAniActionFunc actionFunc) { void EnAni_SetupAction(EnAni* this, EnAniActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;
} }
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 850, ICHAIN_STOP),
};
void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) {
EnAni* this = THIS;
s32 pad; s32 pad;
EnAni* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f); ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f);
@ -117,13 +111,13 @@ s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) {
} }
void func_809B04F0(EnAni* this, GlobalContext* globalCtx) { void func_809B04F0(EnAni* this, GlobalContext* globalCtx) {
if (func_8002F334(&this->actor, globalCtx) != 0) { if (func_8002F334(&this->actor, globalCtx)) {
EnAni_SetupAction(this, func_809B064C); EnAni_SetupAction(this, func_809B064C);
} }
} }
void func_809B0524(EnAni* this, GlobalContext* globalCtx) { void func_809B0524(EnAni* this, GlobalContext* globalCtx) {
if (func_8002F334(&this->actor, globalCtx) != 0) { if (func_8002F334(&this->actor, globalCtx)) {
EnAni_SetupAction(this, func_809B07F8); EnAni_SetupAction(this, func_809B07F8);
} }
} }
@ -143,10 +137,10 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) {
} }
void func_809B05F0(EnAni* this, GlobalContext* globalCtx) { void func_809B05F0(EnAni* this, GlobalContext* globalCtx) {
if (func_8002F334(this, globalCtx) != 0) { if (func_8002F334(&this->actor, globalCtx)) {
EnAni_SetupAction(this, func_809B0558); EnAni_SetupAction(this, func_809B0558);
} }
func_8002F434(this, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f); func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
} }
void func_809B064C(EnAni* this, GlobalContext* globalCtx) { void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
@ -165,7 +159,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
} }
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (func_8002F194(&this->actor, globalCtx) != 0) { if (func_8002F194(&this->actor, globalCtx)) {
if (this->actor.textId == 0x5056) { // "To get a good view..." if (this->actor.textId == 0x5056) { // "To get a good view..."
EnAni_SetupAction(this, func_809B04F0); EnAni_SetupAction(this, func_809B04F0);
} else if (this->actor.textId == 0x5055) { // "...I'll give you this as a memento." } else if (this->actor.textId == 0x5055) { // "...I'll give you this as a memento."
@ -191,7 +185,7 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
u16 textId; u16 textId;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (func_8002F194(&this->actor, globalCtx) != 0) { if (func_8002F194(&this->actor, globalCtx)) {
if (this->actor.textId == 0x5056) { // "To get a good view..." if (this->actor.textId == 0x5056) { // "To get a good view..."
EnAni_SetupAction(this, func_809B0524); EnAni_SetupAction(this, func_809B0524);
} else if (this->actor.textId == 0x5055) { // "...I'll give you this as a memento." } else if (this->actor.textId == 0x5055) { // "...I'll give you this as a memento."
@ -199,15 +193,15 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
} else { } else {
EnAni_SetupAction(this, func_809B0524); EnAni_SetupAction(this, func_809B0524);
} }
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && } else if (yawDiff > -0x36B0 && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f &&
-80.0f < this->actor.yDistToPlayer) { -80.0f < this->actor.yDistToPlayer) {
if ((gSaveContext.itemGetInf[1] & 0x20) != 0) { if (gSaveContext.itemGetInf[1] & 0x20) {
EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..." EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..."
} else { } else {
EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento." EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento."
} }
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { } else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) {
if ((gSaveContext.eventChkInf[2] & 0x8000) == 0) { if (!(gSaveContext.eventChkInf[2] & 0x8000)) {
textId = 0x5052; // "...Something is happening on Death Mountain!" textId = 0x5052; // "...Something is happening on Death Mountain!"
} else { } else {
textId = (gSaveContext.itemGetInf[1] & 0x20) ? 0x5054 : 0x5053; // "I don't feel like getting down..." textId = (gSaveContext.itemGetInf[1] & 0x20) ? 0x5054 : 0x5053; // "I don't feel like getting down..."
@ -296,12 +290,12 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100);
} }
if (DECR(this->unk_2AE) == 0) { if (DECR(this->blinkTimer) == 0) {
this->unk_2AE = Rand_S16Offset(60, 60); this->blinkTimer = Rand_S16Offset(60, 60);
} }
this->unk_2AC = this->unk_2AE; this->eyeIndex = this->blinkTimer;
if (this->unk_2AC >= 3) { if (this->eyeIndex >= 3) {
this->unk_2AC = 0; this->eyeIndex = 0;
} }
} }
@ -316,6 +310,7 @@ s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
} }
void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f };
EnAni* this = THIS; EnAni* this = THIS;
if (limbIndex == 15) { if (limbIndex == 15) {
@ -323,6 +318,12 @@ void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
} }
} }
static u64* sEyeTextures[] = {
0x06000408,
0x06001518,
0x06001D18,
};
void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnAni* this = THIS; EnAni* this = THIS;
s32 pad; s32 pad;
@ -331,7 +332,7 @@ void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_800943C8(globalCtx->state.gfxCtx); func_800943C8(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B0F80[this->unk_2AC])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this); EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this);

View file

@ -18,8 +18,8 @@ typedef struct EnAni {
/* 0x02A2 */ Vec3s unk_2A2; /* 0x02A2 */ Vec3s unk_2A2;
/* 0x02A8 */ u16 unk_2A8; /* 0x02A8 */ u16 unk_2A8;
/* 0x02AA */ u16 unk_2AA; /* 0x02AA */ u16 unk_2AA;
/* 0x02AC */ s16 unk_2AC; /* 0x02AC */ s16 eyeIndex;
/* 0x02AE */ s16 unk_2AE; /* 0x02AE */ s16 blinkTimer;
/* 0x02B0 */ EnAniActionFunc actionFunc; /* 0x02B0 */ EnAniActionFunc actionFunc;
} EnAni; // size = 0x02B4 } EnAni; // size = 0x02B4

View file

@ -52,7 +52,7 @@ void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) {
this->anubis = this->anubis =
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, this->actor.world.pos.x, (EnAnubice*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 0); this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.yawTowardsPlayer, 0, 0);
if (this->anubis != NULL) { if (this->anubis != NULL) {

View file

@ -47,7 +47,7 @@ void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->attackTimer == 0) { if (this->attackTimer == 0) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x, Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x,
this->actor.shape.rot.y, this->actor.shape.rot.z, 0xFFFFFFFF); this->actor.shape.rot.y, this->actor.shape.rot.z, -1);
this->attackTimer = 80; this->attackTimer = 80;
} }
} }

View file

@ -94,7 +94,7 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) {
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &trail); Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &trail);
Collider_InitQuad(globalCtx, &this->collider); Collider_InitQuad(globalCtx, &this->collider);
Collider_SetQuad(globalCtx, &this->collider, this, &sQuadInit); Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit);
EnBoom_SetupAction(this, EnBoom_Fly); EnBoom_SetupAction(this, EnBoom_Fly);
} }
@ -117,7 +117,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
s32 pad1; s32 pad1;
f32 distXYZScale; f32 distXYZScale;
f32 distFromLink; f32 distFromLink;
Actor* hitActor; DynaPolyActor* hitActor;
s32 hitDynaID; s32 hitDynaID;
Vec3f hitPoint; Vec3f hitPoint;
s32 pad2; s32 pad2;
@ -138,7 +138,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
distXYZScale = 0.12f; distXYZScale = 0.12f;
} }
if ((target != (Actor*)player) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) { if ((target != &player->actor) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) {
//! @bug This condition is why the boomerang will randomly fly off in a the down left direction sometimes. //! @bug This condition is why the boomerang will randomly fly off in a the down left direction sometimes.
// If the actor targetted is not Link and the difference between the 2 y angles is greater than 0x4000, // If the actor targetted is not Link and the difference between the 2 y angles is greater than 0x4000,
// the moveTo pointer is nulled and it flies off in a seemingly random direction. // the moveTo pointer is nulled and it flies off in a seemingly random direction.
@ -152,7 +152,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
// Set xyz speed, move forward, and play the boomerang sound // Set xyz speed, move forward, and play the boomerang sound
func_8002D9A4(&this->actor, 12.0f); func_8002D9A4(&this->actor, 12.0f);
Actor_MoveForward(&this->actor); Actor_MoveForward(&this->actor);
func_8002F974(this, NA_SE_IT_BOOMERANG_FLY - SFX_FLAG); func_8002F974(&this->actor, NA_SE_IT_BOOMERANG_FLY - SFX_FLAG);
// If the boomerang collides with EnItem00 or a Skulltula token, set grabbed pointer to pick it up // If the boomerang collides with EnItem00 or a Skulltula token, set grabbed pointer to pick it up
collided = this->collider.base.atFlags & AT_HIT; collided = this->collider.base.atFlags & AT_HIT;
@ -170,7 +170,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
// Otherwise handle grabbing and colliding. // Otherwise handle grabbing and colliding.
if (DECR(this->returnTimer) == 0) { if (DECR(this->returnTimer) == 0) {
distFromLink = Math_Vec3f_DistXYZ(&this->actor.world.pos, &player->actor.focus.pos); distFromLink = Math_Vec3f_DistXYZ(&this->actor.world.pos, &player->actor.focus.pos);
this->moveTo = player; this->moveTo = &player->actor;
// If the boomerang is less than 40 units away from Link, he can catch it. // If the boomerang is less than 40 units away from Link, he can catch it.
if (distFromLink < 40.0f) { if (distFromLink < 40.0f) {
@ -208,7 +208,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 ||
(hitDynaID != BGCHECK_SCENE && (hitDynaID != BGCHECK_SCENE &&
((hitActor = DynaPoly_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) && ((hitActor = DynaPoly_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) &&
hitActor->id == ACTOR_BG_BDAN_OBJECTS && hitActor->params == 0)) { hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS && hitActor->actor.params == 0)) {
collided = false; collided = false;
} else { } else {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint); CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint);
@ -221,7 +221,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
if (collided) { if (collided) {
this->actor.world.rot.x = -this->actor.world.rot.x; this->actor.world.rot.x = -this->actor.world.rot.x;
this->actor.world.rot.y += 0x8000; this->actor.world.rot.y += 0x8000;
this->moveTo = player; this->moveTo = &player->actor;
this->returnTimer = 0; this->returnTimer = 0;
} }
} }

View file

@ -15,7 +15,7 @@ typedef struct EnBoom {
/* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang
/* 0x01D4 */ u8 returnTimer; // returns to Link when 0 /* 0x01D4 */ u8 returnTimer; // returns to Link when 0
/* 0x01D5 */ u8 activeTimer; // increments once every update /* 0x01D5 */ u8 activeTimer; // increments once every update
/* 0x01D8 */ u32 effectIndex; // set by Effect_Add /* 0x01D8 */ s32 effectIndex; // set by Effect_Add
/* 0x01DC */ WeaponInfo boomerangInfo; /* 0x01DC */ WeaponInfo boomerangInfo;
/* 0x01F8 */ EnBoomActionFunc actionFunc; /* 0x01F8 */ EnBoomActionFunc actionFunc;
} EnBoom; // size = 0x01FC } EnBoom; // size = 0x01FC

View file

@ -87,7 +87,7 @@ void EnBox_SetupAction(EnBox* this, EnBoxActionFunc actionFunc) {
void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) {
f32 newY; f32 newY;
CollisionPoly* poly; CollisionPoly* poly;
s32* bgId; s32 bgId;
Vec3f pos; Vec3f pos;
pos = this->dyna.actor.world.pos; pos = this->dyna.actor.world.pos;

View file

@ -226,7 +226,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
sp60 = ABS(sp58) * 85.0f; sp60 = ABS(sp58) * 85.0f;
this->color1.g = sp60; this->color1.g = sp60;
} }
if ((((globalCtx->gameplayFrames % 4) == this->actor.params) && (this->actor.speedXZ != 0.0f) && if ((((globalCtx->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speedXZ != 0.0f) &&
(sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, (sp64 = BgCheck_AnyLineTest2(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0,
1))) || 1))) ||
(this->unk_222 == 0)) { (this->unk_222 == 0)) {
@ -865,7 +865,7 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) {
EnBw_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); EnBw_OverrideLimbDraw, NULL, this, POLY_XLU_DISP);
} }
if (((globalCtx->gameplayFrames + 1) % 4) == thisx->params) { if (((globalCtx->gameplayFrames + 1) % 4) == (u32)thisx->params) {
spAC.z = thisx->scale.z * 375000.0f; spAC.z = thisx->scale.z * 375000.0f;
Matrix_MultVec3f(&spAC, &this->unk_264); Matrix_MultVec3f(&spAC, &this->unk_264);
spAC.z = thisx->scale.z * 150000.0f; spAC.z = thisx->scale.z * 150000.0f;

View file

@ -9,13 +9,13 @@ void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx); void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx);
void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx); void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnCrow_SetupWait(EnCrow* this); void EnCrow_SetupFlyIdle(EnCrow* this);
void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx); void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx);
void func_809E10A8(EnCrow* this, GlobalContext* globalCtx); void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx);
void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx); void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx);
void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx); void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx);
void func_809E1004(EnCrow* this, GlobalContext* globalCtx); void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx);
void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx); void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx);
extern FlexSkeletonHeader D_060010C0; extern FlexSkeletonHeader D_060010C0;
extern AnimationHeader D_060000F0; extern AnimationHeader D_060000F0;
@ -120,7 +120,7 @@ void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f);
sDeathCount = 0; sDeathCount = 0;
EnCrow_SetupWait(this); EnCrow_SetupFlyIdle(this);
} }
void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -129,21 +129,23 @@ void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &this->collider); Collider_DestroyJntSph(globalCtx, &this->collider);
} }
void EnCrow_SetupWait(EnCrow* this) { // Setup Action functions
void EnCrow_SetupFlyIdle(EnCrow* this) {
this->timer = 100; this->timer = 100;
this->collider.base.acFlags |= AC_ON; this->collider.base.acFlags |= AC_ON;
this->actionFunc = EnCrow_Wait; this->actionFunc = EnCrow_FlyIdle;
this->skelAnime.playSpeed = 1.0f; this->skelAnime.playSpeed = 1.0f;
} }
void func_809E0384(EnCrow* this) { void EnCrow_SetupDiveAttack(EnCrow* this) {
this->timer = 300; this->timer = 300;
this->actor.speedXZ = 4.0f; this->actor.speedXZ = 4.0f;
this->skelAnime.playSpeed = 2.0f; this->skelAnime.playSpeed = 2.0f;
this->actionFunc = func_809E0C8C; this->actionFunc = EnCrow_DiveAttack;
} }
void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) {
s32 i; s32 i;
f32 scale; f32 scale;
Vec3f iceParticlePos; Vec3f iceParticlePos;
@ -158,7 +160,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
this->actor.targetArrowOffset = 0.0f; this->actor.targetArrowOffset = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_DEAD); Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_DEAD);
if (this->actor.colChkInfo.damageEffect == 3) { if (this->actor.colChkInfo.damageEffect == 3) { // Ice arrows
func_8003426C(&this->actor, 0, 255, 0, 40); func_8003426C(&this->actor, 0, 255, 0, 40);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x; iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x;
@ -167,7 +169,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255,
((Rand_ZeroOne() * 0.15f) + 0.85f) * scale); ((Rand_ZeroOne() * 0.15f) + 0.85f) * scale);
} }
} else if (this->actor.colChkInfo.damageEffect == 2) { } else if (this->actor.colChkInfo.damageEffect == 2) { // Fire arrows and Din's Fire
func_8003426C(&this->actor, 0x4000, 255, 0, 40); func_8003426C(&this->actor, 0x4000, 255, 0, 40);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
@ -184,7 +186,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
this->collider.base.acFlags &= ~AC_ON; this->collider.base.acFlags &= ~AC_ON;
this->actor.flags |= 0x10; this->actor.flags |= 0x10;
this->actionFunc = func_809E0E2C; this->actionFunc = EnCrow_Damaged;
} }
void EnCrow_SetupDie(EnCrow* this) { void EnCrow_SetupDie(EnCrow* this) {
@ -192,7 +194,7 @@ void EnCrow_SetupDie(EnCrow* this) {
this->actionFunc = EnCrow_Die; this->actionFunc = EnCrow_Die;
} }
void func_809E06E8(EnCrow* this) { void EnCrow_SetupTurnAway(EnCrow* this) {
this->timer = 100; this->timer = 100;
this->actor.speedXZ = 3.5f; this->actor.speedXZ = 3.5f;
this->aimRotX = -0x1000; this->aimRotX = -0x1000;
@ -200,10 +202,10 @@ void func_809E06E8(EnCrow* this) {
this->skelAnime.playSpeed = 2.0f; this->skelAnime.playSpeed = 2.0f;
func_8003426C(&this->actor, 0, 255, 0, 5); func_8003426C(&this->actor, 0, 255, 0, 5);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->actionFunc = func_809E1004; this->actionFunc = EnCrow_TurnAway;
} }
void func_809E0770(EnCrow* this) { void EnCrow_SetupRespawn(EnCrow* this) {
if (sDeathCount == 10) { if (sDeathCount == 10) {
this->actor.params = 1; this->actor.params = 1;
sDeathCount = 0; sDeathCount = 0;
@ -222,10 +224,12 @@ void func_809E0770(EnCrow* this) {
this->actor.shape.yOffset = 2000; this->actor.shape.yOffset = 2000;
this->actor.targetArrowOffset = 2000.0f; this->actor.targetArrowOffset = 2000.0f;
this->actor.draw = NULL; this->actor.draw = NULL;
this->actionFunc = func_809E10A8; this->actionFunc = EnCrow_Respawn;
} }
void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) { // Action functions
void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
s32 skelanimeUpdated; s32 skelanimeUpdated;
s16 var; s16 var;
@ -278,11 +282,11 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
} }
if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x00800000) && if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x00800000) &&
(this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) { (this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
func_809E0384(this); EnCrow_SetupDiveAttack(this);
} }
} }
void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
s32 yaw; s32 yaw;
Vec3f pos; Vec3f pos;
@ -320,11 +324,11 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK); Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK);
} }
EnCrow_SetupWait(this); EnCrow_SetupFlyIdle(this);
} }
} }
void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
this->actor.colorFilterTimer = 40; this->actor.colorFilterTimer = 40;
@ -334,7 +338,7 @@ void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx) {
this->actor.shape.rot.z += 0x1780; this->actor.shape.rot.z += 0x1780;
} }
if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) {
EffectSsDeadDb_Spawn(globalCtx, &this->actor.world, &sZeroVecAccel, &sZeroVecAccel, EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel,
this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1);
EnCrow_SetupDie(this); EnCrow_SetupDie(this);
} }
@ -357,13 +361,13 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) {
} else { } else {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
} }
func_809E0770(this); EnCrow_SetupRespawn(this);
} }
this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; this->actor.scale.z = this->actor.scale.y = this->actor.scale.x;
} }
void func_809E1004(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) { if (this->actor.bgCheckFlags & 8) {
@ -379,11 +383,11 @@ void func_809E1004(EnCrow* this, GlobalContext* globalCtx) {
this->timer--; this->timer--;
} }
if (this->timer == 0) { if (this->timer == 0) {
EnCrow_SetupWait(this); EnCrow_SetupFlyIdle(this);
} }
} }
void func_809E10A8(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) {
f32 target; f32 target;
if (this->timer != 0) { if (this->timer != 0) {
@ -402,24 +406,24 @@ void func_809E10A8(EnCrow* this, GlobalContext* globalCtx) {
this->actor.flags |= 1; this->actor.flags |= 1;
this->actor.flags &= ~0x10; this->actor.flags &= ~0x10;
this->actor.colChkInfo.health = 1; this->actor.colChkInfo.health = 1;
EnCrow_SetupWait(this); EnCrow_SetupFlyIdle(this);
} }
this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; this->actor.scale.z = this->actor.scale.y = this->actor.scale.x;
} }
} }
void func_809E1174(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) { if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT; this->collider.base.acFlags &= ~AC_HIT;
func_80035650(&this->actor, &this->collider.elements[0].info, 1); func_80035650(&this->actor, &this->collider.elements[0].info, 1);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {
if (this->actor.colChkInfo.damageEffect == 1) { if (this->actor.colChkInfo.damageEffect == 1) { // Deku Nuts
func_809E06E8(this); EnCrow_SetupTurnAway(this);
} else { } else {
Actor_ApplyDamage(&this->actor); Actor_ApplyDamage(&this->actor);
this->actor.flags &= ~1; this->actor.flags &= ~1;
func_80032C7C(globalCtx, &this->actor); func_80032C7C(globalCtx, &this->actor);
func_809E03B4(this, globalCtx); EnCrow_SetupDamaged(this, globalCtx);
} }
} }
} }
@ -431,13 +435,13 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
f32 height; f32 height;
f32 scale; f32 scale;
func_809E1174(this, globalCtx); EnCrow_UpdateDamage(this, globalCtx);
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
scale = this->actor.scale.x * 100.0f; scale = this->actor.scale.x * 100.0f;
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.x = -this->actor.shape.rot.x; this->actor.world.rot.x = -this->actor.shape.rot.x;
if (this->actionFunc != func_809E10A8) { if (this->actionFunc != EnCrow_Respawn) {
if (this->actor.colChkInfo.health != 0) { if (this->actor.colChkInfo.health != 0) {
height = 20.0f * scale; height = 20.0f * scale;
func_8002D97C(&this->actor); func_8002D97C(&this->actor);
@ -454,7 +458,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + height; this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + height;
this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z;
if (this->actionFunc == func_809E0C8C) { if (this->actionFunc == EnCrow_DiveAttack) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} }
@ -462,7 +466,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} }
if (this->actionFunc != func_809E10A8) { if (this->actionFunc != EnCrow_Respawn) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} }

View file

@ -12,7 +12,7 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnCs_Walk(EnCs* this, GlobalContext* globalCtx); void EnCs_Walk(EnCs* this, GlobalContext* globalCtx);
void EnCs_Talk(EnCs* this, GlobalContext* globalCtx); void EnCs_Talk(EnCs* this, GlobalContext* globalCtx);
void EnCs_Wait(EnCs* this, GlobalContext* globalCtx); void EnCs_Wait(EnCs* this, GlobalContext* globalCtx);
s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx); s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx);
void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); void EnCs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
extern FlexSkeletonHeader D_06008540; // Graveyard boy skeleton extern FlexSkeletonHeader D_06008540; // Graveyard boy skeleton
@ -215,7 +215,7 @@ void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) {
} else { } else {
func_8002F374(globalCtx, &this->actor, &sp2A, &sp28); func_8002F374(globalCtx, &this->actor, &sp2A, &sp28);
if ((sp2A >= 0) && (sp2A <= 320) && (sp28 >= 0) && (sp28 <= 240) && (func_8002F2CC(this, globalCtx, 100.0f))) { if ((sp2A >= 0) && (sp2A <= 320) && (sp28 >= 0) && (sp28 <= 240) && (func_8002F2CC(&this->actor, globalCtx, 100.0f))) {
this->actor.textId = EnCs_GetTextID(this, globalCtx); this->actor.textId = EnCs_GetTextID(this, globalCtx);
} }
} }
@ -446,7 +446,7 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_cs.c", 1015); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_cs.c", 1015);
} }
s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx) { s32 EnCs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnCs* this = THIS; EnCs* this = THIS;
if (this->flag & 1) { if (this->flag & 1) {

View file

@ -118,7 +118,7 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007958, NULL, &this->jointTable, &this->morphTable, 17); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007958, NULL, this->jointTable, this->morphTable, 17);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@ -391,12 +391,12 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) {
Actor_MoveForward(&this->actor); Actor_MoveForward(&this->actor);
if (this->flags & 0x40) { if (this->flags & 0x40) {
Actor_UpdateBgCheckInfo(globalCtx, this, 0.0f, 0.0f, 0.0f, 4); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
} else if (this->flags & 0x80) { } else if (this->flags & 0x80) {
this->runFlag |= 1; this->runFlag |= 1;
this->flags &= ~0x0080; this->flags &= ~0x0080;
} else if (this->runFlag & 1) { } else if (this->runFlag & 1) {
Actor_UpdateBgCheckInfo(globalCtx, this, 0.0f, 0.0f, 0.0f, 4); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
this->runFlag &= ~1; this->runFlag &= ~1;
} }

View file

@ -251,12 +251,12 @@ void func_809ECA50(EnDha* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->unk_1DC.x, playerPos.x, 1.0f, 16.0f, 0.0f); Math_SmoothStepToF(&this->unk_1DC.x, playerPos.x, 1.0f, 16.0f, 0.0f);
Math_SmoothStepToF(&this->unk_1DC.y, playerPos.y, 1.0f, 16.0f, 0.0f); Math_SmoothStepToF(&this->unk_1DC.y, playerPos.y, 1.0f, 16.0f, 0.0f);
Math_SmoothStepToF(&this->unk_1DC.z, playerPos.z, 1.0f, 16.0f, 0.0f); Math_SmoothStepToF(&this->unk_1DC.z, playerPos.z, 1.0f, 16.0f, 0.0f);
func_80035844(&this->unk_1F4, &this->unk_1DC, &test, 0); func_80035844(&this->unk_1F4, &this->unk_1DC, &test.x, 0);
Matrix_Translate(this->unk_1DC.x, this->unk_1DC.y, this->unk_1DC.z, MTXMODE_NEW); Matrix_Translate(this->unk_1DC.x, this->unk_1DC.y, this->unk_1DC.z, MTXMODE_NEW);
Matrix_RotateRPY(test.x, test.y, 0, MTXMODE_APPLY); Matrix_RotateRPY(test.x, test.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809ED758, &this->unk_1F4); Matrix_MultVec3f(&D_809ED758, &this->unk_1F4);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
func_80035844(&this->actor.world.pos, &this->unk_1F4, &test, 0); func_80035844(&this->actor.world.pos, &this->unk_1F4, &test.x, 0);
Matrix_RotateRPY(test.x, test.y, 0, MTXMODE_APPLY); Matrix_RotateRPY(test.x, test.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809ED74C, &this->unk_1F4); Matrix_MultVec3f(&D_809ED74C, &this->unk_1F4);
this->unk_1CE = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_1F4); this->unk_1CE = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_1F4);

View file

@ -76,8 +76,8 @@ static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF };
void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDodojr* this = THIS; EnDodojr* this = THIS;
ActorShape_Init(&this->actor.shape.rot.x, 0.0f, NULL, 18.0f); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020E0, &D_060009D4, &this->jointTable, &this->morphTable, 15); SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020E0, &D_060009D4, this->jointTable, this->morphTable, 15);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit);
@ -220,7 +220,7 @@ void func_809F6BBC(EnDodojr* this) {
void func_809F6C24(EnDodojr* this) { void func_809F6C24(EnDodojr* this) {
Animation_Change(&this->skelAnime, &D_06000724, 1.0f, 8.0f, 12.0f, ANIMMODE_ONCE, 0.0f); Animation_Change(&this->skelAnime, &D_06000724, 1.0f, 8.0f, 12.0f, ANIMMODE_ONCE, 0.0f);
Audio_PlayActorSound2(this, NA_SE_EN_DODO_M_EAT); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_EAT);
this->actor.speedXZ = 0.0f; this->actor.speedXZ = 0.0f;
this->actor.velocity.x = 0.0f; this->actor.velocity.x = 0.0f;
this->actor.velocity.z = 0.0f; this->actor.velocity.z = 0.0f;
@ -276,7 +276,7 @@ s32 func_809F6DD0(EnDodojr* this) {
} else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->bomb->world.pos) > 30.0f) { } else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->bomb->world.pos) > 30.0f) {
return 0; return 0;
} else { } else {
this->bomb->parent = this; this->bomb->parent = &this->actor;
return 1; return 1;
} }
} }
@ -419,7 +419,7 @@ void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) {
void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) {
f32 sp2C; f32 sp2C;
Math_SmoothStepToS(&this->actor.shape, 0, 4, 0x3E8, 0x64); Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 4, 0x3E8, 0x64);
sp2C = this->actor.shape.rot.x; sp2C = this->actor.shape.rot.x;
sp2C /= 16384.0f; sp2C /= 16384.0f;
this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C); this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C);
@ -563,7 +563,7 @@ void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) {
} }
void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) { void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) {
func_8002D868(this); func_8002D868(&this->actor);
Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10);
this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.world.rot.x = this->actor.shape.rot.x;
@ -625,7 +625,7 @@ void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx) {
func_809F72A4(this, globalCtx); func_809F72A4(this, globalCtx);
} }
s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnDodojr* this = THIS; EnDodojr* this = THIS;
Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f }; Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f };
@ -637,10 +637,10 @@ s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
Matrix_MultVec3f(&D_809F7F64, &this->headPos); Matrix_MultVec3f(&D_809F7F64, &this->headPos);
} }
return 0; return false;
} }
void func_809F7DFC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { void func_809F7DFC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
} }
void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx) { void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -74,7 +74,7 @@ typedef enum {
/* 0x03 */ DOG_SIT, /* 0x03 */ DOG_SIT,
/* 0x04 */ DOG_SIT_2, /* 0x04 */ DOG_SIT_2,
/* 0x05 */ DOG_BOW, /* 0x05 */ DOG_BOW,
/* 0x06 */ DOG_BOW_2, /* 0x06 */ DOG_BOW_2
} DogBehavior; } DogBehavior;
extern FlexSkeletonHeader D_06007290; extern FlexSkeletonHeader D_06007290;

View file

@ -192,7 +192,7 @@ void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) {
case 2: // have 100 rupees and empty bottle case 2: // have 100 rupees and empty bottle
Rupees_ChangeBy(-100); Rupees_ChangeBy(-100);
this->actor.flags &= ~0x10000; this->actor.flags &= ~0x10000;
func_8002F434(this, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f); func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f);
this->actionFunc = EnDs_GiveBluePotion; this->actionFunc = EnDs_GiveBluePotion;
return; return;
} }
@ -229,7 +229,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
this->actor.textId = 0x5048; this->actor.textId = 0x5048;
if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToPlayer < 200.0f)) { if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToPlayer < 200.0f)) {
func_8002F298(this, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM); func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM);
this->unk_1E8 |= 1; this->unk_1E8 |= 1;
} }
} }
@ -245,7 +245,7 @@ void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx); this->actionFunc(this, globalCtx);
if (this->unk_1E8 & 1) { if (this->unk_1E8 & 1) {
func_80038290(globalCtx, this, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); func_80038290(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos);
} else { } else {
Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100); Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100);
Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100); Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100);

View file

@ -1,3 +1,9 @@
/*
* File: z_en_fd.c
* Overlay: ovl_En_Fd
* Description: Flare Dancer (enflamed form)
*/
#include "z_en_fd.h" #include "z_en_fd.h"
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
@ -312,7 +318,7 @@ s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) {
*/ */
s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) { s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) {
CollisionPoly* colPoly; CollisionPoly* colPoly;
u32 bgId; s32 bgId;
Vec3f colPoint; Vec3f colPoint;
s16 angle; s16 angle;
s32 pad; s32 pad;
@ -400,7 +406,7 @@ Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) {
s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16* runDir) { s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16* runDir) {
CollisionPoly* poly; CollisionPoly* poly;
u32 bgId; s32 bgId;
Vec3f colPoint; Vec3f colPoint;
Vec3f pos; Vec3f pos;

View file

@ -1,3 +1,9 @@
/*
* File: z_en_firefly.c
* Overlay: ovl_En_Firefly
* Description: Keese (Normal, Fire, Ice)
*/
#include "z_en_firefly.h" #include "z_en_firefly.h"
#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h"
@ -198,7 +204,7 @@ void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyJntSph(globalCtx, &this->collider); Collider_DestroyJntSph(globalCtx, &this->collider);
} }
void EnFirefly_SetupWait(EnFirefly* this) { void EnFirefly_SetupFlyIdle(EnFirefly* this) {
this->timer = Rand_S16Offset(70, 100); this->timer = Rand_S16Offset(70, 100);
this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f;
Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300);
@ -515,7 +521,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) {
if (((fabsf(this->actor.world.pos.y - this->maxAltitude) < 10.0f) && if (((fabsf(this->actor.world.pos.y - this->maxAltitude) < 10.0f) &&
(Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) < 20.0f)) || (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) < 20.0f)) ||
(this->timer == 0)) { (this->timer == 0)) {
EnFirefly_SetupWait(this); EnFirefly_SetupFlyIdle(this);
return; return;
} }
Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f);
@ -548,7 +554,7 @@ void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) {
} else if (this->actor.params == KEESE_ICE_FLY) { } else if (this->actor.params == KEESE_ICE_FLY) {
this->auraType = KEESE_AURA_ICE; this->auraType = KEESE_AURA_ICE;
} }
EnFirefly_SetupWait(this); EnFirefly_SetupFlyIdle(this);
} }
} }
@ -600,7 +606,7 @@ void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
} }
if (this->timer == 0) { if (this->timer == 0) {
EnFirefly_SetupWait(this); EnFirefly_SetupFlyIdle(this);
} }
} }
@ -638,7 +644,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) {
} else if (!this->onFire) { } else if (!this->onFire) {
EnFirefly_Ignite(this); EnFirefly_Ignite(this);
if (this->actionFunc == EnFirefly_Perch) { if (this->actionFunc == EnFirefly_Perch) {
EnFirefly_SetupWait(this); EnFirefly_SetupFlyIdle(this);
} }
} }
} else if (damageEffect == 3) { // Ice Arrows or Ice Magic } else if (damageEffect == 3) { // Ice Arrows or Ice Magic

View file

@ -83,12 +83,12 @@ extern CutsceneData D_0200E080[];
typedef enum { typedef enum {
/* 0x00 */ FU_FACE_CALM, /* 0x00 */ FU_FACE_CALM,
/* 0x01 */ FU_FACE_MAD, /* 0x01 */ FU_FACE_MAD
} EnFuFace; } EnFuFace;
void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) {
EnFu* this = THIS;
s32 pad; s32 pad;
EnFu* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelanime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable, 16); SkelAnime_InitFlex(globalCtx, &this->skelanime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable, 16);
@ -111,6 +111,7 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnFu* this = THIS; EnFu* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider); Collider_DestroyCylinder(globalCtx, &this->collider);
} }
@ -146,9 +147,8 @@ void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) {
} }
void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) {
u16 textID; u16 textID = Text_GetFaceReaction(globalCtx, 0xB);
textID = Text_GetFaceReaction(globalCtx, 0xB);
if (textID == 0) { if (textID == 0) {
textID = (gSaveContext.eventChkInf[6] & 0x80) ? 0x5033 : 0x5032; textID = (gSaveContext.eventChkInf[6] & 0x80) ? 0x5033 : 0x5032;
// 0x5032: "Go around!..I'm so happy!..I'm trying to come up with a musical theme inspired by this windmill..." // 0x5032: "Go around!..I'm so happy!..I'm trying to come up with a musical theme inspired by this windmill..."
@ -175,7 +175,7 @@ void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) {
void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) { void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) {
// if dialog state is 2 set action to WaitAdult // if dialog state is 2 set action to WaitAdult
if (func_8002F334(this, globalCtx)) { if (func_8002F334(&this->actor, globalCtx)) {
this->actionFunc = EnFu_WaitAdult; this->actionFunc = EnFu_WaitAdult;
} }
} }
@ -206,6 +206,7 @@ void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) {
void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
player->stateFlags2 |= 0x800000; player->stateFlags2 |= 0x800000;
// if dialog state is 7, player has played back the song // if dialog state is 7, player has played back the song
if (func_8010BDBC(&globalCtx->msgCtx) == 7) { if (func_8010BDBC(&globalCtx->msgCtx) == 7) {
@ -216,6 +217,7 @@ void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) {
void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
player->stateFlags2 |= 0x800000; player->stateFlags2 |= 0x800000;
// if dialog state is 2, start song demonstration // if dialog state is 2, start song demonstration
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
@ -250,8 +252,8 @@ void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) {
} }
void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) {
EnFu* this = THIS;
s32 pad; s32 pad;
EnFu* this = THIS;
Collider_UpdateCylinder(&this->actor, &this->collider); Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);

View file

@ -1,3 +1,9 @@
/*
* File: z_en_fw.c
* Overlay: ovl_En_Fw
* Description: Flare Dancer Core
*/
#include "z_en_fw.h" #include "z_en_fw.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
@ -97,7 +103,7 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) {
s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
CollisionPoly* poly; CollisionPoly* poly;
u32 bgId; s32 bgId;
Vec3f collisionPos; Vec3f collisionPos;
if (this->actor.xzDistToPlayer > 300.0f) { if (this->actor.xzDistToPlayer > 300.0f) {

View file

@ -95,14 +95,14 @@ static EnGoAnimation sAnimationEntries[] = {
{ &D_06010590, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, { &D_06010590, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f },
}; };
void EnGo_SetupAction(EnGo* this, EnGoActionFunc* actionFunc) { void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;
} }
u16 EnGo_GetTextID(GlobalContext* globalCtx, EnGo* this) { u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) {
Player* player = PLAYER; Player* player = PLAYER;
switch (this->actor.params & 0xF0) { switch (thisx->params & 0xF0) {
case 0x90: case 0x90:
if (gSaveContext.bgsFlag) { if (gSaveContext.bgsFlag) {
return 0x305E; return 0x305E;
@ -146,7 +146,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, EnGo* this) {
} }
} }
case 0x10: case 0x10:
if (Flags_GetSwitch(globalCtx, this->actor.params >> 8)) { if (Flags_GetSwitch(globalCtx, thisx->params >> 8)) {
return 0x3052; return 0x3052;
} else { } else {
return 0x3051; return 0x3051;
@ -206,16 +206,16 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, EnGo* this) {
} }
} }
s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) { s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
s16 unkState = 1; s16 unkState = 1;
f32 xzRange; f32 xzRange;
f32 yRange = fabsf(this->actor.yDistToPlayer) + 1.0f; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f;
xzRange = this->actor.xzDistToPlayer + 1.0f; xzRange = thisx->xzDistToPlayer + 1.0f;
switch (func_8010BDBC(&globalCtx->msgCtx)) { switch (func_8010BDBC(&globalCtx->msgCtx)) {
if (globalCtx) {} if (globalCtx) {}
case 2: case 2:
switch (this->actor.textId) { switch (thisx->textId) {
case 0x3008: case 0x3008:
gSaveContext.infTable[14] |= 1; gSaveContext.infTable[14] |= 1;
unkState = 0; unkState = 0;
@ -237,7 +237,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) {
unkState = 0; unkState = 0;
break; break;
case 0x3036: case 0x3036:
func_8002F434(&this->actor, globalCtx, GI_TUNIC_GORON, xzRange, yRange); func_8002F434(thisx, globalCtx, GI_TUNIC_GORON, xzRange, yRange);
gSaveContext.infTable[16] |= 0x2000; // EnGo exclusive flag gSaveContext.infTable[16] |= 0x2000; // EnGo exclusive flag
unkState = 2; unkState = 2;
break; break;
@ -268,33 +268,33 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) {
break; break;
case 4: case 4:
if (func_80106BC8(globalCtx)) { if (func_80106BC8(globalCtx)) {
switch (this->actor.textId) { switch (thisx->textId) {
case 0x300A: case 0x300A:
if (globalCtx->msgCtx.choiceIndex == 0) { if (globalCtx->msgCtx.choiceIndex == 0) {
if (CUR_UPG_VALUE(UPG_STRENGTH) || (gSaveContext.infTable[14] & 0x800)) { if (CUR_UPG_VALUE(UPG_STRENGTH) || (gSaveContext.infTable[14] & 0x800)) {
this->actor.textId = 0x300B; thisx->textId = 0x300B;
} else { } else {
this->actor.textId = 0x300C; thisx->textId = 0x300C;
} }
} else { } else {
this->actor.textId = 0x300D; thisx->textId = 0x300D;
} }
func_8010B720(globalCtx, this->actor.textId); func_8010B720(globalCtx, thisx->textId);
unkState = 1; unkState = 1;
break; break;
case 0x3034: case 0x3034:
if (globalCtx->msgCtx.choiceIndex == 0) { if (globalCtx->msgCtx.choiceIndex == 0) {
if (gSaveContext.infTable[16] & 0x800) { if (gSaveContext.infTable[16] & 0x800) {
this->actor.textId = 0x3033; thisx->textId = 0x3033;
} else { } else {
this->actor.textId = 0x3035; thisx->textId = 0x3035;
} }
} else if (gSaveContext.infTable[16] & 0x800) { } else if (gSaveContext.infTable[16] & 0x800) {
this->actor.textId = 0x3036; thisx->textId = 0x3036;
} else { } else {
this->actor.textId = 0x3033; thisx->textId = 0x3033;
} }
func_8010B720(globalCtx, this->actor.textId); func_8010B720(globalCtx, thisx->textId);
unkState = 1; unkState = 1;
break; break;
case 0x3054: case 0x3054:
@ -302,8 +302,8 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) {
if (globalCtx->msgCtx.choiceIndex == 0) { if (globalCtx->msgCtx.choiceIndex == 0) {
unkState = 2; unkState = 2;
} else { } else {
this->actor.textId = 0x3056; thisx->textId = 0x3056;
func_8010B720(globalCtx, this->actor.textId); func_8010B720(globalCtx, thisx->textId);
unkState = 1; unkState = 1;
} }
gSaveContext.infTable[11] |= 0x10; gSaveContext.infTable[11] |= 0x10;
@ -313,13 +313,13 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) {
break; break;
case 5: case 5:
if (func_80106BC8(globalCtx)) { if (func_80106BC8(globalCtx)) {
switch (this->actor.textId) { switch (thisx->textId) {
case 0x3035: case 0x3035:
gSaveContext.infTable[16] |= 0x800; gSaveContext.infTable[16] |= 0x800;
case 0x3032: case 0x3032:
case 0x3033: case 0x3033:
this->actor.textId = 0x3034; thisx->textId = 0x3034;
func_8010B720(globalCtx, this->actor.textId); func_8010B720(globalCtx, thisx->textId);
unkState = 1; unkState = 1;
break; break;
default: default:
@ -597,10 +597,10 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) {
if ((this->actor.params & 0xF0) == 0x90) { if ((this->actor.params & 0xF0) == 0x90) {
isUnkCondition = isUnkCondition =
func_80A3ED24(globalCtx, &this->actor, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); func_80A3ED24(globalCtx, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates);
} else { } else {
isUnkCondition = isUnkCondition =
func_800343CC(globalCtx, &this->actor, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates); func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates);
} }
if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) { if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) {

View file

@ -338,7 +338,7 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
s32 bombBagUpgrade; s32 bombBagUpgrade;
switch (func_8010BDBC(&globalCtx->msgCtx)) { switch (func_8010BDBC(&globalCtx->msgCtx)) {
@ -367,7 +367,7 @@ u16 EnGo2_GetTextIdGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) {
} }
// DMT Goron by Bomb Flower Choice // DMT Goron by Bomb Flower Choice
u16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) {
switch (func_8010BDBC(&globalCtx->msgCtx)) { switch (func_8010BDBC(&globalCtx->msgCtx)) {
case 2: case 2:
if ((this->actor.textId == 0x300B) && (gSaveContext.infTable[14] & 0x800) == 0) { if ((this->actor.textId == 0x300B) && (gSaveContext.infTable[14] & 0x800) == 0) {
@ -402,7 +402,7 @@ u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
return 0; return 0;
} else { } else {
@ -420,7 +420,7 @@ u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x3008) { if (this->actor.textId == 0x3008) {
gSaveContext.infTable[14] |= 0x1; gSaveContext.infTable[14] |= 0x1;
@ -441,7 +441,7 @@ u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x3014) { if (this->actor.textId == 0x3014) {
gSaveContext.infTable[15] |= 0x1; gSaveContext.infTable[15] |= 0x1;
@ -462,7 +462,7 @@ u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x3016) { if (this->actor.textId == 0x3016) {
gSaveContext.infTable[15] |= 0x10; gSaveContext.infTable[15] |= 0x10;
@ -485,7 +485,7 @@ u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x3018) { if (this->actor.textId == 0x3018) {
gSaveContext.infTable[15] |= 0x100; gSaveContext.infTable[15] |= 0x100;
@ -510,7 +510,7 @@ u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
switch (EnGo2_GetDialogState(this, globalCtx)) { switch (EnGo2_GetDialogState(this, globalCtx)) {
case 2: case 2:
switch (this->actor.textId) { switch (this->actor.textId) {
@ -580,7 +580,7 @@ u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
s32 unusedPad; s32 unusedPad;
u8 dialogState = this->dialogState; u8 dialogState = this->dialogState;
@ -648,7 +648,7 @@ u16 EnGo2_GetTextIdGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) {
switch (func_8010BDBC(&globalCtx->msgCtx)) { switch (func_8010BDBC(&globalCtx->msgCtx)) {
case 2: case 2:
return 0; return 0;
@ -669,7 +669,7 @@ u16 EnGo2_GetTextIdGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) {
return LINK_IS_CHILD ? gSaveContext.infTable[14] & 0x8 ? 0x3022 : 0x300E : 0x3043; return LINK_IS_CHILD ? gSaveContext.infTable[14] & 0x8 ? 0x3022 : 0x300E : 0x3043;
} }
u16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x300E) { if (this->actor.textId == 0x300E) {
gSaveContext.infTable[14] |= 0x8; gSaveContext.infTable[14] |= 0x8;
@ -685,7 +685,7 @@ u16 EnGo2_GetTextIdGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) {
return 0x7122; return 0x7122;
} }
u16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
return 0; return 0;
} else { } else {
@ -705,7 +705,7 @@ u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (this->actor.textId == 0x3024) { if (this->actor.textId == 0x3024) {
gSaveContext.infTable[14] |= 0x40; gSaveContext.infTable[14] |= 0x40;
@ -725,7 +725,7 @@ u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
return 0; return 0;
} else { } else {
@ -733,7 +733,8 @@ u16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetTextId(GlobalContext* globalCtx, EnGo2* this) { u16 EnGo2_GetTextId(GlobalContext* globalCtx, Actor* thisx) {
EnGo2* this = THIS;
u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x20); u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x20);
if (faceReaction) { if (faceReaction) {
@ -772,7 +773,9 @@ u16 EnGo2_GetTextId(GlobalContext* globalCtx, EnGo2* this) {
} }
} }
u16 EnGo2_GetState(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetState(GlobalContext* globalCtx, Actor* thisx) {
EnGo2* this = THIS;
switch (this->actor.params & 0x1F) { switch (this->actor.params & 0x1F) {
case GORON_CITY_ROLLING_BIG: case GORON_CITY_ROLLING_BIG:
return EnGo2_GetStateGoronCityRollingBig(globalCtx, this); return EnGo2_GetStateGoronCityRollingBig(globalCtx, this);
@ -816,10 +819,10 @@ s32 func_80A44790(EnGo2* this, GlobalContext* globalCtx) {
this->unk_194.unk_00 = 1; this->unk_194.unk_00 = 1;
return true; return true;
} else if (this->unk_194.unk_00 != 0) { } else if (this->unk_194.unk_00 != 0) {
this->unk_194.unk_00 = EnGo2_GetState(globalCtx, this); this->unk_194.unk_00 = EnGo2_GetState(globalCtx, &this->actor);
return false; return false;
} else if (func_8002F2CC(&this->actor, globalCtx, this->unk_218)) { } else if (func_8002F2CC(&this->actor, globalCtx, this->unk_218)) {
this->actor.textId = EnGo2_GetTextId(globalCtx, this); this->actor.textId = EnGo2_GetTextId(globalCtx, &this->actor);
} }
return false; return false;
} }
@ -854,8 +857,8 @@ void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) {
pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y));
pos.y += D_80A4816C[this->actor.params & 0x1F].yDist; pos.y += D_80A4816C[this->actor.params & 0x1F].yDist;
this->collider.dim.pos = pos; this->collider.dim.pos = pos;
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} }
void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) {
@ -896,7 +899,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) {
globalCtx->damagePlayer(globalCtx, -4); globalCtx->damagePlayer(globalCtx, -4);
func_8002F71C(globalCtx, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); func_8002F71C(globalCtx, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f);
Audio_PlayActorSound2(player, NA_SE_PL_BODY_HIT); Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
this->collider.base.ocFlags1 &= ~0x8; this->collider.base.ocFlags1 &= ~0x8;
} }
} }
@ -1497,7 +1500,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600FEF0, NULL, &this->jointTable, &this->morphTable, 18); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600FEF0, NULL, this->jointTable, this->morphTable, 18);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);

View file

@ -285,24 +285,23 @@ void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) {
} }
void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) {
Actor* thisx; s32 pad;
f32 frameCount; f32 frameCount = this->skelAnime.curFrame;
BgSpot15Saku* actor;
BgSpot15Saku* actor = (BgSpot15Saku*)globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
frameCount = this->skelAnime.curFrame;
thisx = &this->actor;
actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if ((frameCount >= 12.0f) && (!this->audioFlag)) { if ((frameCount >= 12.0f) && (!this->audioFlag)) {
Audio_PlayActorSound2(thisx, NA_SE_EV_SPEAR_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EV_SPEAR_HIT);
this->audioFlag = 1; this->audioFlag = 1;
} }
if (this->unk_2EC <= frameCount) { if (this->unk_2EC <= frameCount) {
while (actor != NULL) { while (actor != NULL) {
if (ACTOR_BG_SPOT15_SAKU != actor->dyna.actor.id) { if (actor->dyna.actor.id != ACTOR_BG_SPOT15_SAKU) {
actor = (BgSpot15Saku*)(actor->dyna.actor.next); actor = (BgSpot15Saku*)(actor->dyna.actor.next);
} else { } else {
this->gate = actor; this->gate = &actor->dyna.actor;
actor->unk_168 = 1; actor->unk_168 = 1;
break; break;
} }
@ -469,7 +468,7 @@ void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) {
if (gate->dyna.actor.id != ACTOR_BG_GATE_SHUTTER) { if (gate->dyna.actor.id != ACTOR_BG_GATE_SHUTTER) {
gate = (BgGateShutter*)gate->dyna.actor.next; gate = (BgGateShutter*)gate->dyna.actor.next;
} else { } else {
this->gate = gate; this->gate = &gate->dyna.actor;
gate->openingState = 1; gate->openingState = 1;
break; break;
} }
@ -615,24 +614,22 @@ void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) {
} }
void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) {
Actor* thisx; s32 pad;
f32 frameCount; f32 frameCount = this->skelAnime.curFrame;
BgGateShutter* gate; BgGateShutter* gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head);
frameCount = this->skelAnime.curFrame;
thisx = &this->actor;
gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if ((frameCount >= 12.0f) && (!this->audioFlag)) { if ((frameCount >= 12.0f) && (!this->audioFlag)) {
Audio_PlayActorSound2(thisx, NA_SE_EV_SPEAR_HIT); Audio_PlayActorSound2(&this->actor, NA_SE_EV_SPEAR_HIT);
this->audioFlag = 1; this->audioFlag = 1;
} }
if (this->unk_2EC <= frameCount) { if (this->unk_2EC <= frameCount) {
while (gate != NULL) { while (gate != NULL) {
if (ACTOR_BG_GATE_SHUTTER != gate->dyna.actor.id) { if (ACTOR_BG_GATE_SHUTTER != gate->dyna.actor.id) {
gate = (BgGateShutter*)(gate->dyna.actor.next); gate = (BgGateShutter*)(gate->dyna.actor.next);
} else { } else {
this->gate = gate; this->gate = &gate->dyna.actor;
if (this->unk_30A != 2) { if (this->unk_30A != 2) {
gate->openingState = -1; gate->openingState = -1;
break; break;
@ -648,6 +645,7 @@ void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) {
this->actionFunc = func_80A53DF8; this->actionFunc = func_80A53DF8;
} }
} }
void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) { void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0); Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0);
Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f); Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f);
@ -661,7 +659,7 @@ void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) {
} }
void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor; s32 pad;
Vec3f pos; Vec3f pos;
f32 rotY; f32 rotY;
EnBom* bomb; EnBom* bomb;
@ -673,7 +671,7 @@ void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) {
pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x; pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x;
pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f); pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f);
pos.z = Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f); pos.z = Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f);
rotY = Rand_CenteredFloat(7000.0f) + thisx->yawTowardsPlayer; rotY = Rand_CenteredFloat(7000.0f) + this->actor.yawTowardsPlayer;
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0);
if (bomb != NULL) { if (bomb != NULL) {
bomb->actor.speedXZ = Rand_CenteredFloat(5.0f) + 10.0f; bomb->actor.speedXZ = Rand_CenteredFloat(5.0f) + 10.0f;
@ -837,6 +835,7 @@ s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnHeishi2* this = THIS; EnHeishi2* this = THIS;
if (limbIndex == 16) { if (limbIndex == 16) {
Matrix_Get(&this->mtxf_330); Matrix_Get(&this->mtxf_330);
} }

View file

@ -266,7 +266,7 @@ void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx) {
void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) { void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
func_80038290(globalCtx, &this->actor, &this->unk_260.x, &this->unk_266.x, this->actor.focus.pos); func_80038290(globalCtx, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos);
if (this->unk_282 == func_8010BDBC(&globalCtx->msgCtx)) { if (this->unk_282 == func_8010BDBC(&globalCtx->msgCtx)) {
if (func_80106BC8(globalCtx) != 0) { if (func_80106BC8(globalCtx) != 0) {
func_80106CCC(globalCtx); func_80106CCC(globalCtx);

View file

@ -599,7 +599,7 @@ void func_80A6ABF8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base);
} }
s32 func_80A6AD84(Actor* thisx, GlobalContext* globalCtx, s32 arg2, s32 arg3) { s32 func_80A6AD84(Actor* thisx, GlobalContext* globalCtx, s32 arg2, PSkinAwb* arg3) {
EnHorseLinkChild* this = THIS; EnHorseLinkChild* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1467); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1467);

View file

@ -244,10 +244,10 @@ void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
} }
void func_80A6DFD4(EnHorseZelda* this, GlobalContext* globalCtx, PSkinAwb* skin) { void func_80A6DFD4(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
Vec3f sp4C; Vec3f sp4C;
Vec3f sp40; Vec3f sp40;
s32 pad; EnHorseZelda* this = THIS;
s32 i; s32 i;
for (i = 0; i < this->colliderSphere.count; i++) { for (i = 0; i < this->colliderSphere.count; i++) {

View file

@ -131,7 +131,7 @@ void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) {
} }
} }
s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx) { s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnHs2* this = THIS; EnHs2* this = THIS;
switch (limbIndex) { switch (limbIndex) {

View file

@ -209,7 +209,7 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) {
} }
} }
s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx) { s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnJs* this = THIS; EnJs* this = THIS;
if (limbIndex == 12) { if (limbIndex == 12) {

View file

@ -127,7 +127,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060065B0, &D_06000214, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060065B0, &D_06000214, NULL, NULL, 0);
func_80080480(globalCtx, this); func_80080480(globalCtx, &this->actor);
this->actor.flags |= 0x8000001; this->actor.flags |= 0x8000001;
func_80078884(NA_SE_SY_CORRECT_CHIME); func_80078884(NA_SE_SY_CORRECT_CHIME);
@ -152,7 +152,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060065B0, &D_06000214, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060065B0, &D_06000214, NULL, NULL, 0);
func_80080480(globalCtx, this); func_80080480(globalCtx, &this->actor);
func_80078884(NA_SE_SY_CORRECT_CHIME); func_80078884(NA_SE_SY_CORRECT_CHIME);
this->actor.flags |= 0x8000001; this->actor.flags |= 0x8000001;

View file

@ -97,7 +97,8 @@ u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) {
} }
} }
u16 EnKz_GetText(GlobalContext* globalCtx, EnKz* this) { u16 EnKz_GetText(GlobalContext* globalCtx, Actor* thisx) {
EnKz* this = THIS;
u16 reactionText = Text_GetFaceReaction(globalCtx, 0x1E); u16 reactionText = Text_GetFaceReaction(globalCtx, 0x1E);
if (reactionText != 0) { if (reactionText != 0) {
@ -111,8 +112,8 @@ u16 EnKz_GetText(GlobalContext* globalCtx, EnKz* this) {
} }
} }
s16 func_80A9C6C0(GlobalContext* globalCtx, EnKz* this) { s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) {
s32 pad; EnKz* this = THIS;
s16 ret = 1; s16 ret = 1;
switch (func_8010BDBC(&globalCtx->msgCtx)) { switch (func_8010BDBC(&globalCtx->msgCtx)) {
@ -197,7 +198,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
} }
if (*arg2 != 0) { if (*arg2 != 0) {
*arg2 = callback2(globalCtx, this); *arg2 = callback2(globalCtx, &this->actor);
return 0; return 0;
} }
@ -222,7 +223,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
return 0; return 0;
} }
this->actor.xzDistToPlayer = xzDistToPlayer; this->actor.xzDistToPlayer = xzDistToPlayer;
this->actor.textId = callback1(globalCtx, this); this->actor.textId = callback1(globalCtx, &this->actor);
return 0; return 0;
} }
@ -230,7 +231,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) {
Player* player = PLAYER; Player* player = PLAYER;
if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0) != 0) { if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) {
if ((this->actor.textId == 0x401A) && !(gSaveContext.eventChkInf[3] & 8)) { if ((this->actor.textId == 0x401A) && !(gSaveContext.eventChkInf[3] & 8)) {
if (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) { if (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) {
this->actor.textId = 0x401B; this->actor.textId = 0x401B;
@ -354,7 +355,7 @@ void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) {
this->unk_1E0.unk_00 = 0; this->unk_1E0.unk_00 = 0;
this->actionFunc = EnKz_SetupMweep; this->actionFunc = EnKz_SetupMweep;
} else { } else {
func_80034F54(globalCtx, &this->unk_2A6, &this->unk_2BE, 12); func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12);
} }
} }
@ -414,7 +415,7 @@ void EnKz_Wait(EnKz* this, GlobalContext* globalCtx) {
this->actionFunc = EnKz_SetupGetItem; this->actionFunc = EnKz_SetupGetItem;
EnKz_SetupGetItem(this, globalCtx); EnKz_SetupGetItem(this, globalCtx);
} else { } else {
func_80034F54(globalCtx, &this->unk_2A6, &this->unk_2BE, 12); func_80034F54(globalCtx, this->unk_2A6, this->unk_2BE, 12);
} }
} }
@ -423,7 +424,7 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) {
f32 xzRange; f32 xzRange;
f32 yRange; f32 yRange;
if (Actor_HasParent(this, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL; this->actor.parent = NULL;
this->unk_1E0.unk_00 = 1; this->unk_1E0.unk_00 = 1;
this->actionFunc = EnKz_StartTimer; this->actionFunc = EnKz_StartTimer;

View file

@ -1,3 +1,9 @@
/*
* File: z_en_mb.c
* Overlay: ovl_En_Mb
* Description: Moblins
*/
#include "z_en_mb.h" #include "z_en_mb.h"
#define FLAGS 0x00000015 #define FLAGS 0x00000015
@ -643,7 +649,7 @@ void func_80AA71AC(EnMb* this, GlobalContext* globalCtx) {
if ((yDistAbs <= 20.0f) && func_80AA652C(this, globalCtx)) { if ((yDistAbs <= 20.0f) && func_80AA652C(this, globalCtx)) {
yawDiff = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; yawDiff = this->actor.shape.rot.y - this->actor.yawTowardsPlayer;
yawDiffAbs = ABS(yawDiff); yawDiffAbs = ABS(yawDiff);
if ((yawDiffAbs <= 0x4000) || (func_8002DDE4(globalCtx) != 0) && (this->actor.xzDistToPlayer < 160.0f)) { if ((yawDiffAbs <= 0x4000) || (func_8002DDE4(globalCtx) && (this->actor.xzDistToPlayer < 160.0f))) {
func_80AA66A0(this, globalCtx); func_80AA66A0(this, globalCtx);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE);
func_80AA6AC8(this); func_80AA6AC8(this);
@ -823,7 +829,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) {
EffectSsBlast_SpawnWhiteShockwave(globalCtx, &sp74, &sp68, &sp68); EffectSsBlast_SpawnWhiteShockwave(globalCtx, &sp74, &sp68, &sp68);
func_80033480(globalCtx, &sp74, 2.0f, 3, 0x12C, 0xB4, 1); func_80033480(globalCtx, &sp74, 2.0f, 3, 0x12C, 0xB4, 1);
Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5); Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5);
func_800358DC(&this->actor, &sp74, &this->actor.world.rot, &sp5C, 20, &sp54, globalCtx, -1, 0); func_800358DC(&this->actor, &sp74, &this->actor.world.rot, sp5C, 20, sp54, globalCtx, -1, 0);
func_80AA6DA4(this); func_80AA6DA4(this);
} }
} else { } else {
@ -1131,7 +1137,7 @@ void func_80AA8AEC(EnMb* this, GlobalContext* globalCtx) {
f32 playSpeedABS; f32 playSpeedABS;
if (Math_Vec3f_DistXZ(&this->waypointPos, &this->actor.world.pos) <= 8.0f || if (Math_Vec3f_DistXZ(&this->waypointPos, &this->actor.world.pos) <= 8.0f ||
Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f) { (Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f)) {
func_80AA68FC(this, globalCtx); func_80AA68FC(this, globalCtx);
} else { } else {
Math_SmoothStepToF(&this->actor.speedXZ, 0.59999996f, 0.1f, 1.0f, 0.0f); Math_SmoothStepToF(&this->actor.speedXZ, 0.59999996f, 0.1f, 1.0f, 0.0f);
@ -1143,7 +1149,7 @@ void func_80AA8AEC(EnMb* this, GlobalContext* globalCtx) {
if (yDistAbs <= 20.0f && func_80AA652C(this, globalCtx) != 0) { if (yDistAbs <= 20.0f && func_80AA652C(this, globalCtx) != 0) {
yawDiff = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); yawDiff = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer);
yawDiffAbs = ABS(yawDiff); yawDiffAbs = ABS(yawDiff);
if (yawDiffAbs <= 0x4000 || func_8002DDE4(globalCtx) != 0 && this->actor.xzDistToPlayer < 160.0f) { if (yawDiffAbs <= 0x4000 || (func_8002DDE4(globalCtx) && this->actor.xzDistToPlayer < 160.0f)) {
func_80AA66A0(this, globalCtx); func_80AA66A0(this, globalCtx);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE);
func_80AA6AC8(this); func_80AA6AC8(this);
@ -1167,7 +1173,7 @@ void func_80AA8AEC(EnMb* this, GlobalContext* globalCtx) {
playSpeedABS = (this->skelAnime.playSpeed >= 0.0f) ? this->skelAnime.playSpeed : -this->skelAnime.playSpeed; playSpeedABS = (this->skelAnime.playSpeed >= 0.0f) ? this->skelAnime.playSpeed : -this->skelAnime.playSpeed;
if (currentFrame != (s32)this->skelAnime.curFrame) { if (currentFrame != (s32)this->skelAnime.curFrame) {
if (!(temp_f6 >= 2 || (s32)playSpeedABS + currentFrame <= 0) || if (!(temp_f6 >= 2 || (s32)playSpeedABS + currentFrame <= 0) ||
temp_f6 <= 20 && (s32)playSpeedABS + currentFrame >= 20) { (temp_f6 <= 20 && (s32)playSpeedABS + currentFrame >= 20)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_WALK); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_WALK);
} }
} }

View file

@ -402,7 +402,9 @@ u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) {
return 0x1060; return 0x1060;
} }
u16 EnMd_GetText(GlobalContext* globalCtx, EnMd* this) { u16 EnMd_GetText(GlobalContext* globalCtx, Actor* thisx) {
EnMd* this = THIS;
switch (globalCtx->sceneNum) { switch (globalCtx->sceneNum) {
case SCENE_SPOT04: case SCENE_SPOT04:
return EnMd_GetTextKokiriForest(globalCtx, this); return EnMd_GetTextKokiriForest(globalCtx, this);
@ -415,7 +417,9 @@ u16 EnMd_GetText(GlobalContext* globalCtx, EnMd* this) {
} }
} }
s16 func_80AAAF04(GlobalContext* globalCtx, EnMd* this) { s16 func_80AAAF04(GlobalContext* globalCtx, Actor* thisx) {
EnMd* this = THIS;
switch (func_80AAAC78(this, globalCtx)) { switch (func_80AAAC78(this, globalCtx)) {
case 0: case 0:
case 1: case 1:
@ -592,7 +596,7 @@ void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) {
(globalCtx->sceneNum == SCENE_SPOT04)) (globalCtx->sceneNum == SCENE_SPOT04))
? 100.0f ? 100.0f
: 400.0f; : 400.0f;
this->alpha = func_80034DD4(this, globalCtx, this->alpha, temp); this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, temp);
this->actor.shape.shadowAlpha = this->alpha; this->actor.shape.shadowAlpha = this->alpha;
} else { } else {
this->alpha = 255; this->alpha = 255;
@ -610,7 +614,7 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
if (!EnMd_ShouldSpawn(&this->actor, globalCtx)) { if (!EnMd_ShouldSpawn(this, globalCtx)) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }
@ -632,7 +636,7 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) {
} }
if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) {
EnMd_SetMovedPos(&this->actor, globalCtx); EnMd_SetMovedPos(this, globalCtx);
} }
this->actionFunc = func_80AAB874; this->actionFunc = func_80AAB874;
@ -645,7 +649,7 @@ void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { void func_80AAB874(EnMd* this, GlobalContext* globalCtx) {
if (this->skelAnime.animation == &D_060002C8) { if (this->skelAnime.animation == &D_060002C8) {
func_80034F54(globalCtx, &this->unk_214, &this->unk_236, 17); func_80034F54(globalCtx, this->unk_214, this->unk_236, 17);
} else if ((this->unk_1E0.unk_00 == 0) && (this->unk_20B != 7)) { } else if ((this->unk_1E0.unk_00 == 0) && (this->unk_20B != 7)) {
func_80AAA92C(this, 7); func_80AAA92C(this, 7);
} }
@ -655,7 +659,7 @@ void func_80AAB874(EnMd* this, GlobalContext* globalCtx) {
void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) { void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) {
if (this->skelAnime.animation == &D_060002C8) { if (this->skelAnime.animation == &D_060002C8) {
func_80034F54(globalCtx, &this->unk_214, &this->unk_236, 17); func_80034F54(globalCtx, this->unk_214, this->unk_236, 17);
} }
func_80AAA93C(this); func_80AAA93C(this);
} }
@ -707,7 +711,7 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) {
} }
if (this->skelAnime.animation == &D_060002C8) { if (this->skelAnime.animation == &D_060002C8) {
func_80034F54(globalCtx, &this->unk_214, &this->unk_236, 17); func_80034F54(globalCtx, this->unk_214, this->unk_236, 17);
} }
if ((this->unk_1E0.unk_00 == 0) && (globalCtx->sceneNum == SCENE_SPOT10)) { if ((this->unk_1E0.unk_00 == 0) && (globalCtx->sceneNum == SCENE_SPOT10)) {
@ -744,7 +748,7 @@ void func_80AABC10(EnMd* this, GlobalContext* globalCtx) {
} }
void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) { void func_80AABD0C(EnMd* this, GlobalContext* globalCtx) {
func_80034F54(globalCtx, &this->unk_214, &this->unk_236, 17); func_80034F54(globalCtx, this->unk_214, this->unk_236, 17);
func_80AAA93C(this); func_80AAA93C(this);
if (!(EnMd_FollowPath(this, globalCtx)) || (this->waypoint != 0)) { if (!(EnMd_FollowPath(this, globalCtx)) || (this->waypoint != 0)) {

Some files were not shown because too many files have changed in this diff Show more