From 02b3640bded597ff695f1a66c549662e4de4c294 Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Tue, 2 Feb 2021 23:44:24 +0000 Subject: [PATCH] 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 --- include/functions.h | 17 +- src/code/z_actor.c | 4 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 4 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 140 ++++---- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 2 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 16 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 18 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 21 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 4 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c | 72 ++-- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h | 2 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 11 +- .../z_bg_hidan_kowarerukabe.c | 4 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c | 38 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h | 4 +- .../z_bg_jya_amishutter.c | 30 +- .../z_bg_jya_amishutter.h | 4 +- .../z_bg_jya_bombchuiwa.c | 10 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 34 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h | 2 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 4 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 8 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 35 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h | 4 +- .../z_bg_menkuri_kaiten.c | 14 +- .../z_bg_menkuri_kaiten.h | 4 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c | 11 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 2 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.c | 24 +- .../ovl_Bg_Spot00_Break/z_bg_spot00_break.c | 14 +- .../ovl_Bg_Spot00_Break/z_bg_spot00_break.h | 4 +- .../z_bg_spot00_hanebasi.c | 8 +- .../z_bg_spot01_idosoko.c | 12 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c | 25 +- .../z_bg_spot06_objects.c | 22 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 51 ++- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 48 ++- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 46 ++- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h | 2 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 8 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c | 45 +-- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h | 6 +- .../z_bg_spot16_bombstone.c | 2 +- .../z_bg_spot17_bakudankabe.c | 2 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 45 +-- .../ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c | 18 +- .../ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h | 6 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 4 +- .../z_bg_spot18_shutter.c | 2 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 50 +-- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 18 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.h | 4 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 3 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h | 2 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 8 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 31 +- .../actors/ovl_Demo_Effect/z_demo_effect.h | 4 +- .../actors/ovl_Demo_Geff/z_demo_geff.c | 2 +- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 15 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 12 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 2 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 14 +- .../actors/ovl_Door_Toki/z_door_toki.c | 14 +- .../actors/ovl_Door_Toki/z_door_toki.h | 5 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 57 +-- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 4 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.c | 2 +- .../actors/ovl_En_Arow_Trap/z_en_arow_trap.c | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 14 +- src/overlays/actors/ovl_En_Boom/z_en_boom.h | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- src/overlays/actors/ovl_En_Bw/z_en_bw.c | 4 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 80 +++-- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 6 +- .../z_en_daiku_kakariko.c | 6 +- src/overlays/actors/ovl_En_Dha/z_en_dha.c | 4 +- .../actors/ovl_En_Dodojr/z_en_dodojr.c | 18 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 2 +- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 6 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 10 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 16 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 14 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 8 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 52 +-- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 47 +-- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 41 ++- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 2 +- .../z_en_horse_link_child.c | 2 +- .../ovl_En_Horse_Zelda/z_en_horse_zelda.c | 4 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.c | 2 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 2 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 4 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 19 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 16 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 22 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 13 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 4 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 46 ++- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 88 +++-- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 8 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 5 +- src/overlays/actors/ovl_En_Ny/z_en_ny.c | 2 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 328 ++++++++---------- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 35 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 8 +- src/overlays/actors/ovl_En_St/z_en_st.c | 8 +- src/overlays/actors/ovl_En_Vase/z_en_vase.c | 4 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 12 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 16 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 4 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 10 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 14 +- .../actors/ovl_Obj_Elevator/z_obj_elevator.c | 2 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 28 +- .../actors/ovl_player_actor/z_player.c | 38 +- 122 files changed, 1129 insertions(+), 1125 deletions(-) diff --git a/include/functions.h b/include/functions.h index 7ac3266a0d..a496e7ab42 100644 --- a/include/functions.h +++ b/include/functions.h @@ -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* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory); 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_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); @@ -521,6 +522,8 @@ u8 Actor_ApplyDamage(Actor* actor); void func_80035650(Actor* actor, ColliderInfo* colBody, s32 freezeFlag); void func_8003573C(Actor* actor, ColliderJntSph* colBody, s32 freezeFlag); 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); s32 Flags_GetEventChkInf(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); void Camera_Finish(Camera* camera); s32 Camera_ChangeMode(Camera* camera, s16 mode); +s32 Camera_CheckValidMode(Camera* camera, s16 mode); s32 Camera_ChangeSetting(Camera* camera, s16 setting); s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx); 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_SetParam(Camera* camera, s32 param, void* value); 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_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints, Player* player, s16 relativeToPlayer); @@ -773,6 +779,7 @@ s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera); Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera); void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3, UNK_TYPE arg6); +s32 func_8005B198(void); s16 func_8005B1A4(Camera* camera); DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* table); @@ -964,6 +971,8 @@ void func_800775D8(); s32 func_800775E4(); void func_800775F0(u16); // ? func_80077600(?); +void func_80077624(GlobalContext* globalCtx); +void func_80077684(GlobalContext* globalCtx); void func_800776E4(GlobalContext* globalCtx); void Lib_MemSet(u8* dest, size_t size, u8 val); f32 Math_CosS(s16 angle); @@ -1206,10 +1215,13 @@ Gfx* func_80093F34(Gfx* gfx); Gfx* func_80093F58(Gfx* gfx); void func_80094044(GraphicsContext* gfxCtx); void func_800940B0(GraphicsContext* gfxCtx); +void func_80094140(GraphicsContext* gfxCtx); +Gfx* func_8009411C(Gfx* gfx); void func_800942F0(GraphicsContext* gfxCtx); void func_8009435C(GraphicsContext* gfxCtx); void func_800943C8(GraphicsContext* gfxCtx); Gfx* func_800944A0(Gfx* gfx); +void func_800944C4(GraphicsContext* gfxCtx); void func_80094520(GraphicsContext* gfxCtx); void func_8009457C(Gfx** gfxp); 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, s32 arg5, s32 arg6, s32 arg7); 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, s32 arg5, s32 arg6, s32 arg7); void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3); @@ -2245,6 +2259,7 @@ void func_800F46E0(Vec3f* pos, f32 arg0); // ? func_800F4784(?); void func_800F47BC(void); void func_800F47FC(void); +void func_800F483C(UNK_TYPE arg0, UNK_TYPE arg1); // ? func_800F491C(?); // ? func_800F4A70(?); void func_800F4BF4(Vec3f*, u16 sfxId, s8); @@ -2284,7 +2299,7 @@ void func_800F6AB0(u8); // ? func_800F6BB8(?); void func_800F6C14(); // ? func_800F6C34(?); -void func_800F6D58(u8, u8, u8); +void func_800F6D58(u8 arg0, u8 arg1, u8 arg2); // ? func_800F6E7C(?); // ? func_800F6FB4(?); void func_800F70F8(); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f6ba831ddf..5c5283703a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -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. */ -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) { EnPart* spawnedEnPart; @@ -4105,7 +4105,7 @@ EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, spawnedEnPart->timer = timer; spawnedEnPart->rotZ = arg3[1]; spawnedEnPart->rotZSpeed = arg3[2]; - return spawnedEnPart; + return &spawnedEnPart->actor; } return NULL; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 923aa5c10f..618c5276ee 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -41,7 +41,7 @@ ColliderQuadInit sQuadInit = { BUMP_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 }; @@ -200,7 +200,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { this->grabbed = NULL; } else { if (this->actor.child != NULL) { - sp94 = Actor_WorldDistXYZToActor(this, grabbed); + sp94 = Actor_WorldDistXYZToActor(&this->actor, grabbed); sp90 = 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); diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 03d769267f..fc720dc229 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -48,7 +48,7 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); this->radius = 0; this->unk_158 = 1.0f; - ArrowFire_SetupAction(&this->actor, ArrowFire_Charge); + ArrowFire_SetupAction(this, ArrowFire_Charge); Actor_SetScale(&this->actor, 0.01f); this->alpha = 160; this->timer = 0; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index ae669899ee..370b03b80b 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -111,12 +111,12 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) { } void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { - BgBdanObjects* this = THIS; s32 pad; + BgBdanObjects* this = THIS; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(this, sInitChain); - DynaPolyActor_Init(this, DPM_PLAYER); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_PLAYER); this->unk_168 = (thisx->params >> 8) & 0x3F; thisx->params &= 0xFF; if (thisx->params == 2) { @@ -128,16 +128,16 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params == 0) { CollisionHeader_GetVirtual(&D_06008CE0, &colHeader); Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, this, &sCylinderInit); - thisx->world.pos.y = (f32)(thisx->world.pos.y + -79.0f); + Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + thisx->world.pos.y += -79.0f; if (Flags_GetClear(globalCtx, thisx->room)) { Flags_SetSwitch(globalCtx, this->unk_168); this->actionFunc = func_8086C6EC; } else { if (BgBdanObjects_GetContactRu1(this, 4)) { - if (Actor_SpawnAsChild(&globalCtx->actorCtx, this, globalCtx, ACTOR_EN_BIGOKUTA, thisx->home.pos.x, - thisx->home.pos.y, thisx->home.pos.z, 0, thisx->shape.rot.y + 0x8000, 0, - 3) != NULL) { + if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA, + thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0, + thisx->shape.rot.y + 0x8000, 0, 3) != NULL) { thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f; } 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; } else { Flags_SetSwitch(globalCtx, this->unk_168); - this->unk_16A = 0; + this->timer = 0; this->actionFunc = func_8086C054; } } } else { if (thisx->params == 1) { CollisionHeader_GetVirtual(&D_06005048, &colHeader); - this->unk_16A = 0x200; + this->timer = 512; this->unk_168 = 0; this->actionFunc = func_8086C874; } else { @@ -183,21 +183,19 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { if (BgBdanObjects_GetContactRu1(this, 0)) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { BgBdanObjects_SetContactRu1(this, 1); - this->unk_16A = 0x14; + this->timer = 20; func_800800F8(globalCtx, 0xBFE, -0x63, &this->dyna.actor, 0); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3300.0f; func_800AA000(0.0f, 0xFF, 0x14, 0x96); } - } else { - if (this->unk_16A != 0) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; - } - if (this->unk_16A == 0) { - this->actionFunc = func_8086C1A0; - } + } else if (this->timer != 0) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + this->actionFunc = func_8086C1A0; } } @@ -213,16 +211,16 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { 0.1f) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); this->actionFunc = func_8086C29C; - this->unk_16A = 0x1E; + this->timer = 30; BgBdanObjects_SetContactRu1(this, 2); func_800AA000(0.0f, 0xFF, 0x14, 0x96); } else { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - if (this->unk_16A == 0) { + if (this->timer == 0) { 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); } @@ -231,9 +229,9 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) { void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { s32 temp; - if (this->unk_16A != 0) { - this->unk_16A -= 1; - if (this->unk_16A == 0) { + if (this->timer != 0) { + this->timer--; + if (this->timer == 0) { temp = Quake_Add(ACTIVE_CAM, 1); Quake_SetSpeed(temp, 0x3A98); 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.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0); BgBdanObjects_SetContactRu1(this, 4); - this->unk_16A = 0xA; + this->timer = 10; this->actionFunc = func_8086C55C; 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, this->dyna.actor.velocity.y)) { 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); this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->actionFunc = func_8086C5BC; @@ -272,12 +270,12 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { func_800AA000(0.0f, 0xFF, 0x1E, 0x96); } else { func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - if (this->unk_16A == 0) { + if (this->timer == 0) { func_800AA000(0.0f, 0x78, 0x14, 0xA); - this->unk_16A = 0xB; + this->timer = 11; } if (this->dyna.actor.child != NULL) { this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; @@ -286,27 +284,25 @@ void func_8086C3D8(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); - } else if (this->unk_16A == -0x28) { - this->unk_16A = 0; + } else if (this->timer == -40) { + this->timer = 0; this->actionFunc = func_8086C3D8; } } void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - if (this->unk_16A == 0) { - if (this->dyna.actor.child != NULL) { - if (this->dyna.actor.child->params == 2) { - this->actionFunc = func_8086C618; - } else if (this->dyna.actor.child->params == 0) { - this->dyna.actor.child->params = 1; - } + if ((this->timer == 0) && (this->dyna.actor.child != NULL)) { + if (this->dyna.actor.child->params == 2) { + this->actionFunc = func_8086C618; + } else if (this->dyna.actor.child->params == 0) { + this->dyna.actor.child->params = 1; } } } @@ -335,7 +331,7 @@ void func_8086C6EC(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) { this->actionFunc = func_8086C7D0; 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) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } if (this->unk_168 == 0) { - if (func_8004356C(&this->dyna.actor)) { + if (func_8004356C(&this->dyna)) { this->cameraSetting = globalCtx->cameraPtrs[0]->setting; Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2); func_8005AD1C(globalCtx->cameraPtrs[0], 4); @@ -369,62 +365,62 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } } else { Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_NORMAL2); - if (!func_8004356C(&this->dyna.actor)) { + if (!func_8004356C(&this->dyna)) { if (this->unk_168 != 0) { - this->unk_168 -= 1; + this->unk_168--; } } if (this->unk_168 == 0) { do { } while (0); - Camera_ChangeSetting(globalCtx->cameraPtrs[0], (s16)this->cameraSetting); + Camera_ChangeSetting(globalCtx->cameraPtrs[0], this->cameraSetting); func_8005ACFC(globalCtx->cameraPtrs[0], 4); } } 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 - if (this->unk_16A == 0) { - this->unk_16A = 0x200; + this->dyna.actor.home.pos.y - (sinf(this->timer * (M_PI / 256.0f)) * 471.239990234375f); // pi * 150 + if (this->timer == 0) { + this->timer = 512; } } void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->unk_168)) { - this->unk_16A = 0x64; + this->timer = 100; this->actionFunc = func_8086C9F0; } } 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)) { Flags_UnsetSwitch(globalCtx, this->unk_168); 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 { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 75.0f, 0.5f)) { 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; } void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - func_8002F994(&this->dyna.actor, this->unk_16A); - if (this->unk_16A == 0) { + func_8002F994(&this->dyna.actor, this->timer); + if (this->timer == 0) { this->actionFunc = func_8086C9F0; } } void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) { - if (func_8004356C(&this->dyna.actor)) { + if (func_8004356C(&this->dyna)) { Flags_SetSwitch(globalCtx, this->unk_168); - this->unk_16A = 0x32; + this->timer = 50; this->actionFunc = func_8086CB8C; this->dyna.actor.home.pos.y -= 200.0f; 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) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + 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) { - Audio_PlayActorSound2(this, NA_SE_EV_BUYOSTAND_STOP_U); + + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 50.0f)) * 200.0f); + + if (this->timer == 0) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->actionFunc = BgBdanObjects_DoNothing; Gameplay_CopyCamera(globalCtx, 0, -1); } else { diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h index 639b18fe85..8d479ea3fc 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h @@ -12,7 +12,7 @@ typedef struct BgBdanObjects { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgBdanObjectsActionFunc actionFunc; /* 0x0168 */ u8 unk_168; - /* 0x016A */ s16 unk_16A; + /* 0x016A */ s16 timer; /* 0x016C */ ColliderCylinder collider; /* 0x01B8 */ s32 cameraSetting; } BgBdanObjects; // size = 0x01BC diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index df768d6478..15868b5002 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -1,6 +1,6 @@ /* * File: z_bg_bdan_switch.c - * Overlay: Bg_Bdan_Switch + * Overlay: ovl_Bg_Bdan_Switch * Description: Switches Inside Lord Jabu-Jabu */ diff --git a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c index 24ea5ffcec..43a4ece968 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c @@ -38,10 +38,10 @@ static InitChainEntry sInitChain[] = { }; typedef enum { - STATE_GO_BOTTOM, - STATE_GO_MIDDLE_FROM_BOTTOM, - STATE_GO_MIDDLE_FROM_TOP, - STATE_GO_TOP, + /* 0 */ STATE_GO_BOTTOM, + /* 1 */ STATE_GO_MIDDLE_FROM_BOTTOM, + /* 2 */ STATE_GO_MIDDLE_FROM_TOP, + /* 3 */ STATE_GO_TOP } BgDdanJdState; #define MOVE_HEIGHT_MIDDLE 140.0f @@ -55,14 +55,14 @@ typedef enum { #define SHORTCUT_Y_SPEED 5 void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) { - BgDdanJd* this = THIS; s32 pad; + BgDdanJd* this = THIS; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_PLAYER); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_PLAYER); 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->state = STATE_GO_BOTTOM; diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index d9e8219c9b..e20895670a 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -58,10 +58,6 @@ static InitChainEntry sInitChain[] = { 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 Gfx D_060048A8[]; @@ -77,7 +73,7 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) { this->prevExplosive = NULL; 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_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); CollisionHeader_GetVirtual(&D_06004F30, &colHeader); @@ -102,7 +98,7 @@ void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { Actor* explosive; - explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider); + explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider.base); if (explosive != NULL) { osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage); explosive->params = 2; @@ -110,7 +106,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) && (Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) { BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs); - func_800800F8(globalCtx, 0xBEA, 0x3E7, this, 0); + func_800800F8(globalCtx, 0xBEA, 0x3E7, &this->dyna.actor, 0); } else { if (this->timer != 0) { this->timer -= 1; @@ -127,6 +123,8 @@ void BgDdanKd_CheckForExplosions(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 sp50; 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, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1); - D_808718FC[0] = Rand_CenteredFloat(3.0f); - D_80871904[0] = Rand_CenteredFloat(3.0f); + D_808718FC.x = Rand_CenteredFloat(3.0f); + D_808718FC.z = Rand_CenteredFloat(3.0f); func_8003555C(globalCtx, &sp5C, &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) { - Gfx_DrawDListOpa(globalCtx, &D_060048A8); + Gfx_DrawDListOpa(globalCtx, D_060048A8); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index a323e52624..16087cf88f 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -112,7 +112,6 @@ extern CollisionHeader D_06009CD0; void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { static UNK_TYPE D_80881014 = 0; - BgHakaTrap* this = THIS; s32 pad; CollisionHeader* colHeader = NULL; @@ -167,7 +166,7 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { } 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.height = 115; @@ -192,10 +191,10 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { BgHakaTrap* this = THIS; - if (thisx->params != HAKA_TRAP_PROPELLER) { - if (thisx->params != HAKA_TRAP_GUILLOTINE_SLOW) { + if (this->dyna.actor.params != HAKA_TRAP_PROPELLER) { + if (this->dyna.actor.params != HAKA_TRAP_GUILLOTINE_SLOW) { 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); } } @@ -485,11 +484,11 @@ void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx) { void BgHakaTrap_Update(Actor* thisx, GlobalContext* globalCtx) { BgHakaTrap* this = THIS; - Vec3f* actorPos = &thisx->world.pos; + Vec3f* actorPos = &this->dyna.actor.world.pos; 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; 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); } - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]); if (this->actionFunc == func_808801B8) { func_80880D68(this); @@ -543,9 +542,9 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { } if ((this->actionFunc == func_808808F4) && !this->unk_169) { - sp2C.x = thisx->world.pos.x; - sp2C.z = thisx->world.pos.z; - sp2C.y = thisx->world.pos.y + 110.0f; + sp2C.x = this->dyna.actor.world.pos.x; + sp2C.z = this->dyna.actor.world.pos.z; + sp2C.y = this->dyna.actor.world.pos.y + 110.0f; SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &sp2C, &this->unk_16C); func_80078914(&this->unk_16C, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h index c83a7cd584..3c9e98c8cc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h @@ -10,7 +10,7 @@ typedef enum { /* 0x02 */ HAKA_TRAP_SPIKED_WALL, /* 0x03 */ HAKA_TRAP_SPIKED_WALL_2, /* 0x04 */ HAKA_TRAP_PROPELLER, - /* 0x05 */ HAKA_TRAP_GUILLOTINE_FAST, + /* 0x05 */ HAKA_TRAP_GUILLOTINE_FAST } HakaTrapType; struct BgHakaTrap; diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 62b5462611..e95a2ab0e8 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -355,7 +355,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { if (this->timer == 11) { 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); } @@ -372,7 +372,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { this->timer++; - func_8002DF54(globalCtx, player, 8); + func_8002DF54(globalCtx, &player->actor, 8); // if parent is NULL, link threw it if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c index 3e742991d4..a08cd74559 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c @@ -1,6 +1,6 @@ /* * File: z_bg_hidan_fslift.c - * Overlay: Bg_Hidan_Fslift + * Overlay: ovl_Bg_Hidan_Fslift * Description: Hookshot Elevator */ @@ -42,33 +42,32 @@ static InitChainEntry sInitChain[] = { }; void BgHidanFslift_Init(Actor* thisx, GlobalContext* globalCtx) { - BgHidanFslift* this = THIS; s32 pad1; + BgHidanFslift* this = THIS; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_PLAYER); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_PLAYER); CollisionHeader_GetVirtual(&D_0600E1E8, &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, - thisx->world.pos.y + 40.0f, thisx->world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { - Actor_Kill(thisx); + if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_HSBLOCK, + this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 40.0f, + this->dyna.actor.world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { + Actor_Kill(&this->dyna.actor); return; } this->actionFunc = func_80886FCC; } void func_80886F24(BgHidanFslift* this) { - Actor* thisx = &this->dyna.actor; - - if (thisx->child != NULL && thisx->child->update != NULL) { - thisx->child->world.pos.x = thisx->world.pos.x; - thisx->child->world.pos.y = thisx->world.pos.y + 40.0f; - thisx->child->world.pos.z = thisx->world.pos.z + -28.0f; - return; + 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; + this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 40.0f; + this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z + -28.0f; + } else { + this->dyna.actor.child = NULL; } - thisx->child = NULL; } void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -78,54 +77,47 @@ void BgHidanFslift_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80886FB4(BgHidanFslift* this) { - this->unk_168 = 0x28; + this->timer = 40; this->actionFunc = func_80886FCC; } void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { 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; - 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; } - if (func_80043590(thisx)) { - if (heightBool) { - this->actionFunc = func_808870D8; - return; - } - } - if (!heightBool) { + if (func_80043590(&this->dyna) && (heightBool)) { + this->actionFunc = func_808870D8; + } else if (!heightBool) { this->actionFunc = func_8088706C; } } } void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y, 4.0f)) { - Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); + 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); func_80886FB4(this); } 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); } void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - if (func_80043590(thisx)) { - if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 790.0f, 4.0f)) { - Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); + if (func_80043590(&this->dyna)) { + if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80886FB4(this); } else { - func_8002F974(thisx, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); + func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); } } else { func_80886FB4(this); @@ -137,12 +129,12 @@ void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx) { BgHidanFslift* this = THIS; this->actionFunc(this, globalCtx); - if (func_8004356C(thisx)) { + if (func_8004356C(&this->dyna)) { if (this->unk_16A == 0) { this->unk_16A = 3; } 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) { Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h index fe8cfa9ec0..f02b6220d7 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h @@ -11,7 +11,7 @@ typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, GlobalContext*); typedef struct BgHidanFslift { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHidanFsliftActionFunc actionFunc; - /* 0x0168 */ s16 unk_168; + /* 0x0168 */ s16 timer; /* 0x016A */ s16 unk_16A; } BgHidanFslift; // size = 0x016C diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 5ae6fd14dc..85011f8cda 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -40,7 +40,9 @@ static InitChainEntry sInitChain[] = { 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[] = { &D_0600E2CC, @@ -55,7 +57,7 @@ static s16 D_80889E7C[] = { 0x0000, }; -static Gfx (*D_80889E84[])[] = { +static Gfx* D_80889E84[] = { 0x0600C798, 0x0600BFA8, 0x0600BB58, @@ -101,10 +103,9 @@ void func_80889ACC(BgHidanKousi* this) { Vec3s* rot = &this->dyna.actor.world.rot; 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); - Vec3f* initPos = &this->dyna.actor.home.pos; - this->dyna.actor.world.pos.x = initPos->x + temp1; - this->dyna.actor.world.pos.z = initPos->z + temp2; + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp1; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp2; } void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index 0c3047112f..040a1f9da9 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -242,7 +242,7 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext Vec3f velocity; Vec3f pos; s16 arg5; - Actor* thisx = &this->dyna.actor; + Actor* thisx = &this->dyna.actor; f32 sin = Math_SinS(thisx->shape.rot.y); f32 cos = Math_CosS(thisx->shape.rot.y); f32 tmp1; @@ -271,7 +271,7 @@ void BgHidanKowarerukabe_LargeWallBreak(BgHidanKowarerukabe* this, GlobalContext 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); } } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index 4c3ec40854..72d693df3f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -1,6 +1,6 @@ /* * File: z_bg_hidan_syoku.c - * Overlay: Bg_Hidan_Syoku + * Overlay: ovl_Bg_Hidan_Syoku * Description: Stone Elevator in the Fire Temple */ @@ -39,8 +39,8 @@ extern Gfx D_0600A7E0[]; extern CollisionHeader* D_0600E568; void BgHidanSyoku_Init(Actor* thisx, GlobalContext* globalCtx) { - BgHidanSyoku* this = THIS; s32 pad; + BgHidanSyoku* this = THIS; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -58,24 +58,24 @@ void BgHidanSyoku_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8088F47C(BgHidanSyoku* this) { - this->unk_16A = 0x3C; + this->timer = 60; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); this->actionFunc = func_8088F62C; } void func_8088F4B8(BgHidanSyoku* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna.actor)) { - this->unk_16A = 0x8C; + if (Flags_GetClear(globalCtx, this->dyna.actor.room) && func_8004356C(&this->dyna)) { + this->timer = 140; this->actionFunc = func_8088F514; } } void func_8088F514(BgHidanSyoku* this, GlobalContext* globalCtx) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - this->dyna.actor.world.pos.y = (cosf(this->unk_16A * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y; - if (this->unk_16A == 0) { + this->dyna.actor.world.pos.y = (cosf(this->timer * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y; + if (this->timer == 0) { func_8088F47C(this); } else { 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) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->unk_16A * (M_PI / 140)) * 540.0f); - if (this->unk_16A == 0) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 140)) * 540.0f); + if (this->timer == 0) { func_8088F47C(this); } else { 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) { - if (this->unk_16A != 0) { - this->unk_16A -= 1; + if (this->timer != 0) { + this->timer--; } - if (this->unk_16A == 0) { - this->unk_16A = 0x8c; + if (this->timer == 0) { + this->timer = 140; if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y) { this->actionFunc = func_8088F514; } else { @@ -112,12 +112,12 @@ void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx) { BgHidanSyoku* this = THIS; this->actionFunc(this, globalCtx); - if (func_8004356C(&this->dyna.actor)) { + if (func_8004356C(&this->dyna)) { if (this->unk_168 == 0) { this->unk_168 = 3; } 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) { Camera_ChangeSetting(globalCtx->cameraPtrs[0], CAM_SET_DUNGEON0); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h index a7b3964586..959150e3b2 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h @@ -12,9 +12,9 @@ typedef struct BgHidanSyoku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHidanSyokuActionFunc actionFunc; /* 0x0168 */ s16 unk_168; - /* 0x016A */ s16 unk_16A; + /* 0x016A */ s16 timer; } BgHidanSyoku; // size = 0x016C extern const ActorInit Bg_Hidan_Syoku_InitVars; -#endif; +#endif diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 9be1b04676..b4b8164be5 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -51,12 +51,12 @@ void func_808932C0(BgJyaAmishutter* this, GlobalContext* globalCtx, CollisionHea CollisionHeader* colHeader = NULL; s16 pad2; - DynaPolyActor_Init(&this->actor, flag); + DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); - if (this->bgId == BG_ACTOR_MAX) { + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + 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, - 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; func_808932C0(this, globalCtx, &D_0600C4C8, DPM_UNK); - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); func_808933BC(this); } void BgJyaAmishutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { 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) { @@ -79,8 +79,8 @@ void func_808933BC(BgJyaAmishutter* this) { } void func_808933CC(BgJyaAmishutter* this) { - if (this->actor.xzDistToPlayer < 60.0f) { - if (fabsf(this->actor.yDistToPlayer) < 30.0f) { + if (this->dyna.actor.xzDistToPlayer < 60.0f) { + if (fabsf(this->dyna.actor.yDistToPlayer) < 30.0f) { func_80893428(this); } } @@ -91,11 +91,11 @@ void func_80893428(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); - Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); } 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) { - if (this->actor.xzDistToPlayer > 300.0f) { + if (this->dyna.actor.xzDistToPlayer > 300.0f) { func_808934FC(this); } } @@ -114,11 +114,11 @@ void func_808934FC(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); - Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); } else { - func_8002F974(&this->actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); + func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h index 3ddcce8705..ed80e44d14 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h @@ -9,9 +9,7 @@ struct BgJyaAmishutter; typedef void (*BgJyaAmishutterActionFunc)(struct BgJyaAmishutter*); typedef struct BgJyaAmishutter { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgJyaAmishutterActionFunc actionFunc; } BgJyaAmishutter; // size = 0x0168 diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index e22f42b739..baf6ee7d90 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -84,14 +84,14 @@ void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { void BgJyaBombchuiwa_Init(Actor* thisx, GlobalContext* globalCtx) { BgJyaBombchuiwa* this = THIS; - Actor_ProcessInitChain(thisx, &sInitChain); - BgJyaBombchuiwa_SetupCollider(thisx, globalCtx); - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + Actor_ProcessInitChain(&this->actor, sInitChain); + BgJyaBombchuiwa_SetupCollider(this, globalCtx); + if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { BgJyaBombchuiwa_SpawnLightRay(this, globalCtx); } else { BgJyaBombchuiwa_SetupWaitForExplosion(this, globalCtx); } - Actor_SetFocus(thisx, 0.0f); + Actor_SetFocus(&this->actor, 0.0f); } void BgJyaBombchuiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { @@ -233,7 +233,7 @@ void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { BgJyaBombchuiwa* this = THIS; if (this->drawFlags & 1) { - Gfx_DrawDListOpa(globalCtx, &D_0600E8D0); + Gfx_DrawDListOpa(globalCtx, D_0600E8D0); Collider_UpdateSpheres(0, &this->collider); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index a05957023a..42a2ef5b72 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -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 "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "vt.h" @@ -46,7 +52,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - &sJntSphElementsInit, + sJntSphElementsInit, }; static InitChainEntry sInitChain[] = { 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) { - Actor* thisx = &this->dyna.actor; + s32 pad; 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) { - if ((thisx->params & 0x3F) != 0x29) { + BgJyaBombiwa* this = THIS; + + if ((this->dyna.actor.params & 0x3F) != 0x29) { osSyncPrintf(VT_COL(YELLOW, BLACK)); // Warning: Switch Number changed (%s %d)(SW %d osSyncPrintf("Warning : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218, - thisx->params & 0x3F); - osSyncPrintf(VT_SGR()); + this->dyna.actor.params & 0x3F); + osSyncPrintf(VT_RST); } - BgJyaBombiwa_SetupDynaPoly(thisx, globalCtx, &D_0600E710, DPM_UNK); - BgJyaBombiwa_InitCollider(thisx, globalCtx); - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { - Actor_Kill(thisx); + BgJyaBombiwa_SetupDynaPoly(this, globalCtx, &D_0600E710, DPM_UNK); + BgJyaBombiwa_InitCollider(this, globalCtx); + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + Actor_Kill(&this->dyna.actor); } else { - Actor_ProcessInitChain(thisx, sInitChain); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); // 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) { BgJyaBombiwa_Break(this, globalCtx); 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); } else { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h index c42747f557..de1b9d24df 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h @@ -11,7 +11,7 @@ typedef struct BgJyaBombiwa { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ s32 unk_164; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderItems; + /* 0x0188 */ ColliderJntSphElement colliderItems[1]; } BgJyaBombiwa; // size = 0x01C8 extern const ActorInit Bg_Jya_Bombiwa_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index d7e949f023..c6f114f912 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -189,13 +189,13 @@ void func_80895A70(BgJyaCobra* this) { } break; case 1: - phi_v0 = temp_v1->lightBeams[1]; + phi_v0 = (MirRay*)temp_v1->lightBeams[1]; if (phi_v0 == NULL) { return; } break; case 2: - phi_v0 = temp_v1->lightBeams[2]; + phi_v0 = (MirRay*)temp_v1->lightBeams[2]; if (phi_v0 == NULL) { return; } diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index b4b230d252..a5410b1de8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -151,7 +151,7 @@ void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT & ~AT_ON; tmp16 = thisx->yawTowardsPlayer - thisx->world.rot.y; - if ((tmp16 >= -0x3FFF) && (tmp16 < 0x4000)) { + if ((tmp16 > -0x4000) && (tmp16 < 0x4000)) { thisx->world.rot.y += 0x8000; } @@ -197,10 +197,10 @@ void func_80897DF0(BgJyaGoroiwa* this, GlobalContext* globalCtx) { } void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { - Player* player = PLAYER; s32 pad; BgJyaGoroiwa* this = THIS; - UNK_PTR sp38; + Player* player = PLAYER; + s32 bgId; Vec3f pos; 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.z = this->actor.world.pos.z; 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); if (this->collider.base.atFlags & AT_ON) { CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index d3162b574d..6485e311a8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -1,7 +1,7 @@ /* * File: z_bg_jya_kanaami.c - * Overlay: Bg_Jya_Kanaami - * Description: Climbable Metal Grating (Fire Temple) + * Overlay: ovl_Bg_Jya_Kanaami + * Description: Climbable grating/bridge (Spirit Temple) */ #include "z_bg_jya_kanaami.h" @@ -48,12 +48,12 @@ void func_80899740(BgJyaKanaami* this, GlobalContext* globalCtx, CollisionHeader CollisionHeader* colHeader = NULL; s32 pad2; - DynaPolyActor_Init(&this->actor, flag); + DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); - if (this->bgId == BG_ACTOR_MAX) { + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + 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, - 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; func_80899740(this, globalCtx, &D_0600F208, 0); - Actor_ProcessInitChain(&this->actor, sInitChain); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_80899A08(this); } else { 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) { 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) { @@ -82,9 +82,9 @@ void func_80899880(BgJyaKanaami* this) { } void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) || this->unk_16A > 0) { - if (this->actor.world.pos.x > -1000.0f && this->unk_16A == 0) { - func_800800F8(globalCtx, 0xD7A, -0x63, &this->actor, 0); + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { + if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) { + func_800800F8(globalCtx, 0xD7A, -0x63, &this->dyna.actor, 0); } this->unk_16A += 1; if (this->unk_16A >= 0xA) { @@ -101,10 +101,11 @@ void func_8089993C(BgJyaKanaami* this) { void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { s32 pad[2]; s32 var; + 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); - 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); Quake_SetSpeed(var, 25000); Quake_SetQuakeValues(var, 2, 0, 0, 0); @@ -114,7 +115,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { void func_80899A08(BgJyaKanaami* this) { this->actionFunc = 0; - this->actor.world.rot.x = 0x4000; + this->dyna.actor.world.rot.x = 0x4000; } void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) { @@ -123,7 +124,7 @@ void BgJyaKanaami_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != NULL) { 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) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h index 7d32e7e2a8..050b4dd96b 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h @@ -9,9 +9,7 @@ struct BgJyaKanaami; typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, GlobalContext*); typedef struct BgJyaKanaami { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x014C */ char unk_150[0x14]; + /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgJyaKanaamiActionFunc actionFunc; /* 0x0168 */ s16 unk_168; /* 0x016A */ s16 unk_16A; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c index 228e283894..50a350b39c 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c @@ -39,24 +39,24 @@ void BgMenkuriKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->actor, sInitChain); - DynaPolyActor_Init(&this->actor, DPM_UNK3); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK3); 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) { 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) { BgMenkuriKaiten* this = THIS; - if (!Flags_GetSwitch(globalCtx, this->actor.params) && func_80043590(&this->actor)) { - func_8002F974(&this->actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); - this->actor.shape.rot.y += 0x80; + if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params) && func_80043590(&this->dyna)) { + func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG); + this->dyna.actor.shape.rot.y += 0x80; } } diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h index 342ff7ea83..652de90530 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h @@ -7,9 +7,7 @@ struct BgMenkuriKaiten; typedef struct BgMenkuriKaiten { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x0000 */ DynaPolyActor dyna; } BgMenkuriKaiten; // size = 0x0164 extern const ActorInit Bg_Menkuri_Kaiten_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index 50aa184706..88106d18fb 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -15,6 +15,8 @@ void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgMizuUzu_Update(Actor* thisx, GlobalContext* globalCtx); void BgMizuUzu_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx); + const ActorInit Bg_Mizu_Uzu_InitVars = { ACTOR_BG_MIZU_UZU, ACTORCAT_PROP, @@ -35,18 +37,17 @@ static InitChainEntry sInitChain[] = { extern CollisionHeader D_060074EC; -void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx); void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) { - BgMizuUzu* this = THIS; s32 pad; + BgMizuUzu* this = THIS; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK); 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; } diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index a41cabb3e0..17d0af2c15 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -79,7 +79,7 @@ void func_808A0850(BgMjin* this, GlobalContext* globalCtx) { this->dyna.actor.flags &= ~0x10; this->dyna.actor.objBankIndex = this->objBankIndex; 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_; CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 95affff466..0eff3b9ddd 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -62,7 +62,7 @@ void BgMoriHineri_Init(Actor* thisx, GlobalContext* globalCtx) { s32 t6; 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; t6 = this->dyna.actor.params & 0x4000; diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index d8d385a3ee..ad461b1412 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -41,16 +41,16 @@ void BgPushbox_SetupAction(BgPushbox* this, BgPushboxActionFunc actionFunc) { } void BgPushbox_Init(Actor* thisx, GlobalContext* globalCtx) { - BgPushbox* this = THIS; s32 pad; + BgPushbox* this = THIS; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(thisx, sInitChain); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&D_06000350, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); BgPushbox_SetupAction(this, func_808A8BAC); } @@ -61,21 +61,19 @@ void BgPushbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - thisx->speedXZ += this->dyna.unk_150 * 0.2f; - thisx->speedXZ = (thisx->speedXZ < -1.0f) ? -1.0f : ((thisx->speedXZ > 1.0f) ? 1.0f : thisx->speedXZ); - Math_StepToF(&thisx->speedXZ, 0.0f, 0.2f); - thisx->world.rot.y = this->dyna.unk_158; - Actor_MoveForward(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 20.0f, 40.0f, 40.0f, 0x1D); + 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); + Math_StepToF(&this->dyna.actor.speedXZ, 0.0f, 0.2f); + this->dyna.actor.world.rot.y = this->dyna.unk_158; + Actor_MoveForward(&this->dyna.actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 40.0f, 40.0f, 0x1D); } void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) { BgPushbox* this = THIS; this->actionFunc(this, globalCtx); - func_8002DF90(this); + func_8002DF90(&this->dyna); } void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c index e7545e9061..076dbe871f 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c @@ -44,26 +44,26 @@ void BgSpot00Break_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->actor, sInitChain); - DynaPolyActor_Init(&this->actor, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK); - if (this->actor.params == 1) { + if (this->dyna.actor.params == 1) { CollisionHeader_GetVirtual(&D_06000AF0, &colHeader); } else { 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) { - Actor_Kill(&this->actor); + Actor_Kill(&this->dyna.actor); } } void BgSpot00Break_Destroy(Actor* thisx, GlobalContext* globalCtx) { 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) { @@ -72,7 +72,7 @@ void BgSpot00Break_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot00Break_Draw(Actor* thisx, GlobalContext* globalCtx) { BgSpot00Break* this = THIS; - if (this->actor.params == 1) { + if (this->dyna.actor.params == 1) { Gfx_DrawDListOpa(globalCtx, D_06000980); } else { Gfx_DrawDListOpa(globalCtx, D_06000440); diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h index 670395a83d..fa62d54e38 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h @@ -8,9 +8,7 @@ struct BgSpot00Break; typedef struct BgSpot00Break { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x0000 */ DynaPolyActor dyna; } BgSpot00Break; // size = 0x0164 #endif diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index eed1f4e283..424a9036ba 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -59,7 +59,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna.actor, 1); + DynaPolyActor_Init(&this->dyna, 1); if (this->dyna.actor.params == DT_DRAWBRIDGE) { CollisionHeader_GetVirtual(&D_060005E0, &colHeader); @@ -175,12 +175,12 @@ void BgSpot00Hanebasi_DrawBridgeRiseAndFall(BgSpot00Hanebasi* this, GlobalContex Actor* childsChild; 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; } if (this->dyna.actor.shape.rot.x >= -0x27D8) { - child = this->dyna.actor.child; + child = (BgSpot00Hanebasi*)this->dyna.actor.child; angle *= 0.4f; Math_ScaledStepToS(&child->dyna.actor.shape.rot.x, child->destAngle, angle); childsChild = child->dyna.actor.child; @@ -229,7 +229,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.eventChkInf[8] |= 1; Flags_SetEventChkInf(0x82); this->actionFunc = BgSpot00Hanebasi_DoNothing; - func_8002DF54(globalCtx, player, 8); + func_8002DF54(globalCtx, &player->actor, 8); globalCtx->nextEntranceIndex = 0x00CD; gSaveContext.nextCutsceneIndex = 0xFFF1; globalCtx->sceneLoadFlag = 0x14; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index efc8cd061d..e386c12ab5 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -1,6 +1,6 @@ /* * 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 */ @@ -40,17 +40,17 @@ void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, BgSpot01IdosokoActionFun } void BgSpot01Idosoko_Init(Actor* thisx, GlobalContext* globalCtx) { - BgSpot01Idosoko* this = THIS; s32 pad; + BgSpot01Idosoko* this = THIS; CollisionHeader* colHeader = NULL; s32 pad2; - DynaPolyActor_Init(thisx, DPM_PLAYER); - Actor_ProcessInitChain(thisx, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_PLAYER); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); 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) { - Actor_Kill(thisx); + Actor_Kill(&this->dyna.actor); } else { BgSpot01Idosoko_SetupAction(this, func_808ABF54); } diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h index dffae45e15..d3edf1481c 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h @@ -9,7 +9,7 @@ typedef enum { WATERFALL_OPENING_IDLE, WATERFALL_OPENING_ANIMATED, WATERFALL_OPENED, - WATERFALL_CLOSING, + WATERFALL_CLOSING } BgSpot03TakiState; struct BgSpot03Taki; diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c index 07993ca848..899803bdd8 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c @@ -43,16 +43,15 @@ static Gfx* sDLists[] = { }; void BgSpot05Soko_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad1; BgSpot05Soko* this = THIS; - u32 pad1; - CollisionHeader* colHeader; - u32 pad2; + CollisionHeader* colHeader = NULL; + s32 pad2; - colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); this->switchFlag = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; - DynaPolyActor_Init(thisx, DPM_UNK); + DynaPolyActor_Init(&this->dyna, DPM_UNK); if (thisx->params == 0) { CollisionHeader_GetVirtual(&D_06000918, &colHeader); if (LINK_IS_ADULT) { @@ -82,23 +81,19 @@ void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx) { } void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - Audio_PlaySoundAtPosition(globalCtx, &thisx->world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); - Actor_SetFocus(thisx, 50.0f); + Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); + Actor_SetFocus(&this->dyna.actor, 50.0f); func_80080480(globalCtx, &this->dyna.actor); this->actionFunc = func_808AE630; - thisx->speedXZ = 0.5f; + this->dyna.actor.speedXZ = 0.5f; } } void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - thisx->speedXZ *= 1.5f; - if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 120.0f, thisx->speedXZ) != 0) { - Actor_Kill(thisx); + 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) { + Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index c0d75f7642..0ab2953e7c 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -113,7 +113,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { switch (thisx->params) { case LHO_WATER_TEMPLE_ENTRACE_GATE: Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_UNK); + DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&D_06000EE8, &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: Actor_ProcessInitChain(thisx, sInitChain); 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 (!(gSaveContext.eventChkInf[6] & 0x200)) { @@ -179,7 +179,7 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) { break; case LHO_ICE_BLOCK: Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_UNK); + DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&D_06001238, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); this->actionFunc = BgSpot06Objects_DoNothing; @@ -200,7 +200,7 @@ void BgSpot06Objects_Destroy(Actor* thisx, GlobalContext* globalCtx) { DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: - Collider_DestroyJntSph(globalCtx, &this->collider.base); + Collider_DestroyJntSph(globalCtx, &this->collider); break; case LHO_WATER_PLANE: 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.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; - 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) { 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) { 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); } - 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->actionFunc = BgSpot06Objects_LockPullOutward; Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Flags_SetSwitch(globalCtx, this->switchFlag); func_800800F8(globalCtx, 0x1018, 170, &this->dyna.actor, 0); } 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; 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.world.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y) * 16.0f); 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) { this->dyna.actor.velocity.y = 0.0f; 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) { this->dyna.actor.velocity.y += 0.02f; this->dyna.actor.world.pos.x = Rand_CenteredFloat(1.0f) + this->dyna.actor.home.pos.x; diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index fe426516b3..b915fa62a3 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -60,16 +60,15 @@ static Gfx* sDLists[] = { s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 carpentersRescued; - Actor* thisx = &this->dyna.actor; if (gSaveContext.sceneSetupIndex >= 4) { - return thisx->params == 0; + return this->dyna.actor.params == 0; } carpentersRescued = (gSaveContext.eventChkInf[9] & 0xF) == 0xF; if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - switch (thisx->params) { + switch (this->dyna.actor.params) { case 0: return 0; case 1: @@ -80,34 +79,32 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 1; } } else { - return thisx->params == 2; + return this->dyna.actor.params == 2; } return 0; } s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - if (thisx->params == 3) { - Actor_SetScale(thisx, 0.1f); + if (this->dyna.actor.params == 3) { + Actor_SetScale(&this->dyna.actor, 0.1f); } else { - Actor_SetScale(thisx, 1.0f); + Actor_SetScale(&this->dyna.actor, 1.0f); } return 1; } s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; + s32 pad; CollisionHeader* colHeader = NULL; - s32 pad[2]; + s32 pad2[2]; - if (D_808B1F90[thisx->params] != NULL) { - DynaPolyActor_Init(thisx, DPM_UNK); - CollisionHeader_GetVirtual(D_808B1F90[thisx->params], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); + if (D_808B1F90[this->dyna.actor.params] != NULL) { + DynaPolyActor_Init(&this->dyna, DPM_UNK); + CollisionHeader_GetVirtual(D_808B1F90[this->dyna.actor.params], &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) { @@ -115,20 +112,20 @@ s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { if (!D_808B1FA4[i](this, globalCtx)) { - return 0; + return false; } } - return 1; + return true; } s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); - return 1; + return true; } s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); - return 1; + return true; } 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) { 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); - thisx->params &= 0xFF; - if ((thisx->params < 0) || (thisx->params >= 5)) { + this->dyna.actor.params &= 0xFF; + 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", - "../z_bg_spot09_obj.c", 322, thisx->params); + "../z_bg_spot09_obj.c", 322, this->dyna.actor.params); } if (!func_808B1C70(this, globalCtx)) { - Actor_Kill(thisx); + Actor_Kill(&this->dyna.actor); } 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; BgSpot09Obj* this = THIS; - if (thisx->params != 0) { + if (this->dyna.actor.params != 0) { DynaPoly_DeleteBgActor(globalCtx, dynaColCtx, this->dyna.bgId); } } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 6d673286cc..43ec2a9eb8 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -1,6 +1,6 @@ /* * File: z_bg_spot12_gate.c - * Overlay: Bg_Spot12_Gate + * Overlay: ovl_Bg_Spot12_Gate * Description: Haunted Wasteland Gate */ @@ -46,27 +46,27 @@ static InitChainEntry sInitChain[] = { extern Gfx D_06001080[]; extern CollisionHeader D_060011EC; -void func_808B2F90(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) { - Actor* thisx = &this->dyna.actor; +void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) { + s32 pad; CollisionHeader* colHeader = NULL; - s32 pad[2]; + s32 pad2; - DynaPolyActor_Init(thisx, flags); + DynaPolyActor_Init(&this->dyna, flags); 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) { 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) { BgSpot12Gate* this = THIS; - func_808B2F90(this, globalCtx, &D_060011EC, DPM_UNK); - Actor_ProcessInitChain(thisx, sInitChain); + BgSpot12Gate_InitDynaPoly(this, globalCtx, &D_060011EC, DPM_UNK); + 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); } else { func_808B30C0(this); @@ -80,24 +80,20 @@ void BgSpot12Gate_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_808B30C0(BgSpot12Gate* this) { - Actor* thisx = &this->dyna.actor; - 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) { - Actor* thisx = &this->dyna.actor; - - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_808B3134(this); - func_800800F8(globalCtx, 0x1040, -0x63, thisx, 0); + func_800800F8(globalCtx, 0x1040, -0x63, &this->dyna.actor, 0); } } void func_808B3134(BgSpot12Gate* this) { this->actionFunc = func_808B314C; - this->unk_168 = 0x28; + this->unk_168 = 40; } void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { @@ -111,27 +107,25 @@ void func_808B317C(BgSpot12Gate* this) { } void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; + s32 pad; s32 var; - Math_StepToF(&thisx->velocity.y, 1.6f, 0.03f); - if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 200.0f, thisx->velocity.y)) { + Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f); + 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); var = Quake_Add(ACTIVE_CAM, 3); Quake_SetSpeed(var, -0x3CB0); Quake_SetQuakeValues(var, 3, 0, 0, 0); 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 { - 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) { - Actor* thisx = &this->dyna.actor; - 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) { @@ -141,7 +135,7 @@ void BgSpot12Gate_Update(Actor* thisx, GlobalContext* globalCtx) { BgSpot12Gate* this = THIS; if (this->unk_168 > 0) { - this->unk_168 -= 1; + this->unk_168--; } this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 546a4211f8..4a39e0bb5c 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -1,6 +1,6 @@ /* * File: z_bg_spot12_saku.c - * Overlay: Bg_Spot12_Saku + * Overlay: ovl_Bg_Spot12_Saku * Description: */ @@ -45,16 +45,16 @@ extern Gfx D_06002260[]; extern CollisionHeader D_0600238C; void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, CollisionHeader* collision, DynaPolyMoveFlag flags) { - Actor* thisx = &this->dyna.actor; + s32 pad; CollisionHeader* colHeader = NULL; - s32 pad[2]; + s32 pad2; - DynaPolyActor_Init(thisx, flags); + DynaPolyActor_Init(&this->dyna, flags); 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) { 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; func_808B3420(this, globalCtx, &D_0600238C, DPM_UNK); - Actor_ProcessInitChain(thisx, sInitChain); - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_808B3714(this); } else { func_808B3550(this); @@ -77,26 +77,22 @@ void BgSpot12Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_808B3550(BgSpot12Saku* this) { - Actor* thisx = &this->dyna.actor; - this->actionFunc = func_808B357C; - thisx->scale.x = 0.1f; - thisx->world.pos.x = thisx->home.pos.x; - thisx->world.pos.z = thisx->home.pos.z; + this->dyna.actor.scale.x = 0.1f; + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; } void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_808B35E4(this); - this->unk_168 = 0x14; - func_800800F8(globalCtx, 0x104A, -0x63, thisx, 0); + this->timer = 20; + func_800800F8(globalCtx, 0x104A, -0x63, &this->dyna.actor, 0); } } void func_808B35E4(BgSpot12Saku* this) { - if (this->unk_168 == 0) { + if (this->timer == 0) { this->actionFunc = func_808B3604; } } @@ -118,12 +114,10 @@ void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) { } void func_808B3714(BgSpot12Saku* this) { - Actor* thisx = &this->dyna.actor; - this->actionFunc = func_808B37AC; - thisx->scale.x = 0.001f / 0.14f; - thisx->world.pos.x = thisx->home.pos.x - (Math_SinS(thisx->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.scale.x = 0.001f / 0.14f; + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x - (Math_SinS(this->dyna.actor.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) { @@ -132,8 +126,8 @@ void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) { void BgSpot12Saku_Update(Actor* thisx, GlobalContext* globalCtx) { BgSpot12Saku* this = THIS; - if (this->unk_168 > 0) { - this->unk_168 -= 1; + if (this->timer > 0) { + this->timer--; } this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h index 92ef07771f..e269c310f6 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h @@ -11,7 +11,7 @@ typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, GlobalContext*); typedef struct BgSpot12Saku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgSpot12SakuActionFunc actionFunc; - /* 0x0168 */ s16 unk_168; + /* 0x0168 */ s16 timer; } BgSpot12Saku; // size = 0x016C extern const ActorInit Bg_Spot12_Saku_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 0c24a2c497..271bb5ea64 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -1,3 +1,9 @@ +/* + * File: z_bg_spot15_rrbox.c + * Overlay: ovl_Bg_Spot15_Rrbox + * Description: Milk Crate + */ + #include "z_bg_spot15_rrbox.h" #define FLAGS 0x00000000 @@ -81,7 +87,7 @@ void func_808B3A34(BgSpot15Rrbox* this) { s32 func_808B3A40(BgSpot15Rrbox* this, GlobalContext* globalCtx) { 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) { return true; } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index 130280a4a4..5b6d6d8660 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -35,21 +35,22 @@ extern Gfx D_060003C0[]; extern CollisionHeader D_060004D0; void BgSpot15Saku_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; BgSpot15Saku* this = THIS; - s32 pad[2]; + s32 pad2; CollisionHeader* colHeader = NULL; - DynaPolyActor_Init(thisx, DPM_UNK); + DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&D_060004D0, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); - thisx->scale.x = 0.1f; - thisx->scale.y = 0.1f; - thisx->scale.z = 0.1f; - this->unk_170 = thisx->world.pos.x; - this->unk_174 = thisx->world.pos.y; - this->unk_178 = thisx->world.pos.z; - if ((gSaveContext.infTable[7] & 2) != 0) { - thisx->world.pos.z = 2659.0f; + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.actor.scale.x = 0.1f; + this->dyna.actor.scale.y = 0.1f; + this->dyna.actor.scale.z = 0.1f; + this->unk_170.x = this->dyna.actor.world.pos.x; + this->unk_170.y = this->dyna.actor.world.pos.y; + this->unk_170.z = this->dyna.actor.world.pos.z; + if (gSaveContext.infTable[7] & 2) { + this->dyna.actor.world.pos.z = 2659.0f; } this->actionFunc = func_808B4930; } @@ -62,26 +63,25 @@ void BgSpot15Saku_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { if (this->unk_168 && !(gSaveContext.infTable[7] & 2)) { - this->unk_17C = 2; + this->timer = 2; this->actionFunc = func_808B4978; } } void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - if (!this->unk_17C) { - Audio_PlayActorSound2(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); - thisx->world.pos.z -= 2.0f; - if (thisx->world.pos.z < 2660.0f) { - Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); - this->unk_17C = 0x1E; + if (this->timer == 0) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); + this->dyna.actor.world.pos.z -= 2.0f; + if (this->dyna.actor.world.pos.z < 2660.0f) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); + this->timer = 30; this->actionFunc = func_808B4A04; } } } void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { - if (!this->unk_17C) { + if (this->timer == 0) { this->unk_168 = 0; this->actionFunc = func_808B4930; } @@ -90,7 +90,10 @@ void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) { BgSpot15Saku* this = THIS; - DECR(this->unk_17C); + if (this->timer != 0) { + this->timer--; + } + this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h index 13deb86b26..3575cd688c 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h @@ -12,10 +12,8 @@ typedef struct BgSpot15Saku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgSpot15SakuActionFunc actionFunc; /* 0x0168 */ u64 unk_168; - /* 0x0170 */ f32 unk_170; - /* 0x0174 */ f32 unk_174; - /* 0x0174 */ f32 unk_178; - /* 0x017C */ s16 unk_17C; + /* 0x0170 */ Vec3f unk_170; + /* 0x017C */ s16 timer; } BgSpot15Saku; // size = 0x0180 extern const ActorInit Bg_Spot15_Saku_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 044cfa5516..42163ae6a0 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -301,7 +301,7 @@ void func_808B5240(BgSpot16Bombstone* this, GlobalContext* globalCtx) { // for(;this->unk_158 < ARRAY_COUNTU(D_808B5EB0); this->unk_158++) 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; } diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index c21fd4166e..6af480a1da 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -98,7 +98,7 @@ void BgSpot17Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; 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))) { Actor_Kill(&this->dyna.actor); return; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index c7d3920b1b..8c2232e55b 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -83,7 +83,7 @@ void func_808B7710(Actor* thisx, GlobalContext* globalCtx) { Collider_InitJntSph(globalCtx, &this->colliderJntSph); Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, - &this->ColliderJntSphElements); + this->ColliderJntSphElements); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } @@ -134,36 +134,36 @@ static InitChainEntry sInitChain[] = { }; void BgSpot18Basket_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; BgSpot18Basket* this = THIS; - Actor* actor = &this->dyna.actor; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DPM_UNK3); - func_808B7710(this, globalCtx); + func_808B7710(&this->dyna.actor, globalCtx); 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); - ActorShape_Init(&actor->shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - actor->home.pos.y += 0.01f; - actor->world.pos.y = actor->home.pos.y; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); + this->dyna.actor.home.pos.y += 0.01f; + 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); return; } func_808B7AEC(this); - Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_BG_SPOT18_FUTA, actor->world.pos.x, - actor->world.pos.y, actor->world.pos.z, actor->shape.rot.x, actor->shape.rot.y + 0x1555, - actor->shape.rot.z, -1); + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_SPOT18_FUTA, this->dyna.actor.world.pos.x, + 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, + this->dyna.actor.shape.rot.z, -1); - if (actor->child == NULL) { + if (this->dyna.actor.child == NULL) { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("Error : 変化壷蓋発生失敗(%s %d)\n", "../z_bg_spot18_basket.c", 351); 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) { 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); } } @@ -228,14 +228,14 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { if (positionDiff > 120.0f && positionDiff < 200.0f) { 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)) { - func_800800F8(globalCtx, 4210, 240, this, 0); + func_800800F8(globalCtx, 4210, 240, &this->dyna.actor, 0); func_808B7D38(this); 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) { @@ -430,18 +430,19 @@ void func_808B81A0(BgSpot18Basket* this, GlobalContext* globalCtx) { } void BgSpot18Basket_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; BgSpot18Basket* this = THIS; - Vec3s temp; + s32 bgId; this->unk_216++; this->actionFunc(this, globalCtx); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &temp, - &this->dyna.actor, &this->dyna.actor.world); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &bgId, + &this->dyna.actor, &this->dyna.actor.world.pos); 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) { this->colliderJntSph.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); } } } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c index 1e32042c28..ecedc4f4ef 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c @@ -42,30 +42,30 @@ void BgSpot18Futa_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; CollisionHeader* colHeader = NULL; - DynaPolyActor_Init(&this->actor, DPM_UNK); + DynaPolyActor_Init(&this->dyna, DPM_UNK); CollisionHeader_GetVirtual(&D_06000368, &colHeader); - this->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, colHeader); - Actor_ProcessInitChain(&this->actor, sInitChain); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } void BgSpot18Futa_Destroy(Actor* thisx, GlobalContext* globalCtx) { 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) { BgSpot18Futa* this = THIS; s32 iVar1; - if (this->actor.parent == NULL) { - iVar1 = Math_StepToF(&this->actor.scale.x, 0, 0.005); + if (this->dyna.actor.parent == NULL) { + iVar1 = Math_StepToF(&this->dyna.actor.scale.x, 0, 0.005); if (iVar1 != 0) { - Actor_Kill(&this->actor); + Actor_Kill(&this->dyna.actor); } else { - this->actor.scale.z = this->actor.scale.x; - this->actor.scale.y = this->actor.scale.x; + this->dyna.actor.scale.z = this->dyna.actor.scale.x; + this->dyna.actor.scale.y = this->dyna.actor.scale.x; } } } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h index 7ee7675515..ecbf8ecd77 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h @@ -7,10 +7,8 @@ struct BgSpot18Futa; typedef struct BgSpot18Futa { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ u32 unk_150[0x5]; -} BgSpot18Futa; // size = 0x0154 + /* 0x0000 */ DynaPolyActor dyna; +} BgSpot18Futa; // size = 0x0164 extern const ActorInit Bg_Spot18_Futa_InitVars; #endif diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index e638ce8286..30160d9be0 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -1,6 +1,6 @@ /* * File: z_bg_spot18_obj.c - * Overlay: Bg_Spot18_Obj + * Overlay: ovl_Bg_Spot18_Obj * Description: */ @@ -134,7 +134,7 @@ s32 func_808B8A98(BgSpot18Obj* this, GlobalContext* globalCtx) { s32 pad[2]; 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); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); return 1; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index eb1db394c0..cfeb853a32 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -91,7 +91,7 @@ void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx) { void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { Actor_SetFocus(&this->dyna.actor, 70.0f); - func_80080480(globalCtx, this); + func_80080480(globalCtx, &this->dyna.actor); this->actionFunc = func_808B9698; } } diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index a6067aa3d3..1b380ff1b0 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -37,28 +37,30 @@ const ActorInit Bg_Toki_Swd_InitVars = { (ActorFunc)BgTokiSwd_Draw, }; -static ColliderCylinderInit sCylinderInit = { { - COLTYPE_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1 | OC2_UNK1, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK0, - { 0xFFCFFFFF, 0x00, 0x00 }, - { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, - OCELEM_ON, - }, - { 10, 70, 0, { 0 } } }; +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1 | OC2_UNK1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xFFCFFFFF, 0x00, 0x00 }, + { 0xFFCFFFFF, 0x00, 0x00 }, + TOUCH_NONE, + BUMP_NONE, + OCELEM_ON, + }, + { 10, 70, 0, { 0 } }, +}; static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 0x19, ICHAIN_STOP), + ICHAIN_VEC3F_DIV1000(scale, 25, ICHAIN_STOP), }; 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) { - BgTokiSwd* this = THIS; s32 pad; + BgTokiSwd* this = THIS; - Actor_ProcessInitChain(thisx, sInitChain); + Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.shape.yOffset = 800.0f; - BgTokiSwd_SetupAction(thisx, func_808BAF40); + BgTokiSwd_SetupAction(this, func_808BAF40); if (LINK_IS_ADULT) { - thisx->draw = NULL; + this->actor.draw = NULL; } if (gSaveContext.sceneSetupIndex == 5) { @@ -83,8 +85,8 @@ void BgTokiSwd_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); - Collider_UpdateCylinder(thisx, &this->collider); - CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); } void BgTokiSwd_Destroy(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index 1d7a51e0ec..a1d0893437 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -35,28 +35,28 @@ static InitChainEntry sInitChain[] = { }; void BgUmaJump_Init(Actor* thisx, GlobalContext* globalCtx) { - BgUmaJump* this = THIS; s32 pad; + BgUmaJump* this = THIS; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->actor, sInitChain); - DynaPolyActor_Init(&this->actor, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK); 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 ((!Flags_GetEventChkInf(0x18)) && (DREG(1) == 0)) { - Actor_Kill(&this->actor); + if (this->dyna.actor.params == 1) { + if (!Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { + Actor_Kill(&this->dyna.actor); return; } - this->actor.flags |= 0x30; + this->dyna.actor.flags |= 0x30; } } void BgUmaJump_Destroy(Actor* thisx, GlobalContext* globalCtx) { 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) { diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h index 4a7368bc4b..38973c727d 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h @@ -7,9 +7,7 @@ struct BgUmaJump; typedef struct BgUmaJump { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x0000 */ DynaPolyActor dyna; } BgUmaJump; // size = 0x0164 extern const ActorInit Bg_Uma_Jump_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 712c57326f..3688c77e0e 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -3,6 +3,7 @@ * Overlay: ovl_Bg_Ydan_Hasi * Description: Deku Tree Puzzle elements. Water plane and floating block in B1, and 3 blocks on 2F */ + #include "z_bg_ydan_hasi.h" #define FLAGS 0x00000030 @@ -199,7 +200,7 @@ void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); 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)); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h index 76ce339b3f..6f5aaaf242 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h @@ -6,7 +6,7 @@ struct BgYdanHasi; -typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, struct GlobalCtx*); +typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, GlobalContext*); typedef struct BgYdanHasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index f42995c7e3..2a68d64177 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -91,7 +91,7 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); 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; thisx->params = (thisx->params >> 8) & 0xFF; @@ -135,7 +135,7 @@ void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) { BgYdanMaruta* this = THIS; Collider_DestroyTris(globalCtx, &this->collider); - if (thisx->params == 1) { + if (this->dyna.actor.params == 1) { 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) { - if (thisx->params == 0) { + BgYdanMaruta* this = THIS; + + if (this->dyna.actor.params == 0) { Gfx_DrawDListOpa(globalCtx, D_06008D88); } else { Gfx_DrawDListOpa(globalCtx, D_06006570); diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 5dedabfe46..7f9b140640 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -63,8 +63,7 @@ void func_808C0C50(BgZg* this) { } s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - s32 flag = (thisx->params >> 8) & 0xFF; + s32 flag = (this->dyna.actor.params >> 8) & 0xFF; return Flags_GetSwitch(globalCtx, flag); } @@ -83,11 +82,9 @@ void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) { } void func_808C0D08(BgZg* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - - thisx->world.pos.y += (kREG(16) + 20.0f) * 1.2f; - if ((((kREG(17) + 200.0f) * 1.2f) + thisx->home.pos.y) <= thisx->world.pos.y) { - Actor_Kill(thisx); + 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) { + Actor_Kill(&this->dyna.actor); } } @@ -99,30 +96,30 @@ void BgZg_Update(Actor* thisx, GlobalContext* globalCtx) { // Translates to: "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { - sActionFuncs[action](&this->dyna.actor, globalCtx); + sActionFuncs[action](this, globalCtx); } } void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { - BgZg* this = THIS; s32 pad[2]; + BgZg* this = THIS; CollisionHeader* colHeader; - Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_Init(thisx, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK); colHeader = NULL; 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)) { - thisx->scale.x = thisx->scale.x * 1.3f; - thisx->scale.z = thisx->scale.z * 1.3f; - thisx->scale.y = thisx->scale.y * 1.2f; + this->dyna.actor.scale.x = this->dyna.actor.scale.x * 1.3f; + this->dyna.actor.scale.z = this->dyna.actor.scale.z * 1.3f; + this->dyna.actor.scale.y = this->dyna.actor.scale.y * 1.2f; } this->action = 0; this->drawConfig = 0; - if (func_808C0C98(this, globalCtx) != 0) { - Actor_Kill(thisx); + if (func_808C0C98(this, globalCtx)) { + Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h index f138a50f33..962e4518e6 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -6,7 +6,7 @@ struct DemoEffect; -typedef void (*DemoEffectFunc)(struct DemoEffect* this, GlobalContext* globalCtx); +typedef void (*DemoEffectFunc)(struct DemoEffect*, GlobalContext*); typedef struct { /* 0x00 */ u8 timer; @@ -76,7 +76,7 @@ typedef struct { /* 0x00 */ u8 timer; } DemoEffectDust; -typedef struct { +typedef struct DemoEffect { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnimeCurve skelCurve; /* 0x016C */ u8 initObjectBankIndex; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 0f990bd49d..0db66fbc48 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -148,7 +148,7 @@ void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { this->deltaPosX = this->actor.world.pos.x - propIt->world.pos.x; this->deltaPosY = this->actor.world.pos.y - propIt->world.pos.y; this->deltaPosZ = this->actor.world.pos.z - propIt->world.pos.z; - this->demoGt = propIt; + this->demoGt = (DemoGt*)propIt; } propIt = propIt->next; } diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index fe32fd58f3..9a5d6a52ac 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -27,7 +27,7 @@ void func_8097D130(DemoGo* this, GlobalContext* globalCtx); void func_8097D290(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[] = { 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_06004930; -extern UNK_TYPE D_0600E680; +extern u64 D_0600E680[]; extern FlexSkeletonHeader D_0600FEF0; -UNK_TYPE func_8097C870(DemoGo* this) { +s32 func_8097C870(DemoGo* this) { s32 ret; switch (this->actor.params) { @@ -75,10 +75,9 @@ UNK_TYPE func_8097C870(DemoGo* this) { } void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) { - s32 pad[2]; Actor* thisx = &this->actor; - Vec3f* sp20; - Vec3f* sp1C; + Vec3f sp20; + f32 sp1C; if ((thisx->params == 0) || (thisx->params == 1)) { SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &thisx->world.pos, &sp20, &sp1C); @@ -98,7 +97,7 @@ void func_8097C930(DemoGo* this) { s32 pad[3]; if (DECR(*something) == 0) { - *something = Rand_S16Offset(0x3C, 0x3C); + *something = Rand_S16Offset(60, 60); } *other = *something; if (*other >= 3) { @@ -349,7 +348,7 @@ void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) { 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); return; } diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 506f27fa2f..000b6878b2 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -1140,7 +1140,7 @@ void DemoIm_Destroy(Actor* thisx, GlobalContext* 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; 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 (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; if (limbIndex == 0x10) { @@ -1203,8 +1203,8 @@ void func_80987658(DemoIm* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80987514, - func_809875C0, this); + SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, DemoIm_OverrideLimbDraw, + DemoIm_PostLimbDraw, this); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 925); } diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index f224bffec6..82a34f8eb5 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -780,7 +780,7 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList DemoSa* this = THIS; if ((limbIndex == 15) && (this->unk_1B0 != 0)) { - *dList = &D_06007B80; + *dList = D_06007B80; } return false; } diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 1350033b29..8cf803ca40 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -99,24 +99,24 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) { f32 currentFrame = this->skelCurve.animCurFrame; - if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame) { + if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame) { this->unk_170 = 255; } else { if (currentFrame <= - (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) { - this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame - currentFrame) / - sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08) * + (sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_08)) { + this->unk_170 = ((((sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].endFrame - currentFrame) / + sDemoTreLgtInfo[((void)0, gSaveContext.linkAge)].unk_08) * 255.0f) + 255.0f); } else { 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; - } 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 = - ((((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 { this->unk_174 = 0; } diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c index 9224fe3beb..ae6c2b6e20 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -33,28 +33,28 @@ static InitChainEntry sInitChain[] = { }; void DoorToki_Init(Actor* thisx, GlobalContext* globalCtx) { - DoorToki* this = THIS; s32 pad; + DoorToki* this = THIS; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->actor, sInitChain); - DynaPolyActor_Init(&this->actor, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DPM_UNK); 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) { 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) { DoorToki* this = THIS; if (gSaveContext.eventChkInf[4] & 0x800) { - func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->bgId); + func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } else { - func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->bgId); + func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } } diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h index eca2bf512f..d2117e7dd3 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h @@ -7,9 +7,8 @@ struct DoorToki; typedef struct DoorToki { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 bgId; - /* 0x0150 */ u8 unk_150[0x18]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ char unk_164[0x4]; } DoorToki; // size = 0x0168 extern const ActorInit Door_Toki_InitVars; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index cd4a99dd1f..02e903de23 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -64,26 +64,20 @@ static ColliderCylinderInit sCylinderInit = { { 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) { 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) { - EnAni* this = THIS; s32 pad; + EnAni* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); 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) { - if (func_8002F334(&this->actor, globalCtx) != 0) { + if (func_8002F334(&this->actor, globalCtx)) { EnAni_SetupAction(this, func_809B064C); } } 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); } } @@ -143,10 +137,10 @@ void func_809B0558(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); } - 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) { @@ -165,7 +159,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } 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..." EnAni_SetupAction(this, func_809B04F0); } 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; 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..." EnAni_SetupAction(this, func_809B0524); } 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 { 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) { - if ((gSaveContext.itemGetInf[1] & 0x20) != 0) { + if (gSaveContext.itemGetInf[1] & 0x20) { EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..." } else { EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento." } - } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { - if ((gSaveContext.eventChkInf[2] & 0x8000) == 0) { + } else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { + if (!(gSaveContext.eventChkInf[2] & 0x8000)) { textId = 0x5052; // "...Something is happening on Death Mountain!" } else { 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); } - if (DECR(this->unk_2AE) == 0) { - this->unk_2AE = Rand_S16Offset(60, 60); + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); } - this->unk_2AC = this->unk_2AE; - if (this->unk_2AC >= 3) { - this->unk_2AC = 0; + this->eyeIndex = this->blinkTimer; + if (this->eyeIndex >= 3) { + 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) { + static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f }; EnAni* this = THIS; 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) { EnAni* this = THIS; s32 pad; @@ -331,7 +332,7 @@ void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { 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, EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 856d3fe1e4..2438bfc1bd 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -18,8 +18,8 @@ typedef struct EnAni { /* 0x02A2 */ Vec3s unk_2A2; /* 0x02A8 */ u16 unk_2A8; /* 0x02AA */ u16 unk_2AA; - /* 0x02AC */ s16 unk_2AC; - /* 0x02AE */ s16 unk_2AE; + /* 0x02AC */ s16 eyeIndex; + /* 0x02AE */ s16 blinkTimer; /* 0x02B0 */ EnAniActionFunc actionFunc; } EnAni; // size = 0x02B4 diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 1bbd04922f..d15f8a36c1 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -52,7 +52,7 @@ void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { 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); if (this->anubis != NULL) { diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index b50b2a33ad..14d13c9fc2 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -47,7 +47,7 @@ void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->attackTimer == 0) { 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.shape.rot.y, this->actor.shape.rot.z, 0xFFFFFFFF); + this->actor.shape.rot.y, this->actor.shape.rot.z, -1); this->attackTimer = 80; } } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 537a9374e4..9f80d727cc 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -94,7 +94,7 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &trail); 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); } @@ -117,7 +117,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { s32 pad1; f32 distXYZScale; f32 distFromLink; - Actor* hitActor; + DynaPolyActor* hitActor; s32 hitDynaID; Vec3f hitPoint; s32 pad2; @@ -138,7 +138,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { 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. // 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. @@ -152,7 +152,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { // Set xyz speed, move forward, and play the boomerang sound func_8002D9A4(&this->actor, 12.0f); 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 collided = this->collider.base.atFlags & AT_HIT; @@ -170,7 +170,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { // Otherwise handle grabbing and colliding. if (DECR(this->returnTimer) == 0) { 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 (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 || (hitDynaID != BGCHECK_SCENE && ((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; } else { CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint); @@ -221,7 +221,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { if (collided) { this->actor.world.rot.x = -this->actor.world.rot.x; this->actor.world.rot.y += 0x8000; - this->moveTo = player; + this->moveTo = &player->actor; this->returnTimer = 0; } } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/src/overlays/actors/ovl_En_Boom/z_en_boom.h index d9c928d834..361577b278 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -15,7 +15,7 @@ typedef struct EnBoom { /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 /* 0x01D5 */ u8 activeTimer; // increments once every update - /* 0x01D8 */ u32 effectIndex; // set by Effect_Add + /* 0x01D8 */ s32 effectIndex; // set by Effect_Add /* 0x01DC */ WeaponInfo boomerangInfo; /* 0x01F8 */ EnBoomActionFunc actionFunc; } EnBoom; // size = 0x01FC diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 8fea984f16..7b41896c2b 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -87,7 +87,7 @@ void EnBox_SetupAction(EnBox* this, EnBoxActionFunc actionFunc) { void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { f32 newY; CollisionPoly* poly; - s32* bgId; + s32 bgId; Vec3f pos; pos = this->dyna.actor.world.pos; diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index 98261f3b04..a6d1000e52 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -226,7 +226,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { sp60 = ABS(sp58) * 85.0f; 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, 1))) || (this->unk_222 == 0)) { @@ -865,7 +865,7 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { 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; Matrix_MultVec3f(&spAC, &this->unk_264); spAC.z = thisx->scale.z * 150000.0f; diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index edfc5a8ee0..a068b5151b 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -9,13 +9,13 @@ void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx); void EnCrow_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnCrow_SetupWait(EnCrow* this); -void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx); -void func_809E10A8(EnCrow* this, GlobalContext* globalCtx); -void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_SetupFlyIdle(EnCrow* this); +void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx); void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx); -void func_809E1004(EnCrow* this, GlobalContext* globalCtx); -void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx); extern FlexSkeletonHeader D_060010C0; extern AnimationHeader D_060000F0; @@ -120,7 +120,7 @@ void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); sDeathCount = 0; - EnCrow_SetupWait(this); + EnCrow_SetupFlyIdle(this); } void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -129,21 +129,23 @@ void EnCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { Collider_DestroyJntSph(globalCtx, &this->collider); } -void EnCrow_SetupWait(EnCrow* this) { +// Setup Action functions + +void EnCrow_SetupFlyIdle(EnCrow* this) { this->timer = 100; this->collider.base.acFlags |= AC_ON; - this->actionFunc = EnCrow_Wait; + this->actionFunc = EnCrow_FlyIdle; this->skelAnime.playSpeed = 1.0f; } -void func_809E0384(EnCrow* this) { +void EnCrow_SetupDiveAttack(EnCrow* this) { this->timer = 300; this->actor.speedXZ = 4.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; f32 scale; Vec3f iceParticlePos; @@ -158,7 +160,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 0.0f; 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); for (i = 0; i < 8; i++) { 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, ((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); for (i = 0; i < 4; i++) { @@ -184,7 +186,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= 0x10; - this->actionFunc = func_809E0E2C; + this->actionFunc = EnCrow_Damaged; } void EnCrow_SetupDie(EnCrow* this) { @@ -192,7 +194,7 @@ void EnCrow_SetupDie(EnCrow* this) { this->actionFunc = EnCrow_Die; } -void func_809E06E8(EnCrow* this) { +void EnCrow_SetupTurnAway(EnCrow* this) { this->timer = 100; this->actor.speedXZ = 3.5f; this->aimRotX = -0x1000; @@ -200,10 +202,10 @@ void func_809E06E8(EnCrow* this) { this->skelAnime.playSpeed = 2.0f; func_8003426C(&this->actor, 0, 255, 0, 5); 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) { this->actor.params = 1; sDeathCount = 0; @@ -222,10 +224,12 @@ void func_809E0770(EnCrow* this) { this->actor.shape.yOffset = 2000; this->actor.targetArrowOffset = 2000.0f; 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; s32 skelanimeUpdated; 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) && (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; s32 yaw; Vec3f pos; @@ -320,11 +324,11 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) { 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); this->actor.colorFilterTimer = 40; @@ -334,7 +338,7 @@ void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx) { this->actor.shape.rot.z += 0x1780; } 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); EnCrow_SetupDie(this); } @@ -357,13 +361,13 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { } else { 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; } -void func_809E1004(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 8) { @@ -379,11 +383,11 @@ void func_809E1004(EnCrow* this, GlobalContext* globalCtx) { this->timer--; } 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; if (this->timer != 0) { @@ -402,24 +406,24 @@ void func_809E10A8(EnCrow* this, GlobalContext* globalCtx) { this->actor.flags |= 1; this->actor.flags &= ~0x10; this->actor.colChkInfo.health = 1; - EnCrow_SetupWait(this); + EnCrow_SetupFlyIdle(this); } 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) { this->collider.base.acFlags &= ~AC_HIT; 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 == 1) { - func_809E06E8(this); + if (this->actor.colChkInfo.damageEffect == 1) { // Deku Nuts + EnCrow_SetupTurnAway(this); } else { Actor_ApplyDamage(&this->actor); this->actor.flags &= ~1; 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 scale; - func_809E1174(this, globalCtx); + EnCrow_UpdateDamage(this, globalCtx); this->actionFunc(this, globalCtx); scale = this->actor.scale.x * 100.0f; this->actor.world.rot.y = this->actor.shape.rot.y; 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) { height = 20.0f * scale; 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.z = this->actor.world.pos.z; - if (this->actionFunc == func_809E0C8C) { + if (this->actionFunc == EnCrow_DiveAttack) { 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); } - if (this->actionFunc != func_809E10A8) { + if (this->actionFunc != EnCrow_Respawn) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 2aaba14058..78e44b0446 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -12,7 +12,7 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx); void EnCs_Walk(EnCs* this, GlobalContext* globalCtx); void EnCs_Talk(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); extern FlexSkeletonHeader D_06008540; // Graveyard boy skeleton @@ -215,7 +215,7 @@ void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { } else { 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); } } @@ -446,7 +446,7 @@ void EnCs_Draw(Actor* thisx, GlobalContext* globalCtx) { 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; if (this->flag & 1) { diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index f9954bbf77..ff8685b7fc 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -118,7 +118,7 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { 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_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); @@ -391,12 +391,12 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); 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) { this->runFlag |= 1; this->flags &= ~0x0080; } 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; } diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index b5d204bcff..76f9a285f5 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -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.y, playerPos.y, 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_RotateRPY(test.x, test.y, 0, MTXMODE_APPLY); 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); - 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_MultVec3f(&D_809ED74C, &this->unk_1F4); this->unk_1CE = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_1F4); diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index f9fbe02d33..e4c9d9be86 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -76,8 +76,8 @@ static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF }; void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) { EnDodojr* this = THIS; - ActorShape_Init(&this->actor.shape.rot.x, 0.0f, NULL, 18.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020E0, &D_060009D4, &this->jointTable, &this->morphTable, 15); + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); + SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020E0, &D_060009D4, this->jointTable, this->morphTable, 15); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit); @@ -220,7 +220,7 @@ void func_809F6BBC(EnDodojr* this) { void func_809F6C24(EnDodojr* this) { 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.velocity.x = 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) { return 0; } else { - this->bomb->parent = this; + this->bomb->parent = &this->actor; return 1; } } @@ -419,7 +419,7 @@ void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) { 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 /= 16384.0f; 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) { - func_8002D868(this); + func_8002D868(&this->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10); 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); } -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; 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); } - 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) { diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 0264d9adbb..8db7faad1e 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -74,7 +74,7 @@ typedef enum { /* 0x03 */ DOG_SIT, /* 0x04 */ DOG_SIT_2, /* 0x05 */ DOG_BOW, - /* 0x06 */ DOG_BOW_2, + /* 0x06 */ DOG_BOW_2 } DogBehavior; extern FlexSkeletonHeader D_06007290; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 5b9bc7280a..ffb2c865fc 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -192,7 +192,7 @@ void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) { case 2: // have 100 rupees and empty bottle Rupees_ChangeBy(-100); 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; return; } @@ -229,7 +229,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { this->actor.textId = 0x5048; 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; } } @@ -245,7 +245,7 @@ void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); 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 { Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100); Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 2a4e12f1d6..ef0d443caf 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -1,3 +1,9 @@ +/* + * File: z_en_fd.c + * Overlay: ovl_En_Fd + * Description: Flare Dancer (enflamed form) + */ + #include "z_en_fd.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) { CollisionPoly* colPoly; - u32 bgId; + s32 bgId; Vec3f colPoint; s16 angle; 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) { CollisionPoly* poly; - u32 bgId; + s32 bgId; Vec3f colPoint; Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index c88c732c7c..0fd81a8ab7 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -1,3 +1,9 @@ +/* + * File: z_en_firefly.c + * Overlay: ovl_En_Firefly + * Description: Keese (Normal, Fire, Ice) + */ + #include "z_en_firefly.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); } -void EnFirefly_SetupWait(EnFirefly* this) { +void EnFirefly_SetupFlyIdle(EnFirefly* this) { this->timer = Rand_S16Offset(70, 100); 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); @@ -515,7 +521,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { if (((fabsf(this->actor.world.pos.y - this->maxAltitude) < 10.0f) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) < 20.0f)) || (this->timer == 0)) { - EnFirefly_SetupWait(this); + EnFirefly_SetupFlyIdle(this); return; } 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) { 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) { - EnFirefly_SetupWait(this); + EnFirefly_SetupFlyIdle(this); } } @@ -638,7 +644,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { } else if (!this->onFire) { EnFirefly_Ignite(this); if (this->actionFunc == EnFirefly_Perch) { - EnFirefly_SetupWait(this); + EnFirefly_SetupFlyIdle(this); } } } else if (damageEffect == 3) { // Ice Arrows or Ice Magic diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 0636ef44e8..b87f5d084e 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -83,12 +83,12 @@ extern CutsceneData D_0200E080[]; typedef enum { /* 0x00 */ FU_FACE_CALM, - /* 0x01 */ FU_FACE_MAD, + /* 0x01 */ FU_FACE_MAD } EnFuFace; void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { - EnFu* this = THIS; s32 pad; + EnFu* this = THIS; 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); @@ -111,6 +111,7 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnFu* this = THIS; + Collider_DestroyCylinder(globalCtx, &this->collider); } @@ -146,9 +147,8 @@ void func_80A1DA04(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) { 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..." @@ -175,7 +175,7 @@ void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) { void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) { // if dialog state is 2 set action to WaitAdult - if (func_8002F334(this, globalCtx)) { + if (func_8002F334(&this->actor, globalCtx)) { this->actionFunc = EnFu_WaitAdult; } } @@ -206,6 +206,7 @@ void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) { void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { Player* player = PLAYER; + player->stateFlags2 |= 0x800000; // if dialog state is 7, player has played back the song if (func_8010BDBC(&globalCtx->msgCtx) == 7) { @@ -216,6 +217,7 @@ void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { Player* player = PLAYER; + player->stateFlags2 |= 0x800000; // if dialog state is 2, start song demonstration if (func_8010BDBC(&globalCtx->msgCtx) == 2) { @@ -250,8 +252,8 @@ void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) { } void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { - EnFu* this = THIS; s32 pad; + EnFu* this = THIS; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index dfe76fa91d..0ea2919f8c 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -1,3 +1,9 @@ +/* + * File: z_en_fw.c + * Overlay: ovl_En_Fw + * Description: Flare Dancer Core + */ + #include "z_en_fw.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.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) { Player* player = PLAYER; CollisionPoly* poly; - u32 bgId; + s32 bgId; Vec3f collisionPos; if (this->actor.xzDistToPlayer > 300.0f) { diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 06beb3e169..ceab9c8c8c 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -95,14 +95,14 @@ static EnGoAnimation sAnimationEntries[] = { { &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; } -u16 EnGo_GetTextID(GlobalContext* globalCtx, EnGo* this) { +u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { Player* player = PLAYER; - switch (this->actor.params & 0xF0) { + switch (thisx->params & 0xF0) { case 0x90: if (gSaveContext.bgsFlag) { return 0x305E; @@ -146,7 +146,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, EnGo* this) { } } case 0x10: - if (Flags_GetSwitch(globalCtx, this->actor.params >> 8)) { + if (Flags_GetSwitch(globalCtx, thisx->params >> 8)) { return 0x3052; } else { 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; 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)) { if (globalCtx) {} case 2: - switch (this->actor.textId) { + switch (thisx->textId) { case 0x3008: gSaveContext.infTable[14] |= 1; unkState = 0; @@ -237,7 +237,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) { unkState = 0; break; 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 unkState = 2; break; @@ -268,33 +268,33 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) { break; case 4: if (func_80106BC8(globalCtx)) { - switch (this->actor.textId) { + switch (thisx->textId) { case 0x300A: if (globalCtx->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_STRENGTH) || (gSaveContext.infTable[14] & 0x800)) { - this->actor.textId = 0x300B; + thisx->textId = 0x300B; } else { - this->actor.textId = 0x300C; + thisx->textId = 0x300C; } } else { - this->actor.textId = 0x300D; + thisx->textId = 0x300D; } - func_8010B720(globalCtx, this->actor.textId); + func_8010B720(globalCtx, thisx->textId); unkState = 1; break; case 0x3034: if (globalCtx->msgCtx.choiceIndex == 0) { if (gSaveContext.infTable[16] & 0x800) { - this->actor.textId = 0x3033; + thisx->textId = 0x3033; } else { - this->actor.textId = 0x3035; + thisx->textId = 0x3035; } } else if (gSaveContext.infTable[16] & 0x800) { - this->actor.textId = 0x3036; + thisx->textId = 0x3036; } else { - this->actor.textId = 0x3033; + thisx->textId = 0x3033; } - func_8010B720(globalCtx, this->actor.textId); + func_8010B720(globalCtx, thisx->textId); unkState = 1; break; case 0x3054: @@ -302,8 +302,8 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) { if (globalCtx->msgCtx.choiceIndex == 0) { unkState = 2; } else { - this->actor.textId = 0x3056; - func_8010B720(globalCtx, this->actor.textId); + thisx->textId = 0x3056; + func_8010B720(globalCtx, thisx->textId); unkState = 1; } gSaveContext.infTable[11] |= 0x10; @@ -313,13 +313,13 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, EnGo* this) { break; case 5: if (func_80106BC8(globalCtx)) { - switch (this->actor.textId) { + switch (thisx->textId) { case 0x3035: gSaveContext.infTable[16] |= 0x800; case 0x3032: case 0x3033: - this->actor.textId = 0x3034; - func_8010B720(globalCtx, this->actor.textId); + thisx->textId = 0x3034; + func_8010B720(globalCtx, thisx->textId); unkState = 1; break; default: @@ -597,10 +597,10 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { if ((this->actor.params & 0xF0) == 0x90) { 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 { 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)) { diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 8fb06e0059..12b6e5bd8c 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -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; switch (func_8010BDBC(&globalCtx->msgCtx)) { @@ -367,7 +367,7 @@ u16 EnGo2_GetTextIdGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { } // 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)) { case 2: 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) { return 0; } 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 (this->actor.textId == 0x3008) { 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 (this->actor.textId == 0x3014) { 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 (this->actor.textId == 0x3016) { 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 (this->actor.textId == 0x3018) { 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)) { case 2: 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; 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)) { case 2: return 0; @@ -669,7 +669,7 @@ u16 EnGo2_GetTextIdGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) { 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 (this->actor.textId == 0x300E) { gSaveContext.infTable[14] |= 0x8; @@ -685,7 +685,7 @@ u16 EnGo2_GetTextIdGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { return 0x7122; } -u16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { +s16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) { return 0; } 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 (this->actor.textId == 0x3024) { 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) { return 0; } 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); 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) { case GORON_CITY_ROLLING_BIG: return EnGo2_GetStateGoronCityRollingBig(globalCtx, this); @@ -816,10 +819,10 @@ s32 func_80A44790(EnGo2* this, GlobalContext* globalCtx) { this->unk_194.unk_00 = 1; return true; } 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; } 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; } @@ -854,8 +857,8 @@ void EnGo2_CheckCollision(EnGo2* this, GlobalContext* globalCtx) { pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); pos.y += D_80A4816C[this->actor.params & 0x1F].yDist; this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { @@ -896,7 +899,7 @@ s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { globalCtx->damagePlayer(globalCtx, -4); 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; } } @@ -1497,7 +1500,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; 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_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 06d7388d7e..9fa98cab19 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -285,24 +285,23 @@ void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) { } void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) { - Actor* thisx; - f32 frameCount; - BgSpot15Saku* actor; + s32 pad; + f32 frameCount = this->skelAnime.curFrame; + + + 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); 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; } if (this->unk_2EC <= frameCount) { 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); } else { - this->gate = actor; + this->gate = &actor->dyna.actor; actor->unk_168 = 1; break; } @@ -469,7 +468,7 @@ void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) { if (gate->dyna.actor.id != ACTOR_BG_GATE_SHUTTER) { gate = (BgGateShutter*)gate->dyna.actor.next; } else { - this->gate = gate; + this->gate = &gate->dyna.actor; gate->openingState = 1; break; } @@ -615,24 +614,22 @@ void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) { } void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { - Actor* thisx; - f32 frameCount; - BgGateShutter* gate; - - frameCount = this->skelAnime.curFrame; - thisx = &this->actor; - gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); + s32 pad; + f32 frameCount = this->skelAnime.curFrame; + BgGateShutter* gate = (BgGateShutter*)(globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); SkelAnime_Update(&this->skelAnime); + 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; } + if (this->unk_2EC <= frameCount) { while (gate != NULL) { if (ACTOR_BG_GATE_SHUTTER != gate->dyna.actor.id) { gate = (BgGateShutter*)(gate->dyna.actor.next); } else { - this->gate = gate; + this->gate = &gate->dyna.actor; if (this->unk_30A != 2) { gate->openingState = -1; break; @@ -648,6 +645,7 @@ void func_80A543A0(EnHeishi2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A53DF8; } } + void func_80A544AC(EnHeishi2* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0); 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) { - Actor* thisx = &this->actor; + s32 pad; Vec3f pos; f32 rotY; EnBom* bomb; @@ -673,7 +671,7 @@ void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x; pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.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); if (bomb != NULL) { 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) { EnHeishi2* this = THIS; + if (limbIndex == 16) { Matrix_Get(&this->mtxf_330); } diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 676155543e..eba4eef9d9 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -266,7 +266,7 @@ void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx) { void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) { 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 (func_80106BC8(globalCtx) != 0) { func_80106CCC(globalCtx); diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 728eea24b0..fc0db39756 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -599,7 +599,7 @@ void func_80A6ABF8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) { 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; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1467); diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 3c7e2ab6fa..9a9fcc1af3 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -244,10 +244,10 @@ void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) { 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 sp40; - s32 pad; + EnHorseZelda* this = THIS; s32 i; for (i = 0; i < this->colliderSphere.count; i++) { diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 8686e55957..4fb5da10d1 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -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; switch (limbIndex) { diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 3de29128b3..73f9a05fda 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -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; if (limbIndex == 12) { diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index cdf8c80b6f..93105f8d9a 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -127,7 +127,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); 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; func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -152,7 +152,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); 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); this->actor.flags |= 0x8000001; diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 7321059029..23cad17033 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -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); if (reactionText != 0) { @@ -111,8 +112,8 @@ u16 EnKz_GetText(GlobalContext* globalCtx, EnKz* this) { } } -s16 func_80A9C6C0(GlobalContext* globalCtx, EnKz* this) { - s32 pad; +s16 func_80A9C6C0(GlobalContext* globalCtx, Actor* thisx) { + EnKz* this = THIS; s16 ret = 1; switch (func_8010BDBC(&globalCtx->msgCtx)) { @@ -197,7 +198,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal } if (*arg2 != 0) { - *arg2 = callback2(globalCtx, this); + *arg2 = callback2(globalCtx, &this->actor); return 0; } @@ -222,7 +223,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal return 0; } this->actor.xzDistToPlayer = xzDistToPlayer; - this->actor.textId = callback1(globalCtx, this); + this->actor.textId = callback1(globalCtx, &this->actor); 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) { 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 (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) { this->actor.textId = 0x401B; @@ -354,7 +355,7 @@ void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) { this->unk_1E0.unk_00 = 0; this->actionFunc = EnKz_SetupMweep; } 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; EnKz_SetupGetItem(this, globalCtx); } 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 yRange; - if (Actor_HasParent(this, globalCtx)) { + if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; this->unk_1E0.unk_00 = 1; this->actionFunc = EnKz_StartTimer; diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index c8269bec3b..1e43dfa10f 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1,3 +1,9 @@ +/* + * File: z_en_mb.c + * Overlay: ovl_En_Mb + * Description: Moblins + */ + #include "z_en_mb.h" #define FLAGS 0x00000015 @@ -643,7 +649,7 @@ void func_80AA71AC(EnMb* this, GlobalContext* globalCtx) { if ((yDistAbs <= 20.0f) && func_80AA652C(this, globalCtx)) { yawDiff = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; 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); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); func_80AA6AC8(this); @@ -823,7 +829,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) { EffectSsBlast_SpawnWhiteShockwave(globalCtx, &sp74, &sp68, &sp68); func_80033480(globalCtx, &sp74, 2.0f, 3, 0x12C, 0xB4, 1); 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); } } else { @@ -1131,7 +1137,7 @@ void func_80AA8AEC(EnMb* this, GlobalContext* globalCtx) { f32 playSpeedABS; 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); } else { 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) { yawDiff = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); 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); Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE); 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; if (currentFrame != (s32)this->skelAnime.curFrame) { 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); } } diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 98dabfb843..0f45c85886 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -402,7 +402,9 @@ u16 EnMd_GetTextLostWoods(GlobalContext* globalCtx, EnMd* this) { return 0x1060; } -u16 EnMd_GetText(GlobalContext* globalCtx, EnMd* this) { +u16 EnMd_GetText(GlobalContext* globalCtx, Actor* thisx) { + EnMd* this = THIS; + switch (globalCtx->sceneNum) { case SCENE_SPOT04: 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)) { case 0: case 1: @@ -592,7 +596,7 @@ void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) { (globalCtx->sceneNum == SCENE_SPOT04)) ? 100.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; } else { this->alpha = 255; @@ -610,7 +614,7 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (!EnMd_ShouldSpawn(&this->actor, globalCtx)) { + if (!EnMd_ShouldSpawn(this, globalCtx)) { Actor_Kill(&this->actor); return; } @@ -632,7 +636,7 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) { - EnMd_SetMovedPos(&this->actor, globalCtx); + EnMd_SetMovedPos(this, globalCtx); } this->actionFunc = func_80AAB874; @@ -645,7 +649,7 @@ void EnMd_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { 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)) { func_80AAA92C(this, 7); } @@ -655,7 +659,7 @@ void func_80AAB874(EnMd* this, GlobalContext* globalCtx) { void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) { 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); } @@ -707,7 +711,7 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } 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)) { @@ -744,7 +748,7 @@ void func_80AABC10(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); if (!(EnMd_FollowPath(this, globalCtx)) || (this->waypoint != 0)) { diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 04384406fe..1e9f89fec8 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -62,7 +62,7 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06005DF0, &D_06000D88, &this->jointTable, &this->morphTable, 13); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06005DF0, &D_06000D88, this->jointTable, this->morphTable, 13); Animation_PlayLoop(&this->skelAnime, &D_06000D88); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); @@ -95,7 +95,7 @@ void func_80AACA40(EnMk* this, GlobalContext* globalCtx) { } void func_80AACA94(EnMk* this, GlobalContext* globalCtx) { - if (Actor_HasParent(this, globalCtx) != 0) { + if (Actor_HasParent(&this->actor, globalCtx) != 0) { this->actor.parent = NULL; this->actionFunc = func_80AACA40; func_80088AA0(240); @@ -348,7 +348,7 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMk* this = THIS; if (limbIndex == 11) { @@ -356,14 +356,15 @@ s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, rot->z += this->headRotation.x; } - return 0; + return false; } -void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80AAD64C = { 1000.0f, -100.0f, 0.0f }; + EnMk* this = THIS; if (limbIndex == 11) { - Matrix_MultVec3f(&D_80AAD64C, &thisx->focus); + Matrix_MultVec3f(&D_80AAD64C, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 99b8e45720..4a8ae8faeb 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -12,7 +12,7 @@ void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80AAF3C0(EnMm2* this, GlobalContext* globalCtx); void func_80AAF57C(EnMm2* this, GlobalContext* globalCtx); void func_80AAF668(EnMm2* this, GlobalContext* globalCtx); -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx); +s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); void EnMm2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); extern FlexSkeletonHeader D_06005E18; @@ -303,7 +303,7 @@ void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_mm2.c", 654); } -s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, void* thisx) { +s32 EnMm2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMm2* this = THIS; switch (limbIndex) { diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 8846c30bf8..36312014c7 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -83,7 +83,7 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9); Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, this, &sCylinderInit); + Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.015f); @@ -92,7 +92,7 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - EnMs_SetOfferText(&this->actor, globalCtx); + EnMs_SetOfferText(this, globalCtx); this->actionFunc = EnMs_Wait; } @@ -107,13 +107,11 @@ void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { s16 yawDiff; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - EnMs_SetOfferText(&this->actor, globalCtx); - if (func_8002F194(&this->actor, globalCtx) != 0) { // if talk is initiated - this->actionFunc = EnMs_Talk; - return; - } + EnMs_SetOfferText(this, globalCtx); - if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range + if (func_8002F194(&this->actor, globalCtx)) { // if talk is initiated + this->actionFunc = EnMs_Talk; + } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range func_8002F2CC(&this->actor, globalCtx, 90.0f); } } @@ -126,22 +124,20 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { if ((dialogState == 6) && (func_80106BC8(globalCtx) != 0)) { // advanced final textbox this->actionFunc = EnMs_Wait; } - } else { - if (func_80106BC8(globalCtx) != 0) { - switch (globalCtx->msgCtx.choiceIndex) { - case 0: // yes - if (gSaveContext.rupees < sPrices[BEANS_BOUGHT]) { - func_8010B720(globalCtx, 0x4069); // not enough rupees text - return; - } - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); - this->actionFunc = EnMs_Sell; + } else if (func_80106BC8(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: // yes + if (gSaveContext.rupees < sPrices[BEANS_BOUGHT]) { + func_8010B720(globalCtx, 0x4069); // not enough rupees text return; - case 1: // no - func_8010B720(globalCtx, 0x4068); - default: - return; - } + } + func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); + this->actionFunc = EnMs_Sell; + return; + case 1: // no + func_8010B720(globalCtx, 0x4068); + default: + return; } } } @@ -151,9 +147,9 @@ void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) { Rupees_ChangeBy(-sPrices[BEANS_BOUGHT]); this->actor.parent = NULL; this->actionFunc = EnMs_TalkAfterPurchase; - return; + } else { + func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); } - func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); } void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index b81089c25a..76432fb5af 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -350,26 +350,24 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) { f32 viewY; f32 viewZ; Vec3f attackCuccoPos; - EnAttackNiw* attackCucco; + Actor* attackCucco; - if (this->timer5 == 0) { - if (this->unk_296 < 7) { - viewX = globalCtx->view.lookAt.x - globalCtx->view.eye.x; - viewY = globalCtx->view.lookAt.y - globalCtx->view.eye.y; - viewZ = globalCtx->view.lookAt.z - globalCtx->view.eye.z; - attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + globalCtx->view.eye.x; - attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((globalCtx->view.eye.y + 50.0f) + (viewY * 0.5f)); - attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + globalCtx->view.eye.z; - attackCucco = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ATTACK_NIW, - attackCuccoPos.x, attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); + if ((this->timer5 == 0) && (this->unk_296 < 7)) { + viewX = globalCtx->view.lookAt.x - globalCtx->view.eye.x; + viewY = globalCtx->view.lookAt.y - globalCtx->view.eye.y; + viewZ = globalCtx->view.lookAt.z - globalCtx->view.eye.z; + attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + globalCtx->view.eye.x; + attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((globalCtx->view.eye.y + 50.0f) + (viewY * 0.5f)); + attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + globalCtx->view.eye.z; + attackCucco = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ATTACK_NIW, + attackCuccoPos.x, attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); - if (attackCucco != NULL) { - this->unk_296++; - this->timer5 = 10; - } else { - osSyncPrintf("\n\n"); - osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 発生できず ☆☆☆☆☆ \n" VT_RST); - } + if (attackCucco != NULL) { + this->unk_296++; + this->timer5 = 10; + } else { + osSyncPrintf("\n\n"); + osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 発生できず ☆☆☆☆☆ \n" VT_RST); } } } @@ -438,9 +436,9 @@ void func_80AB6324(EnNiw* this, GlobalContext* globalCtx) { void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y < 0.0f) { - this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x; - this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y; - this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z; + this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; + this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; + this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ = @@ -553,8 +551,8 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { posZ += 20.0f; } } - this->unk_2B8 = this->unk_2AC + posY; - this->unk_2C0 = this->unk_2B4 + posZ; + this->unk_2B8.x = this->unk_2AC.x + posY; + this->unk_2B8.z = this->unk_2AC.z + posZ; } else { this->timer4 = 4; if (this->actor.bgCheckFlags & 1) { @@ -567,11 +565,11 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { if (this->timer4 != 0) { Math_ApproachZeroF(&this->unk_26C[9], 0.5f, 4000.0f); tmp = 1; - Math_ApproachF(&this->actor.world.pos.x, this->unk_2B8, 1.0f, this->unk_2FC); - Math_ApproachF(&this->actor.world.pos.z, this->unk_2C0, 1.0f, this->unk_2FC); + Math_ApproachF(&this->actor.world.pos.x, this->unk_2B8.x, 1.0f, this->unk_2FC); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2B8.z, 1.0f, this->unk_2FC); Math_ApproachF(&this->unk_2FC, 3.0f, 1.0f, 0.3f); - posY = this->unk_2B8 - this->actor.world.pos.x; - posZ = this->unk_2C0 - this->actor.world.pos.z; + posY = this->unk_2B8.x - this->actor.world.pos.x; + posZ = this->unk_2B8.z - this->actor.world.pos.z; if (fabsf(posY) < 10.0f) { posY = 0.0; @@ -599,9 +597,9 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) { s16 pathIndex = this->path - 1; if (this->path == 0) { - this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x; - this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y; - this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z; + this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; + this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; + this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ = this->unk_2FC = this->unk_300 = 0.0f; @@ -659,9 +657,9 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { return; } if (this->actor.params == 0xE) { - this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x; - this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y; - this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z; + this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; + this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; + this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ = @@ -806,7 +804,7 @@ void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = func_80AB7204; } - func_80AB5BF8(&this->actor, globalCtx, this->unk_2A2); + func_80AB5BF8(this, globalCtx, this->unk_2A2); } void func_80AB7204(EnNiw* this, GlobalContext* globalCtx) { @@ -835,9 +833,9 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { Player* player = PLAYER; if (this->timer6 == 0) { - this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x; - this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y; - this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z; + this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; + this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; + this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ = this->unk_2FC = this->unk_300 = 0.0f; @@ -936,7 +934,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A6 = 0; } - EnNiw_FeatherUpdate(&this->actor, globalCtx); + EnNiw_FeatherUpdate(this, globalCtx); if (this->timer1 != 0) { this->timer1--; } @@ -1011,8 +1009,8 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); thisx->speedXZ = 0.0f; thisx->gravity = -2.0f; - Math_Vec3f_Copy(&this->unk_2AC, &thisx->home); - Math_Vec3f_Copy(&this->unk_2B8, &thisx->home); + Math_Vec3f_Copy(&this->unk_2AC, &thisx->home.pos); + Math_Vec3f_Copy(&this->unk_2B8, &thisx->home.pos); this->unk_300 = 0.0f; this->unk_2FC = 0.0f; this->unk_2F0.z = 0.0f; @@ -1042,7 +1040,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) { thisx->velocity.y = 0.0f; thisx->gravity = 0.0f; - Math_Vec3f_Copy(&pos, &thisx->world); + Math_Vec3f_Copy(&pos, &thisx->world.pos); pos.y += thisx->yDistToWater; this->timer4 = 30; EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); @@ -1069,9 +1067,9 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_26C[8] = 0.0f; this->sfxTimer1 = 10000; this->unk_2A8 = 1; - this->unk_2AC = this->unk_2B8 = thisx->world.pos.x; - this->unk_2B0 = this->unk_2BC = thisx->world.pos.y; - this->unk_2B4 = this->unk_2C0 = thisx->world.pos.z; + this->unk_2AC.x = this->unk_2B8.x = thisx->world.pos.x; + this->unk_2AC.y = this->unk_2B8.y = thisx->world.pos.y; + this->unk_2AC.z = this->unk_2B8.z = thisx->world.pos.z; this->actionFunc = func_80AB70A0; return; } @@ -1083,7 +1081,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); } - func_80AB747C(&this->actor, globalCtx); + func_80AB747C(this, globalCtx); if (this->sfxTimer2 == 0 && this->actionFunc == func_80AB6BF8) { this->sfxTimer2 = 7; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 95d630da70..56166f2755 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -51,12 +51,8 @@ typedef struct EnNiw { /* 0x02A6 */ s16 unk_2A6; /* 0x02A8 */ s16 unk_2A8; /* 0x02AA */ s16 unk_2AA; - /* 0x02AC */ f32 unk_2AC; - /* 0x02B0 */ f32 unk_2B0; - /* 0x02B4 */ f32 unk_2B4; - /* 0x02B8 */ f32 unk_2B8; - /* 0x02BC */ f32 unk_2BC; - /* 0x02C0 */ f32 unk_2C0; + /* 0x02AC */ Vec3f unk_2AC; + /* 0x02B8 */ Vec3f unk_2B8; /* 0x02C4 */ f32 unk_2C4; /* 0x02C8 */ f32 unk_2C8; /* 0x02CC */ f32 unk_2CC; diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 673b9b384d..f2831ede29 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -26,7 +26,10 @@ void EnNwc_Idle(EnNwc* this, GlobalContext* globalCtx); #define CHICK_BG_FLOOR (1 << 0) #define CHICK_BG_WALL (1 << 1) -typedef enum { CHICK_NONE, CHICK_NORMAL } ChickTypes; +typedef enum { + /* 0 */ CHICK_NONE, + /* 1 */ CHICK_NORMAL +} ChickTypes; extern Gfx D_06000840[]; extern Gfx D_060008B0[]; diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 968846a62a..26ab4d7604 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -112,7 +112,7 @@ void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, &this->elements); + Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->elements); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->unk_1CA = 0; this->unk_1D0 = 0; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index ada7fb287b..74773e4f2c 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -1,7 +1,7 @@ /* * File: z_en_ru1.c * Overlay: En_Ru1 - * Description: + * Description: Ruto (child) */ #include "z_en_ru1.h" @@ -302,7 +302,7 @@ s32 func_80AEB020(EnRu1* this, GlobalContext* globalCtx) { while (actorIt != NULL) { if (actorIt->id == ACTOR_EN_RU1) { - someEnRu1 = actorIt; + someEnRu1 = (EnRu1*)actorIt; if (someEnRu1 != this) { if ((someEnRu1->action == 31) || (someEnRu1->action == 32) || (someEnRu1->action == 24)) { return 1; @@ -362,16 +362,14 @@ s32 func_80AEB1B4(GlobalContext* globalCtx) { } void func_80AEB1D8(EnRu1* this) { - Actor* thisx = &this->actor; - this->action = 36; this->drawConfig = 0; - thisx->velocity.x = 0.0f; - thisx->velocity.y = 0.0f; - thisx->velocity.z = 0.0f; - thisx->speedXZ = 0.0f; - thisx->gravity = 0.0f; - thisx->minVelocityY = 0.0f; + this->actor.velocity.x = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.velocity.z = 0.0f; + this->actor.speedXZ = 0.0f; + this->actor.gravity = 0.0f; + this->actor.minVelocityY = 0.0f; func_80AEB0EC(this, 0); } @@ -449,9 +447,9 @@ void EnRu1_SpawnRipple(EnRu1* this, GlobalContext* globalCtx, s16 radiusMax, s16 Vec3f pos; Actor* thisx = &this->actor; - pos.x = thisx->world.pos.x; - pos.y = thisx->world.pos.y + thisx->yDistToWater; - pos.z = thisx->world.pos.z; + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.yDistToWater; + pos.z = this->actor.world.pos.z; EffectSsGRipple_Spawn(globalCtx, &pos, 100, radiusMax, life); } @@ -471,11 +469,10 @@ void func_80AEB59C(EnRu1* this, GlobalContext* globalCtx) { void func_80AEB680(EnRu1* this, GlobalContext* globalCtx) { Vec3f pos; - Actor* thisx = &this->actor; - pos.x = thisx->world.pos.x; - pos.y = thisx->world.pos.y + thisx->yDistToWater; - pos.z = thisx->world.pos.z; + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.yDistToWater; + pos.z = this->actor.world.pos.z; EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 1, 0); } @@ -521,17 +518,16 @@ f32 func_80AEB87C(f32 arg0, s32 arg1, s32 arg2) { } void func_80AEB89C(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; CsCmdActorAction* npcAction = func_80AEB438(globalCtx); s16 npcActionRotY; if (npcAction != NULL) { npcActionRotY = npcAction->rot.y; - thisx->shape.rot.y = npcActionRotY; - thisx->world.rot.y = npcActionRotY; - thisx->world.pos.x = npcAction->startPos.x; - thisx->world.pos.y = npcAction->startPos.y; - thisx->world.pos.z = npcAction->startPos.z; + this->actor.shape.rot.y = npcActionRotY; + this->actor.world.rot.y = npcActionRotY; + this->actor.world.pos.x = npcAction->startPos.x; + this->actor.world.pos.y = npcAction->startPos.y; + this->actor.world.pos.z = npcAction->startPos.z; } } @@ -551,11 +547,11 @@ void func_80AEB974(EnRu1* this, GlobalContext* globalCtx) { Vec3f* thisPos; f32 sp30; CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); - Actor* thisx = &this->actor; + s32 pad; if (csCmdNPCAction != NULL) { sp30 = func_80AEB7E0(csCmdNPCAction, globalCtx); - thisPos = &thisx->world.pos; + thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(sp30, csCmdNPCAction->startPos.x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(sp30, csCmdNPCAction->startPos.y, csCmdNPCAction->endPos.y); thisPos->z = func_80AEB87C(sp30, csCmdNPCAction->startPos.z, csCmdNPCAction->endPos.z); @@ -572,11 +568,11 @@ void func_80AEBA2C(EnRu1* this, GlobalContext* globalCtx) { Vec3f* thisPos; f32 temp_ret_2; CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); - Actor* thisx = &this->actor; - + s32 pad2; + if (csCmdNPCAction != NULL) { temp_ret_2 = func_80AEB7E0(csCmdNPCAction, globalCtx); - thisPos = &thisx->world.pos; + thisPos = &this->actor.world.pos; thisPos->x = func_80AEB87C(temp_ret_2, unk_364->x, csCmdNPCAction->endPos.x); thisPos->y = func_80AEB87C(temp_ret_2, unk_364->y, csCmdNPCAction->endPos.y); thisPos->z = func_80AEB87C(temp_ret_2, unk_364->z, csCmdNPCAction->endPos.z); @@ -785,7 +781,6 @@ void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; s8 actorRoom; if (!(gSaveContext.infTable[20] & 2)) { @@ -798,63 +793,59 @@ void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) { (!(gSaveContext.infTable[20] & 0x20))) { if (!func_80AEB020(this, globalCtx)) { func_80AEB264(this, &D_060097B8, 0, 0, 0); - actorRoom = thisx->room; + actorRoom = this->actor.room; this->action = 22; - thisx->room = -1; + this->actor.room = -1; this->drawConfig = 0; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } void func_80AEC40C(EnRu1* this) { - Actor* thisx = &this->actor; f32 unk_26C = this->unk_26C; if (unk_26C < 8.0f) { - thisx->speedXZ = (((kREG(3) * 0.01f) + 2.7f) * 0.125f) * unk_26C; + this->actor.speedXZ = (((kREG(3) * 0.01f) + 2.7f) * 0.125f) * unk_26C; } else { - thisx->speedXZ = (kREG(3) * 0.01f) + 2.7f; + this->actor.speedXZ = (kREG(3) * 0.01f) + 2.7f; } - thisx->velocity.y = -1.0f; - Actor_MoveForward(thisx); + this->actor.velocity.y = -1.0f; + Actor_MoveForward(&this->actor); } void func_80AEC4CC(EnRu1* this) { - Actor* thisx = &this->actor; - thisx->velocity.y = -1.0f; - Actor_MoveForward(thisx); + this->actor.velocity.y = -1.0f; + Actor_MoveForward(&this->actor); } void func_80AEC4F4(EnRu1* this) { - Actor* thisx = &this->actor; - f32* speedXZ = &thisx->speedXZ; + f32* speedXZ = &this->actor.speedXZ; f32* unk_26C = &this->unk_26C; if (this->unk_26C < 8.0f) { *unk_26C += 1.0f; *speedXZ *= (8.0f - *unk_26C) * 0.125f; - thisx->velocity.y = -*unk_26C * (((kREG(4) * 0.01f) + 13.0f) * 0.125f); + this->actor.velocity.y = -*unk_26C * (((kREG(4) * 0.01f) + 13.0f) * 0.125f); } else { *speedXZ = 0.0f; - thisx->velocity.y = -((kREG(4) * 0.01f) + 13.0f); + this->actor.velocity.y = -((kREG(4) * 0.01f) + 13.0f); } - Actor_MoveForward(thisx); + Actor_MoveForward(&this->actor); } s32 func_80AEC5FC(EnRu1* this, GlobalContext* globalCtx) { Player* player = PLAYER; - Actor* thisx = &this->actor; - f32 thisPosZ = thisx->world.pos.z; + f32 thisPosZ = this->actor.world.pos.z; f32 playerPosZ = player->actor.world.pos.z; - if ((playerPosZ - thisPosZ <= 265.0f) && (player->actor.world.pos.y >= thisx->world.pos.y)) { + if ((playerPosZ - thisPosZ <= 265.0f) && (player->actor.world.pos.y >= this->actor.world.pos.y)) { return 1; } return 0; @@ -898,18 +889,17 @@ void func_80AEC780(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEC81C(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; CsCmdActorAction* csCmdNPCAction; s16 newRotY; if (func_80AEAFE0(globalCtx, 1, 3)) { csCmdNPCAction = globalCtx->csCtx.npcActions[3]; - thisx->world.pos.x = csCmdNPCAction->startPos.x; - thisx->world.pos.y = csCmdNPCAction->startPos.y; - thisx->world.pos.z = csCmdNPCAction->startPos.z; + this->actor.world.pos.x = csCmdNPCAction->startPos.x; + this->actor.world.pos.y = csCmdNPCAction->startPos.y; + this->actor.world.pos.z = csCmdNPCAction->startPos.z; newRotY = csCmdNPCAction->rot.y; - thisx->shape.rot.y = newRotY; - thisx->world.rot.y = newRotY; + this->actor.shape.rot.y = newRotY; + this->actor.world.rot.y = newRotY; this->action = 9; this->drawConfig = 1; } @@ -943,11 +933,10 @@ void func_80AEC9C4(EnRu1* this) { } void func_80AECA18(EnRu1* this) { - Actor* thisx = &this->actor; - if (!(thisx->bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & 1)) { this->action = 13; this->unk_26C = 0.0f; - thisx->velocity.y = 0.0f; + this->actor.velocity.y = 0.0f; } } @@ -1018,20 +1007,20 @@ void func_80AECC84(EnRu1* this, GlobalContext* globalCtx) { } void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; + s32 pad; Vec3f* pos; s16 yawTowardsPlayer; f32 spawnX; f32 spawnY; f32 spawnZ; - s32 pad[2]; + s32 pad2[2]; - yawTowardsPlayer = thisx->yawTowardsPlayer; - pos = &thisx->world.pos; + yawTowardsPlayer = this->actor.yawTowardsPlayer; + pos = &this->actor.world.pos; spawnX = ((kREG(1) + 12.0f) * Math_SinS(yawTowardsPlayer)) + pos->x; spawnY = pos->y; spawnZ = ((kREG(1) + 12.0f) * Math_CosS(yawTowardsPlayer)) + pos->z; - this->unk_278 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, this, globalCtx, ACTOR_DOOR_WARP1, spawnX, + this->unk_278 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, spawnX, spawnY, spawnZ, 0, yawTowardsPlayer, 0, 5); } @@ -1048,13 +1037,13 @@ void func_80AECE04(EnRu1* this, GlobalContext* globalCtx) { } void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; + s32 pad2; Player* player = PLAYER; Vec3f* playerPos = &player->actor.world.pos; s16 shapeRotY = player->actor.shape.rot.y; s32 pad; f32 unk_27C = this->unk_27C; - Vec3f* pos = &thisx->world.pos; + Vec3f* pos = &this->actor.world.pos; pos->x = (Math_SinS(shapeRotY) * unk_27C) + playerPos->x; pos->y = playerPos->y; @@ -1062,11 +1051,11 @@ void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { } void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; + s32 pad; Player* player = PLAYER; Vec3f* player_unk_450 = &player->unk_450; - Vec3f* pos = &thisx->world.pos; - s16 shapeRotY = thisx->shape.rot.y; + Vec3f* pos = &this->actor.world.pos; + s16 shapeRotY = this->actor.shape.rot.y; player_unk_450->x = ((kREG(2) + 30.0f) * Math_SinS(shapeRotY)) + pos->x; player_unk_450->z = ((kREG(2) + 30.0f) * Math_CosS(shapeRotY)) + pos->z; @@ -1127,10 +1116,9 @@ void func_80AED0D8(EnRu1* this, GlobalContext* globalCtx) { } void func_80AED110(EnRu1* this) { - Actor* thisx = &this->actor; - if (thisx->shape.yOffset >= 0.0f) { + if (this->actor.shape.yOffset >= 0.0f) { this->action = 18; - thisx->shape.yOffset = 0.0f; + this->actor.shape.yOffset = 0.0f; func_80AED0B0(this, 1); } } @@ -1202,24 +1190,23 @@ void func_80AED414(EnRu1* this, GlobalContext* globalCtx) { } void func_80AED44C(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; s8 actorRoom; if ((gSaveContext.infTable[20] & 2) && (!(gSaveContext.infTable[20] & 0x20)) && (!(gSaveContext.infTable[20] & 1)) && (!(gSaveContext.infTable[20] & 0x80))) { if (!func_80AEB020(this, globalCtx)) { func_80AEB264(this, &D_060097B8, 0, 0, 0); - actorRoom = thisx->room; + actorRoom = this->actor.room; this->action = 22; - thisx->room = -1; + this->actor.room = -1; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } @@ -1254,14 +1241,13 @@ void func_80AED600(EnRu1* this) { } s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; s8 curRoomNum = globalCtx->roomCtx.curRoom.num; if (this->roomNum2 != curRoomNum) { - Actor_Kill(thisx); + Actor_Kill(&this->actor); return 0; } else if (((this->roomNum1 != curRoomNum) || (this->roomNum2 != curRoomNum)) && - (thisx->yDistToWater > kREG(16) + 50.0f) && (this->action != 33)) { + (this->actor.yDistToWater > kREG(16) + 50.0f) && (this->action != 33)) { this->action = 33; this->drawConfig = 2; this->unk_2A8 = 0xFF; @@ -1349,16 +1335,15 @@ void func_80AED8DC(EnRu1* this) { } void func_80AEDAE0(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - Actor* dyna = DynaPoly_GetActor(&globalCtx->colCtx, thisx->floorBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); - if (dyna == NULL || dyna->id == ACTOR_EN_BOX) { - thisx->bgCheckFlags &= ~0x19; + if (dynaPolyActor == NULL || dynaPolyActor->actor.id == ACTOR_EN_BOX) { + this->actor.bgCheckFlags &= ~0x19; } } void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { - Actor* temp_dyna; + DynaPolyActor* dynaPolyActor; f32* velocityY; f32* speedXZ; f32* gravity; @@ -1370,11 +1355,11 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { velocityY = &this->actor.velocity.y; - temp_dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { speedXZ = &this->actor.speedXZ; - if (temp_dyna != NULL) { - if (temp_dyna->id != ACTOR_EN_BOX) { + if (dynaPolyActor != NULL) { + if (dynaPolyActor->actor.id != ACTOR_EN_BOX) { *speedXZ = 0.0f; } } else { @@ -1385,8 +1370,8 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { } } gravity = &this->actor.gravity; - if (temp_dyna != NULL) { - if (temp_dyna->id != ACTOR_EN_BOX) { + if (dynaPolyActor != NULL) { + if (dynaPolyActor->actor.id != ACTOR_EN_BOX) { *velocityY = 0.0f; this->actor.minVelocityY = 0.0f; *gravity = 0.0f; @@ -1445,9 +1430,9 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { void func_80AEDEF4(EnRu1* this, GlobalContext* globalCtx) { f32* speedXZ = &this->actor.speedXZ; - Actor* dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); - if (dyna != NULL && dyna->id == ACTOR_EN_BOX) { + if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_EN_BOX) { if (*speedXZ != 0.0f) { *speedXZ *= 1.1f; } else { @@ -1468,14 +1453,12 @@ void func_80AEDFF4(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEE02C(EnRu1* this) { - Actor* thisx = &this->actor; - - thisx->velocity.x = 0.0f; - thisx->velocity.y = 0.0f; - thisx->velocity.z = 0.0f; - thisx->speedXZ = 0.0f; - thisx->gravity = 0.0f; - thisx->minVelocityY = 0.0f; + this->actor.velocity.x = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.velocity.z = 0.0f; + this->actor.speedXZ = 0.0f; + this->actor.gravity = 0.0f; + this->actor.minVelocityY = 0.0f; } void func_80AEE050(EnRu1* this) { @@ -1506,7 +1489,7 @@ void func_80AEE050(EnRu1* this) { } this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; - func_8002D7EC(this); + func_8002D7EC(&this->actor); } } else { if (this->unk_350 == 1) { @@ -1532,19 +1515,17 @@ void func_80AEE050(EnRu1* this) { } s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - - if (!func_8002F194(thisx, globalCtx)) { - thisx->flags |= 9; + if (!func_8002F194(&this->actor, globalCtx)) { + this->actor.flags |= 9; if ((gSaveContext.infTable[20] & 8)) { - thisx->textId = 0x404E; - func_8002F2F4(thisx, globalCtx); + this->actor.textId = 0x404E; + func_8002F2F4(&this->actor, globalCtx); } else if (gSaveContext.infTable[20] & 4) { - thisx->textId = 0x404D; - func_8002F2F4(thisx, globalCtx); + this->actor.textId = 0x404D; + func_8002F2F4(&this->actor, globalCtx); } else { - thisx->textId = 0x404C; - func_8002F2F4(thisx, globalCtx); + this->actor.textId = 0x404C; + func_8002F2F4(&this->actor, globalCtx); } return 0; } @@ -1552,13 +1533,13 @@ s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { - Actor* dyna; + DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & 1) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; - dyna = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); - if ((dyna != NULL) && (dyna->id == ACTOR_BG_BDAN_SWITCH)) { - if (((dyna->params >> 8) & 0x3F) == 0x38) { + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); + if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { + if (((dynaPolyActor->actor.params >> 8) & 0x3F) == 0x38) { gSaveContext.infTable[20] |= 1; return; } @@ -1570,21 +1551,21 @@ void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { s32 pad[2]; CollisionContext* colCtx; - DynaPolyActor* dynaActor; + DynaPolyActor* dynaPolyActor; s32 floorBgId; if ((this->actor.bgCheckFlags & 1) && this->actor.floorBgId != BGCHECK_SCENE) { colCtx = &globalCtx->colCtx; floorBgId = this->actor.floorBgId; // necessary match, can't move this out of this block unfortunately - dynaActor = DynaPoly_GetActor(colCtx, floorBgId); - if (dynaActor != NULL && dynaActor->actor.id == ACTOR_BG_BDAN_OBJECTS && dynaActor->actor.params == 0 && + dynaPolyActor = DynaPoly_GetActor(colCtx, floorBgId); + if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_BG_BDAN_OBJECTS && dynaPolyActor->actor.params == 0 && !Player_InCsMode(globalCtx) && globalCtx->msgCtx.unk_E300 == 0) { func_80AEE02C(this); globalCtx->csCtx.segment = &D_80AF10A4; gSaveContext.cutsceneTrigger = 1; this->action = 36; this->drawConfig = 0; - this->unk_28C = (BgBdanObjects*)dynaActor; + this->unk_28C = (BgBdanObjects*)dynaPolyActor; this->actor.shape.shadowAlpha = 0; return 1; } @@ -1593,31 +1574,28 @@ s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEE488(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; s8 curRoomNum; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(&this->actor, globalCtx)) { curRoomNum = globalCtx->roomCtx.curRoom.num; this->roomNum3 = curRoomNum; this->action = 31; func_80AED520(this, globalCtx); - } else if ((!func_80AEE394(this, globalCtx)) && (!(thisx->bgCheckFlags & 1))) { - thisx->minVelocityY = -((kREG(24) * 0.01f) + 6.8f); - thisx->gravity = -((kREG(23) * 0.01f) + 1.3f); + } else if ((!func_80AEE394(this, globalCtx)) && (!(this->actor.bgCheckFlags & 1))) { + this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); + this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; } } void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - if (!func_80AEE394(this, globalCtx)) { - if ((thisx->bgCheckFlags & 1) && (thisx->speedXZ == 0.0f) && (thisx->minVelocityY == 0.0f)) { + if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ == 0.0f) && (this->actor.minVelocityY == 0.0f)) { func_80AEE02C(this); - func_8002F580(this, globalCtx); + func_8002F580(&this->actor, globalCtx); this->action = 27; func_80AEADD8(this); - } else if (thisx->yDistToWater > 0.0f) { + } else if (this->actor.yDistToWater > 0.0f) { this->action = 29; this->unk_350 = 0; } @@ -1664,7 +1642,7 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { Player* player; f32* unk_370 = &this->unk_370; - if (Actor_HasNoParent(this, globalCtx)) { + if (Actor_HasNoParent(&this->actor, globalCtx)) { frameCount = Animation_GetLastFrame(&D_06006B9C); Animation_Change(&this->skelAnime, &D_06006B9C, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); func_80AED6DC(this, globalCtx); @@ -1714,7 +1692,7 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { func_80AEE02C(this); - func_8002F580(this, globalCtx); + func_8002F580(&this->actor, globalCtx); this->action = 27; func_80AEADD8(this); return 1; @@ -1723,18 +1701,16 @@ s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEEB24(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - if ((func_80AEEAC8(this, globalCtx) == 0) && (this->unk_350 == 3)) { this->action = 30; func_80AEE02C(this); - thisx->gravity = -0.1f; - thisx->minVelocityY = -((kREG(18) * 0.1f) + 0.7f); + this->actor.gravity = -0.1f; + this->actor.minVelocityY = -((kREG(18) * 0.1f) + 0.7f); } } void func_80AEEBB4(EnRu1* this, GlobalContext* globalCtx) { - func_8002F580(this, globalCtx); + func_8002F580(&this->actor, globalCtx); } void func_80AEEBD4(EnRu1* this, GlobalContext* globalCtx) { @@ -1886,7 +1862,7 @@ void func_80AEF1F0(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) { func_80106CCC(globalCtx); gSaveContext.infTable[20] |= 8; func_80AED6DC(this, globalCtx); - func_8002F580(this, globalCtx); + func_8002F580(&this->actor, globalCtx); this->action = 27; func_80AEADD8(this); } @@ -1984,7 +1960,6 @@ void func_80AEF5B8(EnRu1* this) { } void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; f32 frameCount; CsCmdActorAction* csCmdNPCAction; CsCmdActorAction* csCmdNPCAction2; @@ -1995,23 +1970,23 @@ void func_80AEF624(EnRu1* this, GlobalContext* globalCtx) { // this weird part with the redundant variable is necessary to match for some reason csCmdNPCAction2 = globalCtx->csCtx.npcActions[3]; csCmdNPCAction = csCmdNPCAction2; - thisx->world.pos.x = csCmdNPCAction->startPos.x; - thisx->world.pos.y = csCmdNPCAction->startPos.y; - thisx->world.pos.z = csCmdNPCAction->startPos.z; + this->actor.world.pos.x = csCmdNPCAction->startPos.x; + this->actor.world.pos.y = csCmdNPCAction->startPos.y; + this->actor.world.pos.z = csCmdNPCAction->startPos.z; newRotTmp = csCmdNPCAction->rot.x; - thisx->shape.rot.x = newRotTmp; - thisx->world.rot.x = newRotTmp; + this->actor.shape.rot.x = newRotTmp; + this->actor.world.rot.x = newRotTmp; newRotTmp = csCmdNPCAction->rot.y; - thisx->shape.rot.y = newRotTmp; - thisx->world.rot.y = newRotTmp; + this->actor.shape.rot.y = newRotTmp; + this->actor.world.rot.y = newRotTmp; newRotTmp = csCmdNPCAction->rot.z; - thisx->shape.rot.z = newRotTmp; - thisx->world.rot.z = newRotTmp; + this->actor.shape.rot.z = newRotTmp; + this->actor.world.rot.z = newRotTmp; Animation_Change(&this->skelAnime, &D_060063F4, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); func_80AEB3A4(this, globalCtx); this->action = 37; this->drawConfig = 1; - thisx->shape.shadowAlpha = 0xFF; + this->actor.shape.shadowAlpha = 0xFF; } } @@ -2055,12 +2030,10 @@ void func_80AEF890(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEF930(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - if (func_80AEB104(this) == 3) { - thisx->flags |= 9; - thisx->textId = 0x4048; - func_8010B720(globalCtx, thisx->textId); + this->actor.flags |= 9; + this->actor.textId = 0x4048; + func_8010B720(globalCtx, this->actor.textId); func_80AEF4A8(this, globalCtx); this->action = 43; this->drawConfig = 0; @@ -2139,16 +2112,14 @@ void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - if ((gSaveContext.infTable[20] & 0x20) && (!(gSaveContext.infTable[20] & 0x40))) { func_80AEB264(this, &D_060097B8, 0, 0, 0); this->action = 41; this->unk_28C = func_80AEB088(globalCtx); func_80AEB0EC(this, 1); - thisx->flags &= ~0x9; + this->actor.flags &= ~0x9; } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } @@ -2162,28 +2133,24 @@ void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - if ((gSaveContext.eventChkInf[3] & 0x80) && (gSaveContext.linkAge == 1)) { func_80AEB264(this, &D_060097B8, 0, 0, 0); - thisx->flags &= ~0x10; + this->actor.flags &= ~0x10; this->action = 44; this->drawConfig = 1; } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } s32 func_80AEFDC0(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; - - if (!func_8002F194(thisx, globalCtx)) { - thisx->flags |= 9; - thisx->textId = Text_GetFaceReaction(globalCtx, 0x1F); - if (thisx->textId == 0) { - thisx->textId = 0x402C; + if (!func_8002F194(&this->actor, globalCtx)) { + this->actor.flags |= 9; + this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1F); + if (this->actor.textId == 0) { + this->actor.textId = 0x402C; } - func_8002F2F4(thisx, globalCtx); + func_8002F2F4(&this->actor, globalCtx); return 0; } return 1; @@ -2227,23 +2194,24 @@ void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) { - Actor* thisx = &this->actor; s8 actorRoom; if ((gSaveContext.infTable[20] & 2) && (gSaveContext.infTable[20] & 1) && (!(gSaveContext.infTable[20] & 0x20)) && (!(func_80AEB020(this, globalCtx)))) { func_80AEB264(this, &D_060097B8, 0, 0, 0); - actorRoom = thisx->room; + actorRoom = this->actor.room; this->action = 22; - thisx->room = -1; + this->actor.room = -1; this->drawConfig = 0; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; + // Ruto switch set osSyncPrintf("スイッチルトセット!!!!!!!!!!!!!!!!!!!!!!\n"); } else { + // Ruto switch not set osSyncPrintf("スイッチルトセットしない!!!!!!!!!!!!!!!!!!!!!!\n"); - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } @@ -2258,7 +2226,8 @@ void func_80AF0050(EnRu1* this, GlobalContext* globalCtx) { void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { EnRu1* this = THIS; - if (this->action < 0 || this->action >= 46 || sActionFuncs[this->action] == NULL) { + if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { + // Main mode is improper! osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } @@ -2266,12 +2235,12 @@ void EnRu1_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { - EnRu1* this = THIS; s32 pad; + EnRu1* this = THIS; - ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 30.0f); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06012700, NULL, this->jointTable, this->morphTable, 17); - func_80AEAD20(this, globalCtx); + func_80AEAD20(&this->actor, globalCtx); switch (func_80AEADF0(this)) { case 0: func_80AECDA0(this, globalCtx); @@ -2298,7 +2267,8 @@ void EnRu1_Init(Actor* thisx, GlobalContext* globalCtx) { func_80AF0050(this, globalCtx); break; default: - Actor_Kill(thisx); + Actor_Kill(&this->actor); + // Relevant arge_data = %d unacceptable osSyncPrintf("該当 arge_data = %d 無し\n", func_80AEADF0(this)); break; } @@ -2325,6 +2295,7 @@ s32 EnRu1_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, EnRu1* this = THIS; if ((this->unk_290 < 0) || (this->unk_290 > 0) || (*sPreLimbDrawFuncs[this->unk_290] == NULL)) { + // Neck rotation mode is improper! osSyncPrintf(VT_FGCOL(RED) "首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { sPreLimbDrawFuncs[this->unk_290](this, globalCtx, limbIndex, rot); @@ -2405,7 +2376,8 @@ void func_80AF05D4(EnRu1* this, GlobalContext* globalCtx) { void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { EnRu1* this = THIS; - if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == 0) { + if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == 0) { + // Draw mode is improper! osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 21491829e7..3cb9c4cec3 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -191,19 +191,19 @@ CsCmdActorAction* func_80AF27AC(GlobalContext* globalCtx, s32 npcActionIdx) { s32 func_80AF27D0(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdActorAction = func_80AF27AC(globalCtx, npcActionIdx); - if (csCmdActorAction != NULL && csCmdActorAction->action == arg2) { - return 1; + if ((csCmdActorAction != NULL) && (csCmdActorAction->action == arg2)) { + return true; } - return 0; + return false; } s32 func_80AF281C(EnRu2* this, GlobalContext* globalCtx, u16 arg2, s32 npcActionIdx) { CsCmdActorAction* csCmdNPCAction = func_80AF27AC(globalCtx, npcActionIdx); - if (csCmdNPCAction != NULL && csCmdNPCAction->action != arg2) { - return 1; + if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { + return true; } - return 0; + return false; } void func_80AF2868(EnRu2* this, GlobalContext* globalCtx, u32 npcActionIdx) { @@ -273,7 +273,7 @@ void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx) { Player* player; s16 temp; - if (gSaveContext.chamberCutsceneNum == 2 && gSaveContext.sceneSetupIndex < 4) { + if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) { player = PLAYER; this->action = 1; globalCtx->csCtx.segment = &D_80AF411C; @@ -291,7 +291,7 @@ void func_80AF2B44(EnRu2* this, GlobalContext* globalCtx) { if (csCtx->state != 0) { csCmdNPCAction = csCtx->npcActions[3]; - if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { + if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 2; this->drawConfig = 1; func_80AF29DC(this, globalCtx); @@ -312,7 +312,7 @@ void func_80AF2BC0(EnRu2* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.state != 0) { csCmdNPCAction = globalCtx->csCtx.npcActions[3]; - if (csCmdNPCAction != NULL && csCmdNPCAction->action == 3) { + if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 3)) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->action = 4; @@ -331,7 +331,7 @@ void func_80AF2C68(EnRu2* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.state != 0) { csCmdNPCAction = globalCtx->csCtx.npcActions[6]; - if (csCmdNPCAction != NULL && csCmdNPCAction->action == 2) { + if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == 2)) { this->action = 6; func_80AF2A38(this, globalCtx); } @@ -560,6 +560,7 @@ void func_80AF3564(EnRu2* this, GlobalContext* globalCtx) { func_80AF34F0(this); break; default: + // There is no such action! osSyncPrintf("En_Ru2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); break; } @@ -621,7 +622,7 @@ void func_80AF37AC() { void func_80AF37CC(EnRu2* this) { f32 funcFloat; - this->unk_2C0 += 1; + this->unk_2C0++; funcFloat = func_8006F9BC((kREG(2) + 0x96) & 0xFFFF, 0, this->unk_2C0, 8, 0); this->actor.world.pos.y = this->actor.home.pos.y + (300.0f * funcFloat); } @@ -675,10 +676,12 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { if (dialogState == 3) { if (this->unk_2C3 != 3) { + // I'm Komatsu! (cinema scene dev) osSyncPrintf("おれが小松だ! \n"); this->unk_2C2++; if (this->unk_2C2 % 6 == 3) { player = PLAYER; + // uorya-! (screeming sound) osSyncPrintf("うおりゃー! \n"); func_8005B1A4(ACTIVE_CAM); player->actor.world.pos.x = 820.0f; @@ -699,13 +702,13 @@ void func_80AF3ADC(EnRu2* this, GlobalContext* globalCtx) { this->unk_2C4 += 1.0f; if (this->unk_2C4 > kREG(5) + 100.0f) { func_80AF28E8(this, &D_0600F8B8, 0, -12.0f, 0); - this->action = 0x13; + this->action = 19; func_80AF36EC(this, globalCtx); } } void func_80AF3B74(EnRu2* this, GlobalContext* globalCtx) { - if (this->unk_2C0 > (((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96)) & 0xFFFF)) { + if (this->unk_2C0 > ((((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96))) & 0xFFFF)) { Actor_Kill(&this->actor); } } @@ -761,7 +764,8 @@ void func_80AF3D60(EnRu2* this, GlobalContext* globalCtx) { void EnRu2_Update(Actor* thisx, GlobalContext* globalCtx) { EnRu2* this = THIS; - if (this->action < 0 || this->action >= 20 || sActionFuncs[this->action] == 0) { + if ((this->action < 0) || (this->action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[this->action] == NULL)) { + // Main Mode is improper! osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } @@ -821,7 +825,8 @@ void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx) { void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { EnRu2* this = THIS; - if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == 0) { + if ((this->drawConfig < 0) || (this->drawConfig >= ARRAY_COUNT(sDrawFuncs)) || (sDrawFuncs[this->drawConfig] == 0)) { + // Draw Mode is improper! osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 36300e5fb9..914b55cf34 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -103,7 +103,7 @@ typedef enum { /* 0x01 */ SHELLBLADE_WAIT_CLOSED, /* 0x02 */ SHELLBLADE_WAIT_OPEN, /* 0x03 */ SHELLBLADE_LUNGE, - /* 0x04 */ SHELLBLADE_BOUNCE, + /* 0x04 */ SHELLBLADE_BOUNCE } ShellbladeBehavior; extern FlexSkeletonHeader D_06002BF0; @@ -117,7 +117,7 @@ void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) { EnSb* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.colChkInfo.damageTable = &sDamageTable; + this->actor.colChkInfo.damageTable = sDamageTable; this->actor.colChkInfo.health = 2; SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06002BF0, &D_06000194, NULL, NULL, 0); Collider_InitCylinder(globalCtx, &this->collider); @@ -454,7 +454,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.params = 1; } - if (func_8003305C(this, &this->unk_1E0, globalCtx, this->actor.params) != 0) { + if (func_8003305C(&this->actor, &this->unk_1E0, globalCtx, this->actor.params) != 0) { if (!this->hitByWindArrow) { Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); } else { @@ -502,7 +502,7 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { flamePos.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + offset->x); flamePos.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + offset->y); flamePos.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + offset->z); - EffectSsEnFire_SpawnVec3f(globalCtx, this, &flamePos, 100, 0, 0, -1); + EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); } } } diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 03f37a9171..93d19df0e6 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -1,3 +1,9 @@ +/* + * File: z_en_st.c + * Overlay: ovl_En_St + * Description: Skulltula (normal, big, invisible) + */ + #include "z_en_st.h" #define FLAGS 0x00000035 @@ -498,7 +504,7 @@ s32 EnSt_CheckColliders(EnSt* this, GlobalContext* globalCtx) { return true; } - if (EnSt_CheckHitBackside(&this->actor, globalCtx)) { + if (EnSt_CheckHitBackside(this, globalCtx)) { // player has hit the backside of the skulltulla return true; } diff --git a/src/overlays/actors/ovl_En_Vase/z_en_vase.c b/src/overlays/actors/ovl_En_Vase/z_en_vase.c index 3b03d27735..8f74ddaaad 100644 --- a/src/overlays/actors/ovl_En_Vase/z_en_vase.c +++ b/src/overlays/actors/ovl_En_Vase/z_en_vase.c @@ -36,8 +36,8 @@ void EnVase_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnVase_Destroy(Actor* thisx, GlobalContext* globalCtx) { -} +} void EnVase_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, &gUnusedVaseDL); + Gfx_DrawDListOpa(globalCtx, gUnusedVaseDL); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 99fd39037b..014ca0ac1d 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -28,7 +28,7 @@ void func_80B2A300(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* AnimationHeader* animationSeg); void func_80B2A448(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); -void func_80B2A4D8(EnViewer* this, GlobalContext* globalCtx, SkeletonHeader* skeletonHeaderSeg, +void func_80B2A4D8(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); // sDrawFuncs @@ -69,10 +69,10 @@ extern UNK_TYPE D_06004EF0; extern AnimationHeader D_0600504C; extern AnimationHeader D_060050A8; extern UNK_TYPE D_060052F0; -extern SkeletonHeader D_06006B2C; +extern FlexSkeletonHeader D_06006B2C; extern AnimationHeader D_06007148; extern UNK_TYPE D_06007210; -extern SkeletonHeader D_06008668; +extern FlexSkeletonHeader D_06008668; extern UNK_TYPE D_0600A4E0; extern Gfx D_0600BE90[]; extern Gfx D_0600C410[]; @@ -184,7 +184,7 @@ void func_80B2A300(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* if (params == 2 || params == 3 || params == 5 || params == 7 || params == 8 || params == 9) { SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } else { - SkelAnime_Init(globalCtx, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); + SkelAnime_Init(globalCtx, &this->skin.skelAnime, &skeletonHeaderSeg->sh, NULL, NULL, NULL, 0); } gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animObjBankIndex].segment); @@ -202,11 +202,11 @@ void func_80B2A448(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* Animation_PlayLoopSetSpeed(&this->skin.skelAnime, animationSeg, 3.0f); } -void func_80B2A4D8(EnViewer* this, GlobalContext* globalCtx, SkeletonHeader* skeletonHeaderSeg, +void func_80B2A4D8(EnViewer* this, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg) { u8 params; - func_800A663C(globalCtx, &this->skin, skeletonHeaderSeg, animationSeg); + func_800A663C(globalCtx, &this->skin, &skeletonHeaderSeg->sh, animationSeg); params = this->actor.params >> 8; if (!(params == 3 || params == 4 || params == 7 || params == 8 || params == 9)) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, animationSeg, 3.0f); diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 5075ea9af6..a21ac29e10 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -58,12 +58,12 @@ static ColliderCylinderInit sCylinderInit = { { 20, 46, 0, { 0, 0, 0 } }, }; -static UNK_PTR D_80B4E61C[] = { 0x06007208, 0x06009848, 0x06009C48, 0x06009848 }; -static UNK_PTR D_80B4E62C[] = { 0x06007608 }; +static u64* D_80B4E61C[] = { 0x06007208, 0x06009848, 0x06009C48, 0x06009848 }; +static u64* D_80B4E62C[] = { 0x06007608 }; extern AnimationHeader D_06000438; -extern UNK_TYPE D_06008848; -extern UNK_TYPE D_06008C48; +extern u64 D_06008848[]; +extern u64 D_06008C48[]; extern FlexSkeletonHeader D_0600F5D8; extern AnimationHeader D_06010B38; extern AnimationHeader D_06011348; @@ -100,10 +100,10 @@ void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &D_06000438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->unk_1E6 = 0; this->actionFunc = func_80B4BC78; - } else if ((Flags_GetEventChkInf(9)) && (Flags_GetEventChkInf(0x25)) && (Flags_GetEventChkInf(0x37))) { + } else if (Flags_GetEventChkInf(9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { Actor_Kill(&this->actor); - } else if (((Flags_GetEventChkInf(9)) && (Flags_GetEventChkInf(0x25))) || - ((Flags_GetEventChkInf(9)) && (Flags_GetEventChkInf(0x37)))) { + } else if ((Flags_GetEventChkInf(9) && Flags_GetEventChkInf(0x25)) || + (Flags_GetEventChkInf(9) && Flags_GetEventChkInf(0x37))) { frameCount = Animation_GetLastFrame(&D_06000438); Animation_Change(&this->skelAnime, &D_06000438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->actor.textId = 0x703D; @@ -510,7 +510,7 @@ void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { break; } case 2: - if (Actor_HasParent(this, globalCtx)) { + if (Actor_HasParent(&this->actor, globalCtx)) { Gameplay_CopyCamera(globalCtx, 0, this->unk_1E8); Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_ACTIVE); Gameplay_ClearCamera(globalCtx, this->unk_1E8); diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 7fd405e56b..59faccdef6 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -147,8 +147,8 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) { void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { static Vec3f velocity = { 0.0f, 0.2f, 0.0f }; static Vec3f accel = { 0.0f, 0.05f, 0.0f }; - static Color_RGB8 primColor = { 255, 255, 255 }; - static Color_RGB8 envColor = { 255, 50, 50 }; + static Color_RGBA8 primColor = { 255, 255, 255, 0 }; + static Color_RGBA8 envColor = { 255, 50, 50, 0 }; Vec3f pos; velocity.x = Rand_CenteredFloat(3.0f); diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index fdbe56ef8e..344f5ed4fa 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -42,18 +42,18 @@ void ObjBlockstop_Destroy(Actor* thisx, GlobalContext* globalCtx) { void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { ObjBlockstop* this = THIS; - Actor* dynaActor; + DynaPolyActor* dynaPolyActor; Vec3f sp4C; s32 bgId; s32 pad; if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &this->actor.home.pos, &this->actor.world.pos, &sp4C, &this->actor.floorPoly, 0, 0, 1, 1, &bgId, &this->actor)) { - dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); - if (dynaActor != NULL && dynaActor->id == ACTOR_OBJ_OSHIHIKI) { - if ((dynaActor->params & 0x000F) == PUSHBLOCK_HUGE_START_ON || - (dynaActor->params & 0x000F) == PUSHBLOCK_HUGE_START_OFF) { + if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI) { + if ((dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_ON || + (dynaPolyActor->actor.params & 0x000F) == PUSHBLOCK_HUGE_START_OFF) { func_80078884(NA_SE_SY_CORRECT_CHIME); } else { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 5b52c1eb13..5ead8936d8 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -101,7 +101,7 @@ void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { Vec3f pos; Vec3f velocity; - Gfx** dlist; + Gfx* dlist; s16 arg5; s16 scale; s32 i; diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index d49677cc46..88bf2c7159 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -50,7 +50,7 @@ void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.cutsceneIndex < 0xFFF0) { if (!LINK_IS_ADULT) { - Actor_Kill(&this->actor); + Actor_Kill(thisx); return; } this->unk_19C = 2; @@ -60,15 +60,15 @@ void ObjDekujr_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_19B = 1; } if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST)) { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } else { - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Collider_InitCylinder(globalCtx, &this->collider); - sCylinderInit.base.actor = thisx; // thisx required to match here + sCylinderInit.base.actor = thisx; Collider_SetCylinderToActor(globalCtx, &this->collider, &sCylinderInit); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.textId = func_80037C30(globalCtx, 0xF); - Actor_SetScale(&this->actor, 0.4f); + thisx->colChkInfo.mass = MASS_IMMOVABLE; + thisx->textId = func_80037C30(globalCtx, 0xF); + Actor_SetScale(thisx, 0.4f); } } diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index d6aa0eb025..ec79c676bb 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -53,7 +53,7 @@ void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, CollisionHeader* s16 pad2; Actor* thisx = &this->dyna.actor; - DynaPolyActor_Init(thisx, flag); + DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index de45b513c1..461c507472 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -69,7 +69,7 @@ void func_80B93B68(ObjHsblock* this, GlobalContext* globalCtx, CollisionHeader* void func_80B93BF0(ObjHsblock* this, GlobalContext* globalCtx) { if ((this->dyna.actor.params >> 5) & 1) { - Actor_SpawnAsChild(&globalCtx->actorCtx, this, globalCtx, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 1); } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 863bc26df5..fa33e6a548 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -148,13 +148,13 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) { } ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { - Actor* dyna; + DynaPolyActor* dynaPolyActor; if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) && (fabsf(this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) < 0.001f)) { - dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); - if ((dyna != NULL) && (dyna->id == ACTOR_OBJ_OSHIHIKI)) { - return (ObjOshihiki*)dyna; + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI)) { + return (ObjOshihiki*)dynaPolyActor; } } return NULL; @@ -504,7 +504,7 @@ void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx) { void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { s32 bgId; Player* player = PLAYER; - DynaPolyActor* dynaActor; + DynaPolyActor* dynaPolyActor; this->stateFlags |= PUSHBLOCK_ON_ACTOR; Actor_MoveForward(&this->dyna.actor); @@ -514,13 +514,13 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { if (bgId == BGCHECK_SCENE) { ObjOshihiki_SetupOnScene(this, globalCtx); } else { - dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); - if (dynaActor != NULL) { - func_800434A8(dynaActor); - func_80043538(dynaActor); + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + if (dynaPolyActor != NULL) { + func_800434A8(dynaPolyActor); + func_80043538(dynaPolyActor); if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { - if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaActor, globalCtx) && + if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, globalCtx) && !ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; @@ -542,11 +542,11 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { if (bgId == BGCHECK_SCENE) { ObjOshihiki_SetupFall(this, globalCtx); } else { - dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); - if ((dynaActor != NULL) && (dynaActor->unk_15C & 1)) { - func_800434A8(dynaActor); - func_80043538(dynaActor); + if ((dynaPolyActor != NULL) && (dynaPolyActor->unk_15C & 1)) { + func_800434A8(dynaPolyActor); + func_80043538(dynaPolyActor); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { ObjOshihiki_SetupFall(this, globalCtx); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 36ab6e2c70..618a0e2754 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -33,6 +33,8 @@ typedef struct { #define CHEST_ANIM_SHORT 0 #define CHEST_ANIM_LONG 1 +#define GET_ITEM_NONE { ITEM_NONE, 0, 0, 0, 0 } + typedef struct { /* 0x00 */ u8 itemId; /* 0x02 */ s16 actorId; @@ -607,8 +609,8 @@ GetItemEntry sGetItemTable[] = { GET_ITEM(ITEM_NUT_UPGRADE_30, OBJECT_GI_NUTS, 0x11, 0xA7, 0x80, CHEST_ANIM_SHORT), GET_ITEM(ITEM_NUT_UPGRADE_40, OBJECT_GI_NUTS, 0x11, 0xA8, 0x80, CHEST_ANIM_SHORT), GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, 0x72, 0x6C, 0x80, CHEST_ANIM_LONG), - { ITEM_NONE }, - { ITEM_NONE }, + GET_ITEM_NONE, + GET_ITEM_NONE, }; LinkAnimationHeader* D_80853914[] = { @@ -4014,7 +4016,7 @@ f32 func_8083973C(GlobalContext* globalCtx, Player* this, Vec3f* arg2, Vec3f* ar return func_808396F4(globalCtx, this, arg2, arg3, &sp24, &sp20); } -s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, CollisionPoly** arg3, u32* arg4, Vec3f* arg5) { +s32 func_80839768(GlobalContext* globalCtx, Player* this, Vec3f* arg2, CollisionPoly** arg3, s32* arg4, Vec3f* arg5) { Vec3f sp44; Vec3f sp38; @@ -4386,7 +4388,7 @@ void func_8083A5C4(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2, s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) { CollisionPoly* sp84; - u32 sp80; + s32 sp80; Vec3f sp74; Vec3f sp68; f32 temp1; @@ -6071,7 +6073,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { if (LINK_IS_CHILD && !(this->stateFlags1 & 0x8000000) && (arg2 & 0x30)) { wallPoly = this->actor.wallPoly; - CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &globalCtx->colCtx, &sp50); + CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &globalCtx->colCtx, sp50); sp4C = phi_f2 = sp50[0].x; sp44 = phi_f12 = sp50[0].z; @@ -6123,7 +6125,7 @@ s32 func_8083F0C8(Player* this, GlobalContext* globalCtx, u32 arg2) { s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; - u32 sp78; + s32 sp78; Vec3f sp6C; Vec3f sp60; Vec3f sp54; @@ -7429,7 +7431,7 @@ void func_80842D20(GlobalContext* globalCtx, Player* this) { s32 func_80842DF4(GlobalContext* globalCtx, Player* this) { f32 phi_f2; CollisionPoly* sp78; - u32 sp74; + s32 sp74; Vec3f sp68; Vec3f sp5C; Vec3f sp50; @@ -9032,7 +9034,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart; if ((titleFileSize != 0) && gSaveContext.showTitleCard) { if ((gSaveContext.sceneSetupIndex < 4) && - (gEntranceTable[(0, gSaveContext.entranceIndex) + (0, gSaveContext.sceneSetupIndex)].field & 0x4000) && + (gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field & 0x4000) && ((globalCtx->sceneNum != SCENE_DDAN) || (gSaveContext.eventChkInf[11] & 1)) && ((globalCtx->sceneNum != SCENE_NIGHT_SHOP) || (gSaveContext.eventChkInf[2] & 0x20))) { TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, this->giObjectSegment, 0xA0, 0x78, @@ -9077,7 +9079,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { } if (gSaveContext.entranceSound != 0) { - Audio_PlayActorSound2(&this->actor, (0, gSaveContext.entranceSound)); + Audio_PlayActorSound2(&this->actor, ((void)0, gSaveContext.entranceSound)); gSaveContext.entranceSound = 0; } @@ -9396,7 +9398,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { if (this->actor.bgCheckFlags & 8) { CollisionPoly* spA0; - u32 sp9C; + s32 sp9C; s16 sp9A; s32 pad; @@ -9443,7 +9445,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { f32 wallHeight; CollisionPoly* sp7C; CollisionPoly* sp78; - u32 sp74; + s32 sp74; Vec3f sp68; f32 sp64; f32 sp60; @@ -10692,10 +10694,10 @@ void func_8084B78C(Player* this, GlobalContext* globalCtx) { void func_8084B840(GlobalContext* globalCtx, Player* this, f32 arg2) { if (this->actor.wallBgId != BGCHECK_SCENE) { - DynaPolyActor* dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); + DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.wallBgId); - if (dynaActor != NULL) { - func_8002DFA4(dynaActor, arg2, this->actor.world.rot.y); + if (dynaPolyActor != NULL) { + func_8002DFA4(dynaPolyActor, arg2, this->actor.world.rot.y); } } } @@ -10756,7 +10758,7 @@ void func_8084B9E4(Player* this, GlobalContext* globalCtx) { Vec3f sp5C; f32 temp2; CollisionPoly* sp54; - u32 sp50; + s32 sp50; Vec3f sp44; Vec3f sp38; @@ -11137,7 +11139,7 @@ s32 func_8084C89C(GlobalContext* globalCtx, Player* this, s32 arg2, f32* arg3) { Vec3f sp40; Vec3f sp34; CollisionPoly* sp30; - u32 sp2C; + s32 sp2C; sp50 = rideActor->actor.world.pos.y + 20.0f; sp4C = rideActor->actor.world.pos.y - 20.0f; @@ -13788,8 +13790,8 @@ Vec3s D_80855210[2][2] = { void func_808526EC(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - static Color_RGB8 primColor = { 255, 255, 255 }; - static Color_RGB8 envColor = { 0, 128, 128 }; + static Color_RGBA8 primColor = { 255, 255, 255, 0 }; + static Color_RGBA8 envColor = { 0, 128, 128, 0 }; s32 age = gSaveContext.linkAge; Vec3f sparklePos; Vec3f sp34;