From 61b579a9ed2bbb59c98003c219c94717b4d5ffd0 Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Wed, 4 Aug 2021 06:18:09 +0100
Subject: [PATCH 01/51] En_Death new build system edition
---
include/functions.h | 14 +-
src/code/z_skelanime.c | 10 +-
src/overlays/actors/ovl_En_Death/z_en_death.c | 1304 ++++++++++++++++-
src/overlays/actors/ovl_En_Death/z_en_death.h | 54 +-
4 files changed, 1302 insertions(+), 80 deletions(-)
diff --git a/include/functions.h b/include/functions.h
index e4fa6fdc9..d321b13f8 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -2559,16 +2559,16 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDraw
void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor, RSPMatrix** mtx);
void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor);
void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst);
-s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg);
+s16 SkelAnime_GetTotalFrames(void* animationSeg);
+s16 SkelAnime_GetFrameCount(void* animationSeg);
Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, RSPMatrix** mtx, Gfx* gfx);
Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
s32 func_80134FFC(s32 arg0, s32 arg1, Vec3s* dst);
-s16 func_801353D4(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg);
+s16 func_801353D4(void* animationSeg);
+s16 SkelAnime_GetTotalFrames2(void* animationSeg);
+s16 SkelAnime_GetFrameCount2(void* animationSeg);
void SkelAnime_InterpolateVec3s(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf);
void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx);
void func_801358D4(GlobalContext* globalCtx);
@@ -3041,7 +3041,7 @@ void func_80169600(GlobalContext* globalCtx, s16 param_2);
Camera* Play_GetCamera(GlobalContext* globalCtx, s16 index);
s32 func_8016970C(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye);
// void func_8016981C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
-// void func_80169940(void);
+void func_80169940(GlobalContext* globalCtx, s16 arg1, f32 arg2);
// void func_80169988(void);
void func_801699D4(GlobalContext* globalCtx, s16 arg1, s16 arg2);
// void func_80169A50(void);
@@ -3964,7 +3964,7 @@ void Audio_PreNMI(void);
// void func_801A44D4(void);
// void func_801A46F8(void);
// void func_801A4748(void);
-// void func_801A479C(void);
+void func_801A479C(Vec3f*, u16, u16);
// void func_801A47DC(void);
// void func_801A48E0(void);
// void func_801A4A28(void);
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 16428023a..9e7d54f9e 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -618,12 +618,12 @@ void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32
}
}
-s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg) {
+s16 SkelAnime_GetTotalFrames(void* animationSeg) {
AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount;
}
-s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg) {
+s16 SkelAnime_GetFrameCount(void* animationSeg) {
AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return (u16)animation->frameCount - 1;
@@ -851,7 +851,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra
// Function is unused.
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_80134FFC.s")
-s16 func_801353D4(AnimationHeaderCommon* animationSeg) {
+s16 func_801353D4(void* animationSeg) {
AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->unk02;
@@ -861,7 +861,7 @@ s16 func_801353D4(AnimationHeaderCommon* animationSeg) {
* Appears to be unused anywhere in the game. Appears to be a clone of
* SkelAnime_GetTotalFrames
*/
-s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg) {
+s16 SkelAnime_GetTotalFrames2(void* animationSeg) {
AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount;
@@ -871,7 +871,7 @@ s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg) {
* Appears to be unused anywhere in the game. Appears to be a clone of
* SkelAnime_GetFrameCount
*/
-s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg) {
+s16 SkelAnime_GetFrameCount2(void* animationSeg) {
AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
return animation->frameCount - 1;
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c
index f309102bc..fd8061974 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.c
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.c
@@ -30,6 +30,23 @@ void func_808C7C88(EnDeath* this, GlobalContext* globalCtx);
void func_808C7D34(EnDeath* this, GlobalContext* globalCtx);
void func_808C7DCC(EnDeath* this, GlobalContext* globalCtx);
+void func_808C597C(EnDeath* this, GlobalContext* globalCtx);
+void func_808C5C0C(EnDeath* this);
+void func_808C5D6C(EnDeath* this, GlobalContext* globalCtx);
+void func_808C5F58(EnDeath* this, GlobalContext* globalCtx);
+void func_808C645C(EnDeath* this);
+void func_808C6620(EnDeath* this);
+void func_808C67C8(EnDeath* this);
+void func_808C68B8(EnDeath* this);
+void func_808C6A08(EnDeath* this);
+void func_808C70D8(EnDeath* this, GlobalContext* globalCtx);
+void func_808C74A4(EnDeath* this);
+void func_808C7A30(EnDeath* this, GlobalContext* globalCtx);
+void func_808C7AEC(EnDeath* this);
+void func_808C7C04(EnDeath* this);
+void func_808C7CFC(EnDeath* this);
+void func_808C7DB8(EnDeath* this);
+
#if 0
const ActorInit En_Death_InitVars = {
ACTOR_EN_DEATH,
@@ -139,134 +156,1293 @@ extern ColliderQuadInit D_808C99C0;
extern DamageTable D_808C9A10;
extern CollisionCheckInfoInit2 D_808C9A30;
extern InitChainEntry D_808C9A60[];
+extern UNK_TYPE D_808C9A3C;
+extern Vec3f D_808C9AF4;
+extern Vec3f D_808C9B00;
+extern Vec3f D_808C9B0C[];
+extern s8 D_808C9B48[];
+extern Vec3f D_808C9ABC;
+extern Vec3f D_808C9AC8;
+extern Vec3f D_808C9ACC;
-extern UNK_TYPE D_06000E64;
-extern UNK_TYPE D_060015B4;
-extern UNK_TYPE D_06001834;
-extern UNK_TYPE D_06001F80;
-extern UNK_TYPE D_06002DE8;
-extern UNK_TYPE D_0600352C;
-extern UNK_TYPE D_06003CAC;
-extern UNK_TYPE D_06006F88;
-extern UNK_TYPE D_060073D0;
-extern UNK_TYPE D_06009988;
-extern UNK_TYPE D_06009F10;
-extern UNK_TYPE D_0600B284;
-extern UNK_TYPE D_0600B508;
-extern UNK_TYPE D_0600CB2C;
+extern FlexSkeletonHeader D_0600AD08;
+extern AnimationHeader D_06003CAC;
+extern AnimationHeader D_0600CB2C;
+extern AnimationHeader D_0600B284;
+extern AnimationHeader D_0600B284;
+extern AnimationHeader D_0600B508;
+extern AnimationHeader D_06001F80;
+extern AnimationHeader D_06000E64;
+extern AnimationHeader D_06002DE8;
+extern AnimationHeader D_0600352C;
+extern AnimationHeader D_06001834;
+extern AnimationHeader D_060015B4;
+extern AnimatedMaterial D_0600CBC0;
+extern AnimatedMaterial D_0600CB84;
+extern Gfx D_06009988[];
+extern Gfx D_06009BA0[];
+extern Gfx D_06006F88[];
+extern Gfx D_060073D0[];
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/EnDeath_Init.s")
+typedef struct {
+ Actor actor;
+ char unk_144[0x18];
+ f32 unk_15C;
+} UnkActor;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/EnDeath_Destroy.s")
+void EnDeath_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnDeath* this = THIS;
+ GlobalContext* globalCtx2 = globalCtx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5310.s")
+ f32 phi_f20 = 15.0f;
+ s16 phi_s3 = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5394.s")
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5428.s")
+ Actor_ProcessInitChain(&this->actor, D_808C9A60);
+ ActorShape_Init(&this->actor.shape, 5500.0f, func_800B3FC0, 80.0f);
+ SkelAnime_InitSV(globalCtx2, &this->skelAnime, &D_0600AD08, &D_06003CAC, this->unk_1E2, this->unk_266, 22);
+
+ Collider_InitAndSetSphere(globalCtx2, &this->unk_808, &this->actor, &D_808C98E0);
+ Collider_InitAndSetCylinder(globalCtx2, &this->unk_73C, &this->actor, &D_808C990C);
+ Collider_InitAndSetQuad(globalCtx2, &this->unk_788, &this->actor, &D_808C99C0);
+ Collider_InitAndSetTris(globalCtx2, &this->unk_860, &this->actor, &D_808C99B0, this->unk_880);
+
+ this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius;
+
+ CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_808C9A10, &D_808C9A30);
+
+ Effect_Add(globalCtx2, &this->unk_300, 2, 0, 0, &D_808C9A3C);
+
+ if (!(gSaveContext.eventInf[6] & 8)) {
+ this->actor.world.pos.y += 400.0f;
+ }
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i] = Actor_SpawnAsChild(&globalCtx2->actorCtx, &this->actor, globalCtx2, ACTOR_EN_MINIDEATH,
+ this->actor.world.pos.x, this->actor.world.pos.y + phi_f20,
+ this->actor.world.pos.z, 0, phi_s3, 0, i);
+ if (this->unk_6E4[i] == NULL) {
+ Actor_MarkForDeath(&this->actor);
+ }
+ phi_s3 += 0x3A00;
+ phi_f20 += 4.0f;
+ }
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4) - 1; i++) {
+ this->unk_6E4[i]->child = this->unk_6E4[i + 1];
+ }
+
+ this->unk_734 = Lib_SegmentedToVirtual(&D_0600CBC0);
+ this->unk_738 = Lib_SegmentedToVirtual(&D_0600CB84);
+
+ if (gSaveContext.eventInf[6] & 8) {
+ this->unk_18E = 1;
+ Actor_SetScale(&this->actor, 0.01f);
+ this->unk_191 = 0x17;
+ this->actor.params = 0x14;
+ this->unk_304 = 1.0f;
+ func_808C7DB8(this);
+ return;
+ }
+ this->unk_192 = 1;
+ this->actor.flags &= ~1;
+ func_808C7CFC(this);
+}
+
+void EnDeath_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnDeath* this = THIS;
+
+ Collider_DestroySphere(globalCtx, &this->unk_808);
+ Collider_DestroyCylinder(globalCtx, &this->unk_73C);
+ Collider_DestroyQuad(globalCtx, &this->unk_788);
+ Collider_DestroyTris(globalCtx, &this->unk_860);
+ func_801A72CC(&this->unk_338);
+ Effect_Destroy(globalCtx, this->unk_300);
+}
+
+void func_808C5310(GlobalContext* globalCtx) {
+ LightSettings* lightSettings;
+ s32 i;
+
+ globalCtx->envCtx.unk_C3 = 0x14;
+ globalCtx->envCtx.unk_C1 = 0x14;
+ globalCtx->envCtx.unk_C2 = 0x14;
+ globalCtx->envCtx.unk_DC = 1.0f;
+ lightSettings = &globalCtx->envCtx.lightSettingsList[20];
+
+ for (i = 0; i != 3; i++) {
+ lightSettings->diffuseDir1[i] = globalCtx->envCtx.unk_C4.diffuseDir1[i];
+ lightSettings->diffusePos2[i] = globalCtx->envCtx.unk_C4.diffusePos2[i];
+ }
+}
+
+void func_808C5394(EnDeath* this) {
+ func_800B9010(&this->actor, 0x3260);
+
+ if (this->unk_2EA == 0) {
+ this->unk_2EA = 0x28;
+ }
+ this->unk_2EA--;
+ this->actor.world.pos.y = (1.0f - Math_CosS(this->unk_2EA * 0x666)) * 7.5f + this->actor.home.pos.y;
+}
+
+s32 func_808C5428(EnDeath* this, GlobalContext* globalCtx) {
+ Actor* temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0);
+ s16 ret;
+
+ if (temp_v0 != NULL &&
+ (ret = Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y, ABS_ALT(ret) < 0x2000) &&
+ (ret = Actor_PitchToPoint(temp_v0, &this->actor.focus.pos) - temp_v0->world.rot.x, ABS_ALT(ret) < 0x3000)) {
+ return 1;
+ }
+ return 0;
+}
+
+void func_808C54F0(EnDeath* this);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C54F0.s")
+/*
+void func_808C54F0(EnDeath *this) {
+ f32 sp64 = Math_SinS(this->actor.shape.rot.y);
+ f32 sp60 = Math_CosS(this->actor.shape.rot.y);
+ Vec3f sp54;
+ Vec3f sp48;
+ Vec3f sp3C;
+ sp3C.x = this->actor.world.pos.x - (70.0f * sp60) + (75.0f * sp64);
+ sp3C.y = this->actor.world.pos.y + -10.0f;
+ sp3C.z = this->actor.world.pos.z + (70.0f * sp64) + (75.0f * sp60);
+
+ sp48.x = this->actor.world.pos.x + (70.0f * sp60) + (65.0f * sp64);
+ sp48.y = sp3C.y + 150.0f;
+ sp48.z = this->actor.world.pos.z - (70.0f * sp64) + (65.0f * sp60);
+
+ sp54.x = sp3C.x + (-10.0f * sp64);
+ sp54.y = sp3C.y + 150.0f;
+ sp54.z = sp3C.z + (-10.0f * sp60);
+
+ Collider_SetTrisVertices(&this->unk_860, 0, &sp3C, &sp48, &sp54);
+
+ sp54.x = sp48.x + (10.0f * sp64);
+ sp54.y = sp3C.y;
+ sp54.z = sp48.z + (10.0f * sp60);
+
+ Collider_SetTrisVertices(&this->unk_860, 1, &sp3C, &sp54, &sp48);
+}
+*/
+
+#ifdef NON_MATCHING
+// regalloc differences
+f32 func_808C566C(EnDeath* this) {
+ this->unk_308 = this->actor.world.pos.y - this->actor.home.pos.y;
+ this->unk_308 = CLAMP_MIN(this->unk_308, 0.0f);
+ this->unk_308 *= 0.02f;
+ this->unk_308 = SQ(this->unk_308) * 3.0f + 80.0f;
+ this->unk_2F6 += (s16)(65536.0f * (22.5f / (this->unk_308 * (2 * M_PI))));
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C566C.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C571C.s")
+void func_808C571C(EnDeath* this, GlobalContext* globalCtx) {
+ Player* player = PLAYER;
+ Vec3f sp30;
+ Vec3f sp24;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C589C.s")
+ this->actor.shape.rot.y = this->actor.shape.rot.y - 0x657A;
+ this->unk_2EE = 0x3C;
+ sp30.x = (Math_SinS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.x;
+ sp30.z = (Math_CosS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.z;
+ sp30.y = this->actor.home.pos.y + 3.0f;
+ sp24.x = this->actor.world.pos.x;
+ sp24.z = this->actor.world.pos.z;
+ sp24.y = this->actor.world.pos.y - 116.0f;
+ player->actor.world.pos.x = Math_SinS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.x;
+ player->actor.world.pos.z = Math_CosS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.z;
+ player->actor.shape.rot.y = Actor_YawBetweenActors(&player->actor, &this->actor);
+ func_8016970C(globalCtx, this->unk_2FA, &sp24, &sp30);
+ func_80169940(globalCtx, this->unk_2FA, 77.0f);
+ func_800B724C(globalCtx, &this->actor, 0x15);
+ this->unk_188 = func_808C589C;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C597C.s")
+void func_808C589C(EnDeath* this, GlobalContext* globalCtx) {
+ Player* player = PLAYER;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5AB8.s")
+ player->actor.world.pos.x = Math_SinS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.x;
+ player->actor.world.pos.z = Math_CosS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.z;
+ player->actor.shape.rot.y = Actor_YawBetweenActors(&player->actor, &this->actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5C0C.s")
+ if (this->unk_2EE == 0x19) {
+ func_800B724C(globalCtx, &this->actor, 0x51);
+ }
+ if (this->unk_2EE > 0) {
+ this->unk_2EE--;
+ } else {
+ func_808C597C(this, globalCtx);
+ }
+ func_808C566C(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5CB4.s")
+void func_808C597C(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5D6C.s")
+ func_808C5310(globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5E90.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 7;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C5F58.s")
+ this->unk_2EE = 0x32;
+ this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.x;
+ this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.z;
+ this->unk_344.y = this->actor.home.pos.y + 20.0f;
+ this->unk_350.x = this->actor.world.pos.x;
+ this->unk_350.z = this->actor.world.pos.z;
+ this->unk_350.y = this->actor.home.pos.y + 50.0f;
+ this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * 0.0225f;
+ this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * 0.0225f;
+ this->unk_188 = func_808C5AB8;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6070.s")
+void func_808C5AB8(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* sp2C = Play_GetCamera(globalCtx, this->unk_2FA);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C645C.s")
+ if (this->unk_2EE == 0x2A) {
+ func_800B724C(globalCtx, &this->actor, 4);
+ } else if (this->unk_2EE == 0x1B) {
+ func_800B724C(globalCtx, &this->actor, 0x7B);
+ }
+ if (this->unk_2EE <= 0) {
+ if (this->actor.world.pos.y < (this->actor.home.pos.y + 400.0f) - 225.0f) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ }
+ Math_Vec3f_StepTo(&sp2C->eye, &this->unk_344, this->unk_30C);
+ Math_Vec3f_StepTo(&sp2C->at, &this->unk_350, this->unk_310);
+ func_8016970C(globalCtx, this->unk_2FA, &sp2C->at, &sp2C->eye);
+ if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 9.0f) != 0) {
+ this->unk_2EE--;
+ if (this->unk_2EE == -0x14) {
+ func_808C5C0C(this);
+ }
+ }
+ } else {
+ this->unk_2EE--;
+ }
+ func_808C566C(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C64DC.s")
+void func_808C5C0C(EnDeath* this) {
+ gSaveContext.eventInf[6] |= 8;
+ SkelAnime_ChangeAnim(&this->skelAnime, &D_0600B284, 0.0f, 0.0f, SkelAnime_GetFrameCount(&D_0600B284), 2, 0.0f);
+ this->actor.scale.y = 0.01f;
+ this->actor.shape.rot.y += 0x777F;
+ Audio_PlayActorSound2(&this->actor, 0x3AB4);
+ this->unk_188 = func_808C5CB4;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6620.s")
+void func_808C5CB4(EnDeath* this, GlobalContext* globalCtx) {
+ s32 temp_v0 = Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f);
+ f32 temp;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C66A8.s")
+ this->actor.scale.z = this->actor.scale.x;
+ temp = 0.01f - this->actor.scale.x;
+ if (temp > 0.0025f) {
+ temp = 0.0025f;
+ }
+ this->actor.shape.rot.y += (s16)(temp * 4505600.0f);
+ if (temp_v0 != 0) {
+ this->unk_192 = 0;
+ func_808C5D6C(this, globalCtx);
+ }
+ func_808C566C(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C67C8.s")
+void func_808C5D6C(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
+ f32 sp20 = 1.0f / SkelAnime_GetFrameCount(&D_0600B284);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C682C.s")
+ this->unk_2EE = 0xA;
+ this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->actor.shape.rot.y = this->actor.home.rot.y;
+ this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.x;
+ this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.z;
+ this->unk_344.y = this->actor.home.pos.y + 95.0f;
+ this->unk_350.x = this->actor.world.pos.x;
+ this->unk_350.z = this->actor.world.pos.z;
+ this->unk_350.y = this->actor.world.pos.y + 100.0f;
+ this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * sp20;
+ this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * sp20;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C68B8.s")
+ this->unk_188 = func_808C5E90;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C692C.s")
+void func_808C5E90(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* temp_v1 = Play_GetCamera(globalCtx, this->unk_2FA);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6A08.s")
+ if (this->unk_191 < 23) {
+ this->unk_191++;
+ }
+ Math_Vec3f_StepTo(&temp_v1->eye, &this->unk_344, this->unk_30C);
+ Math_Vec3f_StepTo(&temp_v1->at, &this->unk_350, this->unk_310);
+ func_8016970C(globalCtx, this->unk_2FA, &temp_v1->at, &temp_v1->eye);
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (this->unk_2EE > 0) {
+ this->unk_2EE--;
+ } else {
+ func_808C5F58(this, globalCtx);
+ }
+ }
+ func_808C566C(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6AB0.s")
+void func_808C5F58(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6C5C.s")
+ SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600CB2C);
+ this->unk_191 = 0x17;
+ func_801A2E54(0x38);
+ this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.x;
+ this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.z;
+ this->unk_344.y = this->actor.home.pos.y + 40.0f;
+ this->unk_350.y = this->actor.world.pos.y + 85.0f;
+ this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * 0.14285715f;
+ this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * 0.14285715f;
+ func_8019F1C0(&this->unk_338, 0x3AB0);
+ this->unk_188 = func_808C6070;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6CDC.s")
+void func_808C6070(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* sp44 = Play_GetCamera(globalCtx, this->unk_2FA);
+ f32 phi_f2;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6D40.s")
+ if (func_801378B8(&this->skelAnime, 12.0f)) {
+ globalCtx->envCtx.unk_C3 = 0x1B;
+ } else if (func_801378B8(&this->skelAnime, 25.0f)) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ } else if (func_801378B8(&this->skelAnime, 38.0f)) {
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C6F6C.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 9;
+ }
+ } else if (func_801378B8(&this->skelAnime, 14.0f)) {
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C70D8.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 8;
+ this->unk_6E4[i]->world.pos.x =
+ (this->unk_6E4[i]->world.pos.x - this->actor.world.pos.x) * 1.8f + this->actor.world.pos.x;
+ this->unk_6E4[i]->world.pos.z =
+ (this->unk_6E4[i]->world.pos.z - this->actor.world.pos.z) * 1.8f + this->actor.world.pos.z;
+ this->unk_6E4[i]->world.pos.y =
+ (this->unk_6E4[i]->world.pos.y - this->actor.world.pos.y) * 1.7f + this->actor.world.pos.y;
+ }
+ this->unk_18E = 1;
+ this->unk_304 = 1.0f;
+ }
+ Math_Vec3f_StepTo(&sp44->eye, &this->unk_344, this->unk_30C);
+ Math_Vec3f_StepTo(&sp44->at, &this->unk_350, this->unk_310);
+ Math_StepToF(&sp44->fov, 60.0f, 2.4285715f);
+ func_80169940(globalCtx, this->unk_2FA, sp44->fov);
+ func_8016970C(globalCtx, this->unk_2FA, &sp44->at, &sp44->eye);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C72AC.s")
+ phi_f2 = CLAMP(this->skelAnime.animCurrentFrame, 10.0f, 14.0f) - 10.0f;
+ this->unk_304 = phi_f2 * 0.25f;
+ if (phi_f2 < 14.0f) {
+ func_808C566C(this);
+ }
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ ActorCutscene_Stop(this->actor.cutscene);
+ func_800B724C(globalCtx, &this->actor, 6);
+ this->actor.flags |= 1;
+ this->unk_808.base.acFlags |= 1;
+ func_808C645C(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C74A4.s")
+void func_808C645C(EnDeath* this) {
+ SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06003CAC, 10.0f);
+
+ this->actor.speedXZ = 1.5f;
+ if (this->unk_188 == func_808C682C || this->unk_188 == func_808C6AB0) {
+ this->unk_2EE = 0x8C;
+ } else {
+ this->unk_2EE = 0x64;
+ }
+ this->unk_188 = func_808C64DC;
+}
+
+void func_808C64DC(EnDeath* this, GlobalContext* globalCtx) {
+ if (globalCtx->envCtx.unk_C3 == 0x14) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ }
+ func_808C5394(this);
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
+
+ if (this->unk_2EE > 0) {
+ this->unk_2EE--;
+ }
+ if (this->actor.params < 5 && Rand_ZeroOne() < 0.4f && func_808C5428(this, globalCtx)) {
+ func_808C68B8(this);
+ return;
+ }
+ if (this->unk_2EE < 0x64 && this->actor.xzDistToPlayer < 200.0f) {
+ func_808C6620(this);
+ return;
+ }
+ if (this->unk_2EE == 0) {
+ if (this->actor.params >= 5) {
+ func_808C7AEC(this);
+ return;
+ }
+ func_808C6A08(this);
+ }
+}
+
+void func_808C6620(EnDeath* this) {
+ SkelAnime_ChangeAnim(&this->skelAnime, &D_06000E64, 1.0f, 0.0f, 10.0f, 2, -3.0f);
+ this->unk_2EE = 0;
+ this->unk_2EA = 0;
+ this->actor.speedXZ = 8.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEATH_ATTACK);
+ this->unk_188 = func_808C66A8;
+}
+
+void func_808C66A8(EnDeath* this, GlobalContext* globalCtx) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x1000, 0x200);
+ Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 3.0f);
+ this->actor.shape.rot.x = (s16)((100.0f - this->actor.xzDistToPlayer) * 0.01f * 1024.0f);
+ this->actor.shape.rot.x = CLAMP_MIN(this->actor.shape.rot.x, 0);
+
+ if (this->unk_2EE > 0) {
+ this->unk_2EE++;
+ if (this->unk_2EE == 3) {
+ func_808C67C8(this);
+ return;
+ }
+ } else if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && this->actor.xzDistToPlayer < 100.0f) {
+ func_8019F1C0(&this->unk_338, 0x3AAC);
+ this->unk_2EE++;
+ this->actor.speedXZ = 0.0f;
+ }
+}
+
+void func_808C67C8(EnDeath* this) {
+ this->skelAnime.animFrameCount = SkelAnime_GetFrameCount(&D_06000E64);
+ this->unk_2EE = 0;
+ this->unk_2EC = -1;
+ this->unk_18C = 1;
+ this->unk_188 = func_808C682C;
+ this->actor.speedXZ = 0.0f;
+}
+
+void func_808C682C(EnDeath* this, GlobalContext* globalCtx) {
+ this->unk_2EE++;
+ if (this->skelAnime.animCurrentFrame > 20.0f) {
+ this->unk_18C = 0;
+ this->unk_788.base.atFlags &= 0xFFFE;
+ Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200);
+ }
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ this->actor.shape.rot.x = 0;
+ func_808C645C(this);
+ }
+}
+
+void func_808C68B8(EnDeath* this) {
+ SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600B508, -3.0f);
+ this->unk_2EC = 0x1F;
+ this->unk_2EE = 0x1E;
+ this->actor.speedXZ = 0.0f;
+ func_808C54F0(this);
+ this->unk_18C = 1;
+ this->unk_190 = -3;
+ this->unk_188 = func_808C692C;
+}
+
+void func_808C692C(EnDeath* this, GlobalContext* globalCtx) {
+ func_808C5394(this);
+
+ this->unk_2EE--;
+ if (this->unk_190 < 7) {
+ this->unk_190++;
+ }
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ if (func_801378B8(&this->skelAnime, 0.0f)) {
+ func_8019F1C0(&this->unk_338, 0x3AAD);
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
+ func_808C54F0(this);
+ if (this->unk_2EE == 0) {
+ if (this->actor.xzDistToPlayer > 200.0f) {
+ func_808C6A08(this);
+ return;
+ }
+ func_808C645C(this);
+ }
+}
+
+void func_808C6A08(EnDeath* this) {
+ if (this->unk_188 != func_808C692C) {
+ SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600B508, -3.0f);
+ this->unk_190 = -3;
+ this->unk_2EE = 0;
+ this->unk_2EC = -1;
+ this->unk_18C = 1;
+ this->actor.speedXZ = 0.0f;
+ } else {
+ this->unk_2EE = 0xA;
+ this->unk_2EC = 9;
+ this->actor.speedXZ = 10.0f;
+ }
+ func_808C54F0(this);
+ this->unk_188 = func_808C6AB0;
+}
+
+void func_808C6AB0(EnDeath* this, GlobalContext* globalCtx) {
+ func_808C5394(this);
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ if (func_801378B8(&this->skelAnime, 0.0f)) {
+ func_8019F1C0(&this->unk_338, 0x3AAD);
+ }
+ if (this->unk_190 < 7) {
+ this->unk_190++;
+ }
+ this->unk_2EE++;
+ if (this->unk_2EE < 10) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
+ } else if (this->unk_2EE == 10) {
+ this->actor.speedXZ = 10.0f;
+ }
+ func_808C54F0(this);
+ Math_ScaledStepToS(&this->unk_2F2, (s32)(Math_SinS(this->unk_2EE * 0x2000) * 2048.0f) + 0x3000, 0x1000);
+ Math_ScaledStepToS(&this->unk_2F4, (s32)(Math_SinS(this->unk_2EE * 0x2000 - 0x8000) * 2048.0f), 0x1000);
+ if ((this->actor.bgCheckFlags & 8) || (this->unk_788.base.atFlags & 2) || (this->unk_860.base.atFlags & 2)) {
+ this->unk_18C = 0;
+ this->unk_788.base.atFlags &= 0xFFFC;
+ this->unk_860.base.atFlags &= 0xFFFD;
+ func_808C645C(this);
+ }
+}
+
+void func_808C6C5C(EnDeath* this) {
+ SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06001F80);
+ this->actor.speedXZ = 10.0f;
+ func_800BE568(&this->actor, &this->unk_808);
+ func_800BCB70(&this->actor, 0x4000, 0xFF, 0, 0xF);
+ Audio_PlayActorSound2(&this->actor, 0x3AB1);
+ this->unk_188 = func_808C6CDC;
+}
+
+void func_808C6CDC(EnDeath* this, GlobalContext* globalCtx) {
+ func_808C5394(this);
+ Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ this->unk_808.base.acFlags |= 1;
+ func_808C6A08(this);
+ }
+}
+
+void func_808C6D40(EnDeath* this, GlobalContext* globalCtx) {
+ Vec3f sp3C;
+ Vec3f sp30;
+ s32 i;
+
+ this->actor.flags &= ~0x1001;
+ SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06002DE8);
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 6;
+ }
+
+ this->unk_18D = 0;
+ this->unk_808.base.acFlags &= 0xFFFE;
+ func_800BCB70(&this->actor, 0x4000, 0xFF, 0, 0x1E);
+ this->unk_2EE = 0x23;
+ this->actor.world.pos.y = this->actor.home.pos.y;
+ this->actor.speedXZ = 0.0f;
+ this->unk_344.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.x;
+ this->unk_344.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.z;
+ this->unk_344.y = this->actor.home.pos.y + 63.0f;
+ sp30.x = this->actor.world.pos.x;
+ sp30.y = this->actor.world.pos.y + 100.0f;
+ sp30.z = this->actor.world.pos.z;
+ sp3C.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.x;
+ sp3C.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.z;
+ sp3C.y = this->actor.home.pos.y + 30.0f;
+ func_8016970C(globalCtx, this->unk_2FA, &sp30, &sp3C);
+ this->unk_30C = Math_Vec3f_DistXYZ(&sp3C, &this->unk_344) * 0.05f;
+ this->actor.shape.rot.y += 0x2000;
+ func_800B724C(globalCtx, &this->actor, 7);
+ Audio_PlayActorSound2(&this->actor, 0x3AB2);
+ this->unk_188 = func_808C6F6C;
+}
+
+void func_808C6F6C(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->unk_2FA);
+ f32 sp28 = Math_Vec3f_StepTo(&camera->eye, &this->unk_344, this->unk_30C);
+
+ func_8016970C(globalCtx, this->unk_2FA, &camera->at, &camera->eye);
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ this->actor.shape.rot.y += 0x2000;
+ SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_0600352C);
+ } else if (this->skelAnime.animCurrentSeg == &D_06002DE8) {
+ this->actor.shape.rot.y += 0x2000;
+ if (this->skelAnime.animCurrentFrame > 3.0f) {
+ SysMatrix_SetCurrentState(&this->unk_6A4);
+ SysMatrix_InsertXRotation_s(-0x1000, 1);
+ SysMatrix_CopyCurrentState(&this->unk_6A4);
+ this->unk_18E = 0;
+ this->unk_6A4.wy += 18.0f;
+ Audio_PlayActorSound2(&this->actor, 0x3AAC);
+ }
+ }
+ if (sp28 < 0.1f) {
+ if (this->unk_2EE == 35) {
+ func_801A479C(&this->unk_338, 0x3AAE, 0x41);
+ }
+ if (this->unk_2EE > 0) {
+ this->unk_2EE--;
+ }
+ if (this->unk_2EE == 0) {
+ func_808C70D8(this, globalCtx);
+ }
+ }
+}
+
+void func_808C70D8(EnDeath* this, GlobalContext* globalCtx) {
+ LightSettings* lightSettings1;
+ LightSettings* lightSettings2;
+ Player* player = PLAYER;
+ Vec3f sp40;
+ Vec3f sp34;
+ f32 sp30;
+ f32 sp2C;
+ s32 i;
+
+ SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_0600352C);
+ this->unk_2EE = 0x1E;
+ player->actor.shape.rot.y = Actor_YawToPoint(&player->actor, &this->actor.home.pos) + 0x1000;
+ this->actor.shape.rot.y = player->actor.shape.rot.y + 0x6000;
+ sp30 = Math_SinS(player->actor.shape.rot.y);
+ sp2C = Math_CosS(player->actor.shape.rot.y);
+ this->actor.world.pos.x = player->actor.world.pos.x + (260.0f * sp30);
+ this->actor.world.pos.z = player->actor.world.pos.z + (260.0f * sp2C);
+ this->actor.world.pos.y = this->actor.home.pos.y + 15.0f;
+ sp40.x = (Math_SinS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.x;
+ sp40.z = (Math_CosS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.z;
+ sp40.y = this->actor.world.pos.y - 13.0f;
+ sp34.x = player->actor.world.pos.x + (120.0f * sp30);
+ sp34.y = player->actor.world.pos.y + 90.0f;
+ sp34.z = player->actor.world.pos.z + (120.0f * sp2C);
+ func_8016970C(globalCtx, this->unk_2FA, &sp34, &sp40);
+
+ lightSettings1 = &globalCtx->envCtx.lightSettingsList[20];
+ lightSettings2 = &globalCtx->envCtx.lightSettingsList[21];
+
+ for (i = 0; i < 3; i++) {
+ lightSettings1->diffuseDir1[i] = lightSettings2->diffuseDir1[i];
+ lightSettings1->diffusePos2[i] = lightSettings2->diffusePos2[i];
+ }
+
+ this->unk_188 = func_808C72AC;
+}
+
+void func_808C72AC(EnDeath* this, GlobalContext* globalCtx) {
+ f32 sin;
+ f32 cos;
+ s16 temp_v1;
+
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+
+ this->unk_2EE--;
+ if (this->unk_2EE >= 0 && this->unk_2EE < 3) {
+ temp_v1 = func_800DFCDC(ACTIVE_CAM) + 0x8000;
+ sin = Math_SinS(temp_v1);
+ cos = Math_CosS(temp_v1);
+ SysMatrix_InsertTranslation(this->actor.world.pos.x + (83.0f * sin) + (-38.0f * cos),
+ this->actor.world.pos.y + 53.0f + 15.0f * this->unk_2EE,
+ this->actor.world.pos.z + (83.0f * cos) - (-38.0f * sin), 0);
+ Matrix_RotateY(temp_v1 - 0x3300, 1);
+ SysMatrix_InsertXRotation_s(0x1100 - this->unk_2EE * 0x1800, 1);
+ SysMatrix_InsertZRotation_s(-0xA00, 1);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, 1);
+ SysMatrix_CopyCurrentState(&this->unk_6A4);
+ if (this->unk_2EE == 0) {
+ func_800DFD04(ACTIVE_CAM, 2, 4, 6);
+ func_8013ECE0(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
+ func_801A7328(&this->unk_338, 0x3AAE);
+ func_8019F1C0(&this->unk_338, 0x3AAF);
+ }
+ }
+ if (this->unk_2EE < -0x19) {
+ globalCtx->envCtx.unk_C3 = 0x14;
+ func_808C74A4(this);
+ }
+}
+
+void func_808C74A4(EnDeath* this) {
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 5;
+ }
+
+ this->unk_2EE = 0;
+ this->unk_188 = func_808C74F8;
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C74F8.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7800.s")
+void func_808C7800(EnDeath* this) {
+ s32 i;
+ for (i = 0; i < ARRAY_COUNT(this->unk_1A9); i++) {
+ this->unk_1A9[i] = 0;
+ }
+
+ Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.focus.pos);
+ this->actor.bgCheckFlags &= 0xFFFE;
+ this->unk_2EE = 0;
+ this->unk_188 = func_808C7888;
+ this->actor.gravity = -1.0f;
+ this->actor.shape.yOffset = 0.0f;
+}
+
+#ifdef NON_MATCHING
+// needs in-function static D_808C9ABC
+void func_808C7888(EnDeath* this, GlobalContext* globalCtx) {
+ Vec3f sp74;
+ s32 i;
+
+ if (this->unk_2EE == 0) {
+ if ((this->actor.bgCheckFlags & 1) || this->actor.floorHeight == -32000.0f) {
+ Actor_SetScale(&this->actor, 0.0f);
+ this->unk_2EE++;
+
+ for (i = 0; i < 40; i++) {
+ D_808C9ABC.y = -0.2f;
+ sp74.x = randPlusMinusPoint5Scaled(4.0f);
+ sp74.y = randPlusMinusPoint5Scaled(4.0f);
+ sp74.z = Rand_ZeroFloat(2.0f) + 3.0f;
+ EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world, &sp74, &D_808C9ABC, &D_808C9AC8,
+ &D_808C9ACC);
+ }
+ Audio_PlayActorSound2(&this->actor, 0x3AB5);
+ }
+ } else {
+ this->unk_2EE++;
+ if (this->unk_2EE == 20) {
+ func_808C7A30(this, globalCtx);
+ }
+ }
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7888.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7A30.s")
+void func_808C7A30(EnDeath* this, GlobalContext* globalCtx) {
+ ActorCutscene_Stop(this->actor.cutscene);
+ func_800B724C(globalCtx, &this->actor, 6);
+ Actor_SetRoomClearedTemp(globalCtx, globalCtx->roomCtx.currRoom.num);
+ this->unk_2EE = 0xFF;
+ globalCtx->envCtx.unk_C3 = 0xFF;
+ this->unk_188 = func_808C7AAC;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7AAC.s")
+void func_808C7AAC(EnDeath* this, GlobalContext* globalCtx) {
+ if (this->unk_2EE > 0) {
+ this->unk_2EE -= 5;
+ if (this->unk_2EE <= 0) {
+ this->unk_2EE = 0;
+ Actor_MarkForDeath(&this->actor);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7AEC.s")
+void func_808C7AEC(EnDeath* this) {
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7B88.s")
+ Audio_PlayActorSound2(&this->actor, 0x3AB0);
+ SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060015B4, 5.0f);
+ this->actor.speedXZ = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7C04.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 3;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7C88.s")
+ this->unk_2EA = 0;
+ this->unk_188 = func_808C7B88;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7CFC.s")
+void func_808C7B88(EnDeath* this, GlobalContext* globalCtx) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
+ Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 5.0f);
+ if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ globalCtx->envCtx.unk_C3 = 0x1B;
+ func_808C7C04(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7D34.s")
+void func_808C7C04(EnDeath* this) {
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7DB8.s")
+ SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001834);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7DCC.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 4;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7E24.s")
+ this->unk_188 = func_808C7C88;
+ this->actor.speedXZ = 0.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7EDC.s")
+void func_808C7C88(EnDeath* this, GlobalContext* globalCtx) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ if (this->actor.params >= 5) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ func_808C645C(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/EnDeath_Update.s")
+void func_808C7CFC(EnDeath* this) {
+ ActorCutscene_SetIntentToPlay(this->actor.cutscene);
+ this->unk_188 = func_808C7D34;
+}
+void func_808C7D34(EnDeath* this, GlobalContext* globalCtx) {
+ if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
+ ActorCutscene_Start(this->actor.cutscene, &this->actor);
+ this->unk_2FA = ActorCutscene_GetCurrentCamera(this->actor.cutscene);
+ if (this->actor.colChkInfo.health == 0) {
+ func_808C6D40(this, globalCtx);
+ } else {
+ func_808C571C(this, globalCtx);
+ }
+ } else {
+ ActorCutscene_SetIntentToPlay(this->actor.cutscene);
+ }
+}
+
+void func_808C7DB8(EnDeath* this) {
+ this->unk_188 = func_808C7DCC;
+}
+
+void func_808C7DCC(EnDeath* this, GlobalContext* globalCtx) {
+ if (func_801690CC(globalCtx) == 0) {
+ func_808C5310(globalCtx);
+ this->unk_808.base.acFlags |= 1;
+ func_801A2E54(0x38);
+ func_808C645C(this);
+ }
+}
+
+void func_808C7E24(EnDeath* this, GlobalContext* globalCtx) {
+ if (this->unk_18D != 0) {
+ this->unk_320.y += this->unk_308;
+ this->unk_308 -= 1.0f;
+ this->unk_2F6 += 0x1800;
+ if (this->unk_320.y < this->actor.floorHeight) {
+ this->unk_320.y = this->actor.floorHeight;
+ func_800B3030(globalCtx, &this->unk_320, &D_801D15B0, &D_801D15B0, 0x64, 0, 0);
+ func_800F0568(globalCtx, &this->unk_320, 0xB, 0x3878);
+ this->unk_18D = 0;
+ }
+ }
+}
+
+void func_808C7EDC(EnDeath* this, GlobalContext* globalCtx) {
+ s32 i;
+
+ if (this->unk_2F8 > 0) {
+ this->unk_2F8--;
+ }
+ if (this->unk_808.base.acFlags & 2) {
+ this->unk_808.base.acFlags &= 0xFFFD;
+
+ if (this->actor.params >= 5) {
+ this->unk_18D = 1;
+ this->unk_308 = -1.0f;
+ this->unk_2F6 = this->actor.shape.rot.y;
+ Math_Vec3s_ToVec3f(&this->unk_320, &this->unk_808.dim.worldSphere.center);
+ func_800F0568(globalCtx, &this->unk_320, 0x1E, 0x3842);
+
+ if (this->actor.colChkInfo.damageEffect == 4 && this->unk_188 != func_808C7B88) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 1;
+ }
+ globalCtx->envCtx.unk_C3 = 0x1C;
+
+ this->unk_2FC = 0x14;
+ if (this->unk_188 == func_808C64DC) {
+ this->unk_2EE = 0x64;
+ }
+ } else if (this->actor.colChkInfo.damageEffect == 0xF) {
+ this->unk_2F8 = 0xA;
+ }
+ } else if (this->actor.colChkInfo.damageEffect != 0xF || this->unk_2F8 == 0) {
+ this->unk_18C = 0;
+ this->unk_788.base.atFlags &= 0xFFFE;
+ this->unk_808.base.acFlags &= 0xFFFE;
+
+ if (this->actor.colChkInfo.damageEffect == 4) {
+ this->unk_31C = 3.0f;
+ this->unk_314 = 0.8f;
+ this->unk_18F = 0x14;
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->unk_808.info.bumper.hitPos.x,
+ this->unk_808.info.bumper.hitPos.y, this->unk_808.info.bumper.hitPos.z, 0, 0, 0, 4);
+ }
+ if (globalCtx->envCtx.unk_C3 == 0x1B) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ }
+ this->actor.shape.rot.x = 0;
+
+ if (func_800BE22C(&this->actor) == 0) {
+ func_800BBA88(globalCtx, &this->actor);
+ func_801A2ED8();
+ func_808C7CFC(this);
+ } else {
+ for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
+ this->unk_6E4[i]->params = 2;
+ }
+
+ func_808C6C5C(this);
+ }
+ }
+ }
+}
+
+void EnDeath_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnDeath* this = THIS;
+ UnkActor* unkActor;
+ s32 pad;
+
+ if (this->unk_2FC > 0) {
+ this->unk_2FC--;
+ unkActor = (UnkActor*)func_ActorCategoryIterateById(globalCtx, NULL, 7, 0x7F);
+ if (unkActor != NULL) {
+ unkActor->unk_15C = -100.0f;
+ }
+ if (this->unk_2FC == 0) {
+ globalCtx->envCtx.unk_C3 = 0x1A;
+ }
+ }
+ func_808C7EDC(this, globalCtx);
+ func_808C7E24(this, globalCtx);
+ if (this->unk_188 != func_808C6AB0) {
+ Math_ScaledStepToS(&this->unk_2F2, 0, 0x800);
+ Math_ScaledStepToS(&this->unk_2F4, 0, 0x800);
+ }
+ this->unk_188(this, globalCtx);
+
+ if (this->unk_188 != func_808C6CDC) {
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ }
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, (this->unk_188 == func_808C6AB0) ? 50.0f : 100.0f, 40.0f,
+ 7);
+
+ this->unk_73C.dim.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * 3.0f;
+ this->unk_73C.dim.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * 3.0f;
+ this->unk_73C.dim.pos.y = this->actor.world.pos.y;
+
+ if (this->actor.params < 5) {
+ this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius + 5;
+ } else {
+ this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius;
+ }
+
+ if (this->unk_188 != func_808C7AAC) {
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_73C.base);
+ }
+ if (this->unk_808.base.acFlags & 1) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_808.base);
+ }
+ if (this->unk_788.base.atFlags & 1) {
+ CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_788.base);
+ }
+ if (this->unk_188 == func_808C692C || this->unk_188 == func_808C6AB0) {
+ CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_860.base);
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_860.base);
+ }
+
+ if (this->unk_31C > 0.0f) {
+ if (this->unk_18F != 0xA) {
+ Math_StepToF(&this->unk_31C, 0.0f, 0.05f);
+ this->unk_314 = (this->unk_31C + 1.0f) * 0.4f;
+
+ this->unk_314 = CLAMP_MAX(this->unk_314, 0.8f);
+
+ return;
+ }
+ if (Math_StepToF(&this->unk_318, 0.8f, 0.02f) == 0) {
+ func_800B9010(&this->actor, 0x20B2);
+ }
+ }
+}
+
+#ifdef NON_MATCHING
+// single reodering, stack
+void func_808C84A4(EnDeath* this, GlobalContext* globalCtx) {
+ Gfx* phi_s0;
+ s32 phi_s2;
+ s32 phi_s3;
+ s32 phi_s4;
+
+ func_800B8118(&this->actor, globalCtx, 0);
+ Scene_SetRenderModeXlu(globalCtx, 1, 2);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ phi_s0 = POLY_XLU_DISP;
+
+ for (phi_s2 = 1, phi_s3 = 0xDC, phi_s4 = 0x2100; phi_s2 < this->unk_190;
+ phi_s2++, phi_s3 -= 0x23, phi_s4 += 0x2100) {
+ gDPPipeSync(phi_s0++);
+ gDPSetEnvColor(phi_s0++, 30, 30, 0, phi_s3);
+
+ SysMatrix_SetCurrentState(&this->unk_6A4);
+ SysMatrix_InsertXRotation_s(phi_s4, 1);
+
+ gSPMatrix(phi_s0++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(phi_s0++, D_06006F88);
+
+ SysMatrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, 1);
+ SysMatrix_InsertRotation(-0x4000, 0, -0x4000, 1);
+
+ gSPMatrix(phi_s0++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(phi_s0++, D_060073D0);
+ }
+ POLY_XLU_DISP = phi_s0;
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C84A4.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C8690.s")
+void func_808C8690(EnDeath* this, GlobalContext* globalCtx) {
+ Gfx* dl;
+ s32 pad;
+
+ if (this->unk_188 == func_808C7AAC) {
+ func_800B8118(&this->actor, globalCtx, 0);
+ Scene_SetRenderModeXlu(globalCtx, 1, 2);
+ }
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ if (this->unk_188 == func_808C7AAC) {
+ dl = POLY_XLU_DISP;
+
+ gDPPipeSync(dl++);
+ gDPSetEnvColor(dl++, 30, 30, 0, this->unk_2EE);
+ } else {
+ dl = POLY_OPA_DISP;
+ }
+
+ SysMatrix_SetCurrentState(&this->unk_6A4);
+ Matrix_Scale(this->unk_304, this->unk_304, this->unk_304, 1);
+
+ gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&dl[1], D_06006F88);
+
+ SysMatrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, 1);
+ SysMatrix_InsertRotation(-0x4000, 0, -0x4000, 1);
+
+ gSPMatrix(&dl[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&dl[3], D_060073D0);
+
+ SysMatrix_GetStateTranslation(&this->unk_32C);
+
+ if (this->unk_188 == func_808C7AAC) {
+ POLY_XLU_DISP = &dl[4];
+ } else {
+ POLY_OPA_DISP = &dl[4];
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C882C.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C8D18.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C9160.s")
+void func_808C9160(EnDeath* this, GlobalContext* globalCtx) {
+ s32 pad;
+ Gfx* dl;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C9220.s")
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+ dl = POLY_OPA_DISP;
+ SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+
+ gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&dl[1], D_06009988);
+
+ if (this->actor.params >= 5) {
+ gSPDisplayList(&dl[2], D_06009BA0);
+ POLY_OPA_DISP = dl + 3;
+ } else {
+ POLY_OPA_DISP = dl + 2;
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+s32 func_808C9220(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
+ EnDeath* this = THIS;
+ f32 temp_f12;
+ s32 temp_v0;
+
+ if (this->unk_193[limbIndex] == 1) {
+ *dList = NULL;
+ } else if (limbIndex == 0xD && this->unk_188 == func_808C74F8) {
+ temp_v0 = this->unk_2EE - 5;
+ if (temp_v0 > 0) {
+ temp_f12 = 1.0f - (temp_v0 * 0.1f);
+ Matrix_Scale(temp_f12, temp_f12, temp_f12, 1);
+ }
+ }
+ if (limbIndex == 0x14 || limbIndex == 0x15) {
+ if (this->unk_18E == 0) {
+ *dList = NULL;
+ }
+ } else if (limbIndex == 0xC) {
+ rot->z = rot->z + this->unk_2F2;
+ } else if (limbIndex == 0xD) {
+ rot->z = rot->z + this->unk_2F4;
+ }
+ return 0;
+}
+
+#ifdef NON_MATCHING
+// A lot towards the bottom, original wants to mult but mine optimizes to shifts
+void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
+ EnDeath* this = THIS;
+ Vec3f sp6C;
+ Vec3f sp60;
+ Vec3f sp54;
+ Vec3f sp48;
+ s32 sp44;
+ f32 temp_f0;
+ s32 temp_s0;
+ s32 temp_v0_2;
+ s8 temp_v1;
+ s32 phi_v0;
+ Vec3f* phi_s1;
+ Vec3f* phi_s0;
+
+ if (limbIndex == 0x15) {
+ SysMatrix_GetStateTranslation(&this->unk_32C);
+ if ((this->unk_788.base.atFlags & 1) && this->unk_2EC != this->unk_2EE) {
+ Math_Vec3f_Copy(&sp6C, &this->unk_788.dim);
+ Math_Vec3f_Copy(&sp60, &this->unk_788.dim.quad[1]);
+ if (this->unk_188 == func_808C682C) {
+ SysMatrix_GetStateTranslationAndScaledX(6000.0f, &sp54);
+ SysMatrix_MultiplyVector3fByState(&D_808C9AF4, &sp48);
+ } else {
+ SysMatrix_GetStateTranslationAndScaledY(5000.0f, &sp48);
+ SysMatrix_MultiplyVector3fByState(&D_808C9B00, &sp54);
+ }
+ Collider_SetQuadVertices(&this->unk_788, &sp48, &sp54, &sp6C, &sp60);
+ func_800A81F0(Effect_GetParams(this->unk_300), &sp54, &sp48);
+ this->unk_2EC = this->unk_2EE;
+ } else if (this->unk_18C != 0) {
+ if (this->unk_188 == func_808C682C) {
+ SysMatrix_GetStateTranslationAndScaledX(6000.0f, &this->unk_788.dim.quad[1]);
+ SysMatrix_MultiplyVector3fByState(&D_808C9AF4, &this->unk_788.dim);
+ } else {
+ SysMatrix_GetStateTranslationAndScaledY(5000.0f, &this->unk_788.dim);
+ SysMatrix_MultiplyVector3fByState(&D_808C9B00, &this->unk_788.dim.quad[1]);
+ }
+ this->unk_18C = 0;
+ this->unk_788.base.atFlags |= 1;
+ this->unk_2EC = this->unk_2EE;
+ }
+ } else if (limbIndex == 2 && this->unk_188 != func_808C7AAC) {
+ SysMatrix_StatePush();
+ func_808C9160(this, globalCtx);
+ SysMatrix_StatePop();
+ SysMatrix_GetStateTranslation(&this->actor.focus);
+ this->unk_808.dim.worldSphere.center.x = this->actor.focus.pos.x;
+ this->unk_808.dim.worldSphere.center.y = this->actor.focus.pos.y;
+ this->unk_808.dim.worldSphere.center.z = this->actor.focus.pos.z;
+ if (this->actor.params < 5) {
+ this->unk_808.dim.worldSphere.center.y = this->actor.focus.pos.y + 5.0f;
+ }
+ } else if (limbIndex == 0x14) {
+ if (!(this->unk_188 != func_808C6AB0 && this->unk_188 != func_808C692C && this->unk_188 != func_808C6070) ||
+ (this->unk_188 == func_808C6F6C && this->unk_18E == 1)) {
+ SysMatrix_CopyCurrentState(&this->unk_6A4);
+ }
+ }
+ temp_v1 = D_808C9B48[limbIndex];
+ if (temp_v1 != -1) {
+ if (temp_v1 < 7) {
+ SysMatrix_GetStateTranslation(&this->unk_35C[temp_v1]);
+ return;
+ }
+ if (temp_v1 == 7) {
+ for (phi_v0 = 0; phi_v0 != 5; phi_v0++) {
+ SysMatrix_MultiplyVector3fByState(&D_808C9B0C[phi_v0], &this->unk_35C[phi_v0 + temp_v1]);
+ }
+ return;
+ }
+ if (temp_v1 == 0xC) {
+ SysMatrix_GetStateTranslation(&this->unk_35C[temp_v1]);
+ SysMatrix_GetStateTranslationAndScaledY(-2000.0f, &this->unk_35C[temp_v1 + 1]);
+ }
+ }
+}
+#else
+void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C9340.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/EnDeath_Draw.s")
+void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnDeath* this = THIS;
+ s32 pad;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+ func_800B8050(&this->actor, globalCtx, 0);
+ AnimatedMat_DrawStepOpa(globalCtx, this->unk_734, this->unk_191);
+ AnimatedMat_DrawOpa(globalCtx, this->unk_738);
+ Scene_SetRenderModeXlu(globalCtx, 0, 1);
+
+ gDPSetEnvColor(POLY_OPA_DISP++, 30, 30, 0, 255);
+
+ if (this->unk_188 != func_808C7AAC && this->unk_188 != func_808C7888) {
+ SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_808C9220, func_808C9340, this);
+ }
+ if (this->unk_188 == func_808C7888) {
+ func_808C9160(this, globalCtx);
+ }
+ if (this->unk_18E == 0) {
+ func_808C8690(this, globalCtx);
+ }
+ if (this->actor.colorFilterTimer != 0) {
+ func_800AE5A0(globalCtx);
+ }
+ func_800BE680(globalCtx, &this->actor, this->unk_35C, 0xE, this->unk_314, this->unk_318, this->unk_31C, this->unk_18F);
+ if (this->unk_188 == func_808C6AB0 || this->unk_188 == func_808C692C) {
+ func_808C84A4(this, globalCtx);
+ }
+ func_808C882C(this, globalCtx);
+ if (this->unk_188 == func_808C7AAC || this->unk_188 == func_808C7888 ||
+ (this->unk_188 == func_808C74F8 && this->unk_2EE > 0)) {
+ func_808C8D18(this, globalCtx);
+ }
+ SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->projectionMatrix, &this->unk_32C, &this->unk_338);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.h b/src/overlays/actors/ovl_En_Death/z_en_death.h
index bb06108ed..646cc0791 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.h
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.h
@@ -8,10 +8,56 @@ struct EnDeath;
typedef void (*EnDeathActionFunc)(struct EnDeath* this, GlobalContext* globalCtx);
typedef struct EnDeath {
- /* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x44];
- /* 0x0188 */ EnDeathActionFunc actionFunc;
- /* 0x018C */ char unk_18C[0x7AC];
+ /* 0x000 */ Actor actor;
+ /* 0x144 */ SkelAnime skelAnime;
+ /* 0x188 */ EnDeathActionFunc unk_188;
+ /* 0x18C */ u8 unk_18C;
+ /* 0x18D */ u8 unk_18D;
+ /* 0x18E */ u8 unk_18E;
+ /* 0x18F */ u8 unk_18F;
+ /* 0x190 */ s8 unk_190;
+ /* 0x191 */ u8 unk_191;
+ /* 0x192 */ u8 unk_192;
+ /* 0x193 */ char unk_193[0x16];
+ /* 0x1A9 */ u8 unk_1A9[56];
+ /* 0x1E1 */ char unk_1E1[1]; // likely padding
+ /* 0x1E2 */ Vec3s unk_1E2[22];
+ /* 0x266 */ Vec3s unk_266[22];
+ /* 0x2EA */ s16 unk_2EA;
+ /* 0x2EC */ s16 unk_2EC;
+ /* 0x2EE */ s16 unk_2EE;
+ /* 0x2F0 */ char unk_2F0[0x2];
+ /* 0x2F2 */ s16 unk_2F2;
+ /* 0x2F4 */ s16 unk_2F4;
+ /* 0x2F6 */ s16 unk_2F6;
+ /* 0x2F8 */ s16 unk_2F8;
+ /* 0x2FA */ s16 unk_2FA;
+ /* 0x2FC */ s16 unk_2FC;
+ /* 0x2FE */ char unk_2FE[0x2];
+ /* 0x300 */ s32 unk_300; // effectIdx
+ /* 0x304 */ f32 unk_304;
+ /* 0x308 */ f32 unk_308;
+ /* 0x30C */ f32 unk_30C;
+ /* 0x310 */ f32 unk_310;
+ /* 0x314 */ f32 unk_314;
+ /* 0x318 */ f32 unk_318;
+ /* 0x31C */ f32 unk_31C;
+ /* 0x320 */ Vec3f unk_320;
+ /* 0x32C */ Vec3f unk_32C;
+ /* 0x338 */ Vec3f unk_338;
+ /* 0x344 */ Vec3f unk_344;
+ /* 0x350 */ Vec3f unk_350;
+ /* 0x35C */ Vec3f unk_35C[2]; // TODO size
+ /* 0x374 */ char unk_374[0x330];
+ /* 0x6A4 */ MtxF unk_6A4;
+ /* 0x6E4 */ Actor* unk_6E4[20];
+ /* 0x734 */ AnimatedMaterial* unk_734;
+ /* 0x738 */ AnimatedMaterial* unk_738;
+ /* 0x73C */ ColliderCylinder unk_73C;
+ /* 0x788 */ ColliderQuad unk_788;
+ /* 0x808 */ ColliderSphere unk_808;
+ /* 0x860 */ ColliderTris unk_860;
+ /* 0x880 */ ColliderTrisElement unk_880[2];
} EnDeath; // size = 0x938
extern const ActorInit En_Death_InitVars;
From f8ae0409d4ebb2228d7f1138b79c4b835187c73f Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Sun, 22 May 2022 21:55:17 +0100
Subject: [PATCH 02/51] Fix merge
---
src/overlays/actors/ovl_En_Death/z_en_death.c | 44 ++++++++++---------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c
index 8281485b6..5a2d21161 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.c
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.c
@@ -68,7 +68,7 @@ const ActorInit En_Death_InitVars = {
// static ColliderSphereInit sSphereInit = {
static ColliderSphereInit D_808C98E0 = {
- { COLTYPE_HIT3, AT_NONE, AC_NONE | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_1, COLSHAPE_SPHERE, },
+ { COLTYPE_HIT3, AT_NONE, AC_NONE | AC_TYPE_GET_PLAYER(globalCtx), OC1_NONE, OC2_TYPE_1, COLSHAPE_SPHERE, },
{ ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
{ 1, { { 0, 0, 0 }, 22 }, 100 },
};
@@ -94,7 +94,7 @@ static ColliderTrisElementInit D_808C9938[2] = {
// static ColliderTrisInit sTrisInit = {
static ColliderTrisInit D_808C99B0 = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_1, COLSHAPE_TRIS, },
+ { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_GET_PLAYER(globalCtx), OC1_NONE, OC2_TYPE_1, COLSHAPE_TRIS, },
2, D_808C9938, // sTrisElementsInit,
};
@@ -168,8 +168,8 @@ extern Vec3f D_808C9B00;
extern Vec3f D_808C9B0C[];
extern s8 D_808C9B48[];
extern Vec3f D_808C9ABC;
-extern Vec3f D_808C9AC8;
-extern Vec3f D_808C9ACC;
+extern Color_RGBA8 D_808C9AC8;
+extern Color_RGBA8 D_808C9ACC;
extern FlexSkeletonHeader D_0600AD08;
extern AnimationHeader D_06003CAC;
@@ -348,11 +348,12 @@ f32 func_808C566C(EnDeath* this) {
this->unk_2F6 += (s16)(65536.0f * (22.5f / (this->unk_308 * (2 * M_PI))));
}
#else
+f32 func_808C566C(EnDeath* this);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C566C.s")
#endif
void func_808C571C(EnDeath* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
Vec3f sp24;
@@ -374,7 +375,7 @@ void func_808C571C(EnDeath* this, GlobalContext* globalCtx) {
}
void func_808C589C(EnDeath* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
player->actor.world.pos.x = Math_SinS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.x;
player->actor.world.pos.z = Math_CosS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.z;
@@ -823,7 +824,7 @@ void func_808C6F6C(EnDeath* this, GlobalContext* globalCtx) {
void func_808C70D8(EnDeath* this, GlobalContext* globalCtx) {
LightSettings* lightSettings1;
LightSettings* lightSettings2;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp40;
Vec3f sp34;
f32 sp30;
@@ -867,7 +868,7 @@ void func_808C72AC(EnDeath* this, GlobalContext* globalCtx) {
this->unk_2EE--;
if (this->unk_2EE >= 0 && this->unk_2EE < 3) {
- temp_v1 = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000;
+ temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
sin = Math_SinS(temp_v1);
cos = Math_CosS(temp_v1);
Matrix_InsertTranslation(this->actor.world.pos.x + (83.0f * sin) + (-38.0f * cos),
@@ -879,7 +880,7 @@ void func_808C72AC(EnDeath* this, GlobalContext* globalCtx) {
Matrix_Scale(0.01f, 0.01f, 0.01f, 1);
Matrix_CopyCurrentState(&this->unk_6A4);
if (this->unk_2EE == 0) {
- func_800DFD04(ACTIVE_CAM, 2, 4, 6);
+ func_800DFD04(GET_ACTIVE_CAM(globalCtx), 2, 4, 6);
func_8013ECE0(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
func_801A7328(&this->unk_338, 0x3AAE);
Audio_PlaySfxAtPos(&this->unk_338, 0x3AAF);
@@ -935,7 +936,7 @@ void func_808C7888(EnDeath* this, GlobalContext* globalCtx) {
sp74.x = randPlusMinusPoint5Scaled(4.0f);
sp74.y = randPlusMinusPoint5Scaled(4.0f);
sp74.z = Rand_ZeroFloat(2.0f) + 3.0f;
- EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world, &sp74, &D_808C9ABC, &D_808C9AC8,
+ EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world.pos, &sp74, &D_808C9ABC, &D_808C9AC8,
&D_808C9ACC);
}
Actor_PlaySfxAtPos(&this->actor, 0x3AB5);
@@ -1056,7 +1057,7 @@ void func_808C7E24(EnDeath* this, GlobalContext* globalCtx) {
if (this->unk_320.y < this->actor.floorHeight) {
this->unk_320.y = this->actor.floorHeight;
func_800B3030(globalCtx, &this->unk_320, &gZeroVec3f, &gZeroVec3f, 0x64, 0, 0);
- func_800F0568(globalCtx, &this->unk_320, 0xB, 0x3878);
+ SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->unk_320, 0xB, 0x3878);
this->unk_18D = 0;
}
}
@@ -1076,7 +1077,7 @@ void func_808C7EDC(EnDeath* this, GlobalContext* globalCtx) {
this->unk_308 = -1.0f;
this->unk_2F6 = this->actor.shape.rot.y;
Math_Vec3s_ToVec3f(&this->unk_320, &this->unk_808.dim.worldSphere.center);
- func_800F0568(globalCtx, &this->unk_320, 0x1E, 0x3842);
+ SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->unk_320, 0x1E, 0x3842);
if (this->actor.colChkInfo.damageEffect == 4 && this->unk_188 != func_808C7B88) {
for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
@@ -1230,6 +1231,7 @@ void func_808C84A4(EnDeath* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
#else
+void func_808C84A4(EnDeath* this, GlobalContext* globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C84A4.s")
#endif
@@ -1276,8 +1278,10 @@ void func_808C8690(EnDeath* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
+void func_808C882C(EnDeath* this, GlobalContext* globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C882C.s")
+void func_808C8D18(EnDeath* this, GlobalContext* globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C8D18.s")
void func_808C9160(EnDeath* this, GlobalContext* globalCtx) {
@@ -1302,7 +1306,7 @@ void func_808C9160(EnDeath* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-s32 func_808C9220(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
+s32 func_808C9220(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnDeath* this = THIS;
f32 temp_f12;
s32 temp_v0;
@@ -1330,7 +1334,7 @@ s32 func_808C9220(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
#ifdef NON_MATCHING
// A lot towards the bottom, original wants to mult but mine optimizes to shifts
-void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
+void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnDeath* this = THIS;
Vec3f sp6C;
Vec3f sp60;
@@ -1348,7 +1352,7 @@ void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (limbIndex == 0x15) {
Matrix_GetStateTranslation(&this->unk_32C);
if ((this->unk_788.base.atFlags & 1) && this->unk_2EC != this->unk_2EE) {
- Math_Vec3f_Copy(&sp6C, &this->unk_788.dim);
+ Math_Vec3f_Copy(&sp6C, &this->unk_788.dim.quad[0]);
Math_Vec3f_Copy(&sp60, &this->unk_788.dim.quad[1]);
if (this->unk_188 == func_808C682C) {
Matrix_GetStateTranslationAndScaledX(6000.0f, &sp54);
@@ -1363,9 +1367,9 @@ void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
} else if (this->unk_18C != 0) {
if (this->unk_188 == func_808C682C) {
Matrix_GetStateTranslationAndScaledX(6000.0f, &this->unk_788.dim.quad[1]);
- Matrix_MultiplyVector3fByState(&D_808C9AF4, &this->unk_788.dim);
+ Matrix_MultiplyVector3fByState(&D_808C9AF4, &this->unk_788.dim.quad[0]);
} else {
- Matrix_GetStateTranslationAndScaledY(5000.0f, &this->unk_788.dim);
+ Matrix_GetStateTranslationAndScaledY(5000.0f, &this->unk_788.dim.quad[0]);
Matrix_MultiplyVector3fByState(&D_808C9B00, &this->unk_788.dim.quad[1]);
}
this->unk_18C = 0;
@@ -1376,7 +1380,7 @@ void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Matrix_StatePush();
func_808C9160(this, globalCtx);
Matrix_StatePop();
- Matrix_GetStateTranslation(&this->actor.focus);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
this->unk_808.dim.worldSphere.center.x = this->actor.focus.pos.x;
this->unk_808.dim.worldSphere.center.y = this->actor.focus.pos.y;
this->unk_808.dim.worldSphere.center.z = this->actor.focus.pos.z;
@@ -1408,7 +1412,7 @@ void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
}
#else
-void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
+void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C9340.s")
#endif
@@ -1428,7 +1432,7 @@ void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (this->unk_188 != func_808C7AAC && this->unk_188 != func_808C7888) {
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
- func_808C9220, func_808C9340, this);
+ func_808C9220, func_808C9340, &this->actor);
}
if (this->unk_188 == func_808C7888) {
func_808C9160(this, globalCtx);
From 78eeb3ffe832da80abc75c6976c228398d724e2a Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Sat, 25 Jun 2022 23:09:57 +0100
Subject: [PATCH 03/51] Matched
---
assets/xml/objects/object_death.xml | 98 +-
spec | 7 +-
src/overlays/actors/ovl_En_Death/z_en_death.c | 1859 ++++++++++-------
src/overlays/actors/ovl_En_Death/z_en_death.h | 68 +-
.../actors/ovl_En_Minideath/z_en_minideath.c | 884 +++++++-
.../actors/ovl_En_Minideath/z_en_minideath.h | 39 +-
tools/disasm/functions.txt | 4 +-
7 files changed, 2009 insertions(+), 950 deletions(-)
diff --git a/assets/xml/objects/object_death.xml b/assets/xml/objects/object_death.xml
index 7d3e1e596..00a0bdd49 100644
--- a/assets/xml/objects/object_death.xml
+++ b/assets/xml/objects/object_death.xml
@@ -1,12 +1,12 @@

-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -39,47 +39,47 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spec b/spec
index a2d9a9ef3..f5071e60a 100644
--- a/spec
+++ b/spec
@@ -1093,17 +1093,14 @@ beginseg
name "ovl_En_Death"
compress
include "build/src/overlays/actors/ovl_En_Death/z_en_death.o"
- include "build/data/ovl_En_Death/ovl_En_Death.data.o"
- include "build/data/ovl_En_Death/ovl_En_Death.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Death/ovl_En_Death_reloc.o"
endseg
beginseg
name "ovl_En_Minideath"
compress
include "build/src/overlays/actors/ovl_En_Minideath/z_en_minideath.o"
- include "build/data/ovl_En_Minideath/ovl_En_Minideath.data.o"
- include "build/data/ovl_En_Minideath/ovl_En_Minideath.bss.o"
- include "build/data/ovl_En_Minideath/ovl_En_Minideath.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Minideath/ovl_En_Minideath_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c
index 5a2d21161..bb3d8e0c3 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.c
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.c
@@ -5,6 +5,8 @@
*/
#include "z_en_death.h"
+#include "overlays/actors/ovl_Arrow_Light/z_arrow_light.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_1000)
@@ -15,45 +17,45 @@ void EnDeath_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDeath_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx);
-void func_808C589C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C5AB8(EnDeath* this, GlobalContext* globalCtx);
-void func_808C5CB4(EnDeath* this, GlobalContext* globalCtx);
-void func_808C5E90(EnDeath* this, GlobalContext* globalCtx);
-void func_808C6070(EnDeath* this, GlobalContext* globalCtx);
-void func_808C64DC(EnDeath* this, GlobalContext* globalCtx);
-void func_808C66A8(EnDeath* this, GlobalContext* globalCtx);
-void func_808C682C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C692C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C6AB0(EnDeath* this, GlobalContext* globalCtx);
-void func_808C6CDC(EnDeath* this, GlobalContext* globalCtx);
-void func_808C6F6C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C72AC(EnDeath* this, GlobalContext* globalCtx);
-void func_808C74F8(EnDeath* this, GlobalContext* globalCtx);
-void func_808C7888(EnDeath* this, GlobalContext* globalCtx);
-void func_808C7AAC(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_IntroCutscenePart1(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_IntroCutscenePart2(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_IntroCutscenePart3(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_IntroCutscenePart4(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_IntroCutscenePart5(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_ApproachPlayer(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SwingAttack(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_EndSwingAttack(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_BlockProjectile(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SpinAttack(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_Damaged(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_DeathCutscenePart1(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_DeathCutscenePart2(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_DeathCutscenePart3(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_DeathCutscenePart4(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_Dead(EnDeath* this, GlobalContext* globalCtx);
void func_808C7B88(EnDeath* this, GlobalContext* globalCtx);
void func_808C7C88(EnDeath* this, GlobalContext* globalCtx);
-void func_808C7D34(EnDeath* this, GlobalContext* globalCtx);
-void func_808C7DCC(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_PlayCutscene(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_BeginWithoutCutscene(EnDeath* this, GlobalContext* globalCtx);
-void func_808C597C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C5C0C(EnDeath* this);
-void func_808C5D6C(EnDeath* this, GlobalContext* globalCtx);
-void func_808C5F58(EnDeath* this, GlobalContext* globalCtx);
-void func_808C645C(EnDeath* this);
-void func_808C6620(EnDeath* this);
-void func_808C67C8(EnDeath* this);
-void func_808C68B8(EnDeath* this);
-void func_808C6A08(EnDeath* this);
-void func_808C70D8(EnDeath* this, GlobalContext* globalCtx);
-void func_808C74A4(EnDeath* this);
-void func_808C7A30(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SetupIntroCutscenePart2(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SetupIntroCutscenePart3(EnDeath* this);
+void EnDeath_SetupIntroCutscenePart4(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SetupIntroCutscenePart5(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SetupApproachPlayer(EnDeath* this);
+void EnDeath_SetupSwingAttack(EnDeath* this);
+void EnDeath_SetupEndSwingAttack(EnDeath* this);
+void EnDeath_SetupBlockProjectile(EnDeath* this);
+void EnDeath_SetupSpinAttack(EnDeath* this);
+void EnDeath_SetupDeathCutscenePart2(EnDeath* this, GlobalContext* globalCtx);
+void EnDeath_SetupDeathCutscenePart3(EnDeath* this);
+void EnDeath_SetupDead(EnDeath* this, GlobalContext* globalCtx);
void func_808C7AEC(EnDeath* this);
void func_808C7C04(EnDeath* this);
-void func_808C7CFC(EnDeath* this);
-void func_808C7DB8(EnDeath* this);
+void EnDeath_SetupPlayCutscene(EnDeath* this);
+void EnDeath_SetupBeginWithoutCutscene(EnDeath* this);
+void EnDeath_SetupDeathCutscenePart4(EnDeath* this);
-#if 0
const ActorInit En_Death_InitVars = {
ACTOR_EN_DEATH,
ACTORCAT_ENEMY,
@@ -68,82 +70,159 @@ const ActorInit En_Death_InitVars = {
// static ColliderSphereInit sSphereInit = {
static ColliderSphereInit D_808C98E0 = {
- { COLTYPE_HIT3, AT_NONE, AC_NONE | AC_TYPE_GET_PLAYER(globalCtx), OC1_NONE, OC2_TYPE_1, COLSHAPE_SPHERE, },
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
+ {
+ COLTYPE_HIT3,
+ AT_NONE,
+ AC_NONE | AC_TYPE_PLAYER,
+ OC1_NONE,
+ OC2_TYPE_1,
+ COLSHAPE_SPHERE,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_NONE,
+ },
{ 1, { { 0, 0, 0 }, 22 }, 100 },
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_808C990C = {
- { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_NONE,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
{ 35, 90, 20, { 0, 0, 0 } },
};
// static ColliderTrisElementInit sTrisElementsInit[2] = {
static ColliderTrisElementInit D_808C9938[2] = {
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x04, 0x20 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x04, 0x20 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_NONE,
+ },
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x04, 0x20 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x04, 0x20 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_NONE,
+ },
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
},
};
// static ColliderTrisInit sTrisInit = {
static ColliderTrisInit D_808C99B0 = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_GET_PLAYER(globalCtx), OC1_NONE, OC2_TYPE_1, COLSHAPE_TRIS, },
- 2, D_808C9938, // sTrisElementsInit,
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_NONE,
+ OC2_TYPE_1,
+ COLSHAPE_TRIS,
+ },
+ 2,
+ D_808C9938, // sTrisElementsInit,
};
// static ColliderQuadInit sQuadInit = {
static ColliderQuadInit D_808C99C0 = {
- { COLTYPE_NONE, AT_NONE | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_TYPE_2, COLSHAPE_QUAD, },
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x20 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, BUMP_NONE, OCELEM_NONE, },
+ {
+ COLTYPE_NONE,
+ AT_NONE | AT_TYPE_ENEMY,
+ AC_NONE,
+ OC1_NONE,
+ OC2_TYPE_2,
+ COLSHAPE_QUAD,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x04, 0x20 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7,
+ BUMP_NONE,
+ OCELEM_NONE,
+ },
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
+typedef enum {
+ DMGEFF_NONE = 0,
+ DMGEFF_FIRE_ARROW = 2,
+ DMGEFF_ICE_ARROW = 3,
+ DMGEFF_LIGHT_ARROW = 4,
+ DMGEFF_EXPLOSIVES = 15
+} EnDeathDamageEffect;
+
// static DamageTable sDamageTable = {
static DamageTable D_808C9A10 = {
- /* Deku Nut */ DMG_ENTRY(0, 0x0),
- /* Deku Stick */ DMG_ENTRY(1, 0x0),
- /* Horse trample */ DMG_ENTRY(0, 0x0),
- /* Explosives */ DMG_ENTRY(1, 0xF),
- /* Zora boomerang */ DMG_ENTRY(1, 0x0),
- /* Normal arrow */ DMG_ENTRY(1, 0x0),
- /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
- /* Hookshot */ DMG_ENTRY(1, 0x0),
- /* Goron punch */ DMG_ENTRY(1, 0x0),
- /* Sword */ DMG_ENTRY(1, 0x0),
- /* Goron pound */ DMG_ENTRY(0, 0x0),
- /* Fire arrow */ DMG_ENTRY(1, 0x2),
- /* Ice arrow */ DMG_ENTRY(1, 0x3),
- /* Light arrow */ DMG_ENTRY(2, 0x4),
- /* Goron spikes */ DMG_ENTRY(1, 0x0),
- /* Deku spin */ DMG_ENTRY(0, 0x0),
- /* Deku bubble */ DMG_ENTRY(1, 0x0),
- /* Deku launch */ DMG_ENTRY(2, 0x0),
- /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
- /* Zora barrier */ DMG_ENTRY(0, 0x0),
- /* Normal shield */ DMG_ENTRY(0, 0x0),
- /* Light ray */ DMG_ENTRY(0, 0x0),
- /* Thrown object */ DMG_ENTRY(1, 0x0),
- /* Zora punch */ DMG_ENTRY(1, 0x0),
- /* Spin attack */ DMG_ENTRY(1, 0x0),
- /* Sword beam */ DMG_ENTRY(0, 0x0),
- /* Normal Roll */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
- /* Unblockable */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
- /* Powder Keg */ DMG_ENTRY(1, 0xF),
+ /* Deku Nut */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Deku Stick */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Horse trample */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Explosives */ DMG_ENTRY(1, DMGEFF_EXPLOSIVES),
+ /* Zora boomerang */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Normal arrow */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* UNK_DMG_0x06 */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Hookshot */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Goron punch */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Sword */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Goron pound */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Fire arrow */ DMG_ENTRY(1, DMGEFF_FIRE_ARROW),
+ /* Ice arrow */ DMG_ENTRY(1, DMGEFF_ICE_ARROW),
+ /* Light arrow */ DMG_ENTRY(2, DMGEFF_LIGHT_ARROW),
+ /* Goron spikes */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Deku spin */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Deku bubble */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Deku launch */ DMG_ENTRY(2, DMGEFF_NONE),
+ /* UNK_DMG_0x12 */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Zora barrier */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Normal shield */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Light ray */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Thrown object */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Zora punch */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Spin attack */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Sword beam */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Normal Roll */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1B */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1C */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Unblockable */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1E */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Powder Keg */ DMG_ENTRY(1, DMGEFF_EXPLOSIVES),
};
// sColChkInfoInit
static CollisionCheckInfoInit2 D_808C9A30 = { 20, 28, 90, 20, 100 };
+static EffectBlureInit2 D_808C9A3C = {
+ 0, 8, 0, { 100, 50, 100, 200 }, { 100, 0, 0, 64 }, { 100, 0, 0, 20 }, { 50, 0, 0, 0 }, 8,
+ 0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
+};
+
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_808C9A60[] = {
ICHAIN_VEC3F(scale, 0, ICHAIN_CONTINUE),
@@ -152,129 +231,86 @@ static InitChainEntry D_808C9A60[] = {
ICHAIN_U8(targetMode, 5, ICHAIN_STOP),
};
-#endif
-
-extern ColliderSphereInit D_808C98E0;
-extern ColliderCylinderInit D_808C990C;
-extern ColliderTrisElementInit D_808C9938[2];
-extern ColliderTrisInit D_808C99B0;
-extern ColliderQuadInit D_808C99C0;
-extern DamageTable D_808C9A10;
-extern CollisionCheckInfoInit2 D_808C9A30;
-extern InitChainEntry D_808C9A60[];
-extern UNK_TYPE D_808C9A3C;
-extern Vec3f D_808C9AF4;
-extern Vec3f D_808C9B00;
-extern Vec3f D_808C9B0C[];
-extern s8 D_808C9B48[];
-extern Vec3f D_808C9ABC;
-extern Color_RGBA8 D_808C9AC8;
-extern Color_RGBA8 D_808C9ACC;
-
-extern FlexSkeletonHeader D_0600AD08;
-extern AnimationHeader D_06003CAC;
-extern AnimationHeader D_0600CB2C;
-extern AnimationHeader D_0600B284;
-extern AnimationHeader D_0600B284;
-extern AnimationHeader D_0600B508;
-extern AnimationHeader D_06001F80;
-extern AnimationHeader D_06000E64;
-extern AnimationHeader D_06002DE8;
-extern AnimationHeader D_0600352C;
-extern AnimationHeader D_06001834;
-extern AnimationHeader D_060015B4;
-extern AnimatedMaterial D_0600CBC0;
-extern AnimatedMaterial D_0600CB84;
-extern Gfx D_06009988[];
-extern Gfx D_06009BA0[];
-extern Gfx D_06006F88[];
-extern Gfx D_060073D0[];
-
-typedef struct {
- Actor actor;
- char unk_144[0x18];
- f32 unk_15C;
-} UnkActor;
-
void EnDeath_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDeath* this = THIS;
GlobalContext* globalCtx2 = globalCtx;
-
- f32 phi_f20 = 15.0f;
- s16 phi_s3 = 0;
-
+ f32 yOffset = 15.0f;
+ s16 yRot = 0;
s32 i;
Actor_ProcessInitChain(&this->actor, D_808C9A60);
ActorShape_Init(&this->actor.shape, 5500.0f, ActorShadow_DrawCircle, 80.0f);
- SkelAnime_InitFlex(globalCtx2, &this->skelAnime, &D_0600AD08, &D_06003CAC, this->unk_1E2, this->unk_266, 22);
+ SkelAnime_InitFlex(globalCtx2, &this->skelAnime, &gGomessSkel, &gGomessFloatAnim, this->jointTable,
+ this->morphTable, GOMESS_LIMB_MAX);
- Collider_InitAndSetSphere(globalCtx2, &this->unk_808, &this->actor, &D_808C98E0);
- Collider_InitAndSetCylinder(globalCtx2, &this->unk_73C, &this->actor, &D_808C990C);
+ Collider_InitAndSetSphere(globalCtx2, &this->coreCollider, &this->actor, &D_808C98E0);
+ Collider_InitAndSetCylinder(globalCtx2, &this->bodyCollider, &this->actor, &D_808C990C);
Collider_InitAndSetQuad(globalCtx2, &this->unk_788, &this->actor, &D_808C99C0);
Collider_InitAndSetTris(globalCtx2, &this->unk_860, &this->actor, &D_808C99B0, this->unk_880);
- this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius;
+ this->coreCollider.dim.worldSphere.radius = this->coreCollider.dim.modelSphere.radius;
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_808C9A10, &D_808C9A30);
- Effect_Add(globalCtx2, &this->unk_300, 2, 0, 0, &D_808C9A3C);
+ Effect_Add(globalCtx2, &this->effectIndex, EFFECT_BLURE2, 0, 0, &D_808C9A3C);
if (!(gSaveContext.eventInf[6] & 8)) {
this->actor.world.pos.y += 400.0f;
}
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i] = Actor_SpawnAsChild(&globalCtx2->actorCtx, &this->actor, globalCtx2, ACTOR_EN_MINIDEATH,
- this->actor.world.pos.x, this->actor.world.pos.y + phi_f20,
- this->actor.world.pos.z, 0, phi_s3, 0, i);
- if (this->unk_6E4[i] == NULL) {
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i] = (EnMinideath*)Actor_SpawnAsChild(
+ &globalCtx2->actorCtx, &this->actor, globalCtx2, ACTOR_EN_MINIDEATH, this->actor.world.pos.x,
+ this->actor.world.pos.y + yOffset, this->actor.world.pos.z, 0, yRot, 0, i);
+ if (this->miniDeaths[i] == NULL) {
Actor_MarkForDeath(&this->actor);
}
- phi_s3 += 0x3A00;
- phi_f20 += 4.0f;
+ yRot += 0x3A00;
+ yOffset += 4.0f;
}
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4) - 1; i++) {
- this->unk_6E4[i]->child = this->unk_6E4[i + 1];
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths) - 1; i++) {
+ this->miniDeaths[i]->actor.child = &this->miniDeaths[i + 1]->actor;
}
- this->unk_734 = Lib_SegmentedToVirtual(&D_0600CBC0);
- this->unk_738 = Lib_SegmentedToVirtual(&D_0600CB84);
+ this->bodyMatAnim = Lib_SegmentedToVirtual(&gGomessBodyMatAnim);
+ this->coreMatAnim = Lib_SegmentedToVirtual(&gGomessCoreMatAnim);
if (gSaveContext.eventInf[6] & 8) {
- this->unk_18E = 1;
+ // Watched intro cutscene
+ this->unk_18E = true;
Actor_SetScale(&this->actor, 0.01f);
this->unk_191 = 0x17;
- this->actor.params = 0x14;
- this->unk_304 = 1.0f;
- func_808C7DB8(this);
- return;
+ this->actor.params = 20;
+ this->scytheScale = 1.0f;
+ EnDeath_SetupBeginWithoutCutscene(this);
+ } else {
+ // Start intro cutscene
+ this->unk_192 = true;
+ this->actor.flags &= ~ACTOR_FLAG_1;
+ EnDeath_SetupPlayCutscene(this);
}
- this->unk_192 = 1;
- this->actor.flags &= ~1;
- func_808C7CFC(this);
}
void EnDeath_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnDeath* this = THIS;
- Collider_DestroySphere(globalCtx, &this->unk_808);
- Collider_DestroyCylinder(globalCtx, &this->unk_73C);
+ Collider_DestroySphere(globalCtx, &this->coreCollider);
+ Collider_DestroyCylinder(globalCtx, &this->bodyCollider);
Collider_DestroyQuad(globalCtx, &this->unk_788);
Collider_DestroyTris(globalCtx, &this->unk_860);
- Audio_StopSfxByPos(&this->unk_338);
- Effect_Destroy(globalCtx, this->unk_300);
+ Audio_StopSfxByPos(&this->scytheScreenPos);
+ Effect_Destroy(globalCtx, this->effectIndex);
}
-void func_808C5310(GlobalContext* globalCtx) {
+void EnDeath_DimLights(GlobalContext* globalCtx) {
LightSettings* lightSettings;
s32 i;
- globalCtx->envCtx.lightSettingOverride = 0x14;
- globalCtx->envCtx.unk_C1 = 0x14;
- globalCtx->envCtx.unk_C2 = 0x14;
+ globalCtx->envCtx.lightSettingOverride = 20;
+ globalCtx->envCtx.unk_C1 = 20;
+ globalCtx->envCtx.unk_C2 = 20;
globalCtx->envCtx.lightBlend = 1.0f;
lightSettings = &globalCtx->envCtx.lightSettingsList[20];
@@ -284,174 +320,179 @@ void func_808C5310(GlobalContext* globalCtx) {
}
}
-void func_808C5394(EnDeath* this) {
- func_800B9010(&this->actor, 0x3260);
+void EnDeath_Float(EnDeath* this) {
+ func_800B9010(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG);
- if (this->unk_2EA == 0) {
- this->unk_2EA = 0x28;
+ if (this->floatTimer == 0) {
+ this->floatTimer = 40;
}
- this->unk_2EA--;
- this->actor.world.pos.y = (1.0f - Math_CosS(this->unk_2EA * 0x666)) * 7.5f + this->actor.home.pos.y;
+ this->floatTimer--;
+ this->actor.world.pos.y = this->actor.home.pos.y + (1.0f - Math_CosS(this->floatTimer * 0x666)) * 7.5f;
}
-s32 func_808C5428(EnDeath* this, GlobalContext* globalCtx) {
- Actor* temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0);
+s32 EnDeath_ProjectileApproaching(EnDeath* this, GlobalContext* globalCtx) {
+ Actor* projectileActor =
+ func_800BC270(globalCtx, &this->actor, 80.0f, 0x10000 | 0x2000 | 0x1000 | 0x800 | 0x80 | 0x20 | 0x10);
s16 ret;
- if (temp_v0 != NULL &&
- (ret = Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y, ABS_ALT(ret) < 0x2000) &&
- (ret = Actor_PitchToPoint(temp_v0, &this->actor.focus.pos) - temp_v0->world.rot.x, ABS_ALT(ret) < 0x3000)) {
- return 1;
+ if (projectileActor != NULL &&
+ (ret = Actor_YawBetweenActors(&this->actor, projectileActor) - this->actor.shape.rot.y,
+ ABS_ALT(ret) < 0x2000) &&
+ (ret = Actor_PitchToPoint(projectileActor, &this->actor.focus.pos) - projectileActor->world.rot.x,
+ ABS_ALT(ret) < 0x3000)) {
+ return true;
}
- return 0;
+ return false;
}
-void func_808C54F0(EnDeath* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C54F0.s")
-/*
-void func_808C54F0(EnDeath *this) {
- f32 sp64 = Math_SinS(this->actor.shape.rot.y);
- f32 sp60 = Math_CosS(this->actor.shape.rot.y);
+void EnDeath_UpdateSpinAttackTris(EnDeath* this) {
+ f32 sinRotY = Math_SinS(this->actor.shape.rot.y);
+ f32 cosRotY = Math_CosS(this->actor.shape.rot.y);
Vec3f sp54;
Vec3f sp48;
Vec3f sp3C;
- sp3C.x = this->actor.world.pos.x - (70.0f * sp60) + (75.0f * sp64);
+ sp3C.x = this->actor.world.pos.x - 70.0f * cosRotY + 75.0f * sinRotY;
sp3C.y = this->actor.world.pos.y + -10.0f;
- sp3C.z = this->actor.world.pos.z + (70.0f * sp64) + (75.0f * sp60);
+ sp3C.z = this->actor.world.pos.z + 70.0f * sinRotY + 75.0f * cosRotY;
- sp48.x = this->actor.world.pos.x + (70.0f * sp60) + (65.0f * sp64);
+ sp48.x = this->actor.world.pos.x + 70.0f * cosRotY + 65.0f * sinRotY;
sp48.y = sp3C.y + 150.0f;
- sp48.z = this->actor.world.pos.z - (70.0f * sp64) + (65.0f * sp60);
-
- sp54.x = sp3C.x + (-10.0f * sp64);
- sp54.y = sp3C.y + 150.0f;
- sp54.z = sp3C.z + (-10.0f * sp60);
+ sp48.z = this->actor.world.pos.z - 70.0f * sinRotY + 65.0f * cosRotY;
+ sp54.x = sp3C.x;
+ sp54.x += -10.0f * sinRotY;
+ sp54.y = sp48.y;
+ sp54.z = sp3C.z;
+ sp54.z += -10.0f * cosRotY;
Collider_SetTrisVertices(&this->unk_860, 0, &sp3C, &sp48, &sp54);
- sp54.x = sp48.x + (10.0f * sp64);
+ sp54.x = sp48.x;
+ sp54.x += 10.0f * sinRotY;
sp54.y = sp3C.y;
- sp54.z = sp48.z + (10.0f * sp60);
-
+ sp54.z = sp48.z;
+ sp54.z += 10.0f * cosRotY;
Collider_SetTrisVertices(&this->unk_860, 1, &sp3C, &sp54, &sp48);
}
-*/
-#ifdef NON_MATCHING
-// regalloc differences
-f32 func_808C566C(EnDeath* this) {
- this->unk_308 = this->actor.world.pos.y - this->actor.home.pos.y;
- this->unk_308 = CLAMP_MIN(this->unk_308, 0.0f);
- this->unk_308 *= 0.02f;
- this->unk_308 = SQ(this->unk_308) * 3.0f + 80.0f;
- this->unk_2F6 += (s16)(65536.0f * (22.5f / (this->unk_308 * (2 * M_PI))));
+f32 EnDeath_UpdateCoreVelocityAndRotation(EnDeath* this) {
+ f32 tmp;
+
+ this->coreVelocity = this->actor.world.pos.y - this->actor.home.pos.y;
+ this->coreVelocity = CLAMP_MIN(this->coreVelocity, 0.0f);
+ this->coreVelocity *= 0.02f;
+ this->coreVelocity = SQ(this->coreVelocity) * 3.0f + 80.0f;
+
+ tmp = 22.5f / (this->coreVelocity * (2 * M_PI));
+ this->coreRotation += (s16)(65536.0f * tmp);
}
-#else
-f32 func_808C566C(EnDeath* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C566C.s")
-#endif
-void func_808C571C(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_SetupIntroCutscenePart1(EnDeath* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
- Vec3f sp30;
- Vec3f sp24;
+ Vec3f eye;
+ Vec3f at;
this->actor.shape.rot.y = this->actor.shape.rot.y - 0x657A;
- this->unk_2EE = 0x3C;
- sp30.x = (Math_SinS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.x;
- sp30.z = (Math_CosS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.z;
- sp30.y = this->actor.home.pos.y + 3.0f;
- sp24.x = this->actor.world.pos.x;
- sp24.z = this->actor.world.pos.z;
- sp24.y = this->actor.world.pos.y - 116.0f;
+ this->actionTimer = 60;
+
+ eye.x = (Math_SinS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.x;
+ eye.z = (Math_CosS(this->actor.home.rot.y + 0x98) * 542.0f) + this->actor.world.pos.z;
+ eye.y = this->actor.home.pos.y + 3.0f;
+
+ at.x = this->actor.world.pos.x;
+ at.z = this->actor.world.pos.z;
+ at.y = this->actor.world.pos.y - 116.0f;
+
player->actor.world.pos.x = Math_SinS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.x;
player->actor.world.pos.z = Math_CosS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.z;
player->actor.shape.rot.y = Actor_YawBetweenActors(&player->actor, &this->actor);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &sp24, &sp30);
- Play_CameraSetFov(globalCtx, this->unk_2FA, 77.0f);
+
+ Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye);
+ Play_CameraSetFov(globalCtx, this->camId, 77.0f);
func_800B724C(globalCtx, &this->actor, 0x15);
- this->unk_188 = func_808C589C;
+
+ this->actionFunc = EnDeath_IntroCutscenePart1;
}
-void func_808C589C(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_IntroCutscenePart1(EnDeath* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
player->actor.world.pos.x = Math_SinS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.x;
player->actor.world.pos.z = Math_CosS(this->actor.home.rot.y - 0x370) * 463.0f + this->actor.world.pos.z;
player->actor.shape.rot.y = Actor_YawBetweenActors(&player->actor, &this->actor);
- if (this->unk_2EE == 0x19) {
+ if (this->actionTimer == 25) {
func_800B724C(globalCtx, &this->actor, 0x51);
}
- if (this->unk_2EE > 0) {
- this->unk_2EE--;
+ if (this->actionTimer > 0) {
+ this->actionTimer--;
} else {
- func_808C597C(this, globalCtx);
+ EnDeath_SetupIntroCutscenePart2(this, globalCtx);
}
- func_808C566C(this);
+ EnDeath_UpdateCoreVelocityAndRotation(this);
}
-void func_808C597C(EnDeath* this, GlobalContext* globalCtx) {
- Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
+void EnDeath_SetupIntroCutscenePart2(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
s32 i;
- func_808C5310(globalCtx);
+ EnDeath_DimLights(globalCtx);
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 7;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_7;
}
- this->unk_2EE = 0x32;
- this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.x;
- this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.z;
- this->unk_344.y = this->actor.home.pos.y + 20.0f;
- this->unk_350.x = this->actor.world.pos.x;
- this->unk_350.z = this->actor.world.pos.z;
- this->unk_350.y = this->actor.home.pos.y + 50.0f;
- this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * 0.0225f;
- this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * 0.0225f;
- this->unk_188 = func_808C5AB8;
+ this->actionTimer = 50;
+ this->camEyeTarget.x = Math_SinS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.x;
+ this->camEyeTarget.z = Math_CosS(this->actor.home.rot.y) * 140.0f + this->actor.world.pos.z;
+ this->camEyeTarget.y = this->actor.home.pos.y + 20.0f;
+ this->camAtTarget.x = this->actor.world.pos.x;
+ this->camAtTarget.z = this->actor.world.pos.z;
+ this->camAtTarget.y = this->actor.home.pos.y + 50.0f;
+ this->camEyeSpeed = Math_Vec3f_DistXYZ(&camera->eye, &this->camEyeTarget) * 0.0225f;
+ this->camAtSpeed = Math_Vec3f_DistXYZ(&camera->at, &this->camAtTarget) * 0.0225f;
+ this->actionFunc = EnDeath_IntroCutscenePart2;
}
-void func_808C5AB8(EnDeath* this, GlobalContext* globalCtx) {
- Camera* sp2C = Play_GetCamera(globalCtx, this->unk_2FA);
+void EnDeath_IntroCutscenePart2(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
- if (this->unk_2EE == 0x2A) {
+ if (this->actionTimer == 42) {
func_800B724C(globalCtx, &this->actor, 4);
- } else if (this->unk_2EE == 0x1B) {
+ } else if (this->actionTimer == 27) {
func_800B724C(globalCtx, &this->actor, 0x7B);
}
- if (this->unk_2EE <= 0) {
+ if (this->actionTimer <= 0) {
if (this->actor.world.pos.y < (this->actor.home.pos.y + 400.0f) - 225.0f) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
+ globalCtx->envCtx.lightSettingOverride = 26;
}
- Math_Vec3f_StepTo(&sp2C->eye, &this->unk_344, this->unk_30C);
- Math_Vec3f_StepTo(&sp2C->at, &this->unk_350, this->unk_310);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &sp2C->at, &sp2C->eye);
+ Math_Vec3f_StepTo(&camera->eye, &this->camEyeTarget, this->camEyeSpeed);
+ Math_Vec3f_StepTo(&camera->at, &this->camAtTarget, this->camAtSpeed);
+ Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye);
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 9.0f) != 0) {
- this->unk_2EE--;
- if (this->unk_2EE == -0x14) {
- func_808C5C0C(this);
+ this->actionTimer--;
+ if (this->actionTimer == -20) {
+ EnDeath_SetupIntroCutscenePart3(this);
}
}
} else {
- this->unk_2EE--;
+ this->actionTimer--;
}
- func_808C566C(this);
+ EnDeath_UpdateCoreVelocityAndRotation(this);
}
-void func_808C5C0C(EnDeath* this) {
+void EnDeath_SetupIntroCutscenePart3(EnDeath* this) {
gSaveContext.eventInf[6] |= 8;
- Animation_Change(&this->skelAnime, &D_0600B284, 0.0f, 0.0f, Animation_GetLastFrame(&D_0600B284), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &object_death_Anim_00B284, 0.0f, 0.0f,
+ Animation_GetLastFrame(&object_death_Anim_00B284), ANIMMODE_ONCE, 0.0f);
this->actor.scale.y = 0.01f;
this->actor.shape.rot.y += 0x777F;
- Actor_PlaySfxAtPos(&this->actor, 0x3AB4);
- this->unk_188 = func_808C5CB4;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_APPEAR);
+ this->actionFunc = EnDeath_IntroCutscenePart3;
}
-void func_808C5CB4(EnDeath* this, GlobalContext* globalCtx) {
- s32 temp_v0 = Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f);
+void EnDeath_IntroCutscenePart3(EnDeath* this, GlobalContext* globalCtx) {
+ s32 stepDone = Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f);
f32 temp;
this->actor.scale.z = this->actor.scale.x;
@@ -460,393 +501,398 @@ void func_808C5CB4(EnDeath* this, GlobalContext* globalCtx) {
temp = 0.0025f;
}
this->actor.shape.rot.y += (s16)(temp * 4505600.0f);
- if (temp_v0 != 0) {
- this->unk_192 = 0;
- func_808C5D6C(this, globalCtx);
+ if (stepDone) {
+ this->unk_192 = false;
+ EnDeath_SetupIntroCutscenePart4(this, globalCtx);
}
- func_808C566C(this);
+ EnDeath_UpdateCoreVelocityAndRotation(this);
}
-void func_808C5D6C(EnDeath* this, GlobalContext* globalCtx) {
- Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
- f32 sp20 = 1.0f / Animation_GetLastFrame(&D_0600B284);
+void EnDeath_SetupIntroCutscenePart4(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
+ f32 invAnimDuration = 1.0f / Animation_GetLastFrame(&object_death_Anim_00B284);
- this->unk_2EE = 0xA;
+ this->actionTimer = 10;
this->skelAnime.playSpeed = 1.0f;
this->actor.shape.rot.y = this->actor.home.rot.y;
- this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.x;
- this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.z;
- this->unk_344.y = this->actor.home.pos.y + 95.0f;
- this->unk_350.x = this->actor.world.pos.x;
- this->unk_350.z = this->actor.world.pos.z;
- this->unk_350.y = this->actor.world.pos.y + 100.0f;
- this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * sp20;
- this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * sp20;
+ this->camEyeTarget.x = Math_SinS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.x;
+ this->camEyeTarget.z = Math_CosS(this->actor.home.rot.y) * 50.0f + this->actor.world.pos.z;
+ this->camEyeTarget.y = this->actor.home.pos.y + 95.0f;
+ this->camAtTarget.x = this->actor.world.pos.x;
+ this->camAtTarget.z = this->actor.world.pos.z;
+ this->camAtTarget.y = this->actor.world.pos.y + 100.0f;
+ this->camEyeSpeed = Math_Vec3f_DistXYZ(&camera->eye, &this->camEyeTarget) * invAnimDuration;
+ this->camAtSpeed = Math_Vec3f_DistXYZ(&camera->at, &this->camAtTarget) * invAnimDuration;
- this->unk_188 = func_808C5E90;
+ this->actionFunc = EnDeath_IntroCutscenePart4;
}
-void func_808C5E90(EnDeath* this, GlobalContext* globalCtx) {
- Camera* temp_v1 = Play_GetCamera(globalCtx, this->unk_2FA);
+void EnDeath_IntroCutscenePart4(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
if (this->unk_191 < 23) {
this->unk_191++;
}
- Math_Vec3f_StepTo(&temp_v1->eye, &this->unk_344, this->unk_30C);
- Math_Vec3f_StepTo(&temp_v1->at, &this->unk_350, this->unk_310);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &temp_v1->at, &temp_v1->eye);
+ Math_Vec3f_StepTo(&camera->eye, &this->camEyeTarget, this->camEyeSpeed);
+ Math_Vec3f_StepTo(&camera->at, &this->camAtTarget, this->camAtSpeed);
+ Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye);
if (SkelAnime_Update(&this->skelAnime)) {
- if (this->unk_2EE > 0) {
- this->unk_2EE--;
+ if (this->actionTimer > 0) {
+ this->actionTimer--;
} else {
- func_808C5F58(this, globalCtx);
+ EnDeath_SetupIntroCutscenePart5(this, globalCtx);
}
}
- func_808C566C(this);
+ EnDeath_UpdateCoreVelocityAndRotation(this);
}
-void func_808C5F58(EnDeath* this, GlobalContext* globalCtx) {
- Camera* sp24 = Play_GetCamera(globalCtx, this->unk_2FA);
+void EnDeath_SetupIntroCutscenePart5(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
- Animation_PlayOnce(&this->skelAnime, &D_0600CB2C);
+ Animation_PlayOnce(&this->skelAnime, &object_death_Anim_00CB2C);
this->unk_191 = 0x17;
- func_801A2E54(0x38);
- this->unk_344.x = Math_SinS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.x;
- this->unk_344.z = Math_CosS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.z;
- this->unk_344.y = this->actor.home.pos.y + 40.0f;
- this->unk_350.y = this->actor.world.pos.y + 85.0f;
- this->unk_30C = Math_Vec3f_DistXYZ(&sp24->eye, &this->unk_344) * 0.14285715f;
- this->unk_310 = Math_Vec3f_DistXYZ(&sp24->at, &this->unk_350) * 0.14285715f;
- Audio_PlaySfxAtPos(&this->unk_338, 0x3AB0);
- this->unk_188 = func_808C6070;
+ func_801A2E54(NA_BGM_MINI_BOSS);
+ this->camEyeTarget.x = Math_SinS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.x;
+ this->camEyeTarget.z = Math_CosS(this->actor.home.rot.y) * 230.0f + this->actor.world.pos.z;
+ this->camEyeTarget.y = this->actor.home.pos.y + 40.0f;
+ this->camAtTarget.y = this->actor.world.pos.y + 85.0f;
+ this->camEyeSpeed = Math_Vec3f_DistXYZ(&camera->eye, &this->camEyeTarget) * 0.14285715f;
+ this->camAtSpeed = Math_Vec3f_DistXYZ(&camera->at, &this->camAtTarget) * 0.14285715f;
+ Audio_PlaySfxAtPos(&this->scytheScreenPos, NA_SE_EN_DEATH_VOICE);
+ this->actionFunc = EnDeath_IntroCutscenePart5;
}
-void func_808C6070(EnDeath* this, GlobalContext* globalCtx) {
- Camera* sp44 = Play_GetCamera(globalCtx, this->unk_2FA);
- f32 phi_f2;
+void EnDeath_IntroCutscenePart5(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
+ f32 scale;
if (Animation_OnFrame(&this->skelAnime, 12.0f)) {
- globalCtx->envCtx.lightSettingOverride = 0x1B;
+ globalCtx->envCtx.lightSettingOverride = 27;
} else if (Animation_OnFrame(&this->skelAnime, 25.0f)) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
+ globalCtx->envCtx.lightSettingOverride = 26;
} else if (Animation_OnFrame(&this->skelAnime, 38.0f)) {
s32 i;
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 9;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_9;
}
} else if (Animation_OnFrame(&this->skelAnime, 14.0f)) {
s32 i;
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 8;
- this->unk_6E4[i]->world.pos.x =
- (this->unk_6E4[i]->world.pos.x - this->actor.world.pos.x) * 1.8f + this->actor.world.pos.x;
- this->unk_6E4[i]->world.pos.z =
- (this->unk_6E4[i]->world.pos.z - this->actor.world.pos.z) * 1.8f + this->actor.world.pos.z;
- this->unk_6E4[i]->world.pos.y =
- (this->unk_6E4[i]->world.pos.y - this->actor.world.pos.y) * 1.7f + this->actor.world.pos.y;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_8;
+ this->miniDeaths[i]->actor.world.pos.x =
+ (this->miniDeaths[i]->actor.world.pos.x - this->actor.world.pos.x) * 1.8f + this->actor.world.pos.x;
+ this->miniDeaths[i]->actor.world.pos.z =
+ (this->miniDeaths[i]->actor.world.pos.z - this->actor.world.pos.z) * 1.8f + this->actor.world.pos.z;
+ this->miniDeaths[i]->actor.world.pos.y =
+ (this->miniDeaths[i]->actor.world.pos.y - this->actor.world.pos.y) * 1.7f + this->actor.world.pos.y;
}
- this->unk_18E = 1;
- this->unk_304 = 1.0f;
+ this->unk_18E = true;
+ this->scytheScale = 1.0f;
}
- Math_Vec3f_StepTo(&sp44->eye, &this->unk_344, this->unk_30C);
- Math_Vec3f_StepTo(&sp44->at, &this->unk_350, this->unk_310);
- Math_StepToF(&sp44->fov, 60.0f, 2.4285715f);
- Play_CameraSetFov(globalCtx, this->unk_2FA, sp44->fov);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &sp44->at, &sp44->eye);
+ Math_Vec3f_StepTo(&camera->eye, &this->camEyeTarget, this->camEyeSpeed);
+ Math_Vec3f_StepTo(&camera->at, &this->camAtTarget, this->camAtSpeed);
+ Math_StepToF(&camera->fov, 60.0f, 2.4285715f);
+ Play_CameraSetFov(globalCtx, this->camId, camera->fov);
+ Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye);
- phi_f2 = CLAMP(this->skelAnime.curFrame, 10.0f, 14.0f) - 10.0f;
- this->unk_304 = phi_f2 * 0.25f;
- if (phi_f2 < 14.0f) {
- func_808C566C(this);
+ scale = CLAMP(this->skelAnime.curFrame, 10.0f, 14.0f) - 10.0f;
+ this->scytheScale = scale * 0.25f;
+ if (scale < 14.0f) {
+ EnDeath_UpdateCoreVelocityAndRotation(this);
}
if (SkelAnime_Update(&this->skelAnime)) {
ActorCutscene_Stop(this->actor.cutscene);
func_800B724C(globalCtx, &this->actor, 6);
- this->actor.flags |= 1;
- this->unk_808.base.acFlags |= 1;
- func_808C645C(this);
+ this->actor.flags |= ACTOR_FLAG_1;
+ this->coreCollider.base.acFlags |= AC_ON;
+ EnDeath_SetupApproachPlayer(this);
}
}
-void func_808C645C(EnDeath* this) {
- Animation_MorphToLoop(&this->skelAnime, &D_06003CAC, 10.0f);
+void EnDeath_SetupApproachPlayer(EnDeath* this) {
+ Animation_MorphToLoop(&this->skelAnime, &gGomessFloatAnim, 10.0f);
this->actor.speedXZ = 1.5f;
- if (this->unk_188 == func_808C682C || this->unk_188 == func_808C6AB0) {
- this->unk_2EE = 0x8C;
+ if (this->actionFunc == EnDeath_EndSwingAttack || this->actionFunc == EnDeath_SpinAttack) {
+ this->actionTimer = 140;
} else {
- this->unk_2EE = 0x64;
+ this->actionTimer = 100;
}
- this->unk_188 = func_808C64DC;
+ this->actionFunc = EnDeath_ApproachPlayer;
}
-void func_808C64DC(EnDeath* this, GlobalContext* globalCtx) {
- if (globalCtx->envCtx.lightSettingOverride == 0x14) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
+void EnDeath_ApproachPlayer(EnDeath* this, GlobalContext* globalCtx) {
+ if (globalCtx->envCtx.lightSettingOverride == 20) {
+ globalCtx->envCtx.lightSettingOverride = 26;
}
- func_808C5394(this);
+ EnDeath_Float(this);
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
- if (this->unk_2EE > 0) {
- this->unk_2EE--;
+ if (this->actionTimer > 0) {
+ this->actionTimer--;
}
- if (this->actor.params < 5 && Rand_ZeroOne() < 0.4f && func_808C5428(this, globalCtx)) {
- func_808C68B8(this);
- return;
- }
- if (this->unk_2EE < 0x64 && this->actor.xzDistToPlayer < 200.0f) {
- func_808C6620(this);
- return;
- }
- if (this->unk_2EE == 0) {
+ if (this->actor.params < 5 && Rand_ZeroOne() < 0.4f && EnDeath_ProjectileApproaching(this, globalCtx)) {
+ EnDeath_SetupBlockProjectile(this);
+ } else if (this->actionTimer < 100 && this->actor.xzDistToPlayer < 200.0f) {
+ EnDeath_SetupSwingAttack(this);
+ } else if (this->actionTimer == 0) {
if (this->actor.params >= 5) {
func_808C7AEC(this);
- return;
+ } else {
+ EnDeath_SetupSpinAttack(this);
}
- func_808C6A08(this);
}
}
-void func_808C6620(EnDeath* this) {
- Animation_Change(&this->skelAnime, &D_06000E64, 1.0f, 0.0f, 10.0f, 2, -3.0f);
- this->unk_2EE = 0;
- this->unk_2EA = 0;
+void EnDeath_SetupSwingAttack(EnDeath* this) {
+ Animation_Change(&this->skelAnime, &gGomessScytheSwingAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -3.0f);
+ this->actionTimer = 0;
+ this->floatTimer = 0;
this->actor.speedXZ = 8.0f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_ATTACK);
- this->unk_188 = func_808C66A8;
+ this->actionFunc = EnDeath_SwingAttack;
}
-void func_808C66A8(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_SwingAttack(EnDeath* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x1000, 0x200);
Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 3.0f);
- this->actor.shape.rot.x = (s16)((100.0f - this->actor.xzDistToPlayer) * 0.01f * 1024.0f);
+ this->actor.shape.rot.x = (s16)((100.0f - this->actor.xzDistToPlayer) * 0.01f * 0x400);
this->actor.shape.rot.x = CLAMP_MIN(this->actor.shape.rot.x, 0);
- if (this->unk_2EE > 0) {
- this->unk_2EE++;
- if (this->unk_2EE == 3) {
- func_808C67C8(this);
- return;
+ if (this->actionTimer > 0) {
+ this->actionTimer++;
+ if (this->actionTimer == 3) {
+ EnDeath_SetupEndSwingAttack(this);
}
} else if (SkelAnime_Update(&this->skelAnime) && this->actor.xzDistToPlayer < 100.0f) {
- Audio_PlaySfxAtPos(&this->unk_338, 0x3AAC);
- this->unk_2EE++;
+ Audio_PlaySfxAtPos(&this->scytheScreenPos, NA_SE_EN_DEATH_SCYTHE);
+ this->actionTimer++;
this->actor.speedXZ = 0.0f;
}
}
-void func_808C67C8(EnDeath* this) {
- this->skelAnime.endFrame = Animation_GetLastFrame(&D_06000E64);
- this->unk_2EE = 0;
+void EnDeath_SetupEndSwingAttack(EnDeath* this) {
+ this->skelAnime.endFrame = Animation_GetLastFrame(&gGomessScytheSwingAnim);
+ this->actionTimer = 0;
this->unk_2EC = -1;
- this->unk_18C = 1;
- this->unk_188 = func_808C682C;
+ this->unk_18C = true;
+ this->actionFunc = EnDeath_EndSwingAttack;
this->actor.speedXZ = 0.0f;
}
-void func_808C682C(EnDeath* this, GlobalContext* globalCtx) {
- this->unk_2EE++;
+void EnDeath_EndSwingAttack(EnDeath* this, GlobalContext* globalCtx) {
+ this->actionTimer++;
if (this->skelAnime.curFrame > 20.0f) {
- this->unk_18C = 0;
- this->unk_788.base.atFlags &= 0xFFFE;
+ this->unk_18C = false;
+ this->unk_788.base.atFlags &= ~AT_ON;
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200);
}
if (SkelAnime_Update(&this->skelAnime)) {
this->actor.shape.rot.x = 0;
- func_808C645C(this);
+ EnDeath_SetupApproachPlayer(this);
}
}
-void func_808C68B8(EnDeath* this) {
- Animation_MorphToLoop(&this->skelAnime, &D_0600B508, -3.0f);
- this->unk_2EC = 0x1F;
- this->unk_2EE = 0x1E;
+void EnDeath_SetupBlockProjectile(EnDeath* this) {
+ Animation_MorphToLoop(&this->skelAnime, &gGomessScytheSpinAnim, -3.0f);
+ this->unk_2EC = 31;
+ this->actionTimer = 30;
this->actor.speedXZ = 0.0f;
- func_808C54F0(this);
- this->unk_18C = 1;
- this->unk_190 = -3;
- this->unk_188 = func_808C692C;
+ EnDeath_UpdateSpinAttackTris(this);
+ this->unk_18C = true;
+ this->numScytheAfterImages = -3;
+ this->actionFunc = EnDeath_BlockProjectile;
}
-void func_808C692C(EnDeath* this, GlobalContext* globalCtx) {
- func_808C5394(this);
+void EnDeath_BlockProjectile(EnDeath* this, GlobalContext* globalCtx) {
+ EnDeath_Float(this);
- this->unk_2EE--;
- if (this->unk_190 < 7) {
- this->unk_190++;
+ this->actionTimer--;
+ if (this->numScytheAfterImages < 7) {
+ this->numScytheAfterImages++;
}
SkelAnime_Update(&this->skelAnime);
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
- Audio_PlaySfxAtPos(&this->unk_338, 0x3AAD);
+ Audio_PlaySfxAtPos(&this->scytheScreenPos, NA_SE_EN_DEATH_ROLL);
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
- func_808C54F0(this);
- if (this->unk_2EE == 0) {
+ EnDeath_UpdateSpinAttackTris(this);
+ if (this->actionTimer == 0) {
if (this->actor.xzDistToPlayer > 200.0f) {
- func_808C6A08(this);
- return;
+ EnDeath_SetupSpinAttack(this);
+ } else {
+ EnDeath_SetupApproachPlayer(this);
}
- func_808C645C(this);
}
}
-void func_808C6A08(EnDeath* this) {
- if (this->unk_188 != func_808C692C) {
- Animation_MorphToLoop(&this->skelAnime, &D_0600B508, -3.0f);
- this->unk_190 = -3;
- this->unk_2EE = 0;
+void EnDeath_SetupSpinAttack(EnDeath* this) {
+ if (this->actionFunc != EnDeath_BlockProjectile) {
+ Animation_MorphToLoop(&this->skelAnime, &gGomessScytheSpinAnim, -3.0f);
+ this->numScytheAfterImages = -3;
+ this->actionTimer = 0;
this->unk_2EC = -1;
- this->unk_18C = 1;
+ this->unk_18C = true;
this->actor.speedXZ = 0.0f;
} else {
- this->unk_2EE = 0xA;
+ // Starting straight out of blocking a projectile, already spinning so start moving immediately
+ this->actionTimer = 10;
this->unk_2EC = 9;
this->actor.speedXZ = 10.0f;
}
- func_808C54F0(this);
- this->unk_188 = func_808C6AB0;
+ EnDeath_UpdateSpinAttackTris(this);
+ this->actionFunc = EnDeath_SpinAttack;
}
-void func_808C6AB0(EnDeath* this, GlobalContext* globalCtx) {
- func_808C5394(this);
+void EnDeath_SpinAttack(EnDeath* this, GlobalContext* globalCtx) {
+ EnDeath_Float(this);
+
SkelAnime_Update(&this->skelAnime);
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
- Audio_PlaySfxAtPos(&this->unk_338, 0x3AAD);
+ Audio_PlaySfxAtPos(&this->scytheScreenPos, NA_SE_EN_DEATH_ROLL);
}
- if (this->unk_190 < 7) {
- this->unk_190++;
+
+ if (this->numScytheAfterImages < 7) {
+ this->numScytheAfterImages++;
}
- this->unk_2EE++;
- if (this->unk_2EE < 10) {
+
+ this->actionTimer++;
+ if (this->actionTimer < 10) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
- } else if (this->unk_2EE == 10) {
+ } else if (this->actionTimer == 10) {
this->actor.speedXZ = 10.0f;
}
- func_808C54F0(this);
- Math_ScaledStepToS(&this->unk_2F2, (s32)(Math_SinS(this->unk_2EE * 0x2000) * 2048.0f) + 0x3000, 0x1000);
- Math_ScaledStepToS(&this->unk_2F4, (s32)(Math_SinS(this->unk_2EE * 0x2000 - 0x8000) * 2048.0f), 0x1000);
- if ((this->actor.bgCheckFlags & 8) || (this->unk_788.base.atFlags & 2) || (this->unk_860.base.atFlags & 2)) {
- this->unk_18C = 0;
- this->unk_788.base.atFlags &= 0xFFFC;
- this->unk_860.base.atFlags &= 0xFFFD;
- func_808C645C(this);
+
+ EnDeath_UpdateSpinAttackTris(this);
+
+ Math_ScaledStepToS(&this->unk_2F2, (s32)(Math_SinS(this->actionTimer * 0x2000) * 0x800) + 0x3000, 0x1000);
+ Math_ScaledStepToS(&this->unk_2F4, (s32)(Math_SinS(this->actionTimer * 0x2000 - 0x8000) * 0x800), 0x1000);
+
+ if ((this->actor.bgCheckFlags & 8) || (this->unk_788.base.atFlags & AT_HIT) ||
+ (this->unk_860.base.atFlags & AT_HIT)) {
+ this->unk_18C = false;
+ this->unk_788.base.atFlags &= ~(AT_ON | AT_HIT);
+ this->unk_860.base.atFlags &= ~AT_HIT;
+ EnDeath_SetupApproachPlayer(this);
}
}
-void func_808C6C5C(EnDeath* this) {
- Animation_PlayOnce(&this->skelAnime, &D_06001F80);
+void EnDeath_SetupDamaged(EnDeath* this) {
+ Animation_PlayOnce(&this->skelAnime, &gGomessDamagedAnim);
this->actor.speedXZ = 10.0f;
- func_800BE568(&this->actor, &this->unk_808);
- Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xF);
- Actor_PlaySfxAtPos(&this->actor, 0x3AB1);
- this->unk_188 = func_808C6CDC;
+ func_800BE568(&this->actor, &this->coreCollider);
+ Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 15);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_DAMAGE);
+ this->actionFunc = EnDeath_Damaged;
}
-void func_808C6CDC(EnDeath* this, GlobalContext* globalCtx) {
- func_808C5394(this);
+void EnDeath_Damaged(EnDeath* this, GlobalContext* globalCtx) {
+ EnDeath_Float(this);
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
if (SkelAnime_Update(&this->skelAnime)) {
- this->unk_808.base.acFlags |= 1;
- func_808C6A08(this);
+ this->coreCollider.base.acFlags |= AC_ON;
+ EnDeath_SetupSpinAttack(this);
}
}
-void func_808C6D40(EnDeath* this, GlobalContext* globalCtx) {
- Vec3f sp3C;
- Vec3f sp30;
+void EnDeath_SetupDeathCutscenePart1(EnDeath* this, GlobalContext* globalCtx) {
+ Vec3f eye;
+ Vec3f at;
s32 i;
- this->actor.flags &= ~0x1001;
- Animation_PlayOnce(&this->skelAnime, &D_06002DE8);
+ this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_1000);
+ Animation_PlayOnce(&this->skelAnime, &gGomessBeginDeathAnim);
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 6;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_6;
}
- this->unk_18D = 0;
- this->unk_808.base.acFlags &= 0xFFFE;
- Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x1E);
- this->unk_2EE = 0x23;
+ this->unk_18D = false;
+ this->coreCollider.base.acFlags &= ~AC_ON;
+ Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 30);
+ this->actionTimer = 35;
this->actor.world.pos.y = this->actor.home.pos.y;
this->actor.speedXZ = 0.0f;
- this->unk_344.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.x;
- this->unk_344.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.z;
- this->unk_344.y = this->actor.home.pos.y + 63.0f;
- sp30.x = this->actor.world.pos.x;
- sp30.y = this->actor.world.pos.y + 100.0f;
- sp30.z = this->actor.world.pos.z;
- sp3C.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.x;
- sp3C.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.z;
- sp3C.y = this->actor.home.pos.y + 30.0f;
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &sp30, &sp3C);
- this->unk_30C = Math_Vec3f_DistXYZ(&sp3C, &this->unk_344) * 0.05f;
+ this->camEyeTarget.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.x;
+ this->camEyeTarget.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 79.0f + this->actor.world.pos.z;
+ this->camEyeTarget.y = this->actor.home.pos.y + 63.0f;
+ at.x = this->actor.world.pos.x;
+ at.y = this->actor.world.pos.y + 100.0f;
+ at.z = this->actor.world.pos.z;
+ eye.x = Math_SinS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.x;
+ eye.z = Math_CosS(this->actor.shape.rot.y + 0x900) * 179.0f + this->actor.world.pos.z;
+ eye.y = this->actor.home.pos.y + 30.0f;
+ Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye);
+ this->camEyeSpeed = Math_Vec3f_DistXYZ(&eye, &this->camEyeTarget) * 0.05f;
this->actor.shape.rot.y += 0x2000;
func_800B724C(globalCtx, &this->actor, 7);
- Actor_PlaySfxAtPos(&this->actor, 0x3AB2);
- this->unk_188 = func_808C6F6C;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_DEAD);
+ this->actionFunc = EnDeath_DeathCutscenePart1;
}
-void func_808C6F6C(EnDeath* this, GlobalContext* globalCtx) {
- Camera* camera = Play_GetCamera(globalCtx, this->unk_2FA);
- f32 sp28 = Math_Vec3f_StepTo(&camera->eye, &this->unk_344, this->unk_30C);
+void EnDeath_DeathCutscenePart1(EnDeath* this, GlobalContext* globalCtx) {
+ Camera* camera = Play_GetCamera(globalCtx, this->camId);
+ f32 distToTarget = Math_Vec3f_StepTo(&camera->eye, &this->camEyeTarget, this->camEyeSpeed);
+
+ Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &camera->at, &camera->eye);
if (SkelAnime_Update(&this->skelAnime)) {
this->actor.shape.rot.y += 0x2000;
- Animation_PlayLoop(&this->skelAnime, &D_0600352C);
- } else if (this->skelAnime.animation == &D_06002DE8) {
+ Animation_PlayLoop(&this->skelAnime, &gGomessDeathAnim);
+ } else if (this->skelAnime.animation == &gGomessBeginDeathAnim) {
this->actor.shape.rot.y += 0x2000;
if (this->skelAnime.curFrame > 3.0f) {
Matrix_SetCurrentState(&this->unk_6A4);
- Matrix_InsertXRotation_s(-0x1000, 1);
+ Matrix_InsertXRotation_s(-0x1000, MTXMODE_APPLY);
Matrix_CopyCurrentState(&this->unk_6A4);
- this->unk_18E = 0;
+ this->unk_18E = false;
this->unk_6A4.wy += 18.0f;
- Actor_PlaySfxAtPos(&this->actor, 0x3AAC);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_SCYTHE);
}
}
- if (sp28 < 0.1f) {
- if (this->unk_2EE == 35) {
- func_801A479C(&this->unk_338, 0x3AAE, 0x41); // TODO sfx id
+
+ if (distToTarget < 0.1f) {
+ if (this->actionTimer == 35) {
+ func_801A479C(&this->scytheScreenPos, NA_SE_EN_DEATH_SCYTHE_LEV, 0x41);
}
- if (this->unk_2EE > 0) {
- this->unk_2EE--;
+ if (this->actionTimer > 0) {
+ this->actionTimer--;
}
- if (this->unk_2EE == 0) {
- func_808C70D8(this, globalCtx);
+ if (this->actionTimer == 0) {
+ EnDeath_SetupDeathCutscenePart2(this, globalCtx);
}
}
}
-void func_808C70D8(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_SetupDeathCutscenePart2(EnDeath* this, GlobalContext* globalCtx) {
LightSettings* lightSettings1;
LightSettings* lightSettings2;
Player* player = GET_PLAYER(globalCtx);
- Vec3f sp40;
- Vec3f sp34;
- f32 sp30;
- f32 sp2C;
+ Vec3f eye;
+ Vec3f at;
+ f32 sinRotY;
+ f32 cosRotY;
s32 i;
- Animation_PlayLoop(&this->skelAnime, &D_0600352C);
- this->unk_2EE = 0x1E;
+ Animation_PlayLoop(&this->skelAnime, &gGomessDeathAnim);
+ this->actionTimer = 30;
player->actor.shape.rot.y = Actor_YawToPoint(&player->actor, &this->actor.home.pos) + 0x1000;
this->actor.shape.rot.y = player->actor.shape.rot.y + 0x6000;
- sp30 = Math_SinS(player->actor.shape.rot.y);
- sp2C = Math_CosS(player->actor.shape.rot.y);
- this->actor.world.pos.x = player->actor.world.pos.x + (260.0f * sp30);
- this->actor.world.pos.z = player->actor.world.pos.z + (260.0f * sp2C);
+ sinRotY = Math_SinS(player->actor.shape.rot.y);
+ cosRotY = Math_CosS(player->actor.shape.rot.y);
+ this->actor.world.pos.x = player->actor.world.pos.x + (260.0f * sinRotY);
+ this->actor.world.pos.z = player->actor.world.pos.z + (260.0f * cosRotY);
this->actor.world.pos.y = this->actor.home.pos.y + 15.0f;
- sp40.x = (Math_SinS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.x;
- sp40.z = (Math_CosS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.z;
- sp40.y = this->actor.world.pos.y - 13.0f;
- sp34.x = player->actor.world.pos.x + (120.0f * sp30);
- sp34.y = player->actor.world.pos.y + 90.0f;
- sp34.z = player->actor.world.pos.z + (120.0f * sp2C);
- Play_CameraSetAtEye(globalCtx, this->unk_2FA, &sp34, &sp40);
+ eye.x = (Math_SinS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.x;
+ eye.z = (Math_CosS((s16)(player->actor.shape.rot.y - 0x2500)) * 182.0f) + this->actor.world.pos.z;
+ eye.y = this->actor.world.pos.y - 13.0f;
+ at.x = player->actor.world.pos.x + (120.0f * sinRotY);
+ at.y = player->actor.world.pos.y + 90.0f;
+ at.z = player->actor.world.pos.z + (120.0f * cosRotY);
+ Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye);
lightSettings1 = &globalCtx->envCtx.lightSettingsList[20];
lightSettings2 = &globalCtx->envCtx.lightSettingsList[21];
@@ -856,56 +902,119 @@ void func_808C70D8(EnDeath* this, GlobalContext* globalCtx) {
lightSettings1->diffusePos2[i] = lightSettings2->diffusePos2[i];
}
- this->unk_188 = func_808C72AC;
+ this->actionFunc = EnDeath_DeathCutscenePart2;
}
-void func_808C72AC(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_DeathCutscenePart2(EnDeath* this, GlobalContext* globalCtx) {
f32 sin;
f32 cos;
- s16 temp_v1;
+ s16 camYaw;
SkelAnime_Update(&this->skelAnime);
- this->unk_2EE--;
- if (this->unk_2EE >= 0 && this->unk_2EE < 3) {
- temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
- sin = Math_SinS(temp_v1);
- cos = Math_CosS(temp_v1);
+ this->actionTimer--;
+ if (this->actionTimer >= 0 && this->actionTimer < 3) {
+ camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
+ sin = Math_SinS(camYaw);
+ cos = Math_CosS(camYaw);
Matrix_InsertTranslation(this->actor.world.pos.x + (83.0f * sin) + (-38.0f * cos),
- this->actor.world.pos.y + 53.0f + 15.0f * this->unk_2EE,
- this->actor.world.pos.z + (83.0f * cos) - (-38.0f * sin), 0);
- Matrix_RotateY(temp_v1 - 0x3300, 1);
- Matrix_InsertXRotation_s(0x1100 - this->unk_2EE * 0x1800, 1);
- Matrix_InsertZRotation_s(-0xA00, 1);
- Matrix_Scale(0.01f, 0.01f, 0.01f, 1);
+ this->actor.world.pos.y + 53.0f + 15.0f * this->actionTimer,
+ this->actor.world.pos.z + (83.0f * cos) - (-38.0f * sin), MTXMODE_NEW);
+ Matrix_RotateY(camYaw - 0x3300, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(0x1100 - this->actionTimer * 0x1800, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(-0xA00, MTXMODE_APPLY);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
Matrix_CopyCurrentState(&this->unk_6A4);
- if (this->unk_2EE == 0) {
+ if (this->actionTimer == 0) {
func_800DFD04(GET_ACTIVE_CAM(globalCtx), 2, 4, 6);
- func_8013ECE0(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
- func_801A7328(&this->unk_338, 0x3AAE);
- Audio_PlaySfxAtPos(&this->unk_338, 0x3AAF);
+ func_8013ECE0(this->actor.xyzDistToPlayerSq, 180, 20, 100);
+ func_801A7328(&this->scytheScreenPos, NA_SE_EN_DEATH_SCYTHE_LEV);
+ Audio_PlaySfxAtPos(&this->scytheScreenPos, NA_SE_EN_DEATH_SCYTHE_ONGND);
}
}
- if (this->unk_2EE < -0x19) {
- globalCtx->envCtx.lightSettingOverride = 0x14;
- func_808C74A4(this);
+ if (this->actionTimer < -25) {
+ globalCtx->envCtx.lightSettingOverride = 20;
+ EnDeath_SetupDeathCutscenePart3(this);
}
}
-void func_808C74A4(EnDeath* this) {
+void EnDeath_SetupDeathCutscenePart3(EnDeath* this) {
s32 i;
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 5;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_DIE;
}
- this->unk_2EE = 0;
- this->unk_188 = func_808C74F8;
+ this->actionTimer = 0;
+ this->actionFunc = EnDeath_DeathCutscenePart3;
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C74F8.s")
+void EnDeath_DeathCutscenePart3(EnDeath* this, GlobalContext* globalCtx) {
+ static Vec3f sparkleVel = { 0.0f, -1.5f, 0.0f };
+ static Vec3f sparkleAccel = { 0.0f, -0.2f, 0.0f };
+ static Color_RGBA8 sparklePrimColor = { 0, 0, 0, 0 };
+ static Color_RGBA8 sparkleEnvColor = { 40, 40, 40, 0 };
+ static s16 D_808C9A90[GOMESS_LIMB_MAX] = { 30, 30, 10, 2, 12, 17, 17, 17, 17, 17, 17,
+ 17, 14, 10, 12, 9, 9, 12, 9, 9, 30, 30 };
+ s32 phi_v0;
+ s32 phi_s0;
+ u8* temp1A9;
+ Vec3f* sparklePos;
+ s32 pad;
+ s32 pad1;
+ f32 sin;
+ f32 cos;
+ f32 temp_fs0;
+ s32 temp_v1;
-void func_808C7800(EnDeath* this) {
+ sparklePos = this->unk_404;
+ temp1A9 = this->unk_1A9;
+ for (phi_v0 = 0; (phi_v0 ^ 0) < ARRAY_COUNT(this->unk_404); phi_v0++) {
+ sparklePos->y += 1.7f;
+ temp_v1 = *temp1A9 - 30;
+ *temp1A9 = CLAMP_MIN(temp_v1, 0);
+ sparklePos++;
+ temp1A9++;
+ }
+
+ temp_v1 = (-this->actionTimer * 14) + 252;
+ this->actor.shape.shadowAlpha = CLAMP_MIN(temp_v1, 0);
+
+ if (this->actionTimer < 18) {
+ sparklePos = &this->unk_404[(this->actionTimer * 7) % ARRAY_COUNT(this->unk_404)];
+ temp1A9 = &this->unk_1A9[(this->actionTimer * 7) % ARRAY_COUNT(this->unk_1A9)];
+
+ sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000);
+ cos = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000);
+
+ for (phi_s0 = 0; phi_s0 < 7; phi_s0++) {
+ temp_fs0 = randPlusMinusPoint5Scaled(100.0f) - 20.0f;
+ sparklePos->x = this->actor.world.pos.x + (30.0f * sin) + (temp_fs0 * cos);
+ sparklePos->y = (Rand_ZeroFloat(20.0f) + this->actor.world.pos.y + 4.0f * this->actionTimer) - 30.0f;
+ sparklePos->z = (this->actor.world.pos.z + 30.0f * cos) - (temp_fs0 * sin);
+ *temp1A9 = 255 - phi_s0 * 4;
+ EffectSsKiraKira_SpawnSmall(globalCtx, sparklePos, &sparkleVel, &sparkleAccel, &sparklePrimColor,
+ &sparkleEnvColor);
+ sparklePos++;
+ temp1A9++;
+ }
+ func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG);
+ }
+
+ this->actionTimer++;
+
+ for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(this->unk_193); phi_v0++) {
+ if (this->actionTimer == D_808C9A90[phi_v0]) {
+ this->unk_193[phi_v0] = 1;
+ }
+ }
+
+ if (this->actionTimer == 26) {
+ EnDeath_SetupDeathCutscenePart4(this);
+ }
+}
+
+void EnDeath_SetupDeathCutscenePart4(EnDeath* this) {
s32 i;
for (i = 0; i < ARRAY_COUNT(this->unk_1A9); i++) {
@@ -913,59 +1022,57 @@ void func_808C7800(EnDeath* this) {
}
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.focus.pos);
- this->actor.bgCheckFlags &= 0xFFFE;
- this->unk_2EE = 0;
- this->unk_188 = func_808C7888;
+ this->actor.bgCheckFlags &= ~1;
+ this->actionTimer = 0;
+ this->actionFunc = EnDeath_DeathCutscenePart4;
this->actor.gravity = -1.0f;
this->actor.shape.yOffset = 0.0f;
}
-#ifdef NON_MATCHING
-// needs in-function static D_808C9ABC
-void func_808C7888(EnDeath* this, GlobalContext* globalCtx) {
- Vec3f sp74;
+void EnDeath_DeathCutscenePart4(EnDeath* this, GlobalContext* globalCtx) {
+ static Vec3f sparkleAccel = { 0.0f, -1.0f, 0.0f };
+ static Color_RGBA8 sparklePrimColor = { 0, 200, 100, 0 };
+ static Color_RGBA8 sparkleEnvColor = { 0, 100, 0, 0 };
+ Vec3f sparkleVel;
s32 i;
- if (this->unk_2EE == 0) {
+ if (this->actionTimer == 0) {
if ((this->actor.bgCheckFlags & 1) || this->actor.floorHeight == -32000.0f) {
Actor_SetScale(&this->actor, 0.0f);
- this->unk_2EE++;
+ this->actionTimer++;
for (i = 0; i < 40; i++) {
- D_808C9ABC.y = -0.2f;
- sp74.x = randPlusMinusPoint5Scaled(4.0f);
- sp74.y = randPlusMinusPoint5Scaled(4.0f);
- sp74.z = Rand_ZeroFloat(2.0f) + 3.0f;
- EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world.pos, &sp74, &D_808C9ABC, &D_808C9AC8,
- &D_808C9ACC);
+ sparkleAccel.y = -0.2f;
+ sparkleVel.x = randPlusMinusPoint5Scaled(4.0f);
+ sparkleVel.z = randPlusMinusPoint5Scaled(4.0f);
+ sparkleVel.y = Rand_ZeroFloat(2.0f) + 3.0f;
+ EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world.pos, &sparkleVel, &sparkleAccel,
+ &sparklePrimColor, &sparkleEnvColor);
}
- Actor_PlaySfxAtPos(&this->actor, 0x3AB5);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_HEARTBREAK);
}
} else {
- this->unk_2EE++;
- if (this->unk_2EE == 20) {
- func_808C7A30(this, globalCtx);
+ this->actionTimer++;
+ if (this->actionTimer == 20) {
+ EnDeath_SetupDead(this, globalCtx);
}
}
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C7888.s")
-#endif
-void func_808C7A30(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_SetupDead(EnDeath* this, GlobalContext* globalCtx) {
ActorCutscene_Stop(this->actor.cutscene);
func_800B724C(globalCtx, &this->actor, 6);
Flags_SetClearTemp(globalCtx, globalCtx->roomCtx.currRoom.num);
- this->unk_2EE = 0xFF;
- globalCtx->envCtx.lightSettingOverride = 0xFF;
- this->unk_188 = func_808C7AAC;
+ this->actionTimer = 255;
+ globalCtx->envCtx.lightSettingOverride = 255;
+ this->actionFunc = EnDeath_Dead;
}
-void func_808C7AAC(EnDeath* this, GlobalContext* globalCtx) {
- if (this->unk_2EE > 0) {
- this->unk_2EE -= 5;
- if (this->unk_2EE <= 0) {
- this->unk_2EE = 0;
+void EnDeath_Dead(EnDeath* this, GlobalContext* globalCtx) {
+ if (this->actionTimer > 0) {
+ this->actionTimer -= 5;
+ if (this->actionTimer <= 0) {
+ this->actionTimer = 0;
Actor_MarkForDeath(&this->actor);
}
}
@@ -974,23 +1081,24 @@ void func_808C7AAC(EnDeath* this, GlobalContext* globalCtx) {
void func_808C7AEC(EnDeath* this) {
s32 i;
- Actor_PlaySfxAtPos(&this->actor, 0x3AB0);
- Animation_MorphToPlayOnce(&this->skelAnime, &D_060015B4, 5.0f);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_VOICE);
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_death_Anim_0015B4, 5.0f);
this->actor.speedXZ = 0.0f;
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 3;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_3;
}
- this->unk_2EA = 0;
- this->unk_188 = func_808C7B88;
+ this->floatTimer = 0;
+ this->actionFunc = func_808C7B88;
}
void func_808C7B88(EnDeath* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 5.0f);
+
if (SkelAnime_Update(&this->skelAnime)) {
- globalCtx->envCtx.lightSettingOverride = 0x1B;
+ globalCtx->envCtx.lightSettingOverride = 27;
func_808C7C04(this);
}
}
@@ -998,127 +1106,134 @@ void func_808C7B88(EnDeath* this, GlobalContext* globalCtx) {
void func_808C7C04(EnDeath* this) {
s32 i;
- Animation_PlayLoop(&this->skelAnime, &D_06001834);
+ Animation_PlayLoop(&this->skelAnime, &object_death_Anim_001834);
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 4;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_4;
}
- this->unk_188 = func_808C7C88;
+ this->actionFunc = func_808C7C88;
this->actor.speedXZ = 0.0f;
}
void func_808C7C88(EnDeath* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x1000, 0x100);
SkelAnime_Update(&this->skelAnime);
+
if (this->actor.params >= 5) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
- func_808C645C(this);
+ globalCtx->envCtx.lightSettingOverride = 26;
+ EnDeath_SetupApproachPlayer(this);
}
}
-void func_808C7CFC(EnDeath* this) {
+void EnDeath_SetupPlayCutscene(EnDeath* this) {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
- this->unk_188 = func_808C7D34;
+ this->actionFunc = EnDeath_PlayCutscene;
}
-void func_808C7D34(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_PlayCutscene(EnDeath* this, GlobalContext* globalCtx) {
+ // Wait for it's turn to play
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
+ // Start playing
ActorCutscene_Start(this->actor.cutscene, &this->actor);
- this->unk_2FA = ActorCutscene_GetCurrentCamera(this->actor.cutscene);
+ this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene);
if (this->actor.colChkInfo.health == 0) {
- func_808C6D40(this, globalCtx);
+ // Death cutscene
+ EnDeath_SetupDeathCutscenePart1(this, globalCtx);
} else {
- func_808C571C(this, globalCtx);
+ // Intro cutscene
+ EnDeath_SetupIntroCutscenePart1(this, globalCtx);
}
} else {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
}
}
-void func_808C7DB8(EnDeath* this) {
- this->unk_188 = func_808C7DCC;
+void EnDeath_SetupBeginWithoutCutscene(EnDeath* this) {
+ this->actionFunc = EnDeath_BeginWithoutCutscene;
}
-void func_808C7DCC(EnDeath* this, GlobalContext* globalCtx) {
- if (Play_InCsMode(globalCtx) == 0) {
- func_808C5310(globalCtx);
- this->unk_808.base.acFlags |= 1;
- func_801A2E54(0x38);
- func_808C645C(this);
+void EnDeath_BeginWithoutCutscene(EnDeath* this, GlobalContext* globalCtx) {
+ if (!Play_InCsMode(globalCtx)) {
+ EnDeath_DimLights(globalCtx);
+ this->coreCollider.base.acFlags |= AC_ON;
+ func_801A2E54(NA_BGM_MINI_BOSS);
+ EnDeath_SetupApproachPlayer(this);
}
}
-void func_808C7E24(EnDeath* this, GlobalContext* globalCtx) {
- if (this->unk_18D != 0) {
- this->unk_320.y += this->unk_308;
- this->unk_308 -= 1.0f;
- this->unk_2F6 += 0x1800;
- if (this->unk_320.y < this->actor.floorHeight) {
- this->unk_320.y = this->actor.floorHeight;
- func_800B3030(globalCtx, &this->unk_320, &gZeroVec3f, &gZeroVec3f, 0x64, 0, 0);
- SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->unk_320, 0xB, 0x3878);
- this->unk_18D = 0;
+void EnDeath_UpdateCore(EnDeath* this, GlobalContext* globalCtx) {
+ if (this->unk_18D) {
+ // Core falling to the ground
+ this->corePos.y += this->coreVelocity;
+ this->coreVelocity -= 1.0f;
+ this->coreRotation += 0x1800;
+ if (this->corePos.y < this->actor.floorHeight) {
+ // Hit the floor
+ this->corePos.y = this->actor.floorHeight;
+ func_800B3030(globalCtx, &this->corePos, &gZeroVec3f, &gZeroVec3f, 100, 0, 0);
+ SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->corePos, 11, NA_SE_EN_EXTINCT);
+ this->unk_18D = false;
}
}
}
-void func_808C7EDC(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_UpdateDamage(EnDeath* this, GlobalContext* globalCtx) {
s32 i;
if (this->unk_2F8 > 0) {
this->unk_2F8--;
}
- if (this->unk_808.base.acFlags & 2) {
- this->unk_808.base.acFlags &= 0xFFFD;
+ if (this->coreCollider.base.acFlags & AC_HIT) {
+ this->coreCollider.base.acFlags &= ~AC_HIT;
if (this->actor.params >= 5) {
- this->unk_18D = 1;
- this->unk_308 = -1.0f;
- this->unk_2F6 = this->actor.shape.rot.y;
- Math_Vec3s_ToVec3f(&this->unk_320, &this->unk_808.dim.worldSphere.center);
- SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->unk_320, 0x1E, 0x3842);
+ this->unk_18D = true;
+ this->coreVelocity = -1.0f;
+ this->coreRotation = this->actor.shape.rot.y;
+ Math_Vec3s_ToVec3f(&this->corePos, &this->coreCollider.dim.worldSphere.center);
+ SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->corePos, 30, NA_SE_EN_FFLY_DEAD);
- if (this->actor.colChkInfo.damageEffect == 4 && this->unk_188 != func_808C7B88) {
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 1;
+ if (this->actor.colChkInfo.damageEffect == DMGEFF_LIGHT_ARROW && this->actionFunc != func_808C7B88) {
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_1;
}
- globalCtx->envCtx.lightSettingOverride = 0x1C;
+ globalCtx->envCtx.lightSettingOverride = 28;
- this->unk_2FC = 0x14;
- if (this->unk_188 == func_808C64DC) {
- this->unk_2EE = 0x64;
+ this->unk_2FC = 20;
+ if (this->actionFunc == EnDeath_ApproachPlayer) {
+ this->actionTimer = 100;
}
- } else if (this->actor.colChkInfo.damageEffect == 0xF) {
+ } else if (this->actor.colChkInfo.damageEffect == DMGEFF_EXPLOSIVES) {
this->unk_2F8 = 0xA;
}
- } else if (this->actor.colChkInfo.damageEffect != 0xF || this->unk_2F8 == 0) {
- this->unk_18C = 0;
- this->unk_788.base.atFlags &= 0xFFFE;
- this->unk_808.base.acFlags &= 0xFFFE;
+ } else if (this->actor.colChkInfo.damageEffect != DMGEFF_EXPLOSIVES || this->unk_2F8 == 0) {
+ this->unk_18C = false;
+ this->unk_788.base.atFlags &= ~AT_ON;
+ this->coreCollider.base.acFlags &= ~AC_ON;
- if (this->actor.colChkInfo.damageEffect == 4) {
- this->unk_31C = 3.0f;
- this->unk_314 = 0.8f;
- this->unk_18F = 0x14;
- Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->unk_808.info.bumper.hitPos.x,
- this->unk_808.info.bumper.hitPos.y, this->unk_808.info.bumper.hitPos.z, 0, 0, 0, 4);
+ if (this->actor.colChkInfo.damageEffect == DMGEFF_LIGHT_ARROW) {
+ this->dmgEffectAlpha = 3.0f;
+ this->dmgEffectScale = 0.8f;
+ this->dmgEffect = ACTOR_DRAW_DMGEFF_LIGHT_ORBS;
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG,
+ this->coreCollider.info.bumper.hitPos.x, this->coreCollider.info.bumper.hitPos.y,
+ this->coreCollider.info.bumper.hitPos.z, 0, 0, 0, 4);
}
- if (globalCtx->envCtx.lightSettingOverride == 0x1B) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
+ if (globalCtx->envCtx.lightSettingOverride == 27) {
+ globalCtx->envCtx.lightSettingOverride = 26;
}
this->actor.shape.rot.x = 0;
if (Actor_ApplyDamage(&this->actor) == 0) {
Enemy_StartFinishingBlow(globalCtx, &this->actor);
- func_801A2ED8();
- func_808C7CFC(this);
+ func_801A2ED8(); // Stop miniboss BGM
+ EnDeath_SetupPlayCutscene(this);
} else {
- for (i = 0; i < ARRAY_COUNT(this->unk_6E4); i++) {
- this->unk_6E4[i]->params = 2;
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ this->miniDeaths[i]->actor.params = MINIDEATH_ACTION_2;
}
-
- func_808C6C5C(this);
+ EnDeath_SetupDamaged(this);
}
}
}
@@ -1126,150 +1241,142 @@ void func_808C7EDC(EnDeath* this, GlobalContext* globalCtx) {
void EnDeath_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDeath* this = THIS;
- UnkActor* unkActor;
+ ArrowLight* lightArrow;
s32 pad;
if (this->unk_2FC > 0) {
this->unk_2FC--;
- unkActor = (UnkActor*)SubS_FindActor(globalCtx, NULL, 7, 0x7F);
- if (unkActor != NULL) {
- unkActor->unk_15C = -100.0f;
+
+ lightArrow = (ArrowLight*)SubS_FindActor(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_ARROW_LIGHT);
+ if (lightArrow != NULL) {
+ lightArrow->screenFillIntensity = -100.0f;
}
+
if (this->unk_2FC == 0) {
- globalCtx->envCtx.lightSettingOverride = 0x1A;
+ globalCtx->envCtx.lightSettingOverride = 26;
}
}
- func_808C7EDC(this, globalCtx);
- func_808C7E24(this, globalCtx);
- if (this->unk_188 != func_808C6AB0) {
+
+ EnDeath_UpdateDamage(this, globalCtx);
+ EnDeath_UpdateCore(this, globalCtx);
+ if (this->actionFunc != EnDeath_SpinAttack) {
Math_ScaledStepToS(&this->unk_2F2, 0, 0x800);
Math_ScaledStepToS(&this->unk_2F4, 0, 0x800);
}
- this->unk_188(this, globalCtx);
- if (this->unk_188 != func_808C6CDC) {
+ this->actionFunc(this, globalCtx);
+
+ if (this->actionFunc != EnDeath_Damaged) {
this->actor.world.rot.y = this->actor.shape.rot.y;
}
Actor_MoveWithGravity(&this->actor);
- Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, (this->unk_188 == func_808C6AB0) ? 50.0f : 100.0f, 40.0f,
- 7);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, (this->actionFunc == EnDeath_SpinAttack) ? 50.0f : 100.0f,
+ 40.0f, 4 | 2 | 1);
- this->unk_73C.dim.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * 3.0f;
- this->unk_73C.dim.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * 3.0f;
- this->unk_73C.dim.pos.y = this->actor.world.pos.y;
+ this->bodyCollider.dim.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * 3.0f;
+ this->bodyCollider.dim.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * 3.0f;
+ this->bodyCollider.dim.pos.y = this->actor.world.pos.y;
if (this->actor.params < 5) {
- this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius + 5;
+ this->coreCollider.dim.worldSphere.radius = this->coreCollider.dim.modelSphere.radius + 5;
} else {
- this->unk_808.dim.worldSphere.radius = this->unk_808.dim.modelSphere.radius;
+ this->coreCollider.dim.worldSphere.radius = this->coreCollider.dim.modelSphere.radius;
}
- if (this->unk_188 != func_808C7AAC) {
- CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_73C.base);
+ if (this->actionFunc != EnDeath_Dead) {
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
}
- if (this->unk_808.base.acFlags & 1) {
- CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_808.base);
+ if (this->coreCollider.base.acFlags & AC_ON) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->coreCollider.base);
}
- if (this->unk_788.base.atFlags & 1) {
+ if (this->unk_788.base.atFlags & AT_ON) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_788.base);
}
- if (this->unk_188 == func_808C692C || this->unk_188 == func_808C6AB0) {
+ if (this->actionFunc == EnDeath_BlockProjectile || this->actionFunc == EnDeath_SpinAttack) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_860.base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_860.base);
}
- if (this->unk_31C > 0.0f) {
- if (this->unk_18F != 0xA) {
- Math_StepToF(&this->unk_31C, 0.0f, 0.05f);
- this->unk_314 = (this->unk_31C + 1.0f) * 0.4f;
+ if (this->dmgEffectAlpha > 0.0f) {
+ if (this->dmgEffect != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
+ Math_StepToF(&this->dmgEffectAlpha, 0.0f, 0.05f);
+ this->dmgEffectScale = (this->dmgEffectAlpha + 1.0f) * 0.4f;
- this->unk_314 = CLAMP_MAX(this->unk_314, 0.8f);
-
- return;
- }
- if (Math_StepToF(&this->unk_318, 0.8f, 0.02f) == 0) {
- func_800B9010(&this->actor, 0x20B2);
+ this->dmgEffectScale = CLAMP_MAX(this->dmgEffectScale, 0.8f);
+ } else if (Math_StepToF(&this->dmgEffectSteamScale, 0.8f, 0.02f) == 0) {
+ func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
}
}
-#ifdef NON_MATCHING
-// single reodering, stack
-void func_808C84A4(EnDeath* this, GlobalContext* globalCtx) {
- Gfx* phi_s0;
- s32 phi_s2;
- s32 phi_s3;
- s32 phi_s4;
+void EnDeath_DrawScytheSpinning(EnDeath* this, GlobalContext* globalCtx) {
+ s32 i;
+ Gfx* dl;
+ s32 pad;
func_800B8118(&this->actor, globalCtx, 0);
Scene_SetRenderModeXlu(globalCtx, 1, 2);
OPEN_DISPS(globalCtx->state.gfxCtx);
+ dl = POLY_XLU_DISP;
- phi_s0 = POLY_XLU_DISP;
-
- for (phi_s2 = 1, phi_s3 = 0xDC, phi_s4 = 0x2100; phi_s2 < this->unk_190;
- phi_s2++, phi_s3 -= 0x23, phi_s4 += 0x2100) {
- gDPPipeSync(phi_s0++);
- gDPSetEnvColor(phi_s0++, 30, 30, 0, phi_s3);
+ for (i = 1; i < this->numScytheAfterImages; i++) {
+ gDPPipeSync(dl++);
+ gDPSetEnvColor(dl++, 30, 30, 0, 255 - i * 35);
Matrix_SetCurrentState(&this->unk_6A4);
- Matrix_InsertXRotation_s(phi_s4, 1);
+ Matrix_InsertXRotation_s(i * 0x2100, MTXMODE_APPLY);
- gSPMatrix(phi_s0++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(phi_s0++, D_06006F88);
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, object_death_DL_006F88); // scythe handle
- Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, 1);
- Matrix_InsertRotation(-0x4000, 0, -0x4000, 1);
+ Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
+ Matrix_InsertRotation(-0x4000, 0, -0x4000, MTXMODE_APPLY);
- gSPMatrix(phi_s0++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(phi_s0++, D_060073D0);
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, object_death_DL_0073D0); // scythe blade
}
- POLY_XLU_DISP = phi_s0;
+ POLY_XLU_DISP = dl;
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-#else
-void func_808C84A4(EnDeath* this, GlobalContext* globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C84A4.s")
-#endif
-void func_808C8690(EnDeath* this, GlobalContext* globalCtx) {
+void EnDeath_DrawScythe(EnDeath* this, GlobalContext* globalCtx) {
Gfx* dl;
s32 pad;
- if (this->unk_188 == func_808C7AAC) {
+ if (this->actionFunc == EnDeath_Dead) {
func_800B8118(&this->actor, globalCtx, 0);
Scene_SetRenderModeXlu(globalCtx, 1, 2);
}
OPEN_DISPS(globalCtx->state.gfxCtx);
- if (this->unk_188 == func_808C7AAC) {
+ if (this->actionFunc == EnDeath_Dead) {
dl = POLY_XLU_DISP;
gDPPipeSync(dl++);
- gDPSetEnvColor(dl++, 30, 30, 0, this->unk_2EE);
+ gDPSetEnvColor(dl++, 30, 30, 0, this->actionTimer);
} else {
dl = POLY_OPA_DISP;
}
Matrix_SetCurrentState(&this->unk_6A4);
- Matrix_Scale(this->unk_304, this->unk_304, this->unk_304, 1);
+ Matrix_Scale(this->scytheScale, this->scytheScale, this->scytheScale, MTXMODE_APPLY);
gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(&dl[1], D_06006F88);
+ gSPDisplayList(&dl[1], object_death_DL_006F88); // scythe handle
- Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, 1);
- Matrix_InsertRotation(-0x4000, 0, -0x4000, 1);
+ Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
+ Matrix_InsertRotation(-0x4000, 0, -0x4000, MTXMODE_APPLY);
gSPMatrix(&dl[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(&dl[3], D_060073D0);
+ gSPDisplayList(&dl[3], object_death_DL_0073D0); // scythe blade
- Matrix_GetStateTranslation(&this->unk_32C);
+ Matrix_GetStateTranslation(&this->scytheWorldPos);
- if (this->unk_188 == func_808C7AAC) {
+ if (this->actionFunc == EnDeath_Dead) {
POLY_XLU_DISP = &dl[4];
} else {
POLY_OPA_DISP = &dl[4];
@@ -1278,143 +1385,338 @@ void func_808C8690(EnDeath* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void func_808C882C(EnDeath* this, GlobalContext* globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C882C.s")
-
-void func_808C8D18(EnDeath* this, GlobalContext* globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C8D18.s")
-
-void func_808C9160(EnDeath* this, GlobalContext* globalCtx) {
- s32 pad;
+void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
+ // Each bat is animated by cycling through these display lists
+ static Gfx* sMinideathDLs[MINIDEATH_ANIM_LENGTH] = {
+ gGomessBatFrame1DL, gGomessBatFrame2DL, gGomessBatFrame3DL, gGomessBatFrame4DL, gGomessBatFrame5DL,
+ gGomessBatFrame6DL, gGomessBatFrame7DL, gGomessBatFrame8DL, gGomessBatFrame9DL,
+ };
+ EnMinideath* miniDeath;
+ MtxF* cmf;
+ f32 phi_fs2;
+ MiniDeathStruct* phi_s0;
+ s32 j;
+ f32 scale;
Gfx* dl;
+ s32 i;
+ Vec3f sp9C;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+ dl = POLY_OPA_DISP;
+
+ gSPDisplayList(dl++, &sSetupDL[0x19 * 6]);
+ gSPDisplayList(dl++, gGomessBatMaterialDL);
+
+ cmf = Matrix_GetCurrentState();
+
+ if (this->actionFunc == EnDeath_Dead) {
+ phi_fs2 = this->actionTimer * 0.000035f;
+ scale = 0.007f;
+ if (phi_fs2 > 0.007f) {
+ phi_fs2 = 0.007f;
+ scale = 0.007f;
+ }
+ } else {
+ phi_fs2 = 0.007f;
+ scale = 0.007f;
+ }
+
+ if (this->actor.flags & ACTOR_FLAG_1000) {
+ Math_Vec3f_Copy(&sp9C, &globalCtx->mainCamera.skyboxOffset);
+ } else {
+ Math_Vec3f_Copy(&sp9C, &gZeroVec3f);
+ }
+
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ if (this->actionFunc == EnDeath_BeginWithoutCutscene ||
+ (this->miniDeaths[i]->actor.flags & ACTOR_FLAG_40) == ACTOR_FLAG_40) {
+ miniDeath = this->miniDeaths[i];
+
+ Matrix_InsertRotation(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
+ Matrix_Scale(phi_fs2, phi_fs2, phi_fs2, MTXMODE_APPLY);
+
+ for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
+ if (phi_s0->unk_1 == 0) {
+ cmf->mf[3][0] = phi_s0->unk_4.x + sp9C.x;
+ cmf->mf[3][1] = phi_s0->unk_4.y + sp9C.y;
+ cmf->mf[3][2] = phi_s0->unk_4.z + sp9C.z;
+
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, sMinideathDLs[phi_s0->animFrame]);
+ }
+ }
+
+ for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
+ if (phi_s0->unk_1 == 1) {
+ Matrix_InsertRotation(0x4000, phi_s0->unk_1E, 0, MTXMODE_NEW);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ cmf->mf[3][0] = phi_s0->unk_4.x + sp9C.x;
+ cmf->mf[3][1] = phi_s0->unk_4.y + sp9C.y;
+ cmf->mf[3][2] = phi_s0->unk_4.z + sp9C.z;
+
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, sMinideathDLs[phi_s0->animFrame]);
+ }
+ }
+ }
+ }
+
+ if (this->unk_192) {
+ for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
+ miniDeath = this->miniDeaths[i];
+
+ Matrix_InsertRotation(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
+ Matrix_Scale(phi_fs2, phi_fs2, phi_fs2, MTXMODE_APPLY);
+
+ for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
+ cmf->mf[3][0] = miniDeath->actor.world.pos.x - phi_s0->unk_10.x;
+ cmf->mf[3][1] = miniDeath->actor.world.pos.y + (20.0f - phi_s0->unk_10.y);
+ cmf->mf[3][2] = miniDeath->actor.world.pos.z - phi_s0->unk_10.z;
+
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, sMinideathDLs[phi_s0->animFrame]);
+ }
+ }
+ }
+
+ if (this->unk_18D) {
+ Matrix_InsertRotation(0x4000, this->coreRotation, 0, MTXMODE_NEW);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ cmf->mf[3][0] = this->corePos.x + sp9C.x;
+ cmf->mf[3][1] = this->corePos.y + sp9C.y;
+ cmf->mf[3][2] = this->corePos.z + sp9C.z;
+
+ gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, sMinideathDLs[0]);
+ }
+
+ POLY_OPA_DISP = dl;
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void EnDeath_DrawFlames(EnDeath* this, GlobalContext* globalCtx2) {
+ GlobalContext* globalCtx = globalCtx2;
+ s32 phi_t1;
+ MtxF* cmf;
+ s32 phi_s7;
+ u8* phi_s3;
+ Vec3f* phi_s1;
+ MiniDeathStruct* phi_s1_2;
+ u8 alpha;
+ s32 phi_s3_2;
+
+ phi_s7 = this->actionTimer * 7;
+ if (phi_s7 > ARRAY_COUNT(this->unk_1A9)) {
+ phi_s7 = ARRAY_COUNT(this->unk_1A9);
+ }
OPEN_DISPS(globalCtx->state.gfxCtx);
- dl = POLY_OPA_DISP;
- Matrix_NormalizeXYZ(&globalCtx->billboardMtxF);
+ gDPSetEnvColor(POLY_XLU_DISP++, 230, 135, 25, 0);
- gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(&dl[1], D_06009988);
+ Matrix_SetCurrentState(&globalCtx->billboardMtxF);
+ Matrix_Scale(0.00405f, 0.003f, 0.00405f, MTXMODE_APPLY);
- if (this->actor.params >= 5) {
- gSPDisplayList(&dl[2], D_06009BA0);
- POLY_OPA_DISP = dl + 3;
+ cmf = Matrix_GetCurrentState();
+
+ phi_s1 = this->unk_404;
+ phi_s3 = this->unk_1A9;
+ for (phi_t1 = 0; phi_t1 < phi_s7; phi_t1++) {
+ if (*phi_s3 > 0) {
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 165, 255, 215, *phi_s3);
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
+ ((globalCtx->gameplayFrames + (phi_t1 * 10)) * -20) & 0x1FF, 32, 128));
+
+ cmf->mf[3][0] = phi_s1->x;
+ cmf->mf[3][1] = phi_s1->y;
+ cmf->mf[3][2] = phi_s1->z;
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL);
+ }
+ phi_s1++;
+ phi_s3++;
+ }
+
+ Matrix_SetCurrentState(&globalCtx->billboardMtxF);
+ Matrix_Scale(0.00405f, 0.003f, 0.00405f, MTXMODE_APPLY);
+
+ if (this->actionFunc == EnDeath_Dead) {
+ alpha = this->actionTimer;
} else {
- POLY_OPA_DISP = dl + 2;
+ alpha = 255;
+ }
+
+ for (phi_t1 = 0; phi_t1 < ARRAY_COUNT(this->miniDeaths); phi_t1++) {
+ if ((this->miniDeaths[phi_t1]->actor.flags & ACTOR_FLAG_40) == ACTOR_FLAG_40) {
+ phi_s1_2 = this->miniDeaths[phi_t1]->unk_160;
+
+ for (phi_s3_2 = 0; phi_s3_2 < ARRAY_COUNT(this->miniDeaths[phi_t1]->unk_160); phi_s3_2++, phi_s1_2++) {
+ cmf->mf[3][0] = phi_s1_2->unk_4.x;
+ cmf->mf[3][1] = phi_s1_2->unk_4.y - 12.0f;
+ cmf->mf[3][2] = phi_s1_2->unk_4.z;
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 165, 255, 215, alpha);
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
+ ((globalCtx->gameplayFrames + ((phi_s3_2 + phi_t1) * 10)) * -20) & 511, 32,
+ 128));
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL);
+ }
+ }
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-s32 func_808C9220(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+void EnDeath_DrawCore(EnDeath* this, GlobalContext* globalCtx) {
+ s32 pad;
+ Gfx* dl;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+ dl = POLY_OPA_DISP;
+
+ Matrix_NormalizeXYZ(&globalCtx->billboardMtxF);
+
+ gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&dl[1], gGomessCoreDL);
+
+ if (this->actor.params >= 5) {
+ // bats in front of the core
+ gSPDisplayList(&dl[2], gGomessBatsGuardingCoreDL);
+ POLY_OPA_DISP = &dl[3];
+ } else {
+ POLY_OPA_DISP = &dl[2];
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+s32 EnDeath_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx) {
EnDeath* this = THIS;
f32 temp_f12;
s32 temp_v0;
if (this->unk_193[limbIndex] == 1) {
*dList = NULL;
- } else if (limbIndex == 0xD && this->unk_188 == func_808C74F8) {
- temp_v0 = this->unk_2EE - 5;
+ } else if (limbIndex == GOMESS_LIMB_CLOAK_LOWER && this->actionFunc == EnDeath_DeathCutscenePart3) {
+ temp_v0 = this->actionTimer - 5;
if (temp_v0 > 0) {
temp_f12 = 1.0f - (temp_v0 * 0.1f);
- Matrix_Scale(temp_f12, temp_f12, temp_f12, 1);
+ Matrix_Scale(temp_f12, temp_f12, temp_f12, MTXMODE_APPLY);
}
}
- if (limbIndex == 0x14 || limbIndex == 0x15) {
- if (this->unk_18E == 0) {
+ if (limbIndex == GOMESS_LIMB_SCYTHE_HANDLE || limbIndex == GOMESS_LIMB_SCYTHE_BLADE) {
+ if (!this->unk_18E) {
*dList = NULL;
}
- } else if (limbIndex == 0xC) {
+ } else if (limbIndex == GOMESS_LIMB_CLOAK_UPPER) {
rot->z = rot->z + this->unk_2F2;
- } else if (limbIndex == 0xD) {
+ } else if (limbIndex == GOMESS_LIMB_CLOAK_LOWER) {
rot->z = rot->z + this->unk_2F4;
}
return 0;
}
-#ifdef NON_MATCHING
-// A lot towards the bottom, original wants to mult but mine optimizes to shifts
-void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ static Vec3f D_808C9AF4 = { -1000.0f, 12000.0f, 0.0f };
+ static Vec3f D_808C9B00 = { -2000.0f, -2500.0f, 0.0f };
+ static Vec3f D_808C9B0C[5] = {
+ { 1000.0f, 2000.0f, 0.0f }, { 1500.0f, 1000.0f, 4000.0f }, { 1500.0f, 1000.0f, -4000.0f },
+ { 4000.0f, 4000.0f, 2000.0f }, { 4000.0f, 4000.0f, -2000.0f },
+ };
+ static s8 D_808C9B48[GOMESS_LIMB_MAX] = { -1, -1, -1, 12, -1, 0, -1, -1, -1, -1, -1,
+ -1, -1, 7, 1, 2, 3, 4, 5, 6, -1, -1 };
EnDeath* this = THIS;
- Vec3f sp6C;
- Vec3f sp60;
- Vec3f sp54;
- Vec3f sp48;
- s32 sp44;
- f32 temp_f0;
- s32 temp_s0;
- s32 temp_v0_2;
- s8 temp_v1;
- s32 phi_v0;
- Vec3f* phi_s1;
- Vec3f* phi_s0;
+ s8 index;
- if (limbIndex == 0x15) {
- Matrix_GetStateTranslation(&this->unk_32C);
- if ((this->unk_788.base.atFlags & 1) && this->unk_2EC != this->unk_2EE) {
- Math_Vec3f_Copy(&sp6C, &this->unk_788.dim.quad[0]);
- Math_Vec3f_Copy(&sp60, &this->unk_788.dim.quad[1]);
- if (this->unk_188 == func_808C682C) {
- Matrix_GetStateTranslationAndScaledX(6000.0f, &sp54);
- Matrix_MultiplyVector3fByState(&D_808C9AF4, &sp48);
+ if (limbIndex == GOMESS_LIMB_SCYTHE_BLADE) {
+ Matrix_GetStateTranslation(&this->scytheWorldPos);
+
+ if ((this->unk_788.base.atFlags & AT_ON) && this->unk_2EC != this->actionTimer) {
+ Vec3f quad0;
+ Vec3f quad1;
+ Vec3f pos1;
+ Vec3f pos2;
+
+ Math_Vec3f_Copy(&quad0, &this->unk_788.dim.quad[0]);
+ Math_Vec3f_Copy(&quad1, &this->unk_788.dim.quad[1]);
+
+ if (this->actionFunc == EnDeath_EndSwingAttack) {
+ Matrix_GetStateTranslationAndScaledX(6000.0f, &pos1);
+ Matrix_MultiplyVector3fByState(&D_808C9AF4, &pos2);
} else {
- Matrix_GetStateTranslationAndScaledY(5000.0f, &sp48);
- Matrix_MultiplyVector3fByState(&D_808C9B00, &sp54);
+ Matrix_GetStateTranslationAndScaledY(5000.0f, &pos2);
+ Matrix_MultiplyVector3fByState(&D_808C9B00, &pos1);
}
- Collider_SetQuadVertices(&this->unk_788, &sp48, &sp54, &sp6C, &sp60);
- EffectBlure_AddVertex(Effect_GetByIndex(this->unk_300), &sp54, &sp48);
- this->unk_2EC = this->unk_2EE;
- } else if (this->unk_18C != 0) {
- if (this->unk_188 == func_808C682C) {
+
+ Collider_SetQuadVertices(&this->unk_788, &pos2, &pos1, &quad0, &quad1);
+ EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &pos1, &pos2);
+
+ this->unk_2EC = this->actionTimer;
+ } else if (this->unk_18C) {
+ if (this->actionFunc == EnDeath_EndSwingAttack) {
Matrix_GetStateTranslationAndScaledX(6000.0f, &this->unk_788.dim.quad[1]);
Matrix_MultiplyVector3fByState(&D_808C9AF4, &this->unk_788.dim.quad[0]);
} else {
Matrix_GetStateTranslationAndScaledY(5000.0f, &this->unk_788.dim.quad[0]);
Matrix_MultiplyVector3fByState(&D_808C9B00, &this->unk_788.dim.quad[1]);
}
- this->unk_18C = 0;
- this->unk_788.base.atFlags |= 1;
- this->unk_2EC = this->unk_2EE;
+ this->unk_18C = false;
+ this->unk_788.base.atFlags |= AT_ON;
+ this->unk_2EC = this->actionTimer;
}
- } else if (limbIndex == 2 && this->unk_188 != func_808C7AAC) {
+ } else if (limbIndex == GOMESS_LIMB_CORE_POS && this->actionFunc != EnDeath_Dead) {
Matrix_StatePush();
- func_808C9160(this, globalCtx);
+ EnDeath_DrawCore(this, globalCtx);
Matrix_StatePop();
Matrix_GetStateTranslation(&this->actor.focus.pos);
- this->unk_808.dim.worldSphere.center.x = this->actor.focus.pos.x;
- this->unk_808.dim.worldSphere.center.y = this->actor.focus.pos.y;
- this->unk_808.dim.worldSphere.center.z = this->actor.focus.pos.z;
+
+ this->coreCollider.dim.worldSphere.center.x = this->actor.focus.pos.x;
+ this->coreCollider.dim.worldSphere.center.y = this->actor.focus.pos.y;
+ this->coreCollider.dim.worldSphere.center.z = this->actor.focus.pos.z;
+
if (this->actor.params < 5) {
- this->unk_808.dim.worldSphere.center.y = this->actor.focus.pos.y + 5.0f;
+ this->coreCollider.dim.worldSphere.center.y = this->actor.focus.pos.y + 5.0f;
}
- } else if (limbIndex == 0x14) {
- if (!(this->unk_188 != func_808C6AB0 && this->unk_188 != func_808C692C && this->unk_188 != func_808C6070) ||
- (this->unk_188 == func_808C6F6C && this->unk_18E == 1)) {
+ } else if (limbIndex == GOMESS_LIMB_SCYTHE_HANDLE) {
+ if (!(this->actionFunc != EnDeath_SpinAttack && this->actionFunc != EnDeath_BlockProjectile &&
+ this->actionFunc != EnDeath_IntroCutscenePart5) ||
+ (this->actionFunc == EnDeath_DeathCutscenePart1 && this->unk_18E == true)) {
Matrix_CopyCurrentState(&this->unk_6A4);
}
}
- temp_v1 = D_808C9B48[limbIndex];
- if (temp_v1 != -1) {
- if (temp_v1 < 7) {
- Matrix_GetStateTranslation(&this->unk_35C[temp_v1]);
- return;
- }
- if (temp_v1 == 7) {
- for (phi_v0 = 0; phi_v0 != 5; phi_v0++) {
- Matrix_MultiplyVector3fByState(&D_808C9B0C[phi_v0], &this->unk_35C[phi_v0 + temp_v1]);
+
+ index = D_808C9B48[limbIndex];
+ if (index != -1) {
+ if (index < 7) {
+ // get matrix translation as-is, occupies slots 0, 1, 2, 3, 4, 5, 6
+ Matrix_GetStateTranslation(&this->dmgEffectPositions[index]);
+ } else if (index == 7) {
+ // 5 points using 5 offsets, occupies slots 7, 8, 9, 10, 11
+ s32 i;
+ Vec3f* offset;
+ Vec3f* effPos;
+
+ for (effPos = &this->dmgEffectPositions[index], offset = &D_808C9B0C[0], i = 0;
+ i != ARRAY_COUNT(D_808C9B0C); i++, offset++, effPos++) {
+ Matrix_MultiplyVector3fByState(offset, effPos);
}
- return;
- }
- if (temp_v1 == 0xC) {
- Matrix_GetStateTranslation(&this->unk_35C[temp_v1]);
- Matrix_GetStateTranslationAndScaledY(-2000.0f, &this->unk_35C[temp_v1 + 1]);
+ } else if (index == 12) {
+ // get matrix translation as-is and a point offset by -2000 from it, occupies slots 12, 13
+ Matrix_GetStateTranslation(&this->dmgEffectPositions[index]);
+ Matrix_GetStateTranslationAndScaledY(-2000.0f, &this->dmgEffectPositions[index + 1]);
}
}
}
-#else
-void func_808C9340(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Death/func_808C9340.s")
-#endif
void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDeath* this = THIS;
@@ -1424,35 +1726,36 @@ void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
func_800B8050(&this->actor, globalCtx, 0);
- AnimatedMat_DrawStepOpa(globalCtx, this->unk_734, this->unk_191);
- AnimatedMat_DrawOpa(globalCtx, this->unk_738);
+ AnimatedMat_DrawStepOpa(globalCtx, this->bodyMatAnim, this->unk_191);
+ AnimatedMat_DrawOpa(globalCtx, this->coreMatAnim);
Scene_SetRenderModeXlu(globalCtx, 0, 1);
gDPSetEnvColor(POLY_OPA_DISP++, 30, 30, 0, 255);
- if (this->unk_188 != func_808C7AAC && this->unk_188 != func_808C7888) {
- SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
- func_808C9220, func_808C9340, &this->actor);
+ if (this->actionFunc != EnDeath_Dead && this->actionFunc != EnDeath_DeathCutscenePart4) {
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnDeath_OverrideLimbDraw, EnDeath_PostLimbDraw, &this->actor);
}
- if (this->unk_188 == func_808C7888) {
- func_808C9160(this, globalCtx);
+ if (this->actionFunc == EnDeath_DeathCutscenePart4) {
+ EnDeath_DrawCore(this, globalCtx);
}
- if (this->unk_18E == 0) {
- func_808C8690(this, globalCtx);
+ if (!this->unk_18E) {
+ EnDeath_DrawScythe(this, globalCtx);
}
if (this->actor.colorFilterTimer != 0) {
func_800AE5A0(globalCtx);
}
- Actor_DrawDamageEffects(globalCtx, &this->actor, this->unk_35C, 0xE, this->unk_314, this->unk_318, this->unk_31C, this->unk_18F);
- if (this->unk_188 == func_808C6AB0 || this->unk_188 == func_808C692C) {
- func_808C84A4(this, globalCtx);
+ Actor_DrawDamageEffects(globalCtx, &this->actor, this->dmgEffectPositions, ARRAY_COUNT(this->dmgEffectPositions),
+ this->dmgEffectScale, this->dmgEffectSteamScale, this->dmgEffectAlpha, this->dmgEffect);
+ if (this->actionFunc == EnDeath_SpinAttack || this->actionFunc == EnDeath_BlockProjectile) {
+ EnDeath_DrawScytheSpinning(this, globalCtx);
}
- func_808C882C(this, globalCtx);
- if (this->unk_188 == func_808C7AAC || this->unk_188 == func_808C7888 ||
- (this->unk_188 == func_808C74F8 && this->unk_2EE > 0)) {
- func_808C8D18(this, globalCtx);
+ EnDeath_DrawBats(this, globalCtx);
+ if (this->actionFunc == EnDeath_Dead || this->actionFunc == EnDeath_DeathCutscenePart4 ||
+ (this->actionFunc == EnDeath_DeathCutscenePart3 && this->actionTimer > 0)) {
+ EnDeath_DrawFlames(this, globalCtx);
}
- SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->unk_32C, &this->unk_338);
+ SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->scytheWorldPos, &this->scytheScreenPos);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.h b/src/overlays/actors/ovl_En_Death/z_en_death.h
index e75ae777a..c074b5917 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.h
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.h
@@ -2,6 +2,8 @@
#define Z_EN_DEATH_H
#include "global.h"
+#include "overlays/actors/ovl_En_Minideath/z_en_minideath.h"
+#include "objects/object_death/object_death.h"
struct EnDeath;
@@ -10,52 +12,50 @@ typedef void (*EnDeathActionFunc)(struct EnDeath*, GlobalContext*);
typedef struct EnDeath {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ EnDeathActionFunc unk_188;
+ /* 0x188 */ EnDeathActionFunc actionFunc;
/* 0x18C */ u8 unk_18C;
/* 0x18D */ u8 unk_18D;
/* 0x18E */ u8 unk_18E;
- /* 0x18F */ u8 unk_18F;
- /* 0x190 */ s8 unk_190;
- /* 0x191 */ u8 unk_191;
+ /* 0x18F */ u8 dmgEffect;
+ /* 0x190 */ s8 numScytheAfterImages;
+ /* 0x191 */ u8 unk_191; // animated material color step?
/* 0x192 */ u8 unk_192;
- /* 0x193 */ char unk_193[0x16];
+ /* 0x193 */ u8 unk_193[GOMESS_LIMB_MAX];
/* 0x1A9 */ u8 unk_1A9[56];
- /* 0x1E1 */ char unk_1E1[1]; // likely padding
- /* 0x1E2 */ Vec3s unk_1E2[22];
- /* 0x266 */ Vec3s unk_266[22];
- /* 0x2EA */ s16 unk_2EA;
+ /* 0x1E2 */ Vec3s jointTable[GOMESS_LIMB_MAX];
+ /* 0x266 */ Vec3s morphTable[GOMESS_LIMB_MAX];
+ /* 0x2EA */ s16 floatTimer;
/* 0x2EC */ s16 unk_2EC;
- /* 0x2EE */ s16 unk_2EE;
+ /* 0x2EE */ s16 actionTimer;
/* 0x2F0 */ char unk_2F0[0x2];
/* 0x2F2 */ s16 unk_2F2;
/* 0x2F4 */ s16 unk_2F4;
- /* 0x2F6 */ s16 unk_2F6;
+ /* 0x2F6 */ s16 coreRotation;
/* 0x2F8 */ s16 unk_2F8;
- /* 0x2FA */ s16 unk_2FA;
+ /* 0x2FA */ s16 camId;
/* 0x2FC */ s16 unk_2FC;
- /* 0x2FE */ char unk_2FE[0x2];
- /* 0x300 */ s32 unk_300; // effectIdx
- /* 0x304 */ f32 unk_304;
- /* 0x308 */ f32 unk_308;
- /* 0x30C */ f32 unk_30C;
- /* 0x310 */ f32 unk_310;
- /* 0x314 */ f32 unk_314;
- /* 0x318 */ f32 unk_318;
- /* 0x31C */ f32 unk_31C;
- /* 0x320 */ Vec3f unk_320;
- /* 0x32C */ Vec3f unk_32C;
- /* 0x338 */ Vec3f unk_338;
- /* 0x344 */ Vec3f unk_344;
- /* 0x350 */ Vec3f unk_350;
- /* 0x35C */ Vec3f unk_35C[2]; // TODO size
- /* 0x374 */ char unk_374[0x330];
+ /* 0x300 */ s32 effectIndex;
+ /* 0x304 */ f32 scytheScale;
+ /* 0x308 */ f32 coreVelocity;
+ /* 0x30C */ f32 camEyeSpeed;
+ /* 0x310 */ f32 camAtSpeed;
+ /* 0x314 */ f32 dmgEffectScale;
+ /* 0x318 */ f32 dmgEffectSteamScale;
+ /* 0x31C */ f32 dmgEffectAlpha;
+ /* 0x320 */ Vec3f corePos;
+ /* 0x32C */ Vec3f scytheWorldPos;
+ /* 0x338 */ Vec3f scytheScreenPos;
+ /* 0x344 */ Vec3f camEyeTarget;
+ /* 0x350 */ Vec3f camAtTarget;
+ /* 0x35C */ Vec3f dmgEffectPositions[14];
+ /* 0x404 */ Vec3f unk_404[56];
/* 0x6A4 */ MtxF unk_6A4;
- /* 0x6E4 */ Actor* unk_6E4[20];
- /* 0x734 */ AnimatedMaterial* unk_734;
- /* 0x738 */ AnimatedMaterial* unk_738;
- /* 0x73C */ ColliderCylinder unk_73C;
- /* 0x788 */ ColliderQuad unk_788;
- /* 0x808 */ ColliderSphere unk_808;
+ /* 0x6E4 */ EnMinideath* miniDeaths[20];
+ /* 0x734 */ AnimatedMaterial* bodyMatAnim;
+ /* 0x738 */ AnimatedMaterial* coreMatAnim;
+ /* 0x73C */ ColliderCylinder bodyCollider;
+ /* 0x788 */ ColliderQuad unk_788; // weapon?
+ /* 0x808 */ ColliderSphere coreCollider;
/* 0x860 */ ColliderTris unk_860;
/* 0x880 */ ColliderTrisElement unk_880[2];
} EnDeath; // size = 0x938
diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c
index d5e15c04d..4723c9f61 100644
--- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c
+++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c
@@ -5,6 +5,8 @@
*/
#include "z_en_minideath.h"
+#include "overlays/actors/ovl_En_Death/z_en_death.h"
+#include "objects/object_death/object_death.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10)
@@ -25,10 +27,18 @@ void func_808CB094(EnMinideath* this, GlobalContext* globalCtx);
void func_808CB22C(EnMinideath* this, GlobalContext* globalCtx);
void func_808CB454(EnMinideath* this, GlobalContext* globalCtx);
void func_808CB59C(EnMinideath* this, GlobalContext* globalCtx);
-void func_808CB6D4(EnMinideath* this, GlobalContext* globalCtx);
-void func_808CB7CC(EnMinideath* this, GlobalContext* globalCtx);
+void EnMinideath_Die(EnMinideath* this, GlobalContext* globalCtx);
+void EnMinideath_Dead(EnMinideath* this, GlobalContext* globalCtx);
+
+void func_808CA34C(EnMinideath* this);
+void func_808CA7D4(EnMinideath* this);
+void func_808CA8E0(EnMinideath* this);
+void func_808CAAC8(EnMinideath* this);
+void func_808CAB90(EnMinideath* this);
+void func_808CAE00(EnMinideath* this);
+void func_808CAF08(EnMinideath* this);
+void EnMinideath_SetupDead(EnMinideath* this);
-#if 0
const ActorInit En_Minideath_InitVars = {
ACTOR_EN_MINIDEATH,
ACTORCAT_ENEMY,
@@ -44,59 +54,97 @@ const ActorInit En_Minideath_InitVars = {
// static ColliderJntSphElementInit sJntSphElementsInit[3] = {
static ColliderJntSphElementInit D_808CBF50[3] = {
{
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 1, { { 0, 0, 0 }, 15 }, 100 },
},
{
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 1, { { 0, 0, 0 }, 15 }, 100 },
},
{
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 1, { { 0, 0, 0 }, 15 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_808CBFBC = {
- { COLTYPE_NONE, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_NONE | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- 3, D_808CBF50, // sJntSphElementsInit,
+ {
+ COLTYPE_NONE,
+ AT_NONE | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_NONE | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_808CBF50),
+ D_808CBF50, // sJntSphElementsInit,
};
+typedef enum {
+ DMGEFF_NONE = 0,
+ DMGEFF_STUN = 1,
+ DMGEFF_FIRE_ARROW = 2,
+ DMGEFF_ICE_ARROW = 3,
+ DMGEFF_LIGHT_ARROW = 4,
+ DMGEFF_ZORA_BARRIER = 5
+} EnMinideathDamageEffect;
+
// static DamageTable sDamageTable = {
static DamageTable D_808CBFCC = {
- /* Deku Nut */ DMG_ENTRY(0, 0x1),
- /* Deku Stick */ DMG_ENTRY(1, 0x0),
- /* Horse trample */ DMG_ENTRY(1, 0x0),
- /* Explosives */ DMG_ENTRY(1, 0x0),
- /* Zora boomerang */ DMG_ENTRY(1, 0x0),
- /* Normal arrow */ DMG_ENTRY(1, 0x0),
- /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
- /* Hookshot */ DMG_ENTRY(1, 0x0),
- /* Goron punch */ DMG_ENTRY(1, 0x0),
- /* Sword */ DMG_ENTRY(1, 0x0),
- /* Goron pound */ DMG_ENTRY(0, 0x0),
- /* Fire arrow */ DMG_ENTRY(1, 0x2),
- /* Ice arrow */ DMG_ENTRY(1, 0x3),
- /* Light arrow */ DMG_ENTRY(2, 0x4),
- /* Goron spikes */ DMG_ENTRY(1, 0x0),
- /* Deku spin */ DMG_ENTRY(1, 0x0),
- /* Deku bubble */ DMG_ENTRY(1, 0x0),
- /* Deku launch */ DMG_ENTRY(2, 0x0),
- /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1),
- /* Zora barrier */ DMG_ENTRY(1, 0x5),
- /* Normal shield */ DMG_ENTRY(0, 0x0),
- /* Light ray */ DMG_ENTRY(0, 0x0),
- /* Thrown object */ DMG_ENTRY(1, 0x0),
- /* Zora punch */ DMG_ENTRY(1, 0x0),
- /* Spin attack */ DMG_ENTRY(1, 0x0),
- /* Sword beam */ DMG_ENTRY(0, 0x0),
- /* Normal Roll */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
- /* Unblockable */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
- /* Powder Keg */ DMG_ENTRY(1, 0x0),
+ /* Deku Nut */ DMG_ENTRY(0, DMGEFF_STUN),
+ /* Deku Stick */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Horse trample */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Explosives */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Zora boomerang */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Normal arrow */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* UNK_DMG_0x06 */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Hookshot */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Goron punch */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Sword */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Goron pound */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Fire arrow */ DMG_ENTRY(1, DMGEFF_FIRE_ARROW),
+ /* Ice arrow */ DMG_ENTRY(1, DMGEFF_ICE_ARROW),
+ /* Light arrow */ DMG_ENTRY(2, DMGEFF_LIGHT_ARROW),
+ /* Goron spikes */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Deku spin */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Deku bubble */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Deku launch */ DMG_ENTRY(2, DMGEFF_NONE),
+ /* UNK_DMG_0x12 */ DMG_ENTRY(0, DMGEFF_STUN),
+ /* Zora barrier */ DMG_ENTRY(1, DMGEFF_ZORA_BARRIER),
+ /* Normal shield */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Light ray */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Thrown object */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Zora punch */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Spin attack */ DMG_ENTRY(1, DMGEFF_NONE),
+ /* Sword beam */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Normal Roll */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1B */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1C */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Unblockable */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* UNK_DMG_0x1E */ DMG_ENTRY(0, DMGEFF_NONE),
+ /* Powder Keg */ DMG_ENTRY(1, DMGEFF_NONE),
};
// sColChkInfoInit
@@ -108,80 +156,754 @@ static InitChainEntry D_808CBFF4[] = {
ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP),
};
-#endif
+static s32 sItemDropTimer;
+s32 D_808CC254;
+s32 D_808CC258;
+s32 D_808CC25C;
-extern ColliderJntSphElementInit D_808CBF50[3];
-extern ColliderJntSphInit D_808CBFBC;
-extern DamageTable D_808CBFCC;
-extern CollisionCheckInfoInit D_808CBFEC;
-extern InitChainEntry D_808CBFF4[];
+void EnMinideath_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnMinideath* this = THIS;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/EnMinideath_Init.s")
+ Actor_ProcessInitChain(thisx, D_808CBFF4);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/EnMinideath_Destroy.s")
+ this->unk_158 = thisx->world.pos.y - thisx->parent->world.pos.y;
+ this->spawnShapeRot = thisx->shape.rot.y;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA268.s")
+ thisx->shape.rot.y = thisx->parent->shape.rot.y;
+ thisx->world.rot.y = thisx->parent->shape.rot.y;
+ thisx->flags &= ~ACTOR_FLAG_1;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA308.s")
+ Collider_InitAndSetJntSph(globalCtx, &this->collider, thisx, &D_808CBFBC, this->colliderElements);
+ CollisionCheck_SetInfo(&thisx->colChkInfo, &D_808CBFCC, &D_808CBFEC);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA34C.s")
+ for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) {
+ this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA458.s")
+ func_808CA34C(this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA7D4.s")
+ this->number = thisx->params;
+ thisx->params = 0;
+ this->unk_149 = false;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA860.s")
+ if (gSaveContext.eventInf[6] & 8) {
+ this->collider.base.atFlags |= AT_ON;
+ this->unk_149 = true;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA8E0.s")
+ func_808CABB0(this, globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CA8F4.s")
+ for (i = 0; i < ARRAY_COUNT(this->unk_160); i++) {
+ Math_Vec3f_Sum(&thisx->world.pos, &this->unk_160[i].unk_10, &this->unk_160[i].unk_4);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAAC8.s")
+ func_808CAB90(this);
+ } else {
+ func_808CA7D4(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAAEC.s")
+void EnMinideath_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnMinideath* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAB90.s")
+ Collider_DestroyJntSph(globalCtx, &this->collider);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CABB0.s")
+void EnMinideath_DropCollectible(Vec3f* spawnPos, GlobalContext* globalCtx) {
+ if (sItemDropTimer == 0 && Rand_ZeroOne() < 0.3f) {
+ if (Rand_ZeroOne() < 0.5f) {
+ Item_DropCollectible(globalCtx, spawnPos, ITEM00_ARROWS_10);
+ } else {
+ Item_DropCollectible(globalCtx, spawnPos, ITEM00_MAGIC_LARGE);
+ }
+ sItemDropTimer = 800; // wait 40 seconds before next drop
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAC54.s")
+void func_808CA308(EnMinideath* this, s32 arg1) {
+ if (this->unk_149 != arg1) {
+ this->unk_149 = arg1;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CACD8.s")
+ if (arg1 == true) {
+ this->actor.parent->params++;
+ } else {
+ this->actor.parent->params--;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAE00.s")
+void func_808CA34C(EnMinideath* this) {
+ MiniDeathStruct* phi_s0;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAE18.s")
+ for (phi_s0 = this->unk_160, i = 0; i < ARRAY_COUNT(this->unk_160); i++, phi_s0++) {
+ phi_s0->unk_10.x = randPlusMinusPoint5Scaled(80.0f);
+ phi_s0->unk_10.y = Rand_ZeroFloat(40.0f);
+ phi_s0->unk_10.z = randPlusMinusPoint5Scaled(80.0f);
+ phi_s0->animFrame = (s32)Rand_ZeroFloat(9.0f) % MINIDEATH_ANIM_LENGTH;
+ phi_s0->unk_1C = (Rand_Next() >> 17);
+ phi_s0->unk_1E = (Rand_Next() >> 16);
+ phi_s0->unk_1 = 0;
+ phi_s0->unk_22 = 0;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAF08.s")
+void func_808CA458(EnMinideath* this, GlobalContext* globalCtx) {
+ s16 temp_s1;
+ MiniDeathStruct* phi_s0;
+ f32 phi_fv0;
+ f32 phi_fa0;
+ s32 i;
+ s32 phi_s7;
+ s32 phi_s3;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CAF68.s")
+ phi_s3 = 0;
+ phi_s7 = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB07C.s")
+ phi_s0 = this->unk_160;
+ for (i = 0; i < ARRAY_COUNT(this->unk_160); i++, phi_s0++) {
+ if (phi_s0->unk_1 == 0) {
+ phi_s0->unk_10.x += 3.0f * Math_CosS(phi_s0->unk_1C) * Math_SinS(phi_s0->unk_1E);
+ phi_s0->unk_10.y += 3.0f * Math_SinS(phi_s0->unk_1C);
+ phi_s0->unk_10.z += 3.0f * Math_CosS(phi_s0->unk_1C) * Math_CosS(phi_s0->unk_1E);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB094.s")
+ if (this->actionFunc == func_808CA860) {
+ phi_fv0 = 100.0f;
+ phi_fa0 = SQ(phi_fv0);
+ } else if (this->actionFunc == func_808CB094 || this->actionFunc == func_808CB454) {
+ phi_fv0 = 20.0f;
+ phi_fa0 = SQ(20.0f);
+ } else {
+ phi_fv0 = 40.0f;
+ phi_fa0 = SQ(40.0f);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB0C8.s")
+ if (phi_s0->unk_10.y < 0.0f || phi_fv0 < phi_s0->unk_10.y ||
+ phi_fa0 < SQ(phi_s0->unk_10.x) + SQ(phi_s0->unk_10.z)) {
+ temp_s1 = Math_FAtan2F(sqrtf(SQ(phi_s0->unk_10.x) + SQ(phi_s0->unk_10.z)), phi_s0->unk_10.y);
+ phi_s0->unk_1C = -1 * temp_s1 + (Rand_Next() >> 19);
+ temp_s1 = Math_FAtan2F(phi_s0->unk_10.z, phi_s0->unk_10.x);
+ phi_s0->unk_1E = temp_s1 + (Rand_Next() >> 19) + 0x8000;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB22C.s")
+ phi_s3++;
+ } else if (phi_s0->unk_1 == 1) {
+ phi_s0->unk_4.y += phi_s0->unk_10.y;
+ phi_s0->unk_1E += 0x1800;
+ phi_s0->unk_10.y -= 1.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB418.s")
+ if (phi_s0->unk_4.y < this->actor.parent->home.pos.y) {
+ phi_s0->unk_4.y = this->actor.parent->home.pos.y;
+ func_800B3030(globalCtx, &phi_s0->unk_4, &gZeroVec3f, &gZeroVec3f, 100, 0, 0);
+ SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &phi_s0->unk_4, 11, NA_SE_EN_EXTINCT);
+ EnMinideath_DropCollectible(&phi_s0->unk_4, globalCtx);
+ phi_s0->unk_1 = 2;
+ }
+ } else if (phi_s0->unk_1 == 2) {
+ if (phi_s0->unk_22 > 0) {
+ phi_s0->unk_22--;
+ } else if (this->actionFunc == func_808CABB0) {
+ Math_Vec3f_Diff(&this->actor.parent->focus.pos, &this->actor.world.pos, &phi_s0->unk_10);
+ phi_s0->unk_1 = 0;
+ this->collider.elements[i].info.bumperFlags |= BUMP_ON;
+ this->collider.elements[i].info.toucherFlags |= TOUCH_ON;
+ phi_s7 = 1;
+ phi_s3++;
+ }
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB454.s")
+ if (phi_s7 && phi_s3 > 1) {
+ func_808CA308(this, true);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB524.s")
+void func_808CA7D4(EnMinideath* this) {
+ this->actor.speedXZ = 6.0f;
+ this->actor.world.pos.x = randPlusMinusPoint5Scaled(600.0f) + this->actor.parent->world.pos.x;
+ this->actor.world.pos.z = randPlusMinusPoint5Scaled(600.0f) + this->actor.parent->world.pos.z;
+ this->actor.shape.rot.y = Rand_Next() >> 16;
+ this->actor.shape.rot.x = 0;
+ this->unk_150.y = this->actor.shape.rot.y;
+ this->actionFunc = func_808CA860;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB59C.s")
+void func_808CA860(EnMinideath* this, GlobalContext* globalCtx) {
+ if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_150.y, 0x480) && (this->actor.bgCheckFlags & 8)) {
+ // Fly away from walls
+ this->unk_150.y = (Rand_Next() >> 18) + this->actor.wallYaw;
+ }
+ if (this->actor.params == MINIDEATH_ACTION_7) {
+ func_808CA8E0(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB6A8.s")
+void func_808CA8E0(EnMinideath* this) {
+ this->actionFunc = func_808CA8F4;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB6D4.s")
+void func_808CA8F4(EnMinideath* this, GlobalContext* globalCtx) {
+ EnDeath* parent;
+ Vec3f sp38;
+ s32 phi_v0;
+ s16 angle;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB7B8.s")
+ Math_StepToF(&this->actor.speedXZ, 15.0f, 0.5f);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB7CC.s")
+ if (this->actor.child == NULL) {
+ phi_v0 = 0;
+ angle = 0;
+ } else {
+ angle = 0x5555;
+ if (this->number == 6) {
+ phi_v0 = 1;
+ } else if (this->number == 12) {
+ phi_v0 = 2;
+ angle = -0x5556;
+ } else {
+ phi_v0 = -1;
+ Math_Vec3f_Copy(&sp38, &this->actor.child->world.pos);
+ angle = 0;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB810.s")
+ if (phi_v0 != -1) {
+ parent = (EnDeath*)this->actor.parent;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/func_808CB8F4.s")
+ angle += parent->coreRotation;
+ sp38.x = this->actor.parent->world.pos.x + Math_SinS(angle) * parent->coreVelocity;
+ sp38.z = this->actor.parent->world.pos.z + Math_CosS(angle) * parent->coreVelocity;
+ sp38.y = this->actor.parent->world.pos.y + phi_v0 * 20;
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &sp38), 2, 0x1000, 0x100);
+ if (this->actor.parent->scale.z > 0.0f) {
+ sp38.y = this->actor.parent->world.pos.y + this->unk_158;
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &sp38), 2, 0x1000, 0x100);
+ if (this->actor.params == MINIDEATH_ACTION_8) {
+ func_808CAAC8(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Minideath/EnMinideath_Update.s")
+void func_808CAAC8(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->actionFunc = func_808CAAEC;
+ this->actor.speedXZ = 5.0f;
+}
+
+void func_808CAAEC(EnMinideath* this, GlobalContext* globalCtx) {
+ Actor_DistanceToPoint(&this->actor, &this->actor.parent->focus.pos);
+ Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.parent->focus.pos), 0x800);
+ Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &this->actor.parent->focus.pos),
+ 0x800);
+ if (this->actor.params == MINIDEATH_ACTION_9) {
+ this->collider.base.atFlags |= AT_ON;
+ func_808CAF08(this);
+ }
+}
+
+void func_808CAB90(EnMinideath* this) {
+ this->actor.shape.rot.x = 0;
+ this->actionFunc = func_808CABB0;
+ this->actor.speedXZ = 0.0f;
+}
+
+void func_808CABB0(EnMinideath* this, GlobalContext* globalCtx) {
+ s16 sp1E = this->spawnShapeRot + this->actor.parent->shape.rot.y;
+
+ this->actor.world.pos.x = this->actor.parent->world.pos.x + Math_SinS(sp1E) * 60.0f;
+ this->actor.world.pos.z = this->actor.parent->world.pos.z + Math_CosS(sp1E) * 60.0f;
+ this->actor.world.pos.y = this->actor.parent->world.pos.y + this->unk_158;
+ this->actor.shape.rot.y = this->actor.parent->shape.rot.y;
+}
+
+void func_808CAC54(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->actor.speedXZ = 8.0f;
+ func_800BE33C(&this->actor.parent->world.pos, &this->actor.world.pos, &this->unk_150, false);
+ if (D_808CC258 != 0) {
+ this->timer = D_808CC258;
+ } else {
+ this->timer = 200;
+ }
+ func_808CA308(this, false);
+ this->actionFunc = func_808CACD8;
+}
+
+void func_808CACD8(EnMinideath* this, GlobalContext* globalCtx) {
+ f32 temp_fv0;
+ f32 temp_fv1;
+
+ Math_StepToF(&this->actor.speedXZ, 6.0f, 0.5f);
+
+ if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_150.y, 0x480) && (this->actor.bgCheckFlags & 8)) {
+ // Fly away from walls
+ this->unk_150.y = (Rand_Next() >> 18) + this->actor.wallYaw;
+ }
+
+ if (Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk_150.x, 0x480)) {
+ temp_fv0 = this->actor.world.pos.y;
+ temp_fv1 = this->actor.parent->home.pos.y;
+
+ if (temp_fv0 < temp_fv1 + 50.0f) {
+ this->unk_150.x = -0x800 - ((u32)Rand_Next() >> 20);
+ } else if (temp_fv0 > temp_fv1 + 200.0f) {
+ this->unk_150.x = ((u32)Rand_Next() >> 20) + 0x800;
+ }
+ }
+
+ if (this->timer == 0) {
+ func_808CAE00(this);
+ } else {
+ this->timer--;
+ }
+}
+
+void func_808CAE00(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->actionFunc = func_808CAE18;
+}
+
+void func_808CAE18(EnMinideath* this, GlobalContext* globalCtx) {
+ s32 pad;
+ f32 temp_fv0 = Actor_DistanceToPoint(&this->actor, &this->actor.parent->focus.pos);
+ f32 phi_fa0 = temp_fv0 * 0.016666668f;
+
+ if (phi_fa0 > 1.0f) {
+ phi_fa0 = 1.0f;
+ }
+ Math_StepToF(&this->actor.speedXZ, 6.0f * phi_fa0, 0.5f);
+ Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.parent->focus.pos), 0x800);
+ Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &this->actor.parent->focus.pos),
+ 0x800);
+ if (temp_fv0 < 30.0f) {
+ func_808CAF08(this);
+ }
+}
+
+void func_808CAF08(EnMinideath* this) {
+ s32 phi_v0;
+
+ this->actor.speedXZ = 0.0f;
+ func_808CA308(this, true);
+
+ for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(this->unk_160); phi_v0++) {
+ this->unk_160[phi_v0].unk_22 = 0;
+ }
+ this->actionFunc = func_808CAF68;
+}
+
+void func_808CAF68(EnMinideath* this, GlobalContext* globalCtx) {
+ Vec3f target;
+ f32 dist;
+ s16 sp26;
+ s32 done;
+
+ done = Math_ScaledStepToS(&this->actor.shape.rot.y, this->spawnShapeRot + this->actor.parent->shape.rot.y, 0x800);
+ Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800);
+ sp26 = this->spawnShapeRot + this->actor.parent->shape.rot.y;
+ target.x = this->actor.parent->world.pos.x + Math_SinS(sp26) * 60.0f;
+ target.z = this->actor.parent->world.pos.z + Math_CosS(sp26) * 60.0f;
+ target.y = this->actor.parent->world.pos.y + this->unk_158;
+
+ dist = Math_Vec3f_StepTo(&this->actor.world.pos, &target, 10.0f);
+ if (done && dist < 20.0f) {
+ func_808CAB90(this);
+ }
+}
+
+void func_808CB07C(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->actionFunc = func_808CB094;
+}
+
+void func_808CB094(EnMinideath* this, GlobalContext* globalCtx) {
+ Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.parent->focus.pos, 5.0f);
+}
+
+void func_808CB0C8(EnMinideath* this, GlobalContext* globalCtx) {
+ s32 phi_a2;
+ s32 phi_v1;
+ s32 phi_a1;
+
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->actor.speedXZ = 8.0f;
+
+ if (this->number >= 10) {
+ phi_v1 = 19 - this->number;
+ phi_a1 = 1;
+ phi_a2 = 0;
+ } else {
+ phi_v1 = 9 - this->number;
+ phi_a1 = -1;
+ phi_a2 = 0x200;
+ }
+ this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (phi_a1 * 0x4000) + ((phi_v1 * 0x2000) * phi_a1);
+ this->actor.shape.rot.x = (phi_a2 - phi_v1 * 0x400) + 0xC00;
+
+ this->actor.world.pos.x = this->actor.parent->focus.pos.x + Math_SinS(this->actor.shape.rot.y) * 60.0f;
+ this->actor.world.pos.z = this->actor.parent->focus.pos.z + Math_CosS(this->actor.shape.rot.y) * 60.0f;
+ this->actor.world.pos.y = this->actor.parent->focus.pos.y - Math_SinS(this->actor.shape.rot.x) * 60.0f;
+
+ func_808CA34C(this);
+ this->timer = 100;
+ func_808CA308(this, false);
+
+ D_808CC254 = 0;
+
+ if (this->actor.child == NULL || this->number == 9) {
+ this->unk_15C = &GET_PLAYER(globalCtx)->actor;
+ } else {
+ this->unk_15C = this->actor.child;
+ }
+ this->actionFunc = func_808CB22C;
+}
+
+void func_808CB22C(EnMinideath* this, GlobalContext* globalCtx) {
+ Vec3f sp34;
+ s16 sp32 = 0;
+
+ Math_StepToF(&this->actor.speedXZ, 6.0f, 0.2f);
+ if (this->timer > 0) {
+ this->timer--;
+ }
+
+ if (this->unk_15C->id != ACTOR_EN_MINIDEATH) {
+ if (this->timer == 0) {
+ this->unk_15C = this->actor.parent;
+ }
+ Math_Vec3f_Copy(&sp34, &this->unk_15C->focus.pos);
+ if (Actor_DistanceToPoint(&this->actor, &sp34) > 200.0f) {
+ if (this->number < 10) {
+ sp32 = -0x1C00;
+ } else {
+ sp32 = 0x1C00;
+ }
+ sp34.y += 50.0f;
+ }
+ } else if (((EnMinideath*)this->unk_15C)->actionFunc != func_808CB22C) {
+ Math_Vec3f_Copy(&sp34, &this->actor.parent->focus.pos);
+ } else {
+ Math_Vec3f_Copy(&sp34, &this->unk_15C->focus.pos);
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &sp34) + sp32, 5, 0xC00, 0x80);
+ Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &sp34), 5, 0xC00, 0x80);
+ if ((this->collider.base.atFlags & AT_HIT) && this->timer > 0) {
+ D_808CC254 += 1;
+ }
+ if (this->timer == 0 && Actor_DistanceToPoint(&this->actor, &this->actor.parent->focus.pos) < 50.0f) {
+ func_808CAF08(this);
+ }
+}
+
+void func_808CB418(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->timer = 10;
+ func_808CA34C(this);
+ this->actionFunc = func_808CB454;
+}
+
+void func_808CB454(EnMinideath* this, GlobalContext* globalCtx) {
+ Vec3f target;
+
+ if (this->timer > 0) {
+ this->timer--;
+ }
+ target.x = (Math_SinS(this->actor.parent->shape.rot.y) * 20.0f) + this->actor.parent->focus.pos.x;
+ target.z = (Math_CosS(this->actor.parent->shape.rot.y) * 20.0f) + this->actor.parent->focus.pos.z;
+ target.y = this->actor.parent->focus.pos.y;
+ Math_Vec3f_StepTo(&this->actor.world.pos, &target, 5.0f);
+ if (this->timer == 0 && ((EnMinideath*)this->actor.child)->actionFunc != func_808CB22C) {
+ func_808CAB90(this);
+ }
+}
+
+void func_808CB524(EnMinideath* this) {
+ s32 i;
+
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ func_808CA308(this, false);
+ this->collider.base.atFlags &= ~AT_ON;
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_160); i++) {
+ this->unk_160[i].unk_1 = 0;
+ }
+
+ this->unk_150.y = this->actor.shape.rot.y;
+ this->unk_150.x = this->actor.shape.rot.x;
+ this->actionFunc = func_808CB59C;
+}
+
+void func_808CB59C(EnMinideath* this, GlobalContext* globalCtx) {
+ f32 temp_fv0;
+ f32 temp_fv1;
+
+ Math_StepToF(&this->actor.speedXZ, 5.0f, 0.2f);
+ if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_150.y, 0x480) && (this->actor.bgCheckFlags & 8)) {
+ // Fly away from walls
+ this->unk_150.y = (Rand_Next() >> 0x12) + this->actor.wallYaw;
+ }
+ if (Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk_150.x, 0x480)) {
+ temp_fv0 = this->actor.world.pos.y;
+ temp_fv1 = this->actor.parent->home.pos.y;
+ if (temp_fv0 < (temp_fv1 + 50.0f)) {
+ this->unk_150.x = -0x800 - ((u32)Rand_Next() >> 20);
+ } else if (temp_fv0 > (temp_fv1 + 200.0f)) {
+ this->unk_150.x = ((u32)Rand_Next() >> 20) + 0x800;
+ }
+ }
+}
+
+void EnMinideath_SetupDie(EnMinideath* this) {
+ this->actor.params = MINIDEATH_ACTION_CONTINUE;
+ this->unk_150.x = 0x4000;
+ this->actionFunc = EnMinideath_Die;
+ this->actor.gravity = -0.5f;
+}
+
+void EnMinideath_Die(EnMinideath* this, GlobalContext* globalCtx) {
+ MiniDeathStruct* phi_s0;
+ s32 i;
+ s32 phi_s2 = 0;
+
+ Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f);
+ Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk_150.x, 0x480);
+ func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG);
+
+ if (this->actor.bgCheckFlags & 1) {
+ this->actor.speedXZ = 0.0f;
+
+ for (phi_s0 = this->unk_160, i = 0; i < ARRAY_COUNT(this->unk_160); i++, phi_s0++) {
+ if (Math_StepToF(&phi_s0->unk_10.y, 0.0f, 7.0f)) {
+ phi_s2++;
+ }
+ }
+
+ if (phi_s2 == ARRAY_COUNT(this->unk_160)) {
+ EnMinideath_SetupDead(this);
+ }
+ }
+}
+
+void EnMinideath_SetupDead(EnMinideath* this) {
+ this->actionFunc = EnMinideath_Dead;
+}
+
+void EnMinideath_Dead(EnMinideath* this, GlobalContext* globalCtx) {
+ if (this->actor.parent->update == NULL) {
+ Actor_MarkForDeath(&this->actor);
+ } else {
+ func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG);
+ }
+}
+
+void EnMinideath_SetNextAction(EnMinideath* this, GlobalContext* globalCtx) {
+ s16 action = this->actor.params;
+
+ if (action == MINIDEATH_ACTION_6) {
+ func_808CB524(this);
+ } else if (action == MINIDEATH_ACTION_2) {
+ func_808CAE00(this);
+ } else if (action == MINIDEATH_ACTION_3) {
+ func_808CB07C(this);
+ } else if (action == MINIDEATH_ACTION_4) {
+ if (this->number == 0 || this->number == 10) {
+ func_808CB418(this);
+ } else {
+ func_808CB0C8(this, globalCtx);
+ }
+ } else if (action == MINIDEATH_ACTION_1) {
+ func_808CAC54(this);
+ } else if (action == MINIDEATH_ACTION_DIE) {
+ EnMinideath_SetupDie(this);
+ }
+}
+
+void func_808CB8F4(EnMinideath* this, GlobalContext* globalCtx) {
+ s32 temp_a0_2;
+ EnMinideath* temp_a0_3;
+ s32 phi_a2;
+ s32 phi_v0_2;
+ s32 phi_a0;
+
+ if (this->collider.base.acFlags & AC_HIT) {
+ this->collider.base.acFlags &= ~AC_HIT;
+
+ if (this->actor.colChkInfo.damageEffect == DMGEFF_STUN) {
+ if (this->actionFunc == func_808CABB0 || this->actionFunc == func_808CAF68) {
+ D_808CC258 = 5;
+ } else if (this->actionFunc == func_808CB22C) {
+ EnMinideath** miniDeaths = (EnMinideath**)((EnDeath*)this->actor.parent)->miniDeaths;
+
+ for (temp_a0_2 = this->number - 1; temp_a0_2 >= 0; temp_a0_2--) {
+ temp_a0_3 = miniDeaths[temp_a0_2];
+
+ if (temp_a0_3->unk_15C == &this->actor) {
+ temp_a0_3->unk_15C = this->unk_15C;
+ break;
+ }
+ }
+
+ this->timer = 0;
+ this->unk_15C = &GET_PLAYER(globalCtx)->actor;
+ }
+ } else {
+ for (phi_a2 = 0; phi_a2 < ARRAY_COUNT(this->colliderElements); phi_a2++) {
+ if (this->collider.elements[phi_a2].info.bumperFlags & BUMP_HIT) {
+ this->collider.elements[phi_a2].info.bumperFlags &= ~(BUMP_ON | BUMP_HIT);
+ this->collider.elements[phi_a2].info.toucherFlags &= ~(TOUCH_ON | TOUCH_HIT);
+ this->unk_160[phi_a2].unk_10.y = -1.0f;
+ this->unk_160[phi_a2].unk_1 = 1;
+ this->unk_160[phi_a2].unk_1E = this->actor.shape.rot.y;
+ this->unk_160[phi_a2].unk_22 = 60;
+
+ if ((this->actionFunc == func_808CABB0 || this->actionFunc == func_808CAF68) &&
+ this->actor.colChkInfo.damageEffect == DMGEFF_LIGHT_ARROW) {
+ D_808CC258 = 200;
+ }
+ }
+ }
+
+ phi_a0 = 0;
+ for (phi_v0_2 = 0; phi_v0_2 < ARRAY_COUNT(this->unk_160); phi_v0_2++) {
+ if (this->unk_160[phi_v0_2].unk_1 != 0) {
+ phi_a0++;
+ }
+ }
+
+ if (phi_a0 > 1) {
+ func_808CA308(this, false);
+ }
+
+ if (D_808CC25C == 0) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_DEAD);
+ D_808CC25C = 1;
+ }
+ }
+ }
+}
+
+void EnMinideath_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnMinideath* this = THIS;
+ s32 pad;
+ ColliderJntSphElement* elem;
+ s32 temp;
+ s32 i;
+ MiniDeathStruct* phi_s0;
+ EnMinideath* phi_s0_3;
+
+ if (sItemDropTimer > 0) {
+ sItemDropTimer--;
+ }
+
+ if (this->actionFunc != EnMinideath_Dead) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_160); i++) {
+ if (this->unk_160[i].unk_1 == 0) {
+ func_800B9010(&this->actor, NA_SE_EV_BAT_FLY - SFX_FLAG);
+ break;
+ }
+ }
+ }
+
+ func_808CB8F4(this, globalCtx);
+
+ EnMinideath_SetNextAction(this, globalCtx);
+ this->actionFunc(this, globalCtx);
+
+ if (this->actionFunc != EnMinideath_Dead) {
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ this->actor.world.rot.x = -this->actor.shape.rot.x;
+
+ if (this->actionFunc == EnMinideath_Die) {
+ Actor_MoveWithGravity(&this->actor);
+ } else {
+ Actor_MoveWithoutGravity(&this->actor);
+ }
+
+ if (this->actionFunc != func_808CABB0 && this->actionFunc != func_808CAF68) {
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 50.0f, 80.0f, 7);
+ }
+
+ if (this->actionFunc != EnMinideath_Die) {
+ func_808CA458(this, globalCtx);
+ }
+
+ Actor_SetFocus(&this->actor, 0.0f);
+
+ phi_s0 = this->unk_160;
+ elem = this->collider.elements;
+ for (i = 0; i != ARRAY_COUNT(this->colliderElements); i++) {
+ if (phi_s0->unk_1 == 0) {
+ Math_Vec3f_Sum(&this->actor.world.pos, &phi_s0->unk_10, &phi_s0->unk_4);
+
+ if (this->actionFunc != EnMinideath_Die) {
+ phi_s0->animFrame++;
+ if (phi_s0->animFrame == MINIDEATH_ANIM_LENGTH) {
+ phi_s0->animFrame = 0;
+ }
+ }
+
+ elem->dim.worldSphere.center.x = phi_s0->unk_4.x;
+ elem->dim.worldSphere.center.y = phi_s0->unk_4.y;
+ elem->dim.worldSphere.center.z = phi_s0->unk_4.z;
+ }
+ phi_s0++;
+ elem++;
+ }
+
+ if (this->collider.base.atFlags & AT_HIT) {
+ this->collider.base.atFlags &= ~AT_HIT;
+ this->attackTimer = 40;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_ATTACK);
+ }
+ if (this->collider.base.atFlags & AT_ON) {
+ temp = (this->actionFunc == func_808CABB0) ? (globalCtx->gameplayFrames % 4) : 4;
+
+ if (temp == 4 || temp == (this->number & 3)) {
+ if (this->attackTimer == 0 && this->actor.parent->shape.rot.x == 0) {
+ CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+ if (this->actionFunc != func_808CB094) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+ }
+ }
+ if (this->attackTimer > 0) {
+ this->attackTimer--;
+ }
+ if (this->number == 19) {
+ phi_s0_3 = NULL;
+ D_808CC25C = 0;
+
+ if (D_808CC258 != 0) {
+ do {
+ phi_s0_3 =
+ (EnMinideath*)SubS_FindActor(globalCtx, &phi_s0_3->actor, ACTORCAT_ENEMY, ACTOR_EN_MINIDEATH);
+ if (phi_s0_3 != NULL) {
+ func_808CAC54(phi_s0_3);
+ phi_s0_3 = (EnMinideath*)phi_s0_3->actor.next;
+ }
+ } while (phi_s0_3 != NULL);
+
+ globalCtx->envCtx.lightSettingOverride = 28;
+
+ if (D_808CC258 == 5) {
+ ((EnDeath*)this->actor.parent)->unk_2FC = 5;
+ } else {
+ ((EnDeath*)this->actor.parent)->unk_2FC = 20;
+ }
+ D_808CC258 = 0;
+ } else if (D_808CC254 >= 5) {
+ do {
+ phi_s0_3 =
+ (EnMinideath*)SubS_FindActor(globalCtx, &phi_s0_3->actor, ACTORCAT_ENEMY, ACTOR_EN_MINIDEATH);
+ if (phi_s0_3 != NULL) {
+ phi_s0_3->timer = 0;
+ phi_s0_3 = (EnMinideath*)phi_s0_3->actor.next;
+ }
+ } while (phi_s0_3 != NULL);
+ D_808CC254 = 0;
+ }
+ }
+ }
+}
diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h
index 7ac4dee6c..f8a02ea81 100644
--- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h
+++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h
@@ -7,10 +7,47 @@ struct EnMinideath;
typedef void (*EnMinideathActionFunc)(struct EnMinideath*, GlobalContext*);
+// "animation" length
+#define MINIDEATH_ANIM_LENGTH 9
+
+typedef enum {
+ MINIDEATH_ACTION_CONTINUE, // continue with current action until it is changed
+ MINIDEATH_ACTION_1, // scatter after light arrows?
+ MINIDEATH_ACTION_2, // gomess damaged
+ MINIDEATH_ACTION_3,
+ MINIDEATH_ACTION_4, // chase player?
+ MINIDEATH_ACTION_DIE, // dead?
+ MINIDEATH_ACTION_6,
+ MINIDEATH_ACTION_7,
+ MINIDEATH_ACTION_8,
+ MINIDEATH_ACTION_9
+} MinideathAction;
+
+typedef struct {
+ /* 0x00 */ u8 animFrame;
+ /* 0x01 */ u8 unk_1;
+ /* 0x04 */ Vec3f unk_4;
+ /* 0x10 */ Vec3f unk_10;
+ /* 0x1C */ s16 unk_1C;
+ /* 0x1E */ s16 unk_1E;
+ /* 0x20 */ char unk_20[0x2];
+ /* 0x22 */ s16 unk_22;
+} MiniDeathStruct; // size = 0x24
+
typedef struct EnMinideath {
/* 0x0000 */ Actor actor;
/* 0x0144 */ EnMinideathActionFunc actionFunc;
- /* 0x0148 */ char unk_148[0x164];
+ /* 0x0148 */ u8 number;
+ /* 0x0149 */ u8 unk_149;
+ /* 0x014A */ s16 timer;
+ /* 0x014C */ s16 spawnShapeRot;
+ /* 0x014E */ s16 attackTimer;
+ /* 0x0150 */ Vec3s unk_150; // move direction?
+ /* 0x0158 */ f32 unk_158;
+ /* 0x015C */ Actor* unk_15C;
+ /* 0x0160 */ MiniDeathStruct unk_160[3];
+ /* 0x01CC */ ColliderJntSph collider;
+ /* 0x01EC */ ColliderJntSphElement colliderElements[3];
} EnMinideath; // size = 0x2AC
extern const ActorInit En_Minideath_InitVars;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index fe4697ca9..ec6f3c690 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -6209,7 +6209,7 @@
0x808C96C8:("EnDeath_Draw",),
0x808CA0B0:("EnMinideath_Init",),
0x808CA23C:("EnMinideath_Destroy",),
- 0x808CA268:("func_808CA268",),
+ 0x808CA268:("EnMinideath_DropCollectible",),
0x808CA308:("func_808CA308",),
0x808CA34C:("func_808CA34C",),
0x808CA458:("func_808CA458",),
@@ -6239,7 +6239,7 @@
0x808CB6D4:("func_808CB6D4",),
0x808CB7B8:("func_808CB7B8",),
0x808CB7CC:("func_808CB7CC",),
- 0x808CB810:("func_808CB810",),
+ 0x808CB810:("EnMinideath_SetNextAction",),
0x808CB8F4:("func_808CB8F4",),
0x808CBB18:("EnMinideath_Update",),
0x808CC260:("EnVm_Init",),
From 7920d077ee8cde55727b6985e9d8bafc2ac5d161 Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Sat, 25 Jun 2022 23:22:41 +0100
Subject: [PATCH 04/51] Fix merge
---
src/overlays/actors/ovl_En_Death/z_en_death.c | 90 +++++++++----------
1 file changed, 45 insertions(+), 45 deletions(-)
diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c
index bb3d8e0c3..cf3d22fab 100644
--- a/src/overlays/actors/ovl_En_Death/z_en_death.c
+++ b/src/overlays/actors/ovl_En_Death/z_en_death.c
@@ -845,11 +845,11 @@ void EnDeath_DeathCutscenePart1(EnDeath* this, GlobalContext* globalCtx) {
} else if (this->skelAnime.animation == &gGomessBeginDeathAnim) {
this->actor.shape.rot.y += 0x2000;
if (this->skelAnime.curFrame > 3.0f) {
- Matrix_SetCurrentState(&this->unk_6A4);
- Matrix_InsertXRotation_s(-0x1000, MTXMODE_APPLY);
- Matrix_CopyCurrentState(&this->unk_6A4);
+ Matrix_Put(&this->unk_6A4);
+ Matrix_RotateXS(-0x1000, MTXMODE_APPLY);
+ Matrix_Get(&this->unk_6A4);
this->unk_18E = false;
- this->unk_6A4.wy += 18.0f;
+ this->unk_6A4.yw += 18.0f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_SCYTHE);
}
}
@@ -917,14 +917,14 @@ void EnDeath_DeathCutscenePart2(EnDeath* this, GlobalContext* globalCtx) {
camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
sin = Math_SinS(camYaw);
cos = Math_CosS(camYaw);
- Matrix_InsertTranslation(this->actor.world.pos.x + (83.0f * sin) + (-38.0f * cos),
+ Matrix_Translate(this->actor.world.pos.x + (83.0f * sin) + (-38.0f * cos),
this->actor.world.pos.y + 53.0f + 15.0f * this->actionTimer,
this->actor.world.pos.z + (83.0f * cos) - (-38.0f * sin), MTXMODE_NEW);
- Matrix_RotateY(camYaw - 0x3300, MTXMODE_APPLY);
- Matrix_InsertXRotation_s(0x1100 - this->actionTimer * 0x1800, MTXMODE_APPLY);
- Matrix_InsertZRotation_s(-0xA00, MTXMODE_APPLY);
+ Matrix_RotateYS(camYaw - 0x3300, MTXMODE_APPLY);
+ Matrix_RotateXS(0x1100 - this->actionTimer * 0x1800, MTXMODE_APPLY);
+ Matrix_RotateZS(-0xA00, MTXMODE_APPLY);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
- Matrix_CopyCurrentState(&this->unk_6A4);
+ Matrix_Get(&this->unk_6A4);
if (this->actionTimer == 0) {
func_800DFD04(GET_ACTIVE_CAM(globalCtx), 2, 4, 6);
func_8013ECE0(this->actor.xyzDistToPlayerSq, 180, 20, 100);
@@ -993,7 +993,7 @@ void EnDeath_DeathCutscenePart3(EnDeath* this, GlobalContext* globalCtx) {
sparklePos->y = (Rand_ZeroFloat(20.0f) + this->actor.world.pos.y + 4.0f * this->actionTimer) - 30.0f;
sparklePos->z = (this->actor.world.pos.z + 30.0f * cos) - (temp_fs0 * sin);
*temp1A9 = 255 - phi_s0 * 4;
- EffectSsKiraKira_SpawnSmall(globalCtx, sparklePos, &sparkleVel, &sparkleAccel, &sparklePrimColor,
+ EffectSsKirakira_SpawnSmall(globalCtx, sparklePos, &sparkleVel, &sparkleAccel, &sparklePrimColor,
&sparkleEnvColor);
sparklePos++;
temp1A9++;
@@ -1046,7 +1046,7 @@ void EnDeath_DeathCutscenePart4(EnDeath* this, GlobalContext* globalCtx) {
sparkleVel.x = randPlusMinusPoint5Scaled(4.0f);
sparkleVel.z = randPlusMinusPoint5Scaled(4.0f);
sparkleVel.y = Rand_ZeroFloat(2.0f) + 3.0f;
- EffectSsKiraKira_SpawnSmall(globalCtx, &this->actor.world.pos, &sparkleVel, &sparkleAccel,
+ EffectSsKirakira_SpawnSmall(globalCtx, &this->actor.world.pos, &sparkleVel, &sparkleAccel,
&sparklePrimColor, &sparkleEnvColor);
}
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEATH_HEARTBREAK);
@@ -1325,14 +1325,14 @@ void EnDeath_DrawScytheSpinning(EnDeath* this, GlobalContext* globalCtx) {
gDPPipeSync(dl++);
gDPSetEnvColor(dl++, 30, 30, 0, 255 - i * 35);
- Matrix_SetCurrentState(&this->unk_6A4);
- Matrix_InsertXRotation_s(i * 0x2100, MTXMODE_APPLY);
+ Matrix_Put(&this->unk_6A4);
+ Matrix_RotateXS(i * 0x2100, MTXMODE_APPLY);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(dl++, object_death_DL_006F88); // scythe handle
- Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
- Matrix_InsertRotation(-0x4000, 0, -0x4000, MTXMODE_APPLY);
+ Matrix_Translate(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
+ Matrix_RotateZYX(-0x4000, 0, -0x4000, MTXMODE_APPLY);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(dl++, object_death_DL_0073D0); // scythe blade
@@ -1362,19 +1362,19 @@ void EnDeath_DrawScythe(EnDeath* this, GlobalContext* globalCtx) {
dl = POLY_OPA_DISP;
}
- Matrix_SetCurrentState(&this->unk_6A4);
+ Matrix_Put(&this->unk_6A4);
Matrix_Scale(this->scytheScale, this->scytheScale, this->scytheScale, MTXMODE_APPLY);
gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[1], object_death_DL_006F88); // scythe handle
- Matrix_InsertTranslation(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
- Matrix_InsertRotation(-0x4000, 0, -0x4000, MTXMODE_APPLY);
+ Matrix_Translate(0.0f, -1084.0f, 7012.0f, MTXMODE_APPLY);
+ Matrix_RotateZYX(-0x4000, 0, -0x4000, MTXMODE_APPLY);
gSPMatrix(&dl[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[3], object_death_DL_0073D0); // scythe blade
- Matrix_GetStateTranslation(&this->scytheWorldPos);
+ Matrix_MultZero(&this->scytheWorldPos);
if (this->actionFunc == EnDeath_Dead) {
POLY_XLU_DISP = &dl[4];
@@ -1407,7 +1407,7 @@ void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
gSPDisplayList(dl++, &sSetupDL[0x19 * 6]);
gSPDisplayList(dl++, gGomessBatMaterialDL);
- cmf = Matrix_GetCurrentState();
+ cmf = Matrix_GetCurrent();
if (this->actionFunc == EnDeath_Dead) {
phi_fs2 = this->actionTimer * 0.000035f;
@@ -1432,7 +1432,7 @@ void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
(this->miniDeaths[i]->actor.flags & ACTOR_FLAG_40) == ACTOR_FLAG_40) {
miniDeath = this->miniDeaths[i];
- Matrix_InsertRotation(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
+ Matrix_RotateZYX(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
Matrix_Scale(phi_fs2, phi_fs2, phi_fs2, MTXMODE_APPLY);
for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
@@ -1449,7 +1449,7 @@ void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
if (phi_s0->unk_1 == 1) {
- Matrix_InsertRotation(0x4000, phi_s0->unk_1E, 0, MTXMODE_NEW);
+ Matrix_RotateZYX(0x4000, phi_s0->unk_1E, 0, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
cmf->mf[3][0] = phi_s0->unk_4.x + sp9C.x;
cmf->mf[3][1] = phi_s0->unk_4.y + sp9C.y;
@@ -1467,7 +1467,7 @@ void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
for (i = 0; i < ARRAY_COUNT(this->miniDeaths); i++) {
miniDeath = this->miniDeaths[i];
- Matrix_InsertRotation(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
+ Matrix_RotateZYX(miniDeath->actor.shape.rot.x, miniDeath->actor.shape.rot.y, 0, MTXMODE_NEW);
Matrix_Scale(phi_fs2, phi_fs2, phi_fs2, MTXMODE_APPLY);
for (phi_s0 = miniDeath->unk_160, j = 0; j < ARRAY_COUNT(miniDeath->unk_160); j++, phi_s0++) {
@@ -1482,7 +1482,7 @@ void EnDeath_DrawBats(EnDeath* this, GlobalContext* globalCtx) {
}
if (this->unk_18D) {
- Matrix_InsertRotation(0x4000, this->coreRotation, 0, MTXMODE_NEW);
+ Matrix_RotateZYX(0x4000, this->coreRotation, 0, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
cmf->mf[3][0] = this->corePos.x + sp9C.x;
cmf->mf[3][1] = this->corePos.y + sp9C.y;
@@ -1516,10 +1516,10 @@ void EnDeath_DrawFlames(EnDeath* this, GlobalContext* globalCtx2) {
gDPSetEnvColor(POLY_XLU_DISP++, 230, 135, 25, 0);
- Matrix_SetCurrentState(&globalCtx->billboardMtxF);
+ Matrix_Put(&globalCtx->billboardMtxF);
Matrix_Scale(0.00405f, 0.003f, 0.00405f, MTXMODE_APPLY);
- cmf = Matrix_GetCurrentState();
+ cmf = Matrix_GetCurrent();
phi_s1 = this->unk_404;
phi_s3 = this->unk_1A9;
@@ -1543,7 +1543,7 @@ void EnDeath_DrawFlames(EnDeath* this, GlobalContext* globalCtx2) {
phi_s3++;
}
- Matrix_SetCurrentState(&globalCtx->billboardMtxF);
+ Matrix_Put(&globalCtx->billboardMtxF);
Matrix_Scale(0.00405f, 0.003f, 0.00405f, MTXMODE_APPLY);
if (this->actionFunc == EnDeath_Dead) {
@@ -1583,7 +1583,7 @@ void EnDeath_DrawCore(EnDeath* this, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
dl = POLY_OPA_DISP;
- Matrix_NormalizeXYZ(&globalCtx->billboardMtxF);
+ Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[1], gGomessCoreDL);
@@ -1639,7 +1639,7 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
s8 index;
if (limbIndex == GOMESS_LIMB_SCYTHE_BLADE) {
- Matrix_GetStateTranslation(&this->scytheWorldPos);
+ Matrix_MultZero(&this->scytheWorldPos);
if ((this->unk_788.base.atFlags & AT_ON) && this->unk_2EC != this->actionTimer) {
Vec3f quad0;
@@ -1651,11 +1651,11 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
Math_Vec3f_Copy(&quad1, &this->unk_788.dim.quad[1]);
if (this->actionFunc == EnDeath_EndSwingAttack) {
- Matrix_GetStateTranslationAndScaledX(6000.0f, &pos1);
- Matrix_MultiplyVector3fByState(&D_808C9AF4, &pos2);
+ Matrix_MultVecX(6000.0f, &pos1);
+ Matrix_MultVec3f(&D_808C9AF4, &pos2);
} else {
- Matrix_GetStateTranslationAndScaledY(5000.0f, &pos2);
- Matrix_MultiplyVector3fByState(&D_808C9B00, &pos1);
+ Matrix_MultVecY(5000.0f, &pos2);
+ Matrix_MultVec3f(&D_808C9B00, &pos1);
}
Collider_SetQuadVertices(&this->unk_788, &pos2, &pos1, &quad0, &quad1);
@@ -1664,21 +1664,21 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
this->unk_2EC = this->actionTimer;
} else if (this->unk_18C) {
if (this->actionFunc == EnDeath_EndSwingAttack) {
- Matrix_GetStateTranslationAndScaledX(6000.0f, &this->unk_788.dim.quad[1]);
- Matrix_MultiplyVector3fByState(&D_808C9AF4, &this->unk_788.dim.quad[0]);
+ Matrix_MultVecX(6000.0f, &this->unk_788.dim.quad[1]);
+ Matrix_MultVec3f(&D_808C9AF4, &this->unk_788.dim.quad[0]);
} else {
- Matrix_GetStateTranslationAndScaledY(5000.0f, &this->unk_788.dim.quad[0]);
- Matrix_MultiplyVector3fByState(&D_808C9B00, &this->unk_788.dim.quad[1]);
+ Matrix_MultVecY(5000.0f, &this->unk_788.dim.quad[0]);
+ Matrix_MultVec3f(&D_808C9B00, &this->unk_788.dim.quad[1]);
}
this->unk_18C = false;
this->unk_788.base.atFlags |= AT_ON;
this->unk_2EC = this->actionTimer;
}
} else if (limbIndex == GOMESS_LIMB_CORE_POS && this->actionFunc != EnDeath_Dead) {
- Matrix_StatePush();
+ Matrix_Push();
EnDeath_DrawCore(this, globalCtx);
- Matrix_StatePop();
- Matrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_Pop();
+ Matrix_MultZero(&this->actor.focus.pos);
this->coreCollider.dim.worldSphere.center.x = this->actor.focus.pos.x;
this->coreCollider.dim.worldSphere.center.y = this->actor.focus.pos.y;
@@ -1691,7 +1691,7 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
if (!(this->actionFunc != EnDeath_SpinAttack && this->actionFunc != EnDeath_BlockProjectile &&
this->actionFunc != EnDeath_IntroCutscenePart5) ||
(this->actionFunc == EnDeath_DeathCutscenePart1 && this->unk_18E == true)) {
- Matrix_CopyCurrentState(&this->unk_6A4);
+ Matrix_Get(&this->unk_6A4);
}
}
@@ -1699,7 +1699,7 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
if (index != -1) {
if (index < 7) {
// get matrix translation as-is, occupies slots 0, 1, 2, 3, 4, 5, 6
- Matrix_GetStateTranslation(&this->dmgEffectPositions[index]);
+ Matrix_MultZero(&this->dmgEffectPositions[index]);
} else if (index == 7) {
// 5 points using 5 offsets, occupies slots 7, 8, 9, 10, 11
s32 i;
@@ -1708,12 +1708,12 @@ void EnDeath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
for (effPos = &this->dmgEffectPositions[index], offset = &D_808C9B0C[0], i = 0;
i != ARRAY_COUNT(D_808C9B0C); i++, offset++, effPos++) {
- Matrix_MultiplyVector3fByState(offset, effPos);
+ Matrix_MultVec3f(offset, effPos);
}
} else if (index == 12) {
// get matrix translation as-is and a point offset by -2000 from it, occupies slots 12, 13
- Matrix_GetStateTranslation(&this->dmgEffectPositions[index]);
- Matrix_GetStateTranslationAndScaledY(-2000.0f, &this->dmgEffectPositions[index + 1]);
+ Matrix_MultZero(&this->dmgEffectPositions[index]);
+ Matrix_MultVecY(-2000.0f, &this->dmgEffectPositions[index + 1]);
}
}
}
From 9a371e84268305b483b9d5a01e15b325c1f1ef21 Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Sun, 18 Sep 2022 22:51:19 +0100
Subject: [PATCH 05/51] Init, Destroy, Update, easy actions
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 2109 ++++++++++++++++++-
src/overlays/actors/ovl_Boss_05/z_boss_05.h | 60 +-
tools/permuter_settings.toml | 2 +
3 files changed, 2133 insertions(+), 38 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index 7b40069d7..d6285fe19 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -15,16 +15,26 @@ void Boss05_Destroy(Actor* thisx, PlayState* play);
void Boss05_Update(Actor* thisx, PlayState* play);
void Boss05_Draw(Actor* thisx, PlayState* play);
+void func_809EEDD0(Boss05* this, PlayState* play);
void func_809EEDE8(Boss05* this, PlayState* play);
void func_809EF9BC(Boss05* this, PlayState* play);
void func_809EFAB4(Boss05* this, PlayState* play);
+void func_809F00CC(Boss05* this, PlayState* play);
void func_809F010C(Boss05* this, PlayState* play);
+void func_809F01CC(Boss05* this, PlayState* play);
void func_809F0244(Boss05* this, PlayState* play);
+void func_809F02D0(Boss05* this, PlayState* play);
void func_809F0374(Boss05* this, PlayState* play);
+void func_809F0474(Boss05* this, PlayState* play);
void func_809F04C0(Boss05* this, PlayState* play);
+void func_809F0538(Boss05 *this, PlayState *arg1);
void func_809F0590(Boss05* this, PlayState* play);
+void func_809F0650(Boss05 *this, PlayState *arg1);
void func_809F06B8(Boss05* this, PlayState* play);
+void func_809F0708(Boss05* this, PlayState* play);
void func_809F0780(Boss05* this, PlayState* play);
+void func_809F0A0C(Boss05* this, PlayState* play);
+void func_809F0A64(Boss05* this, PlayState* play);
void func_809F0ABC(Boss05* this, PlayState* play);
void func_809F0B0C(Boss05* this, PlayState* play);
@@ -161,6 +171,7 @@ const ActorInit Boss_05_InitVars = {
#endif
+extern CollisionHeader D_809F1B00;
extern ColliderJntSphElementInit D_809F1B2C[2];
extern ColliderJntSphInit D_809F1B74;
extern ColliderJntSphElementInit D_809F1B84[1];
@@ -170,77 +181,558 @@ extern ColliderJntSphInit D_809F1BDC;
extern DamageTable D_809F1C00;
extern DamageTable D_809F1C20;
-extern UNK_TYPE D_060006A4;
-extern UNK_TYPE D_06000A5C;
-extern UNK_TYPE D_06000ABC;
-extern UNK_TYPE D_06002F0C;
-extern UNK_TYPE D_06003448;
-extern UNK_TYPE D_06006240;
-extern UNK_TYPE D_06006E50;
-extern UNK_TYPE D_06007488;
-extern UNK_TYPE D_06007908;
+extern AnimationHeader D_060006A4;
+extern AnimationHeader D_06000A5C;
+extern AnimationHeader D_06000ABC;
+extern FlexSkeletonHeader D_060024E0;
+extern AnimationHeader D_06002F0C;
+extern AnimationHeader D_06003448;
+extern AnimatedMaterial D_06006240[];
+extern FlexSkeletonHeader D_06006378;
+extern AnimationHeader D_06006484;
+extern AnimationHeader D_06006E50;
+extern AnimationHeader D_06007488;
+extern AnimationHeader D_06007908;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EE4E0.s")
+extern Color_RGBA8 D_809F1BEC;
+extern Color_RGBA8 D_809F1BF0;
+extern Vec3f D_809F1BF4;
+// static Color_RGBA8 D_809F1BEC = { 0xAA, 0xFF, 0xFF, 0xFF };
+// static Color_RGBA8 D_809F1BF0 = { 0xC8, 0xC8, 0xFF, 0xFF };
+// static Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
+
+void func_809EE4E0(Boss05* this, PlayState* play) {
+ Vec3f sp8C;
+ Vec3f sp80;
+ s32 i;
+
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->unk18C, 30, NA_SE_EV_ICE_BROKEN);
+ for (i = 0; i < 8; i++) {
+ sp80.x = randPlusMinusPoint5Scaled(7.0f);
+ sp80.z = randPlusMinusPoint5Scaled(7.0f);
+ sp80.y = Rand_ZeroFloat(6.0f) + 4.0f;
+ sp8C.x = this->unk18C.x + sp80.x;
+ sp8C.y = this->unk18C.y + sp80.y;
+ sp8C.z = this->unk18C.z + sp80.z;
+ EffectSsEnIce_Spawn(play, &sp8C, Rand_ZeroFloat(0.5f) + 0.7f, &sp80, &D_809F1BF4, &D_809F1BEC, &D_809F1BF0, 30);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EE668.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/Boss05_Init.s")
+void Boss05_Init(Actor* thisx, PlayState* play) {
+ s32 pad;
+ Boss05* this = THIS;
+ CollisionHeader* colHeader = NULL;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/Boss05_Destroy.s")
+ this->dyna.actor.targetMode = 3;
+ this->dyna.actor.colChkInfo.mass = MASS_HEAVY;
+ this->dyna.actor.colChkInfo.health = 2;
+ this->unk160 = (s32)Rand_ZeroFloat(1000.0f);
+ this->unk35C = 1.0f;
+ this->dyna.actor.gravity = -0.3f;
+
+ Actor_SetScale(&this->dyna.actor, 0.01f);
+
+ if ((this->dyna.actor.params == 0) || (this->dyna.actor.params == 1)) {
+ if (this->dyna.actor.world.rot.z == 0) {
+ this->dyna.actor.world.rot.z = 0;
+ }
+
+ this->dyna.actor.shape.rot.z = 0;
+ this->unk168 = this->dyna.actor.world.rot.z;
+ this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
+ this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
+
+ DynaPolyActor_Init(&this->dyna, 0);
+ CollisionHeader_GetVirtual(&D_809F1B00, &colHeader);
+ this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
+ func_809EEDD0(this, play);
+
+ SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
+ SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
+ this->unk4FC = Animation_GetLastFrame(&D_06006484);
+
+ Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
+ Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+
+ if (Flags_GetClear(play, play->roomCtx.currRoom.num)) {
+ this->dyna.actor.params = 2;
+ this->actionFunc = func_809EF9BC;
+ this->dyna.actor.flags &= ~ACTOR_FLAG_1;
+ func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG);
+ }
+ } else if (this->dyna.actor.params == 2) {
+ this->actionFunc = func_809EF9BC;
+
+ CollisionHeader_GetVirtual(&D_809F1B00, &colHeader);
+ this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
+
+ SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
+ this->dyna.actor.flags &= ~ACTOR_FLAG_1;
+ func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG);
+ } else if (this->dyna.actor.params == 3) {
+ this->actionFunc = func_809EFAB4;
+ this->unk198 = 1.0f;
+
+ SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
+ SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+ this->unk4FC = Animation_GetLastFrame(&D_06006484);
+
+ Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
+ Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+
+ ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
+ this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
+ } else if (this->dyna.actor.params == 4) {
+ func_809F00CC(this, play);
+ this->dyna.actor.colChkInfo.mass = 90;
+
+ SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
+
+ Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BDC, this->unk388);
+
+ ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
+ this->dyna.actor.colChkInfo.damageTable = &D_809F1C20;
+ this->dyna.actor.flags |= ACTOR_FLAG_10 | ACTOR_FLAG_20;
+ } else if (this->dyna.actor.params >= 10) {
+ SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
+
+ this->dyna.actor.gravity = 0.0f;
+ this->dyna.actor.world.rot.y = (s32)Rand_ZeroFloat(0x8000);
+ this->dyna.actor.speedXZ = Rand_ZeroFloat(3.0f) + 3.0f;
+ this->dyna.actor.velocity.y = Rand_ZeroFloat(1.5f) + 1.5f;
+
+ this->unk500 = (s32)randPlusMinusPoint5Scaled(700.0f);
+ this->unk502 = (s32)randPlusMinusPoint5Scaled(1500.0f);
+ this->unk162[0] = (s32)(Rand_ZeroFloat(30.0f) + 50.0f);
+
+ this->dyna.actor.flags &= ~ACTOR_FLAG_1;
+ this->actionFunc = func_809F0B0C;
+ }
+}
+
+void Boss05_Destroy(Actor* thisx, PlayState* play) {
+ Boss05* this = THIS;
+
+ if ((this->dyna.actor.params == 2) || (this->dyna.actor.params == 0) || (this->dyna.actor.params == 1)) {
+ DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EECBC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EEDD0.s")
+void func_809EEDD0(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809EEDE8;
+}
+// The big one
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EEDE8.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EF9BC.s")
+void func_809EF9BC(Boss05* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ f32 temp_fv0 = sqrtf(this->dyna.actor.xyzDistToPlayerSq);
+ s16 var_a1;
+
+ if ((temp_fv0 < 50.0f) && (player->actor.bgCheckFlags & 1)) {
+ var_a1 = (s32)(temp_fv0 * 80.0f);
+ var_a1 = CLAMP_MAX(var_a1, 0x7D0);
+ // if (var_a1 > 0x7D0) {
+ // var_a1 = 0x7D0;
+ // }
+ Math_ApproachS(&this->unk178, var_a1, 0x14, 0x7D0);
+ Math_ApproachS(&this->unk176, this->dyna.actor.yawTowardsPlayer, 0x14, 0xFA0);
+ if (!(this->unk160 & 0xF)) {
+ EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x1F4, 0x3E8, 0);
+ }
+ } else {
+ Math_ApproachS(&this->unk178, 0, 0x14, 0x100);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EFAB4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EFE50.s")
+void func_809EFE50(Actor* thisx, PlayState* play2) {
+ PlayState* play = play2;
+ Boss05* this = THIS;
+ u8 var_a2 = 0;
+ ColliderInfo* temp;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0014.s")
+ if ((this->unk16A == 0) && (this->unk368.elements[0].info.bumperFlags & BUMP_HIT)) {
+ this->unk368.elements[0].info.bumperFlags &= ~BUMP_HIT;
+ temp = this->unk368.elements[0].info.acHitInfo;
+ if (temp->toucher.dmgFlags & 0x300000) { // (DMG_NORMAL_SHIELD | DMG_LIGHT_RAY)
+ this->unk338 = -12.0f;
+ this->unk348 = this->dyna.actor.yawTowardsPlayer;
+ this->unk16A = 6;
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0058.s")
+ this->unk16A = 0xA;
+ this->dyna.actor.speedXZ = 0.0f;
+ this->unk338 = -20.0f;
+ this->unk348 = this->dyna.actor.yawTowardsPlayer;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F00CC.s")
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F010C.s")
+ switch (this->dyna.actor.colChkInfo.damageEffect) {
+ case 1:
+ func_809F0A0C(this, play);
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F01CC.s")
+ case 2:
+ this->unk188 = 1;
+ var_a2 = 1;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0244.s")
+ case 3:
+ func_809F0A64(this, play);
+ this->unk188 = 0xA;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F02D0.s")
+ case 4:
+ this->unk188 = 0x14;
+ var_a2 = 1;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0374.s")
+ default:
+ var_a2 = 1;
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0474.s")
+ if (var_a2 != 0) {
+ u8 damage; // Probably fake?
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F04C0.s")
+ if ((this->actionFunc == func_809F0ABC) && (this->unk189 == 0xA) && (this->unk17A != 0)) {
+ func_809EE4E0(this, play);
+ this->unk188 = 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0538.s")
+ damage = this->dyna.actor.colChkInfo.damage;
+ this->dyna.actor.colChkInfo.health -= damage;
+ if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
+ Enemy_StartFinishingBlow(play, &this->dyna.actor);
+ }
+ func_809F0708(this, play);
+ this->unk16C = 0xF;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0590.s")
+s32 func_809F0014(Boss05* this, PlayState* play) {
+ s16 var_v1 = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0650.s")
+ if (ABS_ALT(var_v1) < 0x3000) {
+ return true;
+ } else {
+ return false;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F06B8.s")
+void func_809F0058(Boss05* this, PlayState* play) {
+ if (func_809F0014(this, play) && (this->dyna.actor.xyzDistToPlayerSq <= SQ(200.0f)) &&
+ (fabsf(this->dyna.actor.playerHeightRel) < 70.0f)) {
+ func_809F0474(this, play);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0708.s")
+void func_809F00CC(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F010C;
+ Animation_MorphToPlayOnce(&this->unk3C8, &D_06006E50, -5.0f);
+}
+
+void func_809F010C(Boss05* this, PlayState* play) {
+ SkelAnime_Update(&this->unk3C8);
+ Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
+ Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
+ Math_ApproachF(&this->unk360, 1.0f, 1.0f, 0.5f);
+ Math_ApproachF(&this->unk364, 1.0f, 1.0f, 0.14f);
+ if (this->unk364 == 1.0f) {
+ func_809F01CC(this, play);
+ }
+}
+
+void func_809F01CC(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F0244;
+ Animation_MorphToLoop(&this->unk3C8, &D_06007488, -10.0f);
+ this->unk162[0] = (s32)(Rand_ZeroFloat(25.0f) + 25.0f);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
+}
+
+void func_809F0244(Boss05* this, PlayState* play) {
+ SkelAnime_Update(&this->unk3C8);
+ Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+ Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
+ Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
+
+ if (this->unk162[0] == 0) {
+ func_809F02D0(this, play);
+ }
+
+ func_809F0058(this, play);
+}
+
+void func_809F02D0(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F0374;
+ Animation_MorphToLoop(&this->unk3C8, &D_06007908, 0.0f);
+ this->unk162[0] = (s32)(Rand_ZeroFloat(80.0f) + 60.0f);
+ this->unk34C = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.x;
+ this->unk354 = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.z;
+ this->unk358 = 0.0f;
+}
+
+void func_809F0374(Boss05* this, PlayState* play) {
+ f32 sp24;
+ f32 sp20;
+
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_WALK - SFX_FLAG);
+ SkelAnime_Update(&this->unk3C8);
+ Math_ApproachF(&this->dyna.actor.speedXZ, 5.0f, 1.0f, 2.0f);
+ sp24 = this->unk34C - this->dyna.actor.world.pos.x;
+ sp20 = this->unk354 - this->dyna.actor.world.pos.z;
+ Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(sp24, sp20), 5, (s32)this->unk358);
+ Math_ApproachF(&this->unk358, 2000.0f, 1.0f, 100.0f);
+
+ if ((this->unk162[0] == 0) || ((SQ(sp24) + SQ(sp20)) < 2500.0f)) {
+ func_809F01CC(this, play);
+ }
+
+ func_809F0058(this, play);
+}
+
+void func_809F0474(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F04C0;
+ Animation_MorphToPlayOnce(&this->unk3C8, &D_06003448, 0.0f);
+ this->unk162[0] = 20;
+}
+
+void func_809F04C0(Boss05 *this, PlayState *play) {
+ SkelAnime_Update(&this->unk3C8);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
+ Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+ Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, 0x1000);
+ if (this->unk162[0] == 0) {
+ func_809F0538(this, play);
+ }
+}
+
+void func_809F0538(Boss05 *this, PlayState *arg1) {
+ this->actionFunc = func_809F0590;
+ Animation_MorphToLoop(&this->unk3C8, &D_06000A5C, 0.0f);
+ this->unk162[0] = 60;
+ this->unk358 = 0.0f;
+}
+
+void func_809F0590(Boss05 *this, PlayState *play) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
+ SkelAnime_Update(&this->unk3C8);
+ Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
+ Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s32) this->unk358);
+ Math_ApproachF(&this->unk358, 4000.0f, 1.0f, 400.0f);
+ if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
+ func_809F0650(this, play);
+ }
+}
+
+void func_809F0650(Boss05 *this, PlayState *arg1) {
+ this->actionFunc = func_809F06B8;
+ Animation_MorphToPlayOnce(&this->unk3C8, &D_060006A4, 0.0f);
+ this->unk4FC = Animation_GetLastFrame(&D_060006A4);
+ Actor_PlaySfxAtPos(this, NA_SE_EN_MIZUBABA2_ATTACK);
+}
+
+void func_809F06B8(Boss05 *this, PlayState *play) {
+ SkelAnime_Update(&this->unk3C8);
+ if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ func_809F01CC(this, play);
+ }
+}
+
+void func_809F0708(Boss05 *this, PlayState *play) {
+ this->actionFunc = func_809F0780;
+ Animation_MorphToPlayOnce(&this->unk3C8, &D_06002F0C, 0.0f);
+ this->unk4FC = Animation_GetLastFrame(&D_060006A4);
+ Actor_SetColorFilter(&this->dyna.actor, 0x4000U, 120, 0, 30);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0780.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0A0C.s")
+void func_809F0A0C(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F0ABC;
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
+ this->unk162[0] = 40;
+ Actor_SetColorFilter(&this->dyna.actor, 0, 120, 0, 40);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0A64.s")
+void func_809F0A64(Boss05* this, PlayState* play) {
+ this->actionFunc = func_809F0ABC;
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
+ this->unk162[0] = 80;
+ Actor_SetColorFilter(&this->dyna.actor, 0, 120, 0, 80);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0ABC.s")
+void func_809F0ABC(Boss05* this, PlayState* play) {
+ Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+ if (this->unk162[0] == 0) {
+ func_809F01CC(this, play);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0B0C.s")
+void func_809F0B0C(Boss05* this, PlayState* play) {
+ Actor_MoveWithGravity(&this->dyna.actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/Boss05_Update.s")
+ if (this->unk15C == 0) {
+ Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44);
+ if (this->dyna.actor.bgCheckFlags & 0x20) {
+ this->unk15C = 1;
+ } else {
+ this->unk15C = 2;
+ }
+ }
+
+ if (this->unk15C == 1) {
+ Math_ApproachF(&this->dyna.actor.velocity.y, 1.0f, 1.0f, 0.1f);
+ Math_ApproachZeroF(&this->dyna.actor.speedXZ, 0.5f, 0.5f);
+ this->dyna.actor.shape.rot.x += this->unk500;
+ this->dyna.actor.shape.rot.y += this->unk502;
+
+ if (this->unk162[0] == 0) {
+ Actor_MarkForDeath(&this->dyna.actor);
+ }
+ } else {
+ switch (this->unk15C) {
+ case 2:
+ this->dyna.actor.velocity.y = Rand_ZeroFloat(3.0f) + 3.0f;
+ this->dyna.actor.speedXZ = randPlusMinusPoint5Scaled(5.0f) + 5.0f;
+ this->dyna.actor.world.rot.y = (s32)Rand_ZeroFloat(0x10000);
+ this->dyna.actor.gravity = -1.0f;
+ this->unk15C = 3;
+ break;
+
+ case 3:
+ Actor_MoveWithGravity(&this->dyna.actor);
+
+ if (this->unk324.y < (this->dyna.actor.floorHeight - 30.0f)) {
+ Actor_MarkForDeath(&this->dyna.actor);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Boss05_Update(Actor* thisx, PlayState* play) {
+ s32 pad;
+ Boss05* this = (Boss05*)thisx;
+ s16 var_v0;
+
+ this->unk160++;
+
+ for (var_v0 = 0; var_v0 < 3; var_v0++) {
+ if (this->unk162[var_v0] != 0) {
+ this->unk162[var_v0]--;
+ }
+ }
+
+ if (this->unk16A != 0) {
+ this->unk16A--;
+ }
+
+ if (this->unk16C != 0) {
+ this->unk16C--;
+ }
+ if (this->unk168 != 0) {
+ this->unk168--;
+ }
+
+ if (this->unk17A != 0) {
+ this->unk17A--;
+ }
+
+ this->actionFunc(this, play);
+
+ if (this->dyna.actor.params == 4) {
+ Actor_MoveWithGravity(&this->dyna.actor);
+ Matrix_RotateYS(this->unk348, MTXMODE_NEW);
+ Matrix_MultVecZ(this->unk338, &this->unk33C);
+ this->dyna.actor.world.pos.x += this->unk33C.x;
+ this->dyna.actor.world.pos.z += this->unk33C.z;
+ Math_ApproachZeroF(&this->unk338, 1.0f, 1.0f);
+ Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x45);
+ func_809EFE50(this, play);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk368.base);
+ this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
+ }
+
+ switch (this->unk188) {
+ case 0:
+ this->unk189 = 0;
+ this->unk17A = 0;
+ this->unk184 = 0.0f;
+ break;
+
+ case 1:
+ this->unk189 = 0;
+ this->unk17A = 80;
+ this->unk184 = 1.0f;
+ this->unk188++;
+ this->unk17C = 0.0f;
+ // fallthrough
+ case 2:
+ if (this->unk17A == 0) {
+ Math_ApproachZeroF(&this->unk184, 1.0f, 0.02f);
+ if (this->unk184 == 0.0f) {
+ this->unk188 = 0;
+ }
+ } else {
+ Math_ApproachF(&this->unk17C, 1.0f, 0.1f, 0.5f);
+ }
+ break;
+
+ case 10:
+ this->unk189 = 0xA;
+ this->unk17A = 80;
+ this->unk184 = 1.0f;
+ this->unk188++;
+ this->unk17C = 0.0f;
+ this->unk180 = 2.0f;
+ // fallthrough
+ case 11:
+ if (this->unk17A == 0) {
+ func_809EE4E0(this, play);
+ this->unk188 = 0;
+ } else {
+ Math_ApproachF(&this->unk17C, 1.0f, 1.0f, 0.25f);
+ Math_ApproachF(&this->unk180, 1.0f, 0.1f, 0.1f);
+ }
+ break;
+
+ case 20:
+ this->unk189 = 0x14;
+ this->unk17A = 80;
+ this->unk184 = 1.0f;
+ this->unk188++;
+ this->unk17C = 0.0f;
+ break;
+
+ case 21:
+ if (this->unk17A == 0) {
+ Math_ApproachZeroF(&this->unk17C, 1.0f, 0.03f);
+
+ if (this->unk17C == 0.0f) {
+ this->unk188 = 0;
+ this->unk184 = 0.0f;
+ }
+ } else {
+ Math_ApproachF(&this->unk17C, 1.0f, 0.5f, 0.5f);
+ }
+ break;
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1050.s")
@@ -263,3 +755,1550 @@ extern UNK_TYPE D_06007908;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1550.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/Boss05_Draw.s")
+
+// typedef struct Boss05 {
+// /* 0x000 */ DynaPolyActor dyna;
+// /* 0x15C */ u8 unk15C;
+// /* 0x15D */ char pad15D[1];
+// /* 0x15E */ s16 unk15E; /* inferred */
+// /* 0x160 */ s16 unk160;
+// /* 0x162 */ s16 unk162[3];
+// /* 0x168 */ s16 unk168;
+// /* 0x16A */ s16 unk16A;
+// /* 0x16C */ s16 unk16C;
+// /* 0x16E */ char pad16E[2];
+// /* 0x170 */ void (*actionFunc)(Boss05 *, PlayState *);
+// /* 0x174 */ u8 unk174; /* inferred */
+// /* 0x175 */ char pad175[1];
+// /* 0x176 */ s16 unk176;
+// /* 0x178 */ s16 unk178;
+// /* 0x17A */ s16 unk17A;
+// /* 0x17C */ f32 unk17C;
+// /* 0x180 */ f32 unk180;
+// /* 0x184 */ f32 unk184;
+// /* 0x188 */ u8 unk188;
+// /* 0x189 */ u8 unk189;
+// /* 0x18A */ char pad18A[2]; /* maybe part of unk189[3]? */
+// /* 0x18C */ Vec3f unk18C;
+// /* 0x198 */ f32 unk198;
+// /* 0x19C */ s16 unk19C; /* inferred */
+// /* 0x19E */ s16 unk19E; /* inferred */
+// /* 0x1A0 */ s16 unk1A0; /* inferred */
+// /* 0x1A2 */ s16 unk1A2; /* inferred */
+// /* 0x1A4 */ char pad1A4[0x24]; /* maybe part of unk1A2[0x13]? */
+// /* 0x1C8 */ ColliderJntSph unk1C8;
+// /* 0x1E8 */ ColliderJntSphElement unk1E8[2];
+// /* 0x268 */ SkelAnime unk268;
+// /* 0x2AC */ Vec3s unk2AC[0xA];
+// /* 0x2E8 */ Vec3s unk2E8[0xA];
+// /* 0x324 */ Vec3f unk324;
+// /* 0x330 */ s8 unk330[8];
+// /* 0x338 */ f32 unk338;
+// /* 0x33C */ Vec3f unk33C;
+// /* 0x348 */ s16 unk348;
+// /* 0x34A */ s8 unk34A[0x12];
+// /* 0x35C */ f32 unk35C;
+// /* 0x360 */ f32 unk360; /* inferred */
+// /* 0x364 */ f32 unk364; /* inferred */
+// /* 0x368 */ ColliderJntSph unk368;
+// /* 0x388 */ ColliderJntSphElement unk388[1];
+// /* 0x3C8 */ SkelAnime unk3C8;
+// /* 0x40C */ Vec3s unk40C[0x14];
+// /* 0x484 */ Vec3s unk484[0x14];
+// /* 0x4FC */ f32 unk4FC;
+// /* 0x500 */ s16 unk500;
+// /* 0x502 */ s16 unk502;
+// /* 0x504 */ char pad504[4]; /* maybe part of unk502[3]? */
+// } Boss05; /* size = 0x508 */
+
+// void func_809F00CC(Boss05 *arg0, PlayState *arg1); /* static */
+// void func_809F02D0(Boss05 *arg0, PlayState *arg1); /* static */
+// void func_809F0474(Boss05 *arg0, PlayState *arg1); /* static */
+// void func_809F0538(Boss05 *arg0, PlayState *arg1); /* static */
+// void func_809F0650(Boss05 *arg0, PlayState *arg1); /* static */
+// static BgCamInfo D_809F1A20 = { 0, 0, NULL };
+// static SurfaceType D_809F1A28 = { { 0x10000, 0x7C8 } };
+// static CollisionPoly D_809F1A30[0xA]; /* unable to generate initializer */
+// static Vec3s D_809F1AD0[8] = {
+// { -0xDAC, 0, -0xDAC },
+// { -0xDAC, 0, 0xDAC },
+// { 0xDAC, 0, 0xDAC },
+// { 0xDAC, 0, -0xDAC },
+// { 0xDAC, -0xFA0, -0xDAC },
+// { -0xDAC, -0xFA0, -0xDAC },
+// { 0xDAC, -0xFA0, 0xDAC },
+// { -0xDAC, -0xFA0, 0xDAC },
+// };
+// static ? D_809F1C60; /* unable to generate initializer */
+// static ? D_809F1C8C; /* unable to generate initializer */
+// static ? D_809F1CB8; /* unable to generate initializer */
+// static s32 D_809F1CC0[1] = { 0x06FFFF00 };
+// static Vec3f D_809F1CC4 = { 0.0f, -1400.0f, 600.0f };
+// static Vec3f D_809F1CD0 = { 1600.0f, -300.0f, 0.0f };
+// static Vec3f D_809F1CDC[5] = {
+// { 700.0f, 0.0f, 0.0f },
+// { 3e-45.0f, 4e-45.0f, 1e-45.0f },
+// { 6e-45.0f, 7e-45.0f, 1e-44.0f },
+// { 1.1e-44f, 1.4e-44f, 1.5e-44f },
+// { 1.8e-44f, 2e-44.0f, 2.2e-44f },
+// }; /* extra bytes: 8 */
+// static Vec3f D_809F2110;
+// CollisionHeader D_809F1B00 = {
+// { -0xDAC, -0xFA0, -0xDAC },
+// { 0xDAC, 0, 0xDAC },
+// 8,
+// D_809F1AD0,
+// 0xA,
+// D_809F1A30,
+// &D_809F1A28,
+// &D_809F1A20,
+// 0,
+// NULL,
+// };
+// ColliderJntSphElementInit D_809F1B2C[2] = {
+// {
+// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
+// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
+// },
+// {
+// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
+// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
+// },
+// };
+// ColliderJntSphInit D_809F1B74 = { { 3, 0x11, 9, 9, 0x10, 0 }, 2, D_809F1B2C };
+// ColliderJntSphElementInit D_809F1B84[1] = {
+// {
+// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
+// { 0, { { 0, 0, 0 }, 0x14 }, 0x64 },
+// },
+// };
+// ColliderJntSphInit D_809F1BA8 = { { 3, 0x11, 9, 9, 0x10, 0 }, 1, D_809F1B84 };
+// ColliderJntSphElementInit D_809F1BB8[1] = {
+// {
+// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7FFFFFF, 0, 0 }, 9, 1, 1 },
+// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
+// },
+// };
+// ColliderJntSphInit D_809F1BDC = { { 3, 0x11, 9, 9, 0x10, 0 }, 1, D_809F1BB8 };
+// Color_RGBA8 D_809F1BEC = { 0xAA, 0xFF, 0xFF, 0xFF };
+// Color_RGBA8 D_809F1BF0 = { 0xC8, 0xC8, 0xFF, 0xFF };
+// Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
+// DamageTable D_809F1C00 = {
+// {
+// 0,
+// 0xF1,
+// 0,
+// 0xF1,
+// 0xF1,
+// 0xF3,
+// 0,
+// 3,
+// 0xF2,
+// 0xE1,
+// 0xF1,
+// 0x21,
+// 0x31,
+// 0x43,
+// 0xF1,
+// 0xF1,
+// 0xF3,
+// 0xF2,
+// 0,
+// 0xF1,
+// 0,
+// 0,
+// 0xF1,
+// 0xF1,
+// 0xF1,
+// 0,
+// 0,
+// 0,
+// 0,
+// 0,
+// 0,
+// 0xF1,
+// },
+// };
+// DamageTable D_809F1C20 = {
+// {
+// 0x10,
+// 0xF3,
+// 0,
+// 0xF1,
+// 0xF1,
+// 0xF1,
+// 0,
+// 0x10,
+// 0xF1,
+// 0xF1,
+// 0xF1,
+// 0x22,
+// 0x32,
+// 0x42,
+// 0xF1,
+// 0x10,
+// 0xF1,
+// 0xF2,
+// 0x10,
+// 0xF1,
+// 0,
+// 0,
+// 0xF1,
+// 0xF1,
+// 0xF1,
+// 0,
+// 0,
+// 0x21,
+// 0,
+// 0,
+// 0,
+// 0xF1,
+// },
+// };
+
+// void func_809EE4E0(Boss05 *this, PlayState *play) {
+// f32 sp94;
+// f32 sp90;
+// f32 sp8C;
+// f32 sp88;
+// f32 sp84;
+// f32 sp80;
+// s32 var_s1;
+
+// SoundSource_PlaySfxAtFixedWorldPos(play, &this->unk18C, 0x1EU, 0x28CBU);
+// var_s1 = 0;
+// do {
+// sp80 = randPlusMinusPoint5Scaled(7.0f);
+// sp88 = randPlusMinusPoint5Scaled(7.0f);
+// sp84 = Rand_ZeroFloat(6.0f) + 4.0f;
+// sp8C = this->unk18C.x + sp80;
+// sp90 = this->unk18C.y + sp84;
+// sp94 = this->unk18C.z + sp88;
+// EffectSsEnIce_Spawn(play, (Vec3f *) &sp8C, Rand_ZeroFloat(0.5f) + 0.7f, (Vec3f *) &sp80, &D_809F1BF4,
+// &D_809F1BEC, &D_809F1BF0, 0x1E); var_s1 += 1;
+// } while (var_s1 != 8);
+// }
+
+// void func_809EE668(s32 arg0, void *arg1, Vec3f *arg2) {
+// s32 temp_v0;
+// void *temp_v1;
+
+// temp_v0 = arg0 << 6;
+// (arg1->unk1C + temp_v0)->unk30 = (s16) (s32) arg2->x;
+// (arg1->unk1C + temp_v0)->unk32 = (s16) (s32) arg2->y;
+// (arg1->unk1C + temp_v0)->unk34 = (s16) (s32) arg2->z;
+// temp_v1 = arg1->unk1C + temp_v0;
+// temp_v1->unk36 = (s16) (s32) (temp_v1->unk38 * (f32) temp_v1->unk2E);
+// }
+
+// void Boss05_Init(Actor *thisx, PlayState *play) {
+// CollisionHeader *sp34;
+// s16 temp_v0;
+// s32 temp_ft0;
+// s32 temp_t0;
+// Boss05 *this = (Boss05 *) thisx;
+
+// sp34 = NULL;
+// this->dyna.actor.targetMode = 3;
+// this->dyna.actor.colChkInfo.mass = 0xFE;
+// this->dyna.actor.colChkInfo.health = 2;
+// temp_t0 = (s32) Rand_ZeroFloat(1000.0f);
+// this->unk35C = 1.0f;
+// this->unk160 = (s16) temp_t0;
+// this->dyna.actor.gravity = -0.3f;
+// Actor_SetScale(&this->dyna.actor, 0.01f);
+// temp_v0 = this->dyna.actor.params;
+// if ((temp_v0 == 0) || (temp_v0 == 1)) {
+// if (this->dyna.actor.world.rot.z == 0) {
+// this->dyna.actor.world.rot.z = 0;
+// }
+// this->dyna.actor.shape.rot.z = 0;
+// this->unk168 = this->dyna.actor.world.rot.z;
+// this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
+// this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
+// DynaPolyActor_Init(&this->dyna, 0);
+// CollisionHeader_GetVirtual(&D_809F1B00, &sp34);
+// this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34);
+// func_809EEDD0(this, play);
+// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
+// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+// this->unk4FC = (f32) Animation_GetLastFrame(&D_06006484);
+// Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
+// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+// if (Flags_GetClear(play, (s32) play->roomCtx.currRoom.num) != 0) {
+// this->dyna.actor.params = 2;
+// this->actionFunc = func_809EF9BC;
+// this->dyna.actor.flags &= ~1;
+// func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1U);
+// }
+// } else {
+// if (temp_v0 == 2) {
+// this->actionFunc = func_809EF9BC;
+// CollisionHeader_GetVirtual(&D_809F1B00, &sp34);
+// this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34);
+// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
+// this->dyna.actor.flags &= ~1;
+// func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1U);
+// return;
+// }
+// if (temp_v0 == 3) {
+// this->actionFunc = func_809EFAB4;
+// this->unk198 = 1.0f;
+// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
+// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+// this->unk4FC = (f32) Animation_GetLastFrame(&D_06006484);
+// Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
+// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+// ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
+// this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
+// return;
+// }
+// if (temp_v0 == 4) {
+// func_809F00CC(this, play);
+// this->dyna.actor.colChkInfo.mass = 0x5A;
+// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BDC, this->unk388);
+// ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
+// this->dyna.actor.colChkInfo.damageTable = &D_809F1C20;
+// this->dyna.actor.flags |= 0x30;
+// return;
+// }
+// if (temp_v0 >= 0xA) {
+// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+// this->dyna.actor.gravity = 0.0f;
+// this->dyna.actor.world.rot.y = (s16) (s32) Rand_ZeroFloat(32768.0f);
+// this->dyna.actor.speedXZ = Rand_ZeroFloat(3.0f) + 3.0f;
+// this->dyna.actor.velocity.y = Rand_ZeroFloat(1.5f) + 1.5f;
+// this->unk500 = (s16) (s32) randPlusMinusPoint5Scaled(700.0f);
+// this->unk502 = (s16) (s32) randPlusMinusPoint5Scaled(1500.0f);
+// temp_ft0 = (s32) (Rand_ZeroFloat(30.0f) + 50.0f);
+// this->dyna.actor.flags &= ~1;
+// this->actionFunc = func_809F0B0C;
+// this->unk162[0] = (s16) temp_ft0;
+// }
+// }
+// }
+
+// void Boss05_Destroy(Actor *thisx, PlayState *play) {
+// s16 temp_v0;
+// Boss05 *this = (Boss05 *) thisx;
+
+// temp_v0 = this->dyna.actor.params;
+// if ((temp_v0 == 2) || (temp_v0 == 0) || (temp_v0 == 1)) {
+// DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
+// }
+// }
+
+// s32 func_809EECBC(Actor *arg0, PlayState *arg1) {
+// s32 var_v0;
+// u8 temp_v0;
+// void *var_v1;
+
+// var_v0 = 0;
+// if (arg0->unk16C == 0) {
+// var_v1 = arg0->unk1E4;
+// loop_2:
+// var_v0 += 0x40;
+// if (var_v1->unk16 & 2) {
+// temp_v0 = arg0->colChkInfo.damageEffect;
+// switch (temp_v0) { /* irregular */
+// case 2:
+// return 0xB;
+// case 3:
+// return 0x14;
+// case 4:
+// return 0x1E;
+// default:
+// return 0xA;
+// }
+// } else {
+// var_v1 += 0x40;
+// if (var_v0 == 0x80) {
+// if (arg0->unk384->unk16 & 2) {
+// arg0->colChkInfo.health -= arg0->colChkInfo.damage;
+// if ((s8) arg0->colChkInfo.health <= 0) {
+// Enemy_StartFinishingBlow(arg1, arg0);
+// return 2;
+// }
+// Actor_PlaySfxAtPos(arg0, 0x3807U);
+// arg0->unk16C = 0xF;
+// arg0->unk15C = 0;
+// arg0->unk162 = 0x1E;
+// return 0;
+// }
+// goto block_16;
+// }
+// goto loop_2;
+// }
+// } else {
+// block_16:
+// return 0;
+// }
+// }
+
+// void func_809EEDD0(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809EEDE8;
+// }
+
+// void func_809EEDE8(Boss05 *this, PlayState *play) {
+// Actor *sp108;
+// u8 sp103;
+// ? spD8;
+// s32 spD4;
+// s32 spD0;
+// s32 spCC;
+// s32 spC8;
+// s32 spC4;
+// s32 spC0;
+// s32 spBC;
+// s32 spB8;
+// s32 spB4;
+// f32 spA4;
+// Vec3f sp94;
+// f32 sp80;
+// s32 sp74;
+// f32 sp70;
+// s16 *sp6C;
+// s16 *sp60;
+// s16 *sp5C;
+// ? *temp_t5;
+// ? *var_s1;
+// ? temp_t2_2;
+// ? temp_t4;
+// ? temp_t5_4;
+// Actor *temp_v0_6;
+// Actor *temp_v0_7;
+// Actor *temp_v1;
+// ActorContext *temp_s0_2;
+// CollisionCheckContext *temp_s0_3;
+// CollisionCheckContext *temp_s0_4;
+// SkelAnime *temp_s0;
+// f32 *temp_s1;
+// f32 temp_ft4;
+// f32 var_fv1;
+// s16 var_s4;
+// s16 var_s5;
+// s16 var_s6;
+// s16 var_s7;
+// s32 temp_lo;
+// s32 temp_v0_5;
+// s32 var_s0;
+// s32 var_s0_2;
+// s32 var_s0_3;
+// s32 var_s3;
+// s32 var_s3_2;
+// s32 var_s4_2;
+// s32 var_v1;
+// u8 temp_v0;
+// u8 temp_v0_2;
+// void *temp_t1;
+// void *temp_t1_2;
+// void *temp_t2;
+// void *temp_t2_3;
+// void *temp_t2_4;
+// void *temp_t3;
+// void *temp_t3_2;
+// void *temp_t5_2;
+// void *temp_t5_3;
+// void *temp_t6;
+// void *temp_t6_2;
+// void *temp_t7;
+// void *temp_t8;
+// void *temp_t8_2;
+// void *temp_t9;
+// void *temp_t9_2;
+// void *temp_t9_3;
+// void *temp_v0_3;
+// void *temp_v0_4;
+
+// sp103 = 0;
+// var_s3 = 0;
+// sp108 = play->actorCtx.actorLists[2].first;
+// temp_v0 = this->unk174;
+// this->dyna.actor.hintId = 8;
+// var_s0 = 0;
+// var_s1 = &spD8;
+// if (temp_v0 == 0) {
+// spD4 = 0x3E8;
+// spD0 = 0x3E80;
+// spCC = 0x7D0;
+// spC8 = 0x5DC;
+// spC4 = 0x1770;
+// spC0 = 0xBB8;
+// spBC = 0x514;
+// spB8 = 0x5208;
+// spB4 = 0xDAC;
+// var_s6 = 0xA;
+// var_s7 = 0x300;
+// if (this->unk16C != 0) {
+// spD4 = 0x1B58;
+// spCC = 0x1770;
+// spC0 = 0x1770;
+// spBC = 0x1C84;
+// spB4 = 0x1964;
+// var_s6 = 1;
+// var_s7 = 0x1000;
+// }
+// } else {
+// var_s7 = 0;
+// if (temp_v0 == 3) {
+// spD4 = 0x1B58;
+// spD0 = 0x3E80;
+// spCC = 0x1388;
+// spC8 = 0x5DC;
+// spC4 = 0x2328;
+// spC0 = 0x1388;
+// spBC = 0x1C84;
+// spB8 = 0x5208;
+// spB4 = 0x157C;
+// var_s6 = 1;
+// var_s7 = 0x1000;
+// } else {
+// var_s6 = 0;
+// spB4 = 0;
+// spB8 = 0;
+// spBC = 0;
+// spC0 = 0;
+// spC4 = 0;
+// spC8 = 0;
+// spCC = 0;
+// spD0 = 0;
+// spD4 = 0;
+// }
+// }
+// sp5C = &this->unk1A2;
+// sp60 = &this->unk1A0;
+// sp6C = &this->unk19E;
+// do {
+// temp_v0_2 = this->unk174;
+// if ((temp_v0_2 == 0) || (temp_v0_2 == 3)) {
+// temp_lo = var_s3 * spB8;
+// var_s5 = var_s7;
+// var_s4 = var_s6;
+// sp70 = (f32) spB4;
+// if (var_s3 < 3) {
+// var_s1->unk2 = 0;
+// sp74 = temp_lo;
+// sp80 = (f32) spCC;
+// var_s1->unk0 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spD4) + (var_s3 * spD0))) * sp80);
+// } else {
+// var_s1->unk0 = 0;
+// sp74 = temp_lo;
+// sp80 = (f32) spC0;
+// var_s1->unk2 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spC8) + (var_s3 * spC4))) * sp80);
+// }
+// if ((var_s3 == 4) || (var_s3 == 6)) {
+// var_s1->unk4 = (s16) (s32) (2.0f * (Math_SinS((s16) ((this->unk160 * spBC) + temp_lo)) * sp70));
+// } else {
+// var_s1->unk4 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spBC) + temp_lo)) * sp70);
+// }
+// } else {
+// if (temp_v0_2 == 1) {
+// temp_v0_3 = var_s0 + &D_809F1C60;
+// var_s6 = 5;
+// var_s7 = 0x1000;
+// var_s1->unk0 = (s16) temp_v0_3->unk0;
+// var_s1->unk2 = (s16) temp_v0_3->unk2;
+// var_s1->unk4 = (s16) temp_v0_3->unk4;
+// } else if (temp_v0_2 == 2) {
+// temp_v0_4 = var_s0 + &D_809F1C8C;
+// var_s6 = 1;
+// var_s7 = 0x2000;
+// var_s1->unk0 = (s16) temp_v0_4->unk0;
+// var_s1->unk2 = (s16) temp_v0_4->unk2;
+// var_s1->unk4 = (s16) temp_v0_4->unk4;
+// }
+// var_s5 = var_s7;
+// var_s4 = var_s6;
+// }
+// Math_ApproachS(sp6C, var_s1->unk0, var_s4, var_s5);
+// Math_ApproachS(sp60, var_s1->unk2, var_s4, var_s5);
+// Math_ApproachS(sp5C, var_s1->unk4, var_s4, var_s5);
+// var_s3 += 1;
+// sp5C += 6;
+// sp60 += 6;
+// sp6C += 6;
+// var_s0 += 6;
+// var_s1 += 6;
+// } while (var_s3 < 7);
+// temp_ft4 = (sp108->world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
+// spA4 = temp_ft4;
+// if (temp_ft4 < 0.0f) {
+// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
+// }
+// temp_s0 = &this->unk3C8;
+// SkelAnime_Update(temp_s0);
+// temp_s1 = &this->unk35C;
+// Math_ApproachF(temp_s1, 1.0f, 0.1f, 0.1f);
+// if (this->unk15C != (u8) 0xA) {
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
+// }
+// switch (this->unk15C) { /* irregular */
+// case 0:
+// this->unk174 = 0;
+// this->unk3C8.playSpeed = 1.0f;
+// if (spA4 < 0.0f) {
+// if (sp108->speedXZ > 10.0f) {
+// var_fv1 = 220.0f;
+// } else {
+// var_fv1 = 150.0f;
+// }
+// if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
+// this->unk15C = 1;
+// this->unk162[0] = 0xA;
+// }
+// goto block_42;
+// }
+// sp103 = 1;
+// if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
+// this->unk15E += 1;
+// if (this->unk15E >= 0x1F) {
+// this->unk15C = 0xA;
+// this->unk162[0] = 0x1E;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+// }
+// } else {
+// block_42:
+// this->unk15E = 0;
+// }
+// if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// break;
+// case 10:
+// if (!(this->unk160 & 1)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// this->unk19C = (this->unk162[0] & 1) << 9;
+// this->unk174 = 3;
+// this->unk3C8.playSpeed = 4.0f;
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
+// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
+// if (this->unk162[0] == 0) {
+// this->unk162[0] = 0x64;
+// this->unk15E = 0;
+// this->unk15C = 0;
+// }
+// if (this->unk162[0] == 0x1B) {
+// Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
+// sp94.y += 40.0f;
+// EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, (s16) 1, (s16) 0x7D0);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
+// }
+// break;
+// case 1:
+// if (Animation_OnFrame(temp_s0, this->unk4FC) != 0) {
+// this->unk3C8.playSpeed = 0.0f;
+// }
+// this->unk174 = 1;
+// if (this->unk162[0] == 0) {
+// this->unk15C = 2;
+// this->unk162[0] = 0x14;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+// }
+// break;
+// case 2:
+// if (!(this->unk160 & 1)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// this->unk19C = (this->unk162[0] & 1) << 9;
+// this->unk3C8.playSpeed = 4.0f;
+// Math_ApproachF(temp_s1, 1.5f, 1.0f, 0.7f);
+// this->unk174 = 2;
+// if (this->unk162[0] == 0) {
+// this->unk15C = 0;
+// this->unk162[0] = 0x1E;
+// }
+// break;
+// }
+// temp_v0_5 = func_809EECBC(&this->dyna.actor, play);
+// var_s4_2 = temp_v0_5;
+// if ((temp_v0_5 != 0) || (this->unk168 == 1)) {
+// this->dyna.actor.params = 2;
+// this->actionFunc = func_809EF9BC;
+// this->dyna.actor.flags &= ~1;
+// temp_s0_2 = &play->actorCtx;
+// func_800BC154(play, temp_s0_2, &this->dyna.actor, 1U);
+// if (this->unk168 != 0) {
+// var_s4_2 = 0xA;
+// }
+// if (var_s4_2 >= 0xA) {
+// temp_v0_6 = Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->dyna.actor.world.pos.x,
+// this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, (s16) (s32) this->dyna.actor.shape.rot.x,
+// (s16) (s32) this->dyna.actor.shape.rot.y, (s16) (s32) this->dyna.actor.shape.rot.z, 3); if (temp_v0_6 !=
+// NULL) {
+// var_s0_2 = 0;
+// temp_v1 = play->actorCtx.actorLists[2].first;
+// if (this == temp_v1->unk730) {
+// temp_v1->unk730 = temp_v0_6;
+// play->actorCtx.targetContext.arrowPointedActor = temp_v0_6;
+// play->actorCtx.targetContext.targetedActor = temp_v0_6;
+// }
+// do {
+// temp_t5 = this->unk268.jointTable + var_s0_2;
+// temp_t4 = (unaligned s32) temp_t5->unk0;
+// temp_t1 = temp_v0_6->unk288 + var_s0_2;
+// var_s0_2 += 6;
+// temp_t1->unk0 = (unaligned s32) temp_t4;
+// temp_t1->unk4 = (u16) temp_t5->unk4;
+// } while (var_s0_2 < 0x3C);
+// var_s0_3 = 0;
+// do {
+// temp_t9 = this->unk3C8.jointTable + var_s0_3;
+// temp_t7 = temp_v0_6->unk3E8 + var_s0_3;
+// temp_t7->unk0 = (unaligned s32) temp_t9->unk0;
+// temp_t7->unk4 = (u16) temp_t9->unk4;
+// temp_t6 = this->unk3C8.jointTable + var_s0_3;
+// temp_t3 = temp_v0_6->unk3E8 + var_s0_3;
+// temp_t3->unk6 = (unaligned s32) temp_t6->unk6;
+// temp_t3->unkA = (u16) temp_t6->unkA;
+// temp_t5_2 = this->unk3C8.jointTable + var_s0_3;
+// temp_t2 = temp_v0_6->unk3E8 + var_s0_3;
+// temp_t2->unkC = (unaligned s32) temp_t5_2->unkC;
+// temp_t2->unk10 = (u16) temp_t5_2->unk10;
+// temp_t9_2 = this->unk3C8.jointTable + var_s0_3;
+// temp_t2_2 = (unaligned s32) temp_t9_2->unk12;
+// temp_t8 = temp_v0_6->unk3E8 + var_s0_3;
+// var_s0_3 += 0x18;
+// temp_t8->unk12 = (unaligned s32) temp_t2_2;
+// temp_t8->unk16 = (u16) temp_t9_2->unk16;
+// } while (var_s0_3 != 0x78);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
+// if (var_s4_2 >= 0xB) {
+// temp_v0_6->unk188 = (s8) (var_s4_2 - 0xA);
+// }
+// }
+// } else {
+// var_s3_2 = 0;
+// if (var_s4_2 == 2) {
+// do {
+// temp_v0_7 = Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x,
+// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330, (s16) (s32) this->unk332, (s16) (s32)
+// this->unk334, var_s3_2 + 0xA); if (temp_v0_7 != NULL) {
+// var_v1 = 0;
+// do {
+// temp_t2_3 = this->unk3C8.jointTable + var_v1;
+// temp_t9_3 = temp_v0_7->unk3E8 + var_v1;
+// temp_t9_3->unk0 = (unaligned s32) temp_t2_3->unk0;
+// temp_t9_3->unk4 = (u16) temp_t2_3->unk4;
+// temp_t8_2 = this->unk3C8.jointTable + var_v1;
+// temp_t6_2 = temp_v0_7->unk3E8 + var_v1;
+// temp_t6_2->unk6 = (unaligned s32) temp_t8_2->unk6;
+// temp_t6_2->unkA = (u16) temp_t8_2->unkA;
+// temp_t3_2 = this->unk3C8.jointTable + var_v1;
+// temp_t5_3 = temp_v0_7->unk3E8 + var_v1;
+// temp_t5_3->unkC = (unaligned s32) temp_t3_2->unkC;
+// temp_t5_3->unk10 = (u16) temp_t3_2->unk10;
+// temp_t2_4 = this->unk3C8.jointTable + var_v1;
+// temp_t5_4 = (unaligned s32) temp_t2_4->unk12;
+// temp_t1_2 = temp_v0_7->unk3E8 + var_v1;
+// var_v1 += 0x18;
+// temp_t1_2->unk12 = (unaligned s32) temp_t5_4;
+// temp_t1_2->unk16 = (u16) temp_t2_4->unk16;
+// } while (var_v1 != 0x78);
+// temp_v0_7->unk162 = (s16) (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
+// }
+// var_s3_2 += 1;
+// } while (var_s3_2 != 2);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
+// }
+// }
+// }
+// if (sp103 == 0) {
+// temp_s0_3 = &play->colChkCtx;
+// CollisionCheck_SetAT(play, temp_s0_3, &this->unk1C8.base);
+// CollisionCheck_SetAT(play, temp_s0_3, &this->unk368.base);
+// }
+// temp_s0_4 = &play->colChkCtx;
+// CollisionCheck_SetAC(play, temp_s0_4, &this->unk1C8.base);
+// CollisionCheck_SetAC(play, temp_s0_4, &this->unk368.base);
+// }
+
+// void func_809EF9BC(Boss05 *this, PlayState *play) {
+// f32 temp_fv0;
+// s16 var_a1;
+// s32 temp_ft3;
+
+// temp_fv0 = sqrtf(this->dyna.actor.xyzDistToPlayerSq);
+// if ((temp_fv0 < 50.0f) && (play->actorCtx.actorLists[2].first->bgCheckFlags & 1)) {
+// temp_ft3 = (s32) (temp_fv0 * 80.0f);
+// var_a1 = (s16) temp_ft3;
+// if ((s16) temp_ft3 >= 0x7D1) {
+// var_a1 = 0x7D0;
+// }
+// Math_ApproachS(&this->unk178, var_a1, 0x14, 0x7D0);
+// Math_ApproachS(&this->unk176, this->dyna.actor.yawTowardsPlayer, 0x14, 0xFA0);
+// if (!(this->unk160 & 0xF)) {
+// EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x1F4, 0x3E8, (s16) 0);
+// }
+// } else {
+// Math_ApproachS(&this->unk178, 0, 0x14, 0x100);
+// }
+// }
+
+// void func_809EFAB4(Boss05 *this, PlayState *play) {
+// Vec3f sp80;
+// f32 sp7C;
+// f32 sp78;
+// f32 sp74;
+// ? temp_t8;
+// Actor *temp_v0;
+// Actor *temp_v1;
+// PosRot *temp_s1;
+// s32 var_s1;
+// s32 var_v1;
+// void *temp_t1;
+// void *temp_t3;
+// void *temp_t3_2;
+// void *temp_t5;
+// void *temp_t6;
+// void *temp_t7;
+// void *temp_t7_2;
+// void *temp_t9;
+
+// Actor_MoveWithGravity(&this->dyna.actor);
+// this->dyna.actor.world.pos.y -= 85.0f;
+// this->dyna.actor.prevPos.y -= 85.0f;
+// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
+// this->dyna.actor.world.pos.y += 85.0f;
+// this->dyna.actor.prevPos.y += 85.0f;
+// if (this->dyna.actor.bgCheckFlags & 0x20) {
+// this->dyna.actor.gravity = -0.3f;
+// this->dyna.actor.terminalVelocity = -5.0f;
+// } else {
+// this->dyna.actor.gravity = -2.0f;
+// this->dyna.actor.terminalVelocity = -20.0f;
+// }
+// temp_s1 = &this->dyna.actor.world;
+// if (this->dyna.actor.bgCheckFlags & 0x40) {
+// this->dyna.actor.velocity.y = -3.0f;
+// this->dyna.actor.gravity = -0.3f;
+// this->dyna.actor.terminalVelocity = -5.0f;
+// Math_Vec3f_Copy(&sp80, &temp_s1->pos);
+// sp80.y += 20.0f;
+// EffectSsGSplash_Spawn(play, &temp_s1->pos, NULL, NULL, (s16) 1, (s16) 0x3E8);
+// this->unk162[2] = 0x14;
+// }
+// var_s1 = 0;
+// if (this->unk162[2] != 0) {
+// do {
+// sp74 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+// sp78 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+// sp7C = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+// EffectSsBubble_Spawn(play, (Vec3f *) &sp74, 20.0f, 10.0f, 20.0f, 0.13f);
+// var_s1 += 1;
+// } while (var_s1 != 3);
+// }
+// if (this->dyna.actor.bgCheckFlags & 1) {
+// if ((this->unk189 == 0xA) && (this->unk17A != 0)) {
+// this->unk17A = 0;
+// }
+// Math_ApproachZeroF(&this->unk198, 1.0f, 0.05f);
+// if (this->unk198 == 0.0f) {
+// temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
+// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330, (s16) (s32) this->unk332, (s16) (s32)
+// this->unk334, 4); if (temp_v0 != NULL) {
+// temp_v1 = play->actorCtx.actorLists[2].first;
+// if (this == temp_v1->unk730) {
+// temp_v1->unk730 = temp_v0;
+// play->actorCtx.targetContext.arrowPointedActor = temp_v0;
+// play->actorCtx.targetContext.targetedActor = temp_v0;
+// }
+// var_v1 = 0;
+// do {
+// temp_t7 = this->unk3C8.jointTable + var_v1;
+// temp_t5 = temp_v0->unk3E8 + var_v1;
+// temp_t5->unk0 = (unaligned s32) temp_t7->unk0;
+// temp_t5->unk4 = (u16) temp_t7->unk4;
+// temp_t3 = this->unk3C8.jointTable + var_v1;
+// temp_t1 = temp_v0->unk3E8 + var_v1;
+// temp_t1->unk6 = (unaligned s32) temp_t3->unk6;
+// temp_t1->unkA = (u16) temp_t3->unkA;
+// temp_t9 = this->unk3C8.jointTable + var_v1;
+// temp_t7_2 = temp_v0->unk3E8 + var_v1;
+// temp_t7_2->unkC = (unaligned s32) temp_t9->unkC;
+// temp_t7_2->unk10 = (u16) temp_t9->unk10;
+// temp_t6 = this->unk3C8.jointTable + var_v1;
+// temp_t8 = (unaligned s32) temp_t6->unk12;
+// temp_t3_2 = temp_v0->unk3E8 + var_v1;
+// var_v1 += 0x18;
+// temp_t3_2->unk12 = (unaligned s32) temp_t8;
+// temp_t3_2->unk16 = (u16) temp_t6->unk16;
+// } while (var_v1 != 0x78);
+// Actor_PlaySfxAtPos(temp_v0, 0x3825U);
+// }
+// Actor_MarkForDeath(&this->dyna.actor);
+// }
+// }
+// }
+
+// void func_809EFE50(Actor *thisx, PlayState *play2) {
+// u8 sp27;
+// u8 temp_a0;
+// u8 temp_v0;
+// u8 var_a2;
+// void *temp_v1;
+
+// if ((thisx->unk16A == 0) && (temp_v1 = thisx->unk384, temp_a0 = temp_v1->unk16, ((temp_a0 & 2) != 0))) {
+// temp_v1->unk16 = (u8) (temp_a0 & 0xFFFD);
+// if (*thisx->unk384->unk24 & 0x300000) {
+// thisx->unk16A = 6;
+// thisx->unk338 = -12.0f;
+// thisx->unk348 = (s16) thisx->yawTowardsPlayer;
+// return;
+// }
+// thisx->unk16A = 0xA;
+// thisx->speedXZ = 0.0f;
+// thisx->unk338 = -20.0f;
+// thisx->unk348 = (s16) thisx->yawTowardsPlayer;
+// sp27 = 0;
+// Actor_PlaySfxAtPos(thisx, 0x3807U);
+// temp_v0 = thisx->colChkInfo.damageEffect;
+// switch (temp_v0) { /* irregular */
+// case 1:
+// sp27 = 0;
+// func_809F0A0C((Boss05 *) thisx, play2);
+// var_a2 = 0;
+// break;
+// case 2:
+// thisx->unk188 = 1;
+// default:
+// block_13:
+// var_a2 = 1;
+// break;
+// case 3:
+// sp27 = 0;
+// func_809F0A64((Boss05 *) thisx, play2);
+// var_a2 = 0;
+// thisx->unk188 = 0xA;
+// break;
+// case 4:
+// thisx->unk188 = 0x14;
+// goto block_13;
+// }
+// if (var_a2 != 0) {
+// if ((func_809F0ABC == thisx->unk170) && (thisx->unk189 == 0xA) && (thisx->unk17A != 0)) {
+// func_809EE4E0((Boss05 *) thisx, play2);
+// thisx->unk188 = 0;
+// }
+// thisx->colChkInfo.health -= thisx->colChkInfo.damage;
+// if ((s8) thisx->colChkInfo.health <= 0) {
+// Enemy_StartFinishingBlow(play2, thisx);
+// }
+// func_809F0708((Boss05 *) thisx, play2);
+// thisx->unk16C = 0xF;
+// }
+// }
+// }
+
+// s32 func_809F0014(PlayState *arg0, ? arg1) {
+// s16 temp_v0;
+// s16 var_v1;
+
+// temp_v0 = arg0->unk92 - arg0->unkBE;
+// var_v1 = temp_v0;
+// if (temp_v0 < 0) {
+// var_v1 = -temp_v0;
+// }
+// if (var_v1 < 0x3000) {
+// return 1;
+// }
+// return 0;
+// }
+
+// void func_809F0058(Boss05 *arg0, PlayState *arg1) {
+// if ((func_809F0014(arg1) != 0) && (arg0->dyna.actor.xyzDistToPlayerSq <= 40000.0f) &&
+// (fabsf(arg0->dyna.actor.playerHeightRel) < 70.0f)) {
+// func_809F0474(arg0, arg1);
+// }
+// }
+
+// void func_809F00CC(Boss05 *arg0, PlayState *arg1) {
+// arg0->actionFunc = func_809F010C;
+// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_06006E50, -5.0f);
+// }
+
+// void func_809F010C(Boss05 *this, PlayState *play) {
+// SkelAnime_Update(&this->unk3C8);
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
+// Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
+// Math_ApproachF(&this->unk360, 1.0f, 1.0f, 0.5f);
+// Math_ApproachF(&this->unk364, 1.0f, 1.0f, 0.14f);
+// if (this->unk364 == 1.0f) {
+// func_809F01CC(this, play);
+// }
+// }
+
+// void func_809F01CC(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F0244;
+// Animation_MorphToLoop(&this->unk3C8, &D_06007488, -10.0f);
+// this->unk162[0] = (s16) (s32) (Rand_ZeroFloat(25.0f) + 25.0f);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+
+// void func_809F0244(Boss05 *this, PlayState *play) {
+// SkelAnime_Update(&this->unk3C8);
+// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
+// Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
+// if (this->unk162[0] == 0) {
+// func_809F02D0(this, play);
+// }
+// func_809F0058(this, play);
+// }
+
+// void func_809F02D0(Boss05 *arg0, PlayState *arg1) {
+// f32 temp_ft0;
+
+// arg0->actionFunc = func_809F0374;
+// Animation_MorphToLoop(arg0 + 0x3C8, &D_06007908, 0.0f);
+// arg0->unk162[0] = (s16) (s32) (Rand_ZeroFloat(80.0f) + 60.0f);
+// arg0->unk34C = (f32) (randPlusMinusPoint5Scaled(400.0f) + arg0->dyna.actor.world.pos.x);
+// temp_ft0 = randPlusMinusPoint5Scaled(400.0f) + arg0->dyna.actor.world.pos.z;
+// arg0->unk358 = 0.0f;
+// arg0->unk354 = temp_ft0;
+// }
+
+// void func_809F0374(Boss05 *this, PlayState *play) {
+// f32 sp24;
+// f32 sp20;
+// f32 temp_fa0;
+// f32 temp_fa1;
+
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3027U);
+// SkelAnime_Update(&this->unk3C8);
+// Math_ApproachF(&this->dyna.actor.speedXZ, 5.0f, 1.0f, 2.0f);
+// temp_fa0 = this->unk34C - this->dyna.actor.world.pos.x;
+// temp_fa1 = this->unk354 - this->dyna.actor.world.pos.z;
+// sp24 = temp_fa0;
+// sp20 = temp_fa1;
+// Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(temp_fa0, temp_fa1), 5, (s16) (s32) this->unk358);
+// Math_ApproachF((f32 *) &this->unk34A[0xE], 2000.0f, 1.0f, 100.0f);
+// if ((this->unk162[0] == 0) || (((sp24 * sp24) + (sp20 * sp20)) < 2500.0f)) {
+// func_809F01CC(this, play);
+// }
+// func_809F0058(this, play);
+// }
+
+// void func_809F0474(Boss05 *arg0, PlayState *arg1) {
+// arg0->actionFunc = func_809F04C0;
+// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_06003448, 0.0f);
+// arg0->unk162[0] = 0x14;
+// }
+
+// void func_809F04C0(Boss05 *this, PlayState *play) {
+// SkelAnime_Update(&this->unk3C8);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3006U);
+// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+// Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, 0x1000);
+// if (this->unk162[0] == 0) {
+// func_809F0538(this, play);
+// }
+// }
+
+// void func_809F0538(Boss05 *arg0, PlayState *arg1) {
+// arg0->actionFunc = func_809F0590;
+// Animation_MorphToLoop(arg0 + 0x3C8, &D_06000A5C, 0.0f);
+// arg0->unk162[0] = 0x3C;
+// arg0->unk358 = 0.0f;
+// }
+
+// void func_809F0590(Boss05 *this, PlayState *play) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3006U);
+// SkelAnime_Update(&this->unk3C8);
+// Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
+// Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s16) (s32) this->unk358);
+// Math_ApproachF((f32 *) &this->unk34A[0xE], 4000.0f, 1.0f, 400.0f);
+// if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
+// func_809F0650(this, play);
+// }
+// }
+
+// void func_809F0650(Actor *arg0, PlayState *arg1) {
+// arg0->unk170 = func_809F06B8;
+// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_060006A4, 0.0f);
+// arg0->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
+// Actor_PlaySfxAtPos(arg0, 0x3837U);
+// }
+
+// void func_809F06B8(Boss05 *this, PlayState *play) {
+// SkelAnime *sp1C;
+// SkelAnime *temp_a0;
+
+// temp_a0 = &this->unk3C8;
+// sp1C = temp_a0;
+// SkelAnime_Update(temp_a0);
+// if (Animation_OnFrame(temp_a0, this->unk4FC) != 0) {
+// func_809F01CC(this, play);
+// }
+// }
+
+// void func_809F0708(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F0780;
+// Animation_MorphToPlayOnce(&this->unk3C8, &D_06002F0C, 0.0f);
+// this->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
+// Actor_SetColorFilter(&this->dyna.actor, 0x4000U, 0x78U, 0U, (u16) 0x1E);
+// }
+
+// void func_809F0780(Boss05 *this, PlayState *play) {
+// f32 sp84;
+// f32 sp80;
+// f32 sp7C;
+// ? temp_t5;
+// Actor *temp_v0;
+// PosRot *temp_s1_2;
+// SkelAnime *temp_s1;
+// s32 var_s2;
+// s32 var_s2_2;
+// s32 var_v1;
+// void *temp_t0;
+// void *temp_t0_2;
+// void *temp_t2;
+// void *temp_t3;
+// void *temp_t4;
+// void *temp_t4_2;
+// void *temp_t6;
+// void *temp_t8;
+
+// temp_s1 = &this->unk3C8;
+// SkelAnime_Update(temp_s1);
+// if ((s8) this->dyna.actor.colChkInfo.health <= 0) {
+// var_s2 = 0;
+// if (Animation_OnFrame(temp_s1, 22.0f) != 0) {
+// do {
+// temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D,
+// this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, (s16) (s32)
+// this->dyna.actor.shape.rot.x, (s16) (s32) this->dyna.actor.shape.rot.y, (s16) (s32)
+// this->dyna.actor.shape.rot.z, var_s2 + 0xA); var_s2 += 1; if (temp_v0 != NULL) {
+// var_v1 = 0;
+// do {
+// temp_t4 = this->unk3C8.jointTable + var_v1;
+// temp_t2 = temp_v0->unk3E8 + var_v1;
+// temp_t2->unk0 = (unaligned s32) temp_t4->unk0;
+// temp_t2->unk4 = (u16) temp_t4->unk4;
+// temp_t0 = this->unk3C8.jointTable + var_v1;
+// temp_t8 = temp_v0->unk3E8 + var_v1;
+// temp_t8->unk6 = (unaligned s32) temp_t0->unk6;
+// temp_t8->unkA = (u16) temp_t0->unkA;
+// temp_t6 = this->unk3C8.jointTable + var_v1;
+// temp_t4_2 = temp_v0->unk3E8 + var_v1;
+// temp_t4_2->unkC = (unaligned s32) temp_t6->unkC;
+// temp_t4_2->unk10 = (u16) temp_t6->unk10;
+// temp_t3 = this->unk3C8.jointTable + var_v1;
+// temp_t5 = (unaligned s32) temp_t3->unk12;
+// temp_t0_2 = temp_v0->unk3E8 + var_v1;
+// var_v1 += 0x18;
+// temp_t0_2->unk12 = (unaligned s32) temp_t5;
+// temp_t0_2->unk16 = (u16) temp_t3->unk16;
+// } while (var_v1 != 0x78);
+// }
+// } while (var_s2 < 0xE);
+// var_s2_2 = 0;
+// do {
+// sp7C = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+// sp80 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+// sp84 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+// EffectSsBubble_Spawn(play, (Vec3f *) &sp7C, 20.0f, 10.0f, 20.0f, 0.13f);
+// var_s2_2 += 1;
+// } while (var_s2_2 != 0x14);
+// temp_s1_2 = &this->dyna.actor.world;
+// SoundSource_PlaySfxAtFixedWorldPos(play, &temp_s1_2->pos, 0x28U, 0x381FU);
+// Actor_MarkForDeath(&this->dyna.actor);
+// Item_DropCollectibleRandom(play, NULL, &temp_s1_2->pos, 0xE0);
+// }
+// } else if (Animation_OnFrame(temp_s1, this->unk4FC) != 0) {
+// func_809F0474(this, play);
+// }
+// }
+
+// void func_809F0A0C(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F0ABC;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
+// this->unk162[0] = 0x28;
+// Actor_SetColorFilter(&this->dyna.actor, 0U, 0x78U, 0U, (u16) 0x28);
+// }
+
+// void func_809F0A64(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F0ABC;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
+// this->unk162[0] = 0x50;
+// Actor_SetColorFilter(&this->dyna.actor, 0U, 0x78U, 0U, (u16) 0x50);
+// }
+
+// void func_809F0ABC(Boss05 *this, PlayState *play) {
+// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
+// if (this->unk162[0] == 0) {
+// func_809F01CC(this, play);
+// }
+// }
+
+// void func_809F0B0C(Boss05 *this, PlayState *play) {
+// s32 temp_t9;
+// u8 var_v0;
+
+// Actor_MoveWithGravity(&this->dyna.actor);
+// var_v0 = this->unk15C;
+// if (var_v0 == 0) {
+// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
+// var_v0 = 2U & 0xFF;
+// if (this->dyna.actor.bgCheckFlags & 0x20) {
+// this->unk15C = 1;
+// var_v0 = 1U & 0xFF;
+// } else {
+// this->unk15C = 2;
+// }
+// }
+// if (var_v0 == 1) {
+// Math_ApproachF(&this->dyna.actor.velocity.y, 1.0f, 1.0f, 0.1f);
+// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 0.5f, 0.5f);
+// this->dyna.actor.shape.rot.x += this->unk500;
+// this->dyna.actor.shape.rot.y += this->unk502;
+// if (this->unk162[0] == 0) {
+// Actor_MarkForDeath(&this->dyna.actor);
+// }
+// } else {
+// switch (var_v0) { /* irregular */
+// case 2:
+// this->dyna.actor.velocity.y = Rand_ZeroFloat(3.0f) + 3.0f;
+// this->dyna.actor.speedXZ = randPlusMinusPoint5Scaled(5.0f) + 5.0f;
+// temp_t9 = (s32) Rand_ZeroFloat(65536.0f);
+// this->unk15C = 3;
+// this->dyna.actor.gravity = -1.0f;
+// this->dyna.actor.world.rot.y = (s16) temp_t9;
+// return;
+// case 3:
+// Actor_MoveWithGravity(&this->dyna.actor);
+// if (this->unk324.y < (this->dyna.actor.floorHeight - 30.0f)) {
+// Actor_MarkForDeath(&this->dyna.actor);
+// }
+// return;
+// }
+// }
+// }
+
+// void Boss05_Update(Actor *thisx, PlayState *play) {
+// CollisionCheckContext *sp30;
+// ColliderJntSph *sp2C;
+// ColliderJntSph *temp_a2;
+// CollisionCheckContext *temp_a1;
+// s16 temp_a0;
+// s16 temp_v0;
+// s16 temp_v0_2;
+// s16 temp_v0_3;
+// s16 temp_v0_4;
+// s16 var_v0;
+// u8 temp_v0_5;
+// void *temp_v1;
+// Boss05 *this = (Boss05 *) thisx;
+
+// var_v0 = 0;
+// this->unk160 += 1;
+// do {
+// temp_v1 = this + (var_v0 * 2);
+// temp_a0 = this->unk162[var_v0];
+// var_v0 += 1;
+// if (temp_a0 != 0) {
+// temp_v1->unk162 = (s16) (temp_a0 - 1);
+// }
+// } while (var_v0 < 3);
+// temp_v0 = this->unk16A;
+// if (temp_v0 != 0) {
+// this->unk16A = temp_v0 - 1;
+// }
+// temp_v0_2 = this->unk16C;
+// if (temp_v0_2 != 0) {
+// this->unk16C = temp_v0_2 - 1;
+// }
+// temp_v0_3 = this->unk168;
+// if (temp_v0_3 != 0) {
+// this->unk168 = temp_v0_3 - 1;
+// }
+// temp_v0_4 = this->unk17A;
+// if (temp_v0_4 != 0) {
+// this->unk17A = temp_v0_4 - 1;
+// }
+// this->actionFunc(this, play);
+// if (this->dyna.actor.params == 4) {
+// Actor_MoveWithGravity(&this->dyna.actor);
+// Matrix_RotateYS(this->unk348, MTXMODE_NEW);
+// Matrix_MultVecZ(this->unk338, &this->unk33C);
+// this->dyna.actor.world.pos.x += this->unk33C.x;
+// this->dyna.actor.world.pos.z += this->unk33C.z;
+// Math_ApproachZeroF(&this->unk338, 1.0f, 1.0f);
+// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x45U);
+// func_809EFE50(&this->dyna.actor, play);
+// temp_a2 = &this->unk368;
+// temp_a1 = &play->colChkCtx;
+// sp30 = temp_a1;
+// sp2C = temp_a2;
+// CollisionCheck_SetAT(play, temp_a1, &temp_a2->base);
+// CollisionCheck_SetAC(play, temp_a1, &temp_a2->base);
+// CollisionCheck_SetOC(play, temp_a1, &temp_a2->base);
+// this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
+// }
+// temp_v0_5 = this->unk188;
+// switch (temp_v0_5) {
+// case 0:
+// this->unk189 = 0;
+// this->unk17A = 0;
+// this->unk184 = 0.0f;
+// return;
+// case 1:
+// this->unk189 = 0;
+// this->unk17A = 0x50;
+// this->unk184 = 1.0f;
+// this->unk188 = temp_v0_5 + 1;
+// this->unk17C = 0.0f;
+// /* fallthrough */
+// case 2:
+// if (this->unk17A == 0) {
+// Math_ApproachZeroF(&this->unk184, 1.0f, 0.02f);
+// if (this->unk184 == 0.0f) {
+// this->unk188 = 0;
+// return;
+// }
+// default:
+// return;
+// }
+// Math_ApproachF(&this->unk17C, 1.0f, 0.1f, 0.5f);
+// return;
+// case 10:
+// this->unk189 = 0xA;
+// this->unk17A = 0x50;
+// this->unk184 = 1.0f;
+// this->unk188 = temp_v0_5 + 1;
+// this->unk17C = 0.0f;
+// this->unk180 = 2.0f;
+// /* fallthrough */
+// case 11:
+// if (this->unk17A == 0) {
+// func_809EE4E0(this, play);
+// this->unk188 = 0;
+// return;
+// }
+// Math_ApproachF(&this->unk17C, 1.0f, 1.0f, 0.25f);
+// Math_ApproachF(&this->unk180, 1.0f, 0.1f, 0.1f);
+// return;
+// case 20:
+// this->unk189 = 0x14;
+// this->unk17A = 0x50;
+// this->unk184 = 1.0f;
+// this->unk188 = temp_v0_5 + 1;
+// this->unk17C = 0.0f;
+// return;
+// case 21:
+// if (this->unk17A == 0) {
+// Math_ApproachZeroF(&this->unk17C, 1.0f, 0.03f);
+// if (this->unk17C == 0.0f) {
+// this->unk188 = 0;
+// this->unk184 = 0.0f;
+// return;
+// }
+// } else {
+// Math_ApproachF(&this->unk17C, 1.0f, 0.5f, 0.5f);
+// }
+// break;
+// }
+// }
+
+// s32 func_809F1050(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
+// s8 temp_v1;
+// void *temp_a1;
+
+// if (arg1 == gGameInfo->data[0x500]) {
+// if (!(arg5->unk160 & 3)) {
+// *arg2 = NULL;
+// }
+// arg4->x += gGameInfo->data[0x501] << 8;
+// arg4->y += gGameInfo->data[0x502] << 8;
+// arg4->z += gGameInfo->data[0x503] << 8;
+// }
+// if ((arg5->params == 1) && (arg1 == 9)) {
+// *arg2 = NULL;
+// }
+// if (arg1 == 2) {
+// arg4->x += arg5->unk19C;
+// }
+// temp_v1 = *(&D_809F1CB8 + arg1);
+// if (temp_v1 >= 0) {
+// temp_a1 = arg5 + (temp_v1 * 6);
+// arg4->x += temp_a1->unk19E;
+// arg4->y += temp_a1->unk1A0;
+// arg4->z += temp_a1->unk1A2;
+// }
+// return 0;
+// }
+
+// void func_809F1170(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
+// MtxF sp3C;
+// Vec3f sp30;
+// Vec3f sp24;
+// void *sp20;
+
+// if (arg1 == 4) {
+// Matrix_MultVec3f(&D_809F1CC4, arg4 + 0x324);
+// if (func_809EFAB4 == arg4->unk170) {
+// Matrix_MultVec3f(&D_809F1CC4, &arg4->focus.pos);
+// }
+// Matrix_Get(&sp3C);
+// Matrix_MtxFToYXZRot(&sp3C, arg4 + 0x330, 0);
+// arg4->unk330 = (s16) (arg4->unk330 + 0xF00);
+// }
+// if (arg1 == 2) {
+// Matrix_MultZero(&sp30);
+// func_809EE668(0, arg4 + 0x1C8, &sp30);
+// }
+// if (arg1 == 3) {
+// sp20 = arg4 + 0x1C8;
+// Matrix_MultVecY(-500.0f, &sp24);
+// func_809EE668(1, sp20, &sp24);
+// if (func_809EEDE8 == arg4->unk170) {
+// Matrix_MultVecY(1500.0f, &arg4->focus.pos);
+// }
+// }
+// }
+
+// s32 func_809F1284(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *rot, Actor *thisx) {
+// return 0;
+// }
+
+// void func_809F12A0(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
+// if (arg1 == 1) {
+// Matrix_MultVec3f(&D_809F1CD0, &D_809F2110);
+// func_809EE668(0, arg4 + 0x368, &D_809F2110);
+// if (arg4->params == 4) {
+// Matrix_MultVec3f(D_809F1CDC, &arg4->focus.pos);
+// }
+// if (arg4->unk188 != 0) {
+// Matrix_MultVec3f(D_809F1CDC, arg4 + 0x18C);
+// if (arg4->unk189 == 0) {
+// arg4->unk190 = (f32) (arg4->unk190 - 15.0f);
+// }
+// }
+// }
+// }
+
+// void func_809F135C(PlayState *arg0, s32 arg1, Actor *arg2) {
+// f32 temp_fa0;
+// f32 temp_fa0_2;
+// f32 temp_fa0_3;
+
+// if ((arg1 == 2) || (arg1 == 3)) {
+// temp_fa0 = arg2->unk35C;
+// Matrix_Scale(temp_fa0, 1.0f, temp_fa0, MTXMODE_APPLY);
+// }
+// if (arg1 == 1) {
+// temp_fa0_2 = arg2->unk360;
+// Matrix_Scale(temp_fa0_2, temp_fa0_2, temp_fa0_2, MTXMODE_APPLY);
+// }
+// if ((arg1 >= 4) && (arg1 < 0x14)) {
+// temp_fa0_3 = arg2->unk364;
+// Matrix_Scale(temp_fa0_3, temp_fa0_3, temp_fa0_3, MTXMODE_APPLY);
+// }
+// }
+
+// s32 func_809F1404(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
+// if ((arg1 >= 3) && (arg1 < 9)) {
+// *arg2 = NULL;
+// }
+// return 0;
+// }
+
+// s32 func_809F1430(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *rot, Actor *thisx) {
+// if ((arg1 == 1) || (arg1 == 2) || (arg1 == 9)) {
+// *arg2 = NULL;
+// }
+// return 0;
+// }
+
+// void func_809F1464(PlayState *arg0, s32 arg1, Actor *arg2) {
+// f32 temp_fa0;
+
+// if ((arg1 >= 3) && (arg1 < 9)) {
+// temp_fa0 = arg2->unk198;
+// Matrix_Scale(temp_fa0, temp_fa0, temp_fa0, MTXMODE_APPLY);
+// }
+// }
+
+// s32 func_809F14AC(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
+// if (arg1 != D_809F1CC0[arg5->params]) {
+// *arg2 = NULL;
+// } else if ((s32) arg5->unk15C >= 2) {
+// arg4->x += arg5->unk160 * 0x3000;
+// arg4->y += arg5->unk160 * 0x1A00;
+// arg4->z += arg5->unk160 << 0xD;
+// }
+// return 0;
+// }
+
+// void func_809F1550(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
+// if (arg1 != D_809F1CC0[arg4->params]) {
+// Matrix_MultZero(arg4 + 0x324);
+// }
+// }
+
+// void Boss05_Draw(Actor *thisx, PlayState *play) {
+// GraphicsContext *sp34;
+// GraphicsContext *temp_a0;
+// s16 temp_v0;
+// Boss05 *this = (Boss05 *) thisx;
+
+// temp_a0 = play->state.gfxCtx;
+// sp34 = temp_a0;
+// func_8012C28C(temp_a0);
+// if (func_809EEDE8 == this->actionFunc) {
+// SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32) this->unk268.dListCount,
+// func_809F1050, func_809F1170, &this->dyna.actor); if (this->unk16C & 1) {
+// sp34->polyOpa.p = Gfx_SetFog(sp34->polyOpa.p, 0xFF, 0, 0, 0xFF, 0x384, 0x44B);
+// }
+// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
+// Matrix_RotateYS(this->unk332, MTXMODE_APPLY);
+// Matrix_RotateXS(this->unk330, MTXMODE_APPLY);
+// Matrix_RotateZS(this->unk334, MTXMODE_APPLY);
+// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
+// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
+// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+// } else {
+// temp_v0 = this->dyna.actor.params;
+// if (temp_v0 == 2) {
+// Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+// this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->unk176, MTXMODE_APPLY);
+// Matrix_RotateXS(this->unk178, MTXMODE_APPLY);
+// Matrix_RotateYS((s16) (this->unk176 * -1), MTXMODE_APPLY);
+// Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
+// Matrix_RotateXS(this->dyna.actor.shape.rot.x, MTXMODE_APPLY);
+// Matrix_RotateZS(this->dyna.actor.shape.rot.z, MTXMODE_APPLY);
+// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z,
+// MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32)
+// this->unk268.dListCount, func_809F1404, NULL, &this->dyna.actor);
+// } else if (temp_v0 == 3) {
+// SkelAnime_DrawTransformFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32)
+// this->unk268.dListCount, func_809F1430, func_809F1170, func_809F1464, &this->dyna.actor);
+// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
+// Matrix_RotateYS(this->unk332, MTXMODE_APPLY);
+// Matrix_RotateXS(this->unk330, MTXMODE_APPLY);
+// Matrix_RotateZS(this->unk334, MTXMODE_APPLY);
+// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z,
+// MTXMODE_APPLY); AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
+// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+// Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180,
+// this->unk184, (u8) (s32) this->unk189);
+// } else if (temp_v0 == 4) {
+// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+// if (this->unk16C & 1) {
+// sp34->polyOpa.p = Gfx_SetFog(sp34->polyOpa.p, 0xFF, 0, 0, 0xFF, 0x384, 0x44B);
+// }
+// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
+// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+// Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180,
+// this->unk184, (u8) (s32) this->unk189);
+// } else if (temp_v0 >= 0xA) {
+// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+// SkelAnime_DrawFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
+// this->unk3C8.dListCount, func_809F14AC, func_809F1550, &this->dyna.actor);
+// }
+// }
+// sp34->polyOpa.p = func_801660B8(play, sp34->polyOpa.p);
+// }
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.h b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
index 7a3f29507..d15a4e397 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.h
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
@@ -7,13 +7,67 @@ struct Boss05;
typedef void (*Boss05ActionFunc)(struct Boss05*, PlayState*);
+// typedef struct Boss05 {
+// /* 0x000 */ DynaPolyActor dyna;
+// /* 0x15C */ char unk_15C[0x14];
+// /* 0x170 */ Boss05ActionFunc actionFunc;
+// /* 0x174 */ char unk_174[0x394];
+// } Boss05; // size = 0x508
+
typedef struct Boss05 {
- /* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x2C];
+ /* 0x000 */ DynaPolyActor dyna;
+ /* 0x15C */ u8 unk15C; /* inferred */
+ /* 0x15D */ char pad15D[3]; /* maybe part of unk15C[4]? */
+ /* 0x160 */ s16 unk160; /* inferred */
+ /* 0x162 */ s16 unk162[3];
+ /* 0x168 */ s16 unk168; /* inferred */
+ /* 0x16A */ s16 unk16A; /* inferred */
+ /* 0x16C */ s16 unk16C; /* inferred */
+ /* 0x16E */ char pad16E[2];
/* 0x170 */ Boss05ActionFunc actionFunc;
- /* 0x174 */ char unk_174[0x394];
+ /* 0x174 */ char pad174[2]; // possibly this is a Vec3s
+ /* 0x176 */ s16 unk176;
+ /* 0x178 */ s16 unk178;
+ /* 0x17A */ s16 unk17A; /* inferred */
+ /* 0x17C */ f32 unk17C; /* inferred */
+ /* 0x180 */ f32 unk180; /* inferred */
+ /* 0x184 */ f32 unk184; /* inferred */
+ /* 0x188 */ u8 unk188; /* inferred */
+ /* 0x189 */ u8 unk189; /* inferred */
+ /* 0x18A */ char pad18A[2]; /* maybe part of unk189[3]? */
+ /* 0x18C */ Vec3f unk18C;
+ /* 0x198 */ f32 unk198;
+ /* 0x19C */ char pad19C[0x2C]; /* maybe part of unk198[0xC]? */
+ /* 0x1C8 */ ColliderJntSph unk1C8; /* inferred */
+ /* 0x1E8 */ ColliderJntSphElement unk1E8[2];
+ /* 0x268 */ SkelAnime unk268;
+ /* 0x2AC */ Vec3s unk2AC[10];
+ /* 0x2E8 */ Vec3s unk2E8[10];
+ /* 0x324 */ Vec3f unk324;
+ /* 0x330 */ char unk330[0x8]; // possibly a Vec3f
+ /* 0x330 */ f32 unk338;
+ /* 0x33C */ Vec3f unk33C;
+ /* 0x348 */ s16 unk348;
+ /* 0x34A */ char unk34A[0x2];
+ /* 0x34C */ f32 unk34C;
+ /* 0x350 */ char unk350[0x4];
+ /* 0x35C */ f32 unk354;
+ /* 0x35C */ f32 unk358;
+ /* 0x35C */ f32 unk35C;
+ /* 0x360 */ f32 unk360;
+ /* 0x364 */ f32 unk364;
+ /* 0x368 */ ColliderJntSph unk368;
+ /* 0x388 */ ColliderJntSphElement unk388[1];
+ /* 0x3C8 */ SkelAnime unk3C8;
+ /* 0x40C */ Vec3s unk40C[20];
+ /* 0x484 */ Vec3s unk484[20];
+ /* 0x4FC */ f32 unk4FC; /* inferred */
+ /* 0x500 */ s16 unk500; /* inferred */
+ /* 0x502 */ s16 unk502; /* inferred */
+ /* 0x504 */ char pad504[4]; /* maybe part of unk502[3]? */
} Boss05; // size = 0x508
+
extern const ActorInit Boss_05_InitVars;
#endif // Z_BOSS_05_H
diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml
index bf61be341..380acbfc2 100644
--- a/tools/permuter_settings.toml
+++ b/tools/permuter_settings.toml
@@ -1,3 +1,5 @@
+compiler_type = "ido"
+
[preserve_macros]
"g[DS]P.*" = "void"
"gs[DS]P.*" = "void"
From d823ec3254f612e4bbed33004b6ee1494787e9f8 Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Mon, 19 Sep 2022 01:38:09 +0100
Subject: [PATCH 06/51] Just the hard 3 + 1 left
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 502 ++++++++++++++------
src/overlays/actors/ovl_Boss_05/z_boss_05.h | 9 +-
tools/disasm/variables.txt | 10 +-
3 files changed, 374 insertions(+), 147 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index d6285fe19..249bfcc0e 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -27,9 +27,9 @@ void func_809F02D0(Boss05* this, PlayState* play);
void func_809F0374(Boss05* this, PlayState* play);
void func_809F0474(Boss05* this, PlayState* play);
void func_809F04C0(Boss05* this, PlayState* play);
-void func_809F0538(Boss05 *this, PlayState *arg1);
+void func_809F0538(Boss05* this, PlayState* arg1);
void func_809F0590(Boss05* this, PlayState* play);
-void func_809F0650(Boss05 *this, PlayState *arg1);
+void func_809F0650(Boss05* this, PlayState* arg1);
void func_809F06B8(Boss05* this, PlayState* play);
void func_809F0708(Boss05* this, PlayState* play);
void func_809F0780(Boss05* this, PlayState* play);
@@ -218,7 +218,14 @@ void func_809EE4E0(Boss05* this, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EE668.s")
+void func_809EE668(s32 elementIndex, ColliderJntSph* collider, Vec3f* pos) {
+ collider->elements[elementIndex].dim.worldSphere.center.x = (s32)pos->x;
+ collider->elements[elementIndex].dim.worldSphere.center.y = (s32)pos->y;
+ collider->elements[elementIndex].dim.worldSphere.center.z = (s32)pos->z;
+
+ collider->elements[elementIndex].dim.worldSphere.radius =
+ (s32)(collider->elements[elementIndex].dim.modelSphere.radius * collider->elements[elementIndex].dim.scale);
+}
void Boss05_Init(Actor* thisx, PlayState* play) {
s32 pad;
@@ -506,7 +513,7 @@ void func_809F0474(Boss05* this, PlayState* play) {
this->unk162[0] = 20;
}
-void func_809F04C0(Boss05 *this, PlayState *play) {
+void func_809F04C0(Boss05* this, PlayState* play) {
SkelAnime_Update(&this->unk3C8);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
@@ -516,39 +523,39 @@ void func_809F04C0(Boss05 *this, PlayState *play) {
}
}
-void func_809F0538(Boss05 *this, PlayState *arg1) {
+void func_809F0538(Boss05* this, PlayState* arg1) {
this->actionFunc = func_809F0590;
Animation_MorphToLoop(&this->unk3C8, &D_06000A5C, 0.0f);
this->unk162[0] = 60;
this->unk358 = 0.0f;
}
-void func_809F0590(Boss05 *this, PlayState *play) {
+void func_809F0590(Boss05* this, PlayState* play) {
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
SkelAnime_Update(&this->unk3C8);
Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
- Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s32) this->unk358);
+ Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s32)this->unk358);
Math_ApproachF(&this->unk358, 4000.0f, 1.0f, 400.0f);
if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
func_809F0650(this, play);
}
}
-void func_809F0650(Boss05 *this, PlayState *arg1) {
+void func_809F0650(Boss05* this, PlayState* arg1) {
this->actionFunc = func_809F06B8;
Animation_MorphToPlayOnce(&this->unk3C8, &D_060006A4, 0.0f);
this->unk4FC = Animation_GetLastFrame(&D_060006A4);
- Actor_PlaySfxAtPos(this, NA_SE_EN_MIZUBABA2_ATTACK);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_ATTACK);
}
-void func_809F06B8(Boss05 *this, PlayState *play) {
+void func_809F06B8(Boss05* this, PlayState* play) {
SkelAnime_Update(&this->unk3C8);
if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
func_809F01CC(this, play);
}
}
-void func_809F0708(Boss05 *this, PlayState *play) {
+void func_809F0708(Boss05* this, PlayState* play) {
this->actionFunc = func_809F0780;
Animation_MorphToPlayOnce(&this->unk3C8, &D_06002F0C, 0.0f);
this->unk4FC = Animation_GetLastFrame(&D_060006A4);
@@ -661,7 +668,7 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
this->dyna.actor.world.pos.z += this->unk33C.z;
Math_ApproachZeroF(&this->unk338, 1.0f, 1.0f);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x45);
- func_809EFE50(this, play);
+ func_809EFE50(&this->dyna.actor, play);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk368.base);
@@ -734,27 +741,242 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1050.s")
+extern u8 D_809F1CB8[];
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1170.s")
+s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ Boss05* this = THIS;
+ s8 temp_v1;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1284.s")
+ if (limbIndex == KREG(32)) {
+ if (!(this->unk160 & 3)) {
+ *dList = NULL;
+ }
+ rot->x += KREG(33) * 0x100;
+ rot->y += KREG(34) * 0x100;
+ rot->z += KREG(35) * 0x100;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F12A0.s")
+ if ((thisx->params == 1) && (limbIndex == 9)) {
+ *dList = NULL;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F135C.s")
+ if (limbIndex == 2) {
+ rot->x += this->unk19C;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1404.s")
+ temp_v1 = D_809F1CB8[limbIndex];
+ if (temp_v1 >= 0) {
+ rot->x = rot->x + this->unk19E[temp_v1].x;
+ rot->y = rot->y + this->unk19E[temp_v1].y;
+ rot->z = rot->z + this->unk19E[temp_v1].z;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1430.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1464.s")
+extern Vec3f D_809F1CC4;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F14AC.s")
+void func_809F1170(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ Boss05* this = THIS;
+ MtxF sp3C;
+ Vec3f sp30;
+ Vec3f sp24;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F1550.s")
+ if (limbIndex == 4) {
+ Matrix_MultVec3f(&D_809F1CC4, &this->unk324);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/Boss05_Draw.s")
+ if (this->actionFunc == func_809EFAB4) {
+ Matrix_MultVec3f(&D_809F1CC4, &this->dyna.actor.focus.pos);
+ }
+
+ Matrix_Get(&sp3C);
+ Matrix_MtxFToYXZRot(&sp3C, &this->unk330, false);
+ this->unk330.x += 0xF00;
+ }
+
+ if (limbIndex == 2) {
+ Matrix_MultZero(&sp30);
+ func_809EE668(0, &this->unk1C8, &sp30);
+ }
+
+ if (limbIndex == 3) {
+ Matrix_MultVecY(-500.0f, &sp24);
+ func_809EE668(1, &this->unk1C8, &sp24);
+
+ if (this->actionFunc == func_809EEDE8) {
+ Matrix_MultVecY(1500.0f, &thisx->focus.pos);
+ }
+ }
+}
+
+s32 func_809F1284(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ return false;
+}
+
+extern Vec3f D_809F1CD0;
+extern Vec3f D_809F1CDC;
+extern Vec3f D_809F2110; // bss
+
+void func_809F12A0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ Boss05* this = THIS;
+
+ if (limbIndex == 1) {
+ Matrix_MultVec3f(&D_809F1CD0, &D_809F2110);
+ func_809EE668(0, &this->unk368, &D_809F2110);
+ if (thisx->params == 4) {
+ Matrix_MultVec3f(&D_809F1CDC, &thisx->focus.pos);
+ }
+ if (this->unk188 != 0) {
+ Matrix_MultVec3f(&D_809F1CDC, &this->unk18C);
+ if (this->unk189 == 0) {
+ this->unk18C.y -= 15.0f;
+ }
+ }
+ }
+}
+
+void func_809F135C(PlayState* play, s32 limbIndex, Actor* thisx) {
+ Boss05* this = THIS;
+
+ if ((limbIndex == 2) || (limbIndex == 3)) {
+ Matrix_Scale(this->unk35C, 1.0f, this->unk35C, MTXMODE_APPLY);
+ }
+
+ if (limbIndex == 1) {
+ Matrix_Scale(this->unk360, this->unk360, this->unk360, MTXMODE_APPLY);
+ }
+
+ if ((limbIndex >= 4) && (limbIndex < 20)) {
+ Matrix_Scale(this->unk364, this->unk364, this->unk364, MTXMODE_APPLY);
+ }
+}
+
+s32 func_809F1404(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ if ((limbIndex >= 3) && (limbIndex < 9)) {
+ *dList = NULL;
+ }
+
+ return false;
+}
+
+s32 func_809F1430(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ if ((limbIndex == 1) || (limbIndex == 2) || (limbIndex == 9)) {
+ *dList = NULL;
+ }
+
+ return false;
+}
+
+void func_809F1464(PlayState* play, s32 limbIndex, Actor* thisx) {
+ Boss05* this = THIS;
+
+ if ((limbIndex >= 3) && (limbIndex < 9)) {
+ Matrix_Scale(this->unk198, this->unk198, this->unk198, MTXMODE_APPLY);
+ }
+}
+
+extern s32 D_809F1CE8[];
+
+s32 func_809F14AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ Boss05* this = THIS;
+
+ if (limbIndex != D_809F1CE8[thisx->params - 10]) {
+ *dList = NULL;
+ } else if (this->unk15C >= 2) {
+ rot->x += this->unk160 * 0x3000;
+ rot->y += this->unk160 * 0x1A00;
+ rot->z += this->unk160 * 0x2000;
+ }
+ return false;
+}
+
+void func_809F1550(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ Boss05* this = THIS;
+
+ if (limbIndex != D_809F1CE8[thisx->params - 10]) {
+ Matrix_MultZero(&this->unk324);
+ }
+}
+
+void Boss05_Draw(Actor* thisx, PlayState* play) {
+ s32 pad;
+ Boss05* this = THIS;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ func_8012C28C(play->state.gfxCtx);
+
+ if (this->actionFunc == func_809EEDE8) {
+ SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
+ func_809F1050, func_809F1170, &this->dyna.actor);
+
+ if (this->unk16C & 1) {
+ POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
+ }
+
+ Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
+ Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
+ Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
+
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+
+ SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
+ func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+ } else if (this->dyna.actor.params == 2) {
+ Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
+ MTXMODE_NEW);
+ Matrix_RotateYS(this->unk176, MTXMODE_APPLY);
+ Matrix_RotateXS(this->unk178, MTXMODE_APPLY);
+ Matrix_RotateYS(-this->unk176, MTXMODE_APPLY);
+ Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->dyna.actor.shape.rot.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->dyna.actor.shape.rot.z, MTXMODE_APPLY);
+ Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
+
+ SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
+ func_809F1404, NULL, &this->dyna.actor);
+ } else if (this->dyna.actor.params == 3) {
+ SkelAnime_DrawTransformFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
+ func_809F1430, func_809F1170, func_809F1464, &this->dyna.actor);
+
+ Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
+ Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
+ Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
+
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+
+ SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
+ func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+
+ Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180, this->unk184,
+ this->unk189);
+ } else if (this->dyna.actor.params == 4) {
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+
+ if (this->unk16C & 1) {
+ POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
+ }
+
+ SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
+ func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+
+ Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180, this->unk184,
+ this->unk189);
+ } else if (this->dyna.actor.params >= 0xA) {
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
+
+ SkelAnime_DrawFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
+ func_809F14AC, func_809F1550, &this->dyna.actor);
+ }
+
+ POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
// typedef struct Boss05 {
// /* 0x000 */ DynaPolyActor dyna;
@@ -792,14 +1014,19 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// /* 0x2AC */ Vec3s unk2AC[0xA];
// /* 0x2E8 */ Vec3s unk2E8[0xA];
// /* 0x324 */ Vec3f unk324;
-// /* 0x330 */ s8 unk330[8];
+// /* 0x330 */ Vec3s unk330;
+// /* 0x336 */ s8 unk336[2];
// /* 0x338 */ f32 unk338;
// /* 0x33C */ Vec3f unk33C;
// /* 0x348 */ s16 unk348;
-// /* 0x34A */ s8 unk34A[0x12];
+// /* 0x34A */ s8 unk34A[2];
+// /* 0x34C */ f32 unk34C;
+// /* 0x350 */ s8 unk350[4];
+// /* 0x354 */ f32 unk354;
+// /* 0x358 */ f32 unk358;
// /* 0x35C */ f32 unk35C;
-// /* 0x360 */ f32 unk360; /* inferred */
-// /* 0x364 */ f32 unk364; /* inferred */
+// /* 0x360 */ f32 unk360;
+// /* 0x364 */ f32 unk364;
// /* 0x368 */ ColliderJntSph unk368;
// /* 0x388 */ ColliderJntSphElement unk388[1];
// /* 0x3C8 */ SkelAnime unk3C8;
@@ -811,11 +1038,6 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// /* 0x504 */ char pad504[4]; /* maybe part of unk502[3]? */
// } Boss05; /* size = 0x508 */
-// void func_809F00CC(Boss05 *arg0, PlayState *arg1); /* static */
-// void func_809F02D0(Boss05 *arg0, PlayState *arg1); /* static */
-// void func_809F0474(Boss05 *arg0, PlayState *arg1); /* static */
-// void func_809F0538(Boss05 *arg0, PlayState *arg1); /* static */
-// void func_809F0650(Boss05 *arg0, PlayState *arg1); /* static */
// static BgCamInfo D_809F1A20 = { 0, 0, NULL };
// static SurfaceType D_809F1A28 = { { 0x10000, 0x7C8 } };
// static CollisionPoly D_809F1A30[0xA]; /* unable to generate initializer */
@@ -1473,8 +1695,8 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// if (var_s4_2 == 2) {
// do {
// temp_v0_7 = Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x,
-// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330, (s16) (s32) this->unk332, (s16) (s32)
-// this->unk334, var_s3_2 + 0xA); if (temp_v0_7 != NULL) {
+// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330.x, (s16) (s32) this->unk330.y, (s16)
+// (s32) this->unk330.z, var_s3_2 + 0xA); if (temp_v0_7 != NULL) {
// var_v1 = 0;
// do {
// temp_t2_3 = this->unk3C8.jointTable + var_v1;
@@ -1596,8 +1818,8 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// Math_ApproachZeroF(&this->unk198, 1.0f, 0.05f);
// if (this->unk198 == 0.0f) {
// temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
-// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330, (s16) (s32) this->unk332, (s16) (s32)
-// this->unk334, 4); if (temp_v0 != NULL) {
+// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330.x, (s16) (s32) this->unk330.y, (s16) (s32)
+// this->unk330.z, 4); if (temp_v0 != NULL) {
// temp_v1 = play->actorCtx.actorLists[2].first;
// if (this == temp_v1->unk730) {
// temp_v1->unk730 = temp_v0;
@@ -1691,11 +1913,11 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// }
// }
-// s32 func_809F0014(PlayState *arg0, ? arg1) {
+// s32 func_809F0014(Boss05 *this, PlayState *play) {
// s16 temp_v0;
// s16 var_v1;
-// temp_v0 = arg0->unk92 - arg0->unkBE;
+// temp_v0 = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
// var_v1 = temp_v0;
// if (temp_v0 < 0) {
// var_v1 = -temp_v0;
@@ -1706,16 +1928,16 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// return 0;
// }
-// void func_809F0058(Boss05 *arg0, PlayState *arg1) {
-// if ((func_809F0014(arg1) != 0) && (arg0->dyna.actor.xyzDistToPlayerSq <= 40000.0f) &&
-// (fabsf(arg0->dyna.actor.playerHeightRel) < 70.0f)) {
-// func_809F0474(arg0, arg1);
+// void func_809F0058(Boss05 *this, PlayState *play) {
+// if ((func_809F0014(this, play) != 0) && (this->dyna.actor.xyzDistToPlayerSq <= 40000.0f) &&
+// (fabsf(this->dyna.actor.playerHeightRel) < 70.0f)) {
+// func_809F0474(this, play);
// }
// }
-// void func_809F00CC(Boss05 *arg0, PlayState *arg1) {
-// arg0->actionFunc = func_809F010C;
-// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_06006E50, -5.0f);
+// void func_809F00CC(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F010C;
+// Animation_MorphToPlayOnce(&this->unk3C8, &D_06006E50, -5.0f);
// }
// void func_809F010C(Boss05 *this, PlayState *play) {
@@ -1747,16 +1969,16 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// func_809F0058(this, play);
// }
-// void func_809F02D0(Boss05 *arg0, PlayState *arg1) {
+// void func_809F02D0(Boss05 *this, PlayState *play) {
// f32 temp_ft0;
-// arg0->actionFunc = func_809F0374;
-// Animation_MorphToLoop(arg0 + 0x3C8, &D_06007908, 0.0f);
-// arg0->unk162[0] = (s16) (s32) (Rand_ZeroFloat(80.0f) + 60.0f);
-// arg0->unk34C = (f32) (randPlusMinusPoint5Scaled(400.0f) + arg0->dyna.actor.world.pos.x);
-// temp_ft0 = randPlusMinusPoint5Scaled(400.0f) + arg0->dyna.actor.world.pos.z;
-// arg0->unk358 = 0.0f;
-// arg0->unk354 = temp_ft0;
+// this->actionFunc = func_809F0374;
+// Animation_MorphToLoop(&this->unk3C8, &D_06007908, 0.0f);
+// this->unk162[0] = (s16) (s32) (Rand_ZeroFloat(80.0f) + 60.0f);
+// this->unk34C = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.x;
+// temp_ft0 = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.z;
+// this->unk358 = 0.0f;
+// this->unk354 = temp_ft0;
// }
// void func_809F0374(Boss05 *this, PlayState *play) {
@@ -1773,17 +1995,17 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// sp24 = temp_fa0;
// sp20 = temp_fa1;
// Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(temp_fa0, temp_fa1), 5, (s16) (s32) this->unk358);
-// Math_ApproachF((f32 *) &this->unk34A[0xE], 2000.0f, 1.0f, 100.0f);
+// Math_ApproachF(&this->unk358, 2000.0f, 1.0f, 100.0f);
// if ((this->unk162[0] == 0) || (((sp24 * sp24) + (sp20 * sp20)) < 2500.0f)) {
// func_809F01CC(this, play);
// }
// func_809F0058(this, play);
// }
-// void func_809F0474(Boss05 *arg0, PlayState *arg1) {
-// arg0->actionFunc = func_809F04C0;
-// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_06003448, 0.0f);
-// arg0->unk162[0] = 0x14;
+// void func_809F0474(Boss05 *this, PlayState *play) {
+// this->actionFunc = func_809F04C0;
+// Animation_MorphToPlayOnce(&this->unk3C8, &D_06003448, 0.0f);
+// this->unk162[0] = 0x14;
// }
// void func_809F04C0(Boss05 *this, PlayState *play) {
@@ -1796,11 +2018,11 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// }
// }
-// void func_809F0538(Boss05 *arg0, PlayState *arg1) {
-// arg0->actionFunc = func_809F0590;
-// Animation_MorphToLoop(arg0 + 0x3C8, &D_06000A5C, 0.0f);
-// arg0->unk162[0] = 0x3C;
-// arg0->unk358 = 0.0f;
+// void func_809F0538(Boss05 *this, PlayState *arg1) {
+// this->actionFunc = func_809F0590;
+// Animation_MorphToLoop(&this->unk3C8, &D_06000A5C, 0.0f);
+// this->unk162[0] = 0x3C;
+// this->unk358 = 0.0f;
// }
// void func_809F0590(Boss05 *this, PlayState *play) {
@@ -1808,17 +2030,17 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// SkelAnime_Update(&this->unk3C8);
// Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
// Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s16) (s32) this->unk358);
-// Math_ApproachF((f32 *) &this->unk34A[0xE], 4000.0f, 1.0f, 400.0f);
+// Math_ApproachF(&this->unk358, 4000.0f, 1.0f, 400.0f);
// if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
// func_809F0650(this, play);
// }
// }
-// void func_809F0650(Actor *arg0, PlayState *arg1) {
-// arg0->unk170 = func_809F06B8;
-// Animation_MorphToPlayOnce(arg0 + 0x3C8, &D_060006A4, 0.0f);
-// arg0->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
-// Actor_PlaySfxAtPos(arg0, 0x3837U);
+// void func_809F0650(Boss05 *this, PlayState *arg1) {
+// this->actionFunc = func_809F06B8;
+// Animation_MorphToPlayOnce(&this->unk3C8, &D_060006A4, 0.0f);
+// this->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3837U);
// }
// void func_809F06B8(Boss05 *this, PlayState *play) {
@@ -2101,139 +2323,139 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// }
// }
-// s32 func_809F1050(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
+// s32 func_809F1050(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
// s8 temp_v1;
// void *temp_a1;
-// if (arg1 == gGameInfo->data[0x500]) {
-// if (!(arg5->unk160 & 3)) {
-// *arg2 = NULL;
+// if (limbIndex == gGameInfo->data[0x500]) {
+// if (!(thisx->unk160 & 3)) {
+// *dList = NULL;
// }
-// arg4->x += gGameInfo->data[0x501] << 8;
-// arg4->y += gGameInfo->data[0x502] << 8;
-// arg4->z += gGameInfo->data[0x503] << 8;
+// rot->x += gGameInfo->data[0x501] << 8;
+// rot->y += gGameInfo->data[0x502] << 8;
+// rot->z += gGameInfo->data[0x503] << 8;
// }
-// if ((arg5->params == 1) && (arg1 == 9)) {
-// *arg2 = NULL;
+// if ((thisx->params == 1) && (limbIndex == 9)) {
+// *dList = NULL;
// }
-// if (arg1 == 2) {
-// arg4->x += arg5->unk19C;
+// if (limbIndex == 2) {
+// rot->x += thisx->unk19C;
// }
-// temp_v1 = *(&D_809F1CB8 + arg1);
+// temp_v1 = *(&D_809F1CB8 + limbIndex);
// if (temp_v1 >= 0) {
-// temp_a1 = arg5 + (temp_v1 * 6);
-// arg4->x += temp_a1->unk19E;
-// arg4->y += temp_a1->unk1A0;
-// arg4->z += temp_a1->unk1A2;
+// temp_a1 = thisx + (temp_v1 * 6);
+// rot->x += temp_a1->unk19E;
+// rot->y += temp_a1->unk1A0;
+// rot->z += temp_a1->unk1A2;
// }
// return 0;
// }
-// void func_809F1170(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
+// void func_809F1170(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
// MtxF sp3C;
// Vec3f sp30;
// Vec3f sp24;
// void *sp20;
-// if (arg1 == 4) {
-// Matrix_MultVec3f(&D_809F1CC4, arg4 + 0x324);
-// if (func_809EFAB4 == arg4->unk170) {
-// Matrix_MultVec3f(&D_809F1CC4, &arg4->focus.pos);
+// if (limbIndex == 4) {
+// Matrix_MultVec3f(&D_809F1CC4, thisx + 0x324);
+// if (func_809EFAB4 == thisx->unk170) {
+// Matrix_MultVec3f(&D_809F1CC4, &thisx->focus.pos);
// }
// Matrix_Get(&sp3C);
-// Matrix_MtxFToYXZRot(&sp3C, arg4 + 0x330, 0);
-// arg4->unk330 = (s16) (arg4->unk330 + 0xF00);
+// Matrix_MtxFToYXZRot(&sp3C, thisx + 0x330, 0);
+// thisx->unk330 = (s16) (thisx->unk330 + 0xF00);
// }
-// if (arg1 == 2) {
+// if (limbIndex == 2) {
// Matrix_MultZero(&sp30);
-// func_809EE668(0, arg4 + 0x1C8, &sp30);
+// func_809EE668(0, thisx + 0x1C8, &sp30);
// }
-// if (arg1 == 3) {
-// sp20 = arg4 + 0x1C8;
+// if (limbIndex == 3) {
+// sp20 = thisx + 0x1C8;
// Matrix_MultVecY(-500.0f, &sp24);
// func_809EE668(1, sp20, &sp24);
-// if (func_809EEDE8 == arg4->unk170) {
-// Matrix_MultVecY(1500.0f, &arg4->focus.pos);
+// if (func_809EEDE8 == thisx->unk170) {
+// Matrix_MultVecY(1500.0f, &thisx->focus.pos);
// }
// }
// }
-// s32 func_809F1284(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *rot, Actor *thisx) {
+// s32 func_809F1284(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
// return 0;
// }
-// void func_809F12A0(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
-// if (arg1 == 1) {
+// void func_809F12A0(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
+// if (limbIndex == 1) {
// Matrix_MultVec3f(&D_809F1CD0, &D_809F2110);
-// func_809EE668(0, arg4 + 0x368, &D_809F2110);
-// if (arg4->params == 4) {
-// Matrix_MultVec3f(D_809F1CDC, &arg4->focus.pos);
+// func_809EE668(0, thisx + 0x368, &D_809F2110);
+// if (thisx->params == 4) {
+// Matrix_MultVec3f(D_809F1CDC, &thisx->focus.pos);
// }
-// if (arg4->unk188 != 0) {
-// Matrix_MultVec3f(D_809F1CDC, arg4 + 0x18C);
-// if (arg4->unk189 == 0) {
-// arg4->unk190 = (f32) (arg4->unk190 - 15.0f);
+// if (thisx->unk188 != 0) {
+// Matrix_MultVec3f(D_809F1CDC, thisx + 0x18C);
+// if (thisx->unk189 == 0) {
+// thisx->unk190 = (f32) (thisx->unk190 - 15.0f);
// }
// }
// }
// }
-// void func_809F135C(PlayState *arg0, s32 arg1, Actor *arg2) {
+// void func_809F135C(PlayState *play, s32 limbIndex, Actor *thisx) {
// f32 temp_fa0;
// f32 temp_fa0_2;
// f32 temp_fa0_3;
-// if ((arg1 == 2) || (arg1 == 3)) {
-// temp_fa0 = arg2->unk35C;
+// if ((limbIndex == 2) || (limbIndex == 3)) {
+// temp_fa0 = thisx->unk35C;
// Matrix_Scale(temp_fa0, 1.0f, temp_fa0, MTXMODE_APPLY);
// }
-// if (arg1 == 1) {
-// temp_fa0_2 = arg2->unk360;
+// if (limbIndex == 1) {
+// temp_fa0_2 = thisx->unk360;
// Matrix_Scale(temp_fa0_2, temp_fa0_2, temp_fa0_2, MTXMODE_APPLY);
// }
-// if ((arg1 >= 4) && (arg1 < 0x14)) {
-// temp_fa0_3 = arg2->unk364;
+// if ((limbIndex >= 4) && (limbIndex < 0x14)) {
+// temp_fa0_3 = thisx->unk364;
// Matrix_Scale(temp_fa0_3, temp_fa0_3, temp_fa0_3, MTXMODE_APPLY);
// }
// }
-// s32 func_809F1404(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
-// if ((arg1 >= 3) && (arg1 < 9)) {
-// *arg2 = NULL;
+// s32 func_809F1404(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
+// if ((limbIndex >= 3) && (limbIndex < 9)) {
+// *dList = NULL;
// }
// return 0;
// }
-// s32 func_809F1430(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *rot, Actor *thisx) {
-// if ((arg1 == 1) || (arg1 == 2) || (arg1 == 9)) {
-// *arg2 = NULL;
+// s32 func_809F1430(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
+// if ((limbIndex == 1) || (limbIndex == 2) || (limbIndex == 9)) {
+// *dList = NULL;
// }
// return 0;
// }
-// void func_809F1464(PlayState *arg0, s32 arg1, Actor *arg2) {
+// void func_809F1464(PlayState *play, s32 limbIndex, Actor *thisx) {
// f32 temp_fa0;
-// if ((arg1 >= 3) && (arg1 < 9)) {
-// temp_fa0 = arg2->unk198;
+// if ((limbIndex >= 3) && (limbIndex < 9)) {
+// temp_fa0 = thisx->unk198;
// Matrix_Scale(temp_fa0, temp_fa0, temp_fa0, MTXMODE_APPLY);
// }
// }
-// s32 func_809F14AC(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3f *arg3, Vec3s *arg4, Actor *arg5) {
-// if (arg1 != D_809F1CC0[arg5->params]) {
-// *arg2 = NULL;
-// } else if ((s32) arg5->unk15C >= 2) {
-// arg4->x += arg5->unk160 * 0x3000;
-// arg4->y += arg5->unk160 * 0x1A00;
-// arg4->z += arg5->unk160 << 0xD;
+// s32 func_809F14AC(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
+// if (limbIndex != D_809F1CC0[thisx->params]) {
+// *dList = NULL;
+// } else if ((s32) thisx->unk15C >= 2) {
+// rot->x += thisx->unk160 * 0x3000;
+// rot->y += thisx->unk160 * 0x1A00;
+// rot->z += thisx->unk160 << 0xD;
// }
// return 0;
// }
-// void func_809F1550(PlayState *arg0, s32 arg1, Gfx **arg2, Vec3s *arg3, Actor *arg4) {
-// if (arg1 != D_809F1CC0[arg4->params]) {
-// Matrix_MultZero(arg4 + 0x324);
+// void func_809F1550(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
+// if (limbIndex != D_809F1CC0[thisx->params]) {
+// Matrix_MultZero(thisx + 0x324);
// }
// }
@@ -2252,9 +2474,9 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// sp34->polyOpa.p = Gfx_SetFog(sp34->polyOpa.p, 0xFF, 0, 0, 0xFF, 0x384, 0x44B);
// }
// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
-// Matrix_RotateYS(this->unk332, MTXMODE_APPLY);
-// Matrix_RotateXS(this->unk330, MTXMODE_APPLY);
-// Matrix_RotateZS(this->unk334, MTXMODE_APPLY);
+// Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
+// Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
+// Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
@@ -2276,9 +2498,9 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
// SkelAnime_DrawTransformFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32)
// this->unk268.dListCount, func_809F1430, func_809F1170, func_809F1464, &this->dyna.actor);
// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
-// Matrix_RotateYS(this->unk332, MTXMODE_APPLY);
-// Matrix_RotateXS(this->unk330, MTXMODE_APPLY);
-// Matrix_RotateZS(this->unk334, MTXMODE_APPLY);
+// Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
+// Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
+// Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z,
// MTXMODE_APPLY); AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.h b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
index d15a4e397..36cfd9a7b 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.h
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
@@ -37,14 +37,19 @@ typedef struct Boss05 {
/* 0x18A */ char pad18A[2]; /* maybe part of unk189[3]? */
/* 0x18C */ Vec3f unk18C;
/* 0x198 */ f32 unk198;
- /* 0x19C */ char pad19C[0x2C]; /* maybe part of unk198[0xC]? */
+ /* 0x19C */ s16 unk19C;
+ /* 0x19E */ Vec3s unk19E[1];
+ // /* 0x1A0 */ s16 unk1A0;
+ // /* 0x1A2 */ s16 unk1A2;
+ /* 0x1A4 */ char pad1A4[0x24]; // Some number of other Vec3s in here
/* 0x1C8 */ ColliderJntSph unk1C8; /* inferred */
/* 0x1E8 */ ColliderJntSphElement unk1E8[2];
/* 0x268 */ SkelAnime unk268;
/* 0x2AC */ Vec3s unk2AC[10];
/* 0x2E8 */ Vec3s unk2E8[10];
/* 0x324 */ Vec3f unk324;
- /* 0x330 */ char unk330[0x8]; // possibly a Vec3f
+ /* 0x330 */ Vec3s unk330; // ?
+ /* 0x330 */ char unk336[0x2];
/* 0x330 */ f32 unk338;
/* 0x33C */ Vec3f unk33C;
/* 0x348 */ s16 unk348;
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index ab5318936..223251099 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -10368,11 +10368,11 @@
0x809F1C40:("Boss_05_InitVars","UNK_TYPE1","",0x1),
0x809F1C60:("D_809F1C60","UNK_TYPE2","",0x2),
0x809F1C8C:("D_809F1C8C","UNK_TYPE2","",0x2),
- 0x809F1CB8:("D_809F1CB8","UNK_TYPE1","",0x1),
- 0x809F1CC0:("D_809F1CC0","UNK_TYPE1","",0x1),
- 0x809F1CC4:("D_809F1CC4","UNK_TYPE1","",0x1),
- 0x809F1CD0:("D_809F1CD0","UNK_TYPE1","",0x1),
- 0x809F1CDC:("D_809F1CDC","UNK_TYPE1","",0x1),
+ 0x809F1CB8:("D_809F1CB8","s8","[12]",0xC),
+ 0x809F1CC4:("D_809F1CC4","Vec3f","",0xC),
+ 0x809F1CD0:("D_809F1CD0","Vec3f","",0xC),
+ 0x809F1CDC:("D_809F1CDC","Vec3f","",0xC),
+ 0x809F1CE8:("D_809F1CE8","s32","[]",0x38),
0x809F1D20:("D_809F1D20","f32","",0x4),
0x809F1D24:("D_809F1D24","f32","",0x4),
0x809F1D28:("D_809F1D28","f32","",0x4),
From 4a6a66ce62e654a9a46b1dcb5acd1f0ef9bf2646 Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Tue, 20 Sep 2022 16:24:55 +0100
Subject: [PATCH 07/51] One left
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 2312 ++++++++-----------
src/overlays/actors/ovl_Boss_05/z_boss_05.h | 7 +-
2 files changed, 966 insertions(+), 1353 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index 249bfcc0e..521149654 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -327,14 +327,864 @@ void Boss05_Destroy(Actor* thisx, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EECBC.s")
+s32 func_809EECBC(Boss05* this, PlayState* play) {
+ if (this->unk16C == 0) {
+ s32 var_v0 = 0;
+ ColliderJntSphElement* var_v1 = &this->unk1C8.elements[0];
+
+ while (true) {
+ var_v0 += 0x40;
+
+ if (var_v1->info.bumperFlags & BUMP_HIT) {
+ switch (this->dyna.actor.colChkInfo.damageEffect) {
+ case 2:
+ return 11;
+ case 3:
+ return 20;
+ case 4:
+ return 30;
+ default:
+ return 10;
+ }
+ }
+ var_v1++;
+
+ if (var_v0 == 0x80) {
+ if (this->unk368.elements[0].info.bumperFlags & BUMP_HIT) {
+ u8 damage = this->dyna.actor.colChkInfo.damage;
+ this->dyna.actor.colChkInfo.health -= damage;
+ if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
+ Enemy_StartFinishingBlow(play, &this->dyna.actor);
+ return 2;
+ } else {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
+ this->unk16C = 15;
+ this->unk15C = 0;
+ this->unk162[0] = 30;
+ return 0;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
void func_809EEDD0(Boss05* this, PlayState* play) {
this->actionFunc = func_809EEDE8;
}
+extern Vec3s D_809F1C60[];
+extern Vec3s D_809F1C8C[];
+// Vec3s D_809F1C60[7] = {
+// { 0x3200, 0, 0 },
+// { -0x1E00, 0, 0 },
+// { -0x1400, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// };
+
+// Vec3s D_809F1C8C[7] = {
+// { -0x3200, 0, 0 },
+// { 0, 0, 0 },
+// { 0x1E00, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// };
+
// The big one
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EEDE8.s")
+// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EEDE8.s")
+// struct _m2c_stack_func_809EEDE8 {
+// /* 0x000 */ char pad0[0x5C];
+// /* 0x05C */ s16 *sp5C;
+// /* 0x060 */ s16 *sp60;
+// /* 0x064 */ char pad64[8]; /* maybe part of sp60[3]? */
+// /* 0x06C */ Vec3s *sp6C;
+// /* 0x070 */ f32 sp70;
+// /* 0x074 */ s32 sp74;
+// /* 0x078 */ char pad78[8]; /* maybe part of sp74[3]? */
+// /* 0x080 */ f32 sp80;
+// /* 0x084 */ char pad84[0x10]; /* maybe part of sp80[5]? */
+// /* 0x094 */ Vec3f sp94;
+// /* 0x0A0 */ char padA0[4];
+// /* 0x0A4 */ f32 spA4;
+// /* 0x0A8 */ char padA8[0xC]; /* maybe part of spA4[4]? */
+// /* 0x0B4 */ s32 spB4;
+// /* 0x0B8 */ s32 spB8;
+// /* 0x0BC */ s32 spBC;
+// /* 0x0C0 */ s32 spC0;
+// /* 0x0C4 */ s32 spC4;
+// /* 0x0C8 */ s32 spC8;
+// /* 0x0CC */ s32 spCC;
+// /* 0x0D0 */ s32 spD0;
+// /* 0x0D4 */ s32 spD4;
+// /* 0x0D8 */ Vec3s spD8;
+// /* 0x0DE */ char padDE[0x25]; /* maybe part of spD8[7]? */
+// /* 0x103 */ u8 sp103;
+// /* 0x104 */ char pad104[4]; /* maybe part of sp103[5]? */
+// /* 0x108 */ Player *sp108;
+// /* 0x10C */ char pad10C[4];
+// }; /* size = 0x110 */
+
+// Vec3s D_809F1C60[7] = {
+// { 0x3200, 0, 0 },
+// { -0x1E00, 0, 0 },
+// { -0x1400, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// };
+// Vec3s D_809F1C8C[7] = {
+// { -0x3200, 0, 0 },
+// { 0, 0, 0 },
+// { 0x1E00, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// { 0, 0, 0 },
+// };
+
+extern Vec3s D_809F1C60[];
+extern Vec3s D_809F1C8C[];
+
+void func_809EEDE8(Boss05 *this, PlayState *play) {
+ s32 pad;
+
+ Player *sp108;
+
+ s32 pad1;
+
+ u8 sp103;
+ Vec3s spD8[7];
+ s32 spD4;
+ s32 spD0;
+ s32 spCC;
+ s32 spC8;
+ s32 spC4;
+ s32 spC0;
+ s32 spBC;
+ s32 spB8;
+ s32 spB4;
+
+ s32 pad2;
+
+ f32 spA4;
+ Vec3f sp94;
+ // f32 sp80;
+ // s32 sp74;
+ // f32 sp70;
+ // Vec3s *sp6C;
+ // s16 *sp60;
+ // s16 *sp5C;
+ // ? *temp_t5;
+ // ? temp_t2_2;
+ // ? temp_t4;
+ // ? temp_t5_4;
+ // Boss05 *temp_v0_6;
+ // Boss05 *temp_v0_7;
+ // Player *temp_v1;
+ // ActorContext *temp_s0_2;
+ // CollisionCheckContext *temp_s0_3;
+ // CollisionCheckContext *temp_s0_4;
+ // SkelAnime *temp_s0;
+ // Vec3s *var_s1;
+ // f32 *temp_s1;
+ // f32 temp_ft4;
+ f32 var_fv1;
+ // s16 var_s4;
+ // s16 var_s5;
+ s16 var_s6;
+ s16 var_s7;
+ // s32 temp_lo;
+ // s32 temp_v0_5;
+ // s32 var_s0;
+ s32 var_s0_2;
+ s32 var_s0_3;
+ s32 var_s3;
+ // s32 var_s3_2;
+ s32 var_s4_2;
+ s32 var_v1;
+ // u8 temp_v0;
+ // u8 temp_v0_2;
+ // void *temp_t1;
+ // void *temp_t1_2;
+ // void *temp_t2;
+ // void *temp_t2_3;
+ // void *temp_t2_4;
+ // void *temp_t3;
+ // void *temp_t3_2;
+ // void *temp_t5_2;
+ // void *temp_t5_3;
+ // void *temp_t6;
+ // void *temp_t6_2;
+ // void *temp_t7;
+ // void *temp_t8;
+ // void *temp_t8_2;
+ // void *temp_t9;
+ // void *temp_t9_2;
+ // void *temp_t9_3;
+ // Vec3s *temp_v0_3;
+ // Vec3s *temp_v0_4;
+
+
+
+ sp108 = GET_PLAYER(play);
+ sp103 = 0;
+ // var_s3 = 0;
+ // temp_v0 = this->unk174;
+ this->dyna.actor.hintId = 8;
+ // var_s0 = 0;
+ // var_s1 = spD8;
+ if (this->unk174 == 0) {
+ spD4 = 0x3E8;
+ spD0 = 0x3E80;
+ spCC = 0x7D0;
+ spC8 = 0x5DC;
+ spC4 = 0x1770;
+ spC0 = 0xBB8;
+ spBC = 0x514;
+ spB8 = 0x5208;
+ spB4 = 0xDAC;
+ var_s6 = 0xA;
+ var_s7 = 0x300;
+ if (this->unk16C != 0) {
+ spD4 = 0x1B58;
+ spCC = 0x1770;
+ spC0 = 0x1770;
+ spBC = 0x1C84;
+ spB4 = 0x1964;
+ var_s6 = 1;
+ var_s7 = 0x1000;
+ }
+ } else {
+ if (this->unk174 == 3) {
+ spD4 = 0x1B58;
+ spD0 = 0x3E80;
+ spCC = 0x1388;
+ spC8 = 0x5DC;
+ spC4 = 0x2328;
+ spC0 = 0x1388;
+ spBC = 0x1C84;
+ spB8 = 0x5208;
+ spB4 = 0x157C;
+ var_s6 = 1;
+ var_s7 = 0x1000;
+ } else {
+ var_s6 = 0;
+ var_s7 = 0;
+ spB4 = 0;
+ spB8 = 0;
+ spBC = 0;
+ spC0 = 0;
+ spC4 = 0;
+ spC8 = 0;
+ spCC = 0;
+ spD0 = 0;
+ spD4 = 0;
+ }
+ }
+
+ for (var_s3 = 0; var_s3 < 7; var_s3++) {
+ if ((this->unk174 == 0) || (this->unk174 == 3)) {
+ if (var_s3 < 3) {
+ spD8[var_s3].y = 0;
+ spD8[var_s3].x = (s32) (Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * spCC);
+ } else {
+ spD8[var_s3].x = 0;
+ spD8[var_s3].y = (s32) (Math_SinS((this->unk160 * spC8) + (var_s3 * spC4)) * spC0);
+ }
+
+ if ((var_s3 == 4) || (var_s3 == 6)) {
+ spD8[var_s3].z = (s32) (2.0f * (Math_SinS((this->unk160 * spBC) + var_s3 * spB8) * spB4));
+ } else {
+ spD8[var_s3].z = (s32) (Math_SinS((this->unk160 * spBC) + var_s3 * spB8) * spB4);
+ }
+ } else if (this->unk174 == 1) {
+ var_s6 = 5;
+ var_s7 = 0x1000;
+ spD8[var_s3].x = D_809F1C60[var_s3].x;
+ spD8[var_s3].y = D_809F1C60[var_s3].y;
+ spD8[var_s3].z = D_809F1C60[var_s3].z;
+ } else if (this->unk174 == 2) {
+ var_s6 = 1;
+ var_s7 = 0x2000;
+ spD8[var_s3].x = D_809F1C8C[var_s3].x;
+ spD8[var_s3].y = D_809F1C8C[var_s3].y;
+ spD8[var_s3].z = D_809F1C8C[var_s3].z;
+ }
+
+ Math_ApproachS(&this->unk19E[var_s3].x, spD8[var_s3].x, var_s6, var_s7);
+ Math_ApproachS(&this->unk19E[var_s3].y, spD8[var_s3].y, var_s6, var_s7);
+ Math_ApproachS(&this->unk19E[var_s3].z, spD8[var_s3].z, var_s6, var_s7);
+
+ }
+
+ spA4 = (sp108->actor.world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
+ if (spA4 < 0.0f) {
+ Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s6, var_s7);
+ }
+
+ SkelAnime_Update(&this->unk3C8);
+ Math_ApproachF(&this->unk35C, 1.0f, 0.1f, 0.1f);
+ if (this->unk15C != 0xA) {
+ Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
+ }
+
+ switch (this->unk15C) { /* irregular */
+ case 0:
+ this->unk174 = 0;
+ this->unk3C8.playSpeed = 1.0f;
+ if (spA4 < 0.0f) {
+ if (sp108->actor.speedXZ > 10.0f) {
+ var_fv1 = 220.0f;
+ } else {
+ var_fv1 = 150.0f;
+ }
+ if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
+ this->unk15C = 1;
+ this->unk162[0] = 0xA;
+ }
+ this->unk15E = 0;
+ // goto block_42;
+ } else {
+
+ sp103 = 1;
+ if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
+ this->unk15E++;
+ if (this->unk15E > 0x1E) {
+ this->unk15C = 0xA;
+ this->unk162[0] = 0x1E;
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ }
+ } else {
+ // block_42:
+ this->unk15E = 0;
+ }
+ }
+ if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ break;
+
+ case 10:
+ if (!(this->unk160 & 1)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk174 = 3;
+ this->unk3C8.playSpeed = 4.0f;
+ Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
+ Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
+ if (this->unk162[0] == 0) {
+ this->unk15E = 0;
+ this->unk15C = 0;
+ this->unk162[0] = 0x64;
+ }
+ if (this->unk162[0] == 0x1B) {
+ Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
+ sp94.y += 40.0f;
+ EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 0x7D0);
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
+ }
+ break;
+
+ case 1:
+ if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ this->unk3C8.playSpeed = 0.0f;
+ }
+ this->unk174 = 1;
+ if (this->unk162[0] == 0) {
+ this->unk15C = 2;
+ this->unk162[0] = 0x14;
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ }
+ break;
+
+ case 2:
+ if (!(this->unk160 & 1)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk3C8.playSpeed = 4.0f;
+ Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
+ this->unk174 = 2;
+ if (this->unk162[0] == 0) {
+ this->unk15C = 0;
+ this->unk162[0] = 0x1E;
+ }
+ break;
+ }
+
+ var_s4_2 = func_809EECBC(this, play);
+ if ((var_s4_2 != 0) || (this->unk168 == 1)) {
+ this->dyna.actor.params = 2;
+ this->actionFunc = func_809EF9BC;
+ this->dyna.actor.flags &= ~1;
+ func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1);
+ if (this->unk168 != 0) {
+ var_s4_2 = 0xA;
+ }
+ if (var_s4_2 >= 0xA) {
+ Boss05 *temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, 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, this->dyna.actor.shape.rot.z, 3);
+ if (temp_v0_6 != NULL) {
+ Player* temp_v1 = GET_PLAYER(play);
+ if (&this->dyna.actor == temp_v1->targetActor) {
+ temp_v1->targetActor = &temp_v0_6->dyna.actor;
+ play->actorCtx.targetContext.arrowPointedActor = &temp_v0_6->dyna.actor;
+ play->actorCtx.targetContext.targetedActor = &temp_v0_6->dyna.actor;
+ }
+
+ for (var_s0_2 = 0; var_s0_2 < 10; var_s0_2++) {
+ temp_v0_6->unk268.jointTable[var_s0_2] = this->unk268.jointTable[var_s0_2];
+ }
+
+ for (var_s0_2 = 0; var_s0_2 < 20; var_s0_2++) {
+ temp_v0_6->unk3C8.jointTable[var_s0_2] = this->unk3C8.jointTable[var_s0_2];
+ }
+
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
+ if (var_s4_2 >= 0xB) {
+ temp_v0_6->unk188 = var_s4_2 - 0xA;
+ }
+ }
+ } else if (var_s4_2 == 2) {
+ for (var_s3 = 0; var_s3 < 2; var_s3++) {
+ Boss05 *temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3 + 0xA);
+ if (temp_v0_6 != NULL) {
+
+ for (var_v1 = 0; var_v1 < 20; var_v1++) {
+ temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
+ }
+
+ temp_v0_6->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
+ }
+ }
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
+ }
+
+ }
+
+ if (sp103 == 0) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1C8.base);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
+ }
+
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C8.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
+}
+// void func_809EEDE8(Boss05 *this, PlayState *play) {
+// Player *sp108;
+// u8 sp103;
+// Vec3s spD8;
+// s32 spD4;
+// s32 spD0;
+// s32 spCC;
+// s32 spC8;
+// s32 spC4;
+// s32 spC0;
+// s32 spBC;
+// s32 spB8;
+// s32 spB4;
+// f32 spA4;
+// Vec3f sp94;
+// f32 sp80;
+// s32 sp74;
+// f32 sp70;
+// Vec3s *sp6C;
+// s16 *sp60;
+// s16 *sp5C;
+// // ? *temp_t5;
+// // ? temp_t2_2;
+// // ? temp_t4;
+// // ? temp_t5_4;
+// Boss05 *temp_v0_6;
+// Boss05 *temp_v0_7;
+// Player *temp_v1;
+// ActorContext *temp_s0_2;
+// // CollisionCheckContext *temp_s0_3;
+// // CollisionCheckContext *temp_s0_4;
+// SkelAnime *temp_s0;
+// Vec3s *var_s1;
+// // f32 *temp_s1;
+// f32 temp_ft4;
+// f32 var_fv1;
+// s16 var_s4;
+// s16 var_s5;
+// s16 var_s6;
+// s16 var_s7;
+// s32 temp_lo;
+// s32 temp_v0_5;
+// s32 var_s0;
+// s32 var_s0_2;
+// s32 var_s0_3;
+// s32 var_s3;
+// s32 var_s3_2;
+// s32 var_s4_2;
+// s32 var_v1;
+// u8 temp_v0;
+// u8 temp_v0_2;
+// // void *temp_t1;
+// // void *temp_t1_2;
+// // void *temp_t2;
+// // void *temp_t2_3;
+// // void *temp_t2_4;
+// // void *temp_t3;
+// // void *temp_t3_2;
+// // void *temp_t5_2;
+// // void *temp_t5_3;
+// // void *temp_t6;
+// // void *temp_t6_2;
+// // void *temp_t7;
+// // void *temp_t8;
+// // void *temp_t8_2;
+// // void *temp_t9;
+// // void *temp_t9_2;
+// // void *temp_t9_3;
+// Vec3s *temp_v0_3;
+// Vec3s *temp_v0_4;
+
+// sp103 = 0;
+// var_s3 = 0;
+// sp108 = GET_PLAYER(play);
+// temp_v0 = this->unk174;
+// this->dyna.actor.hintId = 8;
+// var_s0 = 0;
+// var_s1 = &spD8;
+// if (temp_v0 == 0) {
+// spD4 = 0x3E8;
+// spD0 = 0x3E80;
+// spCC = 0x7D0;
+// spC8 = 0x5DC;
+// spC4 = 0x1770;
+// spC0 = 0xBB8;
+// spBC = 0x514;
+// spB8 = 0x5208;
+// spB4 = 0xDAC;
+// var_s6 = 0xA;
+// var_s7 = 0x300;
+// if (this->unk16C != 0) {
+// spD4 = 0x1B58;
+// spCC = 0x1770;
+// spC0 = 0x1770;
+// spBC = 0x1C84;
+// spB4 = 0x1964;
+// var_s6 = 1;
+// var_s7 = 0x1000;
+// }
+// } else {
+// var_s7 = 0;
+// if (temp_v0 == 3) {
+// spD4 = 0x1B58;
+// spD0 = 0x3E80;
+// spCC = 0x1388;
+// spC8 = 0x5DC;
+// spC4 = 0x2328;
+// spC0 = 0x1388;
+// spBC = 0x1C84;
+// spB8 = 0x5208;
+// spB4 = 0x157C;
+// var_s6 = 1;
+// var_s7 = 0x1000;
+// } else {
+// var_s6 = 0;
+// spB4 = 0;
+// spB8 = 0;
+// spBC = 0;
+// spC0 = 0;
+// spC4 = 0;
+// spC8 = 0;
+// spCC = 0;
+// spD0 = 0;
+// spD4 = 0;
+// }
+// }
+// sp5C = &this->unk19E[0].z;
+// sp60 = &this->unk19E[0].y;
+// sp6C = this->unk19E;
+// do {
+// // temp_v0_2 = this->unk174;
+// if ((this->unk174 == 0) || (this->unk174 == 3)) {
+// temp_lo = var_s3 * spB8;
+// var_s5 = var_s7;
+// var_s4 = var_s6;
+// sp70 = (f32) spB4;
+// if (var_s3 < 3) {
+// var_s1->y = 0;
+// sp74 = temp_lo;
+// sp80 = (f32) spCC;
+// var_s1->x = (s32) (Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * sp80);
+// } else {
+// var_s1->x = 0;
+// sp74 = temp_lo;
+// sp80 = (f32) spC0;
+// var_s1->y = (s32) (Math_SinS((s16) ((this->unk160 * spC8) + (var_s3 * spC4))) * sp80);
+// }
+// if ((var_s3 == 4) || (var_s3 == 6)) {
+// var_s1->z = (s32) (2.0f * (Math_SinS((this->unk160 * spBC) + temp_lo) * sp70));
+// } else {
+// var_s1->z = (s32) (Math_SinS((this->unk160 * spBC) + temp_lo) * sp70);
+// }
+// } else {
+// if (this->unk174 == 1) {
+// temp_v0_3 = var_s0 + D_809F1C60;
+// var_s6 = 5;
+// var_s7 = 0x1000;
+// var_s1->x = temp_v0_3->x;
+// var_s1->y = temp_v0_3->y;
+// var_s1->z = temp_v0_3->z;
+// } else if (this->unk174 == 2) {
+// temp_v0_4 = var_s0 + D_809F1C8C;
+// var_s6 = 1;
+// var_s7 = 0x2000;
+// var_s1->x = temp_v0_4->x;
+// var_s1->y = temp_v0_4->y;
+// var_s1->z = temp_v0_4->z;
+// }
+// var_s5 = var_s7;
+// var_s4 = var_s6;
+// }
+// Math_ApproachS(&sp6C->x, var_s1->x, var_s4, var_s5);
+// Math_ApproachS(sp60, var_s1->y, var_s4, var_s5);
+// Math_ApproachS(sp5C, var_s1->z, var_s4, var_s5);
+// var_s3 += 1;
+// sp5C += 6;
+// sp60 += 6;
+// sp6C += 6;
+// var_s0 += 6;
+// var_s1 += 6;
+// } while (var_s3 < 7);
+
+
+// temp_ft4 = (sp108->actor.world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
+// spA4 = temp_ft4;
+// if (temp_ft4 < 0.0f) {
+// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
+// }
+// // temp_s0 = &this->unk3C8;
+// SkelAnime_Update(&this->unk3C8);
+// // temp_s1 = &this->unk35C;
+// Math_ApproachF(&this->unk35C, 1.0f, 0.1f, 0.1f);
+// if (this->unk15C != 0xA) {
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
+// }
+
+// switch (this->unk15C) { /* irregular */
+// case 0:
+// this->unk174 = 0;
+// this->unk3C8.playSpeed = 1.0f;
+// if (spA4 < 0.0f) {
+// if (sp108->actor.speedXZ > 10.0f) {
+// var_fv1 = 220.0f;
+// } else {
+// var_fv1 = 150.0f;
+// }
+// if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
+// this->unk15C = 1;
+// this->unk162[0] = 0xA;
+// }
+// goto block_42;
+// }
+// sp103 = 1;
+// if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
+// this->unk15E++;
+// if (this->unk15E >= 0x1F) {
+// this->unk15C = 0xA;
+// this->unk162[0] = 0x1E;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+// }
+// } else {
+// block_42:
+// this->unk15E = 0;
+// }
+// if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// break;
+// case 10:
+// if (!(this->unk160 & 1)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// this->unk19C = (this->unk162[0] & 1) << 9;
+// this->unk174 = 3;
+// this->unk3C8.playSpeed = 4.0f;
+// Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
+// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
+// if (this->unk162[0] == 0) {
+// this->unk162[0] = 0x64;
+// this->unk15E = 0;
+// this->unk15C = 0;
+// }
+// if (this->unk162[0] == 0x1B) {
+// Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
+// sp94.y += 40.0f;
+// EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, (s16) 1, (s16) 0x7D0);
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
+// }
+// break;
+// case 1:
+// if (Animation_OnFrame(temp_s0, this->unk4FC)) {
+// this->unk3C8.playSpeed = 0.0f;
+// }
+// this->unk174 = 1;
+// if (this->unk162[0] == 0) {
+// this->unk15C = 2;
+// this->unk162[0] = 0x14;
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+// }
+// break;
+// case 2:
+// if (!(this->unk160 & 1)) {
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+// }
+// this->unk19C = (this->unk162[0] & 1) << 9;
+// this->unk3C8.playSpeed = 4.0f;
+// Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
+// this->unk174 = 2;
+// if (this->unk162[0] == 0) {
+// this->unk15C = 0;
+// this->unk162[0] = 0x1E;
+// }
+// break;
+// }
+
+// temp_v0_5 = func_809EECBC(this, play);
+// var_s4_2 = temp_v0_5;
+// if ((temp_v0_5 != 0) || (this->unk168 == 1)) {
+// this->dyna.actor.params = 2;
+// this->actionFunc = func_809EF9BC;
+// this->dyna.actor.flags &= ~1;
+// temp_s0_2 = &play->actorCtx;
+// func_800BC154(play, temp_s0_2, &this->dyna.actor, 1);
+// if (this->unk168 != 0) {
+// var_s4_2 = 0xA;
+// }
+// if (var_s4_2 >= 0xA) {
+// temp_v0_6 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, 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, this->dyna.actor.shape.rot.z, 3);
+// if (temp_v0_6 != NULL) {
+// var_s0_2 = 0;
+// temp_v1 = GET_PLAYER(play);
+// if (&this->dyna.actor == temp_v1->targetActor) {
+// temp_v1->targetActor = temp_v0_6;
+// play->actorCtx.targetContext.arrowPointedActor = temp_v0_6;
+// play->actorCtx.targetContext.targetedActor = temp_v0_6;
+// }
+
+// // do {
+// // temp_t5 = this->unk268.jointTable + var_s0_2;
+// // temp_t4 = (unaligned s32) temp_t5->unk0;
+// // temp_t1 = temp_v0_6->unk288 + var_s0_2;
+// // var_s0_2 += 6;
+// // temp_t1->unk0 = (unaligned s32) temp_t4;
+// // temp_t1->unk4 = (u16) temp_t5->unk4;
+// // } while (var_s0_2 < 0x3C);
+
+// for (var_s0_2 = 0; var_s0_2 < 10; var_s0_2++) {
+// temp_v0_6->unk268.jointTable[var_s0_2] = this->unk268.jointTable[var_s0_2];
+// }
+
+// for (var_s0_3 = 0; var_s0_3 < 20; var_s0_3++) {
+// temp_v0_6->unk3C8.jointTable[var_s0_3] = this->unk3C8.jointTable[var_s0_3];
+// }
+
+// // var_s0_3 = 0;
+// // do {
+// // temp_t9 = this->unk3C8.jointTable + var_s0_3;
+// // temp_t7 = temp_v0_6->unk3E8 + var_s0_3;
+// // temp_t7->unk0 = (unaligned s32) temp_t9->unk0;
+// // temp_t7->unk4 = (u16) temp_t9->unk4;
+// // temp_t6 = this->unk3C8.jointTable + var_s0_3;
+// // temp_t3 = temp_v0_6->unk3E8 + var_s0_3;
+// // temp_t3->unk6 = (unaligned s32) temp_t6->unk6;
+// // temp_t3->unkA = (u16) temp_t6->unkA;
+// // temp_t5_2 = this->unk3C8.jointTable + var_s0_3;
+// // temp_t2 = temp_v0_6->unk3E8 + var_s0_3;
+// // temp_t2->unkC = (unaligned s32) temp_t5_2->unkC;
+// // temp_t2->unk10 = (u16) temp_t5_2->unk10;
+// // temp_t9_2 = this->unk3C8.jointTable + var_s0_3;
+// // temp_t2_2 = (unaligned s32) temp_t9_2->unk12;
+// // temp_t8 = temp_v0_6->unk3E8 + var_s0_3;
+// // var_s0_3 += 0x18;
+// // temp_t8->unk12 = (unaligned s32) temp_t2_2;
+// // temp_t8->unk16 = (u16) temp_t9_2->unk16;
+// // } while (var_s0_3 != 0x78);
+
+
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
+// if (var_s4_2 >= 0xB) {
+// temp_v0_6->unk188 = (s8) (var_s4_2 - 0xA);
+// }
+// }
+// } else {
+// var_s3_2 = 0;
+// if (var_s4_2 == 2) {
+// for (var_s3_2 = 0; var_s3_2 < 2; var_s3_2++) {
+// temp_v0_7 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3_2 + 0xA);
+// if (temp_v0_7 != NULL) {
+
+// for (var_v1 = 0; var_v1 < 20; var_v1++) {
+// temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
+// }
+
+// temp_v0_7->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
+// }
+// }
+// // do {
+// // temp_v0_7 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3_2 + 0xA);
+// // if (temp_v0_7 != NULL) {
+
+// // for (var_v1 = 0; var_v1 < 20; var_v1++) {
+// // temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
+// // }
+
+// // // var_v1 = 0;
+// // // do {
+// // // temp_t2_3 = this->unk3C8.jointTable + var_v1;
+// // // temp_t9_3 = temp_v0_7->unk3E8 + var_v1;
+// // // temp_t9_3->unk0 = (unaligned s32) temp_t2_3->unk0;
+// // // temp_t9_3->unk4 = (u16) temp_t2_3->unk4;
+// // // temp_t8_2 = this->unk3C8.jointTable + var_v1;
+// // // temp_t6_2 = temp_v0_7->unk3E8 + var_v1;
+// // // temp_t6_2->unk6 = (unaligned s32) temp_t8_2->unk6;
+// // // temp_t6_2->unkA = (u16) temp_t8_2->unkA;
+// // // temp_t3_2 = this->unk3C8.jointTable + var_v1;
+// // // temp_t5_3 = temp_v0_7->unk3E8 + var_v1;
+// // // temp_t5_3->unkC = (unaligned s32) temp_t3_2->unkC;
+// // // temp_t5_3->unk10 = (u16) temp_t3_2->unk10;
+// // // temp_t2_4 = this->unk3C8.jointTable + var_v1;
+// // // temp_t5_4 = (unaligned s32) temp_t2_4->unk12;
+// // // temp_t1_2 = temp_v0_7->unk3E8 + var_v1;
+// // // var_v1 += 0x18;
+// // // temp_t1_2->unk12 = (unaligned s32) temp_t5_4;
+// // // temp_t1_2->unk16 = (u16) temp_t2_4->unk16;
+// // // } while (var_v1 != 0x78);
+
+// // temp_v0_7->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
+// // }
+// // var_s3_2 += 1;
+// // } while (var_s3_2 != 2);
+
+// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
+// }
+// }
+// }
+
+// if (sp103 == 0) {
+// CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1C8.base);
+// CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
+// }
+
+// CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C8.base);
+// CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
+// }
+
void func_809EF9BC(Boss05* this, PlayState* play) {
Player* player = GET_PLAYER(play);
@@ -357,7 +1207,77 @@ void func_809EF9BC(Boss05* this, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EFAB4.s")
+void func_809EFAB4(Boss05* this, PlayState* play) {
+ s32 i;
+ Vec3f sp80;
+ Vec3f sp74;
+ Boss05* temp_v0;
+ Player* player;
+
+ Actor_MoveWithGravity(&this->dyna.actor);
+ this->dyna.actor.world.pos.y -= 85.0f;
+ this->dyna.actor.prevPos.y -= 85.0f;
+ Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
+ this->dyna.actor.world.pos.y += 85.0f;
+ this->dyna.actor.prevPos.y += 85.0f;
+
+ if (this->dyna.actor.bgCheckFlags & 0x20) {
+ this->dyna.actor.gravity = -0.3f;
+ this->dyna.actor.terminalVelocity = -5.0f;
+ } else {
+ this->dyna.actor.gravity = -2.0f;
+ this->dyna.actor.terminalVelocity = -20.0f;
+ }
+
+ if (this->dyna.actor.bgCheckFlags & 0x40) {
+ this->dyna.actor.velocity.y = -3.0f;
+ this->dyna.actor.gravity = -0.3f;
+ this->dyna.actor.terminalVelocity = -5.0f;
+ Math_Vec3f_Copy(&sp80, &this->dyna.actor.world.pos);
+ sp80.y += 20.0f;
+ EffectSsGSplash_Spawn(play, &this->dyna.actor.world.pos, NULL, NULL, 1, 1000);
+ this->unk162[2] = 20;
+ }
+
+ if (this->unk162[2] != 0) {
+ for (i = 0; i < 3; i++) {
+ sp74.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+ sp74.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+ sp74.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+ EffectSsBubble_Spawn(play, &sp74, 20.0f, 10.0f, 20.0f, 0.13f);
+ }
+ }
+
+ if (this->dyna.actor.bgCheckFlags & 1) {
+ if ((this->unk189 == 0xA) && (this->unk17A != 0)) {
+ this->unk17A = 0;
+ }
+
+ Math_ApproachZeroF(&this->unk198, 1.0f, 0.05f);
+
+ if (this->unk198 == 0.0f) {
+ temp_v0 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
+ this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y,
+ this->unk330.z, 4);
+
+ if (temp_v0 != NULL) {
+ player = GET_PLAYER(play);
+ if (&this->dyna.actor == player->unk_730) {
+ player->unk_730 = temp_v0;
+ play->actorCtx.targetContext.arrowPointedActor = temp_v0;
+ play->actorCtx.targetContext.targetedActor = temp_v0;
+ }
+
+ for (i = 0; i < 20; i++) {
+ temp_v0->unk3C8.jointTable[i] = this->unk3C8.jointTable[i];
+ }
+
+ Actor_PlaySfxAtPos(&temp_v0->dyna.actor, NA_SE_EN_MIZUBABA_TRANSFORM);
+ }
+ Actor_MarkForDeath(&this->dyna.actor);
+ }
+ }
+}
void func_809EFE50(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
@@ -562,7 +1482,44 @@ void func_809F0708(Boss05* this, PlayState* play) {
Actor_SetColorFilter(&this->dyna.actor, 0x4000U, 120, 0, 30);
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0780.s")
+// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0780.s")
+void func_809F0780(Boss05* this, PlayState* play) {
+ s32 i;
+ s32 j;
+ Vec3f sp7C;
+ Boss05* temp_v0;
+
+ SkelAnime_Update(&this->unk3C8);
+ if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
+ if (Animation_OnFrame(&this->unk3C8, 22.0f)) {
+ for (i = 0; i < 14; i++) {
+ temp_v0 = (Boss05*)Actor_SpawnAsChild(
+ &play->actorCtx, &this->dyna.actor, play, 0x12D, 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, this->dyna.actor.shape.rot.z, i + 0xA);
+
+ if (temp_v0 != NULL) {
+ for (j = 0; j < 20; j++) {
+ temp_v0->unk3C8.jointTable[j] = this->unk3C8.jointTable[j];
+ }
+ }
+ }
+
+ for (i = 0; i < 20; i++) {
+ sp7C.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+ sp7C.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+ sp7C.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+ EffectSsBubble_Spawn(play, &sp7C, 20.0f, 10.0f, 20.0f, 0.13f);
+ }
+
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, 0x381F);
+ Actor_MarkForDeath(&this->dyna.actor);
+ Item_DropCollectibleRandom(play, NULL, &this->dyna.actor.world.pos, 0xE0);
+ }
+ } else if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ func_809F0474(this, play);
+ }
+}
void func_809F0A0C(Boss05* this, PlayState* play) {
this->actionFunc = func_809F0ABC;
@@ -1177,1350 +2134,3 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
// 0xF1,
// },
// };
-
-// void func_809EE4E0(Boss05 *this, PlayState *play) {
-// f32 sp94;
-// f32 sp90;
-// f32 sp8C;
-// f32 sp88;
-// f32 sp84;
-// f32 sp80;
-// s32 var_s1;
-
-// SoundSource_PlaySfxAtFixedWorldPos(play, &this->unk18C, 0x1EU, 0x28CBU);
-// var_s1 = 0;
-// do {
-// sp80 = randPlusMinusPoint5Scaled(7.0f);
-// sp88 = randPlusMinusPoint5Scaled(7.0f);
-// sp84 = Rand_ZeroFloat(6.0f) + 4.0f;
-// sp8C = this->unk18C.x + sp80;
-// sp90 = this->unk18C.y + sp84;
-// sp94 = this->unk18C.z + sp88;
-// EffectSsEnIce_Spawn(play, (Vec3f *) &sp8C, Rand_ZeroFloat(0.5f) + 0.7f, (Vec3f *) &sp80, &D_809F1BF4,
-// &D_809F1BEC, &D_809F1BF0, 0x1E); var_s1 += 1;
-// } while (var_s1 != 8);
-// }
-
-// void func_809EE668(s32 arg0, void *arg1, Vec3f *arg2) {
-// s32 temp_v0;
-// void *temp_v1;
-
-// temp_v0 = arg0 << 6;
-// (arg1->unk1C + temp_v0)->unk30 = (s16) (s32) arg2->x;
-// (arg1->unk1C + temp_v0)->unk32 = (s16) (s32) arg2->y;
-// (arg1->unk1C + temp_v0)->unk34 = (s16) (s32) arg2->z;
-// temp_v1 = arg1->unk1C + temp_v0;
-// temp_v1->unk36 = (s16) (s32) (temp_v1->unk38 * (f32) temp_v1->unk2E);
-// }
-
-// void Boss05_Init(Actor *thisx, PlayState *play) {
-// CollisionHeader *sp34;
-// s16 temp_v0;
-// s32 temp_ft0;
-// s32 temp_t0;
-// Boss05 *this = (Boss05 *) thisx;
-
-// sp34 = NULL;
-// this->dyna.actor.targetMode = 3;
-// this->dyna.actor.colChkInfo.mass = 0xFE;
-// this->dyna.actor.colChkInfo.health = 2;
-// temp_t0 = (s32) Rand_ZeroFloat(1000.0f);
-// this->unk35C = 1.0f;
-// this->unk160 = (s16) temp_t0;
-// this->dyna.actor.gravity = -0.3f;
-// Actor_SetScale(&this->dyna.actor, 0.01f);
-// temp_v0 = this->dyna.actor.params;
-// if ((temp_v0 == 0) || (temp_v0 == 1)) {
-// if (this->dyna.actor.world.rot.z == 0) {
-// this->dyna.actor.world.rot.z = 0;
-// }
-// this->dyna.actor.shape.rot.z = 0;
-// this->unk168 = this->dyna.actor.world.rot.z;
-// this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
-// this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
-// DynaPolyActor_Init(&this->dyna, 0);
-// CollisionHeader_GetVirtual(&D_809F1B00, &sp34);
-// this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34);
-// func_809EEDD0(this, play);
-// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
-// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
-// this->unk4FC = (f32) Animation_GetLastFrame(&D_06006484);
-// Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
-// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
-// if (Flags_GetClear(play, (s32) play->roomCtx.currRoom.num) != 0) {
-// this->dyna.actor.params = 2;
-// this->actionFunc = func_809EF9BC;
-// this->dyna.actor.flags &= ~1;
-// func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1U);
-// }
-// } else {
-// if (temp_v0 == 2) {
-// this->actionFunc = func_809EF9BC;
-// CollisionHeader_GetVirtual(&D_809F1B00, &sp34);
-// this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34);
-// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
-// this->dyna.actor.flags &= ~1;
-// func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1U);
-// return;
-// }
-// if (temp_v0 == 3) {
-// this->actionFunc = func_809EFAB4;
-// this->unk198 = 1.0f;
-// SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 0xA);
-// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
-// this->unk4FC = (f32) Animation_GetLastFrame(&D_06006484);
-// Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
-// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
-// ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
-// this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
-// return;
-// }
-// if (temp_v0 == 4) {
-// func_809F00CC(this, play);
-// this->dyna.actor.colChkInfo.mass = 0x5A;
-// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
-// Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BDC, this->unk388);
-// ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
-// this->dyna.actor.colChkInfo.damageTable = &D_809F1C20;
-// this->dyna.actor.flags |= 0x30;
-// return;
-// }
-// if (temp_v0 >= 0xA) {
-// SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
-// this->dyna.actor.gravity = 0.0f;
-// this->dyna.actor.world.rot.y = (s16) (s32) Rand_ZeroFloat(32768.0f);
-// this->dyna.actor.speedXZ = Rand_ZeroFloat(3.0f) + 3.0f;
-// this->dyna.actor.velocity.y = Rand_ZeroFloat(1.5f) + 1.5f;
-// this->unk500 = (s16) (s32) randPlusMinusPoint5Scaled(700.0f);
-// this->unk502 = (s16) (s32) randPlusMinusPoint5Scaled(1500.0f);
-// temp_ft0 = (s32) (Rand_ZeroFloat(30.0f) + 50.0f);
-// this->dyna.actor.flags &= ~1;
-// this->actionFunc = func_809F0B0C;
-// this->unk162[0] = (s16) temp_ft0;
-// }
-// }
-// }
-
-// void Boss05_Destroy(Actor *thisx, PlayState *play) {
-// s16 temp_v0;
-// Boss05 *this = (Boss05 *) thisx;
-
-// temp_v0 = this->dyna.actor.params;
-// if ((temp_v0 == 2) || (temp_v0 == 0) || (temp_v0 == 1)) {
-// DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
-// }
-// }
-
-// s32 func_809EECBC(Actor *arg0, PlayState *arg1) {
-// s32 var_v0;
-// u8 temp_v0;
-// void *var_v1;
-
-// var_v0 = 0;
-// if (arg0->unk16C == 0) {
-// var_v1 = arg0->unk1E4;
-// loop_2:
-// var_v0 += 0x40;
-// if (var_v1->unk16 & 2) {
-// temp_v0 = arg0->colChkInfo.damageEffect;
-// switch (temp_v0) { /* irregular */
-// case 2:
-// return 0xB;
-// case 3:
-// return 0x14;
-// case 4:
-// return 0x1E;
-// default:
-// return 0xA;
-// }
-// } else {
-// var_v1 += 0x40;
-// if (var_v0 == 0x80) {
-// if (arg0->unk384->unk16 & 2) {
-// arg0->colChkInfo.health -= arg0->colChkInfo.damage;
-// if ((s8) arg0->colChkInfo.health <= 0) {
-// Enemy_StartFinishingBlow(arg1, arg0);
-// return 2;
-// }
-// Actor_PlaySfxAtPos(arg0, 0x3807U);
-// arg0->unk16C = 0xF;
-// arg0->unk15C = 0;
-// arg0->unk162 = 0x1E;
-// return 0;
-// }
-// goto block_16;
-// }
-// goto loop_2;
-// }
-// } else {
-// block_16:
-// return 0;
-// }
-// }
-
-// void func_809EEDD0(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809EEDE8;
-// }
-
-// void func_809EEDE8(Boss05 *this, PlayState *play) {
-// Actor *sp108;
-// u8 sp103;
-// ? spD8;
-// s32 spD4;
-// s32 spD0;
-// s32 spCC;
-// s32 spC8;
-// s32 spC4;
-// s32 spC0;
-// s32 spBC;
-// s32 spB8;
-// s32 spB4;
-// f32 spA4;
-// Vec3f sp94;
-// f32 sp80;
-// s32 sp74;
-// f32 sp70;
-// s16 *sp6C;
-// s16 *sp60;
-// s16 *sp5C;
-// ? *temp_t5;
-// ? *var_s1;
-// ? temp_t2_2;
-// ? temp_t4;
-// ? temp_t5_4;
-// Actor *temp_v0_6;
-// Actor *temp_v0_7;
-// Actor *temp_v1;
-// ActorContext *temp_s0_2;
-// CollisionCheckContext *temp_s0_3;
-// CollisionCheckContext *temp_s0_4;
-// SkelAnime *temp_s0;
-// f32 *temp_s1;
-// f32 temp_ft4;
-// f32 var_fv1;
-// s16 var_s4;
-// s16 var_s5;
-// s16 var_s6;
-// s16 var_s7;
-// s32 temp_lo;
-// s32 temp_v0_5;
-// s32 var_s0;
-// s32 var_s0_2;
-// s32 var_s0_3;
-// s32 var_s3;
-// s32 var_s3_2;
-// s32 var_s4_2;
-// s32 var_v1;
-// u8 temp_v0;
-// u8 temp_v0_2;
-// void *temp_t1;
-// void *temp_t1_2;
-// void *temp_t2;
-// void *temp_t2_3;
-// void *temp_t2_4;
-// void *temp_t3;
-// void *temp_t3_2;
-// void *temp_t5_2;
-// void *temp_t5_3;
-// void *temp_t6;
-// void *temp_t6_2;
-// void *temp_t7;
-// void *temp_t8;
-// void *temp_t8_2;
-// void *temp_t9;
-// void *temp_t9_2;
-// void *temp_t9_3;
-// void *temp_v0_3;
-// void *temp_v0_4;
-
-// sp103 = 0;
-// var_s3 = 0;
-// sp108 = play->actorCtx.actorLists[2].first;
-// temp_v0 = this->unk174;
-// this->dyna.actor.hintId = 8;
-// var_s0 = 0;
-// var_s1 = &spD8;
-// if (temp_v0 == 0) {
-// spD4 = 0x3E8;
-// spD0 = 0x3E80;
-// spCC = 0x7D0;
-// spC8 = 0x5DC;
-// spC4 = 0x1770;
-// spC0 = 0xBB8;
-// spBC = 0x514;
-// spB8 = 0x5208;
-// spB4 = 0xDAC;
-// var_s6 = 0xA;
-// var_s7 = 0x300;
-// if (this->unk16C != 0) {
-// spD4 = 0x1B58;
-// spCC = 0x1770;
-// spC0 = 0x1770;
-// spBC = 0x1C84;
-// spB4 = 0x1964;
-// var_s6 = 1;
-// var_s7 = 0x1000;
-// }
-// } else {
-// var_s7 = 0;
-// if (temp_v0 == 3) {
-// spD4 = 0x1B58;
-// spD0 = 0x3E80;
-// spCC = 0x1388;
-// spC8 = 0x5DC;
-// spC4 = 0x2328;
-// spC0 = 0x1388;
-// spBC = 0x1C84;
-// spB8 = 0x5208;
-// spB4 = 0x157C;
-// var_s6 = 1;
-// var_s7 = 0x1000;
-// } else {
-// var_s6 = 0;
-// spB4 = 0;
-// spB8 = 0;
-// spBC = 0;
-// spC0 = 0;
-// spC4 = 0;
-// spC8 = 0;
-// spCC = 0;
-// spD0 = 0;
-// spD4 = 0;
-// }
-// }
-// sp5C = &this->unk1A2;
-// sp60 = &this->unk1A0;
-// sp6C = &this->unk19E;
-// do {
-// temp_v0_2 = this->unk174;
-// if ((temp_v0_2 == 0) || (temp_v0_2 == 3)) {
-// temp_lo = var_s3 * spB8;
-// var_s5 = var_s7;
-// var_s4 = var_s6;
-// sp70 = (f32) spB4;
-// if (var_s3 < 3) {
-// var_s1->unk2 = 0;
-// sp74 = temp_lo;
-// sp80 = (f32) spCC;
-// var_s1->unk0 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spD4) + (var_s3 * spD0))) * sp80);
-// } else {
-// var_s1->unk0 = 0;
-// sp74 = temp_lo;
-// sp80 = (f32) spC0;
-// var_s1->unk2 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spC8) + (var_s3 * spC4))) * sp80);
-// }
-// if ((var_s3 == 4) || (var_s3 == 6)) {
-// var_s1->unk4 = (s16) (s32) (2.0f * (Math_SinS((s16) ((this->unk160 * spBC) + temp_lo)) * sp70));
-// } else {
-// var_s1->unk4 = (s16) (s32) (Math_SinS((s16) ((this->unk160 * spBC) + temp_lo)) * sp70);
-// }
-// } else {
-// if (temp_v0_2 == 1) {
-// temp_v0_3 = var_s0 + &D_809F1C60;
-// var_s6 = 5;
-// var_s7 = 0x1000;
-// var_s1->unk0 = (s16) temp_v0_3->unk0;
-// var_s1->unk2 = (s16) temp_v0_3->unk2;
-// var_s1->unk4 = (s16) temp_v0_3->unk4;
-// } else if (temp_v0_2 == 2) {
-// temp_v0_4 = var_s0 + &D_809F1C8C;
-// var_s6 = 1;
-// var_s7 = 0x2000;
-// var_s1->unk0 = (s16) temp_v0_4->unk0;
-// var_s1->unk2 = (s16) temp_v0_4->unk2;
-// var_s1->unk4 = (s16) temp_v0_4->unk4;
-// }
-// var_s5 = var_s7;
-// var_s4 = var_s6;
-// }
-// Math_ApproachS(sp6C, var_s1->unk0, var_s4, var_s5);
-// Math_ApproachS(sp60, var_s1->unk2, var_s4, var_s5);
-// Math_ApproachS(sp5C, var_s1->unk4, var_s4, var_s5);
-// var_s3 += 1;
-// sp5C += 6;
-// sp60 += 6;
-// sp6C += 6;
-// var_s0 += 6;
-// var_s1 += 6;
-// } while (var_s3 < 7);
-// temp_ft4 = (sp108->world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
-// spA4 = temp_ft4;
-// if (temp_ft4 < 0.0f) {
-// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
-// }
-// temp_s0 = &this->unk3C8;
-// SkelAnime_Update(temp_s0);
-// temp_s1 = &this->unk35C;
-// Math_ApproachF(temp_s1, 1.0f, 0.1f, 0.1f);
-// if (this->unk15C != (u8) 0xA) {
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
-// }
-// switch (this->unk15C) { /* irregular */
-// case 0:
-// this->unk174 = 0;
-// this->unk3C8.playSpeed = 1.0f;
-// if (spA4 < 0.0f) {
-// if (sp108->speedXZ > 10.0f) {
-// var_fv1 = 220.0f;
-// } else {
-// var_fv1 = 150.0f;
-// }
-// if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
-// this->unk15C = 1;
-// this->unk162[0] = 0xA;
-// }
-// goto block_42;
-// }
-// sp103 = 1;
-// if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
-// this->unk15E += 1;
-// if (this->unk15E >= 0x1F) {
-// this->unk15C = 0xA;
-// this->unk162[0] = 0x1E;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
-// }
-// } else {
-// block_42:
-// this->unk15E = 0;
-// }
-// if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// break;
-// case 10:
-// if (!(this->unk160 & 1)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// this->unk19C = (this->unk162[0] & 1) << 9;
-// this->unk174 = 3;
-// this->unk3C8.playSpeed = 4.0f;
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
-// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
-// if (this->unk162[0] == 0) {
-// this->unk162[0] = 0x64;
-// this->unk15E = 0;
-// this->unk15C = 0;
-// }
-// if (this->unk162[0] == 0x1B) {
-// Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
-// sp94.y += 40.0f;
-// EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, (s16) 1, (s16) 0x7D0);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
-// }
-// break;
-// case 1:
-// if (Animation_OnFrame(temp_s0, this->unk4FC) != 0) {
-// this->unk3C8.playSpeed = 0.0f;
-// }
-// this->unk174 = 1;
-// if (this->unk162[0] == 0) {
-// this->unk15C = 2;
-// this->unk162[0] = 0x14;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
-// }
-// break;
-// case 2:
-// if (!(this->unk160 & 1)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// this->unk19C = (this->unk162[0] & 1) << 9;
-// this->unk3C8.playSpeed = 4.0f;
-// Math_ApproachF(temp_s1, 1.5f, 1.0f, 0.7f);
-// this->unk174 = 2;
-// if (this->unk162[0] == 0) {
-// this->unk15C = 0;
-// this->unk162[0] = 0x1E;
-// }
-// break;
-// }
-// temp_v0_5 = func_809EECBC(&this->dyna.actor, play);
-// var_s4_2 = temp_v0_5;
-// if ((temp_v0_5 != 0) || (this->unk168 == 1)) {
-// this->dyna.actor.params = 2;
-// this->actionFunc = func_809EF9BC;
-// this->dyna.actor.flags &= ~1;
-// temp_s0_2 = &play->actorCtx;
-// func_800BC154(play, temp_s0_2, &this->dyna.actor, 1U);
-// if (this->unk168 != 0) {
-// var_s4_2 = 0xA;
-// }
-// if (var_s4_2 >= 0xA) {
-// temp_v0_6 = Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->dyna.actor.world.pos.x,
-// this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, (s16) (s32) this->dyna.actor.shape.rot.x,
-// (s16) (s32) this->dyna.actor.shape.rot.y, (s16) (s32) this->dyna.actor.shape.rot.z, 3); if (temp_v0_6 !=
-// NULL) {
-// var_s0_2 = 0;
-// temp_v1 = play->actorCtx.actorLists[2].first;
-// if (this == temp_v1->unk730) {
-// temp_v1->unk730 = temp_v0_6;
-// play->actorCtx.targetContext.arrowPointedActor = temp_v0_6;
-// play->actorCtx.targetContext.targetedActor = temp_v0_6;
-// }
-// do {
-// temp_t5 = this->unk268.jointTable + var_s0_2;
-// temp_t4 = (unaligned s32) temp_t5->unk0;
-// temp_t1 = temp_v0_6->unk288 + var_s0_2;
-// var_s0_2 += 6;
-// temp_t1->unk0 = (unaligned s32) temp_t4;
-// temp_t1->unk4 = (u16) temp_t5->unk4;
-// } while (var_s0_2 < 0x3C);
-// var_s0_3 = 0;
-// do {
-// temp_t9 = this->unk3C8.jointTable + var_s0_3;
-// temp_t7 = temp_v0_6->unk3E8 + var_s0_3;
-// temp_t7->unk0 = (unaligned s32) temp_t9->unk0;
-// temp_t7->unk4 = (u16) temp_t9->unk4;
-// temp_t6 = this->unk3C8.jointTable + var_s0_3;
-// temp_t3 = temp_v0_6->unk3E8 + var_s0_3;
-// temp_t3->unk6 = (unaligned s32) temp_t6->unk6;
-// temp_t3->unkA = (u16) temp_t6->unkA;
-// temp_t5_2 = this->unk3C8.jointTable + var_s0_3;
-// temp_t2 = temp_v0_6->unk3E8 + var_s0_3;
-// temp_t2->unkC = (unaligned s32) temp_t5_2->unkC;
-// temp_t2->unk10 = (u16) temp_t5_2->unk10;
-// temp_t9_2 = this->unk3C8.jointTable + var_s0_3;
-// temp_t2_2 = (unaligned s32) temp_t9_2->unk12;
-// temp_t8 = temp_v0_6->unk3E8 + var_s0_3;
-// var_s0_3 += 0x18;
-// temp_t8->unk12 = (unaligned s32) temp_t2_2;
-// temp_t8->unk16 = (u16) temp_t9_2->unk16;
-// } while (var_s0_3 != 0x78);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
-// if (var_s4_2 >= 0xB) {
-// temp_v0_6->unk188 = (s8) (var_s4_2 - 0xA);
-// }
-// }
-// } else {
-// var_s3_2 = 0;
-// if (var_s4_2 == 2) {
-// do {
-// temp_v0_7 = Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x,
-// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330.x, (s16) (s32) this->unk330.y, (s16)
-// (s32) this->unk330.z, var_s3_2 + 0xA); if (temp_v0_7 != NULL) {
-// var_v1 = 0;
-// do {
-// temp_t2_3 = this->unk3C8.jointTable + var_v1;
-// temp_t9_3 = temp_v0_7->unk3E8 + var_v1;
-// temp_t9_3->unk0 = (unaligned s32) temp_t2_3->unk0;
-// temp_t9_3->unk4 = (u16) temp_t2_3->unk4;
-// temp_t8_2 = this->unk3C8.jointTable + var_v1;
-// temp_t6_2 = temp_v0_7->unk3E8 + var_v1;
-// temp_t6_2->unk6 = (unaligned s32) temp_t8_2->unk6;
-// temp_t6_2->unkA = (u16) temp_t8_2->unkA;
-// temp_t3_2 = this->unk3C8.jointTable + var_v1;
-// temp_t5_3 = temp_v0_7->unk3E8 + var_v1;
-// temp_t5_3->unkC = (unaligned s32) temp_t3_2->unkC;
-// temp_t5_3->unk10 = (u16) temp_t3_2->unk10;
-// temp_t2_4 = this->unk3C8.jointTable + var_v1;
-// temp_t5_4 = (unaligned s32) temp_t2_4->unk12;
-// temp_t1_2 = temp_v0_7->unk3E8 + var_v1;
-// var_v1 += 0x18;
-// temp_t1_2->unk12 = (unaligned s32) temp_t5_4;
-// temp_t1_2->unk16 = (u16) temp_t2_4->unk16;
-// } while (var_v1 != 0x78);
-// temp_v0_7->unk162 = (s16) (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
-// }
-// var_s3_2 += 1;
-// } while (var_s3_2 != 2);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
-// }
-// }
-// }
-// if (sp103 == 0) {
-// temp_s0_3 = &play->colChkCtx;
-// CollisionCheck_SetAT(play, temp_s0_3, &this->unk1C8.base);
-// CollisionCheck_SetAT(play, temp_s0_3, &this->unk368.base);
-// }
-// temp_s0_4 = &play->colChkCtx;
-// CollisionCheck_SetAC(play, temp_s0_4, &this->unk1C8.base);
-// CollisionCheck_SetAC(play, temp_s0_4, &this->unk368.base);
-// }
-
-// void func_809EF9BC(Boss05 *this, PlayState *play) {
-// f32 temp_fv0;
-// s16 var_a1;
-// s32 temp_ft3;
-
-// temp_fv0 = sqrtf(this->dyna.actor.xyzDistToPlayerSq);
-// if ((temp_fv0 < 50.0f) && (play->actorCtx.actorLists[2].first->bgCheckFlags & 1)) {
-// temp_ft3 = (s32) (temp_fv0 * 80.0f);
-// var_a1 = (s16) temp_ft3;
-// if ((s16) temp_ft3 >= 0x7D1) {
-// var_a1 = 0x7D0;
-// }
-// Math_ApproachS(&this->unk178, var_a1, 0x14, 0x7D0);
-// Math_ApproachS(&this->unk176, this->dyna.actor.yawTowardsPlayer, 0x14, 0xFA0);
-// if (!(this->unk160 & 0xF)) {
-// EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x1F4, 0x3E8, (s16) 0);
-// }
-// } else {
-// Math_ApproachS(&this->unk178, 0, 0x14, 0x100);
-// }
-// }
-
-// void func_809EFAB4(Boss05 *this, PlayState *play) {
-// Vec3f sp80;
-// f32 sp7C;
-// f32 sp78;
-// f32 sp74;
-// ? temp_t8;
-// Actor *temp_v0;
-// Actor *temp_v1;
-// PosRot *temp_s1;
-// s32 var_s1;
-// s32 var_v1;
-// void *temp_t1;
-// void *temp_t3;
-// void *temp_t3_2;
-// void *temp_t5;
-// void *temp_t6;
-// void *temp_t7;
-// void *temp_t7_2;
-// void *temp_t9;
-
-// Actor_MoveWithGravity(&this->dyna.actor);
-// this->dyna.actor.world.pos.y -= 85.0f;
-// this->dyna.actor.prevPos.y -= 85.0f;
-// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
-// this->dyna.actor.world.pos.y += 85.0f;
-// this->dyna.actor.prevPos.y += 85.0f;
-// if (this->dyna.actor.bgCheckFlags & 0x20) {
-// this->dyna.actor.gravity = -0.3f;
-// this->dyna.actor.terminalVelocity = -5.0f;
-// } else {
-// this->dyna.actor.gravity = -2.0f;
-// this->dyna.actor.terminalVelocity = -20.0f;
-// }
-// temp_s1 = &this->dyna.actor.world;
-// if (this->dyna.actor.bgCheckFlags & 0x40) {
-// this->dyna.actor.velocity.y = -3.0f;
-// this->dyna.actor.gravity = -0.3f;
-// this->dyna.actor.terminalVelocity = -5.0f;
-// Math_Vec3f_Copy(&sp80, &temp_s1->pos);
-// sp80.y += 20.0f;
-// EffectSsGSplash_Spawn(play, &temp_s1->pos, NULL, NULL, (s16) 1, (s16) 0x3E8);
-// this->unk162[2] = 0x14;
-// }
-// var_s1 = 0;
-// if (this->unk162[2] != 0) {
-// do {
-// sp74 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
-// sp78 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
-// sp7C = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
-// EffectSsBubble_Spawn(play, (Vec3f *) &sp74, 20.0f, 10.0f, 20.0f, 0.13f);
-// var_s1 += 1;
-// } while (var_s1 != 3);
-// }
-// if (this->dyna.actor.bgCheckFlags & 1) {
-// if ((this->unk189 == 0xA) && (this->unk17A != 0)) {
-// this->unk17A = 0;
-// }
-// Math_ApproachZeroF(&this->unk198, 1.0f, 0.05f);
-// if (this->unk198 == 0.0f) {
-// temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
-// this->unk324.y, this->unk324.z, (s16) (s32) this->unk330.x, (s16) (s32) this->unk330.y, (s16) (s32)
-// this->unk330.z, 4); if (temp_v0 != NULL) {
-// temp_v1 = play->actorCtx.actorLists[2].first;
-// if (this == temp_v1->unk730) {
-// temp_v1->unk730 = temp_v0;
-// play->actorCtx.targetContext.arrowPointedActor = temp_v0;
-// play->actorCtx.targetContext.targetedActor = temp_v0;
-// }
-// var_v1 = 0;
-// do {
-// temp_t7 = this->unk3C8.jointTable + var_v1;
-// temp_t5 = temp_v0->unk3E8 + var_v1;
-// temp_t5->unk0 = (unaligned s32) temp_t7->unk0;
-// temp_t5->unk4 = (u16) temp_t7->unk4;
-// temp_t3 = this->unk3C8.jointTable + var_v1;
-// temp_t1 = temp_v0->unk3E8 + var_v1;
-// temp_t1->unk6 = (unaligned s32) temp_t3->unk6;
-// temp_t1->unkA = (u16) temp_t3->unkA;
-// temp_t9 = this->unk3C8.jointTable + var_v1;
-// temp_t7_2 = temp_v0->unk3E8 + var_v1;
-// temp_t7_2->unkC = (unaligned s32) temp_t9->unkC;
-// temp_t7_2->unk10 = (u16) temp_t9->unk10;
-// temp_t6 = this->unk3C8.jointTable + var_v1;
-// temp_t8 = (unaligned s32) temp_t6->unk12;
-// temp_t3_2 = temp_v0->unk3E8 + var_v1;
-// var_v1 += 0x18;
-// temp_t3_2->unk12 = (unaligned s32) temp_t8;
-// temp_t3_2->unk16 = (u16) temp_t6->unk16;
-// } while (var_v1 != 0x78);
-// Actor_PlaySfxAtPos(temp_v0, 0x3825U);
-// }
-// Actor_MarkForDeath(&this->dyna.actor);
-// }
-// }
-// }
-
-// void func_809EFE50(Actor *thisx, PlayState *play2) {
-// u8 sp27;
-// u8 temp_a0;
-// u8 temp_v0;
-// u8 var_a2;
-// void *temp_v1;
-
-// if ((thisx->unk16A == 0) && (temp_v1 = thisx->unk384, temp_a0 = temp_v1->unk16, ((temp_a0 & 2) != 0))) {
-// temp_v1->unk16 = (u8) (temp_a0 & 0xFFFD);
-// if (*thisx->unk384->unk24 & 0x300000) {
-// thisx->unk16A = 6;
-// thisx->unk338 = -12.0f;
-// thisx->unk348 = (s16) thisx->yawTowardsPlayer;
-// return;
-// }
-// thisx->unk16A = 0xA;
-// thisx->speedXZ = 0.0f;
-// thisx->unk338 = -20.0f;
-// thisx->unk348 = (s16) thisx->yawTowardsPlayer;
-// sp27 = 0;
-// Actor_PlaySfxAtPos(thisx, 0x3807U);
-// temp_v0 = thisx->colChkInfo.damageEffect;
-// switch (temp_v0) { /* irregular */
-// case 1:
-// sp27 = 0;
-// func_809F0A0C((Boss05 *) thisx, play2);
-// var_a2 = 0;
-// break;
-// case 2:
-// thisx->unk188 = 1;
-// default:
-// block_13:
-// var_a2 = 1;
-// break;
-// case 3:
-// sp27 = 0;
-// func_809F0A64((Boss05 *) thisx, play2);
-// var_a2 = 0;
-// thisx->unk188 = 0xA;
-// break;
-// case 4:
-// thisx->unk188 = 0x14;
-// goto block_13;
-// }
-// if (var_a2 != 0) {
-// if ((func_809F0ABC == thisx->unk170) && (thisx->unk189 == 0xA) && (thisx->unk17A != 0)) {
-// func_809EE4E0((Boss05 *) thisx, play2);
-// thisx->unk188 = 0;
-// }
-// thisx->colChkInfo.health -= thisx->colChkInfo.damage;
-// if ((s8) thisx->colChkInfo.health <= 0) {
-// Enemy_StartFinishingBlow(play2, thisx);
-// }
-// func_809F0708((Boss05 *) thisx, play2);
-// thisx->unk16C = 0xF;
-// }
-// }
-// }
-
-// s32 func_809F0014(Boss05 *this, PlayState *play) {
-// s16 temp_v0;
-// s16 var_v1;
-
-// temp_v0 = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
-// var_v1 = temp_v0;
-// if (temp_v0 < 0) {
-// var_v1 = -temp_v0;
-// }
-// if (var_v1 < 0x3000) {
-// return 1;
-// }
-// return 0;
-// }
-
-// void func_809F0058(Boss05 *this, PlayState *play) {
-// if ((func_809F0014(this, play) != 0) && (this->dyna.actor.xyzDistToPlayerSq <= 40000.0f) &&
-// (fabsf(this->dyna.actor.playerHeightRel) < 70.0f)) {
-// func_809F0474(this, play);
-// }
-// }
-
-// void func_809F00CC(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F010C;
-// Animation_MorphToPlayOnce(&this->unk3C8, &D_06006E50, -5.0f);
-// }
-
-// void func_809F010C(Boss05 *this, PlayState *play) {
-// SkelAnime_Update(&this->unk3C8);
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
-// Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
-// Math_ApproachF(&this->unk360, 1.0f, 1.0f, 0.5f);
-// Math_ApproachF(&this->unk364, 1.0f, 1.0f, 0.14f);
-// if (this->unk364 == 1.0f) {
-// func_809F01CC(this, play);
-// }
-// }
-
-// void func_809F01CC(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F0244;
-// Animation_MorphToLoop(&this->unk3C8, &D_06007488, -10.0f);
-// this->unk162[0] = (s16) (s32) (Rand_ZeroFloat(25.0f) + 25.0f);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-
-// void func_809F0244(Boss05 *this, PlayState *play) {
-// SkelAnime_Update(&this->unk3C8);
-// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
-// Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
-// if (this->unk162[0] == 0) {
-// func_809F02D0(this, play);
-// }
-// func_809F0058(this, play);
-// }
-
-// void func_809F02D0(Boss05 *this, PlayState *play) {
-// f32 temp_ft0;
-
-// this->actionFunc = func_809F0374;
-// Animation_MorphToLoop(&this->unk3C8, &D_06007908, 0.0f);
-// this->unk162[0] = (s16) (s32) (Rand_ZeroFloat(80.0f) + 60.0f);
-// this->unk34C = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.x;
-// temp_ft0 = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.z;
-// this->unk358 = 0.0f;
-// this->unk354 = temp_ft0;
-// }
-
-// void func_809F0374(Boss05 *this, PlayState *play) {
-// f32 sp24;
-// f32 sp20;
-// f32 temp_fa0;
-// f32 temp_fa1;
-
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3027U);
-// SkelAnime_Update(&this->unk3C8);
-// Math_ApproachF(&this->dyna.actor.speedXZ, 5.0f, 1.0f, 2.0f);
-// temp_fa0 = this->unk34C - this->dyna.actor.world.pos.x;
-// temp_fa1 = this->unk354 - this->dyna.actor.world.pos.z;
-// sp24 = temp_fa0;
-// sp20 = temp_fa1;
-// Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(temp_fa0, temp_fa1), 5, (s16) (s32) this->unk358);
-// Math_ApproachF(&this->unk358, 2000.0f, 1.0f, 100.0f);
-// if ((this->unk162[0] == 0) || (((sp24 * sp24) + (sp20 * sp20)) < 2500.0f)) {
-// func_809F01CC(this, play);
-// }
-// func_809F0058(this, play);
-// }
-
-// void func_809F0474(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F04C0;
-// Animation_MorphToPlayOnce(&this->unk3C8, &D_06003448, 0.0f);
-// this->unk162[0] = 0x14;
-// }
-
-// void func_809F04C0(Boss05 *this, PlayState *play) {
-// SkelAnime_Update(&this->unk3C8);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3006U);
-// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
-// Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, 0x1000);
-// if (this->unk162[0] == 0) {
-// func_809F0538(this, play);
-// }
-// }
-
-// void func_809F0538(Boss05 *this, PlayState *arg1) {
-// this->actionFunc = func_809F0590;
-// Animation_MorphToLoop(&this->unk3C8, &D_06000A5C, 0.0f);
-// this->unk162[0] = 0x3C;
-// this->unk358 = 0.0f;
-// }
-
-// void func_809F0590(Boss05 *this, PlayState *play) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3006U);
-// SkelAnime_Update(&this->unk3C8);
-// Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
-// Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s16) (s32) this->unk358);
-// Math_ApproachF(&this->unk358, 4000.0f, 1.0f, 400.0f);
-// if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
-// func_809F0650(this, play);
-// }
-// }
-
-// void func_809F0650(Boss05 *this, PlayState *arg1) {
-// this->actionFunc = func_809F06B8;
-// Animation_MorphToPlayOnce(&this->unk3C8, &D_060006A4, 0.0f);
-// this->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3837U);
-// }
-
-// void func_809F06B8(Boss05 *this, PlayState *play) {
-// SkelAnime *sp1C;
-// SkelAnime *temp_a0;
-
-// temp_a0 = &this->unk3C8;
-// sp1C = temp_a0;
-// SkelAnime_Update(temp_a0);
-// if (Animation_OnFrame(temp_a0, this->unk4FC) != 0) {
-// func_809F01CC(this, play);
-// }
-// }
-
-// void func_809F0708(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F0780;
-// Animation_MorphToPlayOnce(&this->unk3C8, &D_06002F0C, 0.0f);
-// this->unk4FC = (f32) Animation_GetLastFrame(&D_060006A4);
-// Actor_SetColorFilter(&this->dyna.actor, 0x4000U, 0x78U, 0U, (u16) 0x1E);
-// }
-
-// void func_809F0780(Boss05 *this, PlayState *play) {
-// f32 sp84;
-// f32 sp80;
-// f32 sp7C;
-// ? temp_t5;
-// Actor *temp_v0;
-// PosRot *temp_s1_2;
-// SkelAnime *temp_s1;
-// s32 var_s2;
-// s32 var_s2_2;
-// s32 var_v1;
-// void *temp_t0;
-// void *temp_t0_2;
-// void *temp_t2;
-// void *temp_t3;
-// void *temp_t4;
-// void *temp_t4_2;
-// void *temp_t6;
-// void *temp_t8;
-
-// temp_s1 = &this->unk3C8;
-// SkelAnime_Update(temp_s1);
-// if ((s8) this->dyna.actor.colChkInfo.health <= 0) {
-// var_s2 = 0;
-// if (Animation_OnFrame(temp_s1, 22.0f) != 0) {
-// do {
-// temp_v0 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D,
-// this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, (s16) (s32)
-// this->dyna.actor.shape.rot.x, (s16) (s32) this->dyna.actor.shape.rot.y, (s16) (s32)
-// this->dyna.actor.shape.rot.z, var_s2 + 0xA); var_s2 += 1; if (temp_v0 != NULL) {
-// var_v1 = 0;
-// do {
-// temp_t4 = this->unk3C8.jointTable + var_v1;
-// temp_t2 = temp_v0->unk3E8 + var_v1;
-// temp_t2->unk0 = (unaligned s32) temp_t4->unk0;
-// temp_t2->unk4 = (u16) temp_t4->unk4;
-// temp_t0 = this->unk3C8.jointTable + var_v1;
-// temp_t8 = temp_v0->unk3E8 + var_v1;
-// temp_t8->unk6 = (unaligned s32) temp_t0->unk6;
-// temp_t8->unkA = (u16) temp_t0->unkA;
-// temp_t6 = this->unk3C8.jointTable + var_v1;
-// temp_t4_2 = temp_v0->unk3E8 + var_v1;
-// temp_t4_2->unkC = (unaligned s32) temp_t6->unkC;
-// temp_t4_2->unk10 = (u16) temp_t6->unk10;
-// temp_t3 = this->unk3C8.jointTable + var_v1;
-// temp_t5 = (unaligned s32) temp_t3->unk12;
-// temp_t0_2 = temp_v0->unk3E8 + var_v1;
-// var_v1 += 0x18;
-// temp_t0_2->unk12 = (unaligned s32) temp_t5;
-// temp_t0_2->unk16 = (u16) temp_t3->unk16;
-// } while (var_v1 != 0x78);
-// }
-// } while (var_s2 < 0xE);
-// var_s2_2 = 0;
-// do {
-// sp7C = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
-// sp80 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
-// sp84 = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
-// EffectSsBubble_Spawn(play, (Vec3f *) &sp7C, 20.0f, 10.0f, 20.0f, 0.13f);
-// var_s2_2 += 1;
-// } while (var_s2_2 != 0x14);
-// temp_s1_2 = &this->dyna.actor.world;
-// SoundSource_PlaySfxAtFixedWorldPos(play, &temp_s1_2->pos, 0x28U, 0x381FU);
-// Actor_MarkForDeath(&this->dyna.actor);
-// Item_DropCollectibleRandom(play, NULL, &temp_s1_2->pos, 0xE0);
-// }
-// } else if (Animation_OnFrame(temp_s1, this->unk4FC) != 0) {
-// func_809F0474(this, play);
-// }
-// }
-
-// void func_809F0A0C(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F0ABC;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
-// this->unk162[0] = 0x28;
-// Actor_SetColorFilter(&this->dyna.actor, 0U, 0x78U, 0U, (u16) 0x28);
-// }
-
-// void func_809F0A64(Boss05 *this, PlayState *play) {
-// this->actionFunc = func_809F0ABC;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
-// this->unk162[0] = 0x50;
-// Actor_SetColorFilter(&this->dyna.actor, 0U, 0x78U, 0U, (u16) 0x50);
-// }
-
-// void func_809F0ABC(Boss05 *this, PlayState *play) {
-// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
-// if (this->unk162[0] == 0) {
-// func_809F01CC(this, play);
-// }
-// }
-
-// void func_809F0B0C(Boss05 *this, PlayState *play) {
-// s32 temp_t9;
-// u8 var_v0;
-
-// Actor_MoveWithGravity(&this->dyna.actor);
-// var_v0 = this->unk15C;
-// if (var_v0 == 0) {
-// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
-// var_v0 = 2U & 0xFF;
-// if (this->dyna.actor.bgCheckFlags & 0x20) {
-// this->unk15C = 1;
-// var_v0 = 1U & 0xFF;
-// } else {
-// this->unk15C = 2;
-// }
-// }
-// if (var_v0 == 1) {
-// Math_ApproachF(&this->dyna.actor.velocity.y, 1.0f, 1.0f, 0.1f);
-// Math_ApproachZeroF(&this->dyna.actor.speedXZ, 0.5f, 0.5f);
-// this->dyna.actor.shape.rot.x += this->unk500;
-// this->dyna.actor.shape.rot.y += this->unk502;
-// if (this->unk162[0] == 0) {
-// Actor_MarkForDeath(&this->dyna.actor);
-// }
-// } else {
-// switch (var_v0) { /* irregular */
-// case 2:
-// this->dyna.actor.velocity.y = Rand_ZeroFloat(3.0f) + 3.0f;
-// this->dyna.actor.speedXZ = randPlusMinusPoint5Scaled(5.0f) + 5.0f;
-// temp_t9 = (s32) Rand_ZeroFloat(65536.0f);
-// this->unk15C = 3;
-// this->dyna.actor.gravity = -1.0f;
-// this->dyna.actor.world.rot.y = (s16) temp_t9;
-// return;
-// case 3:
-// Actor_MoveWithGravity(&this->dyna.actor);
-// if (this->unk324.y < (this->dyna.actor.floorHeight - 30.0f)) {
-// Actor_MarkForDeath(&this->dyna.actor);
-// }
-// return;
-// }
-// }
-// }
-
-// void Boss05_Update(Actor *thisx, PlayState *play) {
-// CollisionCheckContext *sp30;
-// ColliderJntSph *sp2C;
-// ColliderJntSph *temp_a2;
-// CollisionCheckContext *temp_a1;
-// s16 temp_a0;
-// s16 temp_v0;
-// s16 temp_v0_2;
-// s16 temp_v0_3;
-// s16 temp_v0_4;
-// s16 var_v0;
-// u8 temp_v0_5;
-// void *temp_v1;
-// Boss05 *this = (Boss05 *) thisx;
-
-// var_v0 = 0;
-// this->unk160 += 1;
-// do {
-// temp_v1 = this + (var_v0 * 2);
-// temp_a0 = this->unk162[var_v0];
-// var_v0 += 1;
-// if (temp_a0 != 0) {
-// temp_v1->unk162 = (s16) (temp_a0 - 1);
-// }
-// } while (var_v0 < 3);
-// temp_v0 = this->unk16A;
-// if (temp_v0 != 0) {
-// this->unk16A = temp_v0 - 1;
-// }
-// temp_v0_2 = this->unk16C;
-// if (temp_v0_2 != 0) {
-// this->unk16C = temp_v0_2 - 1;
-// }
-// temp_v0_3 = this->unk168;
-// if (temp_v0_3 != 0) {
-// this->unk168 = temp_v0_3 - 1;
-// }
-// temp_v0_4 = this->unk17A;
-// if (temp_v0_4 != 0) {
-// this->unk17A = temp_v0_4 - 1;
-// }
-// this->actionFunc(this, play);
-// if (this->dyna.actor.params == 4) {
-// Actor_MoveWithGravity(&this->dyna.actor);
-// Matrix_RotateYS(this->unk348, MTXMODE_NEW);
-// Matrix_MultVecZ(this->unk338, &this->unk33C);
-// this->dyna.actor.world.pos.x += this->unk33C.x;
-// this->dyna.actor.world.pos.z += this->unk33C.z;
-// Math_ApproachZeroF(&this->unk338, 1.0f, 1.0f);
-// Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x45U);
-// func_809EFE50(&this->dyna.actor, play);
-// temp_a2 = &this->unk368;
-// temp_a1 = &play->colChkCtx;
-// sp30 = temp_a1;
-// sp2C = temp_a2;
-// CollisionCheck_SetAT(play, temp_a1, &temp_a2->base);
-// CollisionCheck_SetAC(play, temp_a1, &temp_a2->base);
-// CollisionCheck_SetOC(play, temp_a1, &temp_a2->base);
-// this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
-// }
-// temp_v0_5 = this->unk188;
-// switch (temp_v0_5) {
-// case 0:
-// this->unk189 = 0;
-// this->unk17A = 0;
-// this->unk184 = 0.0f;
-// return;
-// case 1:
-// this->unk189 = 0;
-// this->unk17A = 0x50;
-// this->unk184 = 1.0f;
-// this->unk188 = temp_v0_5 + 1;
-// this->unk17C = 0.0f;
-// /* fallthrough */
-// case 2:
-// if (this->unk17A == 0) {
-// Math_ApproachZeroF(&this->unk184, 1.0f, 0.02f);
-// if (this->unk184 == 0.0f) {
-// this->unk188 = 0;
-// return;
-// }
-// default:
-// return;
-// }
-// Math_ApproachF(&this->unk17C, 1.0f, 0.1f, 0.5f);
-// return;
-// case 10:
-// this->unk189 = 0xA;
-// this->unk17A = 0x50;
-// this->unk184 = 1.0f;
-// this->unk188 = temp_v0_5 + 1;
-// this->unk17C = 0.0f;
-// this->unk180 = 2.0f;
-// /* fallthrough */
-// case 11:
-// if (this->unk17A == 0) {
-// func_809EE4E0(this, play);
-// this->unk188 = 0;
-// return;
-// }
-// Math_ApproachF(&this->unk17C, 1.0f, 1.0f, 0.25f);
-// Math_ApproachF(&this->unk180, 1.0f, 0.1f, 0.1f);
-// return;
-// case 20:
-// this->unk189 = 0x14;
-// this->unk17A = 0x50;
-// this->unk184 = 1.0f;
-// this->unk188 = temp_v0_5 + 1;
-// this->unk17C = 0.0f;
-// return;
-// case 21:
-// if (this->unk17A == 0) {
-// Math_ApproachZeroF(&this->unk17C, 1.0f, 0.03f);
-// if (this->unk17C == 0.0f) {
-// this->unk188 = 0;
-// this->unk184 = 0.0f;
-// return;
-// }
-// } else {
-// Math_ApproachF(&this->unk17C, 1.0f, 0.5f, 0.5f);
-// }
-// break;
-// }
-// }
-
-// s32 func_809F1050(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
-// s8 temp_v1;
-// void *temp_a1;
-
-// if (limbIndex == gGameInfo->data[0x500]) {
-// if (!(thisx->unk160 & 3)) {
-// *dList = NULL;
-// }
-// rot->x += gGameInfo->data[0x501] << 8;
-// rot->y += gGameInfo->data[0x502] << 8;
-// rot->z += gGameInfo->data[0x503] << 8;
-// }
-// if ((thisx->params == 1) && (limbIndex == 9)) {
-// *dList = NULL;
-// }
-// if (limbIndex == 2) {
-// rot->x += thisx->unk19C;
-// }
-// temp_v1 = *(&D_809F1CB8 + limbIndex);
-// if (temp_v1 >= 0) {
-// temp_a1 = thisx + (temp_v1 * 6);
-// rot->x += temp_a1->unk19E;
-// rot->y += temp_a1->unk1A0;
-// rot->z += temp_a1->unk1A2;
-// }
-// return 0;
-// }
-
-// void func_809F1170(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
-// MtxF sp3C;
-// Vec3f sp30;
-// Vec3f sp24;
-// void *sp20;
-
-// if (limbIndex == 4) {
-// Matrix_MultVec3f(&D_809F1CC4, thisx + 0x324);
-// if (func_809EFAB4 == thisx->unk170) {
-// Matrix_MultVec3f(&D_809F1CC4, &thisx->focus.pos);
-// }
-// Matrix_Get(&sp3C);
-// Matrix_MtxFToYXZRot(&sp3C, thisx + 0x330, 0);
-// thisx->unk330 = (s16) (thisx->unk330 + 0xF00);
-// }
-// if (limbIndex == 2) {
-// Matrix_MultZero(&sp30);
-// func_809EE668(0, thisx + 0x1C8, &sp30);
-// }
-// if (limbIndex == 3) {
-// sp20 = thisx + 0x1C8;
-// Matrix_MultVecY(-500.0f, &sp24);
-// func_809EE668(1, sp20, &sp24);
-// if (func_809EEDE8 == thisx->unk170) {
-// Matrix_MultVecY(1500.0f, &thisx->focus.pos);
-// }
-// }
-// }
-
-// s32 func_809F1284(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
-// return 0;
-// }
-
-// void func_809F12A0(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
-// if (limbIndex == 1) {
-// Matrix_MultVec3f(&D_809F1CD0, &D_809F2110);
-// func_809EE668(0, thisx + 0x368, &D_809F2110);
-// if (thisx->params == 4) {
-// Matrix_MultVec3f(D_809F1CDC, &thisx->focus.pos);
-// }
-// if (thisx->unk188 != 0) {
-// Matrix_MultVec3f(D_809F1CDC, thisx + 0x18C);
-// if (thisx->unk189 == 0) {
-// thisx->unk190 = (f32) (thisx->unk190 - 15.0f);
-// }
-// }
-// }
-// }
-
-// void func_809F135C(PlayState *play, s32 limbIndex, Actor *thisx) {
-// f32 temp_fa0;
-// f32 temp_fa0_2;
-// f32 temp_fa0_3;
-
-// if ((limbIndex == 2) || (limbIndex == 3)) {
-// temp_fa0 = thisx->unk35C;
-// Matrix_Scale(temp_fa0, 1.0f, temp_fa0, MTXMODE_APPLY);
-// }
-// if (limbIndex == 1) {
-// temp_fa0_2 = thisx->unk360;
-// Matrix_Scale(temp_fa0_2, temp_fa0_2, temp_fa0_2, MTXMODE_APPLY);
-// }
-// if ((limbIndex >= 4) && (limbIndex < 0x14)) {
-// temp_fa0_3 = thisx->unk364;
-// Matrix_Scale(temp_fa0_3, temp_fa0_3, temp_fa0_3, MTXMODE_APPLY);
-// }
-// }
-
-// s32 func_809F1404(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
-// if ((limbIndex >= 3) && (limbIndex < 9)) {
-// *dList = NULL;
-// }
-// return 0;
-// }
-
-// s32 func_809F1430(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
-// if ((limbIndex == 1) || (limbIndex == 2) || (limbIndex == 9)) {
-// *dList = NULL;
-// }
-// return 0;
-// }
-
-// void func_809F1464(PlayState *play, s32 limbIndex, Actor *thisx) {
-// f32 temp_fa0;
-
-// if ((limbIndex >= 3) && (limbIndex < 9)) {
-// temp_fa0 = thisx->unk198;
-// Matrix_Scale(temp_fa0, temp_fa0, temp_fa0, MTXMODE_APPLY);
-// }
-// }
-
-// s32 func_809F14AC(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) {
-// if (limbIndex != D_809F1CC0[thisx->params]) {
-// *dList = NULL;
-// } else if ((s32) thisx->unk15C >= 2) {
-// rot->x += thisx->unk160 * 0x3000;
-// rot->y += thisx->unk160 * 0x1A00;
-// rot->z += thisx->unk160 << 0xD;
-// }
-// return 0;
-// }
-
-// void func_809F1550(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, Actor *thisx) {
-// if (limbIndex != D_809F1CC0[thisx->params]) {
-// Matrix_MultZero(thisx + 0x324);
-// }
-// }
-
-// void Boss05_Draw(Actor *thisx, PlayState *play) {
-// GraphicsContext *sp34;
-// GraphicsContext *temp_a0;
-// s16 temp_v0;
-// Boss05 *this = (Boss05 *) thisx;
-
-// temp_a0 = play->state.gfxCtx;
-// sp34 = temp_a0;
-// func_8012C28C(temp_a0);
-// if (func_809EEDE8 == this->actionFunc) {
-// SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32) this->unk268.dListCount,
-// func_809F1050, func_809F1170, &this->dyna.actor); if (this->unk16C & 1) {
-// sp34->polyOpa.p = Gfx_SetFog(sp34->polyOpa.p, 0xFF, 0, 0, 0xFF, 0x384, 0x44B);
-// }
-// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
-// Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
-// Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
-// Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
-// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
-// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
-// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
-// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
-// } else {
-// temp_v0 = this->dyna.actor.params;
-// if (temp_v0 == 2) {
-// Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
-// this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->unk176, MTXMODE_APPLY);
-// Matrix_RotateXS(this->unk178, MTXMODE_APPLY);
-// Matrix_RotateYS((s16) (this->unk176 * -1), MTXMODE_APPLY);
-// Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
-// Matrix_RotateXS(this->dyna.actor.shape.rot.x, MTXMODE_APPLY);
-// Matrix_RotateZS(this->dyna.actor.shape.rot.z, MTXMODE_APPLY);
-// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z,
-// MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32)
-// this->unk268.dListCount, func_809F1404, NULL, &this->dyna.actor);
-// } else if (temp_v0 == 3) {
-// SkelAnime_DrawTransformFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, (s32)
-// this->unk268.dListCount, func_809F1430, func_809F1170, func_809F1464, &this->dyna.actor);
-// Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
-// Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
-// Matrix_RotateXS(this->unk330.x, MTXMODE_APPLY);
-// Matrix_RotateZS(this->unk330.z, MTXMODE_APPLY);
-// Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z,
-// MTXMODE_APPLY); AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
-// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
-// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
-// Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180,
-// this->unk184, (u8) (s32) this->unk189);
-// } else if (temp_v0 == 4) {
-// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
-// if (this->unk16C & 1) {
-// sp34->polyOpa.p = Gfx_SetFog(sp34->polyOpa.p, 0xFF, 0, 0, 0xFF, 0x384, 0x44B);
-// }
-// SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
-// this->unk3C8.dListCount, func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
-// Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180,
-// this->unk184, (u8) (s32) this->unk189);
-// } else if (temp_v0 >= 0xA) {
-// AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
-// SkelAnime_DrawFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, (s32)
-// this->unk3C8.dListCount, func_809F14AC, func_809F1550, &this->dyna.actor);
-// }
-// }
-// sp34->polyOpa.p = func_801660B8(play, sp34->polyOpa.p);
-// }
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.h b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
index 36cfd9a7b..4881b702d 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.h
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
@@ -17,7 +17,8 @@ typedef void (*Boss05ActionFunc)(struct Boss05*, PlayState*);
typedef struct Boss05 {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ u8 unk15C; /* inferred */
- /* 0x15D */ char pad15D[3]; /* maybe part of unk15C[4]? */
+ /* 0x15D */ char pad15D[1];
+ /* 0x15E */ s16 unk15E; /* inferred */
/* 0x160 */ s16 unk160; /* inferred */
/* 0x162 */ s16 unk162[3];
/* 0x168 */ s16 unk168; /* inferred */
@@ -25,7 +26,9 @@ typedef struct Boss05 {
/* 0x16C */ s16 unk16C; /* inferred */
/* 0x16E */ char pad16E[2];
/* 0x170 */ Boss05ActionFunc actionFunc;
- /* 0x174 */ char pad174[2]; // possibly this is a Vec3s
+ /* 0x174 */ u8 unk174; /* inferred */
+ /* 0x175 */ char pad175[1];
+ // /* 0x174 */ char pad174[2]; // possibly this is a Vec3s
/* 0x176 */ s16 unk176;
/* 0x178 */ s16 unk178;
/* 0x17A */ s16 unk17A; /* inferred */
From d2c48628444b32292804e5f88d31fcdc15f769de Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Tue, 20 Sep 2022 18:16:37 +0100
Subject: [PATCH 08/51] OK
Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 800 ++++----------------
1 file changed, 140 insertions(+), 660 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index 521149654..f4e4fc602 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -379,7 +379,8 @@ void func_809EEDD0(Boss05* this, PlayState* play) {
extern Vec3s D_809F1C60[];
extern Vec3s D_809F1C8C[];
-// Vec3s D_809F1C60[7] = {
+// In-function static doesn't seem to help
+// static Vec3s D_809F1C60[7] = {
// { 0x3200, 0, 0 },
// { -0x1E00, 0, 0 },
// { -0x1400, 0, 0 },
@@ -388,8 +389,7 @@ extern Vec3s D_809F1C8C[];
// { 0, 0, 0 },
// { 0, 0, 0 },
// };
-
-// Vec3s D_809F1C8C[7] = {
+// static Vec3s D_809F1C8C[7] = {
// { -0x3200, 0, 0 },
// { 0, 0, 0 },
// { 0x1E00, 0, 0 },
@@ -399,70 +399,11 @@ extern Vec3s D_809F1C8C[];
// { 0, 0, 0 },
// };
-// The big one
-// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809EEDE8.s")
-// struct _m2c_stack_func_809EEDE8 {
-// /* 0x000 */ char pad0[0x5C];
-// /* 0x05C */ s16 *sp5C;
-// /* 0x060 */ s16 *sp60;
-// /* 0x064 */ char pad64[8]; /* maybe part of sp60[3]? */
-// /* 0x06C */ Vec3s *sp6C;
-// /* 0x070 */ f32 sp70;
-// /* 0x074 */ s32 sp74;
-// /* 0x078 */ char pad78[8]; /* maybe part of sp74[3]? */
-// /* 0x080 */ f32 sp80;
-// /* 0x084 */ char pad84[0x10]; /* maybe part of sp80[5]? */
-// /* 0x094 */ Vec3f sp94;
-// /* 0x0A0 */ char padA0[4];
-// /* 0x0A4 */ f32 spA4;
-// /* 0x0A8 */ char padA8[0xC]; /* maybe part of spA4[4]? */
-// /* 0x0B4 */ s32 spB4;
-// /* 0x0B8 */ s32 spB8;
-// /* 0x0BC */ s32 spBC;
-// /* 0x0C0 */ s32 spC0;
-// /* 0x0C4 */ s32 spC4;
-// /* 0x0C8 */ s32 spC8;
-// /* 0x0CC */ s32 spCC;
-// /* 0x0D0 */ s32 spD0;
-// /* 0x0D4 */ s32 spD4;
-// /* 0x0D8 */ Vec3s spD8;
-// /* 0x0DE */ char padDE[0x25]; /* maybe part of spD8[7]? */
-// /* 0x103 */ u8 sp103;
-// /* 0x104 */ char pad104[4]; /* maybe part of sp103[5]? */
-// /* 0x108 */ Player *sp108;
-// /* 0x10C */ char pad10C[4];
-// }; /* size = 0x110 */
-
-// Vec3s D_809F1C60[7] = {
-// { 0x3200, 0, 0 },
-// { -0x1E00, 0, 0 },
-// { -0x1400, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// };
-// Vec3s D_809F1C8C[7] = {
-// { -0x3200, 0, 0 },
-// { 0, 0, 0 },
-// { 0x1E00, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// };
-
-extern Vec3s D_809F1C60[];
-extern Vec3s D_809F1C8C[];
-
-void func_809EEDE8(Boss05 *this, PlayState *play) {
- s32 pad;
-
- Player *sp108;
-
- s32 pad1;
-
- u8 sp103;
+void func_809EEDE8(Boss05* this, PlayState* play) {
+ s32 var_s3;
+ Player* sp108 = GET_PLAYER(play);
+ s32 var_v1;
+ u8 sp103 = 0;
Vec3s spD8[7];
s32 spD4;
s32 spD0;
@@ -473,76 +414,17 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
s32 spBC;
s32 spB8;
s32 spB4;
-
- s32 pad2;
-
+ s32 var_s6;
+ s32 var_s7;
+ s16 var_s5;
+ s16 var_s4;
f32 spA4;
- Vec3f sp94;
- // f32 sp80;
- // s32 sp74;
- // f32 sp70;
- // Vec3s *sp6C;
- // s16 *sp60;
- // s16 *sp5C;
- // ? *temp_t5;
- // ? temp_t2_2;
- // ? temp_t4;
- // ? temp_t5_4;
- // Boss05 *temp_v0_6;
- // Boss05 *temp_v0_7;
- // Player *temp_v1;
- // ActorContext *temp_s0_2;
- // CollisionCheckContext *temp_s0_3;
- // CollisionCheckContext *temp_s0_4;
- // SkelAnime *temp_s0;
- // Vec3s *var_s1;
- // f32 *temp_s1;
- // f32 temp_ft4;
f32 var_fv1;
- // s16 var_s4;
- // s16 var_s5;
- s16 var_s6;
- s16 var_s7;
- // s32 temp_lo;
- // s32 temp_v0_5;
- // s32 var_s0;
- s32 var_s0_2;
- s32 var_s0_3;
- s32 var_s3;
- // s32 var_s3_2;
+ Vec3f sp94;
s32 var_s4_2;
- s32 var_v1;
- // u8 temp_v0;
- // u8 temp_v0_2;
- // void *temp_t1;
- // void *temp_t1_2;
- // void *temp_t2;
- // void *temp_t2_3;
- // void *temp_t2_4;
- // void *temp_t3;
- // void *temp_t3_2;
- // void *temp_t5_2;
- // void *temp_t5_3;
- // void *temp_t6;
- // void *temp_t6_2;
- // void *temp_t7;
- // void *temp_t8;
- // void *temp_t8_2;
- // void *temp_t9;
- // void *temp_t9_2;
- // void *temp_t9_3;
- // Vec3s *temp_v0_3;
- // Vec3s *temp_v0_4;
-
-
- sp108 = GET_PLAYER(play);
- sp103 = 0;
- // var_s3 = 0;
- // temp_v0 = this->unk174;
this->dyna.actor.hintId = 8;
- // var_s0 = 0;
- // var_s1 = spD8;
+
if (this->unk174 == 0) {
spD4 = 0x3E8;
spD0 = 0x3E80;
@@ -578,17 +460,8 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
var_s6 = 1;
var_s7 = 0x1000;
} else {
- var_s6 = 0;
- var_s7 = 0;
- spB4 = 0;
- spB8 = 0;
- spBC = 0;
- spC0 = 0;
- spC4 = 0;
- spC8 = 0;
- spCC = 0;
- spD0 = 0;
- spD4 = 0;
+
+ spD4 = spD0 = spCC = spC8 = spC4 = spC0 = spBC = spB8 = spB4 = var_s6 = var_s7 = 0;
}
}
@@ -596,40 +469,46 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
if ((this->unk174 == 0) || (this->unk174 == 3)) {
if (var_s3 < 3) {
spD8[var_s3].y = 0;
- spD8[var_s3].x = (s32) (Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * spCC);
+ spD8[var_s3].x = (s32)(Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * spCC);
} else {
spD8[var_s3].x = 0;
- spD8[var_s3].y = (s32) (Math_SinS((this->unk160 * spC8) + (var_s3 * spC4)) * spC0);
+ spD8[var_s3].y = (s32)(Math_SinS((this->unk160 * spC8) + (var_s3 * spC4)) * spC0);
}
if ((var_s3 == 4) || (var_s3 == 6)) {
- spD8[var_s3].z = (s32) (2.0f * (Math_SinS((this->unk160 * spBC) + var_s3 * spB8) * spB4));
+ spD8[var_s3].z = (s32)(Math_SinS((this->unk160 * spBC) + (var_s3 * spB8)) * spB4 * 2.0f);
} else {
- spD8[var_s3].z = (s32) (Math_SinS((this->unk160 * spBC) + var_s3 * spB8) * spB4);
+ spD8[var_s3].z = (s32)(Math_SinS((this->unk160 * spBC) + (var_s3 * spB8)) * spB4);
}
- } else if (this->unk174 == 1) {
- var_s6 = 5;
- var_s7 = 0x1000;
- spD8[var_s3].x = D_809F1C60[var_s3].x;
- spD8[var_s3].y = D_809F1C60[var_s3].y;
- spD8[var_s3].z = D_809F1C60[var_s3].z;
- } else if (this->unk174 == 2) {
- var_s6 = 1;
- var_s7 = 0x2000;
- spD8[var_s3].x = D_809F1C8C[var_s3].x;
- spD8[var_s3].y = D_809F1C8C[var_s3].y;
- spD8[var_s3].z = D_809F1C8C[var_s3].z;
+ var_s4 = var_s6;
+ var_s5 = var_s7;
+ } else {
+ if (this->unk174 == 1) {
+ var_s6 = 5;
+ var_s7 = 0x1000;
+ spD8[var_s3].x = D_809F1C60[var_s3].x;
+ spD8[var_s3].y = D_809F1C60[var_s3].y;
+ spD8[var_s3].z = D_809F1C60[var_s3].z;
+ } else if (this->unk174 == 2) {
+ var_s6 = 1;
+ var_s7 = 0x2000;
+ spD8[var_s3].x = D_809F1C8C[var_s3].x;
+ spD8[var_s3].y = D_809F1C8C[var_s3].y;
+ spD8[var_s3].z = D_809F1C8C[var_s3].z;
+ }
+ var_s4 = var_s6;
+ var_s5 = var_s7;
}
Math_ApproachS(&this->unk19E[var_s3].x, spD8[var_s3].x, var_s6, var_s7);
Math_ApproachS(&this->unk19E[var_s3].y, spD8[var_s3].y, var_s6, var_s7);
Math_ApproachS(&this->unk19E[var_s3].z, spD8[var_s3].z, var_s6, var_s7);
-
}
+ // There is some scope for which of var_s4,var_s5 and var_s6,var_s7 are used here
spA4 = (sp108->actor.world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
if (spA4 < 0.0f) {
- Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s6, var_s7);
+ Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
}
SkelAnime_Update(&this->unk3C8);
@@ -638,93 +517,95 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
}
- switch (this->unk15C) { /* irregular */
- case 0:
- this->unk174 = 0;
- this->unk3C8.playSpeed = 1.0f;
- if (spA4 < 0.0f) {
- if (sp108->actor.speedXZ > 10.0f) {
- var_fv1 = 220.0f;
- } else {
- var_fv1 = 150.0f;
- }
- if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
- this->unk15C = 1;
- this->unk162[0] = 0xA;
- }
- this->unk15E = 0;
- // goto block_42;
- } else {
-
- sp103 = 1;
- if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
- this->unk15E++;
- if (this->unk15E > 0x1E) {
- this->unk15C = 0xA;
- this->unk162[0] = 0x1E;
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ switch (this->unk15C) { /* irregular */
+ case 0:
+ this->unk174 = 0;
+ this->unk3C8.playSpeed = 1.0f;
+ if (spA4 < 0.0f) {
+ if (sp108->actor.speedXZ > 10.0f) {
+ var_fv1 = 220.0f;
+ } else {
+ var_fv1 = 150.0f;
+ }
+ if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
+ this->unk15C = 1;
+ this->unk162[0] = 0xA;
}
- } else {
- // block_42:
this->unk15E = 0;
+ // goto block_42;
+ } else {
+
+ sp103 = 1;
+ if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
+ this->unk15E++;
+ if (this->unk15E > 0x1E) {
+ this->unk15C = 0xA;
+ this->unk162[0] = 0x1E;
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ }
+ } else {
+ // block_42:
+ this->unk15E = 0;
+ }
}
- }
- if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
- }
- break;
+ if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ break;
- case 10:
- if (!(this->unk160 & 1)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
- }
- this->unk19C = (this->unk162[0] & 1) << 9;
- this->unk174 = 3;
- this->unk3C8.playSpeed = 4.0f;
- Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
- Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
- if (this->unk162[0] == 0) {
- this->unk15E = 0;
- this->unk15C = 0;
- this->unk162[0] = 0x64;
- }
- if (this->unk162[0] == 0x1B) {
- Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
- sp94.y += 40.0f;
- EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 0x7D0);
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
- }
- break;
+ case 10:
+ if (!(this->unk160 & 1)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk174 = 3;
+ this->unk3C8.playSpeed = 4.0f;
+ Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
+ Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
+ if (this->unk162[0] == 0) {
+ this->unk15E = 0;
+ this->unk15C = 0;
+ this->unk162[0] = 0x64;
+ }
+ if (this->unk162[0] == 0x1B) {
+ Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
+ sp94.y += 40.0f;
+ EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 0x7D0);
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
+ }
+ break;
- case 1:
- if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
- this->unk3C8.playSpeed = 0.0f;
- }
- this->unk174 = 1;
- if (this->unk162[0] == 0) {
- this->unk15C = 2;
- this->unk162[0] = 0x14;
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
- }
- break;
+ case 1:
+ if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ this->unk3C8.playSpeed = 0.0f;
+ }
+ this->unk174 = 1;
+ if (this->unk162[0] == 0) {
+ this->unk15C = 2;
+ this->unk162[0] = 0x14;
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ }
+ break;
- case 2:
- if (!(this->unk160 & 1)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
- }
- this->unk19C = (this->unk162[0] & 1) << 9;
- this->unk3C8.playSpeed = 4.0f;
- Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
- this->unk174 = 2;
- if (this->unk162[0] == 0) {
- this->unk15C = 0;
- this->unk162[0] = 0x1E;
- }
- break;
+ case 2:
+ if (!(this->unk160 & 1)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ }
+ this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk3C8.playSpeed = 4.0f;
+ Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
+ this->unk174 = 2;
+ if (this->unk162[0] == 0) {
+ this->unk15C = 0;
+ this->unk162[0] = 0x1E;
+ }
+ break;
}
var_s4_2 = func_809EECBC(this, play);
if ((var_s4_2 != 0) || (this->unk168 == 1)) {
+ Boss05* temp_v0_6;
+
this->dyna.actor.params = 2;
this->actionFunc = func_809EF9BC;
this->dyna.actor.flags &= ~1;
@@ -733,43 +614,47 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
var_s4_2 = 0xA;
}
if (var_s4_2 >= 0xA) {
- Boss05 *temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, 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, this->dyna.actor.shape.rot.z, 3);
+ temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D,
+ 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, this->dyna.actor.shape.rot.z, 3);
if (temp_v0_6 != NULL) {
Player* temp_v1 = GET_PLAYER(play);
- if (&this->dyna.actor == temp_v1->targetActor) {
- temp_v1->targetActor = &temp_v0_6->dyna.actor;
+ if (temp_v1->unk_730 == &this->dyna.actor) {
+ temp_v1->unk_730 = &temp_v0_6->dyna.actor;
play->actorCtx.targetContext.arrowPointedActor = &temp_v0_6->dyna.actor;
play->actorCtx.targetContext.targetedActor = &temp_v0_6->dyna.actor;
}
- for (var_s0_2 = 0; var_s0_2 < 10; var_s0_2++) {
- temp_v0_6->unk268.jointTable[var_s0_2] = this->unk268.jointTable[var_s0_2];
+ for (var_s3 = 0; var_s3 < 10; var_s3++) {
+ temp_v0_6->unk268.jointTable[var_s3] = this->unk268.jointTable[var_s3];
}
- for (var_s0_2 = 0; var_s0_2 < 20; var_s0_2++) {
- temp_v0_6->unk3C8.jointTable[var_s0_2] = this->unk3C8.jointTable[var_s0_2];
+ for (var_s3 = 0; var_s3 < 20; var_s3++) {
+ temp_v0_6->unk3C8.jointTable[var_s3] = this->unk3C8.jointTable[var_s3];
}
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x381E);
if (var_s4_2 >= 0xB) {
temp_v0_6->unk188 = var_s4_2 - 0xA;
}
}
} else if (var_s4_2 == 2) {
for (var_s3 = 0; var_s3 < 2; var_s3++) {
- Boss05 *temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3 + 0xA);
+ temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
+ this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y,
+ this->unk330.z, var_s3 + 0xA);
if (temp_v0_6 != NULL) {
-
+
for (var_v1 = 0; var_v1 < 20; var_v1++) {
temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
}
- temp_v0_6->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
+ temp_v0_6->unk162[0] = (s32)(Rand_ZeroFloat(20.0f) + 20.0f);
}
}
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x381F);
}
-
}
if (sp103 == 0) {
@@ -780,411 +665,6 @@ void func_809EEDE8(Boss05 *this, PlayState *play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C8.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
}
-// void func_809EEDE8(Boss05 *this, PlayState *play) {
-// Player *sp108;
-// u8 sp103;
-// Vec3s spD8;
-// s32 spD4;
-// s32 spD0;
-// s32 spCC;
-// s32 spC8;
-// s32 spC4;
-// s32 spC0;
-// s32 spBC;
-// s32 spB8;
-// s32 spB4;
-// f32 spA4;
-// Vec3f sp94;
-// f32 sp80;
-// s32 sp74;
-// f32 sp70;
-// Vec3s *sp6C;
-// s16 *sp60;
-// s16 *sp5C;
-// // ? *temp_t5;
-// // ? temp_t2_2;
-// // ? temp_t4;
-// // ? temp_t5_4;
-// Boss05 *temp_v0_6;
-// Boss05 *temp_v0_7;
-// Player *temp_v1;
-// ActorContext *temp_s0_2;
-// // CollisionCheckContext *temp_s0_3;
-// // CollisionCheckContext *temp_s0_4;
-// SkelAnime *temp_s0;
-// Vec3s *var_s1;
-// // f32 *temp_s1;
-// f32 temp_ft4;
-// f32 var_fv1;
-// s16 var_s4;
-// s16 var_s5;
-// s16 var_s6;
-// s16 var_s7;
-// s32 temp_lo;
-// s32 temp_v0_5;
-// s32 var_s0;
-// s32 var_s0_2;
-// s32 var_s0_3;
-// s32 var_s3;
-// s32 var_s3_2;
-// s32 var_s4_2;
-// s32 var_v1;
-// u8 temp_v0;
-// u8 temp_v0_2;
-// // void *temp_t1;
-// // void *temp_t1_2;
-// // void *temp_t2;
-// // void *temp_t2_3;
-// // void *temp_t2_4;
-// // void *temp_t3;
-// // void *temp_t3_2;
-// // void *temp_t5_2;
-// // void *temp_t5_3;
-// // void *temp_t6;
-// // void *temp_t6_2;
-// // void *temp_t7;
-// // void *temp_t8;
-// // void *temp_t8_2;
-// // void *temp_t9;
-// // void *temp_t9_2;
-// // void *temp_t9_3;
-// Vec3s *temp_v0_3;
-// Vec3s *temp_v0_4;
-
-// sp103 = 0;
-// var_s3 = 0;
-// sp108 = GET_PLAYER(play);
-// temp_v0 = this->unk174;
-// this->dyna.actor.hintId = 8;
-// var_s0 = 0;
-// var_s1 = &spD8;
-// if (temp_v0 == 0) {
-// spD4 = 0x3E8;
-// spD0 = 0x3E80;
-// spCC = 0x7D0;
-// spC8 = 0x5DC;
-// spC4 = 0x1770;
-// spC0 = 0xBB8;
-// spBC = 0x514;
-// spB8 = 0x5208;
-// spB4 = 0xDAC;
-// var_s6 = 0xA;
-// var_s7 = 0x300;
-// if (this->unk16C != 0) {
-// spD4 = 0x1B58;
-// spCC = 0x1770;
-// spC0 = 0x1770;
-// spBC = 0x1C84;
-// spB4 = 0x1964;
-// var_s6 = 1;
-// var_s7 = 0x1000;
-// }
-// } else {
-// var_s7 = 0;
-// if (temp_v0 == 3) {
-// spD4 = 0x1B58;
-// spD0 = 0x3E80;
-// spCC = 0x1388;
-// spC8 = 0x5DC;
-// spC4 = 0x2328;
-// spC0 = 0x1388;
-// spBC = 0x1C84;
-// spB8 = 0x5208;
-// spB4 = 0x157C;
-// var_s6 = 1;
-// var_s7 = 0x1000;
-// } else {
-// var_s6 = 0;
-// spB4 = 0;
-// spB8 = 0;
-// spBC = 0;
-// spC0 = 0;
-// spC4 = 0;
-// spC8 = 0;
-// spCC = 0;
-// spD0 = 0;
-// spD4 = 0;
-// }
-// }
-// sp5C = &this->unk19E[0].z;
-// sp60 = &this->unk19E[0].y;
-// sp6C = this->unk19E;
-// do {
-// // temp_v0_2 = this->unk174;
-// if ((this->unk174 == 0) || (this->unk174 == 3)) {
-// temp_lo = var_s3 * spB8;
-// var_s5 = var_s7;
-// var_s4 = var_s6;
-// sp70 = (f32) spB4;
-// if (var_s3 < 3) {
-// var_s1->y = 0;
-// sp74 = temp_lo;
-// sp80 = (f32) spCC;
-// var_s1->x = (s32) (Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * sp80);
-// } else {
-// var_s1->x = 0;
-// sp74 = temp_lo;
-// sp80 = (f32) spC0;
-// var_s1->y = (s32) (Math_SinS((s16) ((this->unk160 * spC8) + (var_s3 * spC4))) * sp80);
-// }
-// if ((var_s3 == 4) || (var_s3 == 6)) {
-// var_s1->z = (s32) (2.0f * (Math_SinS((this->unk160 * spBC) + temp_lo) * sp70));
-// } else {
-// var_s1->z = (s32) (Math_SinS((this->unk160 * spBC) + temp_lo) * sp70);
-// }
-// } else {
-// if (this->unk174 == 1) {
-// temp_v0_3 = var_s0 + D_809F1C60;
-// var_s6 = 5;
-// var_s7 = 0x1000;
-// var_s1->x = temp_v0_3->x;
-// var_s1->y = temp_v0_3->y;
-// var_s1->z = temp_v0_3->z;
-// } else if (this->unk174 == 2) {
-// temp_v0_4 = var_s0 + D_809F1C8C;
-// var_s6 = 1;
-// var_s7 = 0x2000;
-// var_s1->x = temp_v0_4->x;
-// var_s1->y = temp_v0_4->y;
-// var_s1->z = temp_v0_4->z;
-// }
-// var_s5 = var_s7;
-// var_s4 = var_s6;
-// }
-// Math_ApproachS(&sp6C->x, var_s1->x, var_s4, var_s5);
-// Math_ApproachS(sp60, var_s1->y, var_s4, var_s5);
-// Math_ApproachS(sp5C, var_s1->z, var_s4, var_s5);
-// var_s3 += 1;
-// sp5C += 6;
-// sp60 += 6;
-// sp6C += 6;
-// var_s0 += 6;
-// var_s1 += 6;
-// } while (var_s3 < 7);
-
-
-// temp_ft4 = (sp108->actor.world.pos.y - this->dyna.actor.world.pos.y) + 10.0f;
-// spA4 = temp_ft4;
-// if (temp_ft4 < 0.0f) {
-// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
-// }
-// // temp_s0 = &this->unk3C8;
-// SkelAnime_Update(&this->unk3C8);
-// // temp_s1 = &this->unk35C;
-// Math_ApproachF(&this->unk35C, 1.0f, 0.1f, 0.1f);
-// if (this->unk15C != 0xA) {
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
-// }
-
-// switch (this->unk15C) { /* irregular */
-// case 0:
-// this->unk174 = 0;
-// this->unk3C8.playSpeed = 1.0f;
-// if (spA4 < 0.0f) {
-// if (sp108->actor.speedXZ > 10.0f) {
-// var_fv1 = 220.0f;
-// } else {
-// var_fv1 = 150.0f;
-// }
-// if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
-// this->unk15C = 1;
-// this->unk162[0] = 0xA;
-// }
-// goto block_42;
-// }
-// sp103 = 1;
-// if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
-// this->unk15E++;
-// if (this->unk15E >= 0x1F) {
-// this->unk15C = 0xA;
-// this->unk162[0] = 0x1E;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
-// }
-// } else {
-// block_42:
-// this->unk15E = 0;
-// }
-// if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// break;
-// case 10:
-// if (!(this->unk160 & 1)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// this->unk19C = (this->unk162[0] & 1) << 9;
-// this->unk174 = 3;
-// this->unk3C8.playSpeed = 4.0f;
-// Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
-// Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
-// if (this->unk162[0] == 0) {
-// this->unk162[0] = 0x64;
-// this->unk15E = 0;
-// this->unk15C = 0;
-// }
-// if (this->unk162[0] == 0x1B) {
-// Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
-// sp94.y += 40.0f;
-// EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, (s16) 1, (s16) 0x7D0);
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
-// }
-// break;
-// case 1:
-// if (Animation_OnFrame(temp_s0, this->unk4FC)) {
-// this->unk3C8.playSpeed = 0.0f;
-// }
-// this->unk174 = 1;
-// if (this->unk162[0] == 0) {
-// this->unk15C = 2;
-// this->unk162[0] = 0x14;
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
-// }
-// break;
-// case 2:
-// if (!(this->unk160 & 1)) {
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
-// }
-// this->unk19C = (this->unk162[0] & 1) << 9;
-// this->unk3C8.playSpeed = 4.0f;
-// Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
-// this->unk174 = 2;
-// if (this->unk162[0] == 0) {
-// this->unk15C = 0;
-// this->unk162[0] = 0x1E;
-// }
-// break;
-// }
-
-// temp_v0_5 = func_809EECBC(this, play);
-// var_s4_2 = temp_v0_5;
-// if ((temp_v0_5 != 0) || (this->unk168 == 1)) {
-// this->dyna.actor.params = 2;
-// this->actionFunc = func_809EF9BC;
-// this->dyna.actor.flags &= ~1;
-// temp_s0_2 = &play->actorCtx;
-// func_800BC154(play, temp_s0_2, &this->dyna.actor, 1);
-// if (this->unk168 != 0) {
-// var_s4_2 = 0xA;
-// }
-// if (var_s4_2 >= 0xA) {
-// temp_v0_6 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, 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, this->dyna.actor.shape.rot.z, 3);
-// if (temp_v0_6 != NULL) {
-// var_s0_2 = 0;
-// temp_v1 = GET_PLAYER(play);
-// if (&this->dyna.actor == temp_v1->targetActor) {
-// temp_v1->targetActor = temp_v0_6;
-// play->actorCtx.targetContext.arrowPointedActor = temp_v0_6;
-// play->actorCtx.targetContext.targetedActor = temp_v0_6;
-// }
-
-// // do {
-// // temp_t5 = this->unk268.jointTable + var_s0_2;
-// // temp_t4 = (unaligned s32) temp_t5->unk0;
-// // temp_t1 = temp_v0_6->unk288 + var_s0_2;
-// // var_s0_2 += 6;
-// // temp_t1->unk0 = (unaligned s32) temp_t4;
-// // temp_t1->unk4 = (u16) temp_t5->unk4;
-// // } while (var_s0_2 < 0x3C);
-
-// for (var_s0_2 = 0; var_s0_2 < 10; var_s0_2++) {
-// temp_v0_6->unk268.jointTable[var_s0_2] = this->unk268.jointTable[var_s0_2];
-// }
-
-// for (var_s0_3 = 0; var_s0_3 < 20; var_s0_3++) {
-// temp_v0_6->unk3C8.jointTable[var_s0_3] = this->unk3C8.jointTable[var_s0_3];
-// }
-
-// // var_s0_3 = 0;
-// // do {
-// // temp_t9 = this->unk3C8.jointTable + var_s0_3;
-// // temp_t7 = temp_v0_6->unk3E8 + var_s0_3;
-// // temp_t7->unk0 = (unaligned s32) temp_t9->unk0;
-// // temp_t7->unk4 = (u16) temp_t9->unk4;
-// // temp_t6 = this->unk3C8.jointTable + var_s0_3;
-// // temp_t3 = temp_v0_6->unk3E8 + var_s0_3;
-// // temp_t3->unk6 = (unaligned s32) temp_t6->unk6;
-// // temp_t3->unkA = (u16) temp_t6->unkA;
-// // temp_t5_2 = this->unk3C8.jointTable + var_s0_3;
-// // temp_t2 = temp_v0_6->unk3E8 + var_s0_3;
-// // temp_t2->unkC = (unaligned s32) temp_t5_2->unkC;
-// // temp_t2->unk10 = (u16) temp_t5_2->unk10;
-// // temp_t9_2 = this->unk3C8.jointTable + var_s0_3;
-// // temp_t2_2 = (unaligned s32) temp_t9_2->unk12;
-// // temp_t8 = temp_v0_6->unk3E8 + var_s0_3;
-// // var_s0_3 += 0x18;
-// // temp_t8->unk12 = (unaligned s32) temp_t2_2;
-// // temp_t8->unk16 = (u16) temp_t9_2->unk16;
-// // } while (var_s0_3 != 0x78);
-
-
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381EU);
-// if (var_s4_2 >= 0xB) {
-// temp_v0_6->unk188 = (s8) (var_s4_2 - 0xA);
-// }
-// }
-// } else {
-// var_s3_2 = 0;
-// if (var_s4_2 == 2) {
-// for (var_s3_2 = 0; var_s3_2 < 2; var_s3_2++) {
-// temp_v0_7 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3_2 + 0xA);
-// if (temp_v0_7 != NULL) {
-
-// for (var_v1 = 0; var_v1 < 20; var_v1++) {
-// temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
-// }
-
-// temp_v0_7->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
-// }
-// }
-// // do {
-// // temp_v0_7 = (Boss05*)Actor_SpawnAsChild(temp_s0_2, &this->dyna.actor, play, 0x12D, this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y, this->unk330.z, var_s3_2 + 0xA);
-// // if (temp_v0_7 != NULL) {
-
-// // for (var_v1 = 0; var_v1 < 20; var_v1++) {
-// // temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
-// // }
-
-// // // var_v1 = 0;
-// // // do {
-// // // temp_t2_3 = this->unk3C8.jointTable + var_v1;
-// // // temp_t9_3 = temp_v0_7->unk3E8 + var_v1;
-// // // temp_t9_3->unk0 = (unaligned s32) temp_t2_3->unk0;
-// // // temp_t9_3->unk4 = (u16) temp_t2_3->unk4;
-// // // temp_t8_2 = this->unk3C8.jointTable + var_v1;
-// // // temp_t6_2 = temp_v0_7->unk3E8 + var_v1;
-// // // temp_t6_2->unk6 = (unaligned s32) temp_t8_2->unk6;
-// // // temp_t6_2->unkA = (u16) temp_t8_2->unkA;
-// // // temp_t3_2 = this->unk3C8.jointTable + var_v1;
-// // // temp_t5_3 = temp_v0_7->unk3E8 + var_v1;
-// // // temp_t5_3->unkC = (unaligned s32) temp_t3_2->unkC;
-// // // temp_t5_3->unk10 = (u16) temp_t3_2->unk10;
-// // // temp_t2_4 = this->unk3C8.jointTable + var_v1;
-// // // temp_t5_4 = (unaligned s32) temp_t2_4->unk12;
-// // // temp_t1_2 = temp_v0_7->unk3E8 + var_v1;
-// // // var_v1 += 0x18;
-// // // temp_t1_2->unk12 = (unaligned s32) temp_t5_4;
-// // // temp_t1_2->unk16 = (u16) temp_t2_4->unk16;
-// // // } while (var_v1 != 0x78);
-
-// // temp_v0_7->unk162[0] = (s32) (Rand_ZeroFloat(20.0f) + 20.0f);
-// // }
-// // var_s3_2 += 1;
-// // } while (var_s3_2 != 2);
-
-// Actor_PlaySfxAtPos(&this->dyna.actor, 0x381FU);
-// }
-// }
-// }
-
-// if (sp103 == 0) {
-// CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1C8.base);
-// CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
-// }
-
-// CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C8.base);
-// CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
-// }
-
void func_809EF9BC(Boss05* this, PlayState* play) {
Player* player = GET_PLAYER(play);
@@ -1262,10 +742,10 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
if (temp_v0 != NULL) {
player = GET_PLAYER(play);
- if (&this->dyna.actor == player->unk_730) {
- player->unk_730 = temp_v0;
- play->actorCtx.targetContext.arrowPointedActor = temp_v0;
- play->actorCtx.targetContext.targetedActor = temp_v0;
+ if (player->unk_730 == &this->dyna.actor) {
+ player->unk_730 = &temp_v0->dyna.actor;
+ play->actorCtx.targetContext.arrowPointedActor = &temp_v0->dyna.actor;
+ play->actorCtx.targetContext.targetedActor = &temp_v0->dyna.actor;
}
for (i = 0; i < 20; i++) {
From 41841abc9a3d676fac42bb2664457a2e82e406fa Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Tue, 20 Sep 2022 20:55:56 +0100
Subject: [PATCH 09/51] Data/bss in, extract colheader
---
assets/xml/overlays/ovl_Boss_05.xml | 5 +
spec | 2 -
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 381 ++++++--------------
3 files changed, 121 insertions(+), 267 deletions(-)
create mode 100644 assets/xml/overlays/ovl_Boss_05.xml
diff --git a/assets/xml/overlays/ovl_Boss_05.xml b/assets/xml/overlays/ovl_Boss_05.xml
new file mode 100644
index 000000000..8eef13a4e
--- /dev/null
+++ b/assets/xml/overlays/ovl_Boss_05.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/spec b/spec
index cc7babd85..3dfcaf5c5 100644
--- a/spec
+++ b/spec
@@ -2399,8 +2399,6 @@ beginseg
name "ovl_Boss_05"
compress
include "build/src/overlays/actors/ovl_Boss_05/z_boss_05.o"
- include "build/data/ovl_Boss_05/ovl_Boss_05.data.o"
- include "build/data/ovl_Boss_05/ovl_Boss_05.bss.o"
include "build/data/ovl_Boss_05/ovl_Boss_05.reloc.o"
endseg
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index f4e4fc602..cd08e6b80 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -38,55 +38,116 @@ void func_809F0A64(Boss05* this, PlayState* play);
void func_809F0ABC(Boss05* this, PlayState* play);
void func_809F0B0C(Boss05* this, PlayState* play);
-#if 0
+#include "overlays/ovl_Boss_05/ovl_Boss_05.c"
+
+// #if 0
// static ColliderJntSphElementInit sJntSphElementsInit[2] = {
-static ColliderJntSphElementInit D_809F1B2C[2] = {
+ColliderJntSphElementInit D_809F1B2C[2] = {
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 15 }, 100 },
},
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 15 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_809F1B74 = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809F1B2C, // sJntSphElementsInit,
+ColliderJntSphInit D_809F1B74 = {
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809F1B2C),
+ D_809F1B2C, // sJntSphElementsInit,
};
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
-static ColliderJntSphElementInit D_809F1B84[1] = {
+ColliderJntSphElementInit D_809F1B84[1] = {
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 20 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_809F1BA8 = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809F1B84, // sJntSphElementsInit,
+ColliderJntSphInit D_809F1BA8 = {
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809F1B84),
+ D_809F1B84, // sJntSphElementsInit,
};
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
-static ColliderJntSphElementInit D_809F1BB8[1] = {
+ColliderJntSphElementInit D_809F1BB8[1] = {
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7FFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7FFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 15 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_809F1BDC = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809F1BB8, // sJntSphElementsInit,
+ColliderJntSphInit D_809F1BDC = {
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809F1BB8),
+ D_809F1BB8, // sJntSphElementsInit,
};
+// extern Color_RGBA8 D_809F1BEC;
+// extern Color_RGBA8 D_809F1BF0;
+// extern Vec3f D_809F1BF4;
+Color_RGBA8 D_809F1BEC = { 170, 255, 255, 255 };
+Color_RGBA8 D_809F1BF0 = { 200, 200, 255, 255 };
+Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
+
// static DamageTable sDamageTable = {
-static DamageTable D_809F1C00 = {
+DamageTable D_809F1C00 = {
/* Deku Nut */ DMG_ENTRY(0, 0x0),
/* Deku Stick */ DMG_ENTRY(1, 0xF),
/* Horse trample */ DMG_ENTRY(0, 0x0),
@@ -122,7 +183,7 @@ static DamageTable D_809F1C00 = {
};
// static DamageTable sDamageTable = {
-static DamageTable D_809F1C20 = {
+DamageTable D_809F1C20 = {
/* Deku Nut */ DMG_ENTRY(0, 0x1),
/* Deku Stick */ DMG_ENTRY(3, 0xF),
/* Horse trample */ DMG_ENTRY(0, 0x0),
@@ -169,17 +230,17 @@ const ActorInit Boss_05_InitVars = {
(ActorFunc)Boss05_Draw,
};
-#endif
+// #endif
-extern CollisionHeader D_809F1B00;
-extern ColliderJntSphElementInit D_809F1B2C[2];
-extern ColliderJntSphInit D_809F1B74;
-extern ColliderJntSphElementInit D_809F1B84[1];
-extern ColliderJntSphInit D_809F1BA8;
-extern ColliderJntSphElementInit D_809F1BB8[1];
-extern ColliderJntSphInit D_809F1BDC;
-extern DamageTable D_809F1C00;
-extern DamageTable D_809F1C20;
+// extern CollisionHeader D_809F1B00;
+// extern ColliderJntSphElementInit D_809F1B2C[2];
+// extern ColliderJntSphInit D_809F1B74;
+// extern ColliderJntSphElementInit D_809F1B84[1];
+// extern ColliderJntSphInit D_809F1BA8;
+// extern ColliderJntSphElementInit D_809F1BB8[1];
+// extern ColliderJntSphInit D_809F1BDC;
+// extern DamageTable D_809F1C00;
+// extern DamageTable D_809F1C20;
extern AnimationHeader D_060006A4;
extern AnimationHeader D_06000A5C;
@@ -194,13 +255,6 @@ extern AnimationHeader D_06006E50;
extern AnimationHeader D_06007488;
extern AnimationHeader D_06007908;
-extern Color_RGBA8 D_809F1BEC;
-extern Color_RGBA8 D_809F1BF0;
-extern Vec3f D_809F1BF4;
-// static Color_RGBA8 D_809F1BEC = { 0xAA, 0xFF, 0xFF, 0xFF };
-// static Color_RGBA8 D_809F1BF0 = { 0xC8, 0xC8, 0xFF, 0xFF };
-// static Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
-
void func_809EE4E0(Boss05* this, PlayState* play) {
Vec3f sp8C;
Vec3f sp80;
@@ -252,7 +306,7 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
DynaPolyActor_Init(&this->dyna, 0);
- CollisionHeader_GetVirtual(&D_809F1B00, &colHeader);
+ CollisionHeader_GetVirtual(&sBioBabaLilypadCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
func_809EEDD0(this, play);
@@ -272,7 +326,7 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
} else if (this->dyna.actor.params == 2) {
this->actionFunc = func_809EF9BC;
- CollisionHeader_GetVirtual(&D_809F1B00, &colHeader);
+ CollisionHeader_GetVirtual(&sBioBabaLilypadCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
@@ -377,27 +431,14 @@ void func_809EEDD0(Boss05* this, PlayState* play) {
this->actionFunc = func_809EEDE8;
}
-extern Vec3s D_809F1C60[];
-extern Vec3s D_809F1C8C[];
-// In-function static doesn't seem to help
-// static Vec3s D_809F1C60[7] = {
-// { 0x3200, 0, 0 },
-// { -0x1E00, 0, 0 },
-// { -0x1400, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// };
-// static Vec3s D_809F1C8C[7] = {
-// { -0x3200, 0, 0 },
-// { 0, 0, 0 },
-// { 0x1E00, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// { 0, 0, 0 },
-// };
+// extern Vec3s D_809F1C60[];
+// extern Vec3s D_809F1C8C[];
+Vec3s D_809F1C60[7] = {
+ { 0x3200, 0, 0 }, { -0x1E00, 0, 0 }, { -0x1400, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
+};
+Vec3s D_809F1C8C[7] = {
+ { -0x3200, 0, 0 }, { 0, 0, 0 }, { 0x1E00, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
+};
void func_809EEDE8(Boss05* this, PlayState* play) {
s32 var_s3;
@@ -1178,7 +1219,10 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
}
}
-extern u8 D_809F1CB8[];
+// extern s8 D_809F1CB8[];
+s8 D_809F1CB8[] = {
+ -1, -1, 0, 1, 2, 3, 4, 5, 6, -1, -1, 0,
+};
s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
@@ -1211,7 +1255,8 @@ s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
return false;
}
-extern Vec3f D_809F1CC4;
+// extern Vec3f D_809F1CC4;
+Vec3f D_809F1CC4 = { 0.0f, -1400.0f, 600.0f };
void func_809F1170(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
@@ -1250,9 +1295,12 @@ s32 func_809F1284(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
return false;
}
-extern Vec3f D_809F1CD0;
-extern Vec3f D_809F1CDC;
-extern Vec3f D_809F2110; // bss
+// extern Vec3f D_809F1CD0;
+Vec3f D_809F1CD0 = { 1600.0f, -300.0f, 0.0f };
+// extern Vec3f D_809F1CDC;
+Vec3f D_809F1CDC = { 700.0f, 0.0f, 0.0f };
+// extern Vec3f D_809F2110; // bss
+Vec3f D_809F2110; // bss
void func_809F12A0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
@@ -1312,7 +1360,10 @@ void func_809F1464(PlayState* play, s32 limbIndex, Actor* thisx) {
}
}
-extern s32 D_809F1CE8[];
+// extern s32 D_809F1CE8[];
+s32 D_809F1CE8[] = {
+ 2, 3, 1, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19,
+};
s32 func_809F14AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
@@ -1414,203 +1465,3 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
-
-// typedef struct Boss05 {
-// /* 0x000 */ DynaPolyActor dyna;
-// /* 0x15C */ u8 unk15C;
-// /* 0x15D */ char pad15D[1];
-// /* 0x15E */ s16 unk15E; /* inferred */
-// /* 0x160 */ s16 unk160;
-// /* 0x162 */ s16 unk162[3];
-// /* 0x168 */ s16 unk168;
-// /* 0x16A */ s16 unk16A;
-// /* 0x16C */ s16 unk16C;
-// /* 0x16E */ char pad16E[2];
-// /* 0x170 */ void (*actionFunc)(Boss05 *, PlayState *);
-// /* 0x174 */ u8 unk174; /* inferred */
-// /* 0x175 */ char pad175[1];
-// /* 0x176 */ s16 unk176;
-// /* 0x178 */ s16 unk178;
-// /* 0x17A */ s16 unk17A;
-// /* 0x17C */ f32 unk17C;
-// /* 0x180 */ f32 unk180;
-// /* 0x184 */ f32 unk184;
-// /* 0x188 */ u8 unk188;
-// /* 0x189 */ u8 unk189;
-// /* 0x18A */ char pad18A[2]; /* maybe part of unk189[3]? */
-// /* 0x18C */ Vec3f unk18C;
-// /* 0x198 */ f32 unk198;
-// /* 0x19C */ s16 unk19C; /* inferred */
-// /* 0x19E */ s16 unk19E; /* inferred */
-// /* 0x1A0 */ s16 unk1A0; /* inferred */
-// /* 0x1A2 */ s16 unk1A2; /* inferred */
-// /* 0x1A4 */ char pad1A4[0x24]; /* maybe part of unk1A2[0x13]? */
-// /* 0x1C8 */ ColliderJntSph unk1C8;
-// /* 0x1E8 */ ColliderJntSphElement unk1E8[2];
-// /* 0x268 */ SkelAnime unk268;
-// /* 0x2AC */ Vec3s unk2AC[0xA];
-// /* 0x2E8 */ Vec3s unk2E8[0xA];
-// /* 0x324 */ Vec3f unk324;
-// /* 0x330 */ Vec3s unk330;
-// /* 0x336 */ s8 unk336[2];
-// /* 0x338 */ f32 unk338;
-// /* 0x33C */ Vec3f unk33C;
-// /* 0x348 */ s16 unk348;
-// /* 0x34A */ s8 unk34A[2];
-// /* 0x34C */ f32 unk34C;
-// /* 0x350 */ s8 unk350[4];
-// /* 0x354 */ f32 unk354;
-// /* 0x358 */ f32 unk358;
-// /* 0x35C */ f32 unk35C;
-// /* 0x360 */ f32 unk360;
-// /* 0x364 */ f32 unk364;
-// /* 0x368 */ ColliderJntSph unk368;
-// /* 0x388 */ ColliderJntSphElement unk388[1];
-// /* 0x3C8 */ SkelAnime unk3C8;
-// /* 0x40C */ Vec3s unk40C[0x14];
-// /* 0x484 */ Vec3s unk484[0x14];
-// /* 0x4FC */ f32 unk4FC;
-// /* 0x500 */ s16 unk500;
-// /* 0x502 */ s16 unk502;
-// /* 0x504 */ char pad504[4]; /* maybe part of unk502[3]? */
-// } Boss05; /* size = 0x508 */
-
-// static BgCamInfo D_809F1A20 = { 0, 0, NULL };
-// static SurfaceType D_809F1A28 = { { 0x10000, 0x7C8 } };
-// static CollisionPoly D_809F1A30[0xA]; /* unable to generate initializer */
-// static Vec3s D_809F1AD0[8] = {
-// { -0xDAC, 0, -0xDAC },
-// { -0xDAC, 0, 0xDAC },
-// { 0xDAC, 0, 0xDAC },
-// { 0xDAC, 0, -0xDAC },
-// { 0xDAC, -0xFA0, -0xDAC },
-// { -0xDAC, -0xFA0, -0xDAC },
-// { 0xDAC, -0xFA0, 0xDAC },
-// { -0xDAC, -0xFA0, 0xDAC },
-// };
-// static ? D_809F1C60; /* unable to generate initializer */
-// static ? D_809F1C8C; /* unable to generate initializer */
-// static ? D_809F1CB8; /* unable to generate initializer */
-// static s32 D_809F1CC0[1] = { 0x06FFFF00 };
-// static Vec3f D_809F1CC4 = { 0.0f, -1400.0f, 600.0f };
-// static Vec3f D_809F1CD0 = { 1600.0f, -300.0f, 0.0f };
-// static Vec3f D_809F1CDC[5] = {
-// { 700.0f, 0.0f, 0.0f },
-// { 3e-45.0f, 4e-45.0f, 1e-45.0f },
-// { 6e-45.0f, 7e-45.0f, 1e-44.0f },
-// { 1.1e-44f, 1.4e-44f, 1.5e-44f },
-// { 1.8e-44f, 2e-44.0f, 2.2e-44f },
-// }; /* extra bytes: 8 */
-// static Vec3f D_809F2110;
-// CollisionHeader D_809F1B00 = {
-// { -0xDAC, -0xFA0, -0xDAC },
-// { 0xDAC, 0, 0xDAC },
-// 8,
-// D_809F1AD0,
-// 0xA,
-// D_809F1A30,
-// &D_809F1A28,
-// &D_809F1A20,
-// 0,
-// NULL,
-// };
-// ColliderJntSphElementInit D_809F1B2C[2] = {
-// {
-// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
-// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
-// },
-// {
-// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
-// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
-// },
-// };
-// ColliderJntSphInit D_809F1B74 = { { 3, 0x11, 9, 9, 0x10, 0 }, 2, D_809F1B2C };
-// ColliderJntSphElementInit D_809F1B84[1] = {
-// {
-// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7CFFFFF, 0, 0 }, 9, 1, 1 },
-// { 0, { { 0, 0, 0 }, 0x14 }, 0x64 },
-// },
-// };
-// ColliderJntSphInit D_809F1BA8 = { { 3, 0x11, 9, 9, 0x10, 0 }, 1, D_809F1B84 };
-// ColliderJntSphElementInit D_809F1BB8[1] = {
-// {
-// { 3, { 0xF7CFFFFF, 0, 8 }, { 0xF7FFFFFF, 0, 0 }, 9, 1, 1 },
-// { 0, { { 0, 0, 0 }, 0xF }, 0x64 },
-// },
-// };
-// ColliderJntSphInit D_809F1BDC = { { 3, 0x11, 9, 9, 0x10, 0 }, 1, D_809F1BB8 };
-// Color_RGBA8 D_809F1BEC = { 0xAA, 0xFF, 0xFF, 0xFF };
-// Color_RGBA8 D_809F1BF0 = { 0xC8, 0xC8, 0xFF, 0xFF };
-// Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
-// DamageTable D_809F1C00 = {
-// {
-// 0,
-// 0xF1,
-// 0,
-// 0xF1,
-// 0xF1,
-// 0xF3,
-// 0,
-// 3,
-// 0xF2,
-// 0xE1,
-// 0xF1,
-// 0x21,
-// 0x31,
-// 0x43,
-// 0xF1,
-// 0xF1,
-// 0xF3,
-// 0xF2,
-// 0,
-// 0xF1,
-// 0,
-// 0,
-// 0xF1,
-// 0xF1,
-// 0xF1,
-// 0,
-// 0,
-// 0,
-// 0,
-// 0,
-// 0,
-// 0xF1,
-// },
-// };
-// DamageTable D_809F1C20 = {
-// {
-// 0x10,
-// 0xF3,
-// 0,
-// 0xF1,
-// 0xF1,
-// 0xF1,
-// 0,
-// 0x10,
-// 0xF1,
-// 0xF1,
-// 0xF1,
-// 0x22,
-// 0x32,
-// 0x42,
-// 0xF1,
-// 0x10,
-// 0xF1,
-// 0xF2,
-// 0x10,
-// 0xF1,
-// 0,
-// 0,
-// 0xF1,
-// 0xF1,
-// 0xF1,
-// 0,
-// 0,
-// 0x21,
-// 0,
-// 0,
-// 0,
-// 0xF1,
-// },
-// };
From 03b849214c525e85a30296062cb6698fef31c93f Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Tue, 20 Sep 2022 21:17:35 +0100
Subject: [PATCH 10/51] Clean up externs
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 33 ++-------------------
1 file changed, 3 insertions(+), 30 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index cd08e6b80..26b63a1b1 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -40,7 +40,6 @@ void func_809F0B0C(Boss05* this, PlayState* play);
#include "overlays/ovl_Boss_05/ovl_Boss_05.c"
-// #if 0
// static ColliderJntSphElementInit sJntSphElementsInit[2] = {
ColliderJntSphElementInit D_809F1B2C[2] = {
{
@@ -139,9 +138,6 @@ ColliderJntSphInit D_809F1BDC = {
D_809F1BB8, // sJntSphElementsInit,
};
-// extern Color_RGBA8 D_809F1BEC;
-// extern Color_RGBA8 D_809F1BF0;
-// extern Vec3f D_809F1BF4;
Color_RGBA8 D_809F1BEC = { 170, 255, 255, 255 };
Color_RGBA8 D_809F1BF0 = { 200, 200, 255, 255 };
Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
@@ -230,18 +226,6 @@ const ActorInit Boss_05_InitVars = {
(ActorFunc)Boss05_Draw,
};
-// #endif
-
-// extern CollisionHeader D_809F1B00;
-// extern ColliderJntSphElementInit D_809F1B2C[2];
-// extern ColliderJntSphInit D_809F1B74;
-// extern ColliderJntSphElementInit D_809F1B84[1];
-// extern ColliderJntSphInit D_809F1BA8;
-// extern ColliderJntSphElementInit D_809F1BB8[1];
-// extern ColliderJntSphInit D_809F1BDC;
-// extern DamageTable D_809F1C00;
-// extern DamageTable D_809F1C20;
-
extern AnimationHeader D_060006A4;
extern AnimationHeader D_06000A5C;
extern AnimationHeader D_06000ABC;
@@ -431,8 +415,6 @@ void func_809EEDD0(Boss05* this, PlayState* play) {
this->actionFunc = func_809EEDE8;
}
-// extern Vec3s D_809F1C60[];
-// extern Vec3s D_809F1C8C[];
Vec3s D_809F1C60[7] = {
{ 0x3200, 0, 0 }, { -0x1E00, 0, 0 }, { -0x1400, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
};
@@ -1219,10 +1201,7 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
}
}
-// extern s8 D_809F1CB8[];
-s8 D_809F1CB8[] = {
- -1, -1, 0, 1, 2, 3, 4, 5, 6, -1, -1, 0,
-};
+s8 D_809F1CB8[] = { -1, -1, 0, 1, 2, 3, 4, 5, 6, -1, -1, 0 };
s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
@@ -1255,7 +1234,6 @@ s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
return false;
}
-// extern Vec3f D_809F1CC4;
Vec3f D_809F1CC4 = { 0.0f, -1400.0f, 600.0f };
void func_809F1170(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
@@ -1295,11 +1273,9 @@ s32 func_809F1284(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
return false;
}
-// extern Vec3f D_809F1CD0;
Vec3f D_809F1CD0 = { 1600.0f, -300.0f, 0.0f };
-// extern Vec3f D_809F1CDC;
Vec3f D_809F1CDC = { 700.0f, 0.0f, 0.0f };
-// extern Vec3f D_809F2110; // bss
+
Vec3f D_809F2110; // bss
void func_809F12A0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
@@ -1360,10 +1336,7 @@ void func_809F1464(PlayState* play, s32 limbIndex, Actor* thisx) {
}
}
-// extern s32 D_809F1CE8[];
-s32 D_809F1CE8[] = {
- 2, 3, 1, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19,
-};
+s32 D_809F1CE8[] = { 2, 3, 1, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19 };
s32 func_809F14AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
From 592e8d4d6d62f6c875608489d552d7182815a3c3 Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Wed, 21 Sep 2022 05:03:28 +0100
Subject: [PATCH 11/51] Better match for func_809EECBC
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 213 ++++++++++----------
1 file changed, 103 insertions(+), 110 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index 26b63a1b1..b3a30cd37 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -144,38 +144,38 @@ Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
// static DamageTable sDamageTable = {
DamageTable D_809F1C00 = {
- /* Deku Nut */ DMG_ENTRY(0, 0x0),
- /* Deku Stick */ DMG_ENTRY(1, 0xF),
- /* Horse trample */ DMG_ENTRY(0, 0x0),
- /* Explosives */ DMG_ENTRY(1, 0xF),
- /* Zora boomerang */ DMG_ENTRY(1, 0xF),
- /* Normal arrow */ DMG_ENTRY(3, 0xF),
- /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
- /* Hookshot */ DMG_ENTRY(3, 0x0),
- /* Goron punch */ DMG_ENTRY(2, 0xF),
- /* Sword */ DMG_ENTRY(1, 0xE),
- /* Goron pound */ DMG_ENTRY(1, 0xF),
- /* Fire arrow */ DMG_ENTRY(1, 0x2),
- /* Ice arrow */ DMG_ENTRY(1, 0x3),
- /* Light arrow */ DMG_ENTRY(3, 0x4),
- /* Goron spikes */ DMG_ENTRY(1, 0xF),
- /* Deku spin */ DMG_ENTRY(1, 0xF),
- /* Deku bubble */ DMG_ENTRY(3, 0xF),
- /* Deku launch */ DMG_ENTRY(2, 0xF),
- /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
- /* Zora barrier */ DMG_ENTRY(1, 0xF),
- /* Normal shield */ DMG_ENTRY(0, 0x0),
- /* Light ray */ DMG_ENTRY(0, 0x0),
- /* Thrown object */ DMG_ENTRY(1, 0xF),
- /* Zora punch */ DMG_ENTRY(1, 0xF),
- /* Spin attack */ DMG_ENTRY(1, 0xF),
- /* Sword beam */ DMG_ENTRY(0, 0x0),
- /* Normal Roll */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
- /* Unblockable */ DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
- /* Powder Keg */ DMG_ENTRY(1, 0xF),
+ /* Deku Nut */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x1), //
+ /* Deku Stick */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(3, 0xF), //
+ /* Horse trample */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Explosives */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Zora boomerang */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Normal arrow */ DMG_ENTRY(3, 0xF), // DMG_ENTRY(1, 0xF), //
+ /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Hookshot */ DMG_ENTRY(3, 0x0), // DMG_ENTRY(0, 0x1), //
+ /* Goron punch */ DMG_ENTRY(2, 0xF), // DMG_ENTRY(1, 0xF), //
+ /* Sword */ DMG_ENTRY(1, 0xE), // DMG_ENTRY(1, 0xF), //
+ /* Goron pound */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Fire arrow */ DMG_ENTRY(1, 0x2), // DMG_ENTRY(2, 0x2), //
+ /* Ice arrow */ DMG_ENTRY(1, 0x3), // DMG_ENTRY(2, 0x3), //
+ /* Light arrow */ DMG_ENTRY(3, 0x4), // DMG_ENTRY(2, 0x4), //
+ /* Goron spikes */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Deku spin */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(0, 0x1),
+ /* Deku bubble */ DMG_ENTRY(3, 0xF), // DMG_ENTRY(1, 0xF), //
+ /* Deku launch */ DMG_ENTRY(2, 0xF), // DMG_ENTRY(2, 0xF),
+ /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x1), //
+ /* Zora barrier */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Normal shield */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Light ray */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Thrown object */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Zora punch */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Spin attack */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Sword beam */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Normal Roll */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(1, 0x2), //
+ /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Unblockable */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
+ /* Powder Keg */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
};
// static DamageTable sDamageTable = {
@@ -321,7 +321,7 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
this->unk198 = 1.0f;
SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
- SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 0x14);
+ SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
this->unk4FC = Animation_GetLastFrame(&D_06006484);
Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
@@ -367,13 +367,10 @@ void Boss05_Destroy(Actor* thisx, PlayState* play) {
s32 func_809EECBC(Boss05* this, PlayState* play) {
if (this->unk16C == 0) {
- s32 var_v0 = 0;
- ColliderJntSphElement* var_v1 = &this->unk1C8.elements[0];
+ s32 i = 0;
while (true) {
- var_v0 += 0x40;
-
- if (var_v1->info.bumperFlags & BUMP_HIT) {
+ if (this->unk1C8.elements[i].info.bumperFlags & 2) {
switch (this->dyna.actor.colChkInfo.damageEffect) {
case 2:
return 11;
@@ -385,17 +382,17 @@ s32 func_809EECBC(Boss05* this, PlayState* play) {
return 10;
}
}
- var_v1++;
- if (var_v0 == 0x80) {
- if (this->unk368.elements[0].info.bumperFlags & BUMP_HIT) {
+ i++;
+ if (i == 2) {
+ if (this->unk368.elements[0].info.bumperFlags & 2) {
u8 damage = this->dyna.actor.colChkInfo.damage;
this->dyna.actor.colChkInfo.health -= damage;
if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
Enemy_StartFinishingBlow(play, &this->dyna.actor);
return 2;
} else {
- Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
+ Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
this->unk16C = 15;
this->unk15C = 0;
this->unk162[0] = 30;
@@ -423,9 +420,9 @@ Vec3s D_809F1C8C[7] = {
};
void func_809EEDE8(Boss05* this, PlayState* play) {
- s32 var_s3;
+ s32 i;
Player* sp108 = GET_PLAYER(play);
- s32 var_v1;
+ s32 j;
u8 sp103 = 0;
Vec3s spD8[7];
s32 spD4;
@@ -446,7 +443,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
Vec3f sp94;
s32 var_s4_2;
- this->dyna.actor.hintId = 8;
+ this->dyna.actor.hintId = TATL_HINT_ID_BIO_DEKU_BABA;
if (this->unk174 == 0) {
spD4 = 0x3E8;
@@ -460,6 +457,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
spB4 = 0xDAC;
var_s6 = 0xA;
var_s7 = 0x300;
+
if (this->unk16C != 0) {
spD4 = 0x1B58;
spCC = 0x1770;
@@ -469,39 +467,36 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
var_s6 = 1;
var_s7 = 0x1000;
}
+ } else if (this->unk174 == 3) {
+ spD4 = 0x1B58;
+ spD0 = 0x3E80;
+ spCC = 0x1388;
+ spC8 = 0x5DC;
+ spC4 = 0x2328;
+ spC0 = 0x1388;
+ spBC = 0x1C84;
+ spB8 = 0x5208;
+ spB4 = 0x157C;
+ var_s6 = 1;
+ var_s7 = 0x1000;
} else {
- if (this->unk174 == 3) {
- spD4 = 0x1B58;
- spD0 = 0x3E80;
- spCC = 0x1388;
- spC8 = 0x5DC;
- spC4 = 0x2328;
- spC0 = 0x1388;
- spBC = 0x1C84;
- spB8 = 0x5208;
- spB4 = 0x157C;
- var_s6 = 1;
- var_s7 = 0x1000;
- } else {
-
- spD4 = spD0 = spCC = spC8 = spC4 = spC0 = spBC = spB8 = spB4 = var_s6 = var_s7 = 0;
- }
+ spD4 = spD0 = spCC = spC8 = spC4 = spC0 = spBC = spB8 = spB4 = var_s6 = var_s7 = 0;
}
- for (var_s3 = 0; var_s3 < 7; var_s3++) {
+ for (i = 0; i < 7; i++) {
if ((this->unk174 == 0) || (this->unk174 == 3)) {
- if (var_s3 < 3) {
- spD8[var_s3].y = 0;
- spD8[var_s3].x = (s32)(Math_SinS((this->unk160 * spD4) + (var_s3 * spD0)) * spCC);
+ if (i < 3) {
+ spD8[i].y = 0;
+ spD8[i].x = (s32)(Math_SinS((this->unk160 * spD4) + (i * spD0)) * spCC);
} else {
- spD8[var_s3].x = 0;
- spD8[var_s3].y = (s32)(Math_SinS((this->unk160 * spC8) + (var_s3 * spC4)) * spC0);
+ spD8[i].x = 0;
+ spD8[i].y = (s32)(Math_SinS((this->unk160 * spC8) + (i * spC4)) * spC0);
}
- if ((var_s3 == 4) || (var_s3 == 6)) {
- spD8[var_s3].z = (s32)(Math_SinS((this->unk160 * spBC) + (var_s3 * spB8)) * spB4 * 2.0f);
+ if ((i == 4) || (i == 6)) {
+ spD8[i].z = (s32)(Math_SinS((this->unk160 * spBC) + (i * spB8)) * spB4 * 2.0f);
} else {
- spD8[var_s3].z = (s32)(Math_SinS((this->unk160 * spBC) + (var_s3 * spB8)) * spB4);
+ spD8[i].z = (s32)(Math_SinS((this->unk160 * spBC) + (i * spB8)) * spB4);
}
var_s4 = var_s6;
var_s5 = var_s7;
@@ -509,23 +504,23 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
if (this->unk174 == 1) {
var_s6 = 5;
var_s7 = 0x1000;
- spD8[var_s3].x = D_809F1C60[var_s3].x;
- spD8[var_s3].y = D_809F1C60[var_s3].y;
- spD8[var_s3].z = D_809F1C60[var_s3].z;
+ spD8[i].x = D_809F1C60[i].x;
+ spD8[i].y = D_809F1C60[i].y;
+ spD8[i].z = D_809F1C60[i].z;
} else if (this->unk174 == 2) {
var_s6 = 1;
var_s7 = 0x2000;
- spD8[var_s3].x = D_809F1C8C[var_s3].x;
- spD8[var_s3].y = D_809F1C8C[var_s3].y;
- spD8[var_s3].z = D_809F1C8C[var_s3].z;
+ spD8[i].x = D_809F1C8C[i].x;
+ spD8[i].y = D_809F1C8C[i].y;
+ spD8[i].z = D_809F1C8C[i].z;
}
var_s4 = var_s6;
var_s5 = var_s7;
}
- Math_ApproachS(&this->unk19E[var_s3].x, spD8[var_s3].x, var_s6, var_s7);
- Math_ApproachS(&this->unk19E[var_s3].y, spD8[var_s3].y, var_s6, var_s7);
- Math_ApproachS(&this->unk19E[var_s3].z, spD8[var_s3].z, var_s6, var_s7);
+ Math_ApproachS(&this->unk19E[i].x, spD8[i].x, var_s6, var_s7);
+ Math_ApproachS(&this->unk19E[i].y, spD8[i].y, var_s6, var_s7);
+ Math_ApproachS(&this->unk19E[i].z, spD8[i].z, var_s6, var_s7);
}
// There is some scope for which of var_s4,var_s5 and var_s6,var_s7 are used here
@@ -552,22 +547,20 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
}
if ((this->unk162[0] == 0) && (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= var_fv1)) {
this->unk15C = 1;
- this->unk162[0] = 0xA;
+ this->unk162[0] = 10;
}
this->unk15E = 0;
- // goto block_42;
} else {
-
sp103 = 1;
+
if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
this->unk15E++;
- if (this->unk15E > 0x1E) {
+ if (this->unk15E > 30) {
this->unk15C = 0xA;
- this->unk162[0] = 0x1E;
+ this->unk162[0] = 30;
Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
}
} else {
- // block_42:
this->unk15E = 0;
}
}
@@ -588,12 +581,12 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
if (this->unk162[0] == 0) {
this->unk15E = 0;
this->unk15C = 0;
- this->unk162[0] = 0x64;
+ this->unk162[0] = 100;
}
- if (this->unk162[0] == 0x1B) {
+ if (this->unk162[0] == 27) {
Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
sp94.y += 40.0f;
- EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 0x7D0);
+ EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 2000);
Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
}
break;
@@ -620,7 +613,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
this->unk174 = 2;
if (this->unk162[0] == 0) {
this->unk15C = 0;
- this->unk162[0] = 0x1E;
+ this->unk162[0] = 30;
}
break;
}
@@ -634,10 +627,10 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
this->dyna.actor.flags &= ~1;
func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1);
if (this->unk168 != 0) {
- var_s4_2 = 0xA;
+ var_s4_2 = 10;
}
- if (var_s4_2 >= 0xA) {
- temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D,
+ if (var_s4_2 >= 10) {
+ temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
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, this->dyna.actor.shape.rot.z, 3);
@@ -649,28 +642,28 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
play->actorCtx.targetContext.targetedActor = &temp_v0_6->dyna.actor;
}
- for (var_s3 = 0; var_s3 < 10; var_s3++) {
- temp_v0_6->unk268.jointTable[var_s3] = this->unk268.jointTable[var_s3];
+ for (i = 0; i < 10; i++) {
+ temp_v0_6->unk268.jointTable[i] = this->unk268.jointTable[i];
}
- for (var_s3 = 0; var_s3 < 20; var_s3++) {
- temp_v0_6->unk3C8.jointTable[var_s3] = this->unk3C8.jointTable[var_s3];
+ for (i = 0; i < 20; i++) {
+ temp_v0_6->unk3C8.jointTable[i] = this->unk3C8.jointTable[i];
}
Actor_PlaySfxAtPos(&this->dyna.actor, 0x381E);
- if (var_s4_2 >= 0xB) {
- temp_v0_6->unk188 = var_s4_2 - 0xA;
+ if (var_s4_2 > 10) {
+ temp_v0_6->unk188 = var_s4_2 - 10;
}
}
} else if (var_s4_2 == 2) {
- for (var_s3 = 0; var_s3 < 2; var_s3++) {
- temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
- this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y,
- this->unk330.z, var_s3 + 0xA);
+ for (i = 0; i < 2; i++) {
+ temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
+ this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x,
+ this->unk330.y, this->unk330.z, i + 10);
if (temp_v0_6 != NULL) {
- for (var_v1 = 0; var_v1 < 20; var_v1++) {
- temp_v0_6->unk3C8.jointTable[var_v1] = this->unk3C8.jointTable[var_v1];
+ for (j = 0; j < 20; j++) {
+ temp_v0_6->unk3C8.jointTable[j] = this->unk3C8.jointTable[j];
}
temp_v0_6->unk162[0] = (s32)(Rand_ZeroFloat(20.0f) + 20.0f);
@@ -759,9 +752,9 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
Math_ApproachZeroF(&this->unk198, 1.0f, 0.05f);
if (this->unk198 == 0.0f) {
- temp_v0 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, 0x12D, this->unk324.x,
- this->unk324.y, this->unk324.z, this->unk330.x, this->unk330.y,
- this->unk330.z, 4);
+ temp_v0 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
+ this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x,
+ this->unk330.y, this->unk330.z, 4);
if (temp_v0 != NULL) {
player = GET_PLAYER(play);
@@ -997,9 +990,9 @@ void func_809F0780(Boss05* this, PlayState* play) {
if (Animation_OnFrame(&this->unk3C8, 22.0f)) {
for (i = 0; i < 14; i++) {
temp_v0 = (Boss05*)Actor_SpawnAsChild(
- &play->actorCtx, &this->dyna.actor, play, 0x12D, this->dyna.actor.world.pos.x,
+ &play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05, 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, this->dyna.actor.shape.rot.z, i + 0xA);
+ this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, i + 10);
if (temp_v0 != NULL) {
for (j = 0; j < 20; j++) {
@@ -1427,7 +1420,7 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180, this->unk184,
this->unk189);
- } else if (this->dyna.actor.params >= 0xA) {
+ } else if (this->dyna.actor.params >= 10) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
SkelAnime_DrawFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
From 18021eef87ef1d94b9dd51268cf70537e516d499 Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Wed, 21 Sep 2022 05:17:30 +0100
Subject: [PATCH 12/51] Sfx
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 45 +++++++++++++--------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index b3a30cd37..9c3138340 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -392,7 +392,7 @@ s32 func_809EECBC(Boss05* this, PlayState* play) {
Enemy_StartFinishingBlow(play, &this->dyna.actor);
return 2;
} else {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3807U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_DAMAGE);
this->unk16C = 15;
this->unk15C = 0;
this->unk162[0] = 30;
@@ -449,21 +449,27 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
spD4 = 0x3E8;
spD0 = 0x3E80;
spCC = 0x7D0;
+
spC8 = 0x5DC;
spC4 = 0x1770;
spC0 = 0xBB8;
+
spBC = 0x514;
spB8 = 0x5208;
spB4 = 0xDAC;
+
var_s6 = 0xA;
var_s7 = 0x300;
if (this->unk16C != 0) {
spD4 = 0x1B58;
spCC = 0x1770;
+
spC0 = 0x1770;
+
spBC = 0x1C84;
spB4 = 0x1964;
+
var_s6 = 1;
var_s7 = 0x1000;
}
@@ -471,12 +477,15 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
spD4 = 0x1B58;
spD0 = 0x3E80;
spCC = 0x1388;
+
spC8 = 0x5DC;
spC4 = 0x2328;
spC0 = 0x1388;
+
spBC = 0x1C84;
spB8 = 0x5208;
spB4 = 0x157C;
+
var_s6 = 1;
var_s7 = 0x1000;
} else {
@@ -498,18 +507,21 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
} else {
spD8[i].z = (s32)(Math_SinS((this->unk160 * spBC) + (i * spB8)) * spB4);
}
+
var_s4 = var_s6;
var_s5 = var_s7;
} else {
if (this->unk174 == 1) {
var_s6 = 5;
var_s7 = 0x1000;
+
spD8[i].x = D_809F1C60[i].x;
spD8[i].y = D_809F1C60[i].y;
spD8[i].z = D_809F1C60[i].z;
} else if (this->unk174 == 2) {
var_s6 = 1;
var_s7 = 0x2000;
+
spD8[i].x = D_809F1C8C[i].x;
spD8[i].y = D_809F1C8C[i].y;
spD8[i].z = D_809F1C8C[i].z;
@@ -531,7 +543,8 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
SkelAnime_Update(&this->unk3C8);
Math_ApproachF(&this->unk35C, 1.0f, 0.1f, 0.1f);
- if (this->unk15C != 0xA) {
+
+ if (this->unk15C != 10) {
Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
}
@@ -556,24 +569,24 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
if (sqrtf(this->dyna.actor.xyzDistToPlayerSq) <= 40.0f) {
this->unk15E++;
if (this->unk15E > 30) {
- this->unk15C = 0xA;
+ this->unk15C = 10;
this->unk162[0] = 30;
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_ATTACK);
}
} else {
this->unk15E = 0;
}
}
if (!(this->unk160 & 3) && (Rand_ZeroOne() < 0.5f)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
}
break;
case 10:
if (!(this->unk160 & 1)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
}
- this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk19C = (this->unk162[0] & 1) * 0x200;
this->unk174 = 3;
this->unk3C8.playSpeed = 4.0f;
Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
@@ -587,7 +600,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
Math_Vec3f_Copy(&sp94, &this->dyna.actor.world.pos);
sp94.y += 40.0f;
EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 1, 2000);
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x2808U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_OUT_OF_WATER);
}
break;
@@ -598,16 +611,16 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
this->unk174 = 1;
if (this->unk162[0] == 0) {
this->unk15C = 2;
- this->unk162[0] = 0x14;
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3861U);
+ this->unk162[0] = 20;
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_ATTACK);
}
break;
case 2:
if (!(this->unk160 & 1)) {
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x3860U);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
}
- this->unk19C = (this->unk162[0] & 1) << 9;
+ this->unk19C = (this->unk162[0] & 1) * 0x200;
this->unk3C8.playSpeed = 4.0f;
Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
this->unk174 = 2;
@@ -650,7 +663,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
temp_v0_6->unk3C8.jointTable[i] = this->unk3C8.jointTable[i];
}
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x381E);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_DAMAGE);
if (var_s4_2 > 10) {
temp_v0_6->unk188 = var_s4_2 - 10;
}
@@ -669,7 +682,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
temp_v0_6->unk162[0] = (s32)(Rand_ZeroFloat(20.0f) + 20.0f);
}
}
- Actor_PlaySfxAtPos(&this->dyna.actor, 0x381F);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA_DEAD);
}
}
@@ -713,7 +726,7 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
Actor_MoveWithGravity(&this->dyna.actor);
this->dyna.actor.world.pos.y -= 85.0f;
this->dyna.actor.prevPos.y -= 85.0f;
- Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44U);
+ Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x44);
this->dyna.actor.world.pos.y += 85.0f;
this->dyna.actor.prevPos.y += 85.0f;
@@ -1008,7 +1021,7 @@ void func_809F0780(Boss05* this, PlayState* play) {
EffectSsBubble_Spawn(play, &sp7C, 20.0f, 10.0f, 20.0f, 0.13f);
}
- SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, 0x381F);
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EN_MIZUBABA_DEAD);
Actor_MarkForDeath(&this->dyna.actor);
Item_DropCollectibleRandom(play, NULL, &this->dyna.actor.world.pos, 0xE0);
}
From f4c9720601b71d1ebb2a8a0ec8c1c32f0616743b Mon Sep 17 00:00:00 2001
From: Elliptic Ellipsis
Date: Sun, 25 Sep 2022 20:41:09 +0100
Subject: [PATCH 13/51] Lot of naming
---
src/overlays/actors/ovl_Boss_05/z_boss_05.c | 499 ++++++++++----------
src/overlays/actors/ovl_Boss_05/z_boss_05.h | 86 ++--
2 files changed, 297 insertions(+), 288 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
index 9c3138340..3d9372552 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c
@@ -144,38 +144,38 @@ Vec3f D_809F1BF4 = { 0.0f, -1.0f, 0.0f };
// static DamageTable sDamageTable = {
DamageTable D_809F1C00 = {
- /* Deku Nut */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x1), //
- /* Deku Stick */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(3, 0xF), //
- /* Horse trample */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Explosives */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Zora boomerang */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Normal arrow */ DMG_ENTRY(3, 0xF), // DMG_ENTRY(1, 0xF), //
- /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Hookshot */ DMG_ENTRY(3, 0x0), // DMG_ENTRY(0, 0x1), //
- /* Goron punch */ DMG_ENTRY(2, 0xF), // DMG_ENTRY(1, 0xF), //
- /* Sword */ DMG_ENTRY(1, 0xE), // DMG_ENTRY(1, 0xF), //
- /* Goron pound */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Fire arrow */ DMG_ENTRY(1, 0x2), // DMG_ENTRY(2, 0x2), //
- /* Ice arrow */ DMG_ENTRY(1, 0x3), // DMG_ENTRY(2, 0x3), //
- /* Light arrow */ DMG_ENTRY(3, 0x4), // DMG_ENTRY(2, 0x4), //
- /* Goron spikes */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Deku spin */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(0, 0x1),
- /* Deku bubble */ DMG_ENTRY(3, 0xF), // DMG_ENTRY(1, 0xF), //
- /* Deku launch */ DMG_ENTRY(2, 0xF), // DMG_ENTRY(2, 0xF),
- /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x1), //
- /* Zora barrier */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Normal shield */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Light ray */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Thrown object */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Zora punch */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Spin attack */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
- /* Sword beam */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Normal Roll */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(1, 0x2), //
- /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Unblockable */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), // DMG_ENTRY(0, 0x0),
- /* Powder Keg */ DMG_ENTRY(1, 0xF), // DMG_ENTRY(1, 0xF),
+ /* Deku Nut */ DMG_ENTRY(0, 0x0),
+ /* Deku Stick */ DMG_ENTRY(1, 0xF),
+ /* Horse trample */ DMG_ENTRY(0, 0x0),
+ /* Explosives */ DMG_ENTRY(1, 0xF),
+ /* Zora boomerang */ DMG_ENTRY(1, 0xF),
+ /* Normal arrow */ DMG_ENTRY(3, 0xF),
+ /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
+ /* Hookshot */ DMG_ENTRY(3, 0x0),
+ /* Goron punch */ DMG_ENTRY(2, 0xF),
+ /* Sword */ DMG_ENTRY(1, 0xE),
+ /* Goron pound */ DMG_ENTRY(1, 0xF),
+ /* Fire arrow */ DMG_ENTRY(1, 0x2),
+ /* Ice arrow */ DMG_ENTRY(1, 0x3),
+ /* Light arrow */ DMG_ENTRY(3, 0x4),
+ /* Goron spikes */ DMG_ENTRY(1, 0xF),
+ /* Deku spin */ DMG_ENTRY(1, 0xF),
+ /* Deku bubble */ DMG_ENTRY(3, 0xF),
+ /* Deku launch */ DMG_ENTRY(2, 0xF),
+ /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
+ /* Zora barrier */ DMG_ENTRY(1, 0xF),
+ /* Normal shield */ DMG_ENTRY(0, 0x0),
+ /* Light ray */ DMG_ENTRY(0, 0x0),
+ /* Thrown object */ DMG_ENTRY(1, 0xF),
+ /* Zora punch */ DMG_ENTRY(1, 0xF),
+ /* Spin attack */ DMG_ENTRY(1, 0xF),
+ /* Sword beam */ DMG_ENTRY(0, 0x0),
+ /* Normal Roll */ DMG_ENTRY(0, 0x0),
+ /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
+ /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
+ /* Unblockable */ DMG_ENTRY(0, 0x0),
+ /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
+ /* Powder Keg */ DMG_ENTRY(1, 0xF),
};
// static DamageTable sDamageTable = {
@@ -240,19 +240,20 @@ extern AnimationHeader D_06007488;
extern AnimationHeader D_06007908;
void func_809EE4E0(Boss05* this, PlayState* play) {
- Vec3f sp8C;
- Vec3f sp80;
+ Vec3f icePos;
+ Vec3f iceVelocity;
s32 i;
- SoundSource_PlaySfxAtFixedWorldPos(play, &this->unk18C, 30, NA_SE_EV_ICE_BROKEN);
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->limbPos[0], 30, NA_SE_EV_ICE_BROKEN);
for (i = 0; i < 8; i++) {
- sp80.x = randPlusMinusPoint5Scaled(7.0f);
- sp80.z = randPlusMinusPoint5Scaled(7.0f);
- sp80.y = Rand_ZeroFloat(6.0f) + 4.0f;
- sp8C.x = this->unk18C.x + sp80.x;
- sp8C.y = this->unk18C.y + sp80.y;
- sp8C.z = this->unk18C.z + sp80.z;
- EffectSsEnIce_Spawn(play, &sp8C, Rand_ZeroFloat(0.5f) + 0.7f, &sp80, &D_809F1BF4, &D_809F1BEC, &D_809F1BF0, 30);
+ iceVelocity.x = randPlusMinusPoint5Scaled(7.0f);
+ iceVelocity.z = randPlusMinusPoint5Scaled(7.0f);
+ iceVelocity.y = Rand_ZeroFloat(6.0f) + 4.0f;
+ icePos.x = this->limbPos[0].x + iceVelocity.x;
+ icePos.y = this->limbPos[0].y + iceVelocity.y;
+ icePos.z = this->limbPos[0].z + iceVelocity.z;
+ EffectSsEnIce_Spawn(play, &icePos, Rand_ZeroFloat(0.5f) + 0.7f, &iceVelocity, &D_809F1BF4, &D_809F1BEC,
+ &D_809F1BF0, 30);
}
}
@@ -279,7 +280,7 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->dyna.actor, 0.01f);
- if ((this->dyna.actor.params == 0) || (this->dyna.actor.params == 1)) {
+ if ((this->dyna.actor.params == BIO_DEKU_BABA_TYPE_0) || (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_1)) {
if (this->dyna.actor.world.rot.z == 0) {
this->dyna.actor.world.rot.z = 0;
}
@@ -294,62 +295,69 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
func_809EEDD0(this, play);
- SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
- SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
- this->unk4FC = Animation_GetLastFrame(&D_06006484);
+ SkelAnime_InitFlex(play, &this->skelAnime10, &D_060024E0, &D_06000ABC, this->jointTable10, this->morphTable10,
+ 10);
+ SkelAnime_InitFlex(play, &this->skelAnime20, &D_06006378, &D_06006484, this->jointTable20, this->morphTable20,
+ 20);
+ this->lastAnimFrame = Animation_GetLastFrame(&D_06006484);
- Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
- Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+ Collider_InitAndSetJntSph(play, &this->collider2, &this->dyna.actor, &D_809F1B74, this->colliderElements2);
+ Collider_InitAndSetJntSph(play, &this->collider1, &this->dyna.actor, &D_809F1BA8, this->colliderElements1);
if (Flags_GetClear(play, play->roomCtx.currRoom.num)) {
- this->dyna.actor.params = 2;
+ this->dyna.actor.params = BIO_DEKU_BABA_TYPE_2;
this->actionFunc = func_809EF9BC;
this->dyna.actor.flags &= ~ACTOR_FLAG_1;
func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG);
}
- } else if (this->dyna.actor.params == 2) {
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_2) {
this->actionFunc = func_809EF9BC;
CollisionHeader_GetVirtual(&sBioBabaLilypadCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
- SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
+ SkelAnime_InitFlex(play, &this->skelAnime10, &D_060024E0, &D_06000ABC, this->jointTable10, this->morphTable10,
+ 10);
this->dyna.actor.flags &= ~ACTOR_FLAG_1;
func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG);
- } else if (this->dyna.actor.params == 3) {
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_3) {
this->actionFunc = func_809EFAB4;
this->unk198 = 1.0f;
- SkelAnime_InitFlex(play, &this->unk268, &D_060024E0, &D_06000ABC, this->unk2AC, this->unk2E8, 10);
- SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
- this->unk4FC = Animation_GetLastFrame(&D_06006484);
+ SkelAnime_InitFlex(play, &this->skelAnime10, &D_060024E0, &D_06000ABC, this->jointTable10, this->morphTable10,
+ 10);
+ SkelAnime_InitFlex(play, &this->skelAnime20, &D_06006378, &D_06006484, this->jointTable20, this->morphTable20,
+ 20);
+ this->lastAnimFrame = Animation_GetLastFrame(&D_06006484);
- Collider_InitAndSetJntSph(play, &this->unk1C8, &this->dyna.actor, &D_809F1B74, this->unk1E8);
- Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BA8, this->unk388);
+ Collider_InitAndSetJntSph(play, &this->collider2, &this->dyna.actor, &D_809F1B74, this->colliderElements2);
+ Collider_InitAndSetJntSph(play, &this->collider1, &this->dyna.actor, &D_809F1BA8, this->colliderElements1);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->dyna.actor.colChkInfo.damageTable = &D_809F1C00;
- } else if (this->dyna.actor.params == 4) {
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_4) {
func_809F00CC(this, play);
this->dyna.actor.colChkInfo.mass = 90;
- SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
+ SkelAnime_InitFlex(play, &this->skelAnime20, &D_06006378, &D_06006484, this->jointTable20, this->morphTable20,
+ 20);
- Collider_InitAndSetJntSph(play, &this->unk368, &this->dyna.actor, &D_809F1BDC, this->unk388);
+ Collider_InitAndSetJntSph(play, &this->collider1, &this->dyna.actor, &D_809F1BDC, this->colliderElements1);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->dyna.actor.colChkInfo.damageTable = &D_809F1C20;
this->dyna.actor.flags |= ACTOR_FLAG_10 | ACTOR_FLAG_20;
- } else if (this->dyna.actor.params >= 10) {
- SkelAnime_InitFlex(play, &this->unk3C8, &D_06006378, &D_06006484, this->unk40C, this->unk484, 20);
+ } else if (this->dyna.actor.params >= BIO_DEKU_BABA_TYPE_10) {
+ SkelAnime_InitFlex(play, &this->skelAnime20, &D_06006378, &D_06006484, this->jointTable20, this->morphTable20,
+ 20);
this->dyna.actor.gravity = 0.0f;
this->dyna.actor.world.rot.y = (s32)Rand_ZeroFloat(0x8000);
this->dyna.actor.speedXZ = Rand_ZeroFloat(3.0f) + 3.0f;
this->dyna.actor.velocity.y = Rand_ZeroFloat(1.5f) + 1.5f;
- this->unk500 = (s32)randPlusMinusPoint5Scaled(700.0f);
- this->unk502 = (s32)randPlusMinusPoint5Scaled(1500.0f);
+ this->unk500.x = (s32)randPlusMinusPoint5Scaled(700.0f);
+ this->unk500.y = (s32)randPlusMinusPoint5Scaled(1500.0f);
this->unk162[0] = (s32)(Rand_ZeroFloat(30.0f) + 50.0f);
this->dyna.actor.flags &= ~ACTOR_FLAG_1;
@@ -360,7 +368,8 @@ void Boss05_Init(Actor* thisx, PlayState* play) {
void Boss05_Destroy(Actor* thisx, PlayState* play) {
Boss05* this = THIS;
- if ((this->dyna.actor.params == 2) || (this->dyna.actor.params == 0) || (this->dyna.actor.params == 1)) {
+ if ((this->dyna.actor.params == BIO_DEKU_BABA_TYPE_2) || (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_0) ||
+ (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_1)) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
}
@@ -370,7 +379,7 @@ s32 func_809EECBC(Boss05* this, PlayState* play) {
s32 i = 0;
while (true) {
- if (this->unk1C8.elements[i].info.bumperFlags & 2) {
+ if (this->collider2.elements[i].info.bumperFlags & BUMP_HIT) {
switch (this->dyna.actor.colChkInfo.damageEffect) {
case 2:
return 11;
@@ -385,7 +394,7 @@ s32 func_809EECBC(Boss05* this, PlayState* play) {
i++;
if (i == 2) {
- if (this->unk368.elements[0].info.bumperFlags & 2) {
+ if (this->collider1.elements[0].info.bumperFlags & BUMP_HIT) {
u8 damage = this->dyna.actor.colChkInfo.damage;
this->dyna.actor.colChkInfo.health -= damage;
if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
@@ -541,17 +550,17 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, var_s4, var_s5);
}
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Math_ApproachF(&this->unk35C, 1.0f, 0.1f, 0.1f);
if (this->unk15C != 10) {
Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 0x14, 0x800);
}
- switch (this->unk15C) { /* irregular */
+ switch (this->unk15C) {
case 0:
this->unk174 = 0;
- this->unk3C8.playSpeed = 1.0f;
+ this->skelAnime20.playSpeed = 1.0f;
if (spA4 < 0.0f) {
if (sp108->actor.speedXZ > 10.0f) {
var_fv1 = 220.0f;
@@ -588,7 +597,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
}
this->unk19C = (this->unk162[0] & 1) * 0x200;
this->unk174 = 3;
- this->unk3C8.playSpeed = 4.0f;
+ this->skelAnime20.playSpeed = 4.0f;
Math_ApproachS(&this->dyna.actor.shape.rot.x, -0x8000, 2, 0x2000);
Math_ApproachS(&this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer, 2, 0x2000);
if (this->unk162[0] == 0) {
@@ -605,8 +614,8 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
break;
case 1:
- if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
- this->unk3C8.playSpeed = 0.0f;
+ if (Animation_OnFrame(&this->skelAnime20, this->lastAnimFrame)) {
+ this->skelAnime20.playSpeed = 0.0f;
}
this->unk174 = 1;
if (this->unk162[0] == 0) {
@@ -621,7 +630,7 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
}
this->unk19C = (this->unk162[0] & 1) * 0x200;
- this->unk3C8.playSpeed = 4.0f;
+ this->skelAnime20.playSpeed = 4.0f;
Math_ApproachF(&this->unk35C, 1.5f, 1.0f, 0.7f);
this->unk174 = 2;
if (this->unk162[0] == 0) {
@@ -635,18 +644,18 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
if ((var_s4_2 != 0) || (this->unk168 == 1)) {
Boss05* temp_v0_6;
- this->dyna.actor.params = 2;
+ this->dyna.actor.params = BIO_DEKU_BABA_TYPE_2;
this->actionFunc = func_809EF9BC;
- this->dyna.actor.flags &= ~1;
- func_800BC154(play, &play->actorCtx, &this->dyna.actor, 1);
+ this->dyna.actor.flags &= ~ACTOR_FLAG_1;
+ func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_BG);
if (this->unk168 != 0) {
var_s4_2 = 10;
}
if (var_s4_2 >= 10) {
- temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
- 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, this->dyna.actor.shape.rot.z, 3);
+ temp_v0_6 = (Boss05*)Actor_SpawnAsChild(
+ &play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05, 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, this->dyna.actor.shape.rot.z, BIO_DEKU_BABA_TYPE_3);
if (temp_v0_6 != NULL) {
Player* temp_v1 = GET_PLAYER(play);
if (temp_v1->unk_730 == &this->dyna.actor) {
@@ -656,27 +665,27 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
}
for (i = 0; i < 10; i++) {
- temp_v0_6->unk268.jointTable[i] = this->unk268.jointTable[i];
+ temp_v0_6->skelAnime10.jointTable[i] = this->skelAnime10.jointTable[i];
}
for (i = 0; i < 20; i++) {
- temp_v0_6->unk3C8.jointTable[i] = this->unk3C8.jointTable[i];
+ temp_v0_6->skelAnime20.jointTable[i] = this->skelAnime20.jointTable[i];
}
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_DAMAGE);
if (var_s4_2 > 10) {
- temp_v0_6->unk188 = var_s4_2 - 10;
+ temp_v0_6->drawDmgEffState = var_s4_2 - 10;
}
}
} else if (var_s4_2 == 2) {
for (i = 0; i < 2; i++) {
temp_v0_6 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x,
- this->unk330.y, this->unk330.z, i + 10);
+ this->unk330.y, this->unk330.z, i + BIO_DEKU_BABA_TYPE_10);
if (temp_v0_6 != NULL) {
for (j = 0; j < 20; j++) {
- temp_v0_6->unk3C8.jointTable[j] = this->unk3C8.jointTable[j];
+ temp_v0_6->skelAnime20.jointTable[j] = this->skelAnime20.jointTable[j];
}
temp_v0_6->unk162[0] = (s32)(Rand_ZeroFloat(20.0f) + 20.0f);
@@ -687,29 +696,29 @@ void func_809EEDE8(Boss05* this, PlayState* play) {
}
if (sp103 == 0) {
- CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1C8.base);
- CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base);
}
- CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C8.base);
- CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base);
}
void func_809EF9BC(Boss05* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- f32 temp_fv0 = sqrtf(this->dyna.actor.xyzDistToPlayerSq);
+ f32 distToPlayer = sqrtf(this->dyna.actor.xyzDistToPlayerSq);
s16 var_a1;
- if ((temp_fv0 < 50.0f) && (player->actor.bgCheckFlags & 1)) {
- var_a1 = (s32)(temp_fv0 * 80.0f);
+ if ((distToPlayer < 50.0f) && (player->actor.bgCheckFlags & 1)) {
+ var_a1 = (s32)(distToPlayer * 80.0f);
var_a1 = CLAMP_MAX(var_a1, 0x7D0);
// if (var_a1 > 0x7D0) {
// var_a1 = 0x7D0;
// }
Math_ApproachS(&this->unk178, var_a1, 0x14, 0x7D0);
Math_ApproachS(&this->unk176, this->dyna.actor.yawTowardsPlayer, 0x14, 0xFA0);
- if (!(this->unk160 & 0xF)) {
- EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x1F4, 0x3E8, 0);
+ if ((this->unk160 % 16) == 0) {
+ EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 500, 1000, 0);
}
} else {
Math_ApproachS(&this->unk178, 0, 0x14, 0x100);
@@ -718,8 +727,8 @@ void func_809EF9BC(Boss05* this, PlayState* play) {
void func_809EFAB4(Boss05* this, PlayState* play) {
s32 i;
- Vec3f sp80;
- Vec3f sp74;
+ Vec3f unusedPos;
+ Vec3f bubblePos;
Boss05* temp_v0;
Player* player;
@@ -742,23 +751,23 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
this->dyna.actor.velocity.y = -3.0f;
this->dyna.actor.gravity = -0.3f;
this->dyna.actor.terminalVelocity = -5.0f;
- Math_Vec3f_Copy(&sp80, &this->dyna.actor.world.pos);
- sp80.y += 20.0f;
+ Math_Vec3f_Copy(&unusedPos, &this->dyna.actor.world.pos);
+ unusedPos.y += 20.0f;
EffectSsGSplash_Spawn(play, &this->dyna.actor.world.pos, NULL, NULL, 1, 1000);
this->unk162[2] = 20;
}
if (this->unk162[2] != 0) {
for (i = 0; i < 3; i++) {
- sp74.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
- sp74.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
- sp74.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
- EffectSsBubble_Spawn(play, &sp74, 20.0f, 10.0f, 20.0f, 0.13f);
+ bubblePos.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+ bubblePos.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+ bubblePos.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+ EffectSsBubble_Spawn(play, &bubblePos, 20.0f, 10.0f, 20.0f, 0.13f);
}
}
if (this->dyna.actor.bgCheckFlags & 1) {
- if ((this->unk189 == 0xA) && (this->unk17A != 0)) {
+ if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) && (this->unk17A != 0)) {
this->unk17A = 0;
}
@@ -767,7 +776,7 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
if (this->unk198 == 0.0f) {
temp_v0 = (Boss05*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05,
this->unk324.x, this->unk324.y, this->unk324.z, this->unk330.x,
- this->unk330.y, this->unk330.z, 4);
+ this->unk330.y, this->unk330.z, BIO_DEKU_BABA_TYPE_4);
if (temp_v0 != NULL) {
player = GET_PLAYER(play);
@@ -778,7 +787,7 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
}
for (i = 0; i < 20; i++) {
- temp_v0->unk3C8.jointTable[i] = this->unk3C8.jointTable[i];
+ temp_v0->skelAnime20.jointTable[i] = this->skelAnime20.jointTable[i];
}
Actor_PlaySfxAtPos(&temp_v0->dyna.actor, NA_SE_EN_MIZUBABA_TRANSFORM);
@@ -791,20 +800,20 @@ void func_809EFAB4(Boss05* this, PlayState* play) {
void func_809EFE50(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
Boss05* this = THIS;
- u8 var_a2 = 0;
- ColliderInfo* temp;
+ u8 takeDamage = false;
+ ColliderInfo* hitInfo;
- if ((this->unk16A == 0) && (this->unk368.elements[0].info.bumperFlags & BUMP_HIT)) {
- this->unk368.elements[0].info.bumperFlags &= ~BUMP_HIT;
- temp = this->unk368.elements[0].info.acHitInfo;
- if (temp->toucher.dmgFlags & 0x300000) { // (DMG_NORMAL_SHIELD | DMG_LIGHT_RAY)
+ if ((this->unk16A == 0) && (this->collider1.elements[0].info.bumperFlags & BUMP_HIT)) {
+ this->collider1.elements[0].info.bumperFlags &= ~BUMP_HIT;
+ hitInfo = this->collider1.elements[0].info.acHitInfo;
+ if (hitInfo->toucher.dmgFlags & 0x300000) { // (DMG_NORMAL_SHIELD | DMG_LIGHT_RAY)
this->unk338 = -12.0f;
this->unk348 = this->dyna.actor.yawTowardsPlayer;
this->unk16A = 6;
return;
}
- this->unk16A = 0xA;
+ this->unk16A = 10;
this->dyna.actor.speedXZ = 0.0f;
this->unk338 = -20.0f;
this->unk348 = this->dyna.actor.yawTowardsPlayer;
@@ -817,31 +826,32 @@ void func_809EFE50(Actor* thisx, PlayState* play2) {
break;
case 2:
- this->unk188 = 1;
- var_a2 = 1;
+ this->drawDmgEffState = 1;
+ takeDamage = true;
break;
case 3:
func_809F0A64(this, play);
- this->unk188 = 0xA;
+ this->drawDmgEffState = 10;
break;
case 4:
- this->unk188 = 0x14;
- var_a2 = 1;
+ this->drawDmgEffState = 20;
+ takeDamage = true;
break;
default:
- var_a2 = 1;
+ takeDamage = true;
break;
}
- if (var_a2 != 0) {
+ if (takeDamage) {
u8 damage; // Probably fake?
- if ((this->actionFunc == func_809F0ABC) && (this->unk189 == 0xA) && (this->unk17A != 0)) {
+ if ((this->actionFunc == func_809F0ABC) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) &&
+ (this->unk17A != 0)) {
func_809EE4E0(this, play);
- this->unk188 = 0;
+ this->drawDmgEffState = 0;
}
damage = this->dyna.actor.colChkInfo.damage;
@@ -849,16 +859,17 @@ void func_809EFE50(Actor* thisx, PlayState* play2) {
if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
Enemy_StartFinishingBlow(play, &this->dyna.actor);
}
+
func_809F0708(this, play);
- this->unk16C = 0xF;
+ this->unk16C = 15;
}
}
}
s32 func_809F0014(Boss05* this, PlayState* play) {
- s16 var_v1 = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
+ s16 yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
- if (ABS_ALT(var_v1) < 0x3000) {
+ if (ABS_ALT(yawDiff) < 0x3000) {
return true;
} else {
return false;
@@ -874,15 +885,16 @@ void func_809F0058(Boss05* this, PlayState* play) {
void func_809F00CC(Boss05* this, PlayState* play) {
this->actionFunc = func_809F010C;
- Animation_MorphToPlayOnce(&this->unk3C8, &D_06006E50, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime20, &D_06006E50, -5.0f);
}
void func_809F010C(Boss05* this, PlayState* play) {
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
Math_ApproachF(&this->unk360, 1.0f, 1.0f, 0.5f);
Math_ApproachF(&this->unk364, 1.0f, 1.0f, 0.14f);
+
if (this->unk364 == 1.0f) {
func_809F01CC(this, play);
}
@@ -890,13 +902,13 @@ void func_809F010C(Boss05* this, PlayState* play) {
void func_809F01CC(Boss05* this, PlayState* play) {
this->actionFunc = func_809F0244;
- Animation_MorphToLoop(&this->unk3C8, &D_06007488, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime20, &D_06007488, -10.0f);
this->unk162[0] = (s32)(Rand_ZeroFloat(25.0f) + 25.0f);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA1_MOUTH);
}
void func_809F0244(Boss05* this, PlayState* play) {
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
Math_ApproachS(&this->dyna.actor.shape.rot.x, 0, 2, 0x400);
Math_ApproachS(&this->dyna.actor.shape.rot.z, 0, 2, 0x400);
@@ -910,26 +922,26 @@ void func_809F0244(Boss05* this, PlayState* play) {
void func_809F02D0(Boss05* this, PlayState* play) {
this->actionFunc = func_809F0374;
- Animation_MorphToLoop(&this->unk3C8, &D_06007908, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime20, &D_06007908, 0.0f);
this->unk162[0] = (s32)(Rand_ZeroFloat(80.0f) + 60.0f);
- this->unk34C = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.x;
- this->unk354 = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.z;
+ this->unk34C.x = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.x;
+ this->unk34C.z = randPlusMinusPoint5Scaled(400.0f) + this->dyna.actor.world.pos.z;
this->unk358 = 0.0f;
}
void func_809F0374(Boss05* this, PlayState* play) {
- f32 sp24;
- f32 sp20;
+ f32 deltaX;
+ f32 deltaZ;
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_WALK - SFX_FLAG);
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Math_ApproachF(&this->dyna.actor.speedXZ, 5.0f, 1.0f, 2.0f);
- sp24 = this->unk34C - this->dyna.actor.world.pos.x;
- sp20 = this->unk354 - this->dyna.actor.world.pos.z;
- Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(sp24, sp20), 5, (s32)this->unk358);
+ deltaX = this->unk34C.x - this->dyna.actor.world.pos.x;
+ deltaZ = this->unk34C.z - this->dyna.actor.world.pos.z;
+ Math_ApproachS(&this->dyna.actor.world.rot.y, Math_Atan2S(deltaX, deltaZ), 5, (s32)this->unk358);
Math_ApproachF(&this->unk358, 2000.0f, 1.0f, 100.0f);
- if ((this->unk162[0] == 0) || ((SQ(sp24) + SQ(sp20)) < 2500.0f)) {
+ if ((this->unk162[0] == 0) || ((SQ(deltaX) + SQ(deltaZ)) < 2500.0f)) {
func_809F01CC(this, play);
}
@@ -938,12 +950,12 @@ void func_809F0374(Boss05* this, PlayState* play) {
void func_809F0474(Boss05* this, PlayState* play) {
this->actionFunc = func_809F04C0;
- Animation_MorphToPlayOnce(&this->unk3C8, &D_06003448, 0.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime20, &D_06003448, 0.0f);
this->unk162[0] = 20;
}
void func_809F04C0(Boss05* this, PlayState* play) {
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
Math_ApproachZeroF(&this->dyna.actor.speedXZ, 1.0f, 2.5f);
Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, 0x1000);
@@ -954,78 +966,78 @@ void func_809F04C0(Boss05* this, PlayState* play) {
void func_809F0538(Boss05* this, PlayState* arg1) {
this->actionFunc = func_809F0590;
- Animation_MorphToLoop(&this->unk3C8, &D_06000A5C, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime20, &D_06000A5C, 0.0f);
this->unk162[0] = 60;
this->unk358 = 0.0f;
}
void func_809F0590(Boss05* this, PlayState* play) {
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_VOICE - SFX_FLAG);
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
Math_ApproachF(&this->dyna.actor.speedXZ, 8.0f, 1.0f, 4.0f);
Math_ApproachS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 5, (s32)this->unk358);
Math_ApproachF(&this->unk358, 4000.0f, 1.0f, 400.0f);
- if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= 22500.0f)) {
+
+ if ((this->unk162[0] == 0) || (this->dyna.actor.xyzDistToPlayerSq <= SQ(150.0f))) {
func_809F0650(this, play);
}
}
void func_809F0650(Boss05* this, PlayState* arg1) {
this->actionFunc = func_809F06B8;
- Animation_MorphToPlayOnce(&this->unk3C8, &D_060006A4, 0.0f);
- this->unk4FC = Animation_GetLastFrame(&D_060006A4);
+ Animation_MorphToPlayOnce(&this->skelAnime20, &D_060006A4, 0.0f);
+ this->lastAnimFrame = Animation_GetLastFrame(&D_060006A4);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_MIZUBABA2_ATTACK);
}
void func_809F06B8(Boss05* this, PlayState* play) {
- SkelAnime_Update(&this->unk3C8);
- if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ SkelAnime_Update(&this->skelAnime20);
+ if (Animation_OnFrame(&this->skelAnime20, this->lastAnimFrame)) {
func_809F01CC(this, play);
}
}
void func_809F0708(Boss05* this, PlayState* play) {
this->actionFunc = func_809F0780;
- Animation_MorphToPlayOnce(&this->unk3C8, &D_06002F0C, 0.0f);
- this->unk4FC = Animation_GetLastFrame(&D_060006A4);
- Actor_SetColorFilter(&this->dyna.actor, 0x4000U, 120, 0, 30);
+ Animation_MorphToPlayOnce(&this->skelAnime20, &D_06002F0C, 0.0f);
+ this->lastAnimFrame = Animation_GetLastFrame(&D_060006A4);
+ Actor_SetColorFilter(&this->dyna.actor, 0x4000, 120, 0, 30);
}
-// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_05/func_809F0780.s")
void func_809F0780(Boss05* this, PlayState* play) {
s32 i;
s32 j;
- Vec3f sp7C;
+ Vec3f bubblePos;
Boss05* temp_v0;
- SkelAnime_Update(&this->unk3C8);
+ SkelAnime_Update(&this->skelAnime20);
if ((s8)this->dyna.actor.colChkInfo.health <= 0) {
- if (Animation_OnFrame(&this->unk3C8, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime20, 22.0f)) {
for (i = 0; i < 14; i++) {
temp_v0 = (Boss05*)Actor_SpawnAsChild(
&play->actorCtx, &this->dyna.actor, play, ACTOR_BOSS_05, 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, this->dyna.actor.shape.rot.z, i + 10);
+ this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, i + BIO_DEKU_BABA_TYPE_10);
if (temp_v0 != NULL) {
for (j = 0; j < 20; j++) {
- temp_v0->unk3C8.jointTable[j] = this->unk3C8.jointTable[j];
+ temp_v0->skelAnime20.jointTable[j] = this->skelAnime20.jointTable[j];
}
}
}
for (i = 0; i < 20; i++) {
- sp7C.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
- sp7C.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
- sp7C.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
- EffectSsBubble_Spawn(play, &sp7C, 20.0f, 10.0f, 20.0f, 0.13f);
+ bubblePos.x = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.x;
+ bubblePos.y = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.y;
+ bubblePos.z = randPlusMinusPoint5Scaled(40.0f) + this->dyna.actor.world.pos.z;
+ EffectSsBubble_Spawn(play, &bubblePos, 20.0f, 10.0f, 20.0f, 0.13f);
}
SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EN_MIZUBABA_DEAD);
Actor_MarkForDeath(&this->dyna.actor);
Item_DropCollectibleRandom(play, NULL, &this->dyna.actor.world.pos, 0xE0);
}
- } else if (Animation_OnFrame(&this->unk3C8, this->unk4FC)) {
+ } else if (Animation_OnFrame(&this->skelAnime20, this->lastAnimFrame)) {
func_809F0474(this, play);
}
}
@@ -1066,8 +1078,8 @@ void func_809F0B0C(Boss05* this, PlayState* play) {
if (this->unk15C == 1) {
Math_ApproachF(&this->dyna.actor.velocity.y, 1.0f, 1.0f, 0.1f);
Math_ApproachZeroF(&this->dyna.actor.speedXZ, 0.5f, 0.5f);
- this->dyna.actor.shape.rot.x += this->unk500;
- this->dyna.actor.shape.rot.y += this->unk502;
+ this->dyna.actor.shape.rot.x += this->unk500.x;
+ this->dyna.actor.shape.rot.y += this->unk500.y;
if (this->unk162[0] == 0) {
Actor_MarkForDeath(&this->dyna.actor);
@@ -1126,7 +1138,7 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
- if (this->dyna.actor.params == 4) {
+ if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_4) {
Actor_MoveWithGravity(&this->dyna.actor);
Matrix_RotateYS(this->unk348, MTXMODE_NEW);
Matrix_MultVecZ(this->unk338, &this->unk33C);
@@ -1135,73 +1147,73 @@ void Boss05_Update(Actor* thisx, PlayState* play) {
Math_ApproachZeroF(&this->unk338, 1.0f, 1.0f);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 50.0f, 40.0f, 0x45);
func_809EFE50(&this->dyna.actor, play);
- CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk368.base);
- CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk368.base);
- CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk368.base);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base);
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
}
- switch (this->unk188) {
+ switch (this->drawDmgEffState) {
case 0:
- this->unk189 = 0;
+ this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE;
this->unk17A = 0;
- this->unk184 = 0.0f;
+ this->drawDmgEffAlpha = 0.0f;
break;
case 1:
- this->unk189 = 0;
+ this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE;
this->unk17A = 80;
- this->unk184 = 1.0f;
- this->unk188++;
- this->unk17C = 0.0f;
+ this->drawDmgEffAlpha = 1.0f;
+ this->drawDmgEffState++;
+ this->drawDmgEffScale = 0.0f;
// fallthrough
case 2:
if (this->unk17A == 0) {
- Math_ApproachZeroF(&this->unk184, 1.0f, 0.02f);
- if (this->unk184 == 0.0f) {
- this->unk188 = 0;
+ Math_ApproachZeroF(&this->drawDmgEffAlpha, 1.0f, 0.02f);
+ if (this->drawDmgEffAlpha == 0.0f) {
+ this->drawDmgEffState = 0;
}
} else {
- Math_ApproachF(&this->unk17C, 1.0f, 0.1f, 0.5f);
+ Math_ApproachF(&this->drawDmgEffScale, 1.0f, 0.1f, 0.5f);
}
break;
case 10:
- this->unk189 = 0xA;
+ this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX;
this->unk17A = 80;
- this->unk184 = 1.0f;
- this->unk188++;
- this->unk17C = 0.0f;
- this->unk180 = 2.0f;
+ this->drawDmgEffAlpha = 1.0f;
+ this->drawDmgEffState++;
+ this->drawDmgEffScale = 0.0f;
+ this->dmgEffFrozenSteamScale = 2.0f;
// fallthrough
case 11:
if (this->unk17A == 0) {
func_809EE4E0(this, play);
- this->unk188 = 0;
+ this->drawDmgEffState = 0;
} else {
- Math_ApproachF(&this->unk17C, 1.0f, 1.0f, 0.25f);
- Math_ApproachF(&this->unk180, 1.0f, 0.1f, 0.1f);
+ Math_ApproachF(&this->drawDmgEffScale, 1.0f, 1.0f, 0.25f);
+ Math_ApproachF(&this->dmgEffFrozenSteamScale, 1.0f, 0.1f, 0.1f);
}
break;
case 20:
- this->unk189 = 0x14;
+ this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS;
this->unk17A = 80;
- this->unk184 = 1.0f;
- this->unk188++;
- this->unk17C = 0.0f;
+ this->drawDmgEffAlpha = 1.0f;
+ this->drawDmgEffState++;
+ this->drawDmgEffScale = 0.0f;
break;
case 21:
if (this->unk17A == 0) {
- Math_ApproachZeroF(&this->unk17C, 1.0f, 0.03f);
+ Math_ApproachZeroF(&this->drawDmgEffScale, 1.0f, 0.03f);
- if (this->unk17C == 0.0f) {
- this->unk188 = 0;
- this->unk184 = 0.0f;
+ if (this->drawDmgEffScale == 0.0f) {
+ this->drawDmgEffState = 0;
+ this->drawDmgEffAlpha = 0.0f;
}
} else {
- Math_ApproachF(&this->unk17C, 1.0f, 0.5f, 0.5f);
+ Math_ApproachF(&this->drawDmgEffScale, 1.0f, 0.5f, 0.5f);
}
break;
}
@@ -1217,12 +1229,13 @@ s32 func_809F1050(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
if (!(this->unk160 & 3)) {
*dList = NULL;
}
+
rot->x += KREG(33) * 0x100;
rot->y += KREG(34) * 0x100;
rot->z += KREG(35) * 0x100;
}
- if ((thisx->params == 1) && (limbIndex == 9)) {
+ if ((this->dyna.actor.params == BIO_DEKU_BABA_TYPE_1) && (limbIndex == 9)) {
*dList = NULL;
}
@@ -1244,9 +1257,9 @@ Vec3f D_809F1CC4 = { 0.0f, -1400.0f, 600.0f };
void func_809F1170(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
- MtxF sp3C;
- Vec3f sp30;
- Vec3f sp24;
+ MtxF mf;
+ Vec3f spherePos0;
+ Vec3f spherePos1;
if (limbIndex == 4) {
Matrix_MultVec3f(&D_809F1CC4, &this->unk324);
@@ -1255,22 +1268,22 @@ void func_809F1170(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto
Matrix_MultVec3f(&D_809F1CC4, &this->dyna.actor.focus.pos);
}
- Matrix_Get(&sp3C);
- Matrix_MtxFToYXZRot(&sp3C, &this->unk330, false);
+ Matrix_Get(&mf);
+ Matrix_MtxFToYXZRot(&mf, &this->unk330, false);
this->unk330.x += 0xF00;
}
if (limbIndex == 2) {
- Matrix_MultZero(&sp30);
- func_809EE668(0, &this->unk1C8, &sp30);
+ Matrix_MultZero(&spherePos0);
+ func_809EE668(0, &this->collider2, &spherePos0);
}
if (limbIndex == 3) {
- Matrix_MultVecY(-500.0f, &sp24);
- func_809EE668(1, &this->unk1C8, &sp24);
+ Matrix_MultVecY(-500.0f, &spherePos1);
+ func_809EE668(1, &this->collider2, &spherePos1);
if (this->actionFunc == func_809EEDE8) {
- Matrix_MultVecY(1500.0f, &thisx->focus.pos);
+ Matrix_MultVecY(1500.0f, &this->dyna.actor.focus.pos);
}
}
}
@@ -1289,14 +1302,16 @@ void func_809F12A0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto
if (limbIndex == 1) {
Matrix_MultVec3f(&D_809F1CD0, &D_809F2110);
- func_809EE668(0, &this->unk368, &D_809F2110);
- if (thisx->params == 4) {
+ func_809EE668(0, &this->collider1, &D_809F2110);
+
+ if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_4) {
Matrix_MultVec3f(&D_809F1CDC, &thisx->focus.pos);
}
- if (this->unk188 != 0) {
- Matrix_MultVec3f(&D_809F1CDC, &this->unk18C);
- if (this->unk189 == 0) {
- this->unk18C.y -= 15.0f;
+
+ if (this->drawDmgEffState != 0) {
+ Matrix_MultVec3f(&D_809F1CDC, &this->limbPos[0]);
+ if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) {
+ this->limbPos[0].y -= 15.0f;
}
}
}
@@ -1347,7 +1362,7 @@ s32 D_809F1CE8[] = { 2, 3, 1, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19 };
s32 func_809F14AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
- if (limbIndex != D_809F1CE8[thisx->params - 10]) {
+ if (limbIndex != D_809F1CE8[this->dyna.actor.params - BIO_DEKU_BABA_TYPE_10]) {
*dList = NULL;
} else if (this->unk15C >= 2) {
rot->x += this->unk160 * 0x3000;
@@ -1360,7 +1375,7 @@ s32 func_809F14AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
void func_809F1550(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
Boss05* this = THIS;
- if (limbIndex != D_809F1CE8[thisx->params - 10]) {
+ if (limbIndex != D_809F1CE8[this->dyna.actor.params - BIO_DEKU_BABA_TYPE_10]) {
Matrix_MultZero(&this->unk324);
}
}
@@ -1374,10 +1389,10 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
if (this->actionFunc == func_809EEDE8) {
- SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
- func_809F1050, func_809F1170, &this->dyna.actor);
+ SkelAnime_DrawFlexOpa(play, this->skelAnime10.skeleton, this->skelAnime10.jointTable,
+ this->skelAnime10.dListCount, func_809F1050, func_809F1170, &this->dyna.actor);
- if (this->unk16C & 1) {
+ if ((this->unk16C % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
}
@@ -1389,9 +1404,10 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
- SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
- func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
- } else if (this->dyna.actor.params == 2) {
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime20.skeleton, this->skelAnime20.jointTable,
+ this->skelAnime20.dListCount, func_809F1284, func_809F12A0, func_809F135C,
+ &this->dyna.actor);
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_2) {
Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
MTXMODE_NEW);
Matrix_RotateYS(this->unk176, MTXMODE_APPLY);
@@ -1402,11 +1418,12 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
Matrix_RotateZS(this->dyna.actor.shape.rot.z, MTXMODE_APPLY);
Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
- SkelAnime_DrawFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
- func_809F1404, NULL, &this->dyna.actor);
- } else if (this->dyna.actor.params == 3) {
- SkelAnime_DrawTransformFlexOpa(play, this->unk268.skeleton, this->unk268.jointTable, this->unk268.dListCount,
- func_809F1430, func_809F1170, func_809F1464, &this->dyna.actor);
+ SkelAnime_DrawFlexOpa(play, this->skelAnime10.skeleton, this->skelAnime10.jointTable,
+ this->skelAnime10.dListCount, func_809F1404, NULL, &this->dyna.actor);
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_3) {
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime10.skeleton, this->skelAnime10.jointTable,
+ this->skelAnime10.dListCount, func_809F1430, func_809F1170, func_809F1464,
+ &this->dyna.actor);
Matrix_Translate(this->unk324.x, this->unk324.y, this->unk324.z, MTXMODE_NEW);
Matrix_RotateYS(this->unk330.y, MTXMODE_APPLY);
@@ -1416,28 +1433,32 @@ void Boss05_Draw(Actor* thisx, PlayState* play) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
- SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
- func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime20.skeleton, this->skelAnime20.jointTable,
+ this->skelAnime20.dListCount, func_809F1284, func_809F12A0, func_809F135C,
+ &this->dyna.actor);
- Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180, this->unk184,
- this->unk189);
- } else if (this->dyna.actor.params == 4) {
+ Actor_DrawDamageEffects(play, &this->dyna.actor, this->limbPos, ARRAY_COUNT(this->limbPos),
+ this->drawDmgEffScale, this->dmgEffFrozenSteamScale, this->drawDmgEffAlpha,
+ this->drawDmgEffType);
+ } else if (this->dyna.actor.params == BIO_DEKU_BABA_TYPE_4) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
- if (this->unk16C & 1) {
+ if ((this->unk16C % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
}
- SkelAnime_DrawTransformFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
- func_809F1284, func_809F12A0, func_809F135C, &this->dyna.actor);
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime20.skeleton, this->skelAnime20.jointTable,
+ this->skelAnime20.dListCount, func_809F1284, func_809F12A0, func_809F135C,
+ &this->dyna.actor);
- Actor_DrawDamageEffects(play, &this->dyna.actor, &this->unk18C, 1, this->unk17C, this->unk180, this->unk184,
- this->unk189);
- } else if (this->dyna.actor.params >= 10) {
+ Actor_DrawDamageEffects(play, &this->dyna.actor, this->limbPos, ARRAY_COUNT(this->limbPos),
+ this->drawDmgEffScale, this->dmgEffFrozenSteamScale, this->drawDmgEffAlpha,
+ this->drawDmgEffType);
+ } else if (this->dyna.actor.params >= BIO_DEKU_BABA_TYPE_10) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(D_06006240));
- SkelAnime_DrawFlexOpa(play, this->unk3C8.skeleton, this->unk3C8.jointTable, this->unk3C8.dListCount,
- func_809F14AC, func_809F1550, &this->dyna.actor);
+ SkelAnime_DrawFlexOpa(play, this->skelAnime20.skeleton, this->skelAnime20.jointTable,
+ this->skelAnime20.dListCount, func_809F14AC, func_809F1550, &this->dyna.actor);
}
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.h b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
index 4881b702d..adf8339a5 100644
--- a/src/overlays/actors/ovl_Boss_05/z_boss_05.h
+++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.h
@@ -7,72 +7,60 @@ struct Boss05;
typedef void (*Boss05ActionFunc)(struct Boss05*, PlayState*);
-// typedef struct Boss05 {
-// /* 0x000 */ DynaPolyActor dyna;
-// /* 0x15C */ char unk_15C[0x14];
-// /* 0x170 */ Boss05ActionFunc actionFunc;
-// /* 0x174 */ char unk_174[0x394];
-// } Boss05; // size = 0x508
+typedef enum {
+ /* 0 */ BIO_DEKU_BABA_TYPE_0,
+ /* 0 */ BIO_DEKU_BABA_TYPE_1,
+ /* 0 */ BIO_DEKU_BABA_TYPE_2,
+ /* 0 */ BIO_DEKU_BABA_TYPE_3,
+ /* 0 */ BIO_DEKU_BABA_TYPE_4,
+ /* 0 */ BIO_DEKU_BABA_TYPE_10 = 10, // Fragments?
+} BioDekuBabaType;
typedef struct Boss05 {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ u8 unk15C; /* inferred */
- /* 0x15D */ char pad15D[1];
/* 0x15E */ s16 unk15E; /* inferred */
/* 0x160 */ s16 unk160; /* inferred */
- /* 0x162 */ s16 unk162[3];
- /* 0x168 */ s16 unk168; /* inferred */
- /* 0x16A */ s16 unk16A; /* inferred */
- /* 0x16C */ s16 unk16C; /* inferred */
- /* 0x16E */ char pad16E[2];
+ /* 0x162 */ s16 unk162[3]; // timers
+ /* 0x168 */ s16 unk168; // timer
+ /* 0x16A */ s16 unk16A; // timer
+ /* 0x16C */ s16 unk16C; // timer
/* 0x170 */ Boss05ActionFunc actionFunc;
- /* 0x174 */ u8 unk174; /* inferred */
- /* 0x175 */ char pad175[1];
- // /* 0x174 */ char pad174[2]; // possibly this is a Vec3s
+ /* 0x174 */ u8 unk174;
/* 0x176 */ s16 unk176;
/* 0x178 */ s16 unk178;
- /* 0x17A */ s16 unk17A; /* inferred */
- /* 0x17C */ f32 unk17C; /* inferred */
- /* 0x180 */ f32 unk180; /* inferred */
- /* 0x184 */ f32 unk184; /* inferred */
- /* 0x188 */ u8 unk188; /* inferred */
- /* 0x189 */ u8 unk189; /* inferred */
- /* 0x18A */ char pad18A[2]; /* maybe part of unk189[3]? */
- /* 0x18C */ Vec3f unk18C;
+ /* 0x17A */ s16 unk17A; // timer
+ /* 0x17C */ f32 drawDmgEffScale;
+ /* 0x180 */ f32 dmgEffFrozenSteamScale;
+ /* 0x184 */ f32 drawDmgEffAlpha;
+ /* 0x188 */ u8 drawDmgEffState; // A bit more than just type, possibly we should name it as an internal type?
+ /* 0x189 */ u8 drawDmgEffType;
+ /* 0x18C */ Vec3f limbPos[1];
/* 0x198 */ f32 unk198;
/* 0x19C */ s16 unk19C;
- /* 0x19E */ Vec3s unk19E[1];
- // /* 0x1A0 */ s16 unk1A0;
- // /* 0x1A2 */ s16 unk1A2;
- /* 0x1A4 */ char pad1A4[0x24]; // Some number of other Vec3s in here
- /* 0x1C8 */ ColliderJntSph unk1C8; /* inferred */
- /* 0x1E8 */ ColliderJntSphElement unk1E8[2];
- /* 0x268 */ SkelAnime unk268;
- /* 0x2AC */ Vec3s unk2AC[10];
- /* 0x2E8 */ Vec3s unk2E8[10];
- /* 0x324 */ Vec3f unk324;
- /* 0x330 */ Vec3s unk330; // ?
- /* 0x330 */ char unk336[0x2];
- /* 0x330 */ f32 unk338;
+ /* 0x19E */ Vec3s unk19E[7];
+ /* 0x1C8 */ ColliderJntSph collider2;
+ /* 0x1E8 */ ColliderJntSphElement colliderElements2[2];
+ /* 0x268 */ SkelAnime skelAnime10;
+ /* 0x2AC */ Vec3s jointTable10[10];
+ /* 0x2E8 */ Vec3s morphTable10[10];
+ /* 0x324 */ Vec3f unk324; // pos used for spawning and drawing
+ /* 0x330 */ Vec3s unk330; // rotation used for spawning and drawing
+ /* 0x338 */ f32 unk338;
/* 0x33C */ Vec3f unk33C;
/* 0x348 */ s16 unk348;
- /* 0x34A */ char unk34A[0x2];
- /* 0x34C */ f32 unk34C;
- /* 0x350 */ char unk350[0x4];
- /* 0x35C */ f32 unk354;
+ /* 0x34C */ Vec3f unk34C;
/* 0x35C */ f32 unk358;
/* 0x35C */ f32 unk35C;
/* 0x360 */ f32 unk360;
/* 0x364 */ f32 unk364;
- /* 0x368 */ ColliderJntSph unk368;
- /* 0x388 */ ColliderJntSphElement unk388[1];
- /* 0x3C8 */ SkelAnime unk3C8;
- /* 0x40C */ Vec3s unk40C[20];
- /* 0x484 */ Vec3s unk484[20];
- /* 0x4FC */ f32 unk4FC; /* inferred */
- /* 0x500 */ s16 unk500; /* inferred */
- /* 0x502 */ s16 unk502; /* inferred */
- /* 0x504 */ char pad504[4]; /* maybe part of unk502[3]? */
+ /* 0x368 */ ColliderJntSph collider1;
+ /* 0x388 */ ColliderJntSphElement colliderElements1[1];
+ /* 0x3C8 */ SkelAnime skelAnime20;
+ /* 0x40C */ Vec3s jointTable20[20];
+ /* 0x484 */ Vec3s morphTable20[20];
+ /* 0x4FC */ f32 lastAnimFrame;
+ /* 0x500 */ Vec3s unk500;
} Boss05; // size = 0x508
From 8848fd817049715496216003c17b0a287af8ef4d Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Wed, 5 Oct 2022 02:09:51 +0100
Subject: [PATCH 14/51] En_Knight matching
---
include/functions.h | 4 +-
spec | 4 +-
.../actors/ovl_En_Knight/z_en_knight.c | 4061 +++++++++++++++--
.../actors/ovl_En_Knight/z_en_knight.h | 106 +-
tools/m2ctx.py | 2 +-
tools/sfxconvert.py | 6 +
6 files changed, 3911 insertions(+), 272 deletions(-)
diff --git a/include/functions.h b/include/functions.h
index 63f9eadd8..40c0ef454 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -556,7 +556,7 @@ void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0);
void EffectSsHitmark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos);
void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos);
// void EffectSsFhgFlash_SpawnShock(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5);
-// void EffectSsKFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6);
+void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type);
void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected, s16 drawFlag);
void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList);
// void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6);
@@ -2626,7 +2626,7 @@ void Play_ClearCamera(PlayState* play, s16 camId);
Camera* Play_GetCamera(PlayState* play, s16 index);
s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye);
void Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up);
-void Play_CameraSetFov(PlayState* play, s16 camId, f32 fov);
+s32 Play_CameraSetFov(PlayState* play, s16 camId, f32 fov);
void Play_CameraSetRoll(PlayState* play, s16 camId, s16 roll);
void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId);
// void func_80169A50(void);
diff --git a/spec b/spec
index 231da54ae..233aab9fc 100644
--- a/spec
+++ b/spec
@@ -2284,9 +2284,7 @@ beginseg
name "ovl_En_Knight"
compress
include "build/src/overlays/actors/ovl_En_Knight/z_en_knight.o"
- include "build/data/ovl_En_Knight/ovl_En_Knight.data.o"
- include "build/data/ovl_En_Knight/ovl_En_Knight.bss.o"
- include "build/data/ovl_En_Knight/ovl_En_Knight.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Knight/ovl_En_Knight_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c
index 095ca5a98..955a7c29e 100644
--- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c
+++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c
@@ -5,6 +5,8 @@
*/
#include "z_en_knight.h"
+#include "overlays/actors/ovl_Mir_Ray3/z_mir_ray3.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -15,37 +17,84 @@ void EnKnight_Destroy(Actor* thisx, PlayState* play);
void EnKnight_Update(Actor* thisx, PlayState* play);
void EnKnight_Draw(Actor* thisx, PlayState* play);
+void func_809BD1AC(Actor* thisx, PlayState* play);
+void func_809BD29C(Actor* thisx, PlayState* play);
+
void func_809B331C(EnKnight* this, PlayState* play);
+void func_809B3394(EnKnight* this, PlayState* play);
void func_809B33F0(EnKnight* this, PlayState* play);
+void func_809B35BC(EnKnight* this, PlayState* play);
void func_809B3618(EnKnight* this, PlayState* play);
+void func_809B37C8(EnKnight* this, PlayState* play);
void func_809B3834(EnKnight* this, PlayState* play);
+void func_809B389C(EnKnight* this, PlayState* play);
void func_809B3958(EnKnight* this, PlayState* play);
void func_809B3B94(EnKnight* this, PlayState* play);
+void func_809B3DAC(EnKnight* this, PlayState* arg1);
+void func_809B3E9C(EnKnight* this, PlayState* arg1);
+void func_809B3F0C(EnKnight* this, PlayState* arg1);
void func_809B40E8(EnKnight* this, PlayState* play);
+void func_809B41D8(EnKnight* this, PlayState* arg1);
void func_809B41F8(EnKnight* this, PlayState* play);
+void func_809B42B8(EnKnight* this, PlayState* play);
void func_809B4308(EnKnight* this, PlayState* play);
+void func_809B4880(EnKnight* this, PlayState* play);
void func_809B4C58(EnKnight* this, PlayState* play);
void func_809B4ED8(EnKnight* this, PlayState* play);
void func_809B5058(EnKnight* this, PlayState* play);
void func_809B52E8(EnKnight* this, PlayState* play);
void func_809B5698(EnKnight* this, PlayState* play);
void func_809B58D4(EnKnight* this, PlayState* play);
+void func_809B59FC(EnKnight* this, PlayState* play);
void func_809B5B08(EnKnight* this, PlayState* play);
void func_809B5D54(EnKnight* this, PlayState* play);
void func_809B5ED0(EnKnight* this, PlayState* play);
void func_809B601C(EnKnight* this, PlayState* play);
+void func_809B631C(EnKnight* this, PlayState* play);
+void func_809B6528(EnKnight* this, PlayState* play);
void func_809B6764(EnKnight* this, PlayState* play);
+void func_809B6C04(EnKnight* this, PlayState* play);
void func_809B6C54(EnKnight* this, PlayState* play);
void func_809B6D94(EnKnight* this, PlayState* play);
+void func_809B6EC8(EnKnight* this, PlayState* arg1);
void func_809B6F40(EnKnight* this, PlayState* play);
+void func_809B7190(EnKnight* this, PlayState* play);
void func_809B71DC(EnKnight* this, PlayState* play);
void func_809B7778(EnKnight* this, PlayState* play);
void func_809B7950(EnKnight* this, PlayState* play);
+void func_809B842C(EnKnight* this, PlayState* play);
void func_809B8458(EnKnight* this, PlayState* play);
+void func_809BA058(EnKnight* this, PlayState* play);
void func_809BA0CC(EnKnight* this, PlayState* play);
+void func_809BA940(EnKnight* this, PlayState* play);
void func_809BA978(EnKnight* this, PlayState* play);
-#if 0
+void func_809BD490(EnKnight* this, PlayState* play);
+void func_809BD858(EnKnight* this, PlayState* play);
+
+void func_809B329C(EnKnight* this, PlayState* play, s32 arg2);
+void func_809B4024(EnKnight* this, PlayState* play, s16 arg2);
+void func_809B47EC(EnKnight* this, PlayState* play, u8 arg2);
+
+typedef struct {
+ Vec3f unk0;
+ Vec3f unkC;
+ Vec3f unk18;
+ char unk24[0x6];
+ u8 unk2A;
+ s16 unk2C;
+ s16 unk2E;
+ s16 unk30;
+ f32 unk34;
+ f32 unk38;
+} EnKnightEffect; // size = 0x38
+
+Vec3f D_809BDAF0 = { 0.0f, 0.0f, 0.0f };
+
+u8 D_809BDAFC = 0;
+
+u8 D_809BDB00 = 0;
+
// static DamageTable sDamageTable = {
static DamageTable D_809BDB04 = {
/* Deku Nut */ DMG_ENTRY(0, 0x1),
@@ -121,77 +170,176 @@ static DamageTable D_809BDB24 = {
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
static ColliderJntSphElementInit D_809BDB44[1] = {
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 27 }, 100 },
},
};
-// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_809BDB8C = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809BDB44, // sJntSphElementsInit,
-};
-
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
static ColliderJntSphElementInit D_809BDB68[1] = {
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x10 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 32 }, 100 },
},
};
+// static ColliderJntSphInit sJntSphInit = {
+static ColliderJntSphInit D_809BDB8C = {
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809BDB44),
+ D_809BDB44, // sJntSphElementsInit,
+};
+
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_809BDB9C = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809BDB68, // sJntSphElementsInit,
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809BDB68),
+ D_809BDB68, // sJntSphElementsInit,
};
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
static ColliderJntSphElementInit D_809BDBAC[1] = {
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 27 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_809BDBD0 = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809BDBAC, // sJntSphElementsInit,
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809BDBAC),
+ D_809BDBAC, // sJntSphElementsInit,
};
// static ColliderJntSphElementInit sJntSphElementsInit[2] = {
static ColliderJntSphElementInit D_809BDBE0[2] = {
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7EFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7EFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_HOOKABLE,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 15 }, 100 },
},
{
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7EFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0xF7EFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_HOOKABLE,
+ OCELEM_ON,
+ },
{ 1, { { 0, 0, 0 }, 17 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_809BDC28 = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_809BDBE0, // sJntSphElementsInit,
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(D_809BDBE0),
+ D_809BDBE0, // sJntSphElementsInit,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_809BDC38 = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x10 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 15, 20, -10, { 0, 0, 0 } },
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_809BDC64 = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ALL, AC_ON | AC_TYPE_PLAYER | AC_TYPE_ENEMY | AC_TYPE_OTHER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7FFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ALL,
+ AC_ON | AC_TYPE_PLAYER | AC_TYPE_ENEMY | AC_TYPE_OTHER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK3,
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ { 0xF7FFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 20, 40, 0, { 0, 0, 0 } },
};
+Color_RGBA8 D_809BDC90 = { 60, 50, 20, 255 };
+
+Color_RGBA8 D_809BDC94 = { 40, 30, 30, 255 };
+
const ActorInit En_Knight_InitVars = {
ACTOR_EN_KNIGHT,
ACTORCAT_BOSS,
@@ -204,237 +352,3638 @@ const ActorInit En_Knight_InitVars = {
(ActorFunc)EnKnight_Draw,
};
-#endif
-
-extern DamageTable D_809BDB04;
-extern DamageTable D_809BDB24;
-extern ColliderJntSphElementInit D_809BDB44[1];
-extern ColliderJntSphInit D_809BDB8C;
-extern ColliderJntSphElementInit D_809BDB68[1];
-extern ColliderJntSphInit D_809BDB9C;
-extern ColliderJntSphElementInit D_809BDBAC[1];
-extern ColliderJntSphInit D_809BDBD0;
-extern ColliderJntSphElementInit D_809BDBE0[2];
-extern ColliderJntSphInit D_809BDC28;
-extern ColliderCylinderInit D_809BDC38;
-extern ColliderCylinderInit D_809BDC64;
-
-extern UNK_TYPE D_060005A8;
-extern UNK_TYPE D_06001CDC;
-extern UNK_TYPE D_06002174;
-extern UNK_TYPE D_06003008;
-extern UNK_TYPE D_060031F0;
-extern UNK_TYPE D_06003650;
-extern UNK_TYPE D_060040E0;
-extern UNK_TYPE D_06004620;
-extern UNK_TYPE D_06004974;
-extern UNK_TYPE D_060079D4;
-extern UNK_TYPE D_06008524;
-extern UNK_TYPE D_06008D80;
-extern UNK_TYPE D_06009538;
-extern UNK_TYPE D_06009D8C;
-extern UNK_TYPE D_0600A530;
-extern UNK_TYPE D_0600AFAC;
-extern UNK_TYPE D_0600B5D4;
-extern UNK_TYPE D_0600BCF4;
-extern UNK_TYPE D_0600CDE0;
-extern UNK_TYPE D_0600DDCC;
-extern UNK_TYPE D_0600EA90;
-extern UNK_TYPE D_0600EF44;
-extern UNK_TYPE D_06010E98;
-extern UNK_TYPE D_06011298;
-extern UNK_TYPE D_06013020;
-extern UNK_TYPE D_06018BC4;
-extern UNK_TYPE D_06020950;
-extern UNK_TYPE D_06022728;
-extern UNK_TYPE D_06022CAC;
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B20F0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B21F4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B22CC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/EnKnight_Init.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/EnKnight_Destroy.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B2DD0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B2F54.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B316C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B31E8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B329C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B331C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3394.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B33F0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B35BC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3618.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B37C8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3834.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B389C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3958.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3A7C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3B94.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3CD0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3DAC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3E9C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B3F0C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4024.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B40E8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B41D8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B41F8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B42B8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4308.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B47EC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4880.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4BFC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4C58.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4E84.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4ED8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B4F90.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5058.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B51DC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B52E8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5634.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5698.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B58D4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B592C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B59FC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5B08.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5D38.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5D54.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5E90.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5ED0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B5FA8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B601C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B631C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B638C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6528.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6574.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6764.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6C04.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6C54.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6D38.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6D94.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6EC8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B6F40.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B7190.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B71DC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B7708.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B7778.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B78A4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B7950.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B842C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B8458.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B9A18.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B9D24.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B9E00.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809B9F8C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BA058.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BA0CC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BA940.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BA978.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/EnKnight_Update.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BC2C4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BC67C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BC720.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BC8B4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BCA80.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BCAD8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BCB54.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BCB78.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/EnKnight_Draw.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BD1AC.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BD260.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BD29C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BD490.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Knight/func_809BD858.s")
+u16 D_809BDCB8[4] = { NA_SE_EN_BOSU_WALK, NA_SE_EN_YASE_WALK, NA_SE_EN_DEBU_WALK, 0 };
+u16 D_809BDCC0[4] = { NA_SE_EN_BOSU_LAUGH_K, NA_SE_EN_YASE_PAUSE_K, NA_SE_EN_DEBU_PAUSE_K, 0 };
+u16 D_809BDCC8[4] = { NA_SE_EN_BOSU_LAUGH_K, NA_SE_EN_YASE_LAUGH_K, NA_SE_EN_DEBU_LAUGH_K, 0 };
+u16 D_809BDCD0[4] = { NA_SE_EN_BOSU_ATTACK_W, NA_SE_EN_YASE_ATTACK_W, NA_SE_EN_DEBU_ATTACK_W, 0 };
+u16 D_809BDCD8[4] = { NA_SE_EN_BOSU_DAMAGE, NA_SE_EN_YASE_DAMAGE, NA_SE_EN_DEBU_DAMAGE, 0 };
+u16 D_809BDCE0[4] = { NA_SE_EN_BOSU_DEAD, NA_SE_EN_YASE_DEAD, NA_SE_EN_DEBU_DEAD, 0 };
+u16 D_809BDCE8[4] = { NA_SE_EN_BOSU_DEAD_VOICE, NA_SE_EN_YASE_DEAD_VOICE, NA_SE_EN_DEBU_DEAD_VOICE, 0 };
+
+Color_RGBA8 D_809BDCF0 = { 60, 50, 20, 255 };
+
+Color_RGBA8 D_809BDCF4 = { 40, 30, 30, 255 };
+
+Color_RGBA8 D_809BDCF8 = { 170, 255, 255, 255 };
+
+Color_RGBA8 D_809BDCFC = { 200, 200, 255, 255 };
+
+Vec3f D_809BDD00 = { 0.0f, -1.0f, 0.0f };
+
+Vec3f D_809BDD0C = { 100.0f, 0.0f, 0.0f };
+
+Vec3f D_809BDD18 = { 0.0f, 600.0f, 0.0f };
+
+Vec3f D_809BDD24 = { 0.0f, 600.0f, 1000.0f };
+
+Vec3f D_809BDD30 = { 1000.0f, 0.0f, 0.0f };
+
+s8 D_809BDD3C[0x20] = {
+ -1, -1, -1, -1, 3, 4, 5, -1, -1, 6, 7, 8, -1, -1, -1, -1, -1, -1, 0, -1, 1, 2, -1, 9, 10, 11, 12, 13, 14, -1, 0, 0,
+};
+
+Vec3f D_809BDD5C = { 300.0f, 500.0f, 0.0f };
+
+Vec3f D_809BDD68 = { 1000.0f, 0.0f, 0.0f };
+
+Vec3f D_809BDD74 = { 700.0f, -500.0f, 0.0f };
+
+Vec3f D_809BDD80 = { 300.0f, 500.0f, 0.0f };
+
+EnKnight* D_809BEFD0;
+EnKnight* D_809BEFD4;
+EnKnight* D_809BEFD8;
+EnKnight* D_809BEFDC;
+EnKnight* D_809BEFE0;
+MirRay3* D_809BEFE4;
+EnKnightEffect D_809BEFE8[100];
+
+// object
+
+extern AnimationHeader D_060005A8;
+extern AnimationHeader D_060009E0;
+extern AnimationHeader D_06000D9C;
+extern AnimationHeader D_06001CDC;
+extern AnimationHeader D_06002174;
+extern AnimationHeader D_06003008;
+extern AnimationHeader D_060031F0;
+extern AnimationHeader D_06003650;
+extern AnimationHeader D_060040E0;
+extern AnimationHeader D_06004620;
+extern AnimationHeader D_06004974;
+extern AnimationHeader D_06005D30;
+extern AnimationHeader D_060079D4;
+extern AnimationHeader D_06008390;
+extern AnimationHeader D_06008524;
+extern AnimationHeader D_060089E4;
+extern AnimationHeader D_06008D80;
+extern AnimationHeader D_06009538;
+extern AnimationHeader D_06009D8C;
+extern AnimationHeader D_0600A530;
+extern AnimationHeader D_0600AFAC;
+extern AnimationHeader D_0600B5D4;
+extern AnimationHeader D_0600BCF4;
+extern AnimationHeader D_0600C384;
+extern AnimationHeader D_0600CDE0;
+extern AnimationHeader D_0600DDCC;
+extern AnimationHeader D_0600E15C;
+extern AnimationHeader D_0600E45C;
+extern AnimationHeader D_0600EA90;
+extern AnimationHeader D_0600EF44;
+extern AnimationHeader D_06010E98;
+extern AnimationHeader D_06011298;
+extern AnimationHeader D_06005E78;
+extern AnimationHeader D_06006754;
+extern AnimationHeader D_06006EF8;
+extern AnimationHeader D_0600A88C;
+extern AnimationHeader D_0600C7F0;
+extern AnimationHeader D_0600D870;
+extern AnimationHeader D_0600E7F4;
+extern AnimationHeader D_0600FC78;
+extern AnimationHeader D_0601024C;
+extern AnimationHeader D_0602105C;
+extern AnimationHeader D_06021B10;
+extern AnimationHeader D_06021E34;
+extern Gfx D_06013020[];
+extern Gfx D_06012DB0[];
+extern Gfx D_06012400[];
+extern AnimatedMaterial D_06018BC4;
+extern AnimationHeader D_06020950;
+extern AnimationHeader D_06022728;
+extern AnimationHeader D_06022CAC;
+extern FlexSkeletonHeader D_06020374;
+extern FlexSkeletonHeader D_060201A8;
+extern Gfx D_060188F8[];
+extern Gfx D_060189F0[];
+extern Gfx D_06018AF0[];
+
+extern Gfx D_08000000[];
+
+void func_809B20F0(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, f32 arg5, s16 arg6) {
+ s16 i;
+ EnKnightEffect* eff;
+
+ for (eff = play->specialEffects, i = 0; i < 100; i++, eff++) {
+ if (eff->unk2A == 0) {
+ eff->unk2A = 1;
+ eff->unk0 = *arg1;
+ eff->unkC = *arg2;
+ eff->unk18 = *arg3;
+ eff->unk30 = 0;
+ eff->unk34 = (BREG(50) * 0.0001f + 0.001f) * arg4;
+ eff->unk38 = (BREG(51) * 0.0001f + 0.001f) * arg5;
+ eff->unk2E = arg6;
+ eff->unk2C = 0;
+ return;
+ }
+ }
+}
+
+void func_809B21F4(EnKnight* this, s32 arg1, ColliderJntSph* jntSph, Vec3f* pos) {
+ f32 var_fv0 = (this == D_809BEFD0) ? 1.3076924f : 1.0f;
+
+ if (this->actionFunc == func_809B52E8) {
+ var_fv0 *= 2.0f;
+ }
+
+ jntSph->elements[arg1].dim.worldSphere.center.x = pos->x;
+ jntSph->elements[arg1].dim.worldSphere.center.y = pos->y;
+ jntSph->elements[arg1].dim.worldSphere.center.z = pos->z;
+ jntSph->elements[arg1].dim.worldSphere.radius =
+ jntSph->elements[arg1].dim.modelSphere.radius * var_fv0 * jntSph->elements[arg1].dim.scale;
+}
+
+void func_809B22CC(EnKnight* this, PlayState* play, u8 arg2) {
+ u8 i;
+ Vec3f pos;
+ Vec3f vel;
+ Vec3f acc;
+
+ if (!(this->unk146 & arg2) && this->unk162 == 0 &&
+ (this->unk2A4 > 1.0f || this->unk2A8 > 1.0f || arg2 == 0 || this->actor.speedXZ > 1.0f)) {
+ for (i = 0; i < 2; i++) {
+ vel.x = randPlusMinusPoint5Scaled(3.0f);
+ vel.y = Rand_ZeroFloat(1.0f);
+ vel.z = randPlusMinusPoint5Scaled(3.0f);
+ acc.y = -0.1f;
+ acc.x = acc.z = 0.0f;
+ pos.x = this->unk2AC[i].x + randPlusMinusPoint5Scaled(10.0f);
+ pos.y = (Rand_ZeroFloat(5.0f) + this->actor.floorHeight) - 5.0f;
+ pos.z = this->unk2AC[i].z + randPlusMinusPoint5Scaled(10.0f);
+ func_800B0EB0(play, &pos, &vel, &acc, &D_809BDC90, &D_809BDC94, Rand_ZeroFloat(80.0f) + 150.0f, 10,
+ Rand_ZeroFloat(5.0f) + 14.0f);
+ }
+ }
+}
+
+void EnKnight_Init(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+ s32 pad;
+ s32 temp_v0_2;
+
+ this->actor.targetMode = 5;
+ this->actor.colChkInfo.mass = 0xFE;
+ this->actor.colChkInfo.damageTable = &D_809BDB04;
+ this->unk17C = 255.0f;
+ this->unk146 = Rand_ZeroFloat(1000.0f);
+ this->actor.flags |= 0x400;
+
+ if (this->actor.params == 0x64) {
+ ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f);
+ SkelAnime_InitFlex(play, &this->unk194, &D_060201A8, &D_06003008, this->unk2C4, this->unk372, 29);
+ Actor_SetScale(&this->actor, KREG(12) * 0.001f + 0.017f);
+ func_809BA058(this, play);
+ Collider_InitAndSetCylinder(play, &this->unk488, &this->actor, &D_809BDC38);
+ Collider_InitAndSetCylinder(play, &this->unk634, &this->actor, &D_809BDC64);
+ this->actor.colChkInfo.health = 0xA - BREG(40);
+ } else if (this->actor.params >= 0xC8) {
+ this->actor.update = func_809BD1AC;
+ this->actor.draw = func_809BD29C;
+ this->actor.flags &= ~1;
+ if (1) {}
+ if (this->actor.params == 0xC8) {
+ SkelAnime_InitFlex(play, &this->unk194, &D_06020374, &D_060040E0, this->unk2C4, this->unk372, 0x1D);
+ Actor_SetScale(&this->actor, KREG(13) * 0.001f + 0.013f);
+ } else {
+ SkelAnime_InitFlex(play, &this->unk194, &D_060201A8, &D_060040E0, this->unk2C4, this->unk372, 0x1D);
+ Actor_SetScale(&this->actor, KREG(13) * 0.001f + 0.017f);
+ }
+ if (this->actor.params == 0xCA) {
+ this->unk17C = BREG(79) + 100.0f;
+ } else {
+ this->unk17C = BREG(77) + 120.0f;
+ }
+ } else {
+ this->actor.hintId = 0x16;
+ ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f);
+ Collider_InitAndSetJntSph(play, &this->unk534, &this->actor, &D_809BDBD0, this->unk554);
+ Collider_InitAndSetJntSph(play, &this->unk594, &this->actor, &D_809BDC28, this->unk5B4);
+ if (this->actor.params == 0x23) {
+ Collider_InitAndSetJntSph(play, &this->unk4D4, &this->actor, &D_809BDB8C, this->unk4F4);
+ SkelAnime_InitFlex(play, &this->unk194, &D_06020374, &D_060040E0, this->unk2C4, this->unk372, 0x1D);
+ this->actor.colChkInfo.health = 6 - BREG(40);
+ Actor_SetScale(&this->actor, KREG(13) * 0.001f + 0.013f);
+ } else {
+ Collider_InitAndSetJntSph(play, &this->unk4D4, &this->actor, &D_809BDB9C, this->unk4F4);
+ SkelAnime_InitFlex(play, &this->unk194, &D_060201A8, &D_060040E0, this->unk2C4, this->unk372, 0x1D);
+ this->actor.colChkInfo.health = 0xE - BREG(41);
+ Actor_SetScale(&this->actor, KREG(12) * 0.001f + 0.017f);
+ this->unk290 = Rand_ZeroFloat(1.9999f);
+ }
+ this->unk18E = 3;
+ this->unk180 = 180.0f;
+ temp_v0_2 = D_809BDAFC & 3;
+ D_809BDAFC++;
+ this->unk6B4 = D_809BDCB8[temp_v0_2];
+ this->unk6B6 = D_809BDCC0[temp_v0_2];
+ this->unk6B8 = D_809BDCC8[temp_v0_2];
+ this->unk6BC = D_809BDCD0[temp_v0_2];
+ this->unk6BE = D_809BDCD8[temp_v0_2];
+ this->unk6C0 = D_809BDCE0[temp_v0_2];
+ this->unk6C2 = D_809BDCE8[temp_v0_2];
+ if (this->actor.params != 0x23) {
+ s32 i;
+ play->specialEffects = D_809BEFE8;
+
+ for (i = 0; i < ARRAY_COUNT(D_809BEFE8); i++) {
+ D_809BEFE8[i].unk2A = 0;
+ }
+
+ D_809BEFD0 = this;
+ D_809BEFE0 = NULL;
+ D_809BEFDC = NULL;
+ this->actor.shape.rot.y = -0x4000;
+ D_809BEFD4 =
+ (EnKnight*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KNIGHT, 1398.0f, 66.0f, 2730.0f,
+ this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0x23);
+ D_809BEFD8 =
+ (EnKnight*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KNIGHT, 1398.0f, 66.0f, 2969.0f,
+ this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0x23);
+ Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x12E, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0);
+ Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, 0x12E, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1);
+ }
+ if ((gSaveContext.eventInf[5] & 0x80) && !Flags_GetClear(play, play->roomCtx.currRoom.num)) {
+ if (this == D_809BEFD0) {
+ this->actor.world.pos.x = BREG(27) + 1376.0f;
+ this->actor.world.pos.y = 45.0f;
+ this->actor.world.pos.z = BREG(28) + 2864.0f;
+ func_809B6528(this, play);
+ this->unk194.curFrame = 25.0f;
+ this->actor.flags &= ~1;
+ D_809BDB00 = KREG(83) + 0x28;
+ } else {
+ func_809B3E9C(this, play);
+ this->unk152 = 1;
+ this->unk46C = this->unk470 = 1.0f;
+ this->actor.gravity = -1.5f;
+ this->unk6B0 = 60.0f;
+ }
+ play->envCtx.lightSettingOverride = 7;
+ return;
+ }
+ func_809B631C(this, play);
+ play->envCtx.lightSettingOverride = 0;
+ }
+}
+
+void EnKnight_Destroy(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+}
+
+void func_809B2DD0(EnKnight* this, PlayState* play) {
+ Player* player;
+ Actor* explosive;
+ f32 px;
+ f32 pz;
+ f32 dx;
+ f32 dz;
+
+ if (this->unk162 == 0) {
+ player = GET_PLAYER(play);
+
+ explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first;
+ while (explosive != NULL) {
+ px = this->actor.world.pos.x;
+ pz = this->actor.world.pos.z;
+ dx = explosive->world.pos.x - px;
+ dz = explosive->world.pos.z - pz;
+ if (sqrtf(SQ(dx) + SQ(dz)) < 100.0f) {
+ this->unk440.x = px - dx * 100.0f;
+ this->unk440.z = pz - dz * 100.0f;
+ func_809B47EC(this, play, 0);
+ }
+ explosive = explosive->next;
+ }
+
+ if (D_809BEFE4 != NULL && D_809BEFE4->unk_214 > 0.1f && this->actor.xzDistToPlayer <= (BREG(70) + 300.0f)) {
+ px = this->actor.world.pos.x;
+ pz = this->actor.world.pos.z;
+ dx = player->actor.world.pos.x - px;
+ dz = player->actor.world.pos.z - pz;
+ this->unk440.x = px - dx * 100.0f;
+ this->unk440.z = pz - dz * 100.0f;
+ func_809B47EC(this, play, 1);
+ }
+ }
+}
+
+s32 func_809B2F54(EnKnight* this, PlayState* play) {
+ f32 var_fv0;
+ s32 sp20 = false;
+ Player* player = GET_PLAYER(play);
+
+ var_fv0 = (this == D_809BEFD0) ? 1.3076924f : 1.0f;
+
+ if (this->actor.xzDistToPlayer <= 90.0f * var_fv0 && !(this->unk146 & 7)) {
+ if (Rand_ZeroOne() < 0.5f && D_809BEFDC != (EnKnight*)player->actor.parent) {
+ func_809B389C(this, play);
+ } else if (Rand_ZeroOne() < 0.5f) {
+ func_809B329C(this, play, false);
+ } else {
+ func_809B35BC(this, play);
+ }
+ sp20 = true;
+ }
+
+ if (this == D_809BEFD0 && this->unk162 == 0 && (this->unk14A[2] == 0 || BREG(15) == 1)) {
+ if (KREG(71) + 100.0f < this->actor.xzDistToPlayer) {
+ sp20 = true;
+ if (this->actor.xzDistToPlayer < KREG(72) + 300.0f) {
+ if (Rand_ZeroOne() > 0.5f) {
+ func_809B6EC8(this, play);
+ } else {
+ func_809B6C04(this, play);
+ }
+ } else {
+ func_809B6C04(this, play);
+ }
+ }
+ }
+ return sp20;
+}
+
+s32 func_809B316C(EnKnight* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ s16 temp_v1 = this->unk172;
+ s16 var_a0 = temp_v1 - this->actor.shape.rot.y;
+
+ if (ABS_ALT(var_a0) < 0x3000) {
+ s16 var_a0 = temp_v1 - (s16)(player->actor.shape.rot.y + 0x8000);
+ s32 var_v0 = ABS_ALT(var_a0);
+
+ if (var_v0 < 0x3000) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+s32 func_809B31E8(EnKnight* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ s16 var_v1 = this->unk172 - (s16)(player->actor.focus.rot.y + 0x8000);
+
+ if (ABS_ALT(var_v1) < (s16)(KREG(91) * 0x100 + 0x400)) {
+ s16 var_a1 = (s16) - this->unk170 - player->actor.focus.rot.x;
+ s32 var_v0 = ABS_ALT(var_a1);
+
+ if (var_v0 < (s16)(KREG(92) * 0x100 + 0x300)) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void func_809B329C(EnKnight* this, PlayState* play, s32 arg2) {
+ Animation_MorphToLoop(&this->unk194, &D_06020950, -5.0f);
+ this->actionFunc = func_809B331C;
+ if (this == D_809BEFD0) {
+ if (arg2) {
+ this->unk14A[0] = 0;
+ } else {
+ this->unk14A[0] = 6;
+ }
+ } else {
+ this->unk14A[0] = 15;
+ }
+}
+
+void func_809B331C(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0x500);
+ if (this->unk14A[0] == 0) {
+ func_809B3394(this, play);
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+}
+
+void func_809B3394(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06011298, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06011298);
+ this->actionFunc = func_809B33F0;
+}
+
+void func_809B33F0(EnKnight* this, PlayState* play) {
+ Vec3f sp2C;
+
+ this->unk186 = 0;
+ if (this->unk194.curFrame >= 3.0f && this->unk194.curFrame <= 6.0f) {
+ this->unk450 = 255.0f;
+ this->unk454 = -19.0f;
+ this->unk458 = 46.0f;
+ this->unk45C = 17.0f;
+ this->unk460 = -0.5497787f;
+ this->unk464 = 2.9059734f;
+ this->unk468 = -1.1780972f;
+ }
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk194.curFrame >= 2.0f && this->unk194.curFrame <= 5.0f) {
+ Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_NEW);
+ Matrix_MultVecZ(5.0f, &sp2C);
+ this->unk2A4 = sp2C.x;
+ this->unk2A8 = sp2C.z;
+ }
+ if (Animation_OnFrame(&this->unk194, 1.0f)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6BC);
+ }
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ if (Rand_ZeroOne() < 0.5f && this->actor.xzDistToPlayer <= 100.0f) {
+ func_809B35BC(this, play);
+ } else {
+ func_809B3E9C(this, play);
+ }
+ }
+ this->unk190 = 1;
+}
+
+void func_809B35BC(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06022728, -5.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06022728);
+ this->actionFunc = func_809B3618;
+}
+
+void func_809B3618(EnKnight* this, PlayState* play) {
+ Vec3f sp2C;
+
+ this->unk186 = 0;
+ if (this == D_809BEFD0) {
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0x800);
+ }
+ if (this->unk194.curFrame >= 12.0f && this->unk194.curFrame <= 15.0f) {
+ this->unk450 = 255.0f;
+ this->unk454 = -20.0f;
+ this->unk458 = 47.0f;
+ this->unk45C = 0.0f;
+ this->unk460 = 3.1415927f;
+ this->unk464 = 0.f;
+ this->unk468 = 0.47123894f;
+ }
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk194.curFrame >= 12.0f && this->unk194.curFrame <= 15.0f) {
+ Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_NEW);
+ Matrix_MultVecZ(5.0f, &sp2C);
+ this->unk2A4 = sp2C.x;
+ this->unk2A8 = sp2C.z;
+ }
+ if (Animation_OnFrame(&this->unk194, 12.0f)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6BC);
+ }
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ func_809B37C8(this, play);
+ }
+ if (this->unk194.curFrame >= 12.0f) {
+ this->unk190 = 1;
+ }
+}
+
+void func_809B37C8(EnKnight* this, PlayState* play) {
+ Animation_MorphToLoop(&this->unk194, &D_06022CAC, 0.0f);
+ this->actionFunc = func_809B3834;
+ if (this == D_809BEFD0) {
+ this->unk14A[0] = 6;
+ } else {
+ this->unk14A[0] = 15;
+ }
+}
+
+void func_809B3834(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+}
+
+void func_809B389C(EnKnight* this, PlayState* play) {
+ if (Rand_ZeroOne() < 0.5f) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600C384, -2.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_0600C384);
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600BCF4, -2.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_0600BCF4);
+ }
+ this->actionFunc = func_809B3958;
+ this->unk14A[0] = 20;
+}
+
+void func_809B3958(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ if (Rand_ZeroOne() < 0.6f && this->actor.xzDistToPlayer <= 100.0f) {
+ if (Rand_ZeroOne() < 0.5f) {
+ func_809B389C(this, play);
+ } else {
+ func_809B329C(this, play, 0);
+ }
+ } else {
+ func_809B3E9C(this, play);
+ }
+ }
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 5, 0x500);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] == 16) {
+ this->unk190 = 1;
+ }
+}
+
+void func_809B3A7C(EnKnight* this, PlayState* play) {
+ s32 i;
+ Vec3f sp28;
+
+ if (this->actor.xzDistToPlayer <= 200.0f) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600AFAC, -3.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_0600AFAC);
+ this->actionFunc = func_809B3B94;
+ Matrix_RotateYS(this->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(49) + 7.0f, &sp28);
+ this->unk2A4 = sp28.x;
+ this->unk2A8 = sp28.z;
+ this->actor.velocity.y = 10.0f;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP);
+ this->unk14A[0] = 15;
+
+ for (i = 0; i < 5; i++) {
+ func_809B22CC(this, play, 0);
+ }
+ }
+}
+
+void func_809B3B94(EnKnight* this, PlayState* play) {
+ if (this->unk14A[0] >= 2 && this->unk14A[0] < 6) {
+ this->unk450 = 255.0f;
+ this->unk454 = -19.0f;
+ this->unk458 = 46.0f;
+ this->unk45C = 17.0f;
+ this->unk460 = -0.5497787f;
+ this->unk464 = 2.9059734f;
+ this->unk468 = -1.1780972f;
+ }
+ SkelAnime_Update(&this->unk194);
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600B5D4, 0.0f);
+ Actor_PlaySfxAtPos(&this->actor, this->unk6BC);
+ this->unk1D8 = 1000.0f;
+ }
+ this->actor.speedXZ = 0.0f;
+ if (this->actor.velocity.y <= 0.0f && this->actor.bgCheckFlags & 1) {
+ this->unk2A8 = 0.0f;
+ this->unk2A4 = 0.0f;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK);
+ }
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+ this->unk190 = 1;
+}
+
+void func_809B3CD0(EnKnight* this, PlayState* play) {
+ if (this == D_809BEFD0 && this->actor.xzDistToPlayer <= 120.0f && Rand_ZeroOne() < 0.1f) {
+ func_809B59FC(this, play);
+ return;
+ }
+ if (this->actionFunc != func_809B3DAC) {
+ this->unk424 = this->actionFunc;
+ Animation_MorphToPlayOnce(&this->unk194, &D_060031F0, -2.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_060031F0);
+ this->actionFunc = func_809B3DAC;
+ }
+ this->unk14A[0] = 5;
+}
+
+void func_809B3DAC(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0x800);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] != 0) {
+ this->unk191 = 1;
+ } else if (this->unk424 == func_809B4880) {
+ func_809B47EC(this, play, 1);
+ } else {
+ func_809B3E9C(this, play);
+ if (this == D_809BEFD0 && Rand_ZeroOne() < 0.4f) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_CYNICAL);
+ }
+ }
+ this->unk192 = 1;
+}
+
+void func_809B3E9C(EnKnight* this, PlayState* play) {
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ this->actionFunc = func_809B3F0C;
+ this->unk14A[0] = Rand_ZeroFloat(50.0f) + 20.0f;
+}
+
+void func_809B3F0C(EnKnight* this, PlayState* play) {
+ s16 temp_v1;
+ s32 var_a0;
+
+ SkelAnime_Update(&this->unk194);
+ temp_v1 = this->unk172 - this->actor.shape.rot.y;
+ var_a0 = (this == D_809BEFD0) ? 0x7FFF : 0x6000;
+ if (ABS_ALT(temp_v1) < var_a0) {
+ func_809B41D8(this, play);
+ } else {
+ if (!(this->unk146 & 7) && Rand_ZeroOne() < 0.75f) {
+ this->unk186 = randPlusMinusPoint5Scaled(28672.0f);
+ }
+ if (this->unk14A[0] == 0) {
+ func_809B4024(this, play, 0x4000);
+ }
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ this->unk192 = 1;
+}
+
+void func_809B4024(EnKnight* this, PlayState* play, s16 arg2) {
+ this->actionFunc = func_809B40E8;
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600EF44, -2.0f);
+ if (Rand_ZeroOne() < 0.5f) {
+ this->unk15A = this->actor.shape.rot.y + arg2;
+ this->unk186 = 0x3800;
+ } else {
+ this->unk15A = this->actor.shape.rot.y - arg2;
+ this->unk186 = -0x3800;
+ }
+ this->unk15C = (arg2 == 0x4000) ? 0 : 0x800;
+ this->unk14A[0] = 0x14;
+}
+
+void func_809B40E8(EnKnight* this, PlayState* play) {
+ s16 temp_v0;
+
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] < 0xF) {
+ Math_ApproachS(&this->actor.world.rot.y, this->unk15A, 2, this->unk15C);
+ Math_ApproachS(&this->unk15C, 0x800, 1, 0x200);
+ }
+ temp_v0 = this->unk172 - this->actor.shape.rot.y;
+ if (ABS_ALT(temp_v0) < 0x6000) {
+ func_809B41D8(this, play);
+ } else if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+ this->unk18C = 0x3000;
+ this->unk18E = 2;
+}
+
+void func_809B41D8(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B41F8;
+ this->unk14A[0] = 0xA;
+}
+
+void func_809B41F8(EnKnight* this, PlayState* play) {
+ s16 temp_v0;
+
+ SkelAnime_Update(&this->unk194);
+ temp_v0 = this->unk172 - this->actor.shape.rot.y;
+ if (temp_v0 > 0x3800) {
+ this->unk186 = 0x3800;
+ } else if (temp_v0 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v0;
+ }
+ if (this->unk14A[0] == 0) {
+ func_809B42B8(this, play);
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ this->unk18C = 0x3000;
+ this->unk18E = 2;
+ this->unk192 = 1;
+}
+
+void func_809B42B8(EnKnight* this, PlayState* play) {
+ Animation_MorphToLoop(&this->unk194, &D_06004620, -5.0f);
+ this->actionFunc = func_809B4308;
+ this->actor.speedXZ = 0.0f;
+}
+
+void func_809B4308(EnKnight* this, PlayState* play) {
+ f32 sp5C;
+ f32 dx;
+ f32 dz;
+ f32 var_fv0;
+ Vec3f sp44;
+ Vec3f sp38;
+ s16 temp_v0;
+ s16 sp34;
+ Player* player = GET_PLAYER(play);
+
+ SkelAnime_Update(&this->unk194);
+ if (!(this->unk146 & 0x3F) && Rand_ZeroOne() < 0.5f) {
+ if (Rand_ZeroOne() < 0.6666f) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B6);
+ } else {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B8);
+ }
+ }
+ if (this != D_809BEFD0 && this->actor.xzDistToPlayer > 150.0f) {
+ Matrix_RotateYS(player->actor.world.rot.y, MTXMODE_NEW);
+ if (this == D_809BEFD4) {
+ sp44.x = 100.0f;
+ } else {
+ sp44.x = -100.0f;
+ }
+ sp44.y = 0.0f;
+ sp44.z = 100.0f;
+ Matrix_MultVec3f(&sp44, &sp38);
+ this->unk440.x = player->actor.world.pos.x + sp38.x;
+ this->unk440.z = player->actor.world.pos.z + sp38.z;
+ dx = this->unk440.x - this->actor.world.pos.x;
+ dz = this->unk440.z - this->actor.world.pos.z;
+ sp34 = Math_FAtan2F(dz, dx);
+ } else {
+ sp34 = this->unk172;
+ }
+ Math_ApproachS(&this->actor.world.rot.y, sp34, 5, 0xA00);
+ Math_ApproachS(&this->actor.shape.rot.y, this->unk172, 5, 0x500);
+ sp5C = this->actor.speedXZ;
+ var_fv0 = (this == D_809BEFD0) ? 1.3076924f : 1.0f;
+ if (this->actor.xzDistToPlayer <= (150.0f * var_fv0)) {
+ if (this->actor.xzDistToPlayer <= (80.0f * var_fv0)) {
+ if (this->actor.xzDistToPlayer <= (40.0f * var_fv0)) {
+ Math_ApproachF(&this->actor.speedXZ, -2.5f, 1.0f, 1.0f);
+ } else {
+ Math_ApproachF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f);
+ }
+ } else {
+ Math_ApproachF(&this->actor.speedXZ, 2.5f, 1.0f, 1.0f);
+ }
+ } else {
+ Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 1.0f);
+ if ((Animation_OnFrame(&this->unk194, 0.0f) != 0) || (Animation_OnFrame(&this->unk194, 5.0f) != 0)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B4);
+ }
+ func_809B22CC(this, play, 3);
+ }
+ if ((this->actor.speedXZ > 3.0f) && (sp5C <= 3.0f)) {
+ Animation_MorphToLoop(&this->unk194, &D_06003650, -3.0f);
+ if (Rand_ZeroOne() < 0.25f) {
+ func_809B3A7C(this, play);
+ }
+ }
+ if (this->actionFunc == func_809B4308) {
+ if ((this->actor.speedXZ < 4.0f) && (sp5C >= 4.0f)) {
+ Animation_MorphToLoop(&this->unk194, &D_06004620, -5.0f);
+ if (Rand_ZeroOne() < 0.25f) {
+ func_809B3A7C(this, play);
+ }
+ }
+ if ((this->actor.speedXZ < 1.0f) && (sp5C >= 1.0f)) {
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -10.0f);
+ }
+ if ((this->actor.speedXZ >= 1.0f) && (sp5C < 1.0f)) {
+ Animation_MorphToLoop(&this->unk194, &D_06004620, -5.0f);
+ }
+ }
+ temp_v0 = sp34 - this->actor.shape.rot.y;
+ if (ABS_ALT(temp_v0) < 0x6000) {
+ if (temp_v0 >= 0x3801) {
+ this->unk186 = 0x3800;
+ } else if (temp_v0 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v0;
+ }
+ if (func_809B2F54(this, play) != 0) {
+ return;
+ }
+ } else {
+ func_809B3E9C(this, play);
+ }
+ this->unk192 = 1;
+}
+
+void func_809B47EC(EnKnight* this, PlayState* play, u8 arg2) {
+ if (this->actionFunc != func_809B4880) {
+ Animation_MorphToLoop(&this->unk194, &D_06003650, -5.0f);
+ this->unk148 = 0;
+ this->actionFunc = func_809B4880;
+ }
+ this->unk14A[0] = Rand_ZeroFloat(15.0f) + 10.0f;
+ this->unk292 = arg2;
+}
+
+void func_809B4880(EnKnight* this, PlayState* play) {
+ f32 dx;
+ f32 dz;
+
+ SkelAnime_Update(&this->unk194);
+ this->unk186 = 0;
+ switch (this->unk148) {
+ case 0:
+ Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 1.0f);
+ dx = this->unk440.x - this->actor.world.pos.x;
+ dz = this->unk440.z - this->actor.world.pos.z;
+ Math_ApproachS(&this->actor.world.rot.y, Math_FAtan2F(dz, dx), 5, 0xA00);
+ if (Animation_OnFrame(&this->unk194, 0.0f) || Animation_OnFrame(&this->unk194, 5.0f)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B4);
+ }
+ func_809B22CC(this, play, 3);
+ if (this->unk292 != 0 && ((D_809BEFE4 != NULL && D_809BEFE4->unk_214 < 0.1f) ||
+ BREG(70) + 300.0f < this->actor.xzDistToPlayer || this->unk291 != 0)) {
+ if (this->unk291 != 0) {
+ this->unk148 = 3;
+ this->unk2A1 = 30;
+ Animation_MorphToLoop(&this->unk194, &D_0600E45C, -2.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_0600E45C);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL_FREEZE_LIGHTS);
+ } else {
+ this->unk148 = 1;
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ this->unk1D8 = 1000.0f;
+ }
+ }
+ break;
+ case 1:
+ if (this->unk291 != 0) {
+ this->unk148 = 2;
+ Animation_MorphToPlayOnce(&this->unk194, &D_060031F0, -2.0f);
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B6);
+ }
+ goto block_24;
+ case 2:
+ if (this->unk291 == 0) {
+ this->unk148 = 1;
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ }
+ if (this->unk291 >= 8) {
+ Math_ApproachF(&this->unk474, 1.0f, 1.0f, 0.5f);
+ }
+ goto block_24;
+ case 3:
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ this->unk148 = 2;
+ Animation_MorphToPlayOnce(&this->unk194, &D_060031F0, -2.0f);
+ this->unk1D8 = 1000.0f;
+ }
+ goto block_24;
+
+ block_24:
+ this->unk594.base.colType = 0xA;
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk1D8 > 10.0f) {
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0xE00);
+ }
+ if (D_809BEFE4 != NULL && D_809BEFE4->unk_214 > 0.1f) {
+ this->unk14A[0] = Rand_ZeroFloat(15.0f) + 10.0f;
+ }
+ this->unk192 = 1;
+ break;
+ }
+ if (this->unk14A[0] == 0) {
+ func_809B4024(this, play, 0x7000);
+ }
+}
+
+void func_809B4BFC(EnKnight* this, PlayState* play) {
+ Animation_MorphToLoop(&this->unk194, &D_0600CDE0, -25.0f);
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B6);
+ this->actionFunc = func_809B4C58;
+ this->unk14A[0] = 35;
+}
+
+void func_809B4C58(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ this->unk186 = 0;
+ Math_ApproachF(&this->unk180, 180.0f, 1.0f, 10.0f);
+
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+
+ if (((s16)(BREG(74) + 10) < this->unk14A[0]) && !((BREG(76) + 3) & this->unk146)) {
+ EnKnight* temp_v0 = (EnKnight*)Actor_SpawnAsChild(
+ &play->actorCtx, &this->actor, play, ACTOR_EN_KNIGHT, this->actor.world.pos.x, this->actor.world.pos.y,
+ this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z,
+ (this == D_809BEFD0) ? 0x00C9 : 0x00C8);
+
+ if (temp_v0 != NULL) {
+ s32 i;
+
+ for (i = 0; i < 29; i++) {
+ temp_v0->unk194.jointTable[i] = this->unk194.jointTable[i];
+ temp_v0->unk194.skeleton = this->unk194.skeleton;
+ temp_v0->unk194.dListCount = this->unk194.dListCount;
+ }
+ }
+ }
+}
+
+void func_809B4E84(EnKnight* this, PlayState* play, u16 arg2) {
+ this->actionFunc = func_809B4ED8;
+ this->unk14A[0] = arg2;
+ this->unk14A[1] = 0x1E;
+ Actor_SetColorFilter(&this->actor, 0, 0x78, 0, arg2);
+}
+
+void func_809B4ED8(EnKnight* this, PlayState* play) {
+ if (this->unk14A[1] > 0 && this->unk14A[1] < 23) {
+ if (this->unk14A[1] == 1) {
+ D_809BEFE0 = NULL;
+ } else {
+ D_809BEFE0 = this;
+ }
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] < 20) {
+ if (this->unk14A[0] % 2 != 0) {
+ this->unk184 = 0x708;
+ } else {
+ this->unk184 = -0x708;
+ }
+ } else {
+ this->unk186 = 0;
+ }
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+}
+
+void func_809B4F90(EnKnight* this, PlayState* arg1) {
+ Vec3f sp2C;
+ s16 temp_v0;
+
+ this->actionFunc = func_809B5058;
+ temp_v0 = this->unk172 - this->actor.shape.rot.y;
+ if (ABS_ALT(temp_v0) < 0x4000) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06004974, 0.0f);
+ this->unk148 = 0;
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06000D9C, 0.0f);
+ this->unk148 = 1;
+ }
+ Matrix_RotateYS(this->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(-15.0f, &sp2C);
+ this->unk2A4 = sp2C.x;
+ this->unk2A8 = sp2C.z;
+ this->unk14A[0] = 10;
+}
+
+void func_809B5058(EnKnight* this, PlayState* play) {
+ f32 rand = Rand_ZeroOne();
+
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] == 0) {
+ if (this == D_809BEFD0 && this->actor.xzDistToPlayer < 150.0f) {
+ if (rand < 0.25f) {
+ func_809B35BC(this, play);
+ } else if (rand < 0.5f) {
+ func_809B329C(this, play, 0);
+ } else if (rand < 0.75f) {
+ func_809B59FC(this, play);
+ } else {
+ func_809B3CD0(this, play);
+ }
+ } else if (this->unk148 == 0) {
+ func_809B3E9C(this, play);
+ } else {
+ func_809B4024(this, play, 0x6000);
+ }
+ }
+ if (this == D_809BEFD0 && this->unk14A[0] < 4) {
+ this->unk192 = 1;
+ }
+}
+
+void func_809B51DC(EnKnight* this, PlayState* play) {
+ Vec3f sp2C;
+ s16 temp_v0;
+
+ this->actionFunc = func_809B52E8;
+ temp_v0 = this->unk172 - this->actor.shape.rot.y;
+ if (ABS_ALT(temp_v0) < 0x4000) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06001CDC, 0.0f);
+ this->unk1D8 = 1.0f;
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06005D30, 0.0f);
+ this->unk1D8 = -1.0f;
+ }
+ Matrix_RotateYS(this->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(29) + -15.0f, &sp2C);
+ this->unk2A4 = sp2C.x;
+ this->unk2A8 = sp2C.z;
+ this->unk14A[0] = 35;
+ this->unk14A[1] = 150;
+ this->actor.colChkInfo.damageTable = &D_809BDB24;
+}
+
+void func_809B52E8(EnKnight* this, PlayState* play) {
+ s32 pad;
+ f32 temp_fv0;
+ f32 var_fv0;
+ Vec3f sp40;
+ CollisionPoly* sp3C;
+ f32 temp_fv1;
+ f32 temp;
+ f32 temp_ft4;
+ s16 var_v0;
+
+ if (this->unk14A[0] < (s16)(KREG(6) + 25)) {
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
+ if (this == D_809BEFD0) {
+ var_fv0 = -75.0f;
+ } else {
+ var_fv0 = -65.0f;
+ }
+ Matrix_MultVecZ((KREG(9) + 1.0f) * (var_fv0 * this->unk1D8), &sp40);
+ sp40.x += this->actor.world.pos.x;
+ sp40.y += this->actor.world.pos.y + 300.0f;
+ sp40.z += this->actor.world.pos.z;
+ temp_fv0 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp3C, &sp40);
+ if (temp_fv0 > -10.0f && temp_fv0 != this->actor.floorHeight) {
+ temp_fv1 = sp40.x - this->actor.world.pos.x;
+ temp = temp_fv0 - this->actor.world.pos.y;
+ temp_ft4 = sp40.z - this->actor.world.pos.z;
+ Math_ApproachS(&this->actor.shape.rot.x,
+ Math_Atan2S(temp, sqrtf(SQ(temp_fv1) + SQ(temp_ft4))) * (s32)this->unk1D8, 1, 0x800);
+ } else {
+ Math_ApproachS(&this->actor.shape.rot.x, 0, 1, 0x800);
+ }
+ }
+ if (this->unk14A[1] >= 0x78 && this->unk14A[1] < 0x8C) {
+ if (this->unk14A[1] == 0x78) {
+ D_809BEFE0 = NULL;
+ } else {
+ D_809BEFE0 = this;
+ }
+ }
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ Math_ApproachZeroF(&this->unk180, 1.0f, 10.0f);
+ if (this->unk1D8 > 0.0f) {
+ var_v0 = 0x14;
+ } else {
+ var_v0 = KREG(8) + 8;
+ }
+ if (var_v0 == this->unk14A[0]) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN);
+ this->actor.flags &= ~1;
+ if (this->unk2A0 == 0xA) {
+ this->unk2A2 = 0;
+ }
+ }
+ if (this->unk14A[1] == 0 && D_809BEFD0->actionFunc != func_809B7950) {
+ this->actor.flags |= 1;
+ func_809B4BFC(this, play);
+ if (this == D_809BEFD0) {
+ this->actor.colChkInfo.health = 0xE - BREG(41);
+ } else {
+ this->actor.colChkInfo.health = 6 - BREG(40);
+ }
+ this->unk594.elements[0].info.bumperFlags &= ~2;
+ this->unk594.elements[1].info.bumperFlags &= ~2;
+ this->actor.colChkInfo.damageTable = &D_809BDB04;
+ this->unk156 = 0x19;
+ }
+}
+
+void func_809B5634(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B5698;
+ this->unk14A[2] = 0x32;
+ this->unk2A1 = 0x14;
+ if (this == D_809BEFD0) {
+ func_801A2ED8();
+ }
+ Audio_PlaySfxAtPos(&this->unk6C8, this->unk6C2);
+}
+
+void func_809B5698(EnKnight* this, PlayState* play) {
+ Vec3f sp44;
+ Vec3f sp38;
+ s16 sp36;
+
+ if (this->unk14A[2] >= 0xA && this->unk14A[2] < 0x28) {
+ if (this->unk14A[2] == 0xA) {
+ D_809BEFE0 = NULL;
+ } else {
+ D_809BEFE0 = this;
+ }
+ }
+ if (this->unk14A[2] == 0) {
+ this->unk152 = 0;
+ this->actor.draw = NULL;
+ this->actor.world.pos.y = 1000.0f;
+ this->actor.world.pos.x = 1300.0f;
+ this->actor.world.pos.z = 2864.0f;
+ this->actor.gravity = 0.0f;
+ }
+ Math_ApproachZeroF(&this->actor.scale.y, 0.1f, 0.0015f);
+ if (this->unk14A[2] != 0) {
+ sp36 = (s32)Rand_ZeroFloat(14.9f);
+ sp44 = D_809BDAF0;
+ sp44.y = 0.03f;
+ sp38.x = this->unk1DC[sp36].x + randPlusMinusPoint5Scaled(20.0f);
+ sp38.y = this->unk1DC[sp36].y - 5.0f;
+ sp38.z = this->unk1DC[sp36].z + randPlusMinusPoint5Scaled(20.0f);
+ EffectSsKFire_Spawn(play, &sp38, &D_809BDAF0, &sp44, Rand_ZeroFloat(20.0f) + 20.0f, 0);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG);
+ }
+ if (this->unk14A[2] == 0) {
+ this->actor.flags &= ~1;
+ if (this == D_809BEFD0) {
+ if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
+ ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
+ this->actionFunc = func_809B58D4;
+ } else {
+ ActorCutscene_SetIntentToPlay(this->actor.cutscene);
+ }
+ } else {
+ this->actionFunc = func_809B58D4;
+ }
+ func_800BC154(play, &play->actorCtx, &this->actor, 5);
+ this->unk14A[0] = 30;
+ }
+}
+
+void func_809B58D4(EnKnight* this, PlayState* play) {
+ if (this == D_809BEFD0 && this->unk14A[0] == 0) {
+ Actor_MarkForDeath(&this->actor);
+ Actor_MarkForDeath(&D_809BEFD4->actor);
+ Actor_MarkForDeath(&D_809BEFD8->actor);
+ }
+}
+
+void func_809B592C(EnKnight* this, PlayState* play) {
+ s32 var_s0;
+ Vec3f sp28;
+
+ this->actionFunc = func_809B5B08;
+ Animation_MorphToPlayOnce(&this->unk194, &D_06002174, 0.0f);
+ Matrix_RotateYS(this->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(-15.0f, &sp28);
+ this->unk2A4 = sp28.x;
+ this->unk2A8 = sp28.z;
+ this->actor.velocity.y = 7.5f;
+ for (var_s0 = 0; var_s0 < 5; var_s0++) {
+ func_809B22CC(this, play, 0);
+ }
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP);
+ this->unk148 = 0;
+ this->unk156 = 0xA;
+}
+
+void func_809B59FC(EnKnight* this, PlayState* play) {
+ s32 var_s0;
+ Vec3f sp28;
+
+ this->actionFunc = func_809B5B08;
+ Animation_MorphToPlayOnce(&this->unk194, &D_06002174, 0.0f);
+ Matrix_RotateYS(this->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(90) + 14.0f, &sp28);
+ this->unk2A4 = sp28.x;
+ this->unk2A8 = sp28.z;
+ this->actor.velocity.y = KREG(91) + 13.0f;
+ for (var_s0 = 0; var_s0 < 5; var_s0++) {
+ func_809B22CC(this, play, 0);
+ }
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIBOSS_JUMP1);
+ this->unk148 = 1;
+ this->unk156 = 0x14;
+}
+
+void func_809B5B08(EnKnight* this, PlayState* play) {
+ if (this->unk148 == 1) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG);
+ }
+
+ SkelAnime_Update(&this->unk194);
+ this->actor.speedXZ = 0.0f;
+
+ if (this == D_809BEFD0) {
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0x1000);
+ if (this->unk156 == 0xD) {
+ if (this->unk148 == 1) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_LAUGH_DEMO);
+ } else {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_CYNICAL);
+ }
+ }
+ }
+
+ if (this->actor.velocity.y <= 0.0f && (this->actor.bgCheckFlags & 1)) {
+ this->unk2A4 = this->unk2A8 = 0.0f;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK);
+ if (this->unk148 == 1) {
+ if (this->unk162 != 0) {
+ if (Rand_ZeroOne() < 0.5f) {
+ func_809B3A7C(this, play);
+ } else {
+ func_809B329C(this, play, 0);
+ }
+ } else if (Rand_ZeroOne() < 0.5f) {
+ func_809B3A7C(this, play);
+ } else {
+ func_809B6EC8(this, play);
+ }
+ } else if (this == D_809BEFD0 && Rand_ZeroOne() < 0.3f) {
+ if (Rand_ZeroOne() < 0.5f || this->unk162 != 0) {
+ func_809B3A7C(this, play);
+ } else {
+ func_809B6EC8(this, play);
+ }
+ } else {
+ func_809B3E9C(this, play);
+ }
+ }
+}
+
+void func_809B5D38(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B5D54;
+ this->unk148 = 0;
+}
+
+void func_809B5D54(EnKnight* this, PlayState* play) {
+ this->unk_680 = 1;
+ if (this->unk148 != 0) {
+ SkelAnime_Update(&this->unk194);
+ }
+ switch (this->unk148) {
+ case 0:
+ break;
+ case 1:
+ if (this->unk290 == 0) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_060009E0, 0.0f);
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_060005A8, 0.0f);
+ }
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_STAND);
+ this->unk290 = 1 - this->unk290;
+ this->unk148 = 2;
+ this->unk14A[0] = 2;
+ /* fallthrough */
+ case 2:
+ if (this->unk14A[0] == 1) {
+ if (this->unk290 == 0) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SHOCK);
+ } else {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SHIT);
+ }
+ }
+ if (this->unk_151 == 0) {
+ func_809B6528(this, play);
+ this->unk194.curFrame = 25.0f;
+ }
+ break;
+ }
+ this->unk18A = 0;
+ this->unk184 = this->unk186 = this->unk188 = this->unk18A;
+}
+
+void func_809B5E90(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B5ED0;
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+}
+
+void func_809B5ED0(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+
+ if (D_809BEFE0 == NULL) {
+ func_809B3E9C(this, play);
+ } else {
+ f32 dx = D_809BEFE0->actor.focus.pos.x - this->actor.world.pos.x;
+ f32 dz = D_809BEFE0->actor.focus.pos.z - this->actor.world.pos.z;
+ s16 temp_v1 = Math_FAtan2F(dz, dx) - this->actor.shape.rot.y;
+
+ if (temp_v1 > 0x3800) {
+ this->unk186 = 0x3800;
+ } else if (temp_v1 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v1;
+ }
+ this->unk18C = 0x3000;
+ this->unk18E = 2;
+ }
+}
+
+void func_809B5FA8(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B601C;
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ this->unk148 = 0;
+ this->unk14A[0] = Rand_ZeroFloat(10.0f) + 65.0f;
+}
+
+void func_809B601C(EnKnight* this, PlayState* play) {
+ f32 dx;
+ f32 dz;
+ s16 temp_v1_2;
+ EnKnight* var_t0;
+ Player* sp2C = GET_PLAYER(play);
+
+ SkelAnime_Update(&this->unk194);
+
+ var_t0 = (this == D_809BEFD4) ? D_809BEFD8 : D_809BEFD4;
+
+ switch (this->unk148) {
+ case 0:
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 2, 0x500);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] < 0x28 && this->unk14A[0] >= 0x10) {
+ dx = var_t0->actor.focus.pos.x - this->actor.world.pos.x;
+ dz = var_t0->actor.focus.pos.z - this->actor.world.pos.z;
+ temp_v1_2 = Math_FAtan2F(dz, dx) - this->actor.shape.rot.y;
+
+ if (temp_v1_2 > 0x3800) {
+ this->unk186 = 0x3800;
+ } else if (temp_v1_2 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v1_2;
+ }
+
+ this->unk18C = 0x3000;
+ this->unk18E = 2;
+ } else {
+ this->unk186 = 0;
+ }
+
+ if (this->unk14A[0] == 0 && func_801A46F8() == 1) {
+ Animation_MorphToLoop(&this->unk194, &D_0600DDCC, -3.0f);
+ this->unk148 = 1;
+ this->unk14A[0] = 0xC8;
+ }
+
+ if (!(sp2C->stateFlags3 & PLAYER_STATE3_20000000)) {
+ this->unk148 = 2;
+ this->unk14A[0] = 0xA;
+ }
+ break;
+ case 1:
+ this->actor.speedXZ = KREG(38) + 1.0f;
+
+ if (this == D_809BEFD4) {
+ this->actor.world.rot.y = (this->actor.world.rot.y + KREG(39) * 0x100) + 0x100;
+ } else {
+ this->actor.world.rot.y = (this->actor.world.rot.y - KREG(39) * 0x100) - 0x100;
+ }
+
+ if (this->unk14A[0] == 0 || !(sp2C->stateFlags3 & PLAYER_STATE3_20000000)) {
+ this->unk148 = 2;
+ this->unk14A[0] = 0xA;
+ }
+ goto block_29;
+ case 2:
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ }
+ goto block_29;
+
+ block_29:
+ if (Animation_OnFrame(&this->unk194, KREG(53) + 1.0f) ||
+ Animation_OnFrame(&this->unk194, KREG(54) + 11.0f)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B4);
+ }
+ break;
+ }
+ Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 5, 0x500);
+}
+
+void func_809B631C(EnKnight* this, PlayState* play) {
+ if (this == D_809BEFD0) {
+ this->actionFunc = func_809B8458;
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ } else {
+ this->actionFunc = func_809B842C;
+ }
+ this->actor.world.pos.y = 1000.0f;
+}
+
+void func_809B638C(EnKnight* this, PlayState* play, s16 arg2) {
+ Vec3f sp4C;
+ Vec3f sp40;
+ Vec3f sp34;
+ s16 var_a1;
+
+ Math_Vec3f_Copy(&sp4C, &this->unk434);
+ Matrix_RotateYS(this->unk184 + this->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_RotateXS(this->actor.shape.rot.x + arg2, MTXMODE_APPLY);
+ Matrix_MultVecZ(BREG(48) + 20.0f, &sp40);
+ var_a1 = (this->unk14A[0] < 0x28) ? 0 : 0xC8;
+ Math_ApproachS(&this->unk160, var_a1, 1, 5);
+ if (this->unk160 >= 0x3D) {
+ func_800B9010(&this->actor, NA_SE_EN_FREEZAD_BREATH - SFX_FLAG);
+ }
+ sp34.x = sp34.y = sp34.z = 0.0f;
+ func_809B20F0(play, &sp4C, &sp40, &sp34, 2.0f, 25.0f, this->unk160);
+ sp4C.x -= sp40.x * 0.5f;
+ sp4C.y -= sp40.y * 0.5f;
+ sp4C.z -= sp40.z * 0.5f;
+ func_809B20F0(play, &sp4C, &sp40, &sp34, 2.0f, 25.0f, this->unk160);
+}
+
+void func_809B6528(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600A530, -5.0f);
+ this->actionFunc = func_809B6764;
+ this->unk148 = 0;
+}
+
+void func_809B6574(PlayState* play, u8 arg1) {
+ Player* player = GET_PLAYER(play);
+ Vec3f spB0;
+ Vec3f spA4;
+ Vec3f sp98;
+ u8 var_s1;
+
+ for (var_s1 = 0; var_s1 < arg1; var_s1++) {
+ spA4.x = randPlusMinusPoint5Scaled(3.0f);
+ spA4.y = Rand_ZeroFloat(2.0f) + 1.0f;
+ spA4.z = randPlusMinusPoint5Scaled(3.0f);
+ sp98.x = sp98.z = 0.0f;
+ sp98.y = -0.1f;
+ spB0.x = player->actor.world.pos.x + randPlusMinusPoint5Scaled(30.0f);
+ spB0.y = player->actor.world.pos.y + 20.0f + randPlusMinusPoint5Scaled(30.0f);
+ spB0.z = player->actor.world.pos.z + randPlusMinusPoint5Scaled(30.0f);
+ func_800B0EB0(play, &spB0, &spA4, &sp98, &D_809BDCF0, &D_809BDCF4, Rand_ZeroFloat(50.0f) + 100.0f, 0xA,
+ Rand_ZeroFloat(5.0f) + 14.0f);
+ }
+}
+
+void func_809B6764(EnKnight* this, PlayState* play) {
+ s16 temp_v1;
+ s16 sp54 = 0;
+ Player* player = GET_PLAYER(play);
+ Vec3f sp44;
+ Vec3f sp38;
+
+ SkelAnime_Update(&this->unk194);
+
+ temp_v1 = this->unk172 - this->actor.shape.rot.y;
+ if (temp_v1 > 0x3800) {
+ this->unk186 = 0x3800;
+ } else if (temp_v1 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v1;
+ }
+
+ switch (this->unk148) {
+ case 0:
+ if (this->actor.xzDistToPlayer < 35.0f) {
+ if (player->actor.world.pos.z < this->actor.world.pos.z) {
+ this->unk148 = 1;
+ } else {
+ this->unk148 = 5;
+ }
+ this->unk14A[0] = 8;
+ Actor_PlaySfxAtPos(&this->actor, this->unk6BC);
+ }
+ if (player->unk_D57 == 4 && func_809B31E8(this, play) != 0) {
+ this->unk148 = 0xA;
+ Animation_MorphToPlayOnce(&this->unk194, &D_06008524, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06008524);
+ }
+ break;
+ case 1:
+ if (this->unk14A[0] == 0) {
+ this->unk148++;
+ this->unk14A[0] = 0x14;
+ } else {
+ Math_ApproachS(&this->unk17A, 0x3C00, 1, 0x1770);
+ Math_ApproachS(&this->unk176, 0x1400, 1, 0x1770);
+ if (this->unk14A[0] == 7) {
+ sp54 = -0x2000;
+ }
+ break;
+ }
+ case 2:
+ Math_ApproachS(&this->unk17A, 0, 1, 0xBB8);
+ Math_ApproachS(&this->unk176, 0, 1, 0xBB8);
+ if (this->unk14A[0] == 0) {
+ this->unk148 = 0;
+ }
+ break;
+ case 5:
+ if (this->unk14A[0] == 0) {
+ this->unk148++;
+ this->unk14A[0] = 0x14;
+ } else {
+ Math_ApproachS(&this->unk178, 0x3C00, 1, 0x1770);
+ Math_ApproachS(&this->unk174, 0x1400, 1, 0x1770);
+ if (this->unk14A[0] == 7) {
+ sp54 = 0x2000;
+ }
+ break;
+ }
+ case 6:
+ Math_ApproachS(&this->unk178, 0, 1, 0xBB8);
+ Math_ApproachS(&this->unk174, 0, 1, 0xBB8);
+ if (this->unk14A[0] == 0) {
+ this->unk148 = 0;
+ }
+ break;
+ case 10:
+ if (Animation_OnFrame(&this->unk194, this->unk1D8) != 0) {
+ this->unk148 = 0xB;
+ Animation_MorphToPlayOnce(&this->unk194, &D_060089E4, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_060089E4);
+ }
+ break;
+ case 11:
+ if (Animation_OnFrame(&this->unk194, this->unk1D8) != 0) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600A530, -15.0f);
+ this->unk148 = 0;
+ }
+ break;
+ }
+
+ if (this->unk148 >= 0xA) {
+ sp44.x = this->actor.world.pos.x + 40.0f;
+ sp44.y = this->actor.world.pos.y + 70.0f;
+ sp44.z = this->actor.world.pos.z;
+ func_809B21F4(this, 0, &this->unk534, &sp44);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk534.base);
+ }
+
+ if (D_809BEFD4->actor.draw == NULL && D_809BEFD8->actor.draw == NULL) {
+ func_809B7190(this, play);
+ this->unk17A = this->unk178 = this->unk176 = this->unk174 = 0;
+ }
+
+ if (sp54 != 0) {
+ Math_Vec3f_Copy(&sp38, &player->actor.world.pos);
+ sp38.y += 25.0f;
+ EffectSsHitmark_SpawnFixedScale(play, 0, &sp38);
+ func_800B8D50(play, NULL, KREG(53) + 12.0f, this->actor.shape.rot.y + sp54, KREG(54) + 7.0f, 0x10);
+ func_809B6574(play, 0xC);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLOCK_SHAKE);
+ }
+}
+
+void func_809B6C04(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06003008, -5.0f);
+ this->actionFunc = func_809B6C54;
+ this->unk14A[0] = 0x32;
+}
+
+void func_809B6C54(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+ if (Animation_OnFrame(&this->unk194, 19.0f)) {
+ this->unk162 = 1;
+ D_809BEFDC = (EnKnight*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KNIGHT, 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, 0x64);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_SHORT);
+ }
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ if (this->unk14A[0] == 0) {
+ func_809B3E9C(this, play);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_LAUGH_DEMO);
+ }
+}
+
+void func_809B6D38(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_060079D4, -10.0f);
+ this->actionFunc = func_809B6D94;
+ this->unk148 = 0;
+ this->unk14A[0] = 0x3C;
+ this->unk194.playSpeed = 0.0f;
+}
+
+void func_809B6D94(EnKnight* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+
+ this->unk156 = 5;
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+
+ switch (this->unk148) {
+ case 1:
+ this->unk148 = 2;
+ this->unk14A[0] = 0x28;
+ this->unk194.playSpeed = 1.0f;
+ /* fallthrough */
+ case 2:
+ if (this->unk14A[0] == 0x22) {
+ this->unk162 = 0;
+ Actor_MarkForDeath(&D_809BEFDC->actor);
+ D_809BEFDC = NULL;
+ this->actor.flags |= 1;
+ player->unk_730 = &this->actor;
+ play->actorCtx.targetContext.arrowPointedActor = &this->actor;
+ play->actorCtx.targetContext.targetedActor = &this->actor;
+ }
+ if (this->unk14A[0] == 0xF) {
+ func_809B3E9C(this, play);
+ this->unk14A[2] = Rand_ZeroFloat(100.0f) + 150.0f;
+ }
+ /* fallthrough */
+ case 0:
+ return;
+ }
+}
+
+void func_809B6EC8(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06009538, -5.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06009538);
+ this->actionFunc = func_809B6F40;
+ this->unk148 = 0;
+ this->unk14A[0] = KREG(57) + 0x96;
+ this->unk160 = 0;
+}
+
+void func_809B6F40(EnKnight* this, PlayState* play) {
+ s16 temp_v0;
+
+ SkelAnime_Update(&this->unk194);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ Math_ApproachS(&this->actor.world.rot.y, this->unk172, 5, 0x500);
+
+ temp_v0 = this->unk172 - this->actor.shape.rot.y;
+ if (ABS_ALT(temp_v0) < 0x6000) {
+ if (temp_v0 > 0x3800) {
+ this->unk186 = 0x3800;
+ } else if (temp_v0 < -0x3800) {
+ this->unk186 = -0x3800;
+ } else {
+ this->unk186 = temp_v0;
+ }
+ }
+
+ switch (this->unk148) {
+ case 0:
+ if (Animation_OnFrame(&this->unk194, this->unk1D8) != 0) {
+ this->unk148 = 1;
+ Animation_MorphToLoop(&this->unk194, &D_06008D80, 0.0f);
+ }
+ func_809B638C(this, play, 0x1600);
+ break;
+ case 1:
+ func_809B638C(this, play, 0x1600);
+ if (KREG(21) == 0) {
+ this->unk186 =
+ Math_SinS((KREG(84) + 0x11DC) * this->unk146) * (KREG(85) * 0x800 + 0x1800) + this->unk186;
+ }
+ if (this->unk14A[0] == 0) {
+ this->unk148 = 2;
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600E15C, -5.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_0600E15C);
+ }
+ break;
+ case 2:
+ func_809B638C(this, play, 0x1600);
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ func_809B3E9C(this, play);
+ this->unk14A[2] = Rand_ZeroFloat(150.0f) + 150.0f;
+ }
+ break;
+ }
+
+ this->unk192 = 1;
+}
+
+void func_809B7190(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809B71DC;
+ this->unk684 = 0;
+ this->unk688 = 0;
+ this->unk6A4 = 0.0f;
+ Audio_QueueSeqCmd(0x101400FF);
+}
+
+void func_809B71DC(EnKnight* this, PlayState* play) {
+ f32 temp_fa0;
+ Camera* sp30;
+ f32 temp_fv0;
+
+ this->unk684++;
+ SkelAnime_Update(&this->unk194);
+
+ switch (this->unk688) {
+ case 0:
+ if (ActorCutscene_GetCurrentIndex() != -1) {
+ break;
+ }
+ Cutscene_Start(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 7);
+ this->unk_68A = Play_CreateSubCamera(play);
+ Play_CameraChangeStatus(play, 0, 1);
+ Play_CameraChangeStatus(play, this->unk_68A, 7);
+ this->actor.flags &= ~1;
+ this->unk684 = 0;
+ this->unk688 = 1;
+ this->unk68C.x = 1342.0f;
+ this->unk68C.y = 56.0f;
+ this->unk68C.z = 2810.0f;
+ this->unk698.x = 1400.0f;
+ this->unk698.y = 57.0f;
+ this->unk698.z = 2870.0f;
+ this->unk6B0 = 60.0f;
+ /* Fallthrough */
+ case 1:
+ if (this->unk684 == (u32)(sREG(64) + 0xD)) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06009D8C, sREG(65));
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_STAND);
+ }
+ if (this->unk684 != (u32)(sREG(66) + 0x17)) {
+ break;
+ }
+ this->unk68C.x = 1253.0f;
+ this->unk68C.y = 79.0f;
+ this->unk68C.z = 2903.0f;
+ this->unk698.x = 1354.0f;
+ this->unk698.y = 83.0f;
+ this->unk698.z = 2865.0f;
+ Animation_MorphToPlayOnce(&this->unk194, &D_06009D8C, 0.0f);
+ this->unk684 = 0;
+ this->unk688 = 2;
+ /* Fallthrough */
+ case 2:
+ this->unk6A4 = sREG(67) * 0.001f + 0.05f;
+ Math_ApproachF(&this->unk698.y, 119.0f, 0.2f, this->unk6A4 * 36.0f);
+ if (this->unk684 >= (u32)(sREG(68) + 0xA)) {
+ if (this->unk684 == (u32)(sREG(68) + 0xA)) {
+ this->unk14A[1] = 0x11;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SWORD);
+ }
+
+ temp_fv0 = Math_SinS(this->unk14A[1] * 0x6000);
+ temp_fa0 = (temp_fv0 * this->unk14A[1] * 0.0175f) + (this->unk14A[1] * 0.0175f) + 1.0f;
+
+ Math_ApproachF(&this->unk46C, temp_fa0, 1.0f, 0.5f);
+ Math_ApproachF(&this->unk470, temp_fa0, 1.0f, 0.5f);
+ }
+ if (this->unk684 == (u32)(sREG(69) + 0x32)) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06008390, sREG(65) + -10.0f);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_ATTACK_K);
+ }
+ if (this->unk684 >= (u32)(sREG(69) + 0x32)) {
+ Math_ApproachF(&this->unk6B0, sREG(70) + 40.0f, 0.2f, sREG(71) * 0.1f + 3.0f);
+ }
+ if (this->unk684 >= (u32)(sREG(72) + 0x5A)) {
+ sp30 = Play_GetCamera(play, 0);
+ this->unk688 = 0;
+ func_809B3E9C(this, play);
+ this->unk14A[2] = 0x12C;
+ this->unk152 = 1;
+ this->actor.flags |= 1;
+ this->actor.gravity = -1.5f;
+ sp30->eye = this->unk68C;
+ sp30->eyeNext = this->unk68C;
+ sp30->at = this->unk698;
+ func_80169AFC(play, this->unk_68A, 0);
+ this->unk_68A = 0;
+ Cutscene_End(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 6);
+ D_809BDB00 = 1;
+ }
+ break;
+ }
+
+ if (this->unk_68A != 0) {
+ ShrinkWindow_SetLetterboxTarget(27);
+ Play_CameraSetAtEye(play, this->unk_68A, &this->unk698, &this->unk68C);
+ Play_CameraSetFov(play, this->unk_68A, this->unk6B0);
+ }
+}
+
+void func_809B7708(EnKnight* this, PlayState* play) {
+ if (this->actionFunc != func_809B52E8 && this->actionFunc != func_809B5698 && this->actionFunc != func_809B58D4) {
+ Animation_MorphToLoop(&this->unk194, &D_060040E0, -5.0f);
+ this->actionFunc = func_809B7778;
+ }
+}
+
+void func_809B7778(EnKnight* this, PlayState* play) {
+ Vec3f sp2C;
+ Player* player = GET_PLAYER(play);
+
+ SkelAnime_Update(&this->unk194);
+ this->unk186 = 0;
+ this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
+ this->actor.world.rot.y = this->actor.yawTowardsPlayer;
+ this->actor.speedXZ = 0.0f;
+ if (D_809BEFD0->unk148 == 0) {
+ if (this == D_809BEFD4) {
+ Matrix_RotateYS(D_809BEFD0->actor.shape.rot.y + 0x1400, MTXMODE_NEW);
+ } else {
+ Matrix_RotateYS(D_809BEFD0->actor.shape.rot.y - 0x1400, MTXMODE_NEW);
+ }
+ Matrix_MultVecZ((KREG(19) + 350.0f) - 220.0f, &sp2C);
+ this->actor.world.pos.x = player->actor.world.pos.x + sp2C.x;
+ this->actor.world.pos.z = player->actor.world.pos.z + sp2C.z;
+ }
+ if (D_809BEFD0->actionFunc != func_809B7950) {
+ func_809B3E9C(this, play);
+ }
+}
+
+void func_809B78A4(EnKnight* this, PlayState* play) {
+ this->unk684 = 0;
+ this->unk688 = 0;
+ this->unk6A4 = 0.0f;
+ Audio_QueueSeqCmd(0x100A00FF);
+ if (this->actionFunc != func_809B6764) {
+ this->unk148 = 1;
+ this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
+ this->actor.world.rot.y = this->actor.yawTowardsPlayer;
+ } else {
+ this->unk148 = 0;
+ }
+ func_809B7708(D_809BEFD4, play);
+ func_809B7708(D_809BEFD8, play);
+ this->unk424 = this->actionFunc;
+ this->actionFunc = func_809B7950;
+}
+
+void func_809B7950(EnKnight* this, PlayState* play) {
+ Vec3f sp44;
+ Player* sp40 = GET_PLAYER(play);
+ Camera* var_v1;
+ s32 pad;
+
+ this->unk186 = 0;
+ this->actor.speedXZ = 0.0f;
+ this->unk684 += 1;
+ this->unk2A4 = 0.0f;
+ this->unk2A8 = 0.0f;
+
+ SkelAnime_Update(&this->unk194);
+
+ switch (this->unk688) {
+ case 0:
+ if (ActorCutscene_GetCurrentIndex() == -1) {
+ Cutscene_Start(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 7);
+ this->unk_68A = Play_CreateSubCamera(play);
+ Play_CameraChangeStatus(play, 0, 1);
+ Play_CameraChangeStatus(play, this->unk_68A, 7);
+ this->actor.flags &= ~1;
+ this->unk684 = 0;
+ this->unk688 = 1;
+ this->unk6B0 = 60.0f;
+ if (this->unk424 == func_809B6764) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600EA90, 0.0f);
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600E7F4, 0.0f);
+ }
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_STAND);
+ case 1:
+ Matrix_RotateYS(KREG(29) + this->actor.shape.rot.y + 0x1B58, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(16) + 90.0f, &sp44);
+
+ this->unk68C.x = this->actor.world.pos.x + sp44.x;
+ this->unk68C.y = this->actor.world.pos.y + KREG(17) + 40.0f;
+ this->unk68C.z = this->actor.world.pos.z + sp44.z;
+
+ this->unk698.x = this->actor.focus.pos.x;
+ this->unk698.y = this->actor.focus.pos.y + KREG(18) - 10.0f;
+ this->unk698.z = this->actor.focus.pos.z;
+
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
+
+ sp40->actor.world.rot.y = sp40->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000;
+
+ Matrix_MultVecZ((KREG(19) + 350.0f) - 220.0f, &sp44);
+
+ sp40->actor.world.pos.x = this->actor.world.pos.x + sp44.x;
+ sp40->actor.world.pos.z = this->actor.world.pos.z + sp44.z;
+
+ if (this->unk684 == (u32)(KREG(31) + 0x19)) {
+ this->unk688 = 2;
+ this->unk684 = 0;
+ this->unk6A4 = KREG(20) + 80.0f;
+ }
+ }
+ break;
+ case 2:
+ Matrix_RotateYS(sp40->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_RotateXS(KREG(26) - 0x7D0, MTXMODE_APPLY);
+ Matrix_MultVecZ(this->unk6A4, &sp44);
+ if (this->unk684 >= 0x1A) {
+ Math_ApproachF(&this->unk6A4, 40.0f, 0.2f, 2.0f);
+ }
+
+ this->unk68C.x = sp40->actor.world.pos.x + sp44.x;
+ this->unk68C.y = KREG(21) + (sp40->actor.world.pos.y + sp44.y) + 44.0f;
+ this->unk68C.z = sp40->actor.world.pos.z + sp44.z;
+
+ this->unk698.x = sp40->actor.world.pos.x;
+ this->unk698.y = (sp40->actor.world.pos.y + KREG(22) + 44.0f) - 5.0f;
+ this->unk698.z = sp40->actor.world.pos.z;
+
+ if (this->unk684 == (u32)(KREG(48) + 0x55)) {
+ this->unk688 = 3;
+ this->unk684 = 0;
+ this->unk1D8 = 1000.0f;
+ }
+ break;
+ case 3:
+ if (this->unk684 == 7) {
+ if (this->unk424 == func_809B6764) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06006EF8, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06006EF8);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_STAND_RAPID);
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06006754, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06006754);
+ }
+ Message_StartTextbox(play, 0x153E, NULL);
+ }
+
+ Matrix_RotateYS(KREG(29) + this->actor.shape.rot.y + 0x1B58, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(16) + 90.0f, &sp44);
+
+ this->unk68C.x = this->actor.world.pos.x + sp44.x;
+ this->unk68C.y = this->actor.world.pos.y + KREG(17) + 40.0f;
+ this->unk68C.z = this->actor.world.pos.z + sp44.z;
+
+ if (this->unk684 < (u32)(KREG(24) + 0x23)) {
+ this->unk698.x = this->actor.focus.pos.x;
+ this->unk698.y = this->actor.focus.pos.y + KREG(18) - 10.0f;
+ this->unk698.z = this->actor.focus.pos.z;
+ }
+
+ if (Animation_OnFrame(&this->unk194, this->unk1D8) != 0) {
+ Animation_MorphToLoop(&this->unk194, &D_0600C7F0, 0.0f);
+ this->unk1D8 = 1000.0f;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HAND);
+ }
+
+ if (this->unk684 == (u32)(KREG(25) + 0x78)) {
+ this->unk688 = 4;
+ this->unk684 = 0;
+ Animation_MorphToPlayOnce(&this->unk194, &D_0600C7F0, 0.0f);
+ }
+ break;
+ case 4:
+ Matrix_RotateYS(KREG(29) * 0x100 + this->actor.shape.rot.y + 0x2400, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(16) + 230.0f, &sp44);
+
+ this->unk68C.x = this->actor.world.pos.x + sp44.x;
+ this->unk68C.y = this->actor.world.pos.y + KREG(17) + 40.0f;
+ this->unk68C.z = this->actor.world.pos.z + sp44.z;
+
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_MultVecZ(KREG(49) + 65.0f, &sp44);
+
+ this->unk698.x = this->actor.world.pos.x + sp44.x;
+ this->unk698.y = (this->actor.world.pos.y + KREG(50) + 50.0f) - 20.0f;
+ this->unk698.z = this->actor.world.pos.z + sp44.z;
+
+ if (this->unk684 == 0x3C) {
+ Message_StartTextbox(play, 0x153FU, NULL);
+ }
+ if (this->unk684 == (u32)(BREG(16) + 0x78)) {
+ func_801477B4(play);
+ }
+ if (this->unk684 == (u32)(BREG(17) + 0xA0)) {
+ Message_StartTextbox(play, 0x1542, NULL);
+ Animation_MorphToLoop(&this->unk194, &D_0600A88C, 0.0f);
+ }
+ if (this->unk684 == (u32)(BREG(18) + 0xAA)) {
+ func_800B7298(play, &this->actor, 4);
+ }
+ if ((this->unk684 >= 0x9D) && (this->unk684 < 0xDD)) {
+ if (!(this->unk684 & 1)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_WALK);
+ }
+ if (!(this->unk684 & 3)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SIT);
+ }
+ }
+ if (this->unk684 == (u32)(BREG(19) + 0xDC)) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06021E34, -3.0f);
+ }
+ if (this->unk684 == (u32)(BREG(20) + 0xE6)) {
+ Message_StartTextbox(play, 0x1540, NULL);
+ }
+ if (this->unk684 == (u32)(BREG(20) + 0xF0)) {
+ Animation_MorphToLoop(&this->unk194, &D_06005E78, 0.0f);
+ }
+
+ if (this->unk684 == (u32)(BREG(21) + 0x140)) {
+ if (this->unk424 == func_809B6764) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0601024C, 0.0f);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SIT);
+ } else {
+ Animation_MorphToPlayOnce(&this->unk194, &D_0602105C, 0.0f);
+ }
+ func_801477B4(play);
+ }
+
+ if (this->unk684 >= (u32)(BREG(22) + 0x154)) {
+ var_v1 = Play_GetCamera(play, 0);
+
+ this->unk688 = 0;
+ if (this->unk424 == func_809B6764) {
+ func_809B6528(this, play);
+ this->unk194.curFrame = 25.0f;
+ } else {
+ func_809B3E9C(this, play);
+ this->actor.flags |= 1;
+ }
+
+ var_v1->eye = this->unk68C;
+ var_v1->eyeNext = this->unk68C;
+ var_v1->at = this->unk698;
+
+ func_80169AFC(play, this->unk_68A, 0);
+ this->unk_68A = 0;
+ Cutscene_End(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 6);
+ D_809BDB00 = 5;
+ }
+ break;
+ }
+
+ if (this->unk_68A != 0) {
+ ShrinkWindow_SetLetterboxTarget(27);
+ Play_CameraSetAtEye(play, this->unk_68A, &this->unk698, &this->unk68C);
+ Play_CameraSetFov(play, this->unk_68A, this->unk6B0);
+ }
+}
+
+void func_809B842C(EnKnight* this, PlayState* play) {
+ SkelAnime_Update(&this->unk194);
+}
+
+void func_809B8458(EnKnight* this, PlayState* play) {
+ f32 sp64 = 0.0f;
+ Player* sp60 = GET_PLAYER(play);
+ Camera* temp_v0_2;
+ Vec3f sp50;
+ Vec3f sp44;
+ f32 temp_fv1;
+
+ this->unk684++;
+ SkelAnime_Update(&this->unk194);
+
+ switch (this->unk688) {
+ case 0:
+ if (Flags_GetClear(play, play->roomCtx.currRoom.num) || (ActorCutscene_GetCurrentIndex() != -1) ||
+ !(sp60->actor.world.pos.x >= 870.0f)) {
+ break;
+ }
+
+ Cutscene_Start(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 7);
+ this->unk_68A = Play_CreateSubCamera(play);
+ Play_CameraChangeStatus(play, 0, 1);
+ Play_CameraChangeStatus(play, this->unk_68A, 7);
+ this->actor.flags &= ~1;
+ this->unk684 = 0;
+ this->unk688 = 1;
+ this->unk6B0 = 60.0f;
+ this->unk68C.x = 621.0f;
+ this->unk68C.y = 54.0f;
+ this->unk68C.z = 2865.0f;
+ this->unk698.x = 661.0f;
+ this->unk698.y = 110.0f;
+ this->unk698.z = 2939.0f;
+ Audio_QueueSeqCmd(0x105000FF);
+ /* Fallthrough */
+ case 1:
+ sp60->actor.world.pos.x = 870.0f;
+ sp60->actor.world.pos.z = 2865.0f;
+ this->unk6AC = 0x4000;
+ this->unk68C.x = sp60->actor.world.pos.x + BREG(16) + 100.0f;
+ this->unk68C.y = sp60->actor.world.pos.y + BREG(17) + 20.0f;
+ this->unk68C.z = sp60->actor.world.pos.z + BREG(18);
+ this->unk698.x = sp60->actor.world.pos.x + BREG(19);
+ this->unk698.y = sp60->actor.world.pos.y + BREG(20) + 40.0f;
+ this->unk698.z = sp60->actor.world.pos.z + BREG(21);
+
+ if (this->unk684 >= (u32)(BREG(22) + 0x14)) {
+ sp64 = 0.5f;
+ play_sound(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
+ }
+
+ if (this->unk684 == (u32)(BREG(22) + 0x1E)) {
+ func_800B7298(play, &this->actor, 0x15);
+ }
+
+ if (this->unk684 == (u32)(BREG(22) + 0x32)) {
+ Message_StartTextbox(play, 0x1518, NULL);
+ }
+
+ if (this->unk684 != (u32)(BREG(23) + 0x96)) {
+ break;
+ }
+
+ func_801477B4(play);
+
+ this->unk688 = 2;
+ this->unk684 = 0;
+ this->unk_153 = 1;
+ play->envCtx.lightSettingOverride = 1;
+ play->envCtx.unk_E0 = 0;
+ D_809BEFD0->unk_154 = 0;
+ /* Fallthrough */
+ case 2:
+ this->unk_144 = 0x8000;
+
+ if (this->unk684 == 10) {
+ func_800B7298(play, &this->actor, 4);
+ }
+
+ if (this->unk684 >= 10) {
+ Math_ApproachS(&this->unk6AC, 0, 2, 0x1000);
+ }
+
+ this->unk68C.x = 896.0f;
+ this->unk68C.y = 4.0f;
+ this->unk68C.z = 2752.0f;
+ this->unk698.x = 894.0f;
+ this->unk698.y = 46.0f;
+ this->unk698.z = 2860.0f;
+
+ if (this->unk684 == (u32)(BREG(65) + 0x28)) {
+ Message_StartTextbox(play, 0x1519, NULL);
+ }
+ if ((u32)(BREG(94) + 0x82) >= this->unk684) {
+ sp64 = 0.5f;
+ play_sound(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
+ }
+ if (this->unk684 == (u32)(BREG(65) + 0x8C)) {
+ func_801477B4(play);
+ }
+ if (this->unk684 == (u32)(BREG(65) + 0xAA)) {
+ Message_StartTextbox(play, 0x151AU, NULL);
+ }
+ if ((this->unk684 >= 0xAA) && (this->unk684 < 0xBF)) {
+ this->unk430 = KREG(42) + 200.0f;
+ }
+ if ((this->unk684 == 0x00000096) || (this->unk684 == 0x000000B4)) {
+ Actor_PlaySfxAtPos(&this->actor, this->unk6B4);
+ }
+
+ if (this->unk684 != (u32)(BREG(24) + 0xBE)) {
+ break;
+ }
+
+ this->unk688 = 3;
+ this->unk684 = 0;
+ func_800B7298(play, &this->actor, 0x85);
+ /* Fallthrough */
+ case 3:
+ Math_ApproachS(&this->unk6AC, 0x4000, 2, 0x1000);
+ if (this->unk684 != (u32)(BREG(26) + 0xF)) {
+ break;
+ }
+ this->unk688 = 4;
+ this->unk684 = 0;
+ Animation_MorphToPlayOnce(&this->unk194, &D_06010E98, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06010E98);
+ /* Fallthrough */
+ case 4:
+ this->unk6A4 = BREG(29) * 0.01f + 0.1f;
+ Math_ApproachF(&this->unk68C.x, 1076.0f, 0.5f, this->unk6A4 * 180.0f);
+ Math_ApproachF(&this->unk68C.y, 20.0f, 0.5f, this->unk6A4 * 16.0f);
+ Math_ApproachF(&this->unk68C.z, 2741.0f, 0.5f, this->unk6A4 * 11.0f);
+ Math_ApproachF(&this->unk698.x, 1155.0f, 0.5f, this->unk6A4 * 261.0f);
+ Math_ApproachF(&this->unk698.y, 50.0f, 0.5f, this->unk6A4 * 4.0f);
+ Math_ApproachF(&this->unk698.z, 2822.0f, 0.5f, this->unk6A4 * 38.0f);
+
+ this->actor.world.pos.x = BREG(27) + 1376.0f;
+ this->actor.world.pos.y = 45.0f;
+ this->actor.world.pos.z = BREG(28) + 2864.0f;
+
+ if (this->unk684 != (u32)(BREG(29) + 0x14)) {
+ break;
+ }
+
+ this->unk688 = 5;
+ this->unk684 = 0;
+ Animation_MorphToLoop(&D_809BEFD8->unk194, &D_06021B10, 0.0f);
+ D_809BEFD8->actor.world.pos.x = BREG(30) + 1363.0f + 120.0f;
+ Message_StartTextbox(play, 0x1533, NULL);
+ this->unk6B0 = 30.0f;
+ play->envCtx.lightSettingOverride = 2;
+ /* Fallthrough */
+ case 5:
+ if (this->unk684 == (u32)(BREG(71) + 2)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_SIT);
+ }
+ if ((this->unk684 == (u32)(BREG(72) + 0xA)) || (this->unk684 == (u32)(BREG(73) + 0x19)) ||
+ (this->unk684 == (u32)(BREG(74) + 0x28))) {
+ Actor_PlaySfxAtPos(&D_809BEFD8->actor, D_809BEFD8->unk6B4);
+ }
+ if ((this->unk684 >= 9) && (this->unk684 < 0x2C)) {
+ this->unk430 = KREG(42) + 200.0f;
+ }
+ if (Animation_OnFrame(&this->unk194, this->unk1D8)) {
+ Animation_MorphToLoop(&this->unk194, &D_0600FC78, 0.0f);
+ this->unk1D8 = 1000.0f;
+ }
+ this->unk68C.x = 1349.0f;
+ this->unk68C.y = 126.0f;
+ this->unk68C.z = 2740.0f;
+ this->unk698.x = 1377.0f;
+ this->unk698.y = 121.0f;
+ this->unk698.z = 2851.0f;
+ Math_ApproachF(&D_809BEFD8->actor.world.pos.x, BREG(30) + 1363.0f + 30.0f, 1.0f, BREG(32) + 2.0f);
+ D_809BEFD8->actor.world.pos.y = 45.0f;
+ D_809BEFD8->actor.world.pos.z = BREG(31) + 2864.0f + 60.0f;
+ if (this->unk684 == (u32)(BREG(35) + 0x2D)) {
+ Animation_MorphToPlayOnce(&D_809BEFD8->unk194, &D_0600D870, -10.0f);
+ Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_PAUSE_K);
+ }
+ if (this->unk684 != (u32)(BREG(33) + 0x50)) {
+ break;
+ }
+ this->unk688 = 6;
+ this->unk684 = 0;
+ Animation_MorphToLoop(&D_809BEFD4->unk194, &D_06021B10, 0.0f);
+ D_809BEFD4->actor.world.pos.x = BREG(30) + 1363.0f + 120.0f;
+ D_809BEFD8->actor.world.pos.z = 3164.0f;
+ Message_StartTextbox(play, 0x151B, NULL);
+ play->envCtx.lightSettingOverride = 3;
+ /* Fallthrough */
+ case 6:
+ if ((this->unk684 == (u32)(BREG(72) + 0xA)) || (this->unk684 == (u32)(BREG(73) + 0x19)) ||
+ (this->unk684 == (u32)(BREG(74) + 0x28))) {
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, D_809BEFD4->unk6B4);
+ }
+ if ((this->unk684 >= 0xA) && (this->unk684 < 0x22)) {
+ this->unk430 = KREG(42) + 200.0f;
+ }
+ this->unk68C.x = 1343.0f;
+ this->unk68C.y = 146.0f;
+ this->unk68C.z = 2975.0f;
+ this->unk698.x = 1372.0f;
+ this->unk698.y = 122.0f;
+ this->unk698.z = 2867.0f;
+ Math_ApproachF(&D_809BEFD4->actor.world.pos.x, BREG(30) + 1363.0f + 30.0f, 1.0f, BREG(32) + 2.0f);
+ D_809BEFD4->actor.world.pos.y = 45.0f;
+ D_809BEFD4->actor.world.pos.z = (BREG(31) + 2864.0f) - 60.0f;
+ if (this->unk684 == (u32)(BREG(35) + 0x2D)) {
+ Animation_MorphToPlayOnce(&D_809BEFD4->unk194, &D_0600D870, -10.0f);
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_PAUSE_K);
+ }
+ if (this->unk684 != (u32)(BREG(33) + 0x50)) {
+ break;
+ }
+ this->unk688 = 7;
+ this->unk684 = 0;
+ D_809BEFD4->actor.world.pos.z = ((BREG(31) + 2864.0f) - 60.0f) - 10.0f;
+ D_809BEFD8->actor.world.pos.z = BREG(31) + 2864.0f + 60.0f + 10.0f;
+ D_809BEFD4->actor.world.pos.x = (BREG(30) + 1363.0f + 30.0f) - 40.0f;
+ D_809BEFD8->actor.world.pos.x = (BREG(30) + 1363.0f + 30.0f) - 40.0f;
+ this->unk68C.x = 1339.0f;
+ this->unk68C.y = 117.0f;
+ this->unk68C.z = 2864.0f;
+ this->unk698.x = 1452.0f;
+ this->unk698.y = 120.0f;
+ this->unk698.z = 2864.0f;
+ this->unk6A4 = 0.0f;
+ Message_StartTextbox(play, 0x1534, NULL);
+ this->unk6B0 = 60.0f;
+ play->envCtx.lightSettingOverride = 4;
+ /* Fallthrough */
+ case 7:
+ if (this->unk684 >= (u32)(BREG(37) + 0x14)) {
+ if (this->unk684 == (u32)(BREG(37) + 0x14)) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06009D8C, 0.0f);
+ this->unk1D8 = Animation_GetLastFrame(&D_06009D8C);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_STAND);
+ }
+ if (Animation_OnFrame(&this->unk194, this->unk1D8) != 0) {
+ Animation_MorphToLoop(&this->unk194, &D_06008390, 0.0f);
+ this->unk1D8 = 1000.0f;
+ }
+ }
+ if (this->unk684 < (u32)(BREG(87) + 0x14)) {
+ this->unk430 = 200.0f;
+ }
+ if (this->unk684 == (u32)(BREG(37) + 0x19)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HAND);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_ATTACK);
+ }
+ if (this->unk684 == (u32)(BREG(44) + 0x28)) {
+ Animation_MorphToLoop(&D_809BEFD4->unk194, &D_0600CDE0, -5.0f);
+ Animation_MorphToLoop(&D_809BEFD8->unk194, &D_0600CDE0, -5.0f);
+ }
+ if (this->unk684 == 0x00000028) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_MID);
+ }
+ if (this->unk684 == 0x0000002D) {
+ Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_LAUGH_K);
+ }
+ if (this->unk684 == 0x00000032) {
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
+ }
+ Math_ApproachF(&this->unk68C.x, 1196.0f, 0.1f, this->unk6A4 * 143.0f);
+ Math_ApproachF(&this->unk68C.y, 52.0f, 0.1f, this->unk6A4 * 65.0f);
+ Math_ApproachF(&this->unk698.x, 1302.0f, 0.1f, this->unk6A4 * 150.0f);
+ Math_ApproachF(&this->unk698.y, 90.0f, 0.1f, this->unk6A4 * 30.0f);
+ Math_ApproachF(&this->unk6A4, BREG(45) * 0.01f + 0.1f, 1.0f, BREG(45) * 0.0001f + 0.01f);
+
+ if (this->unk684 != (u32)(BREG(18) + 0x3C)) {
+ break;
+ }
+
+ this->unk688 = 8;
+ this->unk684 = 0;
+
+ this->unk68C.x = 1309.0f;
+ this->unk68C.y = 103.0f;
+ this->unk68C.z = 2790.0f;
+
+ this->unk698.x = 1421.0f;
+ this->unk698.y = 103.0f;
+ this->unk698.z = 2790.0f;
+
+ play->envCtx.lightSettingOverride = 5;
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
+ /* Fallthrough */
+ case 8:
+ if (this->unk684 == 0x0000000F) {
+ this->unk68C.x = 1309.0f;
+ this->unk68C.y = 103.0f;
+ this->unk68C.z = 2930.0f;
+ this->unk698.x = 1421.0f;
+ this->unk698.y = 103.0f;
+ this->unk698.z = 2930.0f;
+ Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_LAUGH_K);
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
+ }
+ if (this->unk684 == 0x0000001E) {
+ this->unk68C.x = 1324.0f;
+ this->unk68C.y = 144.0f;
+ this->unk68C.z = 2864.0f;
+ this->unk698.x = 1436.0f;
+ this->unk698.y = 144.0f;
+ this->unk698.z = 2864.0f;
+ play->envCtx.lightSettingOverride = 6;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_LAUGH_DEMO_K);
+ Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_LAUGH_K);
+ Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
+ }
+ if (this->unk684 == (u32)(BREG(19) + 0x37)) {
+ temp_v0_2 = Play_GetCamera(play, 0);
+ this->unk688 = 0;
+
+ func_809B6528(this, play);
+ func_809B41D8(D_809BEFD4, play);
+ func_809B41D8(D_809BEFD8, play);
+
+ D_809BEFD8->actor.gravity = -1.5f;
+ D_809BEFD4->actor.gravity = D_809BEFD8->actor.gravity;
+ D_809BEFD8->unk152 = 1;
+ D_809BEFD4->unk152 = D_809BEFD8->unk152;
+
+ temp_v0_2->eye = this->unk68C;
+ temp_v0_2->eyeNext = this->unk68C;
+ temp_v0_2->at = this->unk698;
+
+ func_80169AFC(play, this->unk_68A, 0);
+ this->unk_68A = 0;
+ Cutscene_End(play, &play->csCtx);
+ func_800B7298(play, &this->actor, 6);
+ D_809BDB00 = 1;
+ this->unk_153 = 2;
+ func_801477B4(play);
+ play->envCtx.lightSettingOverride = 7;
+ gSaveContext.eventInf[5] |= 0x80;
+ }
+ break;
+ }
+
+ if (this->unk_68A != 0) {
+ ShrinkWindow_SetLetterboxTarget(27);
+ temp_fv1 = Math_SinS(this->unk146 * 0x6000) * 0.5f * sp64;
+
+ sp50.x = this->unk68C.x;
+ sp50.y = this->unk68C.y + temp_fv1;
+ sp50.z = this->unk68C.z;
+ sp44.x = this->unk698.x;
+ sp44.y = this->unk698.y + 2.0f * temp_fv1;
+ sp44.z = this->unk698.z;
+ Play_CameraSetAtEye(play, this->unk_68A, &sp44, &sp50);
+ Play_CameraSetFov(play, this->unk_68A, this->unk6B0);
+ sp60->actor.world.rot.y = sp60->actor.shape.rot.y = this->unk6AC;
+ }
+
+ Math_ApproachF(&this->unk42C, this->unk430, 1.0f, 2.0f * KREG(41) + 200.0f);
+ this->unk428 = Math_SinS((KREG(40) * 0x100 + 0x3F00) * this->unk146) * this->unk42C + this->unk42C;
+ Math_ApproachZeroF(&this->unk42C, 1.0f, KREG(41) + 100.0f);
+
+ if ((this->unk430 >= 50.0f) && !(this->unk146 & 1) && (Rand_ZeroOne() < 0.5f)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_TALK);
+ }
+}
+
+void func_809B9A18(EnKnight* arg0, PlayState* arg1) {
+ s32 var_s0;
+ s32 var_s4;
+ Vec3f sp4C;
+ Player* temp_v0 = GET_PLAYER(arg1);
+
+ if (arg0->unk534.elements[0].info.bumperFlags & 2) {
+ arg0->unk534.elements[0].info.bumperFlags &= 0xFFFD;
+ arg0->unk193 = 5;
+ if ((temp_v0->meleeWeaponState != 0) && (temp_v0->meleeWeaponAnimation >= 0x1E) && (arg0->unk478 == 0)) {
+ play_sound(NA_SE_IT_SHIELD_REFLECT_SW);
+ CollisionCheck_SpawnShieldParticlesMetal(arg1, &arg0->unk47C);
+ arg0->unk478 = 5;
+ }
+ Matrix_RotateYS(arg0->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ((arg0 == D_809BEFD0) ? -6.0f : -4.0f, &sp4C);
+ arg0->unk2A4 = sp4C.x;
+ arg0->unk2A8 = sp4C.z;
+ return;
+ }
+
+ for (var_s4 = 0; var_s4 < 2; var_s4++) {
+ if (arg0->unk156 != 0) {
+ continue;
+ }
+
+ if (arg0->unk594.elements[var_s4].info.bumperFlags & 2) {
+ arg0->unk594.elements[var_s4].info.bumperFlags &= ~2;
+
+ switch (arg0->actor.colChkInfo.damageEffect) {
+ case 3:
+ arg0->unk2A1 = 0x0A;
+ func_809B4E84(arg0, arg1, 0x0050);
+ Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
+ arg0->unk156 = 0x000F;
+ break;
+ case 1:
+ func_809B4E84(arg0, arg1, 0x0028);
+ Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
+ arg0->unk156 = 0x000F;
+ break;
+ case 2:
+ arg0->unk2A1 = 1;
+ break;
+ case 4:
+ arg0->unk2A1 = 0x14;
+ break;
+ case 14:
+ arg0->unk291 = 0x0A;
+ break;
+ case 10:
+ arg0->unk2A1 = 0x28;
+ func_809B4E84(arg0, arg1, 0x0028);
+ Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
+ arg0->unk156 = 0x000F;
+ break;
+ case 13:
+ if (arg0->actor.bgCheckFlags & 1) {
+ Matrix_RotateYS(arg0->unk172, MTXMODE_NEW);
+ Matrix_MultVecZ(-4.0f, &sp4C);
+ arg0->unk2A4 = sp4C.x;
+ arg0->unk2A8 = sp4C.z;
+ arg0->actor.velocity.y = 5.0f;
+
+ for (var_s0 = 0; var_s0 < 5; var_s0++) {
+ func_809B22CC(arg0, arg1, 0);
+ }
+ }
+ break;
+ }
+ if (arg0->actor.colChkInfo.damage != 0) {
+ arg0->actor.colChkInfo.health -= arg0->actor.colChkInfo.damage;
+ if ((s8)arg0->actor.colChkInfo.health <= 0) {
+ func_809B51DC(arg0, arg1);
+ Enemy_StartFinishingBlow(arg1, &arg0->actor);
+ Actor_PlaySfxAtPos(&arg0->actor, arg0->unk6C0);
+ } else if (arg0->actor.colChkInfo.damageEffect != 3) {
+ func_809B4F90(arg0, arg1);
+ Actor_PlaySfxAtPos(&arg0->actor, arg0->unk6BE);
+ }
+ arg0->unk156 = 0x000A;
+ arg0->unk158 = 0x000F;
+ }
+ arg0->unk192 = 0;
+ }
+ }
+}
+
+void func_809B9D24(EnKnight* this, PlayState* play) {
+ if (this->unk156 == 0) {
+ s32 i;
+
+ for (i = 0; i < 2; i++) {
+ ColliderJntSphElement* temp_v0 = &this->unk594.elements[i];
+ ColliderInfo* acHitInfo;
+
+ if (temp_v0->info.bumperFlags & 2) {
+ temp_v0->info.bumperFlags &= ~2;
+
+ acHitInfo = temp_v0->info.acHitInfo;
+
+ this->unk156 = 10;
+ if (acHitInfo->toucher.dmgFlags & 0x200000) {
+ this->unk158 = 15;
+ this->unk156 = 1000;
+ func_809B5634(this, play);
+ }
+ }
+ }
+ }
+}
+
+void func_809B9E00(EnKnight* this, PlayState* play) {
+ Vec3f sp94;
+ Vec3f sp88;
+ s32 i;
+
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->unk1DC[0], 30, NA_SE_EV_ICE_BROKEN);
+
+ for (i = 0; i < 15; i++) {
+ sp88.x = randPlusMinusPoint5Scaled(7.0f);
+ sp88.z = randPlusMinusPoint5Scaled(7.0f);
+ sp88.y = Rand_ZeroFloat(6.0f) + 4.0f;
+ sp94.x = sp88.x + this->unk1DC[i].x;
+ sp94.y = sp88.y + this->unk1DC[i].y;
+ sp94.z = sp88.z + this->unk1DC[i].z;
+ EffectSsEnIce_Spawn(play, &sp94, Rand_ZeroFloat(0.5f) + 0.7f, &sp88, &D_809BDD00, &D_809BDCF8, &D_809BDCFC,
+ 0x1E);
+ }
+}
+
+void func_809B9F8C(EnKnight* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+
+ if (this->unk156 == 0) {
+ if (this->unk634.base.acFlags & AC_HIT) {
+ this->unk634.base.acFlags &= ~AC_HIT;
+ this->unk156 = 0xF;
+ if (&this->actor == player->actor.parent) {
+ player->unk_AE8 = 0x65;
+ player->actor.parent = NULL;
+ player->csMode = 0;
+ func_80165690();
+ func_800B8D50(play, &this->actor, 10.0f, D_809BEFD0->unk172, 5.0f, 16);
+ func_809BA058(this, play);
+ this->unk148 = 1;
+ this->unk14A[1] = 0x1E;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_LAUGH_DEMO_K);
+ }
+ }
+ }
+}
+
+void func_809BA058(EnKnight* this, PlayState* play) {
+ Animation_MorphToPlayOnce(&this->unk194, &D_06003008, 0.0f);
+ this->unk194.curFrame = 19.0f;
+ this->actionFunc = func_809BA0CC;
+ this->unk148 = 0;
+ this->unk14A[1] = KREG(77) + 0xC8;
+ this->actor.flags |= ACTOR_FLAG_1;
+}
+
+void func_809BA0CC(EnKnight* this, PlayState* play) {
+ f32 sp4C;
+ f32 sp48;
+ f32 sp44;
+ s32 pad;
+ f32 sp3C;
+ s16 sp3A;
+ s16 sp38;
+ Player* player = GET_PLAYER(play);
+
+ SkelAnime_Update(&this->unk194);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_FLOAT - SFX_FLAG);
+
+ switch (this->unk148) {
+ case 0:
+ this->unk148 = 1;
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_MultVecZ(500.0f, &this->unk440);
+ this->unk440.x += this->actor.world.pos.x;
+ this->unk440.y = this->actor.world.pos.y + 500.0f;
+ this->unk440.z += this->actor.world.pos.z;
+ this->actor.world.rot.x = KREG(39) * 0x1000 + 0x2000;
+ this->unk14A[0] = 0x14;
+ D_809BEFD0->actor.flags &= ~1;
+ player->unk_730 = &this->actor;
+ play->actorCtx.targetContext.arrowPointedActor = &this->actor;
+ play->actorCtx.targetContext.targetedActor = &this->actor;
+ Math_Vec3f_Copy(&this->actor.world.pos, &D_809BEFD0->actor.world.pos);
+ Math_Vec3s_Copy(&this->actor.world.rot, &D_809BEFD0->actor.world.rot);
+ Math_Vec3s_Copy(&this->actor.shape.rot, &D_809BEFD0->actor.world.rot);
+ this->unk156 = 0xA;
+ this->unk152 = 1;
+ return;
+ case 1:
+ this->unk428 = (Math_SinS((KREG(40) * 0x100 + 0x1200) * this->unk146) * 1000.0f) + 1000.0f;
+ sp4C = this->unk440.x - this->actor.world.pos.x;
+ sp48 = this->unk440.y - this->actor.world.pos.y;
+ sp44 = this->unk440.z - this->actor.world.pos.z;
+ sp3C = sqrtf(SQ(sp4C) + SQ(sp48) + SQ(sp44));
+
+ if ((this->unk14A[1] == 1) || (KREG(5) != 0)) {
+ KREG(5) = 0;
+ if (D_809BEFD0->actionFunc != func_809B52E8 && D_809BEFD0->actionFunc != func_809B5698) {
+ this->unk14A[1] = 0;
+ func_809B6D38(D_809BEFD0, play);
+ Animation_MorphToPlayOnce(&this->unk194, &D_060079D4, -10.0f);
+ this->unk152 = 0;
+ this->unk194.playSpeed = 0.0f;
+ } else {
+ this->unk14A[1] = 0x32;
+ }
+ }
+ if (this->unk14A[1] == 0) {
+ Math_Vec3f_Copy(&this->unk440, &D_809BEFD0->actor.world.pos);
+ this->unk440.y += 100.0f;
+ if (sp3C < 100.0f) {
+ Math_ApproachF(&this->actor.speedXZ, (f32)sREG(48) + 1.5f, 1.0f, 0.3f);
+ }
+ if (sp3C < 30.0f) {
+ this->unk148 = 2;
+ this->unk14A[0] = 0x32;
+ this->unk156 = 0x3E8;
+ break;
+ }
+ } else {
+ Math_ApproachF(&this->actor.speedXZ, sREG(48) + 5.0f, 1.0f, 5.0f);
+ if (this->unk14A[0] == 0 || sp3C < 50.0f) {
+ this->unk14A[0] = Rand_ZeroFloat(50.0f) + 50.0f;
+ if (Rand_ZeroOne() < 0.2f) {
+ Math_Vec3f_Copy(&this->unk440, &player->actor.world.pos);
+ this->unk440.y += 25.0f;
+ } else {
+ this->unk440.x = randPlusMinusPoint5Scaled(500.0f) + player->actor.world.pos.x;
+ this->unk440.y = Rand_ZeroFloat(100.0f) + player->actor.world.pos.y + 50.0f;
+ this->unk440.z = randPlusMinusPoint5Scaled(500.0f) + player->actor.world.pos.z;
+ }
+ }
+ }
+ sp38 = Math_Atan2S(sp4C, sp44);
+ sp3A = Math_Atan2S(sp48, sqrtf(SQ(sp4C) + SQ(sp44)));
+ Math_ApproachS(&this->actor.world.rot.y, sp38, 0xA, 0x800);
+ Math_ApproachS(&this->actor.world.rot.x, sp3A, 0xA, 0x800);
+ Math_ApproachF(&this->unk164.x, 300.0f, 0.1f, 3.0f);
+ Math_ApproachF(&this->unk164.y, -3800.0f, 0.1f, 38.0f);
+ Math_ApproachF(&this->unk164.z, -900.0f, 0.1f, 9.0f);
+ Math_ApproachS(&this->actor.shape.rot.y, this->unk172, 0xA, 0x200);
+ Math_ApproachS(&this->actor.shape.rot.x, this->unk170, 0xA, 0x200);
+ if (this->unk14A[1] == 0x28) {
+ func_809BA940(this, play);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_CYNICAL);
+ }
+ break;
+ case 2:
+ case 3:
+ this->unk156 = 10;
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.1f);
+ Math_ApproachS(&this->actor.shape.rot.y, D_809BEFD0->actor.world.rot.y, 5, 0x800);
+ Math_ApproachS(&this->actor.shape.rot.x, 0, 5, 0x800);
+ Math_ApproachZeroF(&this->unk164.x, 0.5f, (sREG(73) * 0.01f + 0.05f) * 300.0f);
+ Math_ApproachZeroF(&this->unk164.y, 0.5f, (sREG(73) * 0.01f + 0.05f) * 3800.0f);
+ Math_ApproachZeroF(&this->unk164.z, 0.5f, (sREG(73) * 0.01f + 0.05f) * 900.0f);
+ Math_ApproachF(&this->actor.world.pos.x, D_809BEFD0->actor.world.pos.x, 0.5f, sREG(74) * 0.1f + 4.0f);
+ Math_ApproachF(&this->actor.world.pos.y, D_809BEFD0->actor.world.pos.y, 0.5f, sREG(74) * 0.1f + 4.0f);
+ Math_ApproachF(&this->actor.world.pos.z, D_809BEFD0->actor.world.pos.z, 0.5f, sREG(74) * 0.1f + 4.0f);
+ if (this->unk148 == 2) {
+ if ((fabsf(this->actor.world.pos.x - D_809BEFD0->actor.world.pos.x) < 30.0f) &&
+ (fabsf(this->actor.world.pos.z - D_809BEFD0->actor.world.pos.z) < 30.0f) &&
+ (fabsf(this->actor.world.pos.y - D_809BEFD0->actor.world.pos.y) < sREG(75) * 0.1f + 30.0f)) {
+ this->unk148 = 3;
+ D_809BEFD0->unk148 = 1;
+ this->unk194.playSpeed = 1.0f;
+ }
+ }
+ break;
+ }
+}
+
+void func_809BA940(EnKnight* this, PlayState* play) {
+ this->actionFunc = func_809BA978;
+ this->unk148 = 0;
+ this->unk14A[0] = BREG(16) + 0x3C;
+ this->unk14A[2] = 0xFA;
+}
+
+void func_809BA978(EnKnight* this, PlayState* play) {
+ Vec3f sp54;
+ f32 sp50;
+ f32 sp4C;
+ f32 sp48;
+ f32 sp44;
+ s16 sp42;
+ s16 sp40;
+ Player* player = GET_PLAYER(play);
+ s32 pad;
+
+ Matrix_RotateYS(player->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_MultVecZ(7.0f, &sp54);
+
+ if (player->transformation == 1) {
+ sp54.y = 67.0f;
+ } else if (player->transformation == 0) {
+ sp54.y = 85.0f;
+ } else if (player->transformation == 2) {
+ sp54.y = 60.0f;
+ } else if (player->transformation == 3) {
+ sp54.y = 34.0f;
+ } else {
+ sp54.y = 40.0f;
+ }
+
+ sp50 = player->actor.world.pos.x - this->actor.world.pos.x;
+ sp4C = BREG(17) + (player->actor.world.pos.y + 100.0f) - this->actor.world.pos.y;
+ sp48 = player->actor.world.pos.z - this->actor.world.pos.z;
+
+ if (this->unk148 != 1) {
+ f32 var_fv1 = (this->unk148 == 2) ? 3000.0f : 1000.0f;
+
+ this->unk428 = Math_SinS((KREG(40) * 0x100 + 0x1200) * this->unk146) * 1000.0f + var_fv1;
+ }
+
+ sp44 = sqrtf(SQ(sp50) + SQ(sp48));
+
+ switch (this->unk148) {
+ case 0:
+ Math_ApproachF(&this->actor.speedXZ, BREG(18) + 10.0f, 1.0f, 1.0f);
+ sp40 = Math_Atan2S(sp50, sp48);
+ sp42 = Math_Atan2S(sp4C, sp44);
+ Math_ApproachS(&this->actor.world.rot.y, sp40, 0xA, 0x800);
+ Math_ApproachS(&this->actor.world.rot.x, sp42, 0xA, 0x800);
+
+ if (this->unk14A[2] == 0) {
+ func_809BA058(this, play);
+ this->unk148 = 1;
+ this->unk14A[1] = 0x1E;
+ break;
+ }
+
+ if (this->unk14A[0] == 0 && sp44 < BREG(19) + 100.0f) {
+ this->unk148 = 1;
+ this->unk14A[2] = 0x3C;
+ this->unk6A4 = 0.0f;
+ }
+ break;
+ case 1:
+ this->unk152 = 0;
+ Math_ApproachS(&this->unk428, 0xFA0, 5, 0x1000);
+ Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 1.0f);
+ Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x + sp54.x, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + sp54.y, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->actor.world.pos.z, player->actor.world.pos.z + sp54.z, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->unk6A4, BREG(20) + 20.0f, 1.0f, BREG(21) + 0.5f);
+
+ if (this->unk14A[2] == 0 || (player->stateFlags3 & 0x1000)) {
+ func_809BA058(this, play);
+ this->unk148 = 1;
+ this->unk14A[1] = 0x1E;
+ break;
+ }
+
+ if (sp44 < BREG(22) + 20.0f) {
+ if (play->grabPlayer(play, player) != 0) {
+ func_8016566C(0x96);
+ player->actor.parent = &this->actor;
+ Audio_PlaySfxGeneral(NA_SE_VO_LI_DAMAGE_S, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0,
+ &D_801DB4B8);
+ this->actor.flags &= ~1;
+ this->unk148 = 2;
+ this->unk14A[0] = 0x50;
+ } else {
+ this->unk14A[2] = 0;
+ }
+ }
+ break;
+ case 2:
+ if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) ||
+ CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
+
+ if (1) {}
+ if (this->unk14A[0] != 0) {
+ this->unk14A[0]--;
+ if (1) {}
+ }
+ if (this->unk14A[0] != 0) {
+ this->unk14A[0]--;
+ }
+ if (this->unk14A[0] != 0) {
+ this->unk14A[0]--;
+ }
+ if (this->unk14A[0] != 0) {
+ this->unk14A[0]--;
+ }
+ if (this->unk14A[0] != 0) {
+ this->unk14A[0]--;
+ }
+ }
+ Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x + sp54.x, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + sp54.y, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->actor.world.pos.z, player->actor.world.pos.z + sp54.z, 1.0f, this->unk6A4);
+ Math_ApproachF(&this->unk6A4, BREG(20) + 20.0f, 1.0f, BREG(21) + 0.5f);
+ Math_ApproachS(&this->actor.shape.rot.y, player->actor.shape.rot.y + 0x8000, 2, 0x1000);
+ Math_ApproachS(&this->actor.shape.rot.x, BREG(83) * 0x800 + 0x4000, 2, 0x1000);
+ player->unk_AE8 = 0x5A;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_BITE - SFX_FLAG);
+ if (this->unk14A[0] == 0 && &this->actor == player->actor.parent) {
+ player->unk_AE8 = 0x65;
+ player->actor.parent = NULL;
+ player->csMode = 0;
+ func_80165690();
+ func_809BA058(this, play);
+ this->unk148 = 1;
+ this->unk14A[1] = 0x1E;
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_LAUGH_DEMO_K);
+ }
+ break;
+ }
+
+ if (this->unk148 != 2) {
+ Math_ApproachS(&this->actor.shape.rot.y, this->unk172, 0xA, 0x200);
+ Math_ApproachS(&this->actor.shape.rot.x, this->unk170, 0xA, 0x200);
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_FLOAT - SFX_FLAG);
+ }
+}
+
+void EnKnight_Update(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+ Input* input;
+ PlayState* play2 = play;
+ Player* sp78;
+ f32 sp74;
+ f32 sp70;
+ f32 sp6C;
+ u8 var_a0;
+ s32 var_v1;
+
+ sp78 = GET_PLAYER(play);
+ Math_Vec3f_Copy(&this->unk6C8, &this->actor.projectedPos);
+ sp74 = sp78->actor.world.pos.x - this->actor.focus.pos.x;
+ sp70 = KREG(93) + ((sp78->actor.world.pos.y + 34.0f) - this->actor.focus.pos.y);
+ sp6C = sp78->actor.world.pos.z - this->actor.focus.pos.z;
+
+ this->unk172 = Math_FAtan2F(sp6C, sp74);
+ this->unk170 = Math_Atan2S(-sp70, sqrtf(SQ(sp74) + SQ(sp6C)));
+
+ this->unk146++;
+
+ if (this == D_809BEFDC) {
+ for (var_a0 = 0; var_a0 < 3; var_a0++) {
+ if (this->unk14A[var_a0] != 0) {
+ this->unk14A[var_a0]--;
+ }
+ }
+
+ if (this->unk156 != 0) {
+ this->unk156--;
+ }
+ if (this->unk158 != 0) {
+ this->unk158--;
+ }
+ this->actionFunc(this, play);
+ Math_ApproachS(&this->unk184, this->unk186, 5, 0x2000);
+ this->unk186 = 0;
+ Actor_UpdateVelocityWithoutGravity(&this->actor);
+ Actor_UpdatePos(&this->actor);
+ this->actor.world.pos.x += this->unk2A4;
+ this->actor.world.pos.z += this->unk2A8;
+ Math_ApproachZeroF(&this->unk2A4, 1.0f, KREG(86) + 2.0f);
+ Math_ApproachZeroF(&this->unk2A8, 1.0f, KREG(86) + 2.0f);
+ if (this->unk152 != 0) {
+ Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 20.0f, 100.0f, 5);
+ }
+ func_809B9F8C(this, play);
+
+ this->unk488.dim.pos.x = (s32)this->actor.focus.pos.x;
+ this->unk488.dim.pos.y = (s32)this->actor.focus.pos.y;
+ this->unk488.dim.pos.z = (s32)this->actor.focus.pos.z;
+
+ if (this->actionFunc == func_809BA978) {
+ if (this->unk148 < 2) {
+ if (this->unk148 == 0) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk488.base);
+ }
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk488.base);
+ } else {
+ this->unk634.dim.radius = KREG(34) + 0x14;
+ this->unk634.dim.height = KREG(35) + 0x28;
+ this->unk634.dim.yShift = 0;
+ this->unk634.dim.pos.x = (s32)sp78->actor.world.pos.x;
+ this->unk634.dim.pos.y = (s32)sp78->actor.world.pos.y;
+ this->unk634.dim.pos.z = (s32)sp78->actor.world.pos.z;
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk634.base);
+ }
+ } else {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk488.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk488.base);
+ }
+
+ if ((this->actionFunc != func_809BA978 || this->unk148 != 2) && !(BREG(76) & this->unk146)) {
+ EnKnight* temp_v0_5 = (EnKnight*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_KNIGHT,
+ 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, 0xCA);
+ if (temp_v0_5 != NULL) {
+ for (var_v1 = 0; var_v1 < 29; var_v1++) {
+ temp_v0_5->unk194.jointTable[var_v1] = this->unk194.jointTable[var_v1];
+ temp_v0_5->unk194.skeleton = this->unk194.skeleton;
+ temp_v0_5->unk194.dListCount = this->unk194.dListCount;
+ }
+ Math_Vec3f_Copy(&temp_v0_5->unk164, &this->unk164);
+ }
+ }
+ } else {
+ this->unk_680 = 0;
+
+ if (this == D_809BEFD0) {
+ Actor* var_v0;
+
+ D_809BEFE4 = NULL;
+ for (var_v0 = play->actorCtx.actorLists[7].first; var_v0 != NULL; var_v0 = var_v0->next) {
+ if (var_v0->id == ACTOR_MIR_RAY3) {
+ D_809BEFE4 = (MirRay3*)var_v0;
+ break;
+ }
+ }
+
+ this->unk_144 = gSaveContext.save.time;
+ Math_ApproachS(&this->unk428, 0, 2, 0x0200);
+ } else if (D_809BEFD0->unk_154 == 0) {
+ this->actor.hintId = 0x1D;
+ } else {
+ this->actor.hintId = 0x1E;
+ }
+
+ if (D_809BEFD0->unk_151 != 0) {
+ if ((this == D_809BEFD0) && (this->actionFunc == func_809B6764)) {
+ func_809B5D38(this, play);
+ }
+ if (!((this == D_809BEFD0) && (this->actionFunc == func_809B5D54))) {
+ return;
+ }
+ }
+
+ this->unk190 = 0;
+ this->unk191 = 0;
+ this->unk192 = 0;
+ this->unk594.base.colType = 3;
+ if (((KREG(63) == 0) && (this != D_809BEFD0)) || ((KREG(63) != 2) && (this == D_809BEFD0))) {
+ for (var_a0 = 0; var_a0 < 3; var_a0++) {
+ if (this->unk14A[var_a0] != 0) {
+ this->unk14A[var_a0]--;
+ }
+ }
+
+ if (this->unk156 != 0) {
+ this->unk156--;
+ }
+ if (this->unk158 != 0) {
+ this->unk158--;
+ }
+ if (this->unk478 != 0) {
+ this->unk478--;
+ }
+ if (this->unk2A2 != 0) {
+ this->unk2A2--;
+ }
+ if (this->unk15E != 0) {
+ this->unk15E--;
+ }
+ if (this->unk291 != 0) {
+ this->unk291--;
+ }
+
+ Math_ApproachZeroF(&this->unk474, 1.0f, 0.2f);
+
+ if ((this->actionFunc != func_809B52E8) && (this->actionFunc != func_809B5698)) {
+ Math_ApproachS(&this->actor.shape.rot.x, 0, 0x000A, 0x0200);
+ }
+
+ this->actionFunc(this, play);
+
+ Actor_MoveWithGravity(&this->actor);
+
+ this->actor.world.pos.x += this->unk2A4;
+ this->actor.world.pos.z += this->unk2A8;
+
+ if ((this->unk192 != 0) || (this->actionFunc == func_809B4880)) {
+ func_809B2DD0(this, play);
+
+ if ((this->unk192 != 0) && (D_809BEFE0 != NULL) && (this != D_809BEFE0)) {
+ func_809B5E90(this, play);
+ } else if ((this != D_809BEFD0) && (sp78->stateFlags3 & 0x20000000)) {
+ func_809B5FA8(this, play);
+ }
+ }
+ }
+
+ if (this->unk152 != 0) {
+ Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 50.0f, 150.0f, 5);
+ }
+
+ if (this->actor.bgCheckFlags & 1) {
+ if (this->actor.velocity.y <= 0.0f) {
+ this->actor.velocity.y = -2.0f;
+ }
+ Math_ApproachZeroF(&this->unk2A4, 1.0f, 1.0f);
+ Math_ApproachZeroF(&this->unk2A8, 1.0f, 1.0f);
+ }
+
+ Math_ApproachS(&this->unk184, this->unk186, this->unk18E, this->unk18C);
+ this->unk18C = 0x1000;
+ this->unk18E = 3;
+ Math_ApproachS(&this->unk188, this->unk18A, this->unk18E, this->unk18C);
+ this->unk18A = 0;
+
+ if (this->actionFunc != func_809B4308) {
+ Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x0A00);
+ }
+
+ if (this->actionFunc != func_809B842C && this->actionFunc != func_809B5698 &&
+ this->actionFunc != func_809B58D4 && this->actionFunc != func_809B6764 &&
+ this->actionFunc != func_809B6C54 && this->actionFunc != func_809B6D94 && !Play_InCsMode(play)) {
+
+ if (this->actionFunc != func_809B52E8) {
+ func_809B9A18(this, play);
+
+ if (this->unk190 != 0) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk4D4.base);
+ CollisionCheck_SetAT(play, &play2->colChkCtx, &this->unk4D4.base);
+ }
+
+ if (this->unk191 != 0) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk534.base);
+ }
+
+ if (this->unk162 == 0) {
+ if (this->unk193 == 0) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk594.base);
+ } else {
+ this->unk193--;
+ }
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk594.base);
+
+ if (this->unk192 != 0 &&
+ (sp78->unk_D57 != 0 || (sp78->unk_ADC != 0 && this->actor.xzDistToPlayer <= 120.0f)) &&
+ func_809B316C(this, play)) {
+ f32 var_fv1 = (this == D_809BEFD0) ? 0.65f : 0.25f;
+
+ if ((Rand_ZeroOne() < var_fv1) && (sp78->unk_ADC != 0) && (this->actionFunc != func_809B3DAC) &&
+ !(this->actor.bgCheckFlags & 8)) {
+ func_809B592C(this, play);
+ } else {
+ func_809B3CD0(this, play);
+ }
+ }
+ }
+ } else {
+ func_809B9D24(this, play);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk594.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk594.base);
+ }
+ }
+
+ input = &play->state.input[3];
+ if (CHECK_BTN_ALL(input->press.button, BTN_L) && this == D_809BEFD0) {
+ func_809B5634(D_809BEFD4, play);
+ func_809B5634(D_809BEFD8, play);
+ }
+ if (CHECK_BTN_ALL(input->press.button, BTN_R) && this == D_809BEFD0) {
+ this->unk2A1 = KREG(17);
+ }
+
+ switch (this->unk2A1) {
+ case 0:
+ this->unk2A0 = 0;
+ this->unk2A2 = 0;
+ this->unk29C = 0.0f;
+ break;
+ case 1:
+ this->unk2A0 = 0;
+ this->unk2A2 = 0x0050;
+ this->unk2A1++;
+ this->unk29C = 1.0f;
+ this->unk294 = 0.0f;
+ Actor_SetColorFilter(&this->actor, 0x4000, 0x0078, 0, 0x003C);
+ /* fallthrough */
+ case 2:
+ if (this->unk2A2 == 0) {
+ Math_ApproachZeroF(&this->unk29C, 1.0f, 0.02f);
+ if (this->unk29C == 0.0f) {
+ this->unk2A1 = 0;
+ }
+ } else {
+ Math_ApproachF(&this->unk294, 0.5f, 0.1f, 0.5f);
+ }
+ break;
+ case 10:
+ this->unk2A0 = 0x0B;
+ this->unk2A2 = 0x0050;
+ this->unk2A1++;
+ this->unk29C = 1.0f;
+ this->unk294 = 0.0f;
+ this->unk298 = 1.0f;
+ /* fallthrough */
+ case 11:
+ if (this->unk2A2 == 0) {
+ func_809B9E00(this, play);
+ this->unk2A1 = 0;
+ } else {
+ if (this->unk2A2 == 0x0032) {
+ this->unk2A0 = 0x0A;
+ }
+ Math_ApproachF(&this->unk294, 0.5f, 1.0f, 0.08f);
+ Math_ApproachF(&this->unk298, 0.5f, 0.05f, 0.05f);
+ }
+ break;
+ case 20:
+ this->unk2A0 = 0x14;
+ this->unk2A2 = 0x0028;
+ this->unk2A1++;
+ this->unk29C = 1.0f;
+ this->unk294 = 0.0f;
+ /* fallthrough */
+ case 21:
+ if (this->unk2A2 == 0) {
+ Math_ApproachZeroF(&this->unk294, 1.0f, 0.03f);
+ if (this->unk294 == 0.0f) {
+ this->unk2A1 = 0;
+ this->unk29C = 0.0f;
+ }
+ } else {
+ Math_ApproachF(&this->unk294, 0.75f, 0.5f, 0.5f);
+ }
+ break;
+ case 30:
+ this->unk2A0 = 0x14;
+ this->unk2A2 = 0x000A;
+ this->unk2A1++;
+ this->unk29C = 0.5f;
+ /* fallthrough */
+ case 31:
+ if (this->unk2A2 == 0) {
+ Math_ApproachZeroF(&this->unk294, 1.0f, 0.03f);
+ if (this->unk294 == 0.0f) {
+ this->unk2A1 = 0;
+ this->unk29C = 0.0f;
+ }
+ } else {
+ Math_ApproachF(&this->unk294, 0.5f, 0.5f, 0.3f);
+ }
+ break;
+ case 40:
+ this->unk2A0 = 0x1E;
+ this->unk2A2 = 0x0032;
+ this->unk29C = 1.0f;
+ this->unk294 = (KREG(18) * 0.1f) + 0.5f;
+ this->unk2A1++;
+ /* fallthrough */
+ case 41:
+ if (this->unk2A2 == 0) {
+ Math_ApproachZeroF(&this->unk294, 1.0f, 0.05f);
+ if (this->unk294 == 0.0f) {
+ this->unk2A1 = 0;
+ this->unk29C = 0.0f;
+ }
+ }
+ break;
+ }
+
+ this->unk430 = 0.0f;
+
+ if (this == D_809BEFD0) {
+ if (D_809BDB00 != 0) {
+ D_809BDB00--;
+ if (D_809BDB00 == 0) {
+ func_801A2E54(NA_BGM_MINI_BOSS);
+ }
+ }
+ if (this->unk162 != 0) {
+ Math_ApproachF(&this->unk17C, 60.0f, 1.0f, 8.0f);
+ } else {
+ Math_ApproachF(&this->unk17C, 255.0f, 1.0f, 8.0f);
+ }
+ func_809BD490(this, play);
+ if (this->unk_154 != 0) {
+ u16 var_v0_2;
+
+ play->envCtx.lightSettingOverride = 0;
+ play->envCtx.unk_E0 = 2;
+ if (this->unk_154 == 1) {
+ play->envCtx.unk_C1 = 8;
+ play->envCtx.unk_C2 = 0x0C;
+ } else {
+ play->envCtx.unk_C1 = 0;
+ play->envCtx.unk_C2 = 0x0A;
+ }
+ var_v0_2 = gSaveContext.save.time;
+ if ((s32)var_v0_2 > 0x8000) {
+ var_v0_2 = (0xFFFF - var_v0_2) & 0xFFFF;
+ }
+ play->envCtx.lightBlend = var_v0_2 * 0.000030517578f;
+ }
+ if ((this->unk6C4 == 0) && (this->unk162 == 0) && (Player_GetMask(play) == 0x0F) &&
+ ((this->actionFunc == func_809B6764) || (this->unk192 != 0)) &&
+ (this->actor.xzDistToPlayer < (KREG(82) + 130.0f)) && (func_809B316C(this, play) != 0)) {
+ this->unk6C4 = 1;
+ func_809B78A4(this, play);
+ }
+ }
+ this->actor.shape.shadowAlpha = (this->unk180 * this->unk17C) / 255.0f;
+ }
+}
+
+void func_809BC2C4(EnKnight* this, PlayState* play) {
+ f32 var_fv0;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ func_8012C2DC(play->state.gfxCtx);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&D_06018BC4));
+
+ gSPDisplayList(POLY_XLU_DISP++, D_08000000);
+
+ if (this == D_809BEFD0) {
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)(sREG(11) + 0xB4), 255, 255,
+ (u8)((sREG(14) * 0.1f + 1.0f) * this->unk450));
+ } else {
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)((sREG(14) * 0.1f + 1.0f) * this->unk450));
+ }
+
+ Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_Translate(this->unk454, this->unk458, this->unk45C, MTXMODE_APPLY);
+ Matrix_RotateXFApply(this->unk460);
+ Matrix_RotateZF(this->unk468, MTXMODE_APPLY);
+ Matrix_RotateYF(this->unk464, MTXMODE_APPLY);
+
+ var_fv0 = (this == D_809BEFD0) ? (17.0f / 13) : 1.0f;
+ Matrix_Scale(0.021f * var_fv0, 0.021f * var_fv0, 0.021f * var_fv0, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ switch (this->unk44C) {
+ case 0:
+ gSPDisplayList(POLY_XLU_DISP++, D_06018AF0);
+ break;
+ case 1:
+ gSPDisplayList(POLY_XLU_DISP++, D_060189F0);
+ break;
+ default:
+ case 2:
+ gSPDisplayList(POLY_XLU_DISP++, D_060188F8);
+ break;
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+s32 func_809BC67C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnKnight* this = THIS;
+
+ if (limbIndex == 15) {
+ rot->x += (f32)this->unk184;
+ }
+ if (limbIndex == 18) {
+ rot->z += this->unk428;
+ } else if (limbIndex == 19) {
+ rot->z -= this->unk428;
+ }
+
+ if (limbIndex != 18 && limbIndex != 19) {
+ *dList = NULL;
+ }
+ return 0;
+}
+
+s32 func_809BC720(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) {
+ EnKnight* this = THIS;
+
+ if (limbIndex == 0xF) {
+ rot->x += (f32)this->unk184;
+ rot->z += this->unk188;
+ }
+ if (this == D_809BEFD0) {
+ if (limbIndex == 0x12) {
+ rot->z += this->unk428;
+ } else if (limbIndex == 0x13) {
+ rot->z -= this->unk428;
+ }
+ if (limbIndex == 0x17) {
+ rot->z -= this->unk174;
+ }
+ if (limbIndex == 0x18) {
+ rot->z -= this->unk178;
+ }
+ if (limbIndex == 0x1A) {
+ rot->z -= this->unk176;
+ }
+ if (limbIndex == 0x1B) {
+ rot->z -= this->unk17A;
+ }
+ if ((limbIndex == 0x12 || limbIndex == 0x13) && this->unk162 != 0) {
+ *dList = NULL;
+ }
+ } else if (this == D_809BEFD8) {
+ if (limbIndex == 0xF) {
+ *dList = D_06013020;
+ } else if (limbIndex == 0x12) {
+ *dList = D_06012DB0;
+ } else if (limbIndex == 0x13) {
+ *dList = D_06012400;
+ }
+ }
+ return 0;
+}
+
+void func_809BC8B4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
+ EnKnight* this = THIS;
+ Vec3f sp28;
+
+ if (this->actionFunc == func_809B5698 || this->unk29C > 0.0f) {
+ s8 temp_v0 = D_809BDD3C[limbIndex];
+ if (temp_v0 >= 0) {
+ Matrix_MultZero(&this->unk1DC[temp_v0]);
+ }
+ }
+ if (limbIndex == 15) {
+ Matrix_MultVec3f(&D_809BDD0C, &this->actor.focus.pos);
+ Matrix_MultVec3f(&D_809BDD5C, &this->unk434);
+ }
+ if (limbIndex == 20) {
+ Matrix_MultVec3f(&D_809BDD68, &sp28);
+ func_809B21F4(this, 0, &this->unk594, &sp28);
+ }
+ if (limbIndex == 21) {
+ Matrix_MultVec3f(&D_809BDD74, &sp28);
+ func_809B21F4(this, 1, &this->unk594, &sp28);
+ }
+ if (limbIndex == 6 && this->actionFunc != func_809B6764) {
+ Matrix_MultVec3f(&D_809BDD18, &sp28);
+ func_809B21F4(this, 0, &this->unk534, &sp28);
+ Matrix_MultVec3f(&D_809BDD24, &this->unk47C);
+ }
+ if (limbIndex == 11) {
+ Matrix_MultVec3f(&D_809BDD30, &sp28);
+ func_809B21F4(this, 0, &this->unk4D4, &sp28);
+ }
+ if (limbIndex == 28) {
+ Matrix_MultZero(this->unk2AC);
+ }
+ if (limbIndex == 25) {
+ Matrix_MultZero(&this->unk2AC[1]);
+ }
+}
+
+void func_809BCA80(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ EnKnight* this = THIS;
+
+ if (limbIndex == 15) {
+ Matrix_MultVec3f(&D_809BDD80, &this->actor.focus.pos);
+ Math_Vec3f_Copy(&this->unk434, &this->actor.focus.pos);
+ }
+}
+
+void func_809BCAD8(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** gfx) {
+ EnKnight* this = THIS;
+
+ if (this == D_809BEFD0) {
+ if (limbIndex == 6) {
+ Matrix_Scale(this->unk470, this->unk470, this->unk470, MTXMODE_APPLY);
+ } else if (limbIndex == 11) {
+ Matrix_Scale(this->unk46C, this->unk46C, this->unk46C, MTXMODE_APPLY);
+ }
+ }
+}
+
+Gfx* func_809BCB54(GraphicsContext* gfxCtx) {
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx));
+ gSPEndDisplayList(gfx);
+ return gfx;
+}
+
+Gfx* func_809BCB78(GraphicsContext* gfxCtx, u8 alpha) {
+ Gfx* dList = GRAPH_ALLOC(gfxCtx, 6 * sizeof(Gfx));
+ Gfx* gfx = dList;
+
+ gDPPipeSync(gfx++);
+ gDPSetCombineLERP(gfx++, TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0, PRIMITIVE, 0, COMBINED, 0, COMBINED, 0, ENVIRONMENT,
+ 0);
+ gDPSetEnvColor(gfx++, 255, 255, 255, alpha);
+ gDPSetRenderMode(gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
+ gSPClearGeometryMode(gfx++, G_CULL_BACK);
+ gSPEndDisplayList(gfx++);
+ return dList;
+}
+
+void EnKnight_Draw(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+ f32 temp_fa0;
+ s32 sp6C = false;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ gSPSegment(POLY_OPA_DISP++, 0x0A, func_809BCB54(play->state.gfxCtx));
+ gSPSegment(POLY_XLU_DISP++, 0x0A, func_809BCB54(play->state.gfxCtx));
+
+ if (this->unk17C >= 254.0f) {
+ func_8012C28C(play->state.gfxCtx);
+ gSPSegment(POLY_OPA_DISP++, 0x09, func_809BCB54(play->state.gfxCtx));
+ } else {
+ func_8012C2DC(play->state.gfxCtx);
+ gSPSegment(POLY_XLU_DISP++, 0x09, func_809BCB78(play->state.gfxCtx, (u32)this->unk17C));
+ sp6C = true;
+ }
+
+ if (this->unk158 & 1) {
+ POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
+ }
+
+ if (this->actionFunc == func_809B5698) {
+ POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 0, 0, 0, 255, 900, 1099);
+ }
+
+ if (this == D_809BEFDC) {
+ Matrix_Translate(this->unk164.x, this->unk164.y, this->unk164.z, MTXMODE_APPLY);
+ SkelAnime_DrawFlexOpa(play, this->unk194.skeleton, this->unk194.jointTable, this->unk194.dListCount,
+ func_809BC67C, func_809BCA80, &this->actor);
+ } else {
+ if (this == D_809BEFD0 && sp6C) {
+ POLY_XLU_DISP =
+ SubS_DrawTransformFlex(play, this->unk194.skeleton, this->unk194.jointTable, this->unk194.dListCount,
+ func_809BC720, func_809BC8B4, func_809BCAD8, &this->actor, POLY_XLU_DISP);
+ } else {
+ POLY_OPA_DISP =
+ SubS_DrawTransformFlex(play, this->unk194.skeleton, this->unk194.jointTable, this->unk194.dListCount,
+ func_809BC720, func_809BC8B4, func_809BCAD8, &this->actor, POLY_OPA_DISP);
+ }
+
+ if (this->unk450 > 0.0f) {
+ func_809BC2C4(this, play);
+ Math_ApproachZeroF(&this->unk450, 1.0f, 40.0f);
+ this->unk44C++;
+ if (this->unk44C >= 3) {
+ this->unk44C = 2;
+ }
+ } else {
+ this->unk44C = 0;
+ }
+
+ Actor_DrawDamageEffects(play, &this->actor, this->unk1DC, 15, this->unk294, this->unk298, this->unk29C,
+ this->unk2A0);
+
+ if (this->unk474 > 0.01f) {
+ func_8012C2DC(play->state.gfxCtx);
+
+ gSPDisplayList(POLY_XLU_DISP++, gLightOrb1DL);
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, (u8)(sREG(18) + 0xDC), (u8)(sREG(16) + 0xAA));
+ gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, (u8)(sREG(22) + 0x64), 128);
+
+ Matrix_Translate(this->unk47C.x, this->unk47C.y, this->unk47C.z, MTXMODE_NEW);
+ Matrix_ReplaceRotation(&play->billboardMtxF);
+ Matrix_RotateZS(play->gameplayFrames * 0x80, MTXMODE_APPLY);
+
+ temp_fa0 = (sREG(17) + 600) * 0.01f * this->unk474;
+ Matrix_Scale(temp_fa0, temp_fa0, 1.0f, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL);
+ }
+ }
+
+ POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+
+ if (this == D_809BEFD0) {
+ func_809BD858(this, play);
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_809BD1AC(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+ f32 var_fv0;
+
+ if (this->actor.params == 0xCA) {
+ var_fv0 = BREG(75) + 15.0f;
+ } else {
+ var_fv0 = BREG(78) + 8.0f;
+ }
+ Math_ApproachZeroF(&this->unk17C, 1.0f, var_fv0);
+ if (this->unk17C < 0.1f) {
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+s32 func_809BD260(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) {
+ EnKnight* this = THIS;
+
+ if (this->actor.params == 0xCA && limbIndex != 18 && limbIndex != 19) {
+ *dList = NULL;
+ }
+ return 0;
+}
+
+void func_809BD29C(Actor* thisx, PlayState* play) {
+ EnKnight* this = THIS;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ func_8012C2DC(play->state.gfxCtx);
+ gSPSegment(POLY_XLU_DISP++, 0x09, func_809BCB78(play->state.gfxCtx, this->unk17C));
+ gSPSegment(POLY_XLU_DISP++, 0x0A, func_809BCB78(play->state.gfxCtx, this->unk17C));
+ Matrix_Translate(this->unk164.x, this->unk164.y, this->unk164.z, MTXMODE_APPLY);
+ POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->unk194.skeleton, this->unk194.jointTable, this->unk194.dListCount,
+ func_809BD260, NULL, &this->actor, POLY_XLU_DISP);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_809BD490(EnKnight* this, PlayState* play) {
+ EnKnightEffect* var_s0 = play->specialEffects;
+ Player* player = GET_PLAYER(play);
+ s32 var_s4;
+
+ for (var_s4 = 0; var_s4 < 100; var_s4++, var_s0++) {
+ if (var_s0->unk2A != 0) {
+ var_s0->unk0.x += var_s0->unkC.x;
+ var_s0->unk0.y += var_s0->unkC.y;
+ var_s0->unk0.z += var_s0->unkC.z;
+
+ var_s0->unk2C++;
+
+ var_s0->unkC.x += var_s0->unk18.x;
+ var_s0->unkC.y += var_s0->unk18.y;
+ var_s0->unkC.z += var_s0->unk18.z;
+
+ var_s0->unk18.y = BREG(56) * 0.01f + 1.0f;
+
+ if (var_s0->unk2A == (u32)1) { // fake
+ Math_ApproachF(&var_s0->unk34, (KREG(59) * 0.01f + 1.0f) * var_s0->unk38, 0.1f, var_s0->unk38 * 0.1f);
+
+ if (((s16)(BREG(60) + 0x6E) >= var_s0->unk2E) ||
+ (var_s0->unk0.y < (BREG(62) + (this->actor.floorHeight + 30.0f)))) {
+ if ((s16)(BREG(60) + 0x6E) < var_s0->unk2E) {
+ var_s0->unk2E = BREG(60) + 0x6E;
+ }
+ var_s0->unk18.y = BREG(61) * 0.01f + 0.3f;
+
+ var_s0->unkC.x *= 0.85f + BREG(59) * 0.01f;
+ var_s0->unkC.z *= 0.85f + BREG(59) * 0.01f;
+
+ var_s0->unk38 = (BREG(58) * 0.1f + 2.0f) * 0.025f;
+
+ if (var_s0->unkC.y < 0.0f) {
+ var_s0->unkC.y = 0.0f;
+ }
+ }
+ var_s0->unk2E -= (s16)(BREG(49) + 0xA);
+ if (var_s0->unk2E <= 0) {
+ var_s0->unk2E = 0;
+ var_s0->unk2A = 0;
+ }
+ if (this->unk15E == 0) {
+ f32 temp_fv0_3 = player->actor.world.pos.x - var_s0->unk0.x;
+ f32 temp_fv1_2 = (player->actor.world.pos.y + 25.0f) - var_s0->unk0.y;
+ f32 temp_fa0_2 = player->actor.world.pos.z - var_s0->unk0.z;
+ if ((SQ(temp_fv0_3) + SQ(temp_fv1_2) + SQ(temp_fa0_2)) <
+ ((BREG(57) * 0.1f + 1.0f) * ((2500.0f * var_s0->unk34) / 0.025f))) {
+ this->unk15E = 10;
+ func_800B8D10(play, &this->actor, 0.0f, 0, 0.0f, 1, 4);
+ }
+ }
+ }
+ }
+ }
+}
+
+void func_809BD858(EnKnight* this, PlayState* play) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ s16 i;
+ u8 materialFlag = 0;
+ EnKnightEffect* eff = play->specialEffects;
+
+ OPEN_DISPS(gfxCtx);
+
+ func_8012C2DC(play->state.gfxCtx);
+
+ gDPSetColorDither(POLY_XLU_DISP++, G_CD_BAYER);
+ gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_PATTERN);
+
+ for (i = 0; i < 100; i++, eff++) {
+ if (eff->unk2A != 1) {
+ continue;
+ }
+
+ gDPPipeSync(POLY_XLU_DISP++);
+
+ if (materialFlag == 0) {
+ gSPDisplayList(POLY_XLU_DISP++, gFrozenSteamDL);
+ gDPSetEnvColor(POLY_XLU_DISP++, 155, 145, 155, 128);
+ materialFlag++;
+ }
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 155, 155, 255, eff->unk2E);
+
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(play->state.gfxCtx, 0, (eff->unk2C + (i * 3)) * 3, (eff->unk2C + (i * 3)) * 15, 32,
+ 64, 1, 0, 0, 32, 32));
+
+ Matrix_Translate(eff->unk0.x, eff->unk0.y, eff->unk0.z, MTXMODE_NEW);
+ Matrix_ReplaceRotation(&play->billboardMtxF);
+ Matrix_Scale(eff->unk34, eff->unk34, 1.0f, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gFrozenSteamVtxDL);
+ }
+
+ CLOSE_DISPS(gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.h b/src/overlays/actors/ovl_En_Knight/z_en_knight.h
index a4fca8554..c8815d8bf 100644
--- a/src/overlays/actors/ovl_En_Knight/z_en_knight.h
+++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.h
@@ -9,21 +9,107 @@ typedef void (*EnKnightActionFunc)(struct EnKnight*, PlayState*);
typedef struct EnKnight {
/* 0x000 */ Actor actor;
- /* 0x144 */ s16 unk_144;
- /* 0x146 */ char unk_146[0x2];
- /* 0x148 */ s8 unk_148;
- /* 0x149 */ char pad149[8];
- /* 0x151 */ s8 unk_151;
- /* 0x152 */ char pad152[1];
+ /* 0x144 */ u16 unk_144;
+ /* 0x146 */ s16 unk146;
+ /* 0x148 */ u8 unk148;
+ /* 0x14A */ s16 unk14A[3];
+ /* 0x150 */ char pad150[1];
+ /* 0x151 */ u8 unk_151;
+ /* 0x152 */ u8 unk152;
/* 0x153 */ u8 unk_153;
/* 0x154 */ u8 unk_154;
- /* 0x155 */ char pad155[0x2CB];
+ /* 0x155 */ char pad155[1];
+ /* 0x156 */ s16 unk156;
+ /* 0x158 */ s16 unk158;
+ /* 0x15A */ s16 unk15A;
+ /* 0x15C */ s16 unk15C;
+ /* 0x15E */ s16 unk15E;
+ /* 0x160 */ s16 unk160;
+ /* 0x162 */ u8 unk162;
+ /* 0x164 */ Vec3f unk164;
+ /* 0x170 */ s16 unk170;
+ /* 0x172 */ s16 unk172;
+ /* 0x174 */ s16 unk174;
+ /* 0x176 */ s16 unk176;
+ /* 0x178 */ s16 unk178;
+ /* 0x17A */ s16 unk17A;
+ /* 0x17C */ f32 unk17C;
+ /* 0x180 */ f32 unk180;
+ /* 0x184 */ s16 unk184;
+ /* 0x186 */ s16 unk186;
+ /* 0x188 */ s16 unk188;
+ /* 0x18A */ s16 unk18A;
+ /* 0x18C */ s16 unk18C;
+ /* 0x18E */ s16 unk18E;
+ /* 0x190 */ u8 unk190;
+ /* 0x191 */ u8 unk191;
+ /* 0x192 */ u8 unk192;
+ /* 0x193 */ u8 unk193;
+ /* 0x194 */ SkelAnime unk194;
+ /* 0x1D8 */ f32 unk1D8;
+ /* 0x1DC */ Vec3f unk1DC[15];
+ /* 0x290 */ u8 unk290;
+ /* 0x291 */ u8 unk291;
+ /* 0x292 */ u8 unk292;
+ /* 0x294 */ f32 unk294;
+ /* 0x298 */ f32 unk298;
+ /* 0x29C */ f32 unk29C;
+ /* 0x2A0 */ u8 unk2A0;
+ /* 0x2A1 */ u8 unk2A1;
+ /* 0x2A2 */ s16 unk2A2;
+ /* 0x2A4 */ f32 unk2A4;
+ /* 0x2A8 */ f32 unk2A8;
+ /* 0x2AC */ Vec3f unk2AC[2];
+ /* 0x2C4 */ Vec3s unk2C4[29];
+ /* 0x372 */ Vec3s unk372[29];
/* 0x420 */ EnKnightActionFunc actionFunc;
- /* 0x424 */ char unk_424[0x25C];
+ /* 0x424 */ EnKnightActionFunc unk424;
+ /* 0x428 */ s16 unk428;
+ /* 0x42C */ f32 unk42C;
+ /* 0x430 */ f32 unk430;
+ /* 0x434 */ Vec3f unk434;
+ /* 0x440 */ Vec3f unk440;
+ /* 0x44C */ u8 unk44C;
+ /* 0x450 */ f32 unk450;
+ /* 0x454 */ f32 unk454;
+ /* 0x458 */ f32 unk458;
+ /* 0x45C */ f32 unk45C;
+ /* 0x460 */ f32 unk460;
+ /* 0x464 */ f32 unk464;
+ /* 0x468 */ f32 unk468;
+ /* 0x46C */ f32 unk46C;
+ /* 0x470 */ f32 unk470;
+ /* 0x474 */ f32 unk474;
+ /* 0x478 */ s16 unk478;
+ /* 0x47C */ Vec3f unk47C;
+ /* 0x488 */ ColliderCylinder unk488;
+ /* 0x4D4 */ ColliderJntSph unk4D4;
+ /* 0x4F4 */ ColliderJntSphElement unk4F4[1];
+ /* 0x534 */ ColliderJntSph unk534;
+ /* 0x554 */ ColliderJntSphElement unk554[1];
+ /* 0x594 */ ColliderJntSph unk594;
+ /* 0x5B4 */ ColliderJntSphElement unk5B4[2];
+ /* 0x634 */ ColliderCylinder unk634;
/* 0x680 */ u8 unk_680;
- /* 0x681 */ char pad681[9];
+ /* 0x684 */ u32 unk684;
+ /* 0x688 */ s16 unk688;
/* 0x68A */ s16 unk_68A;
- /* 0x68C */ char pad68C[0x48];
+ /* 0x68C */ Vec3f unk68C;
+ /* 0x698 */ Vec3f unk698;
+ /* 0x6A4 */ f32 unk6A4;
+ /* 0x6A8 */ char pad6A8[4];
+ /* 0x6AC */ s16 unk6AC;
+ /* 0x6B0 */ f32 unk6B0;
+ /* 0x6B4 */ u16 unk6B4;
+ /* 0x6B6 */ u16 unk6B6;
+ /* 0x6B8 */ u16 unk6B8;
+ /* 0x6BA */ char pad6BA[2];
+ /* 0x6BC */ u16 unk6BC;
+ /* 0x6BE */ u16 unk6BE;
+ /* 0x6C0 */ u16 unk6C0;
+ /* 0x6C2 */ u16 unk6C2;
+ /* 0x6C4 */ u8 unk6C4;
+ /* 0x6C8 */ Vec3f unk6C8;
} EnKnight; // size = 0x6D4
extern const ActorInit En_Knight_InitVars;
diff --git a/tools/m2ctx.py b/tools/m2ctx.py
index 0824899f1..7ff7b0f75 100755
--- a/tools/m2ctx.py
+++ b/tools/m2ctx.py
@@ -65,7 +65,7 @@ def get_c_file(directory):
def import_c_file(in_file):
in_file = os.path.relpath(in_file, root_dir)
cpp_command = ["gcc", "-E", "-P", "-Iinclude", "-Iassets", "-Isrc", "-undef", "-D__sgi", "-D_LANGUAGE_C",
- "-DNON_MATCHING", "-D_Static_assert(x, y)=", "-D__attribute__(x)=", in_file]
+ "-DNON_MATCHING", "-DM2CTX", "-D_Static_assert(x, y)=", "-D__attribute__(x)=", in_file]
try:
return subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
except subprocess.CalledProcessError:
diff --git a/tools/sfxconvert.py b/tools/sfxconvert.py
index fbd7aa755..a19764417 100755
--- a/tools/sfxconvert.py
+++ b/tools/sfxconvert.py
@@ -51,6 +51,8 @@ def lookup_sfx(idnum, repo):
else:
id = idnum
idfix,sfxFlag = fix_sfx_flag(id)
+ if idfix is None:
+ return id
with open(repo + os.sep + 'include' + os.sep + 'sfx.h','r') as sfxfile:
for line in sfxfile:
if(line.count(idfix)):
@@ -63,6 +65,10 @@ def fix_sfx_flag(id):
return splitdata[0].strip(), ' -' + splitdata[1]
if id.endswith("U"):
id = id[:-1]
+ try:
+ id_hex = int(id, 16)
+ except ValueError:
+ return None,None
if not(int(id, 16) & 0x800):
newid = '0x' + format(int(id,16) + 0x800,'X')
sfxFlag = ' - SFX_FLAG'
From c00d6da814fbeda30de1630ab0f95ff884584d89 Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Fri, 6 Jan 2023 19:49:20 +0000
Subject: [PATCH 15/51] Cleanup
---
.../actors/ovl_En_Knight/z_en_knight.c | 78 +++++++++----------
.../actors/ovl_En_Knight/z_en_knight.h | 1 -
2 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c
index 955a7c29e..e54595828 100644
--- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c
+++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c
@@ -463,7 +463,7 @@ void func_809B20F0(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 a
s16 i;
EnKnightEffect* eff;
- for (eff = play->specialEffects, i = 0; i < 100; i++, eff++) {
+ for (eff = play->specialEffects, i = 0; i < ARRAY_COUNT(D_809BEFE8); i++, eff++) {
if (eff->unk2A == 0) {
eff->unk2A = 1;
eff->unk0 = *arg1;
@@ -522,7 +522,7 @@ void EnKnight_Init(Actor* thisx, PlayState* play) {
s32 temp_v0_2;
this->actor.targetMode = 5;
- this->actor.colChkInfo.mass = 0xFE;
+ this->actor.colChkInfo.mass = MASS_HEAVY;
this->actor.colChkInfo.damageTable = &D_809BDB04;
this->unk17C = 255.0f;
this->unk146 = Rand_ZeroFloat(1000.0f);
@@ -566,7 +566,7 @@ void EnKnight_Init(Actor* thisx, PlayState* play) {
} else {
Collider_InitAndSetJntSph(play, &this->unk4D4, &this->actor, &D_809BDB9C, this->unk4F4);
SkelAnime_InitFlex(play, &this->unk194, &D_060201A8, &D_060040E0, this->unk2C4, this->unk372, 0x1D);
- this->actor.colChkInfo.health = 0xE - BREG(41);
+ this->actor.colChkInfo.health = 14 - BREG(41);
Actor_SetScale(&this->actor, KREG(12) * 0.001f + 0.017f);
this->unk290 = Rand_ZeroFloat(1.9999f);
}
@@ -2507,7 +2507,7 @@ void func_809B8458(EnKnight* this, PlayState* play) {
if ((this->unk684 >= 0xAA) && (this->unk684 < 0xBF)) {
this->unk430 = KREG(42) + 200.0f;
}
- if ((this->unk684 == 0x00000096) || (this->unk684 == 0x000000B4)) {
+ if ((this->unk684 == 150) || (this->unk684 == 180)) {
Actor_PlaySfxAtPos(&this->actor, this->unk6B4);
}
@@ -2657,13 +2657,13 @@ void func_809B8458(EnKnight* this, PlayState* play) {
Animation_MorphToLoop(&D_809BEFD4->unk194, &D_0600CDE0, -5.0f);
Animation_MorphToLoop(&D_809BEFD8->unk194, &D_0600CDE0, -5.0f);
}
- if (this->unk684 == 0x00000028) {
+ if (this->unk684 == 40) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_HEAD_MID);
}
- if (this->unk684 == 0x0000002D) {
+ if (this->unk684 == 45) {
Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_LAUGH_K);
}
- if (this->unk684 == 0x00000032) {
+ if (this->unk684 == 50) {
Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
}
Math_ApproachF(&this->unk68C.x, 1196.0f, 0.1f, this->unk6A4 * 143.0f);
@@ -2691,7 +2691,7 @@ void func_809B8458(EnKnight* this, PlayState* play) {
Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
/* Fallthrough */
case 8:
- if (this->unk684 == 0x0000000F) {
+ if (this->unk684 == 15) {
this->unk68C.x = 1309.0f;
this->unk68C.y = 103.0f;
this->unk68C.z = 2930.0f;
@@ -2701,7 +2701,7 @@ void func_809B8458(EnKnight* this, PlayState* play) {
Actor_PlaySfxAtPos(&D_809BEFD8->actor, NA_SE_EN_DEBU_LAUGH_K);
Actor_PlaySfxAtPos(&D_809BEFD4->actor, NA_SE_EN_YASE_LAUGH_K);
}
- if (this->unk684 == 0x0000001E) {
+ if (this->unk684 == 30) {
this->unk68C.x = 1324.0f;
this->unk68C.y = 144.0f;
this->unk68C.z = 2864.0f;
@@ -2798,15 +2798,15 @@ void func_809B9A18(EnKnight* arg0, PlayState* arg1) {
switch (arg0->actor.colChkInfo.damageEffect) {
case 3:
- arg0->unk2A1 = 0x0A;
- func_809B4E84(arg0, arg1, 0x0050);
+ arg0->unk2A1 = 10;
+ func_809B4E84(arg0, arg1, 0x50);
Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
- arg0->unk156 = 0x000F;
+ arg0->unk156 = 15;
break;
case 1:
- func_809B4E84(arg0, arg1, 0x0028);
+ func_809B4E84(arg0, arg1, 0x28);
Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
- arg0->unk156 = 0x000F;
+ arg0->unk156 = 15;
break;
case 2:
arg0->unk2A1 = 1;
@@ -2815,13 +2815,13 @@ void func_809B9A18(EnKnight* arg0, PlayState* arg1) {
arg0->unk2A1 = 0x14;
break;
case 14:
- arg0->unk291 = 0x0A;
+ arg0->unk291 = 10;
break;
case 10:
arg0->unk2A1 = 0x28;
- func_809B4E84(arg0, arg1, 0x0028);
+ func_809B4E84(arg0, arg1, 0x28);
Actor_PlaySfxAtPos(&arg0->actor, NA_SE_EN_COMMON_FREEZE);
- arg0->unk156 = 0x000F;
+ arg0->unk156 = 15;
break;
case 13:
if (arg0->actor.bgCheckFlags & 1) {
@@ -2847,8 +2847,8 @@ void func_809B9A18(EnKnight* arg0, PlayState* arg1) {
func_809B4F90(arg0, arg1);
Actor_PlaySfxAtPos(&arg0->actor, arg0->unk6BE);
}
- arg0->unk156 = 0x000A;
- arg0->unk158 = 0x000F;
+ arg0->unk156 = 10;
+ arg0->unk158 = 15;
}
arg0->unk192 = 0;
}
@@ -3286,7 +3286,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
Actor* var_v0;
D_809BEFE4 = NULL;
- for (var_v0 = play->actorCtx.actorLists[7].first; var_v0 != NULL; var_v0 = var_v0->next) {
+ for (var_v0 = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; var_v0 != NULL; var_v0 = var_v0->next) {
if (var_v0->id == ACTOR_MIR_RAY3) {
D_809BEFE4 = (MirRay3*)var_v0;
break;
@@ -3294,7 +3294,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
}
this->unk_144 = gSaveContext.save.time;
- Math_ApproachS(&this->unk428, 0, 2, 0x0200);
+ Math_ApproachS(&this->unk428, 0, 2, 0x200);
} else if (D_809BEFD0->unk_154 == 0) {
this->actor.hintId = 0x1D;
} else {
@@ -3343,7 +3343,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
Math_ApproachZeroF(&this->unk474, 1.0f, 0.2f);
if ((this->actionFunc != func_809B52E8) && (this->actionFunc != func_809B5698)) {
- Math_ApproachS(&this->actor.shape.rot.x, 0, 0x000A, 0x0200);
+ Math_ApproachS(&this->actor.shape.rot.x, 0, 10, 0x200);
}
this->actionFunc(this, play);
@@ -3383,7 +3383,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
this->unk18A = 0;
if (this->actionFunc != func_809B4308) {
- Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x0A00);
+ Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0xA00);
}
if (this->actionFunc != func_809B842C && this->actionFunc != func_809B5698 &&
@@ -3447,11 +3447,11 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
break;
case 1:
this->unk2A0 = 0;
- this->unk2A2 = 0x0050;
+ this->unk2A2 = 0x50;
this->unk2A1++;
this->unk29C = 1.0f;
this->unk294 = 0.0f;
- Actor_SetColorFilter(&this->actor, 0x4000, 0x0078, 0, 0x003C);
+ Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 0x3C);
/* fallthrough */
case 2:
if (this->unk2A2 == 0) {
@@ -3464,8 +3464,8 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
}
break;
case 10:
- this->unk2A0 = 0x0B;
- this->unk2A2 = 0x0050;
+ this->unk2A0 = 11;
+ this->unk2A2 = 0x50;
this->unk2A1++;
this->unk29C = 1.0f;
this->unk294 = 0.0f;
@@ -3476,8 +3476,8 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
func_809B9E00(this, play);
this->unk2A1 = 0;
} else {
- if (this->unk2A2 == 0x0032) {
- this->unk2A0 = 0x0A;
+ if (this->unk2A2 == 50) {
+ this->unk2A0 = 10;
}
Math_ApproachF(&this->unk294, 0.5f, 1.0f, 0.08f);
Math_ApproachF(&this->unk298, 0.5f, 0.05f, 0.05f);
@@ -3485,7 +3485,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
break;
case 20:
this->unk2A0 = 0x14;
- this->unk2A2 = 0x0028;
+ this->unk2A2 = 0x28;
this->unk2A1++;
this->unk29C = 1.0f;
this->unk294 = 0.0f;
@@ -3502,8 +3502,8 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
}
break;
case 30:
- this->unk2A0 = 0x14;
- this->unk2A2 = 0x000A;
+ this->unk2A0 = 20;
+ this->unk2A2 = 10;
this->unk2A1++;
this->unk29C = 0.5f;
/* fallthrough */
@@ -3519,8 +3519,8 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
}
break;
case 40:
- this->unk2A0 = 0x1E;
- this->unk2A2 = 0x0032;
+ this->unk2A0 = 30;
+ this->unk2A2 = 50;
this->unk29C = 1.0f;
this->unk294 = (KREG(18) * 0.1f) + 0.5f;
this->unk2A1++;
@@ -3558,10 +3558,10 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
play->envCtx.unk_E0 = 2;
if (this->unk_154 == 1) {
play->envCtx.unk_C1 = 8;
- play->envCtx.unk_C2 = 0x0C;
+ play->envCtx.unk_C2 = 12;
} else {
play->envCtx.unk_C1 = 0;
- play->envCtx.unk_C2 = 0x0A;
+ play->envCtx.unk_C2 = 10;
}
var_v0_2 = gSaveContext.save.time;
if ((s32)var_v0_2 > 0x8000) {
@@ -3569,7 +3569,7 @@ void EnKnight_Update(Actor* thisx, PlayState* play) {
}
play->envCtx.lightBlend = var_v0_2 * 0.000030517578f;
}
- if ((this->unk6C4 == 0) && (this->unk162 == 0) && (Player_GetMask(play) == 0x0F) &&
+ if ((this->unk6C4 == 0) && (this->unk162 == 0) && (Player_GetMask(play) == 15) &&
((this->actionFunc == func_809B6764) || (this->unk192 != 0)) &&
(this->actor.xzDistToPlayer < (KREG(82) + 130.0f)) && (func_809B316C(this, play) != 0)) {
this->unk6C4 = 1;
@@ -3892,7 +3892,7 @@ void func_809BD490(EnKnight* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 var_s4;
- for (var_s4 = 0; var_s4 < 100; var_s4++, var_s0++) {
+ for (var_s4 = 0; var_s4 < ARRAY_COUNT(D_809BEFE8); var_s4++, var_s0++) {
if (var_s0->unk2A != 0) {
var_s0->unk0.x += var_s0->unkC.x;
var_s0->unk0.y += var_s0->unkC.y;
@@ -3958,7 +3958,7 @@ void func_809BD858(EnKnight* this, PlayState* play) {
gDPSetColorDither(POLY_XLU_DISP++, G_CD_BAYER);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_PATTERN);
- for (i = 0; i < 100; i++, eff++) {
+ for (i = 0; i < ARRAY_COUNT(D_809BEFE8); i++, eff++) {
if (eff->unk2A != 1) {
continue;
}
diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.h b/src/overlays/actors/ovl_En_Knight/z_en_knight.h
index c8815d8bf..f91338082 100644
--- a/src/overlays/actors/ovl_En_Knight/z_en_knight.h
+++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.h
@@ -18,7 +18,6 @@ typedef struct EnKnight {
/* 0x152 */ u8 unk152;
/* 0x153 */ u8 unk_153;
/* 0x154 */ u8 unk_154;
- /* 0x155 */ char pad155[1];
/* 0x156 */ s16 unk156;
/* 0x158 */ s16 unk158;
/* 0x15A */ s16 unk15A;
From 3900ab4f0b7f9b8b628eb6235f3199484fb6e94a Mon Sep 17 00:00:00 2001
From: Thar0 <17233964+Thar0@users.noreply.github.com>
Date: Wed, 18 Jan 2023 04:58:33 +0000
Subject: [PATCH 16/51] 2 non-matching
---
spec | 1 -
.../actors/ovl_En_Wdhand/z_en_wdhand.c | 670 +++++++++++++++++-
.../actors/ovl_En_Wdhand/z_en_wdhand.h | 12 +-
tools/disasm/variables.txt | 3 +-
4 files changed, 643 insertions(+), 43 deletions(-)
diff --git a/spec b/spec
index 5f8c616e5..55f0ef798 100644
--- a/spec
+++ b/spec
@@ -3444,7 +3444,6 @@ beginseg
name "ovl_En_Wdhand"
compress
include "build/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.o"
- include "build/data/ovl_En_Wdhand/ovl_En_Wdhand.data.o"
include "build/data/ovl_En_Wdhand/ovl_En_Wdhand.reloc.o"
endseg
diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
index 221ff557c..5ed860d20 100644
--- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
+++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
@@ -5,6 +5,7 @@
*/
#include "z_en_wdhand.h"
+#include "objects/object_wdhand/object_wdhand.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY)
@@ -15,7 +16,22 @@ void EnWdhand_Destroy(Actor* thisx, PlayState* play);
void EnWdhand_Update(Actor* thisx, PlayState* play);
void EnWdhand_Draw(Actor* thisx, PlayState* play);
-#if 0
+void func_80AF4FF8(EnWdhand* this, PlayState* play);
+void func_80AF4A88(EnWdhand* this, PlayState* play);
+void func_80AF4C64(EnWdhand* this, PlayState* play);
+void func_80AF4F30(EnWdhand* this, PlayState* play);
+void func_80AF4FF8(EnWdhand* this, PlayState* play);
+void func_80AF520C(EnWdhand* this, PlayState* play);
+void func_80AF5820(EnWdhand* this, PlayState* play);
+
+void func_80AF4608(EnWdhand* this, Vec3f* dst);
+void func_80AF4964(EnWdhand* this);
+void func_80AF4ED0(EnWdhand* this);
+void func_80AF4C18(EnWdhand* this);
+void func_80AF4F6C(EnWdhand* this);
+void func_80AF5130(EnWdhand* this, PlayState* play);
+void func_80AF488C(Vec3s* dst, Vec3f* src);
+
ActorInit En_Wdhand_InitVars = {
ACTOR_EN_WDHAND,
ACTORCAT_ENEMY,
@@ -63,7 +79,7 @@ static ColliderJntSphElementInit D_80AF63E0[7] = {
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_80AF64DC = {
{ COLTYPE_HIT0, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_80AF63E0, // sJntSphElementsInit,
+ ARRAY_COUNT(D_80AF63E0), D_80AF63E0, // sJntSphElementsInit,
};
// sColChkInfoInit
@@ -105,63 +121,641 @@ static DamageTable D_80AF64F4 = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
+Vec3f D_80AF6514 = { 0.0f, 0.0f, 0.0f };
+Vec3f D_80AF6520 = { 0.0f, 0.05f, 0.0f };
+
+void EnWdhand_Init(Actor* thisx, PlayState* play) {
+ EnWdhand* this = THIS;
+ s32 i;
+ Vec3f sp4C;
+
+ SkelAnime_InitFlex(play, &this->unk144, &object_wdhand_Skel_001E20, &object_wdhand_Anim_000854, this->unk188, this->unk1B8, 8);
+ CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80AF64F4, &D_80AF64EC);
+ Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY);
+ Matrix_MultVecY(3.0f, &this->unk25C[1]);
+ Matrix_MtxFCopy(&this->unk21C, Matrix_GetCurrent());
+ Matrix_MtxFToYXZRot(&this->unk21C, &this->actor.shape.rot, 0);
+ Matrix_Transpose(&this->unk21C);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ func_80AF4608(this, &sp4C);
+ this->actor.speed = sp4C.z;
+ this->actor.velocity.y = sp4C.y;
+ this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed;
+ this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed;
+ Collider_InitAndSetJntSph(play, &this->unk274, &this->actor, &D_80AF64DC, this->unk294);
+
+ for (i = 0; i < ARRAY_COUNT(this->unk294); i++) {
+ ColliderJntSphElement* elem = &this->unk274.elements[i];
+ elem->dim.worldSphere.radius = elem->dim.modelSphere.radius;
+ func_80AF488C(&elem->dim.worldSphere.center, &this->actor.world.pos);
+ }
+
+ for (i = 0; i < 3; i++) {
+ this->unk210[i] = 1.0f;
+ }
+
+ this->unk1EC[0].x = -1;
+ this->unk1EC[0].y = 0;
+ this->actor.world.rot.x = 0;
+ this->actor.world.rot.z = Math_Atan2S_XY(this->unk21C.mf[2][1], this->unk21C.mf[0][1]);
+ this->actor.hintId = 0xA;
+ func_80AF4964(this);
+}
+
+void EnWdhand_Destroy(Actor* thisx, PlayState* play) {
+ EnWdhand* this = THIS;
+
+ Collider_DestroyJntSph(play, &this->unk274);
+}
+
+void func_80AF4608(EnWdhand *this, Vec3f* dst) {
+ s32 var_v0;
+
+ var_v0 = this->actor.params & 0x7F;
+ if (var_v0 == 0x7F) {
+ var_v0 = 0x28;
+ }
+ dst->y = var_v0 * 0.2f;
+
+ var_v0 = (this->actor.params >> 7) & 0x7F;
+ if (var_v0 == 0x7F) {
+ var_v0 = 0x28;
+ }
+ dst->z = var_v0 * 0.2f;
+
+ dst->x = 0.0f;
+}
+
+void func_80AF4670(EnWdhand* this, Player* player, s16* arg2, s16* arg3) {
+ Vec3f sp24;
+ Vec3f sp18;
+
+ Math_Vec3f_Diff(&player->bodyPartsPos[3], &this->actor.world.pos, &sp24);
+ Matrix_Put(&this->unk21C);
+ Matrix_MultVec3f(&sp24, &sp18);
+ *arg3 = Actor_WorldYawTowardPoint(&this->actor, &sp18);
+ *arg2 = Actor_WorldPitchTowardPoint(&this->actor, &sp18) + 0x4000;
+}
+
+void func_80AF46F0(EnWdhand* this, s32 arg1, s32 arg2, Vec3f* arg3) {
+ MtxF* sp24 = Matrix_GetCurrent();
+ f32 scale;
+
+ Matrix_RotateZYX(this->unk1EC[arg1 + 1].x, this->unk1EC[arg1 + 1].y, 0, MTXMODE_APPLY);
+ if (arg2 != 0) {
+ Matrix_RotateYS((s16) (this->unk1EC[arg1 + 1].y * -1), MTXMODE_APPLY);
+ }
+ if (arg1 == 3) {
+ if (this->unk20C > 1.0f) {
+ if (this->unk20C > 1.5f) {
+ scale = 1.5f;
+ } else {
+ scale = this->unk20C;
+ }
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ }
+ } else {
+ if ((this->unk210[arg1] < 1.0f) || (this->unk20C > 1.0f)) {
+ if (this->unk210[arg1] < 0.1f) {
+ Matrix_Scale(0.0f, this->unk20C * this->unk210[arg1], 0.0f, MTXMODE_APPLY);
+ } else {
+ Matrix_Scale(1.0f, this->unk20C * this->unk210[arg1], 1.0f, MTXMODE_APPLY);
+ }
+ }
+ }
+ sp24->mf[3][0] = arg3->x;
+ sp24->mf[3][1] = arg3->y;
+ sp24->mf[3][2] = arg3->z;
+}
+
+void func_80AF488C(Vec3s* dst, Vec3f* src) {
+ dst->x = src->x;
+ dst->y = src->y;
+ dst->z = src->z;
+}
+
+s16 func_80AF48D0(EnWdhand* this, s32 arg1) {
+ return this->unk1EC[arg1 + 1].z * Math_SinF((this->unk1EC[0].z - (arg1 * 0x14)) * 0.07853982f);
+}
+
+void func_80AF4964(EnWdhand* this) {
+ s32 var_s0;
+
+ Animation_MorphToLoop(&this->unk144, &object_wdhand_Anim_000854, -5.0f);
+ if (this->actionFunc != func_80AF4FF8) {
+ this->unk1EC[0].z = 0x50;
+ this->unk1EC[1].y = Rand_Next() >> 0x10;
+
+ for (var_s0 = 1; var_s0 < 4; var_s0++) {
+ this->unk1EC[var_s0 + 1].y = this->unk1EC[var_s0].y + (s32)Rand_ZeroFloat((f32)0x2000) + 0x8000;
+ }
+
+ for (var_s0 = 0; var_s0 < 4; var_s0++) {
+ this->unk1EC[var_s0 + 1].z = Rand_S16Offset(0x1800, 0x1000);
+ }
+ }
+
+ for (var_s0 = 0; var_s0 < 4; var_s0++) {
+ this->unk1EC[var_s0 + 1].x = func_80AF48D0(this, var_s0);
+ }
+
+ this->actionFunc = func_80AF4A88;
+ this->unk20C = 1.0f;
+}
+
+void func_80AF4A88(EnWdhand* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ s32 var_s1;
+ s16 sp4E;
+ s16 sp4C;
+
+ SkelAnime_Update(&this->unk144);
+
+ this->unk1EC[0].z--;
+
+ for (var_s1 = 0; var_s1 < 4; var_s1++) {
+ this->unk1EC[var_s1 + 1].x = func_80AF48D0(this, var_s1);
+ if (this->unk1EC[0].z == 0x14 * var_s1) {
+ if (var_s1 != 0) {
+ this->unk1EC[var_s1 + 1].y = this->unk1EC[var_s1].y + (s32)Rand_CenteredFloat(16384.0f);
+ this->unk1EC[var_s1 + 1].y -= 0x8000;
+ } else {
+ this->unk1EC[1].y += (s16)(s32)Rand_CenteredFloat(16384.0f);
+ }
+ this->unk1EC[var_s1 + 1].z = Rand_S16Offset(0x1800, 0x1000);
+ }
+ }
+
+ if (this->unk1EC[0].z == 0) {
+ this->unk1EC[0].z = 0x50;
+ }
+
+ if (!(player->stateFlags2 & 0x80) && (this->actor.xyzDistToPlayerSq < SQ(120.75f))) {
+ func_80AF4670(this, player, &sp4E, &sp4C);
+ if (ABS_ALT(sp4E) <= 0x4000) {
+ func_80AF4C18(this);
+ }
+ }
+}
+
+void func_80AF4C18(EnWdhand* this) {
+ Animation_MorphToPlayOnce(&this->unk144, &object_wdhand_Anim_000534, -5.0f);
+ this->unk1EC[0].z = 5;
+ this->actionFunc = func_80AF4C64;
+}
+
+void func_80AF4C64(EnWdhand* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ s32 var_s0 = 1;
+ s32 var_s1;
+ s16 sp6A;
+ s16 sp68;
+
+ SkelAnime_Update(&this->unk144);
+ if (this->unk1EC[0].z > 0) {
+ this->unk1EC[0].z--;
+ if (this->unk1EC[0].z == 0) {
+ this->unk274.base.atFlags |= 1;
+ }
+ } else {
+ Math_StepToF(&this->unk20C, 1.5f, 0.05f);
+ func_80AF4670(this, player, &sp6A, &sp68);
+
+ for (var_s1 = 0; var_s1 < 4; var_s1++) {
+ s16 var_v1 = sp68 - this->unk1EC[1 + var_s1].y;
+
+ if (ABS_ALT(var_v1) < 0x4000) {
+ var_s0 &= Math_ScaledStepToS(&this->unk1EC[1 + var_s1].x, sp6A, (s16)(s32)((var_s1 * 0.1f + 1.0f) * 1920.0f));
+ var_s0 &= Math_ScaledStepToS(&this->unk1EC[1 + var_s1].y, sp68, 0x800);
+ } else {
+ var_s0 &= Math_ScaledStepToS(&this->unk1EC[1 + var_s1].x, -sp6A, (s16)(s32)((var_s1 * 0.1f + 1.0f) * 1920.0f));
+ var_s0 &= Math_ScaledStepToS(&this->unk1EC[1 + var_s1].y, sp68 + 0x8000, 0x800);
+ }
+ }
+
+ if ((this->unk274.base.atFlags & 2) && (play->grabPlayer(play, player) != 0)) {
+ func_80AF5130(this, play);
+ } else if (var_s0 != 0) {
+ func_80AF4ED0(this);
+ }
+
+ if (this->unk274.base.atFlags & 2) {
+ this->unk274.base.atFlags &= ~2;
+ }
+ }
+}
+
+void func_80AF4ED0(EnWdhand* this) {
+ Animation_PlayOnce(&this->unk144, &object_wdhand_Anim_0000F4);
+ this->unk274.base.atFlags &= ~1;
+ this->unk274.base.atFlags &= ~2;
+ this->actionFunc = func_80AF4F30;
+ this->unk20C = 1.5f;
+}
+
+void func_80AF4F30(EnWdhand* this, PlayState* play) {
+ if (SkelAnime_Update(&this->unk144) != 0) {
+ func_80AF4F6C(this);
+ }
+}
+
+void func_80AF4F6C(EnWdhand* this) {
+ s32 var_s0;
+
+ Animation_MorphToLoop(&this->unk144, &object_wdhand_Anim_000854, -10.0f);
+
+ for (var_s0 = 0; var_s0 < 4; var_s0++) {
+ this->unk1EC[1 + var_s0].z = Rand_S16Offset(0x1800, 0x1000);
+ }
+ this->unk1EC[0].z = 0x50;
+ this->actionFunc = func_80AF4FF8;
+}
+
+void func_80AF4FF8(EnWdhand* this, PlayState* play) {
+ s32 var_s0;
+ s32 var_s5;
+
+ SkelAnime_Update(&this->unk144);
+
+ this->unk1EC[0].z--;
+
+ var_s5 = Math_ScaledStepToS(&this->unk1EC[1].x, func_80AF48D0(this, 0), 0x200);
+
+ for (var_s0 = 1; var_s0 < 4; var_s0++) {
+ var_s5 &= Math_ScaledStepToS(&this->unk1EC[1 + var_s0].x, func_80AF48D0(this, var_s0), 0x300);
+ if (0x14 * var_s0 == this->unk1EC[0].z) {
+ this->unk1EC[1 + var_s0].z = Rand_S16Offset(0x1800, 0x1000);
+ }
+ }
+
+ if (this->unk1EC[0].z == 0) {
+ this->unk1EC[0].z = 0x50;
+ this->unk1EC[1].z = Rand_S16Offset(0x1800, 0x1000);
+ }
+
+ Math_StepToF(&this->unk20C, 1.0f, 0.05f);
+
+ if (var_s5 != 0) {
+ func_80AF4964(this);
+ }
+}
+
+void func_80AF5130(EnWdhand* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ s32 var_s0;
+
+ this->unk274.base.atFlags &= ~1;
+ this->unk274.base.atFlags &= ~2;
+ this->unk274.base.ocFlags1 &= ~1;
+ Animation_PlayOnce(&this->unk144, &object_wdhand_Anim_0000F4);
+
+ for (var_s0 = 0; var_s0 < 4; var_s0++) {
+ this->unk1EC[1 + var_s0].z = Rand_S16Offset(0x2000, 0x1000);
+ }
+ this->unk1EC[0].z = 0x50;
+ player->actor.parent = &this->actor;
+ Matrix_Transpose(&this->unk21C);
+ this->unk20C = 1.5f;
+
+ Actor_PlaySfx(&this->actor, NA_SE_EN_HANDW_GET);
+ this->actionFunc = func_80AF520C;
+}
+
+#ifdef NON_MATCHING
+void func_80AF520C(EnWdhand* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ Vec3f sp68;
+ f32 var_fv1;
+ s32 var_s1;
+
+ SkelAnime_Update(&this->unk144);
+ this->unk1EC[0].z--;
+ player->unk_AE8 = 0;
+
+ for (var_s1 = 0; var_s1 < 4; var_s1++) {
+ if (this->unk1EC[0].z < 0x4C) {
+ this->unk1EC[1 + var_s1].x = (s16)(s32)(Math_SinF(this->unk1EC[var_s1].z * 0.3926991f) * this->unk1EC[1 + var_s1].z);
+ } else {
+ Math_ScaledStepToS(&this->unk1EC[1 + var_s1].x, (s16)(s32)(Math_SinF(this->unk1EC[var_s1].z * 0.3926991f) * this->unk1EC[1 + var_s1].z), 0x400);
+ }
+ if (!(this->unk1EC[var_s1].z & 0xF)) {
+ if (this->unk1EC[var_s1].z == 0x10) {
+ this->unk1EC[1 + var_s1].y = 0;
+ } else if (var_s1 != 0) {
+ this->unk1EC[1 + var_s1].y = this->unk1EC[var_s1].y + (s32)Rand_CenteredFloat(12288.0f);
+ } else {
+ this->unk1EC[1].y += (s32)Rand_CenteredFloat(12288.0f);
+ }
+ this->unk1EC[1 + var_s1].z = Rand_S16Offset(0x2000, 0x1000);
+ }
+ }
+
+ if (this->unk1EC[0].z < 4) {
+ Math_StepToF(&this->unk20C, 1.5f, 0.125f);
+ } else if (this->unk1EC[0].z < 0x10) {
+ Math_StepToF(&this->unk20C, 2.0f, 0.041666668f);
+ }
+
+ if (this->unk1EC[0].z == 0) {
+ this->unk274.base.ocFlags1 |= 1;
+ func_80AF4F6C(this);
+ } else if (this->unk1EC[0].z >= 4) {
+ Matrix_Put(&this->unk21C);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
+ Matrix_MultVecY(300.0f, &sp68);
+
+ for (var_s1 = 0; var_s1 < 3; var_s1++) {
+ Matrix_Push();
+ func_80AF46F0(this, var_s1, 0, &sp68);
+ Matrix_MultVecY(2300.0f, &sp68);
+ Matrix_Pop();
+ }
+
+ func_80AF46F0(this, 3, 1, &sp68);
+ Matrix_MtxFToYXZRot(Matrix_GetCurrent(), &player->actor.shape.rot, 0);
+
+ if (this->unk20C > 1.0f) {
+ if (this->unk20C > 1.5f) {
+ var_fv1 = 1.5f;
+ } else {
+ var_fv1 = this->unk20C;
+ }
+ Matrix_RotateZS((s16)(s32)((var_fv1 - 1.0f) * -32768.0f), MTXMODE_APPLY);
+ }
+ Matrix_MultVecY(1000.0f, &player->actor.world.pos);
+
+ if ((this->unk1EC[0].z == 4) && (&this->actor == player->actor.parent)) {
+ player->unk_AE8 = 100;
+ player->actor.parent = NULL;
+ Matrix_Transpose(&this->unk21C);
+ player->actor.shape.rot.x = 0;
+ player->actor.shape.rot.z = 0;
+ player->actor.world.pos.x += 2.0f * this->actor.velocity.x;
+ player->actor.world.pos.y += 2.0f * this->actor.velocity.y;
+ player->actor.world.pos.z += 2.0f * this->actor.velocity.z;
+ func_800B8D50(play, &this->actor, this->actor.speed, this->actor.world.rot.y, this->actor.velocity.y, 0);
+ Actor_PlaySfx(&this->actor, NA_SE_EN_HANDW_RELEASE);
+ } else if (this->unk1EC[0].z == 2) {
+ Animation_PlayOnce(&this->unk144, &object_wdhand_Anim_000364);
+ }
+ }
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF520C.s")
#endif
-extern ColliderJntSphElementInit D_80AF63E0[7];
-extern ColliderJntSphInit D_80AF64DC;
-extern CollisionCheckInfoInit D_80AF64EC;
-extern DamageTable D_80AF64F4;
+s32 func_80AF5650(EnWdhand* this, s32 arg1) {
+ this->unk210[arg1] -= 0.1f;
+ if (this->unk210[arg1] <= 0.05f) {
+ this->unk210[arg1] = 0.05f;
+ return true;
+ }
+ return false;
+}
-extern UNK_TYPE D_060000F4;
-extern UNK_TYPE D_06000364;
-extern UNK_TYPE D_06000534;
-extern UNK_TYPE D_06000854;
-extern UNK_TYPE D_060014C0;
+void func_80AF56A0(EnWdhand* this) {
+ s32 var_s0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/EnWdhand_Init.s")
+ this->actor.flags &= ~1;
+ this->actor.flags |= 0x10;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/EnWdhand_Destroy.s")
+ for (var_s0 = 0; var_s0 < ARRAY_COUNT(this->unk294); var_s0++) {
+ if (this->unk274.elements[var_s0].info.bumperFlags & 2) {
+ break;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4608.s")
+ this->unk1EC[0].y = (s16) ((s32) ((s32) (var_s0 + 1) / 2) % 4);
+ this->unk1EC[0].x = this->unk1EC[0].y - 1;
+ Matrix_Put(&this->unk21C);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
+ Matrix_MultVecY(300.0f, &this->unk25C[1]);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4670.s")
+ for (var_s0 = 0; var_s0 < this->unk1EC[0].y; var_s0++) {
+ Matrix_Push();
+ func_80AF46F0(this, var_s0, 0, &this->unk25C[1]);
+ Matrix_MultVecY(2300.0f, &this->unk25C[1]);
+ Matrix_Pop();
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF46F0.s")
+ this->actor.velocity.y = 2.45f;
+ this->actor.velocity.x = 2.0f * Math_SinS(this->actor.world.rot.z);
+ this->actor.velocity.z = 2.0f * Math_CosS(this->actor.world.rot.z);
+ this->unk1EC[0].z = 5;
+ this->actionFunc = func_80AF5820;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF488C.s")
+#ifdef NON_MATCHING
+void func_80AF5820(EnWdhand* this, PlayState* play) {
+ Vec3f spA0;
+ Vec3f sp94;
+ Vec3f sp70;
+ s16 temp_s0_6;
+ s32 temp_s5;
+ s32 var_s0;
+ s32 var_s2;
+ Vec3s* temp;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF48D0.s")
+ temp = &this->unk274.elements[6].dim.worldSphere.center;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4964.s")
+ spA0.x = (this->unk25C[1].x - temp->x) * 0.5f;
+ spA0.y = (this->unk25C[1].y - temp->y) * 0.5f;
+ spA0.z = (this->unk25C[1].z - temp->z) * 0.5f;
+ Matrix_RotateXS(0x100, MTXMODE_NEW);
+ Matrix_MultVec3f(&spA0, &sp94);
+ this->unk25C[1].x = spA0.x + sp94.x + temp->x;
+ this->unk25C[1].y = spA0.y + sp94.y + temp->y;
+ this->unk25C[1].z = spA0.z + sp94.z + temp->z;
+ if (this->actor.velocity.y > -2.0f) {
+ this->actor.velocity.y += -0.15f;
+ }
+ Math_Vec3f_Sum(&this->unk25C[1], &this->actor.velocity, &this->unk25C[1]);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4A88.s")
+ this->actor.world.rot.x += 0x100;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4C18.s")
+ if (this->unk1EC[0].x >= 0 && func_80AF5650(this, this->unk1EC[0].x)) {
+ this->unk1EC[0].x -= 1;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4C64.s")
+ if (this->unk1EC[0].y < 3) {
+ if (func_80AF5650(this, this->unk1EC[0].y)) {
+ this->unk1EC[0].y += 1;
+ }
+ Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.z, 0, MTXMODE_NEW);
+ Matrix_RotateYS(-this->actor.world.rot.z, MTXMODE_APPLY);
+ Matrix_Mult(&this->unk21C, MTXMODE_APPLY);
+ func_80AF46F0(this, this->unk1EC[0].y, 0, &this->unk25C[1]);
+ Matrix_MultVecY(2.3f / this->unk210[this->unk1EC[0].y], &this->unk25C[1]);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4ED0.s")
+ this->unk1EC[0].z--;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4F30.s")
+ temp_s5 = this->unk1EC[0].x + 1;
+ for (var_s2 = 0; var_s2 < temp_s5; var_s2++) {
+ if (this->unk1EC[0].z > 0) {
+ Math_ScaledStepToS(&this->unk1EC[1 + var_s2].x, (s16)(s32)(Math_SinF(this->unk1EC[var_s2].z * 0.8975979f) * this->unk1EC[1 + var_s2].y), 0x200);
+ } else if (Rand_ZeroOne() < 0.65f) {
+ this->unk1EC[1 + var_s2].x = this->unk1EC[1 + var_s2].y + Math_SinF(this->unk1EC[var_s2].z * 0.8975979f);
+ }
+ if ((this->unk1EC[var_s2].z % 7) == 0) {
+ if (var_s2 != 0) {
+ this->unk1EC[1 + var_s2].x = this->unk1EC[var_s2].y + (s32)Rand_CenteredFloat(12288.0f);
+ } else {
+ this->unk1EC[1].y += (s32) Rand_CenteredFloat(12288.0f);
+ }
+ this->unk1EC[1 + var_s2].y = Rand_S16Offset((s16) ((var_s2 << 8) + 0xC00), 0x800);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4F6C.s")
+ if ((this->unk1EC[0].x < 0) && (this->unk1EC[0].y >= 3)) {
+ if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) {
+ for (var_s0 = 0; var_s0 < 2; var_s0++) {
+ for (var_s2 = 0; var_s2 < 5; var_s2++) {
+ D_80AF6514.y = Rand_ZeroOne() + 1.0f;
+ temp_s0_6 = Rand_S16Offset(0x28, 0x28);
+ sp70.x = Rand_CenteredFloat(12.0f) + this->unk25C[var_s2].x;
+ sp70.y = Rand_CenteredFloat(12.0f) + this->unk25C[var_s2].y;
+ sp70.z = Rand_CenteredFloat(12.0f) + this->unk25C[var_s2].z;
+ EffectSsDtBubble_SpawnColorProfile(play, &sp70, &D_80AF6514, &D_80AF6520, temp_s0_6, 25, 2, 1);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF4FF8.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF5130.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF520C.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF5650.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF56A0.s")
+ Actor_Kill(&this->actor);
+ } else {
+ this->actor.scale.y = this->actor.scale.x;
+ this->actor.scale.z = this->actor.scale.x;
+ }
+ }
+ for (var_s0 = 0; var_s0 < 2; var_s0++) {
+ D_80AF6514.y = Rand_ZeroOne() + 1.0f;
+ EffectSsDtBubble_SpawnColorProfile(play, &this->unk25C[var_s0], &D_80AF6514, &D_80AF6520, Rand_S16Offset(40, 40), 25, 2, 1);
+ }
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF5820.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF5E3C.s")
+void func_80AF5E3C(EnWdhand* this, PlayState* play) {
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/EnWdhand_Update.s")
+ if (this->unk274.base.acFlags & 2) {
+ Player* player = GET_PLAYER(play);
+ s32 temp = ~1;
+ this->unk274.base.acFlags &= temp;
+ this->unk274.base.acFlags &= ~2;
+ this->unk274.base.atFlags &= temp;
+ this->unk274.base.ocFlags1 &= temp;
+ Actor_SetDropFlagJntSph(&this->actor, &this->unk274);
+ Enemy_StartFinishingBlow(play, &this->actor);
+ if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) {
+ player->unk_AE8 = 100;
+ player->actor.parent = NULL;
+ player->actor.shape.rot.x = 0;
+ player->actor.shape.rot.z = 0;
+ func_800B8D50(play, &this->actor, this->actor.speed, this->actor.world.rot.y, this->actor.velocity.y, 0U);
+ } else {
+ Matrix_Transpose(&this->unk21C);
+ }
+ func_80AF56A0(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/func_80AF5FE4.s")
+void EnWdhand_Update(Actor* thisx, PlayState* play) {
+ EnWdhand* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Wdhand/EnWdhand_Draw.s")
+ func_80AF5E3C(this, play);
+
+ this->actionFunc(this, play);
+
+ if (this->unk274.base.atFlags & 1) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk274.base);
+ }
+ if (this->unk274.base.acFlags & 1) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk274.base);
+ }
+ if (this->unk274.base.ocFlags1 & 1) {
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk274.base);
+ }
+}
+
+void func_80AF5FE4(EnWdhand* this, s32 arg1, Vec3f* arg2) {
+ func_80AF46F0(this, arg1, 1, arg2);
+ Matrix_MultVecY(575.0f, arg2);
+ func_80AF488C(&this->unk274.elements[2 * arg1].dim.worldSphere.center, arg2);
+ Matrix_MultVecY(1725.0f, arg2);
+ func_80AF488C(&this->unk274.elements[2 * arg1 + 1].dim.worldSphere.center, arg2);
+ Matrix_MultVecY(2300.0f, arg2);
+}
+
+void EnWdhand_Draw(Actor* thisx, PlayState* play) {
+ EnWdhand* this = THIS;
+ Vec3f sp90;
+ Gfx* dl;
+ s32 var;
+ s32 var_s1;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ dl = POLY_OPA_DISP;
+
+ gSPDisplayList(&dl[0], &gSetupDLs[25 * 6]);
+ gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&dl[2], object_wdhand_DL_0014C0);
+
+ Matrix_MultVecY(300.0f, &sp90);
+
+ dl = &dl[3];
+
+ var = this->unk1EC[0].x + 1;
+ for (var_s1 = 0; var_s1 < var; var_s1++) {
+ Matrix_Push();
+ func_80AF5FE4(this, var_s1, &sp90);
+ gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, object_wdhand_DL_0015B0);
+ Matrix_Pop();
+ }
+
+ Math_Vec3f_Copy(&this->unk25C[0], &sp90);
+ Math_Vec3f_Copy(&sp90, &this->unk25C[1]);
+ if (this->actor.world.rot.x != 0) {
+ Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.z, 0, MTXMODE_NEW);
+ Matrix_RotateYS(-this->actor.world.rot.z, MTXMODE_APPLY);
+ Matrix_Mult(&this->unk21C, MTXMODE_APPLY);
+ Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
+ }
+
+ for (var_s1 = this->unk1EC[0].y; var_s1 < 3; var_s1++) {
+ Matrix_Push();
+ func_80AF5FE4(this, var_s1, &sp90);
+ gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(dl++, object_wdhand_DL_0015B0);
+ Matrix_Pop();
+ }
+
+ func_80AF46F0(this, 3, 1, &sp90);
+ if (this->unk20C > 1.0f) {
+ s32 pad;
+ f32 var_fv1;
+
+ if (this->unk20C > 1.5f) {
+ var_fv1 = 1.5f;
+ } else {
+ var_fv1 = this->unk20C;
+ }
+ Matrix_RotateZS((s16)(s32)((var_fv1 - 1.0f) * -32768.0f), MTXMODE_APPLY);
+ }
+ if (this->actor.scale.x < 0.01f) {
+ Matrix_Translate(0.0f, (10.0f / this->actor.scale.x) - 1000.0f, 0.0f, MTXMODE_APPLY);
+ }
+ Math_Vec3f_Copy(&this->actor.focus.pos, &sp90);
+ Matrix_MultVecY(1000.0f, &sp90);
+ func_80AF488C(&this->unk274.elements[6].dim.worldSphere.center, &sp90);
+
+ POLY_OPA_DISP = dl;
+ SkelAnime_DrawFlexOpa(play, this->unk144.skeleton, this->unk144.jointTable, this->unk144.dListCount, NULL, NULL, &this->actor);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h
index 5eb02fa1a..8a1cd297d 100644
--- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h
+++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h
@@ -9,9 +9,17 @@ typedef void (*EnWdhandActionFunc)(struct EnWdhand*, PlayState*);
typedef struct EnWdhand {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0xA4];
+ /* 0x144 */ SkelAnime unk144;
+ /* 0x188 */ Vec3s unk188[8];
+ /* 0x1B8 */ Vec3s unk1B8[8];
/* 0x1E8 */ EnWdhandActionFunc actionFunc;
- /* 0x1EC */ char unk_1EC[0x268];
+ /* 0x1EC */ Vec3s unk1EC[5];
+ /* 0x20C */ f32 unk20C;
+ /* 0x20C */ f32 unk210[3];
+ /* 0x21C */ MtxF unk21C;
+ /* 0x25C */ Vec3f unk25C[2];
+ /* 0x274 */ ColliderJntSph unk274;
+ /* 0x294 */ ColliderJntSphElement unk294[7];
} EnWdhand; // size = 0x454
#endif // Z_EN_WDHAND_H
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index b1b5b726b..33d8c9299 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -13291,8 +13291,7 @@
0x80AF64DC:("D_80AF64DC","UNK_TYPE1","",0x1),
0x80AF64EC:("D_80AF64EC","UNK_TYPE1","",0x1),
0x80AF64F4:("D_80AF64F4","UNK_TYPE1","",0x1),
- 0x80AF6514:("D_80AF6514","UNK_TYPE1","",0x1),
- 0x80AF6518:("D_80AF6518","f32","",0x4),
+ 0x80AF6514:("D_80AF6514","Vec3f","",0xC),
0x80AF6520:("D_80AF6520","UNK_TYPE1","",0x1),
0x80AF6530:("D_80AF6530","f32","",0x4),
0x80AF6534:("D_80AF6534","f32","",0x4),
From 6be262aeefc9ac9ef59fe3dc6ab10334ee2a4e5e Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 00:25:28 -0700
Subject: [PATCH 17/51] Fix struct
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 4 ++--
.../effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 10a01989a..25b06a2b9 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -31,8 +31,8 @@ typedef struct BossHakugin {
/* 0x0191 */ u8 unk_191;
/* 0x018C */ char unk_0192[0x866];
/* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT];
- /* 0x2618 */ char unk_2618[0x8E8];
- /* 0x2F00 */ BossHakuginFhgFlashUnkStruct unk_2F00[7][15];
+ /* 0x2618 */ char unk_2618[0xB40];
+ /* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
/* 0x3734 */ char unk_3734[0xDC];
} BossHakugin; // size = 0x3810
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
index c8f5a74c7..30010a196 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
@@ -100,9 +100,9 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) {
s32 gohtIndex = goht->unk_191 - 3;
if (gohtIndex < 0) {
- bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00;
+ bodyPartPos = &goht->unk_3158[this->rParams - FHGFLASH_SHOCK_GOHT_2][12].unk_00;
} else {
- bodyPartPos = &goht->unk_2F00[this->rParams][gohtIndex].unk_00;
+ bodyPartPos = &goht->unk_3158[this->rParams - FHGFLASH_SHOCK_GOHT_2][gohtIndex].unk_00;
}
this->pos.x = Rand_CenteredFloat(70.0f) + bodyPartPos->x;
From 6c31a319ca074ab9ed5d2b155ea9d38b6ef74ad9 Mon Sep 17 00:00:00 2001
From: Tom Overton
Date: Wed, 27 Sep 2023 13:08:40 -0700
Subject: [PATCH 18/51] 20/79 OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 619 +++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 60 +-
.../z_eff_ss_fhg_flash.c | 2 +-
3 files changed, 644 insertions(+), 37 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 9c759b63c..741e5e84c 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -7,12 +7,14 @@
#include "z_boss_hakugin.h"
#include "z64quake.h"
#include "z64rumble.h"
+#include "overlays/actors/ovl_En_Hakurock/z_en_hakurock.h"
+#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((BossHakugin*)thisx)
-void BossHakugin_Init(Actor* thisx, PlayState* play);
+void BossHakugin_Init(Actor* thisx, PlayState* play2);
void BossHakugin_Destroy(Actor* thisx, PlayState* play);
void BossHakugin_Update(Actor* thisx, PlayState* play);
void BossHakugin_Draw(Actor* thisx, PlayState* play);
@@ -32,6 +34,15 @@ void func_80B09EDC(BossHakugin* this, PlayState* play);
void func_80B0A2A4(BossHakugin* this, PlayState* play);
void func_80B0A638(BossHakugin* this, PlayState* play);
void func_80B0A8C4(BossHakugin* this, PlayState* play);
+void func_80B058C0(BossHakugin* this);
+void func_80B05EE0(BossHakugin* this, PlayState* play);
+void func_80B08124(BossHakugin* this);
+void func_80B08C1C(BossHakugin* this);
+void func_80B09E84(BossHakugin* this);
+void func_80B0825C(BossHakugin* this);
+void func_80B09F7C(BossHakugin* this);
+void func_80B08550(BossHakugin* this, PlayState* play);
+void func_80B08848(BossHakugin* this, PlayState* play);
#if 0
ActorInit Boss_Hakugin_InitVars = {
@@ -217,28 +228,182 @@ extern ColliderSphereInit D_80B0EA08;
extern ColliderCylinderInit D_80B0EA34;
extern DamageTable D_80B0EA60;
extern CollisionCheckInfoInit D_80B0EA80;
+extern TexturePtr D_80B0EA88;
+extern s8 D_80B0EA95;
+extern s8 D_80B0EA9A;
+extern s8 D_80B0EAA5;
+extern s8 D_80B0EAAC;
+extern s32 D_80B0EAD4;
extern InitChainEntry D_80B0EAD8[];
+extern Vec3f D_80B0EAE8;
+extern Vec3f D_80B0EAF4;
+extern Vec3f D_80B0EB00;
+extern Vec3f D_80B0EB0C;
+extern Vec3f D_80B0EB18;
-extern UNK_TYPE D_06002054;
-extern UNK_TYPE D_0600319C;
-extern UNK_TYPE D_06010488;
-extern UNK_TYPE D_06011208;
-extern UNK_TYPE D_06012ED0;
-extern UNK_TYPE D_060134D0;
-extern UNK_TYPE D_06013828;
-extern UNK_TYPE D_06014040;
+extern AnimationHeader D_06002054; // gGohtThawAndBreakWallAnim
+extern AnimationHeader D_0600319C; // gGohtStationaryAnim
+extern Gfx D_06010488[]; // gGohtRockMaterialDL
+extern Gfx D_06011208[]; // gGohtLightningMaterialDL
+extern Gfx D_06012ED0[]; // gGohtLightOrbMaterialDL
+extern AnimationHeader D_060134D0; // gGohtFallDownAnim
+extern AnimationHeader D_06013828; // gGohtRunAnim
+extern TexturePtr D_06014040; // gGohtTitleCardTex
+extern FlexSkeletonHeader D_06013158; // gGohtSkel
+#ifdef NON_MATCHING
+// requires in-function static, too lazy to import all the data right now
+void BossHakugin_Init(Actor* thisx, PlayState* play2) {
+ static s32 D_80B0EAD4 = 0;
+ PlayState* play = play2;
+ BossHakugin* this = THIS;
+ Actor** actorPtr;
+ s32 pad;
+ s32 i;
+
+ Actor_ProcessInitChain(&this->actor, D_80B0EAD8);
+ SkelAnime_InitFlex(play, &this->skelAnime, &D_06013158, &D_06013828, this->jointTable, this->morphTable, 0x21);
+ if (D_80B0EAD4 == 0) {
+ D_80B0EAD4 = 1;
+ D_80B0EA88 = Lib_SegmentedToVirtual(D_80B0EA88);
+ }
+
+ Collider_InitAndSetJntSph(play, &this->unk_0484, &this->actor, &D_80B0E9AC, this->unk_04A4);
+ for (i = 0; i < 20; i++) {
+ Collider_InitAndSetTris(play, &this->unk_2618[i].unk_14, &this->actor, &D_80B0E9F8, &this->unk_2618[i].unk_34);
+ }
+
+ Collider_InitAndSetSphere(play, &this->unk_37B8, &this->actor, &D_80B0EA08);
+ this->unk_37B8.dim.worldSphere.radius = 40;
+ Collider_InitAndSetCylinder(play, &this->unk_0964, &this->actor, &D_80B0EA34);
+ this->unk_0964.dim.pos.x = (this->actor.world.pos.x - 50.0f);
+ this->unk_0964.dim.pos.y = this->actor.world.pos.y;
+ this->unk_0964.dim.pos.z = this->actor.world.pos.z;
+ this->unk_0964.dim.radius = 150;
+ this->unk_0964.dim.height = 300;
+ this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
+ Lights_PointNoGlowSetInfo(&this->lightInfo, 0, 0, 0, 255, 255, 180, -1);
+ this->unk_01B4 = -1;
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
+ func_80B05EE0(this, play);
+ Actor_Kill(&this->actor);
+ return;
+ }
+
+ for (i = 0; i < 8; i++) {
+ actorPtr = &this->unk_09B0[i];
+ *actorPtr = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HAKUROCK, 0.0f, 0.0f, 0.0f, 0, 0,
+ 0, EN_HAKUROCK_TYPE_BOULDER);
+ }
+
+ for (i = 0; i < 10; i++) {
+ this->unk_09D0[i] = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HAKUROCK, 0.0f, 0.0f, 0.0f,
+ 0, 0, 0, EN_HAKUROCK_TYPE_UNK_2);
+ }
+
+ for (i = 0; i < 180; i++) {
+ this->unk_09F8[i].unk_18 = -1;
+ }
+
+ CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B0EA60, &D_80B0EA80);
+ this->unk_01A0 = this->actor.shape.rot.y;
+ this->unk_01B0 = -1;
+
+ if (CHECK_EVENTINF(EVENTINF_53)) {
+ SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC);
+ this->actor.world.pos.x = 0.0f;
+ func_80B08C1C(this);
+ } else if (CHECK_EVENTINF(EVENTINF_62)) {
+ this->unk_0193 = 255;
+ this->unk_01D4 = 2.7f;
+ func_80B058C0(this);
+ Animation_PlayOnce(&this->skelAnime, &D_06002054);
+ this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
+ func_80B08124(this);
+ } else {
+ this->unk_0193 = 255;
+ this->unk_01D4 = 2.7f;
+ func_80B058C0(this);
+ func_80B09E84(this);
+ }
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Init.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Destroy.s")
+void BossHakugin_Destroy(Actor* thisx, PlayState* play) {
+ BossHakugin* this = THIS;
+ s32 pad;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0573C.s")
+ LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
+ Collider_DestroyJntSph(play, &this->unk_0484);
+ Collider_DestroyCylinder(play, &this->unk_0964);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B057A4.s")
+ for (i = 0; i < 20; i++) {
+ Collider_DestroyTris(play, &this->unk_2618[i].unk_14);
+ }
+
+ Collider_DestroySphere(play, &this->unk_37B8);
+ AudioSfx_StopByPos(&this->unk_0458);
+ AudioSfx_StopByPos(&this->unk_0464);
+}
+
+s32 func_80B0573C(Vec3f* arg0) {
+ f32 magnitude;
+
+ magnitude = Math3D_Vec3fMagnitude(arg0);
+ if (magnitude < 0.0001f) {
+ return false;
+ }
+
+ Math_Vec3f_Scale(arg0, 1.0f / magnitude);
+ return true;
+}
+
+void func_80B057A4(Vec3f* arg0, Vec3f* arg1, f32 arg2) {
+ Vec3f sp34;
+ Vec3f sp28;
+ f32 temp_fa0;
+ f32 var_fv1;
+
+ temp_fa0 = (arg0->x * arg1->x) + (arg0->y * arg1->y) + (arg0->z * arg1->z);
+ if (fabsf(temp_fa0) < 1.0f) {
+ var_fv1 = Math_FAcosF(temp_fa0);
+ } else if (temp_fa0 >= 1.0f) {
+ var_fv1 = 0.0f;
+ } else {
+ var_fv1 = M_PI;
+ }
+
+ if (var_fv1 < arg2) {
+ arg2 = var_fv1;
+ }
+
+ if (!(arg2 < (M_PI / 180.0f))) {
+ Math3D_CrossProduct(arg0, arg1, &sp34);
+ if (func_80B0573C(&sp34)) {
+ Matrix_RotateAxisF(arg2, &sp34, MTXMODE_NEW);
+ Matrix_MultVec3f(arg0, &sp28);
+ Math_Vec3f_Copy(arg0, &sp28);
+ }
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B058C0.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05A64.s")
+void func_80B05A64(BossHakugin* this, PlayState* play, s16 speed, s32 y, s16 duration) {
+ s16 quakeIndex;
+
+ if (y > 0) {
+ quakeIndex = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, speed);
+ Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, duration);
+ Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05B04.s")
@@ -246,7 +411,43 @@ extern UNK_TYPE D_06014040;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05D4C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05EE0.s")
+void func_80B05EE0(BossHakugin* this, PlayState* play) {
+ s16 atan;
+ Vec3f warpPos;
+ Vec3f heartPos;
+ f32 sp50;
+ f32 sin;
+ f32 cos;
+
+ atan = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
+ if (atan > 0x4000) {
+ warpPos.x = 1400.0f;
+ warpPos.y = 0.0f;
+ warpPos.z = -1400.0f;
+ } else if (atan < -0x4000) {
+ warpPos.x = -1400.0f;
+ warpPos.y = 0.0f;
+ warpPos.z = -1400.0f;
+ } else if (atan > 0) {
+ warpPos.x = 1400.0f;
+ warpPos.y = -320.0f;
+ warpPos.z = 1400.0f;
+ } else {
+ warpPos.x = -1400.0f;
+ warpPos.y = -160.0f;
+ warpPos.z = 1400.0f;
+ }
+
+ sp50 = this->unk_01B4 * 300.0f;
+ sin = Math_SinS(this->unk_019E);
+ cos = Math_CosS(this->unk_019E);
+ heartPos.x = ((100.0f * sin) + warpPos.x) + (sp50 * cos);
+ heartPos.z = ((100.0f * cos) + warpPos.z) - (sp50 * sin);
+ Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, warpPos.x, warpPos.y, warpPos.z, 0, 0, 0,
+ 1);
+ Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, heartPos.x, warpPos.y, heartPos.z, 0, 0, 0,
+ BHEART_PARAM_NORMAL);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0607C.s")
@@ -254,20 +455,63 @@ extern UNK_TYPE D_06014040;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06600.s")
+void func_80B0696C(BossHakugin* this, Vec3f* arg1);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0696C.s")
+void func_80B06B20(BossHakugin* this, Vec3f* arg1);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06B20.s")
+void func_80B06C08(BossHakugin* this);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06C08.s")
+void func_80B06D38(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06D38.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06F48.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0728C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07450.s")
+void func_80B07450(BossHakugin* this, PlayState* play) {
+ Vec3f velocity;
+ Vec3f pos;
+ f32 temp;
+ s32 i;
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_FOOTSTEP_OLD);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA9A]);
+ if (this->actor.xzDistToPlayer < 1500.0f) {
+ temp = (1500.0f - this->actor.xzDistToPlayer) * 0.00066666666f;
+ func_80B05A64(this, play, 17000, 6.5f * temp, 10);
+ }
+
+ func_80B06C08(this);
+ } else if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EAAC]);
+ func_80B06B20(this, &pos);
+ } else if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA95]);
+ func_80B06D38(this, play);
+ } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EAA5]);
+ func_80B06B20(this, &pos);
+ } else {
+ return;
+ }
+
+ velocity.x = Math_SinS(this->actor.shape.rot.y) * -1.0f;
+ velocity.y = 1.0f;
+ velocity.z = Math_CosS(this->actor.shape.rot.y) * -1.0f;
+ pos.x += 40.0f * velocity.x;
+ pos.y += 5.0f;
+ pos.z += 40.0f * velocity.z;
+ func_800B12F0(play, &pos, &velocity, &gZeroVec3f, Rand_S16Offset(650, 100), Rand_S16Offset(20, 10), 30);
+ for (i = 0; i < 4; i++) {
+ func_80B0696C(this, &pos);
+ }
+}
+
+void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07700.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0791C.s")
@@ -276,29 +520,324 @@ extern UNK_TYPE D_06014040;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07BFC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07DA4.s")
+void func_80B07DA4(BossHakugin* this, PlayState* play, f32 arg2, s16 arg3) {
+ Camera* camera = Play_GetCamera(play, this->unk_01AC);
+ Vec3f sp38;
+ Vec3f sp2C;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07EEC.s")
+ Math_Vec3f_Diff(&camera->at, &camera->eye, &sp38);
+ Math_Vec3f_StepTo(&camera->eye, &this->unk_038C, arg2);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08018.s")
+ if (func_80B0573C(&sp38)) {
+ sp2C.x = Math_CosS(this->unk_037A.x) * Math_SinS(this->unk_037A.y);
+ sp2C.y = Math_SinS(this->unk_037A.x);
+ sp2C.z = Math_CosS(this->unk_037A.x) * Math_CosS(this->unk_037A.y);
+ func_80B057A4(&sp38, &sp2C, BINANG_TO_RAD(arg3));
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08124.s")
+ camera->at.x = camera->eye.x + (50.0f * sp38.x);
+ camera->at.y = camera->eye.y + (50.0f * sp38.y);
+ camera->at.z = camera->eye.z + (50.0f * sp38.z);
+ Play_SetCameraAtEye(play, this->unk_01AC, &camera->at, &camera->eye);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0813C.s")
+void func_80B07EEC(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ Vec3f sp20;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0825C.s")
+ Animation_PlayOnce(&this->skelAnime, &D_06002054);
+ this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
+ this->unk_01AC = CutsceneManager_GetCurrentSubCamId(this->actor.csId);
+ sp20.x = player->actor.focus.pos.x;
+ sp20.y = player->actor.focus.pos.y;
+ sp20.z = player->actor.focus.pos.z;
+ this->unk_038C.x = (Math_SinS(player->actor.shape.rot.y) * 70.0f) + player->actor.focus.pos.x;
+ this->unk_038C.y = player->actor.focus.pos.y + 20.0f;
+ this->unk_038C.z = (Math_CosS(player->actor.shape.rot.y) * 70.0f) + player->actor.focus.pos.z;
+ Play_SetCameraAtEye(play, this->unk_01AC, &sp20, &this->unk_038C);
+ this->unk_037A.x = Math_Atan2S_XY(70.0f, -20.0f);
+ this->unk_037A.y = player->actor.shape.rot.y + 0x8000;
+ func_800B7298(play, &this->actor, PLAYER_CSMODE_21);
+ this->unk_019C = 0;
+ this->actionFunc = func_80B08018;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B082AC.s")
+void func_80B08018(BossHakugin* this, PlayState* play) {
+ this->unk_019C++;
+ if (this->unk_019C == 30) {
+ this->unk_038C.x = 417.0f;
+ this->unk_038C.y = 40.0f;
+ this->unk_038C.z = -1417.0f;
+ Play_SetCameraAtEye(play, this->unk_01AC, &D_80B0EAE8, &this->unk_038C);
+ func_800BE33C(&this->unk_038C, &D_80B0EAE8, &this->unk_037A, true);
+ } else if (this->unk_019C == 50) {
+ this->unk_037A.x = 0x1500;
+ } else if (this->unk_019C == 120) {
+ CutsceneManager_Stop(this->actor.csId);
+ SET_EVENTINF(EVENTINF_62);
+ func_80B08124(this);
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08550.s")
+ if (this->unk_019C >= 31) {
+ func_80B07DA4(this, play, 5.0f, 0xC0);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0863C.s")
+void func_80B08124(BossHakugin* this) {
+ this->unk_019C = 0;
+ this->actionFunc = func_80B0813C;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08848.s")
+void func_80B0813C(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08960.s")
+ if (!(player->stateFlags2 & PLAYER_STATE2_4000)) {
+ DECR(this->unk_019C);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08C1C.s")
+ if ((this->unk_0964.base.acFlags & AC_HIT) && (this->unk_0964.info.acHitInfo->toucher.dmgFlags == 0x800)) {
+ this->unk_0964.base.atFlags &= ~AT_HIT;
+ this->unk_0964.base.acFlags &= ~AC_HIT;
+ this->unk_0964.base.ocFlags1 &= ~OC1_HIT;
+ func_80B09E84(this);
+ return;
+ }
+
+ if (this->unk_0964.base.atFlags & AT_HIT) {
+ this->unk_019C = 40;
+ this->unk_0964.base.atFlags &= ~AT_HIT;
+ }
+
+ if (this->unk_019C == 0) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_0964.base);
+ }
+
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_0964.base);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_0964.base);
+ this->unk_01A4 = 20;
+}
+
+void func_80B0825C(BossHakugin* this) {
+ this->unk_019C = 100;
+ this->unk_01AC = CutsceneManager_GetCurrentSubCamId(this->actor.csId);
+ Play_EnableMotionBlur(140);
+ this->actionFunc = func_80B082AC;
+}
+
+void func_80B082AC(BossHakugin* this, PlayState* play) {
+ Vec3f eye;
+ Vec3f at;
+ s32 temp_v1;
+
+ this->unk_019C--;
+ if ((this->unk_019C >= 30) && (this->unk_019C % 2 != 0)) {
+ func_80B07700(this, play, 1);
+ } else if ((this->unk_019C % 4 == 0)) {
+ func_80B07700(this, play, 0);
+ }
+
+ if (this->unk_019C == 99) {
+ at.x = 479.0f;
+ at.y = 181.0f;
+ at.z = -1637.0f;
+ eye.x = 328.0f;
+ eye.y = 164.0f;
+ eye.z = -1693.0f;
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &eye);
+ } else if (this->unk_019C == 75) {
+ at.x = 693.0f;
+ at.y = 162.0f;
+ at.z = -1550.0f;
+ eye.x = 638.0f;
+ eye.y = 200.0f;
+ eye.z = -1407.0f;
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &eye);
+ } else if (this->unk_019C == 50) {
+ at.x = 825.0f;
+ at.y = 123.0f;
+ at.z = -1637.0f;
+ eye.x = 734.0f;
+ eye.y = 145.0f;
+ eye.z = -1762.0f;
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &eye);
+ } else if (this->unk_019C == 25) {
+ at.x = 711.0f;
+ at.y = 76.0f;
+ at.z = -1602.0f;
+ eye.x = 634.0f;
+ eye.y = 54.0f;
+ eye.z = -1735.0f;
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &eye);
+ }
+
+ this->unk_01D4 -= 0.027f;
+ temp_v1 = (s32)(this->unk_019C * 5.1f) + 50;
+ this->unk_0193 = CLAMP_MAX(temp_v1, 255);
+
+ Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG);
+ if (this->unk_019C == 0) {
+ this->unk_0193 = 0;
+ func_80B08550(this, play);
+ }
+}
+
+void func_80B08550(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_STEAM_DEMO_UP_OLD);
+ Play_SetCameraAtEye(play, this->unk_01AC, &D_80B0EAF4, &D_80B0EB00);
+ this->unk_037A.x = -0x1F00;
+ this->unk_037A.y = -0x4000;
+ this->unk_019C = 70;
+ this->unk_038C.x = 680.0f;
+ this->unk_038C.y = 370.0f;
+ this->unk_038C.z = -1600.0f;
+ player->actor.world.pos.x = 250.0f;
+ player->actor.world.pos.z = -1560.0f;
+ player->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000;
+ player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y;
+ func_800B7298(play, &this->actor, PLAYER_CSMODE_131);
+ this->actionFunc = func_80B0863C;
+}
+
+void func_80B0863C(BossHakugin* this, PlayState* play) {
+ s32 i;
+
+ this->unk_019C--;
+ if (this->unk_019C > 0) {
+ func_80B07DA4(this, play, 7.0f, 0xC0);
+ } else if (this->unk_019C == 0) {
+ Play_SetCameraAtEye(play, this->unk_01AC, &D_80B0EB0C, &D_80B0EB18);
+ this->unk_037A.y = 0x4000;
+ this->unk_037A.x = Math_Atan2S_XY(95.0f, 32.0f);
+ this->unk_038C.x = 232.0f;
+ this->unk_038C.y = 43.0f;
+ this->unk_038C.z = -1600.0f;
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_STEAMS_DEMO_OLD);
+ } else {
+ func_80B07DA4(this, play, 1.0f, 0xC0);
+
+ if (Animation_OnFrame(&this->skelAnime, 20.0f)) {
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_STEAM_DEMO_UP_OLD);
+ }
+
+ if (Animation_OnFrame(&this->skelAnime, 45.0f)) {
+ SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC);
+ }
+
+ if (Animation_OnFrame(&this->skelAnime, 65.0f)) {
+ TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, Lib_SegmentedToVirtual(&D_06014040), 160,
+ 180, 128, 40);
+ }
+
+ if (Animation_OnFrame(&this->skelAnime, 86.0f)) {
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_ICEB_CRY_OLD);
+ }
+
+ if (Animation_OnFrame(&this->skelAnime, 90.0f)) {
+ Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK);
+ for (i = 6; i < 10; i++) {
+ this->unk_09D0[i]->params = 0;
+ }
+ }
+
+ if (SkelAnime_Update(&this->skelAnime)) {
+ func_80B08848(this, play);
+ return;
+ }
+ }
+
+ if (((this->unk_019C + 12) >= 0) && (this->unk_019C % 4 == 0)) {
+ func_80B07700(this, play, 0);
+ }
+}
+
+void func_80B08848(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ Vec3f sp30;
+
+ this->unk_038C.x = player->actor.world.pos.x - 150.0f;
+ this->unk_038C.y = player->actor.world.pos.y + 30.0f;
+ this->unk_038C.z = player->actor.world.pos.z - 30.0f;
+ sp30.x = this->actor.world.pos.x - 100.0f;
+ sp30.y = this->actor.world.pos.y + 100.0f;
+ sp30.z = this->actor.world.pos.z;
+ func_800BE33C(&this->unk_038C, &sp30, &this->unk_037A, true);
+ Animation_Change(&this->skelAnime, &D_06013828, 1.5f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f);
+ this->unk_019C = 0;
+ this->actor.speed = 5.0f;
+ func_800B7298(play, &this->actor, PLAYER_CSMODE_END);
+ player->stateFlags1 |= PLAYER_STATE1_20;
+ play->actorCtx.unk268 = 1;
+ this->actionFunc = func_80B08960;
+}
+
+void func_80B08960(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ Camera* camera = Play_GetCamera(play, this->unk_01AC);
+ Vec3f at;
+ f32 var_fv0;
+ s32 i;
+
+ Math_ScaledStepToS(&this->unk_01A6, 0x800, 0x80);
+ Math_StepToF(&this->actor.speed, 25.0f, 0.5f);
+ this->skelAnime.playSpeed = (this->actor.speed * 0.03125f) + 0.5f;
+ func_80B07450(this, play);
+ this->unk_018D = 10;
+ SkelAnime_Update(&this->skelAnime);
+ this->unk_019C++;
+ if (this->unk_019C < 8) {
+ func_80B07DA4(this, play, 25.0f, 0x120);
+ } else if (this->unk_019C == 22) {
+ this->unk_038C.x = camera->eye.x;
+ this->unk_038C.y = camera->eye.y;
+ this->unk_038C.z = camera->eye.z + 450.0f;
+ } else if (this->unk_019C == 62) {
+ this->actor.flags |= ACTOR_FLAG_TARGETABLE;
+ CutsceneManager_Stop(this->actor.csId);
+ player->stateFlags1 &= ~PLAYER_STATE1_20;
+ SET_EVENTINF(EVENTINF_53);
+ Play_DisableMotionBlur();
+ func_80B08C1C(this);
+ return;
+ } else if (this->unk_019C > 22) {
+ at.x = this->actor.world.pos.x;
+ at.y = this->actor.world.pos.y + 150.0f;
+ at.z = this->actor.world.pos.z;
+ Math_Vec3f_StepTo(&camera->eye, &this->unk_038C, 35.0f);
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &camera->eye);
+
+ if (this->unk_019C == 42) {
+ Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_WALL);
+ for (i = 0; i < 6; i++) {
+ this->unk_09D0[i]->params = 0;
+ }
+ }
+ }
+
+ if (this->unk_0484.base.atFlags & AT_HIT) {
+ func_800B8D50(play, &this->actor, 10.0f, 0, 6.0f, 0);
+ } else {
+ play->actorCtx.unk268 = 1;
+ }
+
+ if (this->unk_019C >= 5) {
+ var_fv0 = (this->unk_019C - 4) * 5.0f;
+ var_fv0 = CLAMP_MAX(var_fv0, 60.0f);
+ func_800B6F20(play, &play->actorCtx.unk_26C, var_fv0, -0x4000);
+ }
+}
+
+void func_80B08C1C(BossHakugin* this) {
+ Animation_Change(&this->skelAnime, &D_06013828, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -5.0f);
+ this->unk_01A2 = 0;
+ this->unk_01C8 = 0.0f;
+ this->unk_019E = Rand_CenteredFloat(3072.0f);
+ this->unk_019C = 40;
+ this->unk_01C4 = 16.0f;
+ this->actionFunc = func_80B08CB8;
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08CB8.s")
@@ -322,9 +861,31 @@ extern UNK_TYPE D_06014040;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09E20.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09E84.s")
+void func_80B09E84(BossHakugin* this) {
+ CutsceneManager_Queue(this->actor.csId);
+ if (this->actionFunc == func_80B0813C) {
+ this->unk_019C = 1;
+ } else {
+ this->unk_019C = 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09EDC.s")
+ this->actionFunc = func_80B09EDC;
+}
+
+void func_80B09EDC(BossHakugin* this, PlayState* play) {
+ if (CutsceneManager_IsNext(this->actor.csId)) {
+ CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor);
+ if (this->actor.colChkInfo.health == 0) {
+ func_80B09F7C(this);
+ } else if (this->unk_019C == 1) {
+ func_80B0825C(this);
+ } else {
+ func_80B07EEC(this, play);
+ }
+ } else {
+ CutsceneManager_Queue(this->actor.csId);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09F7C.s")
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 25b06a2b9..b28c7055a 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -18,6 +18,12 @@ typedef struct BossHakuginEffect {
#define BOSS_HAKUGIN_EFFECT_COUNT 180
+typedef struct BossHakuginUnkStruct_2618 {
+ /* 0x00 */ char unk_00[0x14];
+ /* 0x14 */ ColliderTris unk_14;
+ /* 0x34 */ ColliderTrisElement unk_34;
+} BossHakuginUnkStruct_2618; // size = 0x90
+
typedef struct BossHakuginFhgFlashUnkStruct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ char unk_0C[0x8];
@@ -25,15 +31,55 @@ typedef struct BossHakuginFhgFlashUnkStruct {
typedef struct BossHakugin {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_0144[0x44];
+ /* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ BossHakuginActionFunc actionFunc;
- /* 0x018C */ char unk_018C[0x5];
- /* 0x0191 */ u8 unk_191;
- /* 0x018C */ char unk_0192[0x866];
- /* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT];
- /* 0x2618 */ char unk_2618[0xB40];
+ /* 0x018C */ char unk_018C[0x1];
+ /* 0x018D */ s8 unk_018D;
+ /* 0x018E */ char unk_018E[3];
+ /* 0x0191 */ u8 unk_0191;
+ /* 0x0192 */ char unk_0192[0x1];
+ /* 0x0193 */ u8 unk_0193;
+ /* 0x0194 */ char unk_0194[0x8];
+ /* 0x019C */ s16 unk_019C;
+ /* 0x019E */ s16 unk_019E;
+ /* 0x01A0 */ s16 unk_01A0;
+ /* 0x01A2 */ s16 unk_01A2;
+ /* 0x01A4 */ s16 unk_01A4;
+ /* 0x01A6 */ s16 unk_01A6;
+ /* 0x01A8 */ char unk_01A8[4];
+ /* 0x01AC */ s16 unk_01AC;
+ /* 0x01AE */ char unk_01AE[0x2];
+ /* 0x01B0 */ u32 unk_01B0;
+ /* 0x01B4 */ s32 unk_01B4;
+ /* 0x01B8 */ char unk_01B8[0xC];
+ /* 0x01C4 */ f32 unk_01C4;
+ /* 0x01C8 */ f32 unk_01C8;
+ /* 0x01CC */ char unk_01CC[0x8];
+ /* 0x01D4 */ f32 unk_01D4;
+ /* 0x01D8 */ char unk_01D8[0x10];
+ /* 0x01E8 */ Vec3s jointTable[33];
+ /* 0x02AE */ Vec3s morphTable[33];
+ /* 0x0374 */ char unk_0374[0x6];
+ /* 0x037A */ Vec3s unk_037A;
+ /* 0x0380 */ char unk_0380[0xC];
+ /* 0x038C */ Vec3f unk_038C;
+ /* 0x0398 */ Vec3f bodyPartsPos[15];
+ /* 0x044C */ char unk_044C[0xC];
+ /* 0x0458 */ Vec3f unk_0458;
+ /* 0x0464 */ Vec3f unk_0464;
+ /* 0x0470 */ LightNode* lightNode;
+ /* 0x0474 */ LightInfo lightInfo;
+ /* 0x0482 */ char unk_0482[0x2];
+ /* 0x0484 */ ColliderJntSph unk_0484;
+ /* 0x04A4 */ ColliderJntSphElement unk_04A4[19];
+ /* 0x0964 */ ColliderCylinder unk_0964;
+ /* 0x09B0 */ Actor* unk_09B0[8];
+ /* 0x09D0 */ Actor* unk_09D0[10];
+ /* 0x09F8 */ BossHakuginEffect unk_09F8[BOSS_HAKUGIN_EFFECT_COUNT];
+ /* 0x2618 */ BossHakuginUnkStruct_2618 unk_2618[20];
/* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
- /* 0x3734 */ char unk_3734[0xDC];
+ /* 0x3734 */ char unk_3734[0x84];
+ /* 0x37B8 */ ColliderSphere unk_37B8;
} BossHakugin; // size = 0x3810
#endif // Z_BOSS_HAKUGIN_H
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
index 30010a196..6ab2f2b78 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
@@ -97,7 +97,7 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) {
s32 pad;
Vec3f* bodyPartPos;
BossHakugin* goht = (BossHakugin*)this->actor;
- s32 gohtIndex = goht->unk_191 - 3;
+ s32 gohtIndex = goht->unk_0191 - 3;
if (gohtIndex < 0) {
bodyPartPos = &goht->unk_3158[this->rParams - FHGFLASH_SHOCK_GOHT_2][12].unk_00;
From 52f8905a78db18f755f10bce474291eb1e153fbd Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 19:03:13 -0700
Subject: [PATCH 19/51] BossHakugin_Draw OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 65 ++++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 17 +++--
.../actors/ovl_En_Hakurock/z_en_hakurock.c | 4 +-
3 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 741e5e84c..0d2b2fa24 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -44,6 +44,10 @@ void func_80B09F7C(BossHakugin* this);
void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
+void func_80B0E5A4(BossHakugin* this, PlayState* play);
+void func_80B0D69C(UNK_PTR arg0, BossHakugin* this);
+void func_80B0D750(UNK_PTR arg0, BossHakugin* this, PlayState* play);
+
#if 0
ActorInit Boss_Hakugin_InitVars = {
ACTOR_BOSS_HAKUGIN,
@@ -467,6 +471,7 @@ void func_80B06C08(BossHakugin* this);
void func_80B06D38(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06D38.s")
+void func_80B06F48(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06F48.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0728C.s")
@@ -915,28 +920,86 @@ void func_80B09EDC(BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Update.s")
+s32 func_80B0C000(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, struct Actor* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C000.s")
+void func_80B0C1BC(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C1BC.s")
+void func_80B0C398(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C398.s")
+void func_80B0C570(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C570.s")
+void func_80B0C7B0(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C7B0.s")
+void func_80B0CAF0(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CAF0.s")
+void func_80B0CCD8(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CCD8.s")
+void func_80B0CF24(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CF24.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Draw.s")
+void BossHakugin_Draw(Actor* thisx, PlayState* play) {
+ s32 pad;
+ BossHakugin* this = (BossHakugin*)thisx;
+ UNK_PTR sp34 = GRAPH_ALLOC(play->state.gfxCtx, 0x1000);
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Opa(play->state.gfxCtx);
+ gSPSegment(POLY_OPA_DISP++, 0x08, D_80B0EA88);
+ SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80B0C000, func_80B0C1BC, &this->actor);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+
+ Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->unk_01DC,
+ this->unk_01E0, this->unk_01E4, this->unk_0196);
+
+ SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_0380, &this->unk_0458);
+ SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_3734, &this->unk_0464);
+
+ if (this->unk_0190 == 0) {
+ func_80B06F48(this, play);
+ }
+ this->unk_0190 = 1;
+
+ if (this->actor.colorFilterTimer != 0) {
+ func_800AE5A0(play);
+ }
+
+ if (this->actionFunc == func_80B0A8C4) {
+ func_80B0E5A4(this, play);
+ } else {
+ func_80B0C398(this, play);
+ }
+
+ func_80B0C570(this, play);
+ func_80B0C7B0(this, play);
+ func_80B0CAF0(this, play);
+ func_80B0CCD8(this, play);
+
+ if (this->unk_0193 > 0) {
+ func_80B0CF24(this, play);
+ }
+
+ if (this->actionFunc != func_80B0A8C4) {
+ func_80B0D69C(sp34, this);
+ func_80B0D750(sp34, this, play);
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D2B8.s")
+void func_80B0D69C(UNK_PTR arg0, BossHakugin* this);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D69C.s")
+void func_80B0D750(UNK_PTR arg0, BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D750.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index b28c7055a..195323d9d 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -35,11 +35,14 @@ typedef struct BossHakugin {
/* 0x0188 */ BossHakuginActionFunc actionFunc;
/* 0x018C */ char unk_018C[0x1];
/* 0x018D */ s8 unk_018D;
- /* 0x018E */ char unk_018E[3];
+ /* 0x018E */ char unk_018E[2];
+ /* 0x0190 */ u8 unk_0190; // boolean?
/* 0x0191 */ u8 unk_0191;
/* 0x0192 */ char unk_0192[0x1];
/* 0x0193 */ u8 unk_0193;
- /* 0x0194 */ char unk_0194[0x8];
+ /* 0x0194 */ char unk_0194[2];
+ /* 0x0196 */ u8 unk_0196;
+ /* 0x0197 */ char unk_0197[0x5];
/* 0x019C */ s16 unk_019C;
/* 0x019E */ s16 unk_019E;
/* 0x01A0 */ s16 unk_01A0;
@@ -56,12 +59,15 @@ typedef struct BossHakugin {
/* 0x01C8 */ f32 unk_01C8;
/* 0x01CC */ char unk_01CC[0x8];
/* 0x01D4 */ f32 unk_01D4;
- /* 0x01D8 */ char unk_01D8[0x10];
+ /* 0x01D8 */ char unk_01D8[0x4];
+ /* 0x01DC */ f32 unk_01DC;
+ /* 0x01E0 */ f32 unk_01E0;
+ /* 0x01E4 */ f32 unk_01E4;
/* 0x01E8 */ Vec3s jointTable[33];
/* 0x02AE */ Vec3s morphTable[33];
/* 0x0374 */ char unk_0374[0x6];
/* 0x037A */ Vec3s unk_037A;
- /* 0x0380 */ char unk_0380[0xC];
+ /* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
/* 0x0398 */ Vec3f bodyPartsPos[15];
/* 0x044C */ char unk_044C[0xC];
@@ -78,7 +84,8 @@ typedef struct BossHakugin {
/* 0x09F8 */ BossHakuginEffect unk_09F8[BOSS_HAKUGIN_EFFECT_COUNT];
/* 0x2618 */ BossHakuginUnkStruct_2618 unk_2618[20];
/* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
- /* 0x3734 */ char unk_3734[0x84];
+ /* 0x3734 */ Vec3f unk_3734;
+ /* 0x3740 */ char unk_3740[0x78];
/* 0x37B8 */ ColliderSphere unk_37B8;
} BossHakugin; // size = 0x3810
diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c
index f5885b3cf..0b8807c3c 100644
--- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c
+++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c
@@ -93,8 +93,8 @@ void EnHakurock_Destroy(Actor* thisx, PlayState* play) {
void func_80B21BE0(BossHakugin* parent, Vec3f* arg1, s32 arg2) {
s32 i;
- for (i = 0; i < ARRAY_COUNT(parent->unk_9F8); i++) {
- BossHakuginEffect* gohtEffect = &parent->unk_9F8[i];
+ for (i = 0; i < ARRAY_COUNT(parent->unk_09F8); i++) {
+ BossHakuginEffect* gohtEffect = &parent->unk_09F8[i];
if (gohtEffect->unk_18 < 0) {
s16 sp2E;
s16 sp2C;
From df18f1e26efc8358a39be052e6356d991e1cfb42 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 19:20:43 -0700
Subject: [PATCH 20/51] func_80B0D69C OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 29 ++++++++++++++-----
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 0d2b2fa24..07c39c14b 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -45,8 +45,8 @@ void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
void func_80B0E5A4(BossHakugin* this, PlayState* play);
-void func_80B0D69C(UNK_PTR arg0, BossHakugin* this);
-void func_80B0D750(UNK_PTR arg0, BossHakugin* this, PlayState* play);
+void func_80B0D69C(u8* tex, BossHakugin* this);
+void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play);
#if 0
ActorInit Boss_Hakugin_InitVars = {
@@ -947,7 +947,7 @@ void func_80B0CF24(BossHakugin* this, PlayState* play);
void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 pad;
BossHakugin* this = (BossHakugin*)thisx;
- UNK_PTR sp34 = GRAPH_ALLOC(play->state.gfxCtx, 0x1000);
+ u8* tex = GRAPH_ALLOC(play->state.gfxCtx, 64 * 64);
OPEN_DISPS(play->state.gfxCtx);
@@ -989,17 +989,30 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
}
if (this->actionFunc != func_80B0A8C4) {
- func_80B0D69C(sp34, this);
- func_80B0D750(sp34, this, play);
+ func_80B0D69C(tex, this);
+ func_80B0D750(tex, this, play);
}
}
+void func_80B0D2B8(BossHakugin* this, u8* tex, f32 tween);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D2B8.s")
-void func_80B0D69C(UNK_PTR arg0, BossHakugin* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D69C.s")
+void func_80B0D69C(u8* tex, BossHakugin* this) {
+ s32* iter = (s32*)tex;
+ s16 i;
-void func_80B0D750(UNK_PTR arg0, BossHakugin* this, PlayState* play);
+ for (i = 0; i < (64 * 64) / 4; i++, iter++) {
+ *iter = 0;
+ }
+
+ Matrix_RotateXFNew(1.0f);
+
+ for (i = 0; i < 6; i++) {
+ func_80B0D2B8(this, tex, i / 5.0f);
+ }
+}
+
+void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D750.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
From e259c526dba3349483681126dcd752dcb53e1760 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 20:50:28 -0700
Subject: [PATCH 21/51] func_80B0D2B8 OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 96 ++++++++++++++++++-
1 file changed, 94 insertions(+), 2 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 07c39c14b..a6894ea4f 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -994,8 +994,100 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
}
}
-void func_80B0D2B8(BossHakugin* this, u8* tex, f32 tween);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D2B8.s")
+#if 0
+s32 D_80B0EB70[6] = { 1, 2, 3, 3, 2, 1 };
+s32 D_80B0EB88[7] = { 2, 3, 4, 4, 4, 3, 2 };
+s32 D_80B0EBA4[8] = { 2, 3, 4, 4, 4, 4, 3, 2 };
+s32 D_80B0EBC4[14] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
+s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 0xA, 0, 0xC, 0xD };
+u8 D_80B0EC38[15] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3 };
+#else
+extern s32 D_80B0EB70[];
+extern s32 D_80B0EB88[];
+extern s32 D_80B0EBA4[];
+extern s32 D_80B0EBC4[];
+extern s32 D_80B0EBFC[];
+extern u8 D_80B0EC38[];
+#endif
+
+void func_80B0D2B8(BossHakugin* this, u8* tex, f32 arg2) {
+ s32 index;
+ s32 i;
+ s32 baseX;
+ s32 baseY;
+ s32 addY;
+ s32 x;
+ s32 y = -1;
+ Vec3f lerp;
+ Vec3f* parentBodyPartPos;
+ Vec3f* bodyPartPos;
+ Vec3f sp74;
+ Vec3f sp68;
+
+ for (i = 0; i < 15; i++) {
+ if ((arg2 == 0.0f) || (y = D_80B0EBFC[i]) > BODYPART_NONE) {
+ bodyPartPos = &this->bodyPartsPos[i];
+ if (arg2 > 0.0f) {
+ parentBodyPartPos = &this->bodyPartsPos[y];
+
+ VEC3F_LERPIMPDST(&lerp, bodyPartPos, parentBodyPartPos, arg2);
+
+ sp74.x = lerp.x - this->actor.world.pos.x;
+ sp74.y = lerp.y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
+ sp74.z = lerp.z - this->actor.world.pos.z;
+ } else {
+ sp74.x = bodyPartPos->x - this->actor.world.pos.x;
+ sp74.y = bodyPartPos->y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
+ sp74.z = bodyPartPos->z - this->actor.world.pos.z;
+ }
+ Matrix_MultVec3f(&sp74, &sp68);
+
+ sp68.x *= 0.7f;
+ sp68.y *= 0.7f;
+
+ baseX = (u16)(s32)(sp68.x + 32.0f);
+ baseY = (u16)((s32)sp68.y * 64);
+
+ if (D_80B0EC38[i] == 2) {
+ for (y = 0, addY = -0x180; y < 14; y++, addY += 0x40) {
+ for (x = -D_80B0EBC4[y]; x < D_80B0EBC4[y]; x++) {
+ index = baseX + x + baseY + addY;
+ if ((index >= 0) && (index < 0x1000)) {
+ tex[index] = 255;
+ }
+ }
+ }
+ } else if (D_80B0EC38[i] == 1) {
+ for (y = 0, addY = -0x100; y < 8; y++, addY += 0x40) {
+ for (x = -D_80B0EBA4[y]; x < D_80B0EBA4[y]; x++) {
+ index = baseX + x + baseY + addY;
+ if ((index >= 0) && (index < 0x1000)) {
+ tex[index] = 255;
+ }
+ }
+ }
+ } else if (D_80B0EC38[i] == 0) {
+ for (y = 0, addY = -0xC0; y < 7; y++, addY += 0x40) {
+ for (x = -D_80B0EB88[y]; x < D_80B0EB88[y]; x++) {
+ index = baseX + x + baseY + addY;
+ if ((index >= 0) && (index < 0x1000)) {
+ tex[index] = 255;
+ }
+ }
+ }
+ } else {
+ for (y = 0, addY = -0x80; y < 6; y++, addY += 0x40) {
+ for (x = -D_80B0EB70[y]; x < D_80B0EB70[y]; x++) {
+ index = baseX + x + baseY + addY;
+ if ((index >= 0) && (index < 0x1000)) {
+ tex[index] = 255;
+ }
+ }
+ }
+ }
+ }
+ }
+}
void func_80B0D69C(u8* tex, BossHakugin* this) {
s32* iter = (s32*)tex;
From 7b524559471209853f52ca236b3ec253398b6bea Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 20:58:56 -0700
Subject: [PATCH 22/51] func_80B0D750 OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 37 +++++++++++++++++--
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index a6894ea4f..90ba3d602 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -947,7 +947,7 @@ void func_80B0CF24(BossHakugin* this, PlayState* play);
void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 pad;
BossHakugin* this = (BossHakugin*)thisx;
- u8* tex = GRAPH_ALLOC(play->state.gfxCtx, 64 * 64);
+ u8* tex = GRAPH_ALLOC(play->state.gfxCtx, sizeof(u8[64][64]));
OPEN_DISPS(play->state.gfxCtx);
@@ -1093,7 +1093,7 @@ void func_80B0D69C(u8* tex, BossHakugin* this) {
s32* iter = (s32*)tex;
s16 i;
- for (i = 0; i < (64 * 64) / 4; i++, iter++) {
+ for (i = 0; i < (sizeof(u8[64][64])) / sizeof(s32); i++, iter++) {
*iter = 0;
}
@@ -1104,8 +1104,37 @@ void func_80B0D69C(u8* tex, BossHakugin* this) {
}
}
-void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D750.s")
+void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play) {
+ s32 pad[2];
+ f32 alpha;
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mtx;
+
+ OPEN_DISPS(gfxCtx);
+
+ Gfx_SetupDL25_Opa(play->state.gfxCtx);
+
+ alpha = (400.0f - this->actor.world.pos.y) * 0.0025f;
+ alpha = CLAMP_MIN(alpha, 0.0f);
+ alpha = CLAMP_MAX(alpha, 1.0f);
+
+ gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (s8)(alpha * 80.0f));
+ gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
+
+ if (this->actor.floorPoly != NULL) {
+ func_800C0094(this->actor.floorPoly, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, &mtx);
+ Matrix_Put(&mtx);
+ }
+
+ Matrix_Scale(4.25f, 1.0f, 4.25f, MTXMODE_APPLY);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, gShadowMaterialDL);
+ gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP,
+ G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
+ gSPDisplayList(POLY_OPA_DISP++, gShadowModelDL);
+
+ CLOSE_DISPS(gfxCtx);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
From 89b2accda1b8c315d81d4463a09bb2b572bdfbcf Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 21:09:47 -0700
Subject: [PATCH 23/51] Shadow function docs
---
include/z64subs.h | 2 +-
src/code/z_sub_s.c | 8 +--
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 63 ++++++++++---------
tools/disasm/functions.txt | 6 +-
4 files changed, 41 insertions(+), 38 deletions(-)
diff --git a/include/z64subs.h b/include/z64subs.h
index 4d365dd14..96153d6b2 100644
--- a/include/z64subs.h
+++ b/include/z64subs.h
@@ -133,7 +133,7 @@ s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst);
s32 SubS_Offer(Actor* actor, struct PlayState* play, f32 xzRange, f32 yRange, s32 itemId, SubSOfferMode mode);
void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size);
-void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[], s8 parentBodyParts[]);
+void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 weight, u8 bodyPartsNum, u8 sizes[], s8 parentBodyParts[]);
void SubS_DrawShadowTex(Actor* actor, struct GameState* gameState, u8* tex);
s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax);
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c
index 4baff41ce..db79f0437 100644
--- a/src/code/z_sub_s.c
+++ b/src/code/z_sub_s.c
@@ -963,7 +963,7 @@ void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size) {
}
}
-void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[],
+void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 weight, u8 bodyPartsNum, u8 sizes[],
s8 parentBodyParts[]) {
Vec3f pos;
Vec3f startVec;
@@ -978,9 +978,9 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween
parentBodyPart = parentBodyParts[i];
bodyPartPos = &bodyPartsPos[i];
- pos.x = (bodyPartsPos[parentBodyPart].x - bodyPartPos->x) * tween + (bodyPartPos->x - worldPos->x);
- pos.y = (bodyPartsPos[parentBodyPart].y - bodyPartPos->y) * tween + (bodyPartPos->y - worldPos->y);
- pos.z = (bodyPartsPos[parentBodyPart].z - bodyPartPos->z) * tween + (bodyPartPos->z - worldPos->z);
+ pos.x = (bodyPartsPos[parentBodyPart].x - bodyPartPos->x) * weight + (bodyPartPos->x - worldPos->x);
+ pos.y = (bodyPartsPos[parentBodyPart].y - bodyPartPos->y) * weight + (bodyPartPos->y - worldPos->y);
+ pos.z = (bodyPartsPos[parentBodyPart].z - bodyPartPos->z) * weight + (bodyPartPos->z - worldPos->z);
} else {
bodyPartPos = &bodyPartsPos[i];
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 90ba3d602..5ecc4c0f8 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -45,8 +45,8 @@ void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
void func_80B0E5A4(BossHakugin* this, PlayState* play);
-void func_80B0D69C(u8* tex, BossHakugin* this);
-void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play);
+void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
+void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
#if 0
ActorInit Boss_Hakugin_InitVars = {
@@ -989,8 +989,8 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
}
if (this->actionFunc != func_80B0A8C4) {
- func_80B0D69C(tex, this);
- func_80B0D750(tex, this, play);
+ BossHakugin_GenShadowTex(tex, this);
+ BossHakugin_DrawShadowTex(tex, this, play);
}
}
@@ -999,18 +999,20 @@ s32 D_80B0EB70[6] = { 1, 2, 3, 3, 2, 1 };
s32 D_80B0EB88[7] = { 2, 3, 4, 4, 4, 3, 2 };
s32 D_80B0EBA4[8] = { 2, 3, 4, 4, 4, 4, 3, 2 };
s32 D_80B0EBC4[14] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
-s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 0xA, 0, 0xC, 0xD };
+s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 10, 0, 12, 13 };
u8 D_80B0EC38[15] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3 };
#else
+// These are the different sizes wdiths
extern s32 D_80B0EB70[];
extern s32 D_80B0EB88[];
extern s32 D_80B0EBA4[];
extern s32 D_80B0EBC4[];
-extern s32 D_80B0EBFC[];
-extern u8 D_80B0EC38[];
+
+extern s32 D_80B0EBFC[]; // sParentBodyParts
+extern u8 D_80B0EC38[]; // sShadowSizes
#endif
-void func_80B0D2B8(BossHakugin* this, u8* tex, f32 arg2) {
+void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
s32 index;
s32 i;
s32 baseX;
@@ -1021,32 +1023,32 @@ void func_80B0D2B8(BossHakugin* this, u8* tex, f32 arg2) {
Vec3f lerp;
Vec3f* parentBodyPartPos;
Vec3f* bodyPartPos;
- Vec3f sp74;
- Vec3f sp68;
+ Vec3f pos;
+ Vec3f startVec;
for (i = 0; i < 15; i++) {
- if ((arg2 == 0.0f) || (y = D_80B0EBFC[i]) > BODYPART_NONE) {
+ if ((weight == 0.0f) || (y = D_80B0EBFC[i]) > BODYPART_NONE) {
bodyPartPos = &this->bodyPartsPos[i];
- if (arg2 > 0.0f) {
+ if (weight > 0.0f) {
parentBodyPartPos = &this->bodyPartsPos[y];
- VEC3F_LERPIMPDST(&lerp, bodyPartPos, parentBodyPartPos, arg2);
+ VEC3F_LERPIMPDST(&lerp, bodyPartPos, parentBodyPartPos, weight);
- sp74.x = lerp.x - this->actor.world.pos.x;
- sp74.y = lerp.y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
- sp74.z = lerp.z - this->actor.world.pos.z;
+ pos.x = lerp.x - this->actor.world.pos.x;
+ pos.y = lerp.y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
+ pos.z = lerp.z - this->actor.world.pos.z;
} else {
- sp74.x = bodyPartPos->x - this->actor.world.pos.x;
- sp74.y = bodyPartPos->y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
- sp74.z = bodyPartPos->z - this->actor.world.pos.z;
+ pos.x = bodyPartPos->x - this->actor.world.pos.x;
+ pos.y = bodyPartPos->y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 600.0f;
+ pos.z = bodyPartPos->z - this->actor.world.pos.z;
}
- Matrix_MultVec3f(&sp74, &sp68);
+ Matrix_MultVec3f(&pos, &startVec);
- sp68.x *= 0.7f;
- sp68.y *= 0.7f;
+ startVec.x *= 0.7f;
+ startVec.y *= 0.7f;
- baseX = (u16)(s32)(sp68.x + 32.0f);
- baseY = (u16)((s32)sp68.y * 64);
+ baseX = (u16)(s32)(startVec.x + 32.0f);
+ baseY = (u16)((s32)startVec.y * 64);
if (D_80B0EC38[i] == 2) {
for (y = 0, addY = -0x180; y < 14; y++, addY += 0x40) {
@@ -1089,22 +1091,22 @@ void func_80B0D2B8(BossHakugin* this, u8* tex, f32 arg2) {
}
}
-void func_80B0D69C(u8* tex, BossHakugin* this) {
+void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this) {
s32* iter = (s32*)tex;
s16 i;
- for (i = 0; i < (sizeof(u8[64][64])) / sizeof(s32); i++, iter++) {
+ for (i = 0; i < ((sizeof(u8[64][64])) / sizeof(s32)); i++, iter++) {
*iter = 0;
}
Matrix_RotateXFNew(1.0f);
- for (i = 0; i < 6; i++) {
- func_80B0D2B8(this, tex, i / 5.0f);
+ for (i = 0; i <= 5; i++) {
+ BossHakugin_FillShadowTex(this, tex, i / 5.0f);
}
}
-void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play) {
+void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
s32 pad[2];
f32 alpha;
GraphicsContext* gfxCtx = play->state.gfxCtx;
@@ -1122,7 +1124,8 @@ void func_80B0D750(u8* tex, BossHakugin* this, PlayState* play) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
if (this->actor.floorPoly != NULL) {
- func_800C0094(this->actor.floorPoly, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, &mtx);
+ func_800C0094(this->actor.floorPoly, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z,
+ &mtx);
Matrix_Put(&mtx);
}
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index c8330232d..be8c72fe4 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -12979,9 +12979,9 @@
0x80B0CCD8:("func_80B0CCD8",),
0x80B0CF24:("func_80B0CF24",),
0x80B0D0D4:("BossHakugin_Draw",),
- 0x80B0D2B8:("func_80B0D2B8",),
- 0x80B0D69C:("func_80B0D69C",),
- 0x80B0D750:("func_80B0D750",),
+ 0x80B0D2B8:("BossHakugin_FillShadowTex",),
+ 0x80B0D69C:("BossHakugin_GenShadowTex",),
+ 0x80B0D750:("BossHakugin_DrawShadowTex",),
0x80B0D9CC:("func_80B0D9CC",),
0x80B0DFA8:("func_80B0DFA8",),
0x80B0E548:("func_80B0E548",),
From 952eb06aac2c6cffb0a0907be452124d5eff6d19 Mon Sep 17 00:00:00 2001
From: Tom Overton
Date: Wed, 27 Sep 2023 22:20:14 -0700
Subject: [PATCH 24/51] Fix some non-matchings
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 5ecc4c0f8..1979c5130 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -1044,8 +1044,8 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
}
Matrix_MultVec3f(&pos, &startVec);
- startVec.x *= 0.7f;
- startVec.y *= 0.7f;
+ startVec.x *= 0.070000000298f;
+ startVec.y *= 0.070000000298f;
baseX = (u16)(s32)(startVec.x + 32.0f);
baseY = (u16)((s32)startVec.y * 64);
@@ -1095,7 +1095,7 @@ void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this) {
s32* iter = (s32*)tex;
s16 i;
- for (i = 0; i < ((sizeof(u8[64][64])) / sizeof(s32)); i++, iter++) {
+ for (i = 0; i < (s32)((sizeof(u8[64][64])) / sizeof(s32)); i++, iter++) {
*iter = 0;
}
From 7768ca92860531a3144004f6b26e96ea6343efe4 Mon Sep 17 00:00:00 2001
From: Tom Overton
Date: Wed, 27 Sep 2023 22:23:01 -0700
Subject: [PATCH 25/51] Apparently this matches now? It didn't before
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 1979c5130..19873e032 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -1044,8 +1044,8 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
}
Matrix_MultVec3f(&pos, &startVec);
- startVec.x *= 0.070000000298f;
- startVec.y *= 0.070000000298f;
+ startVec.x *= 0.07f;
+ startVec.y *= 0.07f;
baseX = (u16)(s32)(startVec.x + 32.0f);
baseY = (u16)((s32)startVec.y * 64);
From 3e050e55cd4d20bac0cbe1a2e28cc0bdadc9de3b Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 21:47:02 -0700
Subject: [PATCH 26/51] OverrideLimbDraw OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 50 +++++++++++++++++--
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 9 ++--
tools/disasm/functions.txt | 2 +-
3 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 19873e032..e62286c0e 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -255,6 +255,8 @@ extern AnimationHeader D_06013828; // gGohtRunAnim
extern TexturePtr D_06014040; // gGohtTitleCardTex
extern FlexSkeletonHeader D_06013158; // gGohtSkel
+extern s32 D_80B0EAB0[5];
+
#ifdef NON_MATCHING
// requires in-function static, too lazy to import all the data right now
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
@@ -920,10 +922,50 @@ void func_80B09EDC(BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Update.s")
-s32 func_80B0C000(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, struct Actor* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C000.s")
+#ifdef NON_MATCHING
+s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ static s32 D_80B0EB68 = 4;
+ static s32 D_80B0EB6C = 6;
+ BossHakugin* this = THIS;
-void func_80B0C1BC(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* thisx);
+ if (this->actionFunc == func_80B0A8C4) {
+ if (limbIndex == GOHT_LIMB_ROOT) {
+ pos->y -= this->actor.shape.yOffset;
+ }
+ if (!(this->unk_01B0 & (1 << (limbIndex + 0x1F)))) {
+ *dList = NULL;
+ }
+ }
+
+ if ((this->unk_0190 == 0) && (limbIndex == D_80B0EB6C)) {
+ Matrix_MultZero(&this->unk_3158[D_80B0EB68][this->unk_0191].unk_00);
+ D_80B0EB68--;
+ if (D_80B0EB68 < 0) {
+ D_80B0EB68 = 4;
+ }
+ D_80B0EB6C = D_80B0EAB0[D_80B0EB68];
+ }
+
+ if (limbIndex == GOHT_LIMB_HEAD) {
+ rot->z += this->unk_01A6;
+ if (this->actionFunc == func_80B0A2A4) {
+ rot->z += this->unk_0378;
+ rot->y += this->unk_0376;
+ }
+ } else if (limbIndex == GOHT_LIMB_THORAX_WRAPPER) {
+ rot->z += (s16)(this->unk_01A6 * 2);
+ } else if ((limbIndex == GOHT_LIMB_FRONT_LEFT_LEG_ROOT) || (limbIndex == GOHT_LIMB_FRONT_RIGHT_LEG_ROOT)) {
+ rot->z -= (s16)(this->unk_01A6 * 3);
+ }
+
+ return false;
+}
+#else
+s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_OverrideLimbDraw.s")
+#endif
+
+void func_80B0C1BC(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C1BC.s")
void func_80B0C398(BossHakugin* this, PlayState* play);
@@ -954,7 +996,7 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, D_80B0EA88);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
- func_80B0C000, func_80B0C1BC, &this->actor);
+ BossHakugin_OverrideLimbDraw, func_80B0C1BC, &this->actor);
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 195323d9d..47051e5c0 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -2,6 +2,7 @@
#define Z_BOSS_HAKUGIN_H
#include "global.h"
+#include "objects/object_boss_hakugin/object_boss_hakugin.h"
struct BossHakugin;
@@ -63,9 +64,11 @@ typedef struct BossHakugin {
/* 0x01DC */ f32 unk_01DC;
/* 0x01E0 */ f32 unk_01E0;
/* 0x01E4 */ f32 unk_01E4;
- /* 0x01E8 */ Vec3s jointTable[33];
- /* 0x02AE */ Vec3s morphTable[33];
- /* 0x0374 */ char unk_0374[0x6];
+ /* 0x01E8 */ Vec3s jointTable[GOHT_LIMB_MAX];
+ /* 0x02AE */ Vec3s morphTable[GOHT_LIMB_MAX];
+ /* 0x0374 */ s16 unk_0374;
+ /* 0x0376 */ s16 unk_0376;
+ /* 0x0378 */ s16 unk_0378;
/* 0x037A */ Vec3s unk_037A;
/* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index be8c72fe4..98b14a09f 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -12970,7 +12970,7 @@
0x80B0B548:("func_80B0B548",),
0x80B0B660:("func_80B0B660",),
0x80B0BAE0:("BossHakugin_Update",),
- 0x80B0C000:("func_80B0C000",),
+ 0x80B0C000:("BossHakugin_OverrideLimbDraw",),
0x80B0C1BC:("func_80B0C1BC",),
0x80B0C398:("func_80B0C398",),
0x80B0C570:("func_80B0C570",),
From 4d74e117ee92b39927c11db64b1f14d82adb6976 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Wed, 27 Sep 2023 22:40:35 -0700
Subject: [PATCH 27/51] BossHakugin_PostLimbDraw
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 66 ++++++++++++++-----
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 4 +-
tools/disasm/functions.txt | 2 +-
tools/disasm/variables.txt | 8 +--
4 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index e62286c0e..59894b02e 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -233,10 +233,9 @@ extern ColliderCylinderInit D_80B0EA34;
extern DamageTable D_80B0EA60;
extern CollisionCheckInfoInit D_80B0EA80;
extern TexturePtr D_80B0EA88;
-extern s8 D_80B0EA95;
-extern s8 D_80B0EA9A;
-extern s8 D_80B0EAA5;
+extern s8 D_80B0EA8C[]; // sLimbToBodyParts
extern s8 D_80B0EAAC;
+extern s32 D_80B0EAB0[5];
extern s32 D_80B0EAD4;
extern InitChainEntry D_80B0EAD8[];
extern Vec3f D_80B0EAE8;
@@ -255,8 +254,6 @@ extern AnimationHeader D_06013828; // gGohtRunAnim
extern TexturePtr D_06014040; // gGohtTitleCardTex
extern FlexSkeletonHeader D_06013158; // gGohtSkel
-extern s32 D_80B0EAB0[5];
-
#ifdef NON_MATCHING
// requires in-function static, too lazy to import all the data right now
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
@@ -486,7 +483,7 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_FOOTSTEP_OLD);
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA9A]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_FRONT_LEFT_HOOF]]);
if (this->actor.xzDistToPlayer < 1500.0f) {
temp = (1500.0f - this->actor.xzDistToPlayer) * 0.00066666666f;
func_80B05A64(this, play, 17000, 6.5f * temp, 10);
@@ -494,13 +491,13 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
func_80B06C08(this);
} else if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EAAC]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_BACK_LEFT_HOOF]]);
func_80B06B20(this, &pos);
} else if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA95]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_FRONT_RIGHT_HOOF]]);
func_80B06D38(this, play);
} else if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EAA5]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_BACK_RIGHT_HOOF]]);
func_80B06B20(this, &pos);
} else {
return;
@@ -923,7 +920,9 @@ void func_80B09EDC(BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Update.s")
#ifdef NON_MATCHING
-s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+// requires in-function static, too lazy to import all the data right now
+s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx) {
static s32 D_80B0EB68 = 4;
static s32 D_80B0EB6C = 6;
BossHakugin* this = THIS;
@@ -949,8 +948,8 @@ s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dL
if (limbIndex == GOHT_LIMB_HEAD) {
rot->z += this->unk_01A6;
if (this->actionFunc == func_80B0A2A4) {
- rot->z += this->unk_0378;
- rot->y += this->unk_0376;
+ rot->z += this->unk_0374.y;
+ rot->y += this->unk_0374.z;
}
} else if (limbIndex == GOHT_LIMB_THORAX_WRAPPER) {
rot->z += (s16)(this->unk_01A6 * 2);
@@ -961,12 +960,47 @@ s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dL
return false;
}
#else
-s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
+s32 BossHakugin_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_OverrideLimbDraw.s")
#endif
-void func_80B0C1BC(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C1BC.s")
+void BossHakugin_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ BossHakugin* this = THIS;
+ s8 bodyPartIndex;
+ s32 i;
+ f32 cos;
+ s16 angle;
+
+ Collider_UpdateSpheres(limbIndex, &this->unk_0484);
+ bodyPartIndex = D_80B0EA8C[limbIndex];
+ if (bodyPartIndex > BODYPART_NONE) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_04A4); i++) {
+ if (this->unk_0484.elements[i].dim.limb == limbIndex) {
+ Math_Vec3s_ToVec3f(&this->bodyPartsPos[bodyPartIndex],
+ &this->unk_0484.elements[i].dim.worldSphere.center);
+ break;
+ }
+ }
+ if (i == ARRAY_COUNT(this->unk_04A4)) {
+ Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]);
+ }
+ }
+ if (limbIndex == GOHT_LIMB_HEAD) {
+ Matrix_MultVecX(3500.0f, &this->actor.focus.pos);
+ this->actor.focus.rot.y = this->actor.shape.rot.y;
+ if (this->actionFunc != func_80B0A2A4) {
+ Matrix_MtxFToYXZRot(Matrix_GetCurrent(), &this->unk_0374, false);
+ }
+
+ if (this->unk_01C8 > 0.0f) {
+ angle = 0x12C0 - this->unk_0374.z;
+ cos = Math_CosS(angle);
+ this->unk_0380.x = this->actor.focus.pos.x - (Math_SinS(this->actor.shape.rot.y) * (60.0f * cos));
+ this->unk_0380.y = this->actor.focus.pos.y - (Math_SinS(angle) * 60.0f);
+ this->unk_0380.z = this->actor.focus.pos.z - (Math_CosS(this->actor.shape.rot.y) * (60.0f * cos));
+ }
+ }
+}
void func_80B0C398(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C398.s")
@@ -996,7 +1030,7 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, D_80B0EA88);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
- BossHakugin_OverrideLimbDraw, func_80B0C1BC, &this->actor);
+ BossHakugin_OverrideLimbDraw, BossHakugin_PostLimbDraw, &this->actor);
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 47051e5c0..ce1cf637d 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -66,9 +66,7 @@ typedef struct BossHakugin {
/* 0x01E4 */ f32 unk_01E4;
/* 0x01E8 */ Vec3s jointTable[GOHT_LIMB_MAX];
/* 0x02AE */ Vec3s morphTable[GOHT_LIMB_MAX];
- /* 0x0374 */ s16 unk_0374;
- /* 0x0376 */ s16 unk_0376;
- /* 0x0378 */ s16 unk_0378;
+ /* 0x0374 */ Vec3s unk_0374;
/* 0x037A */ Vec3s unk_037A;
/* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 98b14a09f..729e8bb1b 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -12971,7 +12971,7 @@
0x80B0B660:("func_80B0B660",),
0x80B0BAE0:("BossHakugin_Update",),
0x80B0C000:("BossHakugin_OverrideLimbDraw",),
- 0x80B0C1BC:("func_80B0C1BC",),
+ 0x80B0C1BC:("BossHakugin_PostLimbDraw",),
0x80B0C398:("func_80B0C398",),
0x80B0C570:("func_80B0C570",),
0x80B0C7B0:("func_80B0C7B0",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index 4b224cf3f..d0aa85def 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -13496,13 +13496,7 @@
0x80B0EA60:("D_80B0EA60","UNK_TYPE1","",0x1),
0x80B0EA80:("D_80B0EA80","UNK_TYPE1","",0x1),
0x80B0EA88:("D_80B0EA88","UNK_TYPE4","",0x4),
- 0x80B0EA8C:("D_80B0EA8C","UNK_TYPE1","",0x1),
- 0x80B0EA94:("D_80B0EA94","UNK_TYPE1","",0x1),
- 0x80B0EA95:("D_80B0EA95","UNK_TYPE1","",0x1),
- 0x80B0EA9A:("D_80B0EA9A","UNK_TYPE1","",0x1),
- 0x80B0EA9C:("D_80B0EA9C","UNK_TYPE1","",0x1),
- 0x80B0EAA4:("D_80B0EAA4","UNK_TYPE1","",0x1),
- 0x80B0EAA5:("D_80B0EAA5","UNK_TYPE1","",0x1),
+ 0x80B0EA8C:("D_80B0EA8C","s8","[]", 0x20),
0x80B0EAAC:("D_80B0EAAC","UNK_TYPE1","",0x1),
0x80B0EAB0:("D_80B0EAB0","UNK_TYPE1","",0x1),
0x80B0EAC4:("D_80B0EAC4","UNK_TYPE1","",0x1),
From c437c6396e78d8914dabe19e73ccfb60959c51eb Mon Sep 17 00:00:00 2001
From: engineer124 <47598039+engineer124@users.noreply.github.com>
Date: Wed, 27 Sep 2023 07:24:12 +1000
Subject: [PATCH 28/51] Animation Cleanup: En_G* (#1395)
* wip
* more cleanup
* more cleanup
* one more thing
* one more default case
* missed brackets
* PR Review
---
src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 65 +++--
src/overlays/actors/ovl_En_Gb2/z_en_gb2.h | 5 +-
src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 11 +-
src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 41 +--
src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 6 +-
src/overlays/actors/ovl_En_Geg/z_en_geg.c | 151 ++++++----
src/overlays/actors/ovl_En_Geg/z_en_geg.h | 7 +-
src/overlays/actors/ovl_En_Gg/z_en_gg.c | 192 ++++++++-----
src/overlays/actors/ovl_En_Gg/z_en_gg.h | 11 +-
src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 110 ++++---
src/overlays/actors/ovl_En_Gg2/z_en_gg2.h | 7 +-
src/overlays/actors/ovl_En_Giant/z_en_giant.c | 147 +++++-----
.../actors/ovl_En_Ginko_Man/z_en_ginko_man.c | 26 +-
.../actors/ovl_En_Ginko_Man/z_en_ginko_man.h | 5 +-
src/overlays/actors/ovl_En_Gk/z_en_gk.c | 271 +++++++++++-------
src/overlays/actors/ovl_En_Gk/z_en_gk.h | 9 +-
src/overlays/actors/ovl_En_Gm/z_en_gm.c | 211 ++++++++------
src/overlays/actors/ovl_En_Gm/z_en_gm.h | 9 +-
src/overlays/actors/ovl_En_Go/z_en_go.c | 86 +++---
src/overlays/actors/ovl_En_Go/z_en_go.h | 4 +-
.../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 8 +-
.../ovl_En_Grasshopper/z_en_grasshopper.c | 24 +-
.../ovl_En_Grasshopper/z_en_grasshopper.h | 2 +-
src/overlays/actors/ovl_En_Gs/z_en_gs.c | 41 ++-
.../ovl_En_Guard_Nuts/z_en_guard_nuts.c | 69 +++--
.../ovl_En_Guard_Nuts/z_en_guard_nuts.h | 2 +-
.../actors/ovl_En_Guruguru/z_en_guruguru.c | 35 ++-
.../actors/ovl_En_Guruguru/z_en_guruguru.h | 7 +-
src/overlays/actors/ovl_En_Jg/z_en_jg.c | 29 +-
src/overlays/actors/ovl_En_Jg/z_en_jg.h | 2 +-
src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 6 +-
src/overlays/actors/ovl_En_Mnk/z_en_mnk.c | 18 +-
.../actors/ovl_En_Railgibud/z_en_railgibud.c | 21 +-
.../actors/ovl_En_Railgibud/z_en_railgibud.h | 2 +-
tools/disasm/functions.txt | 10 +-
tools/disasm/variables.txt | 2 +-
36 files changed, 976 insertions(+), 676 deletions(-)
diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c
index 9b96771be..36e18e350 100644
--- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c
+++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c
@@ -5,7 +5,6 @@
*/
#include "z_en_gb2.h"
-#include "objects/object_ps/object_ps.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -163,7 +162,7 @@ u16 func_80B0F7FC(EnGb2* this) {
return 0x14E4;
}
- if (gSaveContext.save.saveInfo.playerData.health > 48) {
+ if (gSaveContext.save.saveInfo.playerData.health > 0x30) {
return 0x14D2;
}
@@ -171,7 +170,7 @@ u16 func_80B0F7FC(EnGb2* this) {
return 0x14D3;
case 0x14E4:
- if (gSaveContext.save.saveInfo.playerData.health > 48) {
+ if (gSaveContext.save.saveInfo.playerData.health > 0x30) {
return 0x14D2;
}
@@ -193,8 +192,10 @@ u16 func_80B0F7FC(EnGb2* this) {
case 0x14D9:
return 0x14DA;
+
+ default:
+ return 0;
}
- return 0;
}
u16 func_80B0F8F8(EnGb2* this) {
@@ -213,8 +214,10 @@ u16 func_80B0F8F8(EnGb2* this) {
case 0x14E1:
return 0x14E2;
+
+ default:
+ return 0;
}
- return 0;
}
u16 func_80B0F97C(EnGb2* this) {
@@ -236,8 +239,10 @@ u16 func_80B0F97C(EnGb2* this) {
case 0x14FA:
this->unk_26C |= 2;
return 0x14FB;
+
+ default:
+ return 0;
}
- return 0;
}
void func_80B0FA04(EnGb2* this) {
@@ -262,17 +267,19 @@ s32 func_80B0FA48(EnGb2* this, PlayState* play) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_40)) {
this->unk_26E = 0x14EB;
return false;
+ } else {
+ this->unk_26E = 0x14EE;
+ return true;
}
- this->unk_26E = 0x14EE;
- return true;
- }
- if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) {
- this->unk_26E = 0x14EF;
- return false;
- } else {
- this->unk_26E = 0x14F4;
- return true;
+ default:
+ if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) {
+ this->unk_26E = 0x14EF;
+ return false;
+ } else {
+ this->unk_26E = 0x14F4;
+ return true;
+ }
}
}
@@ -314,12 +321,14 @@ u16 func_80B0FB24(EnGb2* this) {
case 0x14F2:
this->unk_26C |= 2;
return 0x14F3;
+
+ default:
+ return 0;
}
- return 0;
}
void func_80B0FBF0(EnGb2* this, PlayState* play) {
- Vec3f sp90[4] = {
+ Vec3f sp90[] = {
{ 120.0f, 0.0f, 800.0f },
{ -120.0f, 0.0f, 750.0f },
{ 60.0f, 0.0f, 750.0f },
@@ -425,6 +434,9 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
+
+ default:
+ break;
}
} else if (this->unk_26E == 0x14DA) {
switch (play->msgCtx.choiceIndex) {
@@ -443,6 +455,9 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
+
+ default:
+ break;
}
}
}
@@ -505,7 +520,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
}
- if (gSaveContext.save.saveInfo.playerData.health < 49) {
+ if (gSaveContext.save.saveInfo.playerData.health <= 0x30) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
SET_EVENTINF(EVENTINF_46);
SET_EVENTINF(EVENTINF_45);
@@ -596,6 +611,9 @@ void func_80B10634(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
+
+ default:
+ break;
}
}
}
@@ -673,6 +691,9 @@ void func_80B10A48(EnGb2* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->actionFunc = func_80B111AC;
break;
+
+ default:
+ break;
}
}
}
@@ -877,7 +898,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) {
this->actor.room = -1;
Actor_ProcessInitChain(&this->actor, sInitChain);
SkelAnime_InitFlex(play, &this->skelAnime, &object_ps_Skel_007230, &object_ps_Anim_00049C, this->jointTable,
- this->morphTable, 12);
+ this->morphTable, OBJECT_PS_LIMB_MAX);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit);
@@ -981,11 +1002,11 @@ s32 EnGb2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
Gfx** gfx) {
EnGb2* this = THIS;
- if (limbIndex == 7) {
+ if (limbIndex == OBJECT_PS_LIMB_07) {
Matrix_RotateYS(this->unk_270.y, MTXMODE_APPLY);
}
- if (limbIndex == 1) {
+ if (limbIndex == OBJECT_PS_LIMB_01) {
*dList = NULL;
}
@@ -996,7 +1017,7 @@ void EnGb2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnGb2* this = THIS;
Vec3f sp18 = { 2400.0f, 0.0f, 0.0f };
- if (limbIndex == 7) {
+ if (limbIndex == OBJECT_PS_LIMB_07) {
Matrix_MultVec3f(&sp18, &this->actor.focus.pos);
}
}
diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h
index a257ab3d4..fa500f15c 100644
--- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h
+++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h
@@ -2,6 +2,7 @@
#define Z_EN_GB2_H
#include "global.h"
+#include "objects/object_ps/object_ps.h"
struct EnGb2;
@@ -19,8 +20,8 @@ typedef enum {
typedef struct EnGb2 {
/* 0x0000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s jointTable[12];
- /* 0x1D0 */ Vec3s morphTable[12];
+ /* 0x188 */ Vec3s jointTable[OBJECT_PS_LIMB_MAX];
+ /* 0x1D0 */ Vec3s morphTable[OBJECT_PS_LIMB_MAX];
/* 0x218 */ EnGb2ActionFunc actionFunc;
/* 0x21C */ ColliderCylinder collider;
/* 0x268 */ Actor* unk_268;
diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
index 25556fdf7..c83305a8c 100644
--- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
+++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
@@ -69,10 +69,11 @@ typedef enum {
/* 6 */ GERUDO_WHITE_ANIM_EXCITED_CLAPPING,
/* 7 */ GERUDO_WHITE_ANIM_SALUTE,
/* 8 */ GERUDO_WHITE_ANIM_LEADING_BOAT,
- /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY
+ /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY,
+ /* 10 */ GERUDO_WHITE_ANIM_MAX
} GerudoWhiteAnimation;
-void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames);
+void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames);
void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play);
void EnGe1_Wait(EnGe1* this, PlayState* play);
void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play);
@@ -127,8 +128,8 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
-void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) {
- static AnimationHeader* sAnimations[] = {
+void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames) {
+ static AnimationHeader* sAnimations[GERUDO_WHITE_ANIM_MAX] = {
&gGerudoWhiteArmsFoldedAnim, // GERUDO_WHITE_ANIM_ARMS_FOLDED,
&gGerudoWhiteUnfoldingArmsAnim, // GERUDO_WHITE_ANIM_UNFOLDING_ARMS
&gGerudoWhiteStandingHeadBowedAnim, // GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED,
@@ -154,7 +155,7 @@ void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) {
default:
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
+ Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
break;
}
diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
index eeacf00a5..45d304aaf 100644
--- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
+++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
@@ -119,7 +119,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) {
switch (GERUDO_PURPLE_GET_TYPE(&this->picto.actor)) {
case GERUDO_PURPLE_TYPE_BOAT_SENTRY:
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, 0.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, 0.0f);
this->actionFunc = EnGe2_GuardStationary;
this->picto.actor.speed = 0.0f;
this->picto.actor.uncullZoneForward = 4000.0f;
@@ -343,18 +343,18 @@ s32 EnGe2_FollowPathWithoutGravity(EnGe2* this) {
/* Action and helper functions */
void EnGe2_SpawnEffects(EnGe2* this, PlayState* play) {
- static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f };
- static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f };
- static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 };
- static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 };
+ static Vec3f sEffectVelocity = { 0.0f, -0.05f, 0.0f };
+ static Vec3f sEffectAccel = { 0.0f, -0.025f, 0.0f };
+ static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 0 };
+ static Color_RGBA8 sEffectEnvColor = { 255, 150, 0, 0 };
s16 effectAngle = play->state.frames * 0x2800;
Vec3f effectPos;
effectPos.x = (Math_CosS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.x;
effectPos.y = this->picto.actor.focus.pos.y + 10.0f;
effectPos.z = (Math_SinS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.z;
- EffectSsKirakira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor,
- 1000, 16);
+ EffectSsKirakira_SpawnDispersed(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
+ &sEffectEnvColor, 1000, 16);
}
void EnGe2_Scream(EnGe2* this) {
@@ -396,7 +396,7 @@ void EnGe2_SetupCapturePlayer(EnGe2* this) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_CapturePlayer;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
}
void EnGe2_Charge(EnGe2* this, PlayState* play) {
@@ -429,7 +429,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) {
if (this->picto.actor.shape.rot.y == this->picto.actor.yawTowardsPlayer) {
Animation_Change(&this->skelAnime, &gGerudoPurpleChargingAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleChargingAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleChargingAnim), ANIMMODE_LOOP, -8.0f);
this->timer = 50;
this->picto.actor.speed = 4.0f;
this->actionFunc = EnGe2_Charge;
@@ -438,7 +438,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) {
void EnGe2_SetupLookAround(EnGe2* this) {
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
this->timer = 60;
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_LookAround;
@@ -483,13 +483,13 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_SetupCharge;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
this->stateFlags |= GERUDO_PURPLE_STATE_CAPTURING;
} else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_80_08)) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_TurnToPlayerFast;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
} else if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos,
this->picto.actor.shape.rot.y, 0x1800, visionRange, this->verticalDetectRange)) {
if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) {
@@ -499,7 +499,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
Message_StartTextbox(play, 0x1194, &this->picto.actor);
this->actionFunc = EnGe2_SetupCharge;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
}
} else if (this->collider.base.acFlags & AC_HIT) {
if ((this->collider.info.acHitInfo != NULL) &&
@@ -510,7 +510,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
this->stateFlags |= GERUDO_PURPLE_STATE_STUNNED;
} else {
Animation_Change(&this->skelAnime, &gGerudoPurpleFallingToGroundAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), 2, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), ANIMMODE_ONCE, -8.0f);
this->timer = 200;
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_KnockedOut;
@@ -543,7 +543,7 @@ void EnGe2_LookAround(EnGe2* this, PlayState* play) {
} else {
this->actionFunc = EnGe2_Walk;
Animation_Change(&this->skelAnime, &gGerudoPurpleWalkingAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), ANIMMODE_LOOP, -8.0f);
this->headRot.y = 0;
this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED;
}
@@ -602,13 +602,14 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) {
switch (cueId) {
case ENGE2_CUEID_BEEHIVE_PATROL:
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
+ Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
EnGe2_GetNextPath(this, play);
break;
case ENGE2_CUEID_BEEHIVE_RUN_AWAY:
Animation_Change(&this->skelAnime, &gGerudoPurpleRunningAwayCutsceneAnim, 1.0f, 0.0f,
- Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), 0, -5.0f);
+ Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), ANIMMODE_LOOP,
+ -5.0f);
this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f);
break;
@@ -617,11 +618,13 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) {
break;
case ENGE2_CUEID_GBT_ENTR_STAND_STILL:
- Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f);
+ Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f,
+ ANIMMODE_ONCE, 0.0f);
break;
case ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY:
- Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, 2, 0.0f);
+ Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f,
+ ANIMMODE_ONCE, 0.0f);
EnGe2_SetupBlownAwayPath(this, play);
this->stateFlags |= GERUDO_PURPLE_STATE_DISABLE_MOVEMENT;
this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f);
diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c
index e55d0746e..21f207e7c 100644
--- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c
+++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c
@@ -15,7 +15,7 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play);
void EnGe3_Update(Actor* thisx, PlayState* play);
void EnGe3_Draw(Actor* thisx, PlayState* play);
-void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames);
+void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames);
void EnGe3_SetupPath(EnGe3* this, PlayState* play);
void EnGe3_Idle(EnGe3* this, PlayState* play);
void EnGe3_AveilsChamberIdle(EnGe3* this, PlayState* play);
@@ -111,7 +111,7 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
-void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames) {
+void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames) {
static AnimationHeader* sAnimations[GERUDO_AVEIL_ANIM_MAX] = {
&gGerudoRedStandAnim, // GERUDO_AVEIL_ANIM_STAND
&gGerudoRedWalkAnim, // GERUDO_AVEIL_ANIM_WALK
@@ -125,7 +125,7 @@ void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames) {
};
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
+ Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
this->animIndex = animIndex;
}
diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c
index a01bfbd19..9183856ab 100644
--- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c
+++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c
@@ -7,7 +7,6 @@
#include "z_en_geg.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
-#include "objects/object_oF1d_map/object_oF1d_map.h"
#include "objects/object_taisou/object_taisou.h"
#include "objects/object_hakugin_demo/object_hakugin_demo.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -126,68 +125,112 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-static AnimationInfoS sAnimationInfo[] = {
- { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+typedef enum {
+ /* -1 */ ENGEG_ANIM_NONE = -1,
+ /* 0x00 */ ENGEG_ANIM_0,
+ /* 0x01 */ ENGEG_ANIM_1,
+ /* 0x02 */ ENGEG_ANIM_2,
+ /* 0x03 */ ENGEG_ANIM_3,
+ /* 0x04 */ ENGEG_ANIM_4,
+ /* 0x05 */ ENGEG_ANIM_5,
+ /* 0x06 */ ENGEG_ANIM_6,
+ /* 0x07 */ ENGEG_ANIM_7,
+ /* 0x08 */ ENGEG_ANIM_8,
+ /* 0x09 */ ENGEG_ANIM_9,
+ /* 0x0A */ ENGEG_ANIM_10,
+ /* 0x0B */ ENGEG_ANIM_11,
+ /* 0x0C */ ENGEG_ANIM_12,
+ /* 0x0D */ ENGEG_ANIM_13,
+ /* 0x0E */ ENGEG_ANIM_14,
+ /* 0x0F */ ENGEG_ANIM_15,
+ /* 0x10 */ ENGEG_ANIM_16,
+ /* 0x11 */ ENGEG_ANIM_17,
+ /* 0x12 */ ENGEG_ANIM_18,
+ /* 0x13 */ ENGEG_ANIM_19,
+ /* 0x14 */ ENGEG_ANIM_20,
+ /* 0x15 */ ENGEG_ANIM_MAX
+} EnGegAnimation;
+
+static AnimationInfoS sAnimationInfo[ENGEG_ANIM_MAX] = {
+ { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_0
+ { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_1
+ { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_2
+ { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_3
+ { &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_4
+ { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_5
+ { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_6
+ { &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_7
+ { &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_8
+ { &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_9
+ { &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_10
+ { &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_11
+ { &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_12
+ { &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_13
+ { &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_14
+ { &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_15
+ { &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_16
+ { &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_17
+ { &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_18
+ { &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_19
+ { &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_20
};
u16 func_80BB16D0(EnGeg* this) {
switch (this->unk_496) {
case 0xD5E:
return 0xD5F;
+
case 0xD5F:
return 0xD60;
+
case 0xD60:
return 0xD61;
+
case 0xD62:
return 0xD63;
+
case 0xD64:
return 0xD65;
+
case 0xD66:
return 0xD67;
+
case 0xD67:
return 0xD68;
+
case 0xD68:
return 0xD69;
+
case 0xD6A:
return 0xD6B;
+
case 0xD6B:
return 0xD6C;
+
case 0xD6C:
return 0xD6D;
+
case 0xD6E:
return 0xD6F;
+
case 0xD70:
return 0xD71;
+
case 0xD71:
return 0xD72;
+
case 0xD73:
return 0xD74;
+
case 0xD74:
return 0xD75;
+
case 0xD89:
return 0xD8A;
+
+ default:
+ return 0;
}
- return 0;
}
void func_80BB178C(EnGeg* this, PlayState* play) {
@@ -372,14 +415,14 @@ s32 func_80BB1D64(EnGeg* this, PlayState* play) {
return true;
}
-void func_80BB1FCC(EnGeg* this, PlayState* play) {
+void EnGeg_UpdateSkelAnime(EnGeg* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment);
SkelAnime_Update(&this->skelAnime);
}
-void func_80BB2020(EnGeg* this, PlayState* play) {
+void EnGeg_ChangeAnim(EnGeg* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment);
- SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_4AC);
+ SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
s32 func_80BB2088(EnGeg* this, PlayState* play) {
@@ -393,7 +436,7 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) {
}
if (Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7FF8) &&
- ((this->unk_4AC == 5) || ((this->unk_4AC == 13) && (this->unk_496 == 0xD69)))) {
+ ((this->animIndex == ENGEG_ANIM_5) || ((this->animIndex == ENGEG_ANIM_13) && (this->unk_496 == 0xD69)))) {
this->unk_230 |= 2;
func_80BB1D64(this, play);
} else {
@@ -412,8 +455,8 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) {
void func_80BB217C(EnGeg* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->unk_248)) {
- this->unk_4AC = 5;
- func_80BB2020(this, play);
+ this->animIndex = ENGEG_ANIM_5;
+ EnGeg_ChangeAnim(this, play);
Actor_SetScale(&this->actor, 0.01f);
this->unk_230 = 0;
this->actor.shape.shadowScale = 20.0f;
@@ -509,8 +552,8 @@ void func_80BB2520(EnGeg* this, PlayState* play) {
case 0xD66:
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP);
if (this->unk_248 >= 0) {
- this->unk_4AC = 19;
- func_80BB2020(this, play);
+ this->animIndex = ENGEG_ANIM_19;
+ EnGeg_ChangeAnim(this, play);
}
this->unk_230 |= 0x20;
this->actionFunc = func_80BB2944;
@@ -527,11 +570,14 @@ void func_80BB2520(EnGeg* this, PlayState* play) {
case 0xD8B:
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP);
if (this->unk_248 >= 0) {
- this->unk_4AC = 4;
- func_80BB2020(this, play);
+ this->animIndex = ENGEG_ANIM_4;
+ EnGeg_ChangeAnim(this, play);
}
this->actionFunc = func_80BB2E00;
break;
+
+ default:
+ break;
}
} else {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
@@ -557,6 +603,9 @@ void func_80BB26EC(EnGeg* this, PlayState* play) {
this->unk_230 &= ~0x10;
this->actionFunc = func_80BB221C;
return;
+
+ default:
+ break;
}
this->unk_496 = func_80BB16D0(this);
@@ -609,12 +658,12 @@ void func_80BB27D4(EnGeg* this, PlayState* play) {
void func_80BB2944(EnGeg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s16 curFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation);
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (this->unk_4AC == 19) {
- if (curFrame == lastFrame) {
- this->unk_4AC = 6;
- func_80BB2020(this, play);
+ if (this->animIndex == ENGEG_ANIM_19) {
+ if (curFrame == endFrame) {
+ this->animIndex = ENGEG_ANIM_6;
+ EnGeg_ChangeAnim(this, play);
}
} else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
if (this->unk_496 == 0xD67) {
@@ -666,8 +715,8 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) {
Message_ContinueTextbox(play, this->unk_496);
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU);
if (this->unk_248 >= 0) {
- this->unk_4AC = 13;
- func_80BB2020(this, play);
+ this->animIndex = ENGEG_ANIM_13;
+ EnGeg_ChangeAnim(this, play);
}
this->actionFunc = func_80BB27D4;
} else {
@@ -704,21 +753,21 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) {
}
void func_80BB2E00(EnGeg* this, PlayState* play) {
- s16 sp2E = this->skelAnime.curFrame;
- s16 sp2C = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (this->unk_4AC == 2) {
+ if (this->animIndex == ENGEG_ANIM_2) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (sp2E == sp2C) {
+ if (curFrame == endFrame) {
CutsceneManager_Stop(this->csId);
- this->unk_4AC = 20;
- func_80BB2020(this, play);
+ this->animIndex = ENGEG_ANIM_20;
+ EnGeg_ChangeAnim(this, play);
this->actionFunc = func_80BB30B4;
} else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_STAND_IMT);
}
- } else if (this->unk_4AC == 4) {
+ } else if (this->animIndex == ENGEG_ANIM_4) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
this->unk_230 |= 1;
this->actor.shape.yOffset = 14.0f;
@@ -740,11 +789,11 @@ void func_80BB2F7C(EnGeg* this, PlayState* play) {
if ((this->actor.xzDistToPlayer < 150.0f) && (fabsf(this->actor.playerHeightRel) < 10.0f) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
- this->unk_4AC = 2;
+ this->animIndex = ENGEG_ANIM_2;
this->actor.speed = 0.0f;
this->unk_230 &= ~1;
this->actor.shape.yOffset = 0.0f;
- func_80BB2020(this, play);
+ EnGeg_ChangeAnim(this, play);
this->actionFunc = func_80BB2E00;
} else {
this->actor.speed = 5.0f;
@@ -902,7 +951,7 @@ void EnGeg_Update(Actor* thisx, PlayState* play) {
EnGeg* this = THIS;
this->actionFunc(this, play);
- func_80BB1FCC(this, play);
+ EnGeg_UpdateSkelAnime(this, play);
func_80BB2088(this, play);
func_80BB1C8C(this);
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGEG_FIDGET_TABLE_LEN);
diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.h b/src/overlays/actors/ovl_En_Geg/z_en_geg.h
index 522312fc2..980ada9fd 100644
--- a/src/overlays/actors/ovl_En_Geg/z_en_geg.h
+++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.h
@@ -2,6 +2,7 @@
#define Z_EN_GEG_H
#include "global.h"
+#include "objects/object_oF1d_map/object_oF1d_map.h"
struct EnGeg;
@@ -23,8 +24,8 @@ typedef struct EnGeg {
/* 0x242 */ s16 unk_242;
/* 0x244 */ s16 unk_244;
/* 0x248 */ s32 unk_248;
- /* 0x24C */ Vec3s jointTable[18];
- /* 0x2B8 */ Vec3s morphTable[18];
+ /* 0x24C */ Vec3s jointTable[GORON_LIMB_MAX];
+ /* 0x2B8 */ Vec3s morphTable[GORON_LIMB_MAX];
/* 0x324 */ UNK_TYPE1 unk324[0x144];
/* 0x468 */ s16 unk_468;
/* 0x46A */ s16 unk_46A;
@@ -38,7 +39,7 @@ typedef struct EnGeg {
/* 0x498 */ s16 csId;
/* 0x49A */ s16 nextCsId;
/* 0x49C */ s16 csIdList[8];
- /* 0x4AC */ s32 unk_4AC;
+ /* 0x4AC */ s32 animIndex;
/* 0x4B0 */ s16 unk_4B0;
/* 0x4B4 */ Vec3f unk_4B4;
/* 0x4C0 */ Vec3f unk_4C0[2];
diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c
index ab1f8b539..1d59139a4 100644
--- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c
+++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c
@@ -6,7 +6,6 @@
#include "z_en_gg.h"
#include "objects/gameplay_keep/gameplay_keep.h"
-#include "objects/object_gg/object_gg.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS)
@@ -95,15 +94,44 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
-static AnimationInfo sAnimationInfo[] = {
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f },
- { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f },
- { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f },
+typedef enum {
+ /* -1 */ ENGG_ANIM_NONE = -1,
+ /* 0x00 */ ENGG_ANIM_0,
+ /* 0x01 */ ENGG_ANIM_1,
+ /* 0x02 */ ENGG_ANIM_2,
+ /* 0x03 */ ENGG_ANIM_3,
+ /* 0x04 */ ENGG_ANIM_4,
+ /* 0x05 */ ENGG_ANIM_5,
+ /* 0x06 */ ENGG_ANIM_6,
+ /* 0x07 */ ENGG_ANIM_7,
+ /* 0x08 */ ENGG_ANIM_8,
+ /* 0x09 */ ENGG_ANIM_9,
+ /* 0x0A */ ENGG_ANIM_10,
+ /* 0x0B */ ENGG_ANIM_11,
+ /* 0x0C */ ENGG_ANIM_12,
+ /* 0x0D */ ENGG_ANIM_13,
+ /* 0x0E */ ENGG_ANIM_14,
+ /* 0x0F */ ENGG_ANIM_15,
+ /* 0x10 */ ENGG_ANIM_MAX
+} EnGgAnimation;
+
+static AnimationInfo sAnimationInfo[ENGG_ANIM_MAX] = {
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_0
+ { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_1
+ { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_2
+ { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_3
+ { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_4
+ { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_5
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_6
+ { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_7
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_8
+ { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_9
+ { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_10
+ { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_11
+ { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_12
+ { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_13
+ { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_14
+ { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_15
};
void func_80B34F70(EnGg* this) {
@@ -149,7 +177,7 @@ void func_80B35108(EnGg* this, PlayState* play) {
}
void func_80B351A4(EnGg* this) {
- if ((this->unk_2E6 == 2) || (this->unk_2E6 == 3)) {
+ if ((this->animIndex == ENGG_ANIM_2) || (this->animIndex == ENGG_ANIM_3)) {
this->unk_2E2 = 3;
} else {
s16 temp = this->unk_2E4 - 1;
@@ -170,57 +198,57 @@ void func_80B351A4(EnGg* this) {
void func_80B35250(EnGg* this) {
this->unk_2E4 = 20;
this->unk_2E2 = 0;
- this->unk_2E6 = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ this->animIndex = ENGG_ANIM_0;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
this->actionFunc = func_80B35450;
}
void func_80B352A4(EnGg* this, PlayState* play) {
- s16 sp26 = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E6].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (sp26 == lastFrame) {
+ if (curFrame == endFrame) {
switch (this->actor.textId) {
case 0xCE5:
- this->unk_2E6 = 1;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ this->animIndex = ENGG_ANIM_1;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_1);
break;
case 0xCE6:
case 0xCEC:
- this->unk_2E6 = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ this->animIndex = ENGG_ANIM_0;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
break;
case 0xCE8:
- this->unk_2E6 = 2;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ this->animIndex = ENGG_ANIM_2;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_2);
break;
case 0xCE9:
- this->unk_2E6 = 3;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ this->animIndex = ENGG_ANIM_3;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_3);
break;
case 0xCED:
case 0xCEE:
- this->unk_2E6 = 4;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
+ this->animIndex = ENGG_ANIM_4;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4);
break;
default:
- this->unk_2E6 = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ this->animIndex = ENGG_ANIM_0;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
break;
}
SET_WEEKEVENTREG(WEEKEVENTREG_19_80);
this->actionFunc = func_80B3556C;
- } else if ((this->unk_2E6 == 0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) {
- if (sp26 < (lastFrame - 1)) {
+ } else if ((this->animIndex == ENGG_ANIM_0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) {
+ if (curFrame < (endFrame - 1)) {
this->skelAnime.playSpeed = 2.0f;
} else {
- this->unk_2E6 = 4;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
+ this->animIndex = ENGG_ANIM_4;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4);
}
}
}
@@ -249,7 +277,7 @@ void func_80B35450(EnGg* this, PlayState* play) {
void func_80B3556C(EnGg* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
- if (this->unk_2E6 == 4) {
+ if (this->animIndex == ENGG_ANIM_4) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
this->unk_308 = 0;
@@ -275,47 +303,43 @@ void func_80B35634(EnGg* this, PlayState* play) {
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
- this->unk_2DA = 0;
- this->unk_2E6 = 0;
+ this->csAnimIndex = ENGG_ANIM_0;
+ this->animIndex = ENGG_ANIM_0;
break;
case 2:
- this->unk_2DA = 9;
- this->unk_2E6 = 9;
+ this->csAnimIndex = ENGG_ANIM_9;
+ this->animIndex = ENGG_ANIM_9;
break;
case 3:
- this->unk_2DA = 10;
- this->unk_2E6 = 10;
+ this->csAnimIndex = ENGG_ANIM_10;
+ this->animIndex = ENGG_ANIM_10;
break;
case 4:
- do {
- this->unk_344.unk_30 = this->unk_2DA = 11;
- } while (0);
- this->unk_2E6 = 11;
+ this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_11;
+ this->animIndex = ENGG_ANIM_11;
func_80B364D4(&this->unk_344, play);
break;
case 5:
- do {
- this->unk_344.unk_30 = this->unk_2DA = 12;
- } while (0);
- this->unk_2E6 = 12;
+ this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_12;
+ //! FAKE:
+ if (1) {}
+ this->animIndex = ENGG_ANIM_12;
break;
case 6:
- do {
- this->unk_344.unk_30 = this->unk_2DA = 13;
- } while (0);
- this->unk_2E6 = 13;
+ this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_13;
+ //! FAKE:
+ if (1) {}
+ this->animIndex = ENGG_ANIM_13;
break;
case 7:
- do {
- this->unk_344.unk_30 = this->unk_2DA = 14;
- } while (0);
- this->unk_2E6 = 14;
+ this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_14;
+ this->animIndex = ENGG_ANIM_14;
func_80B364D4(&this->unk_344, play);
break;
@@ -324,13 +348,13 @@ void func_80B35634(EnGg* this, PlayState* play) {
return;
default:
- this->unk_2DA = 0;
+ this->csAnimIndex = ENGG_ANIM_0;
break;
}
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2DA);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
- if (this->unk_2DA == 14) {
+ if (this->csAnimIndex == ENGG_ANIM_14) {
func_80B358D8(this, play);
}
@@ -345,16 +369,22 @@ u16 func_80B357F0(EnGg* this) {
switch (this->actor.textId) {
case 0xCE5:
return 0xCE6;
+
case 0xCE6:
return 0xCE8;
+
case 0xCE8:
return 0xCE9;
+
case 0xCE9:
return 0xCEC;
+
case 0xCEC:
return 0xCED;
+
+ default:
+ return 0;
}
- return 0;
}
void func_80B3584C(EnGg* this) {
@@ -366,12 +396,12 @@ void func_80B3584C(EnGg* this) {
}
void func_80B358D8(EnGg* this, PlayState* play) {
- s16 sp1E = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2DA].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation);
- if ((this->unk_2E6 == 14) && (sp1E == lastFrame)) {
- this->unk_2E6 = 15;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 15);
+ if ((this->animIndex == ENGG_ANIM_14) && (curFrame == endFrame)) {
+ this->animIndex = ENGG_ANIM_15;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_15);
}
}
@@ -379,8 +409,8 @@ void func_80B35968(EnGg* this, PlayState* play) {
if (this->unk_344.unk_34 != NULL) {
this->unk_344.unk_34(&this->unk_344, play);
} else {
- if ((this->unk_2DA == 11) || (this->unk_2DA == 14)) {
- this->unk_344.unk_30 = this->unk_2DA;
+ if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_14)) {
+ this->unk_344.animIndex = this->csAnimIndex;
}
func_80B363E8(&this->unk_344, play, &this->unk_320, &this->unk_32C, &this->unk_338);
}
@@ -433,7 +463,7 @@ void func_80B35B24(EnGgStruct* ptr, PlayState* play) {
}
void func_80B35B44(EnGgStruct* ptr, PlayState* play) {
- if (ptr->unk_30 == 0xE) {
+ if (ptr->animIndex == ENGG_ANIM_14) {
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
ptr->unk_48 = 1;
@@ -455,13 +485,13 @@ void func_80B35B44(EnGgStruct* ptr, PlayState* play) {
ptr->unk_44 = 0x37;
}
}
- } else if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12)) {
+ } else if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12)) {
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
ptr->unk_48 = 1;
ptr->unk_40 = 0;
}
- } else if (ptr->unk_30 == 0xD) {
+ } else if (ptr->animIndex == ENGG_ANIM_13) {
ptr->unk_48 = 0;
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
@@ -496,7 +526,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) {
sp74 = ptr->unk_40 % temp;
ptr->unk_40 = sp74;
phi_s7 = 0x46;
- } else if (ptr->unk_30 == 0xD) {
+ } else if (ptr->animIndex == ENGG_ANIM_13) {
sp74 = ptr->unk_40;
phi_s7 = 0x46;
} else {
@@ -519,6 +549,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) {
temp_f26 = ptr->unk_00.z + (ptr->unk_18.z * temp_f20) + (0.5f * ptr->unk_24.z * temp_f20 * temp_f20);
temp_f20 = Rand_ZeroOne() * 0.003f;
+ //! FAKE:
if (1) {}
Matrix_Translate(temp_f22, temp_f24, temp_f26, MTXMODE_NEW);
@@ -630,9 +661,9 @@ void func_80B363E8(EnGgStruct* ptr, PlayState* play, Vec3f* arg1, Vec3f* arg2, V
ptr->unk_00.x += -4.0f;
ptr->unk_0C.x += 4.0f;
- if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12) || (ptr->unk_30 == 13)) {
+ if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12) || (ptr->animIndex == ENGG_ANIM_13)) {
ptr->unk_38 = func_80B35C84;
- } else if (ptr->unk_30 == 14) {
+ } else if (ptr->animIndex == ENGG_ANIM_14) {
ptr->unk_38 = func_80B3610C;
}
}
@@ -655,7 +686,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable,
- this->morphTable, 20);
+ this->morphTable, OBJECT_GG_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@@ -700,11 +731,13 @@ void EnGg_Update(Actor* thisx, PlayState* play) {
}
if ((play->csCtx.state == CS_STATE_IDLE) &&
- ((this->unk_2DA != 14) && (this->unk_2DA != 11) && (this->unk_2DA != 12) && (this->unk_2DA != 13))) {
+ ((this->csAnimIndex != ENGG_ANIM_14) && (this->csAnimIndex != ENGG_ANIM_11) &&
+ (this->csAnimIndex != ENGG_ANIM_12) && (this->csAnimIndex != ENGG_ANIM_13))) {
func_80B364D4(&this->unk_344, play);
}
- if (((this->unk_2DA == 14) || (this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) &&
+ if (((this->csAnimIndex == ENGG_ANIM_14) || (this->csAnimIndex == ENGG_ANIM_11) ||
+ (this->csAnimIndex == ENGG_ANIM_12) || (this->csAnimIndex == ENGG_ANIM_13)) &&
(this->unk_309 == 1)) {
func_80B35968(this, play);
}
@@ -738,7 +771,7 @@ s32 EnGg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
Gfx** gfx) {
EnGg* this = THIS;
- if (limbIndex == 2) {
+ if (limbIndex == OBJECT_GG_LIMB_02) {
Matrix_RotateZS(this->unk_2E8, MTXMODE_APPLY);
}
return false;
@@ -750,12 +783,13 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp30 = { 0.0f, 0.0f, 0.0f };
Vec3f sp24 = { 0.0f, 0.0f, 0.0f };
- if (this->unk_2DA == 14) {
+ if (this->csAnimIndex == ENGG_ANIM_14) {
sp30.y = 3.0f;
sp30.z = -1.0f;
sp24.y = -0.07f;
this->unk_309 = 1;
- } else if ((this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) {
+ } else if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_12) ||
+ (this->csAnimIndex == ENGG_ANIM_13)) {
sp30.x = 3.0f;
sp24.x = 0.5f;
this->unk_309 = 1;
@@ -763,7 +797,7 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
this->unk_309 = 0;
}
- if (limbIndex == 4) {
+ if (limbIndex == OBJECT_GG_LIMB_04) {
Matrix_MultVec3f(&D_80B36DF0, &this->unk_320);
Matrix_Push();
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.h b/src/overlays/actors/ovl_En_Gg/z_en_gg.h
index 802024897..436d5a4ab 100644
--- a/src/overlays/actors/ovl_En_Gg/z_en_gg.h
+++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.h
@@ -2,6 +2,7 @@
#define Z_EN_GG_H
#include "global.h"
+#include "objects/object_gg/object_gg.h"
struct EnGg;
struct EnGgStruct;
@@ -14,7 +15,7 @@ typedef struct EnGgStruct {
/* 0x0C */ Vec3f unk_0C;
/* 0x18 */ Vec3f unk_18;
/* 0x24 */ Vec3f unk_24;
- /* 0x30 */ u8 unk_30;
+ /* 0x30 */ u8 animIndex;
/* 0x34 */ EnGgUnkFunc unk_34;
/* 0x38 */ EnGgUnkFunc unk_38;
/* 0x3C */ s32 unk_3C;
@@ -30,16 +31,16 @@ typedef struct EnGg {
/* 0x1D4 */ EnGgActionFunc actionFunc;
/* 0x1D8 */ Vec3s unk_1D8;
/* 0x1DE */ Vec3s unk_1DE;
- /* 0x1E4 */ Vec3s jointTable[20];
- /* 0x25C */ Vec3s morphTable[20];
+ /* 0x1E4 */ Vec3s jointTable[OBJECT_GG_LIMB_MAX];
+ /* 0x25C */ Vec3s morphTable[OBJECT_GG_LIMB_MAX];
/* 0x2D4 */ UNK_TYPE1 unk_2D4[0x6];
- /* 0x2DA */ u8 unk_2DA;
+ /* 0x2DA */ u8 csAnimIndex;
/* 0x2DB */ u8 cueId;
/* 0x2DC */ s16 csId;
/* 0x2DE */ UNK_TYPE1 unk2DE[4];
/* 0x2E2 */ s16 unk_2E2;
/* 0x2E4 */ s16 unk_2E4;
- /* 0x2E6 */ s16 unk_2E6;
+ /* 0x2E6 */ s16 animIndex;
/* 0x2E8 */ s16 unk_2E8;
/* 0x2EA */ UNK_TYPE1 unk2EA[0x1A];
/* 0x304 */ s16 unk_304;
diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c
index abb80780d..e106c8f88 100644
--- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c
+++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c
@@ -5,7 +5,6 @@
*/
#include "z_en_gg2.h"
-#include "objects/object_gg/object_gg.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS)
@@ -39,15 +38,44 @@ ActorInit En_Gg2_InitVars = {
(ActorFunc)EnGg2_Draw,
};
-AnimationInfo D_80B3BF00[] = {
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f },
- { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f },
- { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
- { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f },
+typedef enum {
+ /* -1 */ ENGG2_ANIM_NONE = -1,
+ /* 0x00 */ ENGG2_ANIM_0,
+ /* 0x01 */ ENGG2_ANIM_1,
+ /* 0x02 */ ENGG2_ANIM_2,
+ /* 0x03 */ ENGG2_ANIM_3,
+ /* 0x04 */ ENGG2_ANIM_4,
+ /* 0x05 */ ENGG2_ANIM_5,
+ /* 0x06 */ ENGG2_ANIM_6,
+ /* 0x07 */ ENGG2_ANIM_7,
+ /* 0x08 */ ENGG2_ANIM_8,
+ /* 0x09 */ ENGG2_ANIM_9,
+ /* 0x0A */ ENGG2_ANIM_10,
+ /* 0x0B */ ENGG2_ANIM_11,
+ /* 0x0C */ ENGG2_ANIM_12,
+ /* 0x0D */ ENGG2_ANIM_13,
+ /* 0x0E */ ENGG2_ANIM_14,
+ /* 0x0F */ ENGG2_ANIM_15,
+ /* 0x10 */ ENGG2_ANIM_MAX
+} EnGg2Animation;
+
+static AnimationInfo sAnimationInfo[ENGG2_ANIM_MAX] = {
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_0
+ { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_1
+ { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_2
+ { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_3
+ { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_4
+ { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_5
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_6
+ { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_7
+ { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_8
+ { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_9
+ { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_10
+ { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_11
+ { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_12
+ { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_13
+ { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_14
+ { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_15
};
Color_RGBA8 D_80B3C080 = { 255, 255, 255, 255 };
@@ -116,38 +144,38 @@ void func_80B3ADD8(EnGg2* this) {
void func_80B3AE60(EnGg2* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(D_80B3BF00[this->unk_2EE].animation);
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (curFrame == lastFrame) {
- switch (this->unk_2EE) {
- case 0:
- this->unk_2EE = 1;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 1);
+ if (curFrame == endFrame) {
+ switch (this->animIndex) {
+ case ENGG2_ANIM_0:
+ this->animIndex = ENGG2_ANIM_1;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_1);
this->actionFunc = func_80B3B0A0;
break;
- case 1:
- case 8:
- this->unk_2EE = 5;
+ case ENGG2_ANIM_1:
+ case ENGG2_ANIM_8:
+ this->animIndex = ENGG2_ANIM_5;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5);
this->actionFunc = func_80B3B120;
break;
- case 5:
- this->unk_2EE = 6;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
+ case ENGG2_ANIM_5:
+ this->animIndex = ENGG2_ANIM_6;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B21C;
break;
- case 6:
- this->unk_2EE = 7;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5);
+ case ENGG2_ANIM_6:
+ this->animIndex = ENGG2_ANIM_7;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5);
this->actionFunc = func_80B3B294;
break;
default:
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3AFB0;
break;
}
@@ -338,7 +366,7 @@ f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
void func_80B3B8A4(EnGg2* this) {
f32 sp1C;
- if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) {
+ if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) {
this->unk_2F2 += 0x62C;
sp1C = 1100.0f;
} else {
@@ -368,7 +396,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable,
- this->morphTable, 20);
+ this->morphTable, OBJECT_GG_LIMB_MAX);
this->path = SubS_GetPathByIndex(play, ENGG2_GET_PATH_INDEX(&this->actor), ENGG2_PATH_INDEX_NONE);
this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS;
this->unk_2F0 = 0;
@@ -384,15 +412,15 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10);
- this->unk_2EE = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
+ this->animIndex = ENGG2_ANIM_0;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3AFB0;
} else if (play->sceneId == SCENE_17SETUGEN) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04);
- this->unk_2EE = 8;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
+ this->animIndex = ENGG2_ANIM_8;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B05C;
} else {
Actor_Kill(&this->actor);
@@ -401,8 +429,8 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08);
- this->unk_2EE = 8;
- Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
+ this->animIndex = ENGG2_ANIM_8;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B05C;
} else {
Actor_Kill(&this->actor);
@@ -424,7 +452,7 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) {
this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS;
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
- if ((this->unk_2EE == 5) && (this->unk_2EE == 7)) {
+ if ((this->animIndex == ENGG2_ANIM_5) && (this->animIndex == ENGG2_ANIM_7)) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
}
} else {
@@ -441,7 +469,7 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
func_80B3B8A4(this);
Actor_TrackPlayer(play, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos);
- if ((this->unk_2EE == 5) || (this->unk_2EE == 7)) {
+ if ((this->animIndex == ENGG2_ANIM_5) || (this->animIndex == ENGG2_ANIM_7)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG);
if ((play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) && ((play->state.frames % 4) == 0)) {
func_80B3B4B0(this, play);
@@ -454,12 +482,12 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) {
EnGg2* this = THIS;
- if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) {
- if (limbIndex == 1) {
+ if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) {
+ if (limbIndex == OBJECT_GG_LIMB_01) {
Matrix_RotateYS(this->unk_2F6, MTXMODE_APPLY);
}
- if (limbIndex == 2) {
+ if (limbIndex == OBJECT_GG_LIMB_02) {
Matrix_RotateZS(this->unk_2F4, MTXMODE_APPLY);
}
}
@@ -469,7 +497,7 @@ s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
void func_80B3BDC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
EnGg2* this = THIS;
- if (limbIndex == 4) {
+ if (limbIndex == OBJECT_GG_LIMB_04) {
Matrix_MultVec3f(&D_80B3C0A0, &this->unk_304);
}
}
diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h
index 83b4bad42..dd68c20b1 100644
--- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h
+++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h
@@ -2,6 +2,7 @@
#define Z_EN_GG2_H
#include "global.h"
+#include "objects/object_gg/object_gg.h"
struct EnGg2;
@@ -20,14 +21,14 @@ typedef struct EnGg2 {
/* 0x1DC */ s32 unk_1DC;
/* 0x1E0 */ Vec3s unk_1E0;
/* 0x1E6 */ Vec3s unk_1E6;
- /* 0x1EC */ Vec3s jointTable[20];
- /* 0x264 */ Vec3s morphTable[20];
+ /* 0x1EC */ Vec3s jointTable[OBJECT_GG_LIMB_MAX];
+ /* 0x264 */ Vec3s morphTable[OBJECT_GG_LIMB_MAX];
/* 0x2DC */ UNK_TYPE1 unk2DC[0x8];
/* 0x2E4 */ s16 csId;
/* 0x2E6 */ UNK_TYPE1 unk2E6[4];
/* 0x2EA */ s16 unk_2EA;
/* 0x2EC */ s16 unk_2EC;
- /* 0x2EE */ s16 unk_2EE;
+ /* 0x2EE */ s16 animIndex;
/* 0x2F0 */ u8 unk_2F0;
/* 0x2F1 */ u8 unk_2F1;
/* 0x2F2 */ s16 unk_2F2;
diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c
index 8d244c09c..d68e6902f 100644
--- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c
+++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c
@@ -28,10 +28,45 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play);
#define GIANT_TYPE_IS_CLOCK_TOWER_FAILURE(type) \
(type >= GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE && type <= GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE)
+/**
+ * Used as values for cueId. The UNKNOWN ones are never used in-game.
+ */
+typedef enum {
+ /* 0 */ GIANT_CUEID_NONE,
+ /* 1 */ GIANT_CUEID_IDLE,
+ /* 2 */ GIANT_CUEID_WALKING,
+ /* 3 */ GIANT_CUEID_LOOKING_UP,
+ /* 4 */ GIANT_CUEID_RAISING_ARMS,
+ /* 5 */ GIANT_CUEID_STRUGGLING,
+ /* 6 */ GIANT_CUEID_FALLING_OVER,
+ /* 7 */ GIANT_CUEID_IDLE_FADE_IN,
+ /* 8 */ GIANT_CUEID_TALKING,
+ /* 9 */ GIANT_CUEID_DONE_TALKING,
+ /* 10 */ GIANT_CUEID_TEACHING_OATH_TO_ORDER,
+ /* 11 */ GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER,
+ /* 12 */ GIANT_CUEID_UNKNOWN_12,
+ /* 13 */ GIANT_CUEID_UNKNOWN_13,
+ /* 14 */ GIANT_CUEID_UNKNOWN_14,
+ /* 15 */ GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER
+} GiantCueId;
+
+ActorInit En_Giant_InitVars = {
+ ACTOR_EN_GIANT,
+ ACTORCAT_NPC,
+ FLAGS,
+ OBJECT_GIANT,
+ sizeof(EnGiant),
+ (ActorFunc)EnGiant_Init,
+ (ActorFunc)EnGiant_Destroy,
+ (ActorFunc)EnGiant_Update,
+ (ActorFunc)EnGiant_Draw,
+};
+
/**
* These values are used to index into sAnimations to pick the appropriate animation.
*/
typedef enum {
+ /* -1 */ GIANT_ANIM_NONE = -1,
/* 0 */ GIANT_ANIM_LOOK_UP_START,
/* 1 */ GIANT_ANIM_LOOK_UP_LOOP,
/* 2 */ GIANT_ANIM_FALLING_OVER,
@@ -50,49 +85,26 @@ typedef enum {
/* 15 */ GIANT_ANIM_MAX
} GiantAnimation;
-/**
- * Used as values for cueId. The UNKNOWN ones are never used in-game.
- */
-typedef enum {
- /* 0 */ GIANT_CUE_ID_NONE,
- /* 1 */ GIANT_CUE_ID_IDLE,
- /* 2 */ GIANT_CUE_ID_WALKING,
- /* 3 */ GIANT_CUE_ID_LOOKING_UP,
- /* 4 */ GIANT_CUE_ID_RAISING_ARMS,
- /* 5 */ GIANT_CUE_ID_STRUGGLING,
- /* 6 */ GIANT_CUE_ID_FALLING_OVER,
- /* 7 */ GIANT_CUE_ID_IDLE_FADE_IN,
- /* 8 */ GIANT_CUE_ID_TALKING,
- /* 9 */ GIANT_CUE_ID_DONE_TALKING,
- /* 10 */ GIANT_CUE_ID_TEACHING_OATH_TO_ORDER,
- /* 11 */ GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER,
- /* 12 */ GIANT_CUE_ID_UNKNOWN_12,
- /* 13 */ GIANT_CUE_ID_UNKNOWN_13,
- /* 14 */ GIANT_CUE_ID_UNKNOWN_14,
- /* 15 */ GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER
-} GiantCueId;
-
-ActorInit En_Giant_InitVars = {
- ACTOR_EN_GIANT,
- ACTORCAT_NPC,
- FLAGS,
- OBJECT_GIANT,
- sizeof(EnGiant),
- (ActorFunc)EnGiant_Init,
- (ActorFunc)EnGiant_Destroy,
- (ActorFunc)EnGiant_Update,
- (ActorFunc)EnGiant_Draw,
-};
-
-static AnimationHeader* sAnimations[] = {
- &gGiantLookUpStartAnim, &gGiantLookUpLoopAnim, &gGiantFallingOverAnim, &gGiantRaisedArmsStartAnim,
- &gGiantRaisedArmsLoopAnim, &gGiantStruggleStartAnim, &gGiantStruggleLoopAnim, &gGiantIdleAnim,
- &gGiantWalkingAnim, &gGiantBigCallStartAnim, &gGiantBigCallLoopAnim, &gGiantBigCallEndAnim,
- &gGiantSmallCallStartAnim, &gGiantSmallCallLoopAnim, &gGiantSmallCallEndAnim,
+static AnimationHeader* sAnimations[GIANT_ANIM_MAX] = {
+ &gGiantLookUpStartAnim, // GIANT_ANIM_LOOK_UP_START
+ &gGiantLookUpLoopAnim, // GIANT_ANIM_LOOK_UP_LOOP
+ &gGiantFallingOverAnim, // GIANT_ANIM_FALLING_OVER
+ &gGiantRaisedArmsStartAnim, // GIANT_ANIM_RAISED_ARMS_START
+ &gGiantRaisedArmsLoopAnim, // GIANT_ANIM_RAISED_ARMS_LOOP
+ &gGiantStruggleStartAnim, // GIANT_ANIM_STRUGGLE_START
+ &gGiantStruggleLoopAnim, // GIANT_ANIM_STRUGGLE_LOOP
+ &gGiantIdleAnim, // GIANT_ANIM_IDLE_LOOP
+ &gGiantWalkingAnim, // GIANT_ANIM_WALKING_LOOP
+ &gGiantBigCallStartAnim, // GIANT_ANIM_BIG_CALL_START
+ &gGiantBigCallLoopAnim, // GIANT_ANIM_BIG_CALL_LOOP
+ &gGiantBigCallEndAnim, // GIANT_ANIM_BIG_CALL_END
+ &gGiantSmallCallStartAnim, // GIANT_ANIM_SMALL_CALL_START
+ &gGiantSmallCallLoopAnim, // GIANT_ANIM_SMALL_CALL_LOOP
+ &gGiantSmallCallEndAnim, // GIANT_ANIM_SMALL_CALL_END
};
void EnGiant_ChangeAnim(EnGiant* this, s16 animIndex) {
- if (animIndex >= GIANT_ANIM_LOOK_UP_START && animIndex < GIANT_ANIM_MAX) {
+ if ((animIndex >= GIANT_ANIM_LOOK_UP_START) && (animIndex < GIANT_ANIM_MAX)) {
if (((this->animIndex == GIANT_ANIM_WALKING_LOOP) && (animIndex != GIANT_ANIM_WALKING_LOOP)) ||
((animIndex == GIANT_ANIM_WALKING_LOOP) && (this->animIndex != GIANT_ANIM_WALKING_LOOP))) {
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
@@ -160,7 +172,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable,
GIANT_LIMB_MAX);
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
- this->cueId = GIANT_CUE_ID_NONE;
+ this->cueId = GIANT_CUEID_NONE;
this->actionFunc = EnGiant_PerformCutsceneActions;
this->actor.draw = NULL;
this->alpha = 0;
@@ -275,58 +287,58 @@ void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimIndex)
*/
void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) {
switch (this->cueId) {
- case GIANT_CUE_ID_IDLE:
+ case GIANT_CUEID_IDLE:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
- case GIANT_CUE_ID_WALKING:
+ case GIANT_CUEID_WALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
break;
- case GIANT_CUE_ID_STRUGGLING:
+ case GIANT_CUEID_STRUGGLING:
EnGiant_ChangeAnim(this, GIANT_ANIM_STRUGGLE_START);
break;
- case GIANT_CUE_ID_FALLING_OVER:
+ case GIANT_CUEID_FALLING_OVER:
EnGiant_ChangeAnim(this, GIANT_ANIM_FALLING_OVER);
break;
- case GIANT_CUE_ID_IDLE_FADE_IN:
+ case GIANT_CUEID_IDLE_FADE_IN:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
this->alpha = 0;
break;
- case GIANT_CUE_ID_TALKING:
+ case GIANT_CUEID_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_START);
break;
- case GIANT_CUE_ID_DONE_TALKING:
+ case GIANT_CUEID_DONE_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_END);
break;
- case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER:
+ case GIANT_CUEID_TEACHING_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_START);
break;
- case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER:
+ case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_END);
break;
- case GIANT_CUE_ID_UNKNOWN_12:
+ case GIANT_CUEID_UNKNOWN_12:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
- case GIANT_CUE_ID_UNKNOWN_13:
+ case GIANT_CUEID_UNKNOWN_13:
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
break;
- case GIANT_CUE_ID_UNKNOWN_14:
+ case GIANT_CUEID_UNKNOWN_14:
if (this->animIndex != GIANT_ANIM_WALKING_LOOP) {
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
}
break;
- case GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER:
+ case GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER:
Animation_Change(&this->skelAnime, &gGiantRaisedArmsStartAnim, 0.0f,
Animation_GetLastFrame(&gGiantRaisedArmsStartAnim) - 1.0f,
Animation_GetLastFrame(&gGiantRaisedArmsStartAnim), ANIMMODE_ONCE, 0.0f);
@@ -339,14 +351,16 @@ void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) {
void EnGiant_UpdateAlpha(EnGiant* this) {
switch (this->cueId) {
- case GIANT_CUE_ID_FALLING_OVER:
+ case GIANT_CUEID_FALLING_OVER:
if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) {
this->alpha -= 12;
}
break;
- case GIANT_CUE_ID_UNKNOWN_14:
+
+ case GIANT_CUEID_UNKNOWN_14:
this->alpha -= 12;
break;
+
default:
if (this->alpha < 255) {
this->alpha += 8;
@@ -363,36 +377,37 @@ void EnGiant_UpdateAlpha(EnGiant* this) {
*/
void EnGiant_PlayAndUpdateAnimation(EnGiant* this) {
if (SkelAnime_Update(&this->skelAnime) &&
- (this->animIndex != GIANT_ANIM_FALLING_OVER || this->cueId != GIANT_CUE_ID_FALLING_OVER)) {
+ ((this->animIndex != GIANT_ANIM_FALLING_OVER) || (this->cueId != GIANT_CUEID_FALLING_OVER))) {
EnGiant_ChangeAnim(this, this->animIndex);
+
switch (this->cueId) {
- case GIANT_CUE_ID_LOOKING_UP:
+ case GIANT_CUEID_LOOKING_UP:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START);
break;
- case GIANT_CUE_ID_RAISING_ARMS:
+ case GIANT_CUEID_RAISING_ARMS:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START);
break;
- case GIANT_CUE_ID_STRUGGLING:
+ case GIANT_CUEID_STRUGGLING:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START);
break;
- case GIANT_CUE_ID_FALLING_OVER:
+ case GIANT_CUEID_FALLING_OVER:
// Unused
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER);
break;
- case GIANT_CUE_ID_TALKING:
+ case GIANT_CUEID_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP);
break;
- case GIANT_CUE_ID_DONE_TALKING:
- case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER:
+ case GIANT_CUEID_DONE_TALKING:
+ case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
- case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER:
+ case GIANT_CUEID_TEACHING_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP);
break;
@@ -445,7 +460,7 @@ void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) {
}
EnGiant_PlaySound(this);
- if (this->cueId == GIANT_CUE_ID_STRUGGLING) {
+ if (this->cueId == GIANT_CUEID_STRUGGLING) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG);
}
EnGiant_PlayAndUpdateAnimation(this);
diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
index ea3f9fea2..566f35ba0 100644
--- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
+++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
@@ -5,7 +5,6 @@
*/
#include "z_en_ginko_man.h"
-#include "objects/object_boj/object_boj.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@@ -47,15 +46,16 @@ typedef enum {
/* 1 */ GINKO_ANIM_SITTING,
/* 2 */ GINKO_ANIM_REACHING,
/* 3 */ GINKO_ANIM_AMAZED,
- /* 4 */ GINKO_ANIM_ADVERTISING
+ /* 4 */ GINKO_ANIM_ADVERTISING, // looking around for customers
+ /* 5 */ GINKO_ANIM_MAX
} GinkoAnimation;
-static AnimationInfo sAnimationInfo[] = {
- { &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
- { &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // looking around for customers
- { &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
+static AnimationInfo sAnimationInfo[GINKO_ANIM_MAX] = {
+ { &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_LEGSMACKING
+ { &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_SITTING
+ { &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // GINKO_ANIM_REACHING
+ { &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_AMAZED
+ { &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_ADVERTISING
};
void EnGinkoMan_Init(Actor* thisx, PlayState* play) {
@@ -71,7 +71,7 @@ void EnGinkoMan_Init(Actor* thisx, PlayState* play) {
this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET;
this->serviceFee = 0;
SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_0043F0, this->jointTable,
- this->morphTable, 16);
+ this->morphTable, OBJECT_BOJ_LIMB_MAX);
EnGinkoMan_SetupIdle(this);
}
@@ -172,7 +172,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_59_40);
Message_StartTextbox(play, 0x45B, &this->actor);
this->curTextId = 0x45B;
- } else if ((HS_GET_BANK_RUPEES() >= 1000) && ((this->previousBankValue) < 1000) &&
+ } else if ((HS_GET_BANK_RUPEES() >= 1000) && (this->previousBankValue < 1000) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) {
SET_WEEKEVENTREG(WEEKEVENTREG_59_80);
Message_StartTextbox(play, 0x45C, &this->actor);
@@ -664,16 +664,16 @@ void EnGinkoMan_Update(Actor* thisx, PlayState* play) {
s32 EnGinkoMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnGinkoMan* this = THIS;
- if (limbIndex == 15) {
+ if (limbIndex == OBJECT_BOJ_LIMB_0F) {
*dList = object_boj_DL_00B1D8;
}
- if (limbIndex == 15) {
+ if (limbIndex == OBJECT_BOJ_LIMB_0F) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXS(this->limb15Rot.y, MTXMODE_APPLY);
Matrix_RotateZS(this->limb15Rot.x, MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- } else if (limbIndex == 8) {
+ } else if (limbIndex == OBJECT_BOJ_LIMB_08) {
Matrix_RotateXS(-this->limb8Rot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->limb8Rot.x, MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
index b8a19d0f3..48ef4bdb1 100644
--- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
+++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
@@ -2,6 +2,7 @@
#define Z_EN_GINKO_MAN_H
#include "global.h"
+#include "objects/object_boj/object_boj.h"
struct EnGinkoMan;
@@ -11,8 +12,8 @@ typedef struct EnGinkoMan {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ EnGinkoManActionFunc actionFunc;
- /* 0x18C */ Vec3s jointTable[0x10];
- /* 0x1EC */ Vec3s morphTable[0x10];
+ /* 0x18C */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX];
+ /* 0x1EC */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX];
/* 0x24C */ Vec3s limb15Rot;
/* 0x252 */ Vec3s limb8Rot;
/* 0x258 */ s16 curTextId;
diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
index dd87be400..ad5bc484f 100644
--- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c
+++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
@@ -5,7 +5,6 @@
*/
#include "z_en_gk.h"
-#include "objects/object_gk/object_gk.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@@ -102,14 +101,38 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
-static AnimationInfo sAnimationInfo[] = {
- { &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, 0, 0.0f },
- { &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
- { &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, 0, 0.0f },
+typedef enum {
+ /* -1 */ ENGK_ANIM_NONE = -1,
+ /* 0x0 */ ENGK_ANIM_0,
+ /* 0x1 */ ENGK_ANIM_1,
+ /* 0x2 */ ENGK_ANIM_2,
+ /* 0x3 */ ENGK_ANIM_3,
+ /* 0x4 */ ENGK_ANIM_4,
+ /* 0x5 */ ENGK_ANIM_5,
+ /* 0x6 */ ENGK_ANIM_6,
+ /* 0x7 */ ENGK_ANIM_7,
+ /* 0x8 */ ENGK_ANIM_8,
+ /* 0x9 */ ENGK_ANIM_9,
+ /* 0xA */ ENGK_ANIM_10,
+ /* 0xB */ ENGK_ANIM_11,
+ /* 0xC */ ENGK_ANIM_12,
+ /* 0xD */ ENGK_ANIM_MAX
+} EnGkAnimation;
+
+static AnimationInfo sAnimationInfo[ENGK_ANIM_MAX] = {
+ { &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_0
+ { &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_1
+ { &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_2
+ { &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_3
+ { &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_4
+ { &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_5
+ { &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_6
+ { &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_7
+ { &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_8
+ { &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_9
+ { &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_10
+ { &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_11
+ { &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_12
};
Color_RGBA8 D_80B533A0 = { 255, 255, 255, 255 };
@@ -124,18 +147,24 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE7A:
return 0xE7B;
+
case 0xE7B:
return 0xE7C;
+
case 0xE7C:
return 0xE7D;
+
case 0xE7D:
return 0xE7E;
+
case 0xE7E:
return 0xE7F;
+
case 0xE7F:
SET_WEEKEVENTREG(WEEKEVENTREG_40_80);
this->unk_1E4 |= 1;
return 0xE80;
+
default:
return 0xE7A;
}
@@ -147,16 +176,21 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE82:
return 0xE83;
+
case 0xE83:
return 0xE7D;
+
case 0xE7D:
return 0xE7E;
+
case 0xE7E:
return 0xE7F;
+
case 0xE7F:
SET_WEEKEVENTREG(WEEKEVENTREG_41_01);
this->unk_1E4 |= 1;
return 0xE80;
+
default:
return 0xE82;
}
@@ -197,10 +231,12 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE85:
return 0xE86;
+
case 0xE86:
SET_WEEKEVENTREG(WEEKEVENTREG_41_02);
this->unk_1E4 |= 1;
return 0xE87;
+
default:
return 0xE85;
}
@@ -208,9 +244,9 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
this->unk_1E4 |= 1;
return 0xE87;
}
- } else {
- return 0;
}
+
+ return 0;
}
u16 func_80B50710(EnGk* this) {
@@ -229,8 +265,10 @@ u16 func_80B50710(EnGk* this) {
this->unk_1E4 |= 0x10;
this->unk_1E4 |= 1;
return 0xE8C;
+
+ default:
+ return 0;
}
- return 0;
}
void func_80B507A0(EnGk* this, PlayState* play) {
@@ -259,8 +297,8 @@ s32 func_80B50854(EnGk* this, PlayState* play) {
if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) &&
(play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY)) {
Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor));
- this->unk_2E4 = 3;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ this->animIndex = ENGK_ANIM_3;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_3);
this->actionFunc = func_80B521E8;
return true;
}
@@ -285,12 +323,13 @@ void func_80B509A8(EnGk* this, PlayState* play) {
this->unk_30C.y += Rand_ZeroOne();
this->unk_30C.z += 2.0f * Rand_Centered();
- if (this->unk_2E4 == 0) {
+ if (this->animIndex == ENGK_ANIM_0) {
sp4C.x = 0.0f;
sp4C.z = 0.0f;
sp4C.y = -1.2f;
phi_s1 = 25;
- } else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) {
+ } else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) ||
+ (this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) {
sp4C.x = 0.0f;
sp4C.z = 0.0f;
sp4C.y = -0.5f;
@@ -307,28 +346,28 @@ void func_80B50B38(EnGk* this, PlayState* play) {
s16 i;
s16 temp;
- switch (this->unk_2E4) {
- case 0:
+ switch (this->animIndex) {
+ case ENGK_ANIM_0:
this->unk_2E0 = 3;
for (i = 0; i < 2; i++) {
func_80B509A8(this, play);
}
break;
- case 2:
+ case ENGK_ANIM_2:
this->unk_2E0 = 3;
func_80B509A8(this, play);
break;
- case 1:
- case 3:
- case 12:
+ case ENGK_ANIM_1:
+ case ENGK_ANIM_3:
+ case ENGK_ANIM_12:
this->unk_2E0 = 2;
break;
- case 9:
- case 10:
- case 11:
+ case ENGK_ANIM_9:
+ case ENGK_ANIM_10:
+ case ENGK_ANIM_11:
this->unk_2E0 = 3;
func_80B509A8(this, play);
break;
@@ -483,22 +522,22 @@ s32 func_80B5123C(EnGk* this, PlayState* play) {
}
void func_80B51308(EnGk* this, PlayState* play) {
- s16 sp1E = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_31A].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation);
- if ((this->unk_2E4 == 7) && (sp1E == lastFrame)) {
- this->unk_2E4 = 8;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8);
+ if ((this->animIndex == ENGK_ANIM_7) && (curFrame == endFrame)) {
+ this->animIndex = ENGK_ANIM_8;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_8);
}
}
void func_80B51398(EnGk* this, PlayState* play) {
- s16 sp1E = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[9].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[9].animation);
- if ((this->unk_2E4 == 9) && (sp1E == lastFrame)) {
- this->unk_2E4 = 10;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10);
+ if ((this->animIndex == ENGK_ANIM_9) && (curFrame == endFrame)) {
+ this->animIndex = ENGK_ANIM_10;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_10);
}
}
@@ -541,35 +580,35 @@ void func_80B51510(EnGk* this, PlayState* play) {
this->cueId = play->csCtx.actorCues[cueChannel]->id;
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
- this->unk_31A = 0;
- this->unk_2E4 = 0;
+ this->csAnimIndex = ENGK_ANIM_0;
+ this->animIndex = ENGK_ANIM_0;
break;
case 2:
- this->unk_31A = 2;
- this->unk_2E4 = 2;
+ this->csAnimIndex = ENGK_ANIM_2;
+ this->animIndex = ENGK_ANIM_2;
break;
case 3:
- this->unk_31A = 7;
- this->unk_2E4 = 7;
+ this->csAnimIndex = ENGK_ANIM_7;
+ this->animIndex = ENGK_ANIM_7;
break;
case 4:
- this->unk_31A = 3;
- this->unk_2E4 = 3;
+ this->csAnimIndex = ENGK_ANIM_3;
+ this->animIndex = ENGK_ANIM_3;
break;
case 5:
- this->unk_31A = 1;
- this->unk_2E4 = 1;
+ this->csAnimIndex = ENGK_ANIM_1;
+ this->animIndex = ENGK_ANIM_1;
this->unk_1E4 |= 0x80;
this->actionFunc = func_80B5227C;
break;
case 6:
- this->unk_31A = 12;
- this->unk_2E4 = 12;
+ this->csAnimIndex = ENGK_ANIM_12;
+ this->animIndex = ENGK_ANIM_12;
break;
case 7:
@@ -579,10 +618,10 @@ void func_80B51510(EnGk* this, PlayState* play) {
default:
break;
}
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_31A);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
- if (this->unk_31A == 7) {
+ if (this->csAnimIndex == ENGK_ANIM_7) {
func_80B51308(this, play);
}
@@ -594,41 +633,44 @@ void func_80B51510(EnGk* this, PlayState* play) {
}
void func_80B51698(EnGk* this, PlayState* play) {
- s16 sp26 = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (sp26 == lastFrame) {
- switch (this->unk_2E4) {
- case 0:
- this->unk_2E4 = 2;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ if (curFrame == endFrame) {
+ switch (this->animIndex) {
+ case ENGK_ANIM_0:
+ this->animIndex = ENGK_ANIM_2;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_2);
this->actionFunc = func_80B5216C;
break;
- case 2:
- this->unk_2E4 = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ case ENGK_ANIM_2:
+ this->animIndex = ENGK_ANIM_0;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0);
this->actionFunc = func_80B5202C;
break;
+
+ default:
+ break;
}
}
}
void func_80B51760(EnGk* this, PlayState* play) {
- s16 sp2E = this->skelAnime.curFrame;
- s16 lastFrame;
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame;
- if (this->unk_2E4 == 11) {
- lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
- if (sp2E == lastFrame) {
- this->unk_2E4 = 5;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4);
+ if (this->animIndex == ENGK_ANIM_11) {
+ endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ if (curFrame == endFrame) {
+ this->animIndex = ENGK_ANIM_5;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex);
}
- } else if (this->unk_2E4 == 10) {
- lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
- if (sp2E == lastFrame) {
- this->unk_2E4 = 11;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4);
+ } else if (this->animIndex == ENGK_ANIM_10) {
+ endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ if (curFrame == endFrame) {
+ this->animIndex = ENGK_ANIM_11;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex);
}
} else {
if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) {
@@ -643,7 +685,7 @@ void func_80B51760(EnGk* this, PlayState* play) {
Message_StartTextbox(play, this->unk_31C, &this->actor);
this->actionFunc = func_80B51970;
if (this->unk_31C == 0xE81) {
- this->unk_2E4 = 0;
+ this->animIndex = ENGK_ANIM_0;
this->unk_1E4 |= 2;
}
} else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) &&
@@ -673,7 +715,7 @@ void func_80B51970(EnGk* this, PlayState* play) {
if (this->unk_1E4 & 1) {
this->unk_1E4 &= ~1;
this->unk_1E4 &= ~4;
- if (this->unk_2E4 == 10) {
+ if (this->animIndex == ENGK_ANIM_10) {
this->unk_1E4 &= ~2;
}
this->actionFunc = func_80B51760;
@@ -691,10 +733,10 @@ void func_80B51970(EnGk* this, PlayState* play) {
if (this->unk_1E4 & 2) {
Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG);
- if (this->unk_2E4 != 10) {
- if (this->unk_2E4 != 9) {
- this->unk_2E4 = 9;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9);
+ if (this->animIndex != ENGK_ANIM_10) {
+ if (this->animIndex != ENGK_ANIM_9) {
+ this->animIndex = ENGK_ANIM_9;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9);
} else {
func_80B51398(this, play);
}
@@ -703,7 +745,7 @@ void func_80B51970(EnGk* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (this->unk_2E4 == 6) {
+ if (this->animIndex == ENGK_ANIM_6) {
func_80B50954(this);
}
}
@@ -717,7 +759,7 @@ void func_80B51B40(EnGk* this, PlayState* play) {
this->unk_1E4 &= ~1;
this->unk_1E4 &= ~4;
- if (this->unk_2E4 == 10) {
+ if (this->animIndex == ENGK_ANIM_10) {
this->unk_1E4 &= ~2;
}
@@ -752,15 +794,18 @@ void func_80B51B40(EnGk* this, PlayState* play) {
this->unk_31C = 0xE8A;
Message_StartTextbox(play, this->unk_31C, &this->actor);
break;
+
+ default:
+ break;
}
}
if (this->unk_1E4 & 2) {
Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG);
- if (this->unk_2E4 != 10) {
- if (this->unk_2E4 != 9) {
- this->unk_2E4 = 9;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9);
+ if (this->animIndex != ENGK_ANIM_10) {
+ if (this->animIndex != ENGK_ANIM_9) {
+ this->animIndex = ENGK_ANIM_9;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9);
} else {
func_80B51398(this, play);
}
@@ -778,8 +823,8 @@ void func_80B51D9C(EnGk* this, PlayState* play) {
CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor);
if (this->unk_1E4 & 4) {
this->unk_1E4 &= ~4;
- this->unk_2E4 = 6;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6);
+ this->animIndex = ENGK_ANIM_6;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_6);
this->actionFunc = func_80B51EA4;
} else {
this->unk_1E4 |= 4;
@@ -880,21 +925,21 @@ void func_80B5216C(EnGk* this, PlayState* play) {
}
void func_80B521E8(EnGk* this, PlayState* play) {
- s16 sp1E = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if (sp1E == lastFrame) {
- this->unk_2E4 = 1;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ if (curFrame == endFrame) {
+ this->animIndex = ENGK_ANIM_1;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_1);
this->actionFunc = func_80B5227C;
}
}
void func_80B5227C(EnGk* this, PlayState* play) {
- s16 sp26 = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
- if ((sp26 + 1) == lastFrame) {
+ if (curFrame == (endFrame - 1)) {
func_800B14D4(play, 20.0f, &this->actor.home.pos);
this->unk_350 = 60;
if (!(this->unk_1E4 & 0x80)) {
@@ -948,6 +993,9 @@ void func_80B52430(EnGk* this, PlayState* play) {
this->unk_1E4 &= ~4;
this->actionFunc = func_80B51760;
return;
+
+ default:
+ break;
}
}
@@ -1005,7 +1053,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
EnGk* this = THIS;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gk_Skel_0079C0, &object_gk_Anim_00787C, this->jointTable,
- this->morphTable, 20);
+ this->morphTable, OBJECT_GK_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@@ -1019,16 +1067,16 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
this->actor.gravity = -1.0f;
if (ENGK_GET_F(&this->actor) == ENGK_F_1) {
- this->unk_2E4 = 5;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5);
+ this->animIndex = ENGK_ANIM_5;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_5);
if (play->sceneId == SCENE_17SETUGEN2) {
if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) {
Actor_Kill(&this->actor);
- } else {
- this->csId = this->actor.csId;
- this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE);
- this->actionFunc = func_80B51760;
+ return;
}
+ this->csId = this->actor.csId;
+ this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE);
+ this->actionFunc = func_80B51760;
} else if (play->sceneId == SCENE_GORONRACE) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) {
@@ -1054,11 +1102,11 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
}
} else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON)) {
- this->unk_2E4 = 0;
+ this->animIndex = ENGK_ANIM_0;
this->csId = this->actor.csId;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_2000000;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0);
this->actionFunc = func_80B5202C;
} else {
this->actionFunc = func_80B52654;
@@ -1111,7 +1159,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp28.x = 1100.0f;
sp28.z = -500.0f;
- if (this->unk_2E4 == 0) {
+ if (this->animIndex == ENGK_ANIM_0) {
sp34.y = -100.0f;
sp28.y = -100.0f;
@@ -1121,7 +1169,8 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp4C = sp40;
sp4C.x *= -1.0f;
- } else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) {
+ } else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) ||
+ (this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) {
sp34.y = 400.0f;
sp28.y = 400.0f;
@@ -1133,7 +1182,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp4C.x *= -1.0f;
}
- if (limbIndex == 17) {
+ if (limbIndex == OBJECT_GK_LIMB_11) {
if (ENGK_GET_F(&this->actor) == ENGK_F_1) {
phi_f0 = 100.0f;
} else {
@@ -1164,7 +1213,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
s32 phi_v1;
switch (limbIndex) {
- case 18:
+ case OBJECT_GK_LIMB_12:
if (this->unk_1E4 & 8) {
phi_v1 = true;
} else {
@@ -1191,7 +1240,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_Push();
break;
- case 9:
+ case OBJECT_GK_LIMB_09:
if (this->unk_1E4 & 8) {
phi_v1 = true;
} else {
@@ -1216,6 +1265,9 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_Push();
break;
+
+ default:
+ break;
}
}
@@ -1260,8 +1312,9 @@ void EnGk_Draw(Actor* thisx, PlayState* play) {
if (ENGK_GET_F(&this->actor) != ENGK_F_2) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
- if ((this->unk_2E4 == 0) || (this->unk_2E4 == 1) || (this->unk_2E4 == 2) || (this->unk_2E4 == 3) ||
- (this->unk_2E4 == 4)) {
+ if ((this->animIndex == ENGK_ANIM_0) || (this->animIndex == ENGK_ANIM_1) ||
+ (this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_3) ||
+ (this->animIndex == ENGK_ANIM_4)) {
pos.x = this->actor.world.pos.x - 15.0f;
pos.y = this->actor.world.pos.y;
pos.z = this->actor.world.pos.z;
diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.h b/src/overlays/actors/ovl_En_Gk/z_en_gk.h
index 130b97675..6bd28ad94 100644
--- a/src/overlays/actors/ovl_En_Gk/z_en_gk.h
+++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.h
@@ -2,6 +2,7 @@
#define Z_EN_GK_H
#include "global.h"
+#include "objects/object_gk/object_gk.h"
struct EnGk;
@@ -32,17 +33,17 @@ typedef struct EnGk {
/* 0x1E4 */ u16 unk_1E4;
/* 0x1E8 */ Path* path;
/* 0x1EC */ s32 unk_1EC;
- /* 0x1F0 */ Vec3s jointTable[20];
- /* 0x1F0 */ Vec3s morphTable[20];
+ /* 0x1F0 */ Vec3s jointTable[OBJECT_GK_LIMB_MAX];
+ /* 0x1F0 */ Vec3s morphTable[OBJECT_GK_LIMB_MAX];
/* 0x2E0 */ s16 unk_2E0;
/* 0x2E2 */ s16 unk_2E2;
- /* 0x2E4 */ s16 unk_2E4;
+ /* 0x2E4 */ s16 animIndex;
/* 0x2E8 */ Vec3f unk_2E8;
/* 0x2F4 */ Vec3f unk_2F4;
/* 0x300 */ Vec3f unk_300;
/* 0x30C */ Vec3f unk_30C;
/* 0x318 */ s16 csId;
- /* 0x31A */ u8 unk_31A;
+ /* 0x31A */ u8 csAnimIndex;
/* 0x31B */ u8 cueId;
/* 0x31C */ u16 unk_31C;
/* 0x31E */ s16 unk_31E;
diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
index 787ce43b9..39b705649 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
@@ -6,7 +6,6 @@
#include "z_en_gm.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
-#include "objects/object_in2/object_in2.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@@ -209,20 +208,38 @@ static ColliderSphereInit sSphereInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
-static AnimationInfoS sAnimationInfo[] = {
- { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 },
- { &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
+typedef enum {
+ /* -1 */ ENGM_ANIM_NONE = -1,
+ /* 0x0 */ ENGM_ANIM_0,
+ /* 0x1 */ ENGM_ANIM_1,
+ /* 0x2 */ ENGM_ANIM_2,
+ /* 0x3 */ ENGM_ANIM_3,
+ /* 0x4 */ ENGM_ANIM_4,
+ /* 0x5 */ ENGM_ANIM_5,
+ /* 0x6 */ ENGM_ANIM_6,
+ /* 0x7 */ ENGM_ANIM_7,
+ /* 0x8 */ ENGM_ANIM_8,
+ /* 0x9 */ ENGM_ANIM_9,
+ /* 0xA */ ENGM_ANIM_10,
+ /* 0xB */ ENGM_ANIM_11,
+ /* 0xC */ ENGM_ANIM_12,
+ /* 0xD */ ENGM_ANIM_MAX
+} EnGmAnimation;
+
+static AnimationInfoS sAnimationInfo[ENGM_ANIM_MAX] = {
+ { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_0
+ { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_1
+ { &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_2
+ { &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_3
+ { &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_4
+ { &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_5
+ { &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_6
+ { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_7
+ { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_8
+ { &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGM_ANIM_9
+ { &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_10
+ { &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_11
+ { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_12
};
Actor* func_8094DEE0(EnGm* this, PlayState* play, u8 arg2, s16 arg3) {
@@ -286,43 +303,43 @@ EnDoor* func_8094DF90(PlayState* play, s32 arg1) {
return SubS_FindDoor(play, phi_a1);
}
-s32 func_8094DFF8(EnGm* this, PlayState* play) {
- s32 ret = false;
+s32 EnGm_UpdateSkelAnime(EnGm* this, PlayState* play) {
+ s32 isAnimFinished = false;
if (this->unk_262 < 0) {
return false;
}
if (this->unk_262 >= 0) {
- this->skelAnime.playSpeed = this->unk_3A8;
- ret = SkelAnime_Update(&this->skelAnime);
+ this->skelAnime.playSpeed = this->animPlaySpeed;
+ isAnimFinished = SkelAnime_Update(&this->skelAnime);
}
- return ret;
+ return isAnimFinished;
}
-s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) {
+s32 EnGm_ChangeAnim(EnGm* this, PlayState* play, s32 animIndex) {
s8 tmp = this->unk_262;
- s32 phi_v1 = false;
- s32 ret = false;
+ s32 changeAnim = false;
+ s32 didAnimChange = false;
- if ((arg2 == 0) || (arg2 == 1)) {
- if ((this->unk_3E8 != 0) && (this->unk_3E8 != 1)) {
- phi_v1 = true;
+ if ((animIndex == ENGM_ANIM_0) || (animIndex == ENGM_ANIM_1)) {
+ if ((this->animIndex != ENGM_ANIM_0) && (this->animIndex != ENGM_ANIM_1)) {
+ changeAnim = true;
}
- } else if (arg2 != this->unk_3E8) {
- phi_v1 = true;
+ } else if (this->animIndex != animIndex) {
+ changeAnim = true;
}
- if (phi_v1) {
+ if (changeAnim) {
if (tmp >= 0) {
- this->unk_3E8 = arg2;
- ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2);
- this->unk_3A8 = this->skelAnime.playSpeed;
+ this->animIndex = animIndex;
+ didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
+ this->animPlaySpeed = this->skelAnime.playSpeed;
}
}
- return ret;
+ return didAnimChange;
}
s32 func_8094E0F8(EnGm* this, PlayState* play) {
@@ -486,6 +503,9 @@ s32 func_8094E52C(EnGm* this, PlayState* play) {
this->unk_3E0++;
ret = true;
break;
+
+ default:
+ break;
}
return ret;
@@ -502,7 +522,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
switch (this->unk_3E0) {
case 0:
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
- func_8094E054(this, play, 2);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
this->unk_3E2 = 0;
this->unk_3E0++;
break;
@@ -558,6 +578,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
this->unk_3E2 = 0;
this->unk_3E0++;
break;
+
case 9:
sp48 = this->actor.world.rot.y;
this->unk_3E2++;
@@ -565,13 +586,16 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, sp48, 3, 0x2AA8);
this->unk_3A4 &= ~0x20;
} else {
- func_8094E054(this, play, 1);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
this->actor.shape.rot.y = sp48;
this->unk_3E0++;
this->unk_3E2 = 0;
ret = true;
}
break;
+
+ default:
+ break;
}
return ret;
}
@@ -639,7 +663,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) {
break;
}
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
- func_8094E054(this, play, 2);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
this->unk_3E2 = 0;
this->unk_3E0++;
@@ -669,7 +693,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, oldYaw, 3, 0x2AA8);
this->unk_3A4 &= ~0x20;
} else {
- func_8094E054(this, play, 1);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
this->actor.shape.rot.y = oldYaw;
this->unk_3E2 = 0;
this->unk_3E0++;
@@ -763,7 +787,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) {
if (play->csCtx.state != CS_STATE_IDLE) {
if (this->unk_3F8 == 0) {
if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) {
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
this->unk_258 = 255;
}
this->cueId = 255;
@@ -879,9 +903,9 @@ void func_8094F3D0(EnGm* this, PlayState* play) {
}
s32 func_8094F4EC(EnGm* this, PlayState* play) {
- if ((this->unk_258 != 6) && (this->unk_3E8 == 12)) {
+ if ((this->unk_258 != 6) && (this->animIndex == ENGM_ANIM_12)) {
this->unk_3A4 &= ~0x2000;
- func_8094E054(this, play, 8);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_8);
}
return true;
}
@@ -897,30 +921,30 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
if (this->unk_3A6 != sp32) {
switch (sp32) {
case 0x2B13:
- func_8094E054(this, play, 2);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
break;
case 0x2B14:
case 0x2B18:
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
break;
case 0x2B16:
- func_8094E054(this, play, 1);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
break;
case 0x2B15:
- func_8094E054(this, play, 5);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_5);
break;
case 0x2B17:
- func_8094E054(this, play, 6);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_6);
break;
default:
- if ((this->unk_3E8 == 7) || (this->unk_3E8 == 8)) {
+ if ((this->animIndex == ENGM_ANIM_7) || (this->animIndex == ENGM_ANIM_8)) {
this->unk_3A4 |= 0x2000;
- func_8094E054(this, play, 12);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_12);
}
break;
}
@@ -941,6 +965,9 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_268 = toto;
}
break;
+
+ default:
+ break;
}
if (sp32 == 0x2AA8) {
@@ -963,7 +990,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_18C(this, play);
}
- if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
+ if ((this->animIndex == ENGM_ANIM_6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO);
}
@@ -1039,7 +1066,7 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
- func_8094E054(this, play, 7);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_7);
this->actor.gravity = 0.0f;
ret = true;
}
@@ -1087,7 +1114,7 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
- func_8094E054(this, play, 7);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_7);
this->actor.gravity = -1.0f;
ret = true;
}
@@ -1102,9 +1129,9 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (this->unk_258 == 0) {
Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
} else {
- func_8094E054(this, play, 9);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_9);
this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE;
}
this->unk_3A4 |= 0x100;
@@ -1118,7 +1145,7 @@ s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) {
- func_8094E054(this, play, 11);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_11);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
@@ -1134,7 +1161,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL);
if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) &&
(al->update != NULL)) {
- func_8094E054(this, play, 11);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_11);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_268 = al;
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_20)) {
@@ -1176,11 +1203,11 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3C8 = 4;
this->unk_3CA = 4;
this->unk_3CC = 8;
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
func_8094E278(play);
} else {
Math_Vec3f_Copy(&this->actor.world.pos, &sp30);
- func_8094E054(this, play, 9);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_9);
this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE;
}
this->unk_400 = 0;
@@ -1202,7 +1229,7 @@ s32 func_80950088(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= (0x2000 | 0x100);
this->unk_3A4 |= 0x200;
- func_8094E054(this, play, 12);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_12);
return true;
}
@@ -1217,7 +1244,7 @@ s32 func_80950120(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= (0x800 | 0x100);
this->unk_3A4 |= 0x200;
- func_8094E054(this, play, 4);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_4);
return true;
}
@@ -1238,7 +1265,7 @@ s32 func_809501B8(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3CC = 8;
this->actor.targetMode = TARGET_MODE_6;
this->unk_3B4 = 60.0f;
- func_8094E054(this, play, 10);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_10);
return true;
}
@@ -1334,11 +1361,11 @@ s32 func_80950388(EnGm* this, PlayState* play) {
s32 func_809503F8(EnGm* this, PlayState* play) {
s32 pad;
- if (this->unk_3E8 == 9) {
+ if (this->animIndex == ENGM_ANIM_9) {
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
} else {
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
}
@@ -1348,7 +1375,8 @@ s32 func_809503F8(EnGm* this, PlayState* play) {
s32 func_80950490(EnGm* this, PlayState* play) {
static s32 D_80951DE4[] = {
- 1, 5, 5, 1, 6, 5, 1, 5, 6, 1, 5, 6,
+ ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_5, ENGM_ANIM_1, ENGM_ANIM_6, ENGM_ANIM_5,
+ ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6, ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6,
};
s32 pad;
@@ -1358,32 +1386,32 @@ s32 func_80950490(EnGm* this, PlayState* play) {
this->unk_3CA = 1;
this->unk_3CC = 8;
this->unk_400 = 1;
- func_8094E054(this, play, 3);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_3);
}
return false;
}
this->unk_400 = 0;
- switch (this->unk_3E8) {
- case 9:
+ switch (this->animIndex) {
+ case ENGM_ANIM_9:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3C8 = 4;
this->unk_3CA = 4;
this->unk_3CC = 8;
- func_8094E054(this, play, 0);
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
func_8094E278(play);
} else {
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
}
break;
- case 5:
- case 6:
+ case ENGM_ANIM_5:
+ case ENGM_ANIM_6:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
- func_8094E054(this, play, D_80951DE4[this->unk_3F4]);
+ EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]);
this->unk_3F4++;
this->unk_3F4 %= 12;
this->unk_3DE = Rand_S16Offset(30, 30);
@@ -1392,7 +1420,7 @@ s32 func_80950490(EnGm* this, PlayState* play) {
default:
if (DECR(this->unk_3DE) == 0) {
- func_8094E054(this, play, D_80951DE4[this->unk_3F4]);
+ EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]);
this->unk_3F4++;
this->unk_3F4 %= 12;
this->unk_3DE = Rand_S16Offset(30, 30);
@@ -1433,6 +1461,7 @@ s32 func_80950690(EnGm* this, PlayState* play) {
break;
case 8:
+ default:
break;
}
@@ -1574,6 +1603,9 @@ void func_80950C24(EnGm* this, PlayState* play) {
case 30:
func_8095097C(this, play);
break;
+
+ default:
+ break;
}
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8);
@@ -1629,7 +1661,7 @@ void func_80950DB8(EnGm* this, PlayState* play) {
}
void func_80950F2C(EnGm* this, PlayState* play) {
- s32 sp50[] = { 0, 0, 3, 2 };
+ s32 csAnimIndex[] = { ENGM_ANIM_0, ENGM_ANIM_0, ENGM_ANIM_3, ENGM_ANIM_2 };
Player* player = GET_PLAYER(play);
s32 pad;
Vec3f sp3C;
@@ -1644,7 +1676,7 @@ void func_80950F2C(EnGm* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
}
this->cueId = cueId;
- func_8094E054(this, play, sp50[cueId]);
+ EnGm_ChangeAnim(this, play, csAnimIndex[cueId]);
}
if ((this->cueId == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) {
@@ -1670,9 +1702,10 @@ void EnGm_Init(Actor* thisx, PlayState* play) {
}
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, 20);
- this->unk_3E8 = -1;
- func_8094E054(this, play, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable,
+ OBJECT_IN2_LIMB_MAX);
+ this->animIndex = ENGM_ANIM_NONE;
+ EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit);
Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
@@ -1698,7 +1731,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) {
if (!func_8094E0F8(this, play)) {
if (!func_8094EE84(this, play) && func_8094EFC4(this, play)) {
func_80950F2C(this, play);
- func_8094DFF8(this, play);
+ EnGm_UpdateSkelAnime(this, play);
func_8094E2D0(this);
return;
}
@@ -1708,7 +1741,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) {
func_8094F53C(this, play);
if (this->unk_258 != 0) {
- func_8094DFF8(this, play);
+ EnGm_UpdateSkelAnime(this, play);
func_8094E2D0(this);
func_8094F2E8(this);
SubS_Offer(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & SUBS_OFFER_MODE_MASK);
@@ -1726,20 +1759,20 @@ s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
EnGm* this = THIS;
s32 fidgetIndex;
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_IN2_LIMB_10) {
func_8094F3D0(this, play);
}
switch (limbIndex) {
- case 9:
+ case OBJECT_IN2_LIMB_09:
fidgetIndex = 0;
break;
- case 10:
+ case OBJECT_IN2_LIMB_0A:
fidgetIndex = 1;
break;
- case 13:
+ case OBJECT_IN2_LIMB_0D:
fidgetIndex = 2;
break;
@@ -1763,20 +1796,20 @@ void EnGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp30;
s32 pad2;
- if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == 16)) {
+ if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == OBJECT_IN2_LIMB_10)) {
Matrix_MultVec3f(&D_80951E24, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
}
OPEN_DISPS(play->state.gfxCtx);
- if ((limbIndex == 15) && (this->unk_3A4 & 0x800)) {
+ if ((limbIndex == OBJECT_IN2_LIMB_0F) && (this->unk_3A4 & 0x800)) {
gSPDisplayList(POLY_OPA_DISP++, object_in2_DL_007528);
}
CLOSE_DISPS(play->state.gfxCtx);
- if (limbIndex == 9) {
+ if (limbIndex == OBJECT_IN2_LIMB_09) {
Matrix_MultVec3f(&gZeroVec3f, &sp30);
Math_Vec3f_ToVec3s(&this->colliderSphere.dim.worldSphere.center, &sp30);
}
@@ -1799,7 +1832,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
overrideRot = false;
}
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_IN2_LIMB_10) {
SubS_UpdateLimb(BINANG_ADD(this->unk_3BC + this->unk_3C0, 0x4000),
BINANG_ADD(this->unk_3BE + this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_290,
&this->unk_2A8, stepRot, overrideRot);
@@ -1810,7 +1843,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_RotateXS(this->unk_2A8.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_2A8.z, MTXMODE_APPLY);
Matrix_Push();
- } else if (limbIndex == 9) {
+ } else if (limbIndex == OBJECT_IN2_LIMB_09) {
SubS_UpdateLimb(BINANG_ADD(this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3C2 + this->actor.shape.rot.y, 0x4000),
&this->unk_29C, &this->unk_2AE, stepRot, overrideRot);
Matrix_Pop();
@@ -1824,8 +1857,10 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
}
void EnGm_Draw(Actor* thisx, PlayState* play) {
- static TexturePtr D_80951E30[] = { object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828,
- object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68 };
+ static TexturePtr D_80951E30[] = {
+ object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828,
+ object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68,
+ };
EnGm* this = THIS;
if ((this->unk_258 != 0) && (this->unk_262 >= 0)) {
diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h
index 572fa322f..968d6dd07 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h
@@ -2,6 +2,7 @@
#define Z_EN_GM_H
#include "global.h"
+#include "objects/object_in2/object_in2.h"
struct EnGm;
@@ -42,11 +43,11 @@ typedef struct EnGm {
/* 0x29C */ Vec3f unk_29C;
/* 0x2A8 */ Vec3s unk_2A8;
/* 0x2AE */ Vec3s unk_2AE;
- /* 0x2B4 */ Vec3s jointTable[20];
- /* 0x32C */ Vec3s morphTable[20];
+ /* 0x2B4 */ Vec3s jointTable[OBJECT_IN2_LIMB_MAX];
+ /* 0x32C */ Vec3s morphTable[OBJECT_IN2_LIMB_MAX];
/* 0x3A4 */ u16 unk_3A4;
/* 0x3A6 */ u16 unk_3A6;
- /* 0x3A8 */ f32 unk_3A8;
+ /* 0x3A8 */ f32 animPlaySpeed;
/* 0x3AC */ f32 unk_3AC;
/* 0x3B0 */ f32 unk_3B0;
/* 0x3B4 */ f32 unk_3B4;
@@ -69,7 +70,7 @@ typedef struct EnGm {
/* 0x3E0 */ s16 unk_3E0;
/* 0x3E2 */ s16 unk_3E2;
/* 0x3E4 */ EnGmUnkFunc unk_3E4;
- /* 0x3E8 */ s32 unk_3E8;
+ /* 0x3E8 */ s32 animIndex;
/* 0x3EC */ UNK_TYPE1 unk3EC[0x4];
/* 0x3F0 */ s32 prevTalkState;
/* 0x3F4 */ s32 unk_3F4;
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 10dda353c..f5678eedd 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -82,8 +82,8 @@ typedef enum EnGoEffectType {
/* 7 */ ENGO_EFFECT_STEAM = ENGO_EFFECT_STEAM_MIN
} EnGoEffectType;
-typedef enum EnGoAnimationIndex {
- /* -1 */ ENGO_ANIM_INVALID = -1,
+typedef enum EnGoAnimation {
+ /* -1 */ ENGO_ANIM_NONE = -1,
/* 0 */ ENGO_ANIM_GORON_MIN,
/* 0 */ ENGO_ANIM_LYINGDOWNIDLE = ENGO_ANIM_GORON_MIN,
/* 1 */ ENGO_ANIM_LYINGDOWNIDLE_IMM,
@@ -95,21 +95,21 @@ typedef enum EnGoAnimationIndex {
/* 7 */ ENGO_ANIM_DROPKEG,
/* 8 */ ENGO_ANIM_COVEREARS,
/* 9 */ ENGO_ANIM_SHIVERINGSURPRISED,
- /* 10 */ ENGO_ANIM_ATHLETICS_MIN,
- /* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN,
- /* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE,
- /* 12 */ ENGO_ANIM_SHAKE_LIMBS,
- /* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND,
- /* 14 */ ENGO_ANIM_SITTING_STRETCH,
- /* 15 */ ENGO_ANIM_CHEER,
- /* 16 */ ENGO_ANIM_SHOUT,
- /* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH,
- /* 18 */ ENGO_ANIM_SPRING_MIN,
- /* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN,
- /* 19 */ ENGO_ANIM_SHOW_LOOPED,
- /* 20 */ ENGO_ANIM_LOOK_AROUND,
- /* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED
-} EnGoAnimationIndex;
+ /* 10 */ ENGO_ANIM_ATHLETICS_MIN,
+ /* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN,
+ /* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE,
+ /* 12 */ ENGO_ANIM_SHAKE_LIMBS,
+ /* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND,
+ /* 14 */ ENGO_ANIM_SITTING_STRETCH,
+ /* 15 */ ENGO_ANIM_CHEER,
+ /* 16 */ ENGO_ANIM_SHOUT,
+ /* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH,
+ /* 18 */ ENGO_ANIM_SPRING_MIN,
+ /* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN,
+ /* 19 */ ENGO_ANIM_SHOW_LOOPED,
+ /* 20 */ ENGO_ANIM_LOOK_AROUND,
+ /* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED
+} EnGoAnimation;
void EnGo_Idle(EnGo* this, PlayState* play);
void EnGo_Sleep(EnGo* this, PlayState* play);
@@ -309,7 +309,7 @@ static DamageTable sDamageTable = {
/**
* Animations used in the actor.
*
- * @see EnGoAnimationIndex
+ * @see EnGoAnimation
*/
static AnimationInfoS sAnimationInfo[] = {
@@ -530,7 +530,7 @@ void EnGo_DrawDust(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) {
* @param pos Position around which the effects appear
*/
void EnGo_InitSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], Vec3f pos) {
- static u8 effectIndexToSnowEffectTable[ENGO_SNOW_EFFECT_COUNT] = {
+ static u8 sEffectIndexToSnowEffectTable[ENGO_SNOW_EFFECT_COUNT] = {
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
@@ -570,7 +570,7 @@ void EnGo_InitSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], Vec3f pos) {
effect->alphaDenom = effect->alphaNumer = 1;
// Assign a snow effect value of 'ENGO_EFFECT_SNOW1'/'2'/'3'
- effect->type = effectIndexToSnowEffectTable[i];
+ effect->type = sEffectIndexToSnowEffectTable[i];
// Initialize the parameters for the paired element
randRelativeToWorldPos.x = ((Rand_ZeroOne() - 0.5f) * 80.0f) + effect->pos.x;
@@ -977,27 +977,27 @@ s32 EnGo_UpdateSpringArrivalCutscene(EnGo* this, PlayState* play) {
*
* @return True if non-repeating animation has finished
*/
-s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) {
+s32 EnGo_UpdateSkelAnime(EnGo* this, PlayState* play) {
s8 objIndex = this->actor.objBankIndex;
s8 extraObjIndex = -1;
- s32 ret = false;
+ s32 isAnimFinished = false;
- if ((this->curAnimIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
+ if ((this->animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
extraObjIndex = this->hakuginDemoObjIndex;
- } else if ((this->curAnimIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) {
+ } else if ((this->animIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) {
extraObjIndex = this->taisouObjIndex;
- } else if (this->curAnimIndex < ENGO_ANIM_ATHLETICS_MIN) {
+ } else if (this->animIndex < ENGO_ANIM_ATHLETICS_MIN) {
extraObjIndex = this->actor.objBankIndex;
}
if (extraObjIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment);
- this->skelAnime.playSpeed = this->curAnimPlaySpeed;
- ret = SkelAnime_Update(&this->skelAnime);
+ this->skelAnime.playSpeed = this->animPlaySpeed;
+ isAnimFinished = SkelAnime_Update(&this->skelAnime);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment);
}
- return ret;
+ return isAnimFinished;
}
/**
@@ -1005,7 +1005,7 @@ s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) {
*/
s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
if (play->csCtx.state == CS_STATE_IDLE) {
- if (this->curAnimIndex == ENGO_ANIM_ROLL) {
+ if (this->animIndex == ENGO_ANIM_ROLL) {
if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE);
}
@@ -1013,7 +1013,7 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 22.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT);
}
- } else if ((this->curAnimIndex == ENGO_ANIM_UNROLL) || (this->curAnimIndex == ENGO_ANIM_UNROLL_IMM)) {
+ } else if ((this->animIndex == ENGO_ANIM_UNROLL) || (this->animIndex == ENGO_ANIM_UNROLL_IMM)) {
if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE_OFF);
}
@@ -1037,10 +1037,10 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
*
* @return True if animation was changed
*/
-s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex) {
+s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimation animIndex) {
s8 objIndex = this->actor.objBankIndex;
s8 extraObjIndex = -1;
- s32 ret = false;
+ s32 didAnimChange = false;
if ((animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
extraObjIndex = this->hakuginDemoObjIndex;
@@ -1052,13 +1052,13 @@ s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex) {
if (extraObjIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment);
- this->curAnimIndex = animIndex;
- ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
- this->curAnimPlaySpeed = this->skelAnime.playSpeed;
+ this->animIndex = animIndex;
+ didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
+ this->animPlaySpeed = this->skelAnime.playSpeed;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment);
}
- return ret;
+ return didAnimChange;
}
/**
@@ -1651,7 +1651,7 @@ void EnGo_ChangeToStretchingAnimation(EnGo* this, PlayState* play) {
EnGo_ChangeAnim(this, play, sSubtypeToAnimIndex[subtypeLookup]);
// Move the sitting Goron forward, since their spawn location is the same as their standing counterpart.
- if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) {
+ if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) {
Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &sStretchingGoronOffset,
&newSittingStretcherPos);
@@ -1701,7 +1701,7 @@ void EnGo_ChangeToSpectatingAnimation(EnGo* this, PlayState* play) {
void EnGo_ChangeToFrozenAnimation(EnGo* this, PlayState* play) {
Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInitFrozen);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
- this->curAnimIndex = -1;
+ this->animIndex = ENGO_ANIM_NONE;
EnGo_ChangeAnim(this, play, ENGO_ANIM_SHIVER);
this->sleepState = ENGO_AWAKE;
this->iceBlockScale = (this->scaleFactor / 0.01f) * 0.9f;
@@ -1899,7 +1899,7 @@ void EnGo_SetupInitialAction(EnGo* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable,
GORON_LIMB_MAX);
- this->curAnimIndex = ENGO_ANIM_INVALID;
+ this->animIndex = ENGO_ANIM_NONE;
EnGo_ChangeAnim(this, play, ENGO_ANIM_UNROLL);
this->actor.draw = EnGo_Draw;
@@ -2168,14 +2168,14 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play) {
switch (this->springArrivalCueId) {
case 3:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) &&
- (this->curAnimIndex == ENGO_ANIM_LOOK_AROUND)) {
+ (this->animIndex == ENGO_ANIM_LOOK_AROUND)) {
EnGo_ChangeAnim(this, play, ENGO_ANIM_LOOK_AROUND_LOOPED);
}
break;
case 4:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) &&
- (this->curAnimIndex == ENGO_ANIM_SHOW)) {
+ (this->animIndex == ENGO_ANIM_SHOW)) {
EnGo_ChangeAnim(this, play, ENGO_ANIM_SHOW_LOOPED);
}
break;
@@ -2439,7 +2439,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) {
if (!(this->actionFlags & ENGO_FLAG_FROZEN)) {
EnGo_UpdateEyes(this);
- EnGo_UpdateAnimationToCurrent(this, play);
+ EnGo_UpdateSkelAnime(this, play);
EnGo_UpdateAttentionTargetAndReactions(this, play);
EnGo_UpdateSfx(this, play);
}
@@ -2599,7 +2599,7 @@ void EnGo_Draw(Actor* thisx, PlayState* play) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
- if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) {
+ if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) {
Matrix_Translate(0.0f, 0.0f, -4000.0f, MTXMODE_APPLY);
}
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h
index 0ada7fe1e..97959a03e 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.h
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.h
@@ -106,7 +106,7 @@ typedef struct EnGo {
/* 0x390 */ u16 actionFlags;
/* 0x392 */ u16 lastTextId;
/* 0x394 */ u8 springArrivalCueId;
- /* 0x398 */ f32 curAnimPlaySpeed;
+ /* 0x398 */ f32 animPlaySpeed;
/* 0x39C */ f32 iceBlockScale;
/* 0x3A0 */ f32 iceBlockAlpha;
/* 0x3A4 */ f32 scaleFactor;
@@ -132,7 +132,7 @@ typedef struct EnGo {
/* 0x3CE */ s16 fidgetTableY[ENGO_FIDGET_TABLE_LEN];
/* 0x3D4 */ s16 surprisePhase;
/* 0x3D8 */ MsgEventFunc msgEventFunc;
- /* 0x3DC */ s32 curAnimIndex;
+ /* 0x3DC */ s32 animIndex;
/* 0x3E0 */ UNK_TYPE1 unk3E0[0x4];
/* 0x3E4 */ s32 indexPathPoint;
/* 0x3E8 */ s32 indexEffect;
diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
index 148b2d116..aa6eb041f 100644
--- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
+++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
@@ -674,6 +674,7 @@ void func_80940090(EnGoroiwa* this, PlayState* play) {
sp10C.x = this->actor.world.pos.x;
sp10C.y = this->actor.world.pos.y + this->unk_1DC;
sp10C.z = this->actor.world.pos.z;
+ //! FAKE:
if (1) {}
spD8 = spEC * 150.0f;
spA8 = 0x10000 / spD8;
@@ -1117,8 +1118,8 @@ void func_809419D0(EnGoroiwa* this) {
void func_80941A10(EnGoroiwa* this, PlayState* play) {
static EnGoroiwaUnkFunc D_80942E94[] = {
- &func_8093F498,
- &func_8093F34C,
+ func_8093F498,
+ func_8093F34C,
};
static u16 D_80942E9C[][2] = {
{ NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG },
@@ -1507,6 +1508,9 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) {
this->actor.floorBgId = 50;
}
break;
+
+ default:
+ break;
}
func_8093FAA4(this, play);
diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c
index 3c0d97d20..90b39f860 100644
--- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c
+++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c
@@ -75,8 +75,9 @@ typedef enum {
/* 4 */ DRAGONFLY_ANIM_HOVER,
/* 5 */ DRAGONFLY_ANIM_DAMAGE,
/* 6 */ DRAGONFLY_ANIM_DEAD,
- /* 7 */ DRAGONFLY_ANIM_FALL
-} EnGrasshopperAnim;
+ /* 7 */ DRAGONFLY_ANIM_FALL,
+ /* 8 */ DRAGONFLY_ANIM_MAX
+} DragonflyAnimation;
static s32 sOccupiedIndices[] = {
false, false, false, false, false,
@@ -333,7 +334,7 @@ void EnGrasshopper_Destroy(Actor* thisx, PlayState* play) {
sOccupiedIndices[this->index] = false;
}
-static AnimationHeader* sAnimations[] = {
+static AnimationHeader* sAnimations[DRAGONFLY_ANIM_MAX] = {
&gDragonflyRaiseTailAnim, // DRAGONFLY_ANIM_RAISE_TAIL
&gDragonflyLowerTailAnim, // DRAGONFLY_ANIM_LOWER_TAIL
&gDragonflyFlyAnim, // DRAGONFLY_ANIM_FLY
@@ -344,7 +345,7 @@ static AnimationHeader* sAnimations[] = {
&gDragonflyFallAnim, // DRAGONFLY_ANIM_FALL
};
-static u8 sAnimationModes[] = {
+static u8 sAnimationModes[DRAGONFLY_ANIM_MAX] = {
ANIMMODE_ONCE, // DRAGONFLY_ANIM_RAISE_TAIL
ANIMMODE_ONCE, // DRAGONFLY_ANIM_LOWER_TAIL
ANIMMODE_LOOP, // DRAGONFLY_ANIM_FLY
@@ -358,15 +359,15 @@ static u8 sAnimationModes[] = {
void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) {
f32 morphFrames;
- this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]);
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
morphFrames = 0.0f;
if ((animIndex == DRAGONFLY_ANIM_ATTACK) || (animIndex == DRAGONFLY_ANIM_HOVER) ||
(animIndex == DRAGONFLY_ANIM_DAMAGE)) {
morphFrames = -3.0f;
}
- Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->endFrame, sAnimationModes[animIndex],
- morphFrames);
+ Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->animEndFrame,
+ sAnimationModes[animIndex], morphFrames);
}
void EnGrasshopper_RaiseTail(EnGrasshopper* this) {
@@ -389,7 +390,7 @@ void EnGrasshopper_LowerTail(EnGrasshopper* this) {
void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
- if (curFrame >= this->endFrame) {
+ if (curFrame >= this->animEndFrame) {
if (this->decision == DRAGONFLY_DECISION_ATTACK) {
EnGrasshopper_SetupAttack(this);
} else {
@@ -580,6 +581,9 @@ void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) {
this->actionFunc = EnGrasshopper_RoamInCircles;
}
break;
+
+ default:
+ break;
}
}
@@ -735,7 +739,7 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) {
Math_ApproachF(&this->actor.world.pos.y, this->targetApproachPos.y, 0.1f, this->approachSpeed);
Math_ApproachF(&this->approachSpeed, 10.0f, 0.1f, 1.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA);
- if (curFrame >= this->endFrame) {
+ if (curFrame >= this->animEndFrame) {
EnGrasshopper_SetupWaitAfterAttack(this);
}
}
@@ -831,7 +835,7 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) {
this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE;
}
- if (curFrame >= this->endFrame) {
+ if (curFrame >= this->animEndFrame) {
this->actor.flags &= ~ACTOR_FLAG_10;
EnGrasshopper_SetupFall(this);
}
diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h
index cf0e50cbe..a07091dd8 100644
--- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h
+++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h
@@ -91,7 +91,7 @@ typedef struct EnGrasshopper {
/* 0x035E */ s16 type;
/* 0x0360 */ f32 dragonflyScale;
/* 0x0364 */ f32 angularVelocity;
- /* 0x0368 */ f32 endFrame;
+ /* 0x0368 */ f32 animEndFrame;
/* 0x036C */ f32 approachSpeed;
/* 0x0370 */ f32 baseFlyHeight;
/* 0x0374 */ f32 targetPosY;
diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
index e3ddfee6a..55bd83106 100644
--- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c
+++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
@@ -250,6 +250,9 @@ void func_80997E4C(EnGs* this, PlayState* play) {
case ENGS_2:
this->unk_210 = this->unk_195 + 0x20F7;
break;
+
+ default:
+ break;
}
Message_ContinueTextbox(play, this->unk_210);
break;
@@ -260,6 +263,9 @@ void func_80997E4C(EnGs* this, PlayState* play) {
}
}
break;
+
+ default:
+ break;
}
}
@@ -329,6 +335,9 @@ void func_8099807C(EnGs* this, PlayState* play) {
func_809984F4(this, play);
}
break;
+
+ default:
+ break;
}
break;
@@ -339,6 +348,9 @@ void func_8099807C(EnGs* this, PlayState* play) {
case 26:
func_80997D14(this, play);
break;
+
+ default:
+ break;
}
}
@@ -444,6 +456,9 @@ void func_8099874C(EnGs* this, PlayState* play) {
case 4:
phi_v0 = func_809995A4(this, play);
break;
+
+ default:
+ break;
}
if (phi_v0 == 0) {
@@ -483,6 +498,9 @@ void func_8099874C(EnGs* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_77_20);
}
break;
+
+ default:
+ break;
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_10)) {
@@ -754,16 +772,16 @@ void func_80999584(Color_RGB8* arg0, Color_RGB8* arg1) {
}
s32 func_809995A4(EnGs* this, PlayState* play) {
- static Color_RGB8 flashColours[] = {
+ static Color_RGB8 sFlashColours[] = {
{ 255, 50, 50 },
{ 50, 50, 255 },
{ 255, 255, 255 },
};
- static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f };
- static Color_RGBA8 dustPrim = { 200, 200, 200, 128 };
- static Color_RGBA8 dustEnv = { 100, 100, 100, 0 };
- static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f };
- static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f };
+ static Vec3f sDustAccel = { 0.0f, -0.3f, 0.0f };
+ static Color_RGBA8 sDustPrimColor = { 200, 200, 200, 128 };
+ static Color_RGBA8 sDustEnvColor = { 100, 100, 100, 0 };
+ static Vec3f sBomb2Velocity = { 0.0f, 0.0f, 0.0f };
+ static Vec3f sBomb2Accel = { 0.0f, 0.0f, 0.0f };
s32 sp7C = -1;
if (this->unk_19D == 0) {
@@ -784,18 +802,18 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
u8 pad;
this->unk_1D4--;
- func_80999584(&this->unk_1FA, &flashColours[2]);
+ func_80999584(&this->unk_1FA, &sFlashColours[2]);
if (this->unk_1D4 < 80) {
if ((this->unk_1D4 % 20) < 8) {
if (this->unk_1D4 < 20) {
if ((this->unk_1D4 % 20) == 7) {
- func_80999584(&this->unk_1FA, &flashColours[0]);
+ func_80999584(&this->unk_1FA, &sFlashColours[0]);
this->unk_1F4 = this->unk_1FA;
Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_E);
this->unk_200 = 0.0f;
}
} else if ((this->unk_1D4 % 20) == 7) {
- func_80999584(&this->unk_1FA, &flashColours[1]);
+ func_80999584(&this->unk_1FA, &sFlashColours[1]);
this->unk_1F4 = this->unk_1FA;
Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_N);
this->unk_200 = 0.0f;
@@ -826,7 +844,8 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
sp6C.y = this->actor.world.pos.y + 7.0f;
sp6C.z = this->actor.world.pos.z + (2.0f * sp60.z);
- func_800B0EB0(play, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, 15);
+ func_800B0EB0(play, &sp6C, &sp60, &sDustAccel, &sDustPrimColor, &sDustEnvColor,
+ Rand_ZeroFloat(50.0f) + 200.0f, 40, 15);
}
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG);
@@ -856,7 +875,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
sp54.y = this->actor.world.pos.y;
sp54.z = this->actor.world.pos.z;
Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
- EffectSsBomb2_SpawnLayered(play, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20);
+ EffectSsBomb2_SpawnLayered(play, &sp54, &sBomb2Velocity, &sBomb2Accel, 100, 20);
this->unk_1D4 = 10;
this->unk_19A |= 8;
this->unk_216 = 0;
diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
index d51cf7703..7fcf32bf4 100644
--- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
+++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
@@ -61,18 +61,32 @@ s32 sGuardCount = 0;
s32 D_80ABBE20 = 0;
-static u16 sTextIDs[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C };
+static u16 sTextIds[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C };
s16 D_80ABBE38[] = { 0x0000, 0x0000, 0x0002, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0002 };
-static AnimationHeader* sAnimations[] = {
- &gDekuPalaceGuardWaitAnim,
- &gDekuPalaceGuardWalkAnim,
- &gDekuPalaceGuardDigAnim,
- &gDekuPalaceGuardWalkAnim,
+typedef enum {
+ /* -1 */ GUARD_NUTS_ANIM_NONE = -1,
+ /* 0 */ GUARD_NUTS_ANIM_WAIT_HEAD_TILT,
+ /* 1 */ GUARD_NUTS_ANIM_WALK,
+ /* 2 */ GUARD_NUTS_ANIM_DIG,
+ /* 3 */ GUARD_NUTS_ANIM_WALK_2,
+ /* 4 */ GUARD_NUTS_ANIM_MAX
+} EnGuardNutsAnimation;
+
+static AnimationHeader* sAnimations[GUARD_NUTS_ANIM_MAX] = {
+ &gDekuPalaceGuardWaitAnim, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT
+ &gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK
+ &gDekuPalaceGuardDigAnim, // GUARD_NUTS_ANIM_DIG
+ &gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK_2
};
-static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE };
+static u8 sAnimationModes[GUARD_NUTS_ANIM_MAX] = {
+ ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT
+ ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WALK
+ ANIMMODE_ONCE, // GUARD_NUTS_ANIM_DIG
+ ANIMMODE_ONCE, // GUARD_NUTS_ANIM_WALK_2
+};
static TexturePtr sEyeTextures[] = {
gDekuPalaceGuardEyeOpenTex,
@@ -80,13 +94,6 @@ static TexturePtr sEyeTextures[] = {
gDekuPalaceGuardEyeClosedTex,
};
-typedef enum {
- /* 0 */ WAIT_HEAD_TILT_ANIM,
- /* 1 */ WALK_ANIM,
- /* 2 */ DIG_ANIM,
- /* 3 */ WALK_ANIM_2
-} EnGuardNutsAnim;
-
typedef enum {
/* 0 */ GUARD_NUTS_WAIT_STATE,
/* 1 */ GUARD_NUTS_TALKING_STATE,
@@ -123,20 +130,20 @@ void EnGuardNuts_Destroy(Actor* thisx, PlayState* play) {
}
/**
- * @brief Changes the animation to the provided index. Updates animIndex and animFrameCount for the animation.
+ * @brief Changes the animation to the provided index. Updates animIndex and animEndFrame for the animation.
*
* @param this
* @param animIndex the index of sAnimations to change to
*/
void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 animIndex) {
this->animIndex = animIndex;
- this->animFrameCount = Animation_GetLastFrame(sAnimations[this->animIndex]);
- Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animFrameCount,
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]);
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], -2.0f);
}
void EnGuardNuts_SetupWait(EnGuardNuts* this) {
- EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM);
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT);
this->state = GUARD_NUTS_WAIT_STATE;
this->actionFunc = EnGuardNuts_Wait;
}
@@ -169,22 +176,22 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) {
// No place for an outsider
this->guardTextIndex = 3;
}
- this->actor.textId = sTextIDs[this->guardTextIndex];
+ this->actor.textId = sTextIds[this->guardTextIndex];
phi_a1 = this->actor.world.rot.y;
if (D_80ABBE20 == 2) {
EnGuardNuts_Burrow(this, play);
return;
}
if (D_80ABBE20 == 1) {
- if (this->animIndex != WALK_ANIM) {
- EnGuardNuts_ChangeAnim(this, WALK_ANIM);
+ if (this->animIndex != GUARD_NUTS_ANIM_WALK) {
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK);
}
phi_a1 = (this->actor.home.rot.y + 0x8000);
}
if (fabsf((f32)(this->actor.shape.rot.y - phi_a1)) < 100.0f) {
this->actor.shape.rot.y = phi_a1;
- if ((D_80ABBE20 == 1) && (this->animIndex != WALK_ANIM_2)) {
- EnGuardNuts_ChangeAnim(this, WALK_ANIM_2);
+ if ((D_80ABBE20 == 1) && (this->animIndex != GUARD_NUTS_ANIM_WALK_2)) {
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK_2);
}
} else {
Math_SmoothStepToS(&this->actor.shape.rot.y, phi_a1, 1, 0xBB8, 0);
@@ -199,7 +206,7 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) {
}
void func_80ABB540(EnGuardNuts* this) {
- EnGuardNuts_ChangeAnim(this, WALK_ANIM);
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK);
this->targetHeadPos.x = this->targetHeadPos.y = 0;
this->timer = 16;
this->state = GUARD_NUTS_TALKING_STATE;
@@ -216,7 +223,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
if (fabsf((this->actor.shape.rot.y - yaw)) < 100.0f) {
this->actor.shape.rot.y = yaw;
curFrame = this->skelAnime.curFrame;
- if ((curFrame < this->animFrameCount) || (this->guardTextIndex >= 7)) {
+ if ((curFrame < this->animEndFrame) || (this->guardTextIndex >= 7)) {
SkelAnime_Update(&this->skelAnime);
}
} else {
@@ -226,8 +233,8 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) {
this->targetHeadPos.y = 0;
this->targetHeadPos.x = 0;
- if ((this->guardTextIndex == 3) && (this->animIndex == WAIT_HEAD_TILT_ANIM)) {
- EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM);
+ if ((this->guardTextIndex == 3) && (this->animIndex == GUARD_NUTS_ANIM_WAIT_HEAD_TILT)) {
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT);
}
if (Message_ShouldAdvance(play)) {
if (D_80ABBE38[this->guardTextIndex] != 1) {
@@ -238,7 +245,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
EnGuardNuts_Burrow(this, play);
} else {
this->guardTextIndex++;
- Message_StartTextbox(play, sTextIDs[this->guardTextIndex], &this->actor);
+ Message_StartTextbox(play, sTextIds[this->guardTextIndex], &this->actor);
if (D_80ABBE38[this->guardTextIndex] == 2) {
D_80ABBE20 = 1;
}
@@ -271,7 +278,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play) {
Vec3f digPos;
- EnGuardNuts_ChangeAnim(this, DIG_ANIM);
+ EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_DIG);
Math_Vec3f_Copy(&digPos, &this->actor.world.pos);
digPos.y = this->actor.floorHeight;
EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
@@ -287,7 +294,7 @@ void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
- if (this->animFrameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
this->state = GUARD_NUTS_BURROWED_STATE;
this->actionFunc = EnGuardNuts_Unburrow;
this->actor.world.rot.y = this->actor.home.rot.y;
@@ -327,7 +334,7 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) {
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
}
- if ((this->animIndex == WALK_ANIM) &&
+ if ((this->animIndex == GUARD_NUTS_ANIM_WALK) &&
(Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f))) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK);
}
diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h
index 8cbe26f03..e07e70eaf 100644
--- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h
+++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h
@@ -25,7 +25,7 @@ typedef struct EnGuardNuts {
/* 0x228 */ Vec3f guardPos;
/* 0x234 */ Vec3s headRot;
/* 0x23A */ Vec3s targetHeadPos;
- /* 0x240 */ f32 animFrameCount;
+ /* 0x240 */ f32 animEndFrame;
/* 0x244 */ ColliderCylinder collider;
} EnGuardNuts; // size = 0x290
diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
index 28b37cc91..92afb3083 100644
--- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
+++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
@@ -5,7 +5,6 @@
*/
#include "z_en_guruguru.h"
-#include "objects/object_fu/object_fu.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@@ -62,9 +61,27 @@ static ColliderCylinderInit sCylinderInit = {
{ 15, 20, 0, { 0, 0, 0 } },
};
-static AnimationHeader* sAnimations[] = { &gGuruGuruPlayStillAnim, &gGuruGuruPlayAndMoveHeadAnim };
-static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP };
-static f32 sPlaySpeeds[] = { 1.0f, 1.0f };
+typedef enum {
+ /* 0 */ GURU_GURU_ANIM_PLAY_STILL,
+ /* 1 */ GURU_GURU_ANIM_PLAY_MOVE_HEAD,
+ /* 2 */ GURU_GURU_ANIM_MAX
+} GuruGuruAnimation;
+
+static AnimationHeader* sAnimations[GURU_GURU_ANIM_MAX] = {
+ &gGuruGuruPlayStillAnim, // GURU_GURU_ANIM_PLAY_STILL
+ &gGuruGuruPlayAndMoveHeadAnim, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
+};
+
+static u8 sAnimationModes[GURU_GURU_ANIM_MAX] = {
+ ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_STILL
+ ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
+};
+
+static f32 sPlaySpeeds[GURU_GURU_ANIM_MAX] = {
+ 1.0f, // GURU_GURU_ANIM_PLAY_STILL
+ 1.0f, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
+};
+
static TexturePtr sEyeTextures[] = { gGuruGuruEyeClosedTex, gGuruGuruEyeAngryTex };
static TexturePtr sMouthTextures[] = { gGuruGuruMouthOpenTex, gGuruGuruMouthAngryTex };
@@ -74,7 +91,7 @@ void EnGuruguru_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gGuruGuruSkel, &gGuruGuruPlayStillAnim, this->jointTable,
- this->morphTable, 16);
+ this->morphTable, GURU_GURU_LIMB_MAX);
this->actor.targetMode = TARGET_MODE_0;
if (this->actor.params != 2) {
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@@ -106,8 +123,8 @@ void EnGuruguru_Destroy(Actor* thisx, PlayState* play) {
}
void EnGuruguru_ChangeAnim(EnGuruguru* this, s32 animIndex) {
- this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]);
- Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->frameCount,
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
+ Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->animEndFrame,
sAnimationModes[animIndex], -4.0f);
}
@@ -115,7 +132,7 @@ void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play) {
}
void func_80BC6E10(EnGuruguru* this) {
- EnGuruguru_ChangeAnim(this, 0);
+ EnGuruguru_ChangeAnim(this, GURU_GURU_ANIM_PLAY_STILL);
this->textIdIndex = 0;
this->unk270 = 0;
if (this->actor.params == 0) {
@@ -373,7 +390,7 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) {
s32 EnGuruguru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnGuruguru* this = THIS;
- if (limbIndex == 14) {
+ if (limbIndex == GURU_GURU_LIMB_HEAD) {
rot->x += this->headXRot;
rot->z += this->headZRot;
}
diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h
index 0158e3ddc..4913d4124 100644
--- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h
+++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h
@@ -2,6 +2,7 @@
#define Z_EN_GURUGURU_H
#include "global.h"
+#include "objects/object_fu/object_fu.h"
struct EnGuruguru;
@@ -10,8 +11,8 @@ typedef void (*EnGuruguruActionFunc)(struct EnGuruguru*, PlayState*);
typedef struct EnGuruguru {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s jointTable[16];
- /* 0x1E8 */ Vec3s morphTable[16];
+ /* 0x188 */ Vec3s jointTable[GURU_GURU_LIMB_MAX];
+ /* 0x1E8 */ Vec3s morphTable[GURU_GURU_LIMB_MAX];
/* 0x248 */ EnGuruguruActionFunc actionFunc;
/* 0x24C */ s16 headZRot;
/* 0x24E */ s16 headXRot;
@@ -22,7 +23,7 @@ typedef struct EnGuruguru {
/* 0x264 */ s16 unusedTimer; // set to 6 and decremented, but never has any effect
/* 0x266 */ s16 unk266;
/* 0x268 */ s16 unk268;
- /* 0x26C */ f32 frameCount;
+ /* 0x26C */ f32 animEndFrame;
/* 0x270 */ u8 unk270;
/* 0x272 */ s16 unk272; // set, but never used
/* 0x274 */ s16 textIdIndex;
diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c
index 20be1b6c8..7e30676e2 100644
--- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c
+++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c
@@ -631,7 +631,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
- this->cutsceneAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE;
+ this->csAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE;
if (this->drum != NULL) {
Actor_Kill(this->drum);
this->drum = NULL;
@@ -639,50 +639,49 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
break;
case 2:
- this->cutsceneAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM;
+ this->csAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM;
break;
case 3:
- this->cutsceneAnimIndex = EN_JG_ANIM_DRUM_IDLE;
+ this->csAnimIndex = EN_JG_ANIM_DRUM_IDLE;
break;
case 4:
- this->cutsceneAnimIndex = EN_JG_ANIM_PLAYING_DRUM;
+ this->csAnimIndex = EN_JG_ANIM_PLAYING_DRUM;
break;
case 5:
- this->cutsceneAnimIndex = EN_JG_ANIM_THINKING;
+ this->csAnimIndex = EN_JG_ANIM_THINKING;
break;
case 6:
- this->cutsceneAnimIndex = EN_JG_ANIM_REMEMBERING;
+ this->csAnimIndex = EN_JG_ANIM_REMEMBERING;
break;
case 7:
- this->cutsceneAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING;
+ this->csAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING;
break;
case 8:
- this->cutsceneAnimIndex = EN_JG_ANIM_DEPRESSED;
+ this->csAnimIndex = EN_JG_ANIM_DEPRESSED;
break;
case 9:
- this->cutsceneAnimIndex = EN_JG_ANIM_CRADLE;
+ this->csAnimIndex = EN_JG_ANIM_CRADLE;
break;
default:
- this->cutsceneAnimIndex = EN_JG_ANIM_IDLE;
+ this->csAnimIndex = EN_JG_ANIM_IDLE;
break;
}
- SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->cutsceneAnimIndex);
+ SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
if (!(this->flags & FLAG_DRUM_SPAWNED) &&
- (((this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && Animation_OnFrame(&this->skelAnime, 14.0f) &&
+ (((this->csAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && Animation_OnFrame(&this->skelAnime, 14.0f) &&
(this->action != EN_JG_ACTION_LULLABY_INTRO_CS)) ||
- (((this->cutsceneAnimIndex == EN_JG_ANIM_DRUM_IDLE) ||
- (this->cutsceneAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) &&
+ (((this->csAnimIndex == EN_JG_ANIM_DRUM_IDLE) || (this->csAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) &&
(this->action == EN_JG_ACTION_LULLABY_INTRO_CS)))) {
this->flags |= FLAG_DRUM_SPAWNED;
this->drum = Actor_SpawnAsChildAndCutscene(
@@ -691,7 +690,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
this->actor.params, this->actor.csId, this->actor.halfDaysBits, NULL);
}
- if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) {
+ if (this->csAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) {
if (Animation_OnFrame(&this->skelAnime, 23.0f)) {
Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_WOOD_BOUND_S);
} else if (Animation_OnFrame(&this->skelAnime, 38.0f)) {
diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.h b/src/overlays/actors/ovl_En_Jg/z_en_jg.h
index b63f34dce..30c84973c 100644
--- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h
+++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h
@@ -35,7 +35,7 @@ typedef struct EnJg {
/* 0x3B0 */ Vec3f breathVelocity;
/* 0x3BC */ Vec3f breathAccel;
/* 0x3C8 */ s16 csId;
- /* 0x3CA */ u8 cutsceneAnimIndex;
+ /* 0x3CA */ u8 csAnimIndex;
/* 0x3CB */ u8 cueId;
/* 0x3CC */ u16 flags;
/* 0x3CE */ u16 textId;
diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
index 694b9271d..b5819e333 100644
--- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
+++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
@@ -17,7 +17,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play);
void EnKgy_Update(Actor* thisx, PlayState* play);
void EnKgy_Draw(Actor* thisx, PlayState* play);
-void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames);
+void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames);
EnKbt* EnKgy_FindZubora(PlayState* play);
ObjIcePoly* EnKgy_FindIceBlock(PlayState* play);
void func_80B40D30(PlayState* play);
@@ -109,7 +109,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
}
-void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames) {
+void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) {
static AnimationHeader* sAnimations[] = {
&object_kgy_Anim_004B98, &object_kgy_Anim_0008FC, &object_kgy_Anim_00292C, &object_kgy_Anim_0042E4,
&object_kgy_Anim_0101F0, &object_kgy_Anim_001764, &object_kgy_Anim_003334, &object_kgy_Anim_010B84,
@@ -117,7 +117,7 @@ void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames) {
};
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
+ Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
this->unk_2D2 = animIndex;
}
diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c
index 04b5b73b8..8113526f2 100644
--- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c
+++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c
@@ -147,11 +147,11 @@ TexturePtr sMonkeyFaceTextures[] = {
object_mnk_Tex_017120, object_mnk_Tex_017920, object_mnk_Tex_018120,
};
-void EnMnk_MonkeyTiedUp_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
+void EnMnk_MonkeyTiedUp_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sMonkeyTiedUpAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(&sMonkeyTiedUpAnimations[animIndex]->common), mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyTiedUpAnimations[animIndex]->common), animMode, morphFrames);
Animation_Change(&this->propSkelAnime, sMonkeyTiedUpPoleAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(&sMonkeyTiedUpPoleAnimations[animIndex]->common), mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyTiedUpPoleAnimations[animIndex]->common), animMode, morphFrames);
switch (animIndex) {
case MONKEY_TIEDUP_ANIM_KICKAROUND:
@@ -184,11 +184,11 @@ void EnMnk_MonkeyTiedUp_SetNewAnim(EnMnk* this, s32 animIndex) {
}
}
-void EnMnk_MonkeyHanging_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
+void EnMnk_MonkeyHanging_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sMonkeyHangingAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(&sMonkeyHangingAnimations[animIndex]->common), mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyHangingAnimations[animIndex]->common), animMode, morphFrames);
Animation_Change(&this->propSkelAnime, sMonkeyHangingRopeAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(&sMonkeyHangingRopeAnimations[animIndex]->common), mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyHangingRopeAnimations[animIndex]->common), animMode, morphFrames);
this->animIndex = animIndex;
}
@@ -196,7 +196,7 @@ void EnMnk_MonkeyHanging_SetAnim(EnMnk* this, s32 animIndex) {
EnMnk_MonkeyHanging_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f);
}
-void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
+void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
s32 pad;
if (animIndex == 100) {
@@ -204,10 +204,10 @@ void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrame
}
if ((animIndex == 4) || (animIndex == 6)) {
Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], -1.0f,
- Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), 0.0f, mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), 0.0f, animMode, morphFrames);
} else {
Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], 1.0f, 0.0f,
- Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), mode, morphFrames);
+ Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), animMode, morphFrames);
}
this->unk_3E0 = 0;
this->animIndex = animIndex;
diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
index ad20b3d07..9aa218e2f 100644
--- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
+++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
@@ -1182,37 +1182,40 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) {
this->cueId = play->csCtx.actorCues[cueChannel]->id;
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_IDLE;
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_IDLE;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE);
break;
case 2:
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START;
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START;
Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_START);
break;
case 3:
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION;
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_CONVULSION);
break;
case 4:
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START;
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_START);
break;
case 5:
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_WALK;
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_WALK;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK);
break;
+
+ default:
+ break;
}
} else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
- if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) {
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP;
+ if (this->csAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) {
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_LOOP);
- } else if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) {
- this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP;
+ } else if (this->csAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) {
+ this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_LOOP);
EnRailgibud_SetupSinkIntoGround(this);
}
diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h
index 42b41ed8a..c9536d235 100644
--- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h
+++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h
@@ -52,7 +52,7 @@ typedef struct EnRailgibud {
/* 0x3EE */ s16 shouldWalkForwardNextFrame; // Only used by the "main" Gibdo
/* 0x3F0 */ union {
s16 grabState;
- s16 cutsceneAnimIndex;
+ s16 csAnimIndex;
};
/* 0x3F2 */ union {
s16 playerStunWaitTimer; // Cannot stun the player if this is non-zero
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 729e8bb1b..a78a55e4f 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -7580,8 +7580,8 @@
0x80949BD4:("EnClearTag_DrawEffects",),
0x8094DEE0:("func_8094DEE0",),
0x8094DF90:("func_8094DF90",),
- 0x8094DFF8:("func_8094DFF8",),
- 0x8094E054:("func_8094E054",),
+ 0x8094DFF8:("EnGm_UpdateSkelAnime",),
+ 0x8094E054:("EnGm_ChangeAnim",),
0x8094E0F8:("func_8094E0F8",),
0x8094E1DC:("func_8094E1DC",),
0x8094E278:("func_8094E278",),
@@ -9696,7 +9696,7 @@
0x80A12774:("EnGo_UpdateTalking",),
0x80A12868:("EnGo_DetectCollisions",),
0x80A12954:("EnGo_UpdateSpringArrivalCutscene",),
- 0x80A12A64:("EnGo_UpdateAnimationToCurrent",),
+ 0x80A12A64:("EnGo_UpdateSkelAnime",),
0x80A12B78:("EnGo_UpdateSfx",),
0x80A12C48:("EnGo_ChangeAnim",),
0x80A12D6C:("EnGo_UpdateEyes",),
@@ -15302,8 +15302,8 @@
0x80BB1C8C:("func_80BB1C8C",),
0x80BB1D04:("func_80BB1D04",),
0x80BB1D64:("func_80BB1D64",),
- 0x80BB1FCC:("func_80BB1FCC",),
- 0x80BB2020:("func_80BB2020",),
+ 0x80BB1FCC:("EnGeg_UpdateSkelAnime",),
+ 0x80BB2020:("EnGeg_ChangeAnim",),
0x80BB2088:("func_80BB2088",),
0x80BB217C:("func_80BB217C",),
0x80BB221C:("func_80BB221C",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index d0aa85def..c5d4d208f 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -14133,7 +14133,7 @@
0x80B3A9E4:("D_80B3A9E4","f32","",0x4),
0x80B3A9E8:("D_80B3A9E8","f32","",0x4),
0x80B3BEE0:("En_Gg2_InitVars","UNK_TYPE1","",0x1),
- 0x80B3BF00:("D_80B3BF00","UNK_TYPE4","",0x4),
+ 0x80B3BF00:("sAnimationInfo","UNK_TYPE4","",0x4),
0x80B3C080:("D_80B3C080","UNK_TYPE4","",0x4),
0x80B3C084:("D_80B3C084","UNK_TYPE4","",0x4),
0x80B3C088:("D_80B3C088","UNK_TYPE1","",0x1),
From 0387f6c687e8f73ff09b4ebfc9e975a20e6eca87 Mon Sep 17 00:00:00 2001
From: Parker B <20159000+jpburnett@users.noreply.github.com>
Date: Thu, 28 Sep 2023 00:13:58 -0700
Subject: [PATCH 29/51] add more matches and fill stuct
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 140 +++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 15 +-
2 files changed, 142 insertions(+), 13 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 59894b02e..22fa25a91 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -515,14 +515,68 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
}
}
-void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07700.s")
+void func_80B07700(BossHakugin *this, PlayState *play, s32 arg2) {
+ Vec3f vel;
+ Vec3f pos;
+
+ if (arg2 != 0) {
+ vel.y = (this->unk_019C - 0x1E) * ( 1 / 70.0f );
+ } else {
+ vel.y = 0.1f;
+ }
+
+ vel.x = Rand_CenteredFloat(2.0f) * vel.y;
+ vel.z = Rand_CenteredFloat(2.0f) * vel.y;
+
+ pos.x = ((vel.x >= 0.0f ? 1.0f : -1.0f) * (Rand_ZeroFloat(20.0f) + 5.0f) * 4.0f) + this->unk_0964.dim.pos.x;
+ pos.z = ((vel.z >= 0.0f ? 1.0f : -1.0f) * (Rand_ZeroFloat(20.0f) + 5.0f) * 4.0f) + this->unk_0964.dim.pos.z;
+ if (arg2 != 0) {
+ pos.y = this->unk_0964.dim.pos.y + (this->unk_0964.dim.height * vel.y);
+ } else {
+ pos.y = (Rand_ZeroFloat(this->unk_0964.dim.height) * 0.8f) + this->unk_0964.dim.pos.y;
+ }
+ vel.y += 0.8f;
+
+ EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 0x258);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0791C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07B88.s")
+void func_80B07B88(BossHakugin *this, PlayState *play) {
+ if (this->unk_0196 == 0xA) {
+ this->unk_0196 = 0;
+ this->unk_01E4 = 0.0f;
+ Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 0xF, 3, 0.7f, 0.5f);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B07BFC.s")
+void func_80B07BFC(BossHakugin *this, PlayState *play, s32 arg2) {
+ ColliderJntSphElement *temp_v0_2;
+ ColliderJntSphElement *temp_v0_3;
+
+ if (this->actor.colChkInfo.damageEffect == 0x2) {
+ this->unk_0196 = 0;
+ this->unk_01E4 = 3.0f;
+ this->unk_01DC = 2.5f;
+ } else if (this->actor.colChkInfo.damageEffect == 0x4) {
+ this->unk_0196 = 0x14;
+ this->unk_01E4 = 3.0f;
+ this->unk_01DC = 2.5f;
+ temp_v0_2 = &this->unk_0484.elements[arg2];
+ Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_2->info.bumper.hitPos.x, temp_v0_2->info.bumper.hitPos.y, temp_v0_2->info.bumper.hitPos.z, 0, 0, 0, 4);
+ } else if (this->actor.colChkInfo.damageEffect == 0x3) {
+ this->unk_0196 = 0xA;
+ this->unk_01DC = 2.5f;
+ this->unk_01E0 = 3.75f;
+ this->unk_01E4 = 1.0f;
+ } else if (this->actor.colChkInfo.damageEffect == 0xD) {
+ this->unk_0196 = 0x15;
+ this->unk_01DC = 2.5f;
+ this->unk_01E4 = 3.0f;
+ temp_v0_3 = &this->unk_0484.elements[arg2];
+ Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_3->info.bumper.hitPos.x, temp_v0_3->info.bumper.hitPos.y, temp_v0_3->info.bumper.hitPos.z, 0, 0, 3, 4);
+ }
+}
void func_80B07DA4(BossHakugin* this, PlayState* play, f32 arg2, s16 arg3) {
Camera* camera = Play_GetCamera(play, this->unk_01AC);
@@ -849,13 +903,83 @@ void func_80B08C1C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B091D8.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B093C0.s")
+void func_80B093C0(BossHakugin *this) {
+ f32 sp24;
+
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060134D0, -3.0f);
+ this->unk_0484.base.atFlags &= 0xFFFE;
+ this->unk_0484.base.acFlags &= 0xFFFB;
+ this->unk_01A6 = 0;
+ this->unk_0195 = 0;
+ this->unk_01C8 = 0.0f;
+ if (this->unk_0192 == 1) {
+ Math_Vec3f_Copy(&this->unk_3734, &this->unk_0380);
+ this->unk_01B8 = this->actor.speed + 100.0f;
+ sp24 = Math_CosS(0xA00);
+ this->unk_37AC = Math_SinS(this->actor.shape.rot.y) * sp24;
+ this->unk_37B0 = Math_SinS(0xA00);
+ sp24 = Math_CosS(0xA00);
+ this->unk_37B4 = Math_CosS(this->actor.shape.rot.y) * sp24;
+ this->unk_0192 = 2;
+ this->unk_01C8 = 0.0f;
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_E_BALL_THR);
+ this->unk_37B8.base.atFlags |= 1;
+ }
+ this->unk_019C = 0x3C;
+ this->actor.speed = 20.0f;
+ this->actionFunc = func_80B094E0;
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B094E0.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09840.s")
+void func_80B09840(BossHakugin *this, PlayState *play) {
+ Player* player = GET_PLAYER(play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B098BC.s")
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0600319C, -10.0f);
+ player->actor.parent = &this->actor;
+ this->unk_0484.base.atFlags &= 0xFFFE;
+ this->unk_0484.base.ocFlags1 &= 0xFFFE;
+ this->unk_019C = 0xA;
+ this->actionFunc = func_80B098BC;
+}
+
+void func_80B098BC(BossHakugin *this, PlayState *play) {
+ Player *player = GET_PLAYER(play);
+ s16 sp32;
+ f32 sp2C;
+
+ SkelAnime_Update(&this->skelAnime);
+ Math_StepToF(&this->actor.speed, 0.0f, 2.0f);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_01A0, 5, 0x800, 0x100);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ if (this->unk_019C < 10) {
+ this->unk_019C--;
+ if (this->unk_019C == 0) {
+ this->unk_0484.base.atFlags |= 1;
+ this->unk_0484.base.ocFlags1 |= 1;
+ func_80B08C1C(this);
+ }
+ } else {
+ if (Math_ScaledStepToS(&this->unk_01A6, -0x800, 0x1C0) != 0) {
+ player->actionVar2 = 0x64;
+ player->actor.parent = NULL;
+ player->invincibilityTimer = 0;
+ player->actor.shape.rot.x = 0;
+ func_800B8D50(play, &this->actor, 10.0f, (this->actor.shape.rot.y + 0x8000), 15.0f, 0x10);
+ player->actor.world.pos.y += 30.0f;
+ this->unk_019C--;
+ } else {
+ player->actionVar2 = 0;
+ sp32 = -this->unk_0374.z + 0x1F40;
+ player->actor.shape.rot.x = -this->unk_0374.z + 0x8FC0;
+
+ sp2C = Math_CosS(sp32);
+ player->actor.world.pos.x = this->actor.focus.pos.x - (Math_SinS(this->unk_01A0) * (20.0f * sp2C));
+ player->actor.world.pos.y = this->actor.focus.pos.y - (Math_SinS(sp32) * 20.0f);
+ player->actor.world.pos.z = this->actor.focus.pos.z - (Math_CosS(this->unk_01A0) * (20.0f * sp2C));
+ }
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09A94.s")
@@ -1221,4 +1345,4 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E548.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E5A4.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E5A4.s")
\ No newline at end of file
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index ce1cf637d..dff5df74e 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -39,9 +39,10 @@ typedef struct BossHakugin {
/* 0x018E */ char unk_018E[2];
/* 0x0190 */ u8 unk_0190; // boolean?
/* 0x0191 */ u8 unk_0191;
- /* 0x0192 */ char unk_0192[0x1];
+ /* 0x0192 */ u8 unk_0192;
/* 0x0193 */ u8 unk_0193;
- /* 0x0194 */ char unk_0194[2];
+ /* 0x0194 */ u8 unk_0194;
+ /* 0x0194 */ u8 unk_0195;
/* 0x0196 */ u8 unk_0196;
/* 0x0197 */ char unk_0197[0x5];
/* 0x019C */ s16 unk_019C;
@@ -55,7 +56,8 @@ typedef struct BossHakugin {
/* 0x01AE */ char unk_01AE[0x2];
/* 0x01B0 */ u32 unk_01B0;
/* 0x01B4 */ s32 unk_01B4;
- /* 0x01B8 */ char unk_01B8[0xC];
+ /* 0x01B8 */ f32 unk_01B8;
+ /* 0x01BC */ char pad1BC[8];
/* 0x01C4 */ f32 unk_01C4;
/* 0x01C8 */ f32 unk_01C8;
/* 0x01CC */ char unk_01CC[0x8];
@@ -86,8 +88,11 @@ typedef struct BossHakugin {
/* 0x2618 */ BossHakuginUnkStruct_2618 unk_2618[20];
/* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
/* 0x3734 */ Vec3f unk_3734;
- /* 0x3740 */ char unk_3740[0x78];
+ /* 0x3740 */ char pad3740[0x6C];
+ /* 0x37AC */ f32 unk_37AC;
+ /* 0x37B0 */ f32 unk_37B0;
+ /* 0x37B4 */ f32 unk_37B4;
/* 0x37B8 */ ColliderSphere unk_37B8;
} BossHakugin; // size = 0x3810
-#endif // Z_BOSS_HAKUGIN_H
+#endif // Z_BOSS_HAKUGIN_H
\ No newline at end of file
From 61b9d830436c643b2ccaf38d9bcce65bf0c08964 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 28 Sep 2023 08:30:43 -0700
Subject: [PATCH 30/51] 3 more Draw functions
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 150 +++++++++++++++---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 16 +-
2 files changed, 137 insertions(+), 29 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 22fa25a91..2d45a2621 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -10,6 +10,8 @@
#include "overlays/actors/ovl_En_Hakurock/z_en_hakurock.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((BossHakugin*)thisx)
@@ -236,6 +238,8 @@ extern TexturePtr D_80B0EA88;
extern s8 D_80B0EA8C[]; // sLimbToBodyParts
extern s8 D_80B0EAAC;
extern s32 D_80B0EAB0[5];
+extern Color_RGB8 D_80B0EACC;
+extern Color_RGB8 D_80B0EAD0;
extern s32 D_80B0EAD4;
extern InitChainEntry D_80B0EAD8[];
extern Vec3f D_80B0EAE8;
@@ -515,12 +519,12 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
}
}
-void func_80B07700(BossHakugin *this, PlayState *play, s32 arg2) {
+void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2) {
Vec3f vel;
Vec3f pos;
if (arg2 != 0) {
- vel.y = (this->unk_019C - 0x1E) * ( 1 / 70.0f );
+ vel.y = (this->unk_019C - 0x1E) * (1 / 70.0f);
} else {
vel.y = 0.1f;
}
@@ -536,13 +540,13 @@ void func_80B07700(BossHakugin *this, PlayState *play, s32 arg2) {
pos.y = (Rand_ZeroFloat(this->unk_0964.dim.height) * 0.8f) + this->unk_0964.dim.pos.y;
}
vel.y += 0.8f;
-
+
EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 0x258);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0791C.s")
-void func_80B07B88(BossHakugin *this, PlayState *play) {
+void func_80B07B88(BossHakugin* this, PlayState* play) {
if (this->unk_0196 == 0xA) {
this->unk_0196 = 0;
this->unk_01E4 = 0.0f;
@@ -550,9 +554,9 @@ void func_80B07B88(BossHakugin *this, PlayState *play) {
}
}
-void func_80B07BFC(BossHakugin *this, PlayState *play, s32 arg2) {
- ColliderJntSphElement *temp_v0_2;
- ColliderJntSphElement *temp_v0_3;
+void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
+ ColliderJntSphElement* temp_v0_2;
+ ColliderJntSphElement* temp_v0_3;
if (this->actor.colChkInfo.damageEffect == 0x2) {
this->unk_0196 = 0;
@@ -563,7 +567,8 @@ void func_80B07BFC(BossHakugin *this, PlayState *play, s32 arg2) {
this->unk_01E4 = 3.0f;
this->unk_01DC = 2.5f;
temp_v0_2 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_2->info.bumper.hitPos.x, temp_v0_2->info.bumper.hitPos.y, temp_v0_2->info.bumper.hitPos.z, 0, 0, 0, 4);
+ Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_2->info.bumper.hitPos.x, temp_v0_2->info.bumper.hitPos.y,
+ temp_v0_2->info.bumper.hitPos.z, 0, 0, 0, 4);
} else if (this->actor.colChkInfo.damageEffect == 0x3) {
this->unk_0196 = 0xA;
this->unk_01DC = 2.5f;
@@ -574,7 +579,8 @@ void func_80B07BFC(BossHakugin *this, PlayState *play, s32 arg2) {
this->unk_01DC = 2.5f;
this->unk_01E4 = 3.0f;
temp_v0_3 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_3->info.bumper.hitPos.x, temp_v0_3->info.bumper.hitPos.y, temp_v0_3->info.bumper.hitPos.z, 0, 0, 3, 4);
+ Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_3->info.bumper.hitPos.x, temp_v0_3->info.bumper.hitPos.y,
+ temp_v0_3->info.bumper.hitPos.z, 0, 0, 3, 4);
}
}
@@ -903,7 +909,7 @@ void func_80B08C1C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B091D8.s")
-void func_80B093C0(BossHakugin *this) {
+void func_80B093C0(BossHakugin* this) {
f32 sp24;
Animation_MorphToPlayOnce(&this->skelAnime, &D_060134D0, -3.0f);
@@ -913,7 +919,7 @@ void func_80B093C0(BossHakugin *this) {
this->unk_0195 = 0;
this->unk_01C8 = 0.0f;
if (this->unk_0192 == 1) {
- Math_Vec3f_Copy(&this->unk_3734, &this->unk_0380);
+ Math_Vec3f_Copy(&this->unk_3734[0], &this->unk_0380);
this->unk_01B8 = this->actor.speed + 100.0f;
sp24 = Math_CosS(0xA00);
this->unk_37AC = Math_SinS(this->actor.shape.rot.y) * sp24;
@@ -932,7 +938,7 @@ void func_80B093C0(BossHakugin *this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B094E0.s")
-void func_80B09840(BossHakugin *this, PlayState *play) {
+void func_80B09840(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Animation_MorphToPlayOnce(&this->skelAnime, &D_0600319C, -10.0f);
@@ -943,8 +949,8 @@ void func_80B09840(BossHakugin *this, PlayState *play) {
this->actionFunc = func_80B098BC;
}
-void func_80B098BC(BossHakugin *this, PlayState *play) {
- Player *player = GET_PLAYER(play);
+void func_80B098BC(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
s16 sp32;
f32 sp2C;
@@ -972,7 +978,7 @@ void func_80B098BC(BossHakugin *this, PlayState *play) {
player->actionVar2 = 0;
sp32 = -this->unk_0374.z + 0x1F40;
player->actor.shape.rot.x = -this->unk_0374.z + 0x8FC0;
-
+
sp2C = Math_CosS(sp32);
player->actor.world.pos.x = this->actor.focus.pos.x - (Math_SinS(this->unk_01A0) * (20.0f * sp2C));
player->actor.world.pos.y = this->actor.focus.pos.y - (Math_SinS(sp32) * 20.0f);
@@ -1135,14 +1141,112 @@ void func_80B0C570(BossHakugin* this, PlayState* play);
void func_80B0C7B0(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C7B0.s")
-void func_80B0CAF0(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CAF0.s")
+void func_80B0CAF0(BossHakugin* this, PlayState* play) {
+ BossHakuginUnkStruct_2618* iter;
+ s32 i;
-void func_80B0CCD8(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CCD8.s")
+ OPEN_DISPS(play->state.gfxCtx);
-void func_80B0CF24(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0CF24.s")
+ Gfx_SetupDL25_Xlu(play->state.gfxCtx);
+
+ gDPSetEnvColor(POLY_XLU_DISP++, D_80B0EAD0.r, D_80B0EAD0.g, D_80B0EAD0.b, 0);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningMaterialDL);
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
+ iter = &this->unk_2618[i];
+
+ if ((iter->unk_0C > 0) && (iter->unk_0C < 256)) {
+ Matrix_SetTranslateRotateYXZ(iter->unk_00.x, iter->unk_00.y, iter->unk_00.z, &iter->unk_0E);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, iter->unk_0C);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningModelDL);
+
+ Matrix_RotateZS(0x4000, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningModelDL);
+ }
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_80B0CCD8(BossHakugin* this, PlayState* play2) {
+ s32 pad[4];
+ PlayState* play = play2;
+ s32 end;
+ f32 scale;
+ s32 i;
+ s16 rotZ;
+ s32 alpha;
+ Vec3f* pos;
+
+ if (this->unk_0192 == 4) {
+ i = 9;
+ end = this->unk_01AA;
+ } else if (this->unk_01AA != 0) {
+ i = this->unk_01AA - 1;
+ end = 0;
+ } else {
+ return;
+ }
+
+ scale = 30.0f - ((i - 1) * 1.5f);
+ alpha = 215 - (i * 15);
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Xlu(play->state.gfxCtx);
+ gDPSetEnvColor(POLY_XLU_DISP++, D_80B0EACC.r, D_80B0EACC.g, D_80B0EACC.b, 0);
+
+ rotZ = this->unk_0198;
+
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightOrbMaterialDL);
+
+ for (; i >= end; i--) {
+ pos = &this->unk_3734[i];
+
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, alpha);
+ Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_NEW);
+ Matrix_ReplaceRotation(&play->billboardMtxF);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ Matrix_RotateZS(rotZ, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightOrbModelDL);
+
+ scale += 1.5f;
+ alpha += 15;
+ rotZ += 0x1000;
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_80B0CF24(BossHakugin* this, PlayState* play) {
+ s32 pad;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Xlu(play->state.gfxCtx);
+ func_800B8118(&this->actor, play, 0);
+ Matrix_Translate(this->unk_0964.dim.pos.x, this->unk_0964.dim.pos.y, this->unk_0964.dim.pos.z, MTXMODE_NEW);
+ Matrix_Scale(4.0f, this->unk_01D4, 4.0f, MTXMODE_APPLY);
+ Matrix_RotateYS(0xF00, MTXMODE_APPLY);
+ Matrix_RotateXS(0x500, MTXMODE_APPLY);
+ Matrix_RotateZS(-0x500, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames & 0xFF, 32, 16, 1, 0,
+ (play->gameplayFrames * 2) & 0xFF, 64, 32));
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_0193);
+ gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 pad;
@@ -1162,7 +1266,7 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
this->unk_01E0, this->unk_01E4, this->unk_0196);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_0380, &this->unk_0458);
- SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_3734, &this->unk_0464);
+ SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_3734[0], &this->unk_0464);
if (this->unk_0190 == 0) {
func_80B06F48(this, play);
@@ -1345,4 +1449,4 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E548.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E5A4.s")
\ No newline at end of file
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E5A4.s")
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index dff5df74e..e6a716022 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -20,7 +20,9 @@ typedef struct BossHakuginEffect {
#define BOSS_HAKUGIN_EFFECT_COUNT 180
typedef struct BossHakuginUnkStruct_2618 {
- /* 0x00 */ char unk_00[0x14];
+ /* 0x00 */ Vec3f unk_00;
+ /* 0x0C */ s16 unk_0C;
+ /* 0x0E */ Vec3s unk_0E;
/* 0x14 */ ColliderTris unk_14;
/* 0x34 */ ColliderTrisElement unk_34;
} BossHakuginUnkStruct_2618; // size = 0x90
@@ -44,14 +46,17 @@ typedef struct BossHakugin {
/* 0x0194 */ u8 unk_0194;
/* 0x0194 */ u8 unk_0195;
/* 0x0196 */ u8 unk_0196;
- /* 0x0197 */ char unk_0197[0x5];
+ /* 0x0197 */ char unk_0197[0x1];
+ /* 0x0198 */ s16 unk_0198;
+ /* 0x019A */ s16 unk_019A;
/* 0x019C */ s16 unk_019C;
/* 0x019E */ s16 unk_019E;
/* 0x01A0 */ s16 unk_01A0;
/* 0x01A2 */ s16 unk_01A2;
/* 0x01A4 */ s16 unk_01A4;
/* 0x01A6 */ s16 unk_01A6;
- /* 0x01A8 */ char unk_01A8[4];
+ /* 0x01A8 */ char unk_01A8[2];
+ /* 0x01AA */ s16 unk_01AA;
/* 0x01AC */ s16 unk_01AC;
/* 0x01AE */ char unk_01AE[0x2];
/* 0x01B0 */ u32 unk_01B0;
@@ -87,12 +92,11 @@ typedef struct BossHakugin {
/* 0x09F8 */ BossHakuginEffect unk_09F8[BOSS_HAKUGIN_EFFECT_COUNT];
/* 0x2618 */ BossHakuginUnkStruct_2618 unk_2618[20];
/* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
- /* 0x3734 */ Vec3f unk_3734;
- /* 0x3740 */ char pad3740[0x6C];
+ /* 0x3734 */ Vec3f unk_3734[10];
/* 0x37AC */ f32 unk_37AC;
/* 0x37B0 */ f32 unk_37B0;
/* 0x37B4 */ f32 unk_37B4;
/* 0x37B8 */ ColliderSphere unk_37B8;
} BossHakugin; // size = 0x3810
-#endif // Z_BOSS_HAKUGIN_H
\ No newline at end of file
+#endif // Z_BOSS_HAKUGIN_H
From 5e6edd3cfd89f6a0ec5f8f70d80871dd394ba441 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 28 Sep 2023 08:44:49 -0700
Subject: [PATCH 31/51] func_80B0E5A4
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 25 +++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 2d45a2621..dc9f94154 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -46,7 +46,7 @@ void func_80B09F7C(BossHakugin* this);
void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
-void func_80B0E5A4(BossHakugin* this, PlayState* play);
+void func_80B0E5A4(BossHakugin* this2, PlayState* play);
void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
@@ -1449,4 +1449,25 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E548.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E5A4.s")
+void func_80B0E5A4(BossHakugin* this2, PlayState* play) {
+ BossHakugin* this = this2;
+ s32 i;
+ BossHakuginEffect* effect;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Opa(play->state.gfxCtx);
+ gSPDisplayList(POLY_OPA_DISP++, gGohtRockMaterialDL);
+
+ for (i = 0; i < 36; i++) {
+ effect = &this->unk_09F8[i];
+
+ Matrix_SetTranslateRotateYXZ(effect->unk_0.x, effect->unk_0.y, effect->unk_0.z, &effect->unk_1C);
+ Matrix_Scale(effect->unk_24, effect->unk_24, effect->unk_24, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, gGohtRockModelDL);
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
From 0935a348721c179d6557831255c7e205997bdd6c Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 28 Sep 2023 15:19:39 -0700
Subject: [PATCH 32/51] Finshed the Draw functions
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 188 ++++++++++++++++--
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 9 +-
2 files changed, 181 insertions(+), 16 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index dc9f94154..bc55a385c 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -9,6 +9,7 @@
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Hakurock/z_en_hakurock.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
+#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -20,6 +21,7 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2);
void BossHakugin_Destroy(Actor* thisx, PlayState* play);
void BossHakugin_Update(Actor* thisx, PlayState* play);
void BossHakugin_Draw(Actor* thisx, PlayState* play);
+void func_80B0E5A4(Actor* thisx, PlayState* play);
void func_80B08018(BossHakugin* this, PlayState* play);
void func_80B0813C(BossHakugin* this, PlayState* play);
@@ -46,7 +48,6 @@ void func_80B09F7C(BossHakugin* this);
void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
-void func_80B0E5A4(BossHakugin* this2, PlayState* play);
void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
@@ -474,8 +475,68 @@ void func_80B06C08(BossHakugin* this);
void func_80B06D38(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06D38.s")
-void func_80B06F48(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06F48.s")
+void func_80B06F48(BossHakugin* this, PlayState* play) {
+ BossHakuginFhgFlashUnkStruct* iter;
+ BossHakuginFhgFlashUnkStruct* iter2;
+ BossHakuginFhgFlashUnkStruct* iter3;
+ Vec3f spA0;
+ s32 sp9C;
+ s32 var_s4;
+ s32 i;
+ s32 j;
+ s32 pad;
+
+ sp9C = this->unk_0191 + 3;
+ if (sp9C >= 15) {
+ sp9C = 0;
+ }
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_3158); i++) {
+ if (((15 - (3 * i)) < this->actor.colChkInfo.health) || !((1 << (D_80B0EAB0[i] + 0x1F)) & this->unk_01B0)) {
+ break;
+ }
+
+ iter3 = &this->unk_3158[i][sp9C];
+ iter2 = &this->unk_3158[i][this->unk_0191];
+
+ Math_Vec3f_Diff(&iter3->unk_00, &iter2->unk_00, &spA0);
+
+ spA0.y -= 3.5f;
+
+ var_s4 = Math3D_Vec3fMagnitude(&spA0) / 10.0f;
+ if (var_s4 >= 2) {
+ if (var_s4 >= 4) {
+ var_s4 = 3;
+ }
+ Math_Vec3f_Scale(&spA0, 1.0f / var_s4);
+ } else {
+ var_s4 = 1;
+ }
+
+ for (j = 0; j < var_s4; j++) {
+ iter = &this->unk_3158[i][this->unk_0191 + j];
+
+ iter->unk_00.x = Rand_CenteredFloat(20.0f) + (iter2->unk_00.x + (spA0.x * j));
+ iter->unk_00.y = Rand_CenteredFloat(20.0f) + (iter2->unk_00.y + (spA0.y * j));
+ iter->unk_00.z = Rand_CenteredFloat(20.0f) + (iter2->unk_00.z + (spA0.z * j));
+ iter->unk_0C = 0.01f;
+ iter->unk_10 = 150;
+ iter->unk_12 = 5 - j;
+ }
+
+ if ((play->gameplayFrames % 2) != 0) {
+ EffectSsFhgFlash_SpawnShock(play, &this->actor, &this->unk_3158[i][this->unk_0191].unk_00, 250,
+ i + FHGFLASH_SHOCK_GOHT_2);
+ }
+ }
+
+ sp9C = this->unk_0191 - 3;
+ if (sp9C < 0) {
+ this->unk_0191 = 12;
+ } else {
+ this->unk_0191 = sp9C;
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0728C.s")
@@ -1132,14 +1193,115 @@ void BossHakugin_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s
}
}
-void func_80B0C398(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C398.s")
+void func_80B0C398(BossHakugin* this, PlayState* play) {
+ BossHakuginEffect* effect;
+ s32 i;
-void func_80B0C570(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C570.s")
+ OPEN_DISPS(play->state.gfxCtx);
-void func_80B0C7B0(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0C7B0.s")
+ gSPDisplayList(POLY_OPA_DISP++, gGohtRockMaterialDL);
+ for (i = 0; i < ARRAY_COUNT(this->unk_09F8); i++) {
+ effect = &this->unk_09F8[i];
+ if ((effect->unk_18 >= 0) && (effect->unk_1A == 0)) {
+ Matrix_SetTranslateRotateYXZ(effect->unk_0.x, effect->unk_0.y, effect->unk_0.z, &effect->unk_1C);
+ Matrix_Scale(effect->unk_24, effect->unk_24, effect->unk_24, MTXMODE_APPLY);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, gGohtRockModelDL);
+ }
+ }
+
+ gSPDisplayList(POLY_OPA_DISP++, gGohtStalactiteMaterialDL);
+ for (i = 0; i < ARRAY_COUNT(this->unk_09F8); i++) {
+ effect = &this->unk_09F8[i];
+ if ((effect->unk_18 >= 0) && (effect->unk_1A == 1)) {
+ Matrix_SetTranslateRotateYXZ(effect->unk_0.x, effect->unk_0.y, effect->unk_0.z, &effect->unk_1C);
+ Matrix_Scale(effect->unk_24, effect->unk_24, effect->unk_24, MTXMODE_APPLY);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, gGohtStalactiteModelDL);
+ }
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_80B0C570(BossHakugin* this, PlayState* play) {
+ BossHakuginFhgFlashUnkStruct* iter;
+ s32 i;
+ s32 j;
+ s16 camYaw;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Xlu(play->state.gfxCtx);
+
+ gSPDisplayList(POLY_XLU_DISP++, gFrozenSteamMaterialDL);
+ camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000;
+ gDPSetEnvColor(POLY_XLU_DISP++, 1, 1, 1, 128);
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_3158); i++) {
+ for (j = 0; j < ARRAY_COUNT(this->unk_3158[0]); j++) {
+ iter = &this->unk_3158[i][j];
+ if (iter->unk_10 > 0) {
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, iter->unk_10);
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(play->state.gfxCtx, 0, iter->unk_12 * 3, iter->unk_12 * 15, 32, 64, 1, 0, 0,
+ 32, 32));
+ Matrix_Translate(iter->unk_00.x, iter->unk_00.y, iter->unk_00.z, MTXMODE_NEW);
+ Matrix_RotateYS(camYaw, MTXMODE_APPLY);
+ Matrix_Scale(iter->unk_0C, iter->unk_0C, 1.0f, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gFrozenSteamModelDL);
+ }
+ }
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void func_80B0C7B0(BossHakugin* this, PlayState* play) {
+ s32 pad;
+ s32 i;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ Gfx_SetupDL25_Xlu(play->state.gfxCtx);
+
+ if (this->unk_01C8 > 0.0f) {
+ gDPSetEnvColor(POLY_XLU_DISP++, D_80B0EAD0.r, D_80B0EAD0.g, D_80B0EAD0.b, 0);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningMaterialDL);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
+
+ for (i = -1; i <= 1; i += 2) {
+ Matrix_SetTranslateRotateYXZ(this->unk_0380.x, this->unk_0380.y, this->unk_0380.z, &this->unk_0374);
+ Matrix_RotateYS(0x1400 * i, MTXMODE_APPLY);
+ Matrix_RotateXS(0xC00 * i, MTXMODE_APPLY);
+ Matrix_RotateZS(this->unk_0198, MTXMODE_APPLY);
+ Matrix_Scale(0.62f, 0.62f, this->unk_01D0, MTXMODE_APPLY);
+ Matrix_Translate(0.0f, 0.0f, this->unk_01CC * i, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningModelDL);
+
+ Matrix_RotateZS(0x4000, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightningModelDL);
+ }
+
+ gDPPipeSync(POLY_XLU_DISP++);
+ gDPSetEnvColor(POLY_XLU_DISP++, D_80B0EACC.r, D_80B0EACC.g, D_80B0EACC.b, 0);
+ Matrix_Translate(this->unk_0380.x, this->unk_0380.y, this->unk_0380.z, MTXMODE_NEW);
+ Matrix_ReplaceRotation(&play->billboardMtxF);
+ Matrix_Scale(this->unk_01C8, this->unk_01C8, this->unk_01C8, MTXMODE_APPLY);
+ Matrix_RotateZS(this->unk_0198, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightOrbMaterialDL);
+ gSPDisplayList(POLY_XLU_DISP++, gGohtLightOrbModelDL);
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
void func_80B0CAF0(BossHakugin* this, PlayState* play) {
BossHakuginUnkStruct_2618* iter;
@@ -1250,7 +1412,7 @@ void func_80B0CF24(BossHakugin* this, PlayState* play) {
void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 pad;
- BossHakugin* this = (BossHakugin*)thisx;
+ BossHakugin* this = THIS;
u8* tex = GRAPH_ALLOC(play->state.gfxCtx, sizeof(u8[64][64]));
OPEN_DISPS(play->state.gfxCtx);
@@ -1278,7 +1440,7 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
}
if (this->actionFunc == func_80B0A8C4) {
- func_80B0E5A4(this, play);
+ func_80B0E5A4(&this->actor, play);
} else {
func_80B0C398(this, play);
}
@@ -1449,8 +1611,8 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E548.s")
-void func_80B0E5A4(BossHakugin* this2, PlayState* play) {
- BossHakugin* this = this2;
+void func_80B0E5A4(Actor* thisx, PlayState* play) {
+ BossHakugin* this = THIS;
s32 i;
BossHakuginEffect* effect;
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index e6a716022..407fb4d24 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -29,7 +29,9 @@ typedef struct BossHakuginUnkStruct_2618 {
typedef struct BossHakuginFhgFlashUnkStruct {
/* 0x00 */ Vec3f unk_00;
- /* 0x0C */ char unk_0C[0x8];
+ /* 0x0C */ f32 unk_0C;
+ /* 0x10 */ s16 unk_10;
+ /* 0x12 */ s16 unk_12;
} BossHakuginFhgFlashUnkStruct; // size = 0x14
typedef struct BossHakugin {
@@ -62,10 +64,11 @@ typedef struct BossHakugin {
/* 0x01B0 */ u32 unk_01B0;
/* 0x01B4 */ s32 unk_01B4;
/* 0x01B8 */ f32 unk_01B8;
- /* 0x01BC */ char pad1BC[8];
+ /* 0x01BC */ char unk_01BC[8];
/* 0x01C4 */ f32 unk_01C4;
/* 0x01C8 */ f32 unk_01C8;
- /* 0x01CC */ char unk_01CC[0x8];
+ /* 0x01CC */ f32 unk_01CC;
+ /* 0x01D0 */ f32 unk_01D0;
/* 0x01D4 */ f32 unk_01D4;
/* 0x01D8 */ char unk_01D8[0x4];
/* 0x01DC */ f32 unk_01DC;
From 59b87a795acd307da30b2ab65f0d61a3f1948a22 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 28 Sep 2023 15:47:31 -0700
Subject: [PATCH 33/51] Small cleanup
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 80 ++++++++-----------
1 file changed, 35 insertions(+), 45 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index bc55a385c..7b140cecf 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -9,6 +9,7 @@
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Hakurock/z_en_hakurock.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
+#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -249,16 +250,6 @@ extern Vec3f D_80B0EB00;
extern Vec3f D_80B0EB0C;
extern Vec3f D_80B0EB18;
-extern AnimationHeader D_06002054; // gGohtThawAndBreakWallAnim
-extern AnimationHeader D_0600319C; // gGohtStationaryAnim
-extern Gfx D_06010488[]; // gGohtRockMaterialDL
-extern Gfx D_06011208[]; // gGohtLightningMaterialDL
-extern Gfx D_06012ED0[]; // gGohtLightOrbMaterialDL
-extern AnimationHeader D_060134D0; // gGohtFallDownAnim
-extern AnimationHeader D_06013828; // gGohtRunAnim
-extern TexturePtr D_06014040; // gGohtTitleCardTex
-extern FlexSkeletonHeader D_06013158; // gGohtSkel
-
#ifdef NON_MATCHING
// requires in-function static, too lazy to import all the data right now
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
@@ -270,14 +261,15 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
s32 i;
Actor_ProcessInitChain(&this->actor, D_80B0EAD8);
- SkelAnime_InitFlex(play, &this->skelAnime, &D_06013158, &D_06013828, this->jointTable, this->morphTable, 0x21);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gGohtSkel, &gGohtRunAnim, this->jointTable, this->morphTable,
+ GOHT_LIMB_MAX);
if (D_80B0EAD4 == 0) {
D_80B0EAD4 = 1;
D_80B0EA88 = Lib_SegmentedToVirtual(D_80B0EA88);
}
Collider_InitAndSetJntSph(play, &this->unk_0484, &this->actor, &D_80B0E9AC, this->unk_04A4);
- for (i = 0; i < 20; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
Collider_InitAndSetTris(play, &this->unk_2618[i].unk_14, &this->actor, &D_80B0E9F8, &this->unk_2618[i].unk_34);
}
@@ -299,18 +291,18 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
return;
}
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09B0); i++) {
actorPtr = &this->unk_09B0[i];
*actorPtr = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HAKUROCK, 0.0f, 0.0f, 0.0f, 0, 0,
0, EN_HAKUROCK_TYPE_BOULDER);
}
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09D0); i++) {
this->unk_09D0[i] = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HAKUROCK, 0.0f, 0.0f, 0.0f,
0, 0, 0, EN_HAKUROCK_TYPE_UNK_2);
}
- for (i = 0; i < 180; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09F8); i++) {
this->unk_09F8[i].unk_18 = -1;
}
@@ -326,7 +318,7 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
this->unk_0193 = 255;
this->unk_01D4 = 2.7f;
func_80B058C0(this);
- Animation_PlayOnce(&this->skelAnime, &D_06002054);
+ Animation_PlayOnce(&this->skelAnime, &gGohtThawAndBreakWallAnim);
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
func_80B08124(this);
} else {
@@ -349,7 +341,7 @@ void BossHakugin_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyJntSph(play, &this->unk_0484);
Collider_DestroyCylinder(play, &this->unk_0964);
- for (i = 0; i < 20; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
Collider_DestroyTris(play, &this->unk_2618[i].unk_14);
}
@@ -628,8 +620,9 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_01E4 = 3.0f;
this->unk_01DC = 2.5f;
temp_v0_2 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_2->info.bumper.hitPos.x, temp_v0_2->info.bumper.hitPos.y,
- temp_v0_2->info.bumper.hitPos.z, 0, 0, 0, 4);
+ Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, temp_v0_2->info.bumper.hitPos.x,
+ temp_v0_2->info.bumper.hitPos.y, temp_v0_2->info.bumper.hitPos.z, 0, 0, 0,
+ CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS));
} else if (this->actor.colChkInfo.damageEffect == 0x3) {
this->unk_0196 = 0xA;
this->unk_01DC = 2.5f;
@@ -640,8 +633,9 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_01DC = 2.5f;
this->unk_01E4 = 3.0f;
temp_v0_3 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, 0xA2, temp_v0_3->info.bumper.hitPos.x, temp_v0_3->info.bumper.hitPos.y,
- temp_v0_3->info.bumper.hitPos.z, 0, 0, 3, 4);
+ Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, temp_v0_3->info.bumper.hitPos.x,
+ temp_v0_3->info.bumper.hitPos.y, temp_v0_3->info.bumper.hitPos.z, 0, 0, 3,
+ CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS));
}
}
@@ -670,7 +664,7 @@ void func_80B07EEC(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f sp20;
- Animation_PlayOnce(&this->skelAnime, &D_06002054);
+ Animation_PlayOnce(&this->skelAnime, &gGohtThawAndBreakWallAnim);
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->unk_01AC = CutsceneManager_GetCurrentSubCamId(this->actor.csId);
sp20.x = player->actor.focus.pos.x;
@@ -756,9 +750,9 @@ void func_80B082AC(BossHakugin* this, PlayState* play) {
s32 temp_v1;
this->unk_019C--;
- if ((this->unk_019C >= 30) && (this->unk_019C % 2 != 0)) {
+ if ((this->unk_019C >= 30) && ((this->unk_019C % 2) != 0)) {
func_80B07700(this, play, 1);
- } else if ((this->unk_019C % 4 == 0)) {
+ } else if ((this->unk_019C % 4) == 0) {
func_80B07700(this, play, 0);
}
@@ -852,8 +846,8 @@ void func_80B0863C(BossHakugin* this, PlayState* play) {
}
if (Animation_OnFrame(&this->skelAnime, 65.0f)) {
- TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, Lib_SegmentedToVirtual(&D_06014040), 160,
- 180, 128, 40);
+ TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, Lib_SegmentedToVirtual(&gGohtTitleCardTex),
+ 160, 180, 128, 40);
}
if (Animation_OnFrame(&this->skelAnime, 86.0f)) {
@@ -862,7 +856,7 @@ void func_80B0863C(BossHakugin* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 90.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK);
- for (i = 6; i < 10; i++) {
+ for (i = 6; i < ARRAY_COUNT(this->unk_09D0); i++) {
this->unk_09D0[i]->params = 0;
}
}
@@ -873,7 +867,7 @@ void func_80B0863C(BossHakugin* this, PlayState* play) {
}
}
- if (((this->unk_019C + 12) >= 0) && (this->unk_019C % 4 == 0)) {
+ if (((this->unk_019C + 12) >= 0) && ((this->unk_019C % 4) == 0)) {
func_80B07700(this, play, 0);
}
}
@@ -889,7 +883,7 @@ void func_80B08848(BossHakugin* this, PlayState* play) {
sp30.y = this->actor.world.pos.y + 100.0f;
sp30.z = this->actor.world.pos.z;
func_800BE33C(&this->unk_038C, &sp30, &this->unk_037A, true);
- Animation_Change(&this->skelAnime, &D_06013828, 1.5f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f);
+ Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.5f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f);
this->unk_019C = 0;
this->actor.speed = 5.0f;
func_800B7298(play, &this->actor, PLAYER_CSMODE_END);
@@ -955,7 +949,7 @@ void func_80B08960(BossHakugin* this, PlayState* play) {
}
void func_80B08C1C(BossHakugin* this) {
- Animation_Change(&this->skelAnime, &D_06013828, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -5.0f);
+ Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -5.0f);
this->unk_01A2 = 0;
this->unk_01C8 = 0.0f;
this->unk_019E = Rand_CenteredFloat(3072.0f);
@@ -971,22 +965,18 @@ void func_80B08C1C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B091D8.s")
void func_80B093C0(BossHakugin* this) {
- f32 sp24;
-
- Animation_MorphToPlayOnce(&this->skelAnime, &D_060134D0, -3.0f);
- this->unk_0484.base.atFlags &= 0xFFFE;
- this->unk_0484.base.acFlags &= 0xFFFB;
+ Animation_MorphToPlayOnce(&this->skelAnime, &gGohtFallDownAnim, -3.0f);
+ this->unk_0484.base.atFlags &= ~AT_ON;
+ this->unk_0484.base.acFlags &= ~AC_HARD;
this->unk_01A6 = 0;
this->unk_0195 = 0;
this->unk_01C8 = 0.0f;
if (this->unk_0192 == 1) {
Math_Vec3f_Copy(&this->unk_3734[0], &this->unk_0380);
this->unk_01B8 = this->actor.speed + 100.0f;
- sp24 = Math_CosS(0xA00);
- this->unk_37AC = Math_SinS(this->actor.shape.rot.y) * sp24;
+ this->unk_37AC = Math_CosS(0xA00) * Math_SinS(this->actor.shape.rot.y);
this->unk_37B0 = Math_SinS(0xA00);
- sp24 = Math_CosS(0xA00);
- this->unk_37B4 = Math_CosS(this->actor.shape.rot.y) * sp24;
+ this->unk_37B4 = Math_CosS(0xA00) * Math_CosS(this->actor.shape.rot.y);
this->unk_0192 = 2;
this->unk_01C8 = 0.0f;
Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_E_BALL_THR);
@@ -1002,10 +992,10 @@ void func_80B093C0(BossHakugin* this) {
void func_80B09840(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- Animation_MorphToPlayOnce(&this->skelAnime, &D_0600319C, -10.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gGohtStationaryAnim, -10.0f);
player->actor.parent = &this->actor;
- this->unk_0484.base.atFlags &= 0xFFFE;
- this->unk_0484.base.ocFlags1 &= 0xFFFE;
+ this->unk_0484.base.atFlags &= ~AT_ON;
+ this->unk_0484.base.ocFlags1 &= ~OC1_ON;
this->unk_019C = 0xA;
this->actionFunc = func_80B098BC;
}
@@ -1022,12 +1012,12 @@ void func_80B098BC(BossHakugin* this, PlayState* play) {
if (this->unk_019C < 10) {
this->unk_019C--;
if (this->unk_019C == 0) {
- this->unk_0484.base.atFlags |= 1;
- this->unk_0484.base.ocFlags1 |= 1;
+ this->unk_0484.base.atFlags |= AT_ON;
+ this->unk_0484.base.ocFlags1 |= OC1_ON;
func_80B08C1C(this);
}
} else {
- if (Math_ScaledStepToS(&this->unk_01A6, -0x800, 0x1C0) != 0) {
+ if (Math_ScaledStepToS(&this->unk_01A6, -0x800, 0x1C0)) {
player->actionVar2 = 0x64;
player->actor.parent = NULL;
player->invincibilityTimer = 0;
From 0593d7ed53b7c5d5547e592180c4ade670a966e8 Mon Sep 17 00:00:00 2001
From: Tom Overton
Date: Fri, 29 Sep 2023 11:17:23 -0700
Subject: [PATCH 34/51] Most of the death-handling code done
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 201 ++++++++++++++++--
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 8 +-
2 files changed, 187 insertions(+), 22 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 7b140cecf..e8d7fa4c9 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -7,9 +7,10 @@
#include "z_boss_hakugin.h"
#include "z64quake.h"
#include "z64rumble.h"
+#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
+#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
#include "overlays/actors/ovl_En_Hakurock/z_en_hakurock.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
-#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -48,9 +49,14 @@ void func_80B0825C(BossHakugin* this);
void func_80B09F7C(BossHakugin* this);
void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
+void func_80B0A5EC(BossHakugin* this);
+void func_80B0A87C(BossHakugin* this);
void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
+void func_80B0D9CC(BossHakugin* this);
+void func_80B0DFA8(BossHakugin* this);
+void func_80B0E548(Actor* this, PlayState* play);
#if 0
ActorInit Boss_Hakugin_InitVars = {
@@ -577,7 +583,7 @@ void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2) {
Vec3f pos;
if (arg2 != 0) {
- vel.y = (this->unk_019C - 0x1E) * (1 / 70.0f);
+ vel.y = (this->unk_019C - 30) * (1 / 70.0f);
} else {
vel.y = 0.1f;
}
@@ -608,9 +614,6 @@ void func_80B07B88(BossHakugin* this, PlayState* play) {
}
void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
- ColliderJntSphElement* temp_v0_2;
- ColliderJntSphElement* temp_v0_3;
-
if (this->actor.colChkInfo.damageEffect == 0x2) {
this->unk_0196 = 0;
this->unk_01E4 = 3.0f;
@@ -619,9 +622,9 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_0196 = 0x14;
this->unk_01E4 = 3.0f;
this->unk_01DC = 2.5f;
- temp_v0_2 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, temp_v0_2->info.bumper.hitPos.x,
- temp_v0_2->info.bumper.hitPos.y, temp_v0_2->info.bumper.hitPos.z, 0, 0, 0,
+ Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->unk_0484.elements[arg2].info.bumper.hitPos.x,
+ this->unk_0484.elements[arg2].info.bumper.hitPos.y,
+ this->unk_0484.elements[arg2].info.bumper.hitPos.z, 0, 0, 0,
CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS));
} else if (this->actor.colChkInfo.damageEffect == 0x3) {
this->unk_0196 = 0xA;
@@ -632,9 +635,9 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_0196 = 0x15;
this->unk_01DC = 2.5f;
this->unk_01E4 = 3.0f;
- temp_v0_3 = &this->unk_0484.elements[arg2];
- Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, temp_v0_3->info.bumper.hitPos.x,
- temp_v0_3->info.bumper.hitPos.y, temp_v0_3->info.bumper.hitPos.z, 0, 0, 3,
+ Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->unk_0484.elements[arg2].info.bumper.hitPos.x,
+ this->unk_0484.elements[arg2].info.bumper.hitPos.y,
+ this->unk_0484.elements[arg2].info.bumper.hitPos.z, 0, 0, 3,
CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS));
}
}
@@ -980,9 +983,9 @@ void func_80B093C0(BossHakugin* this) {
this->unk_0192 = 2;
this->unk_01C8 = 0.0f;
Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_E_BALL_THR);
- this->unk_37B8.base.atFlags |= 1;
+ this->unk_37B8.base.atFlags |= AT_ON;
}
- this->unk_019C = 0x3C;
+ this->unk_019C = 60;
this->actor.speed = 20.0f;
this->actionFunc = func_80B094E0;
}
@@ -996,7 +999,7 @@ void func_80B09840(BossHakugin* this, PlayState* play) {
player->actor.parent = &this->actor;
this->unk_0484.base.atFlags &= ~AT_ON;
this->unk_0484.base.ocFlags1 &= ~OC1_ON;
- this->unk_019C = 0xA;
+ this->unk_019C = 10;
this->actionFunc = func_80B098BC;
}
@@ -1072,15 +1075,175 @@ void func_80B09EDC(BossHakugin* this, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09F7C.s")
+void func_80B09F7C(BossHakugin* this) {
+ f32 temp_fv0_2;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A2A4.s")
+ Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.3f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f);
+ this->unk_01AC = CutsceneManager_GetCurrentSubCamId(this->actor.csId);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A5EC.s")
+ if ((this->actor.world.pos.z >= 0.0f) && (this->actor.world.pos.x >= 0.0f)) {
+ this->unk_019E = -0x4000;
+ } else {
+ if ((this->actor.world.pos.z >= 0.0f) && (this->actor.world.pos.x < 0.0f)) {
+ this->unk_019E = -0x8000;
+ } else if ((this->actor.world.pos.x >= 0.0f) && (this->actor.world.pos.z < 0.0f)) {
+ this->unk_019E = 0;
+ } else {
+ this->unk_019E = 0x4000;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A638.s")
+ if (this->unk_01B4 == 1) {
+ this->unk_019E -= 0x4000;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A87C.s")
+ temp_fv0_2 = this->unk_01B4;
+ if ((this->unk_019E > 0x6000) || (this->unk_019E < -0x6000)) {
+ this->unk_038C.x = temp_fv0_2 * -1200.0f;
+ this->unk_038C.y = (temp_fv0_2 * 80.0f) + -240.0f + 60.0f;
+ this->unk_038C.z = 1200.0f;
+ } else if ((this->unk_019E < 0x2000) && (this->unk_019E > -0x2000)) {
+ this->unk_038C.x = temp_fv0_2 * 1200.0f;
+ this->unk_038C.y = 60.0f;
+ this->unk_038C.z = -1200.0f;
+ } else if (this->unk_019E >= 0x2000) {
+ this->unk_038C.x = -1200.0f;
+ this->unk_038C.y = (80.0f * temp_fv0_2) + -80.0f + 60.0f;
+ this->unk_038C.z = temp_fv0_2 * -1200.0f;
+ } else {
+ this->unk_038C.x = 1200.0f;
+ this->unk_038C.y = (-160.0f * temp_fv0_2) + -160.0f + 60.0f;
+ this->unk_038C.z = temp_fv0_2 * 1200.0f;
+ }
+
+ this->unk_01C8 = 0.0f;
+ this->unk_01A6 = 0;
+ Play_EnableMotionBlur(140);
+ this->unk_01A2 = Rand_S16Offset(0x800, 0x800) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1);
+ SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
+ this->actor.home.rot.y = this->actor.shape.rot.y;
+ this->unk_019C = 18;
+ if ((this->unk_0192 == 2) || (this->unk_0192 == 3)) {
+ this->unk_0192 = 4;
+ this->unk_01AA = 0;
+ }
+
+ this->unk_01AE = Rand_ZeroFloat(6144.0f);
+ this->unk_0374.y = 0;
+ this->unk_0374.z = 0;
+ this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
+ this->actor.speed = CLAMP_MIN(this->actor.speed, 16.0f);
+ this->actionFunc = func_80B0A2A4;
+}
+
+void func_80B0A2A4(BossHakugin* this, PlayState* play) {
+ Vec3f at;
+ f32 absPosX;
+ f32 absPosZ;
+ s32 absRotY;
+
+ Math_StepToF(&this->actor.speed, 15.0f, 2.0f);
+ SkelAnime_Update(&this->skelAnime);
+ this->unk_018D = 10;
+ this->unk_018E = 10;
+ this->unk_018F = 10;
+ func_80B07450(this, play);
+ Math_SmoothStepToS(&this->actor.home.rot.y, this->unk_01A0, 5, 0x800, 0x100);
+ this->unk_019C--;
+ this->actor.shape.rot.y = (s32)(Math_SinF(this->unk_019C * 0.17453294f) * this->unk_01A2) + this->actor.home.rot.y;
+
+ if (this->unk_019C == 0) {
+ if (this->unk_01A2 > 0) {
+ this->unk_01A2 = -Rand_S16Offset(0x800, 0x800);
+ } else {
+ this->unk_01A2 = Rand_S16Offset(0x800, 0x800);
+ }
+ this->unk_019C = 0x12;
+ this->unk_01AE = Rand_ZeroFloat(6144.0f);
+ }
+
+ this->unk_0374.z = (8192.0f * Math_SinS(this->unk_01AE)) * Math_SinF(this->unk_019C * 0.34906587f);
+ this->unk_0374.y = (8192.0f * Math_CosS(this->unk_01AE)) * Math_SinF(this->unk_019C * 0.34906587f);
+ this->actor.shape.rot.z = Math_SinF(this->unk_019C * 0.17453294f) * -(this->unk_01A2 * 0.3f);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ at.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x;
+ at.y = this->actor.world.pos.y + 200.0f;
+ at.z = (Math_CosS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.z;
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &this->unk_038C);
+
+ if (this->unk_019E == this->unk_01A0) {
+ absPosX = fabsf(this->actor.world.pos.x);
+ absPosZ = fabsf(this->actor.world.pos.z);
+ absRotY = ABS_ALT(this->actor.shape.rot.y);
+
+ if (((absPosX > 1289.1f) && (absPosZ < 1110.9f) && ((absRotY < 0x2000) || (absRotY > 0x6000))) ||
+ ((absPosZ > 1289.1f) && (absPosX < 1110.9f) && (absRotY > 0x2000) && (absRotY < 0x6000))) {
+ func_80B0A5EC(this);
+ }
+ }
+}
+
+void func_80B0A5EC(BossHakugin* this) {
+ if (this->unk_01B4 == 1) {
+ this->unk_019E -= 0x4000;
+ } else {
+ this->unk_019E += 0x4000;
+ }
+
+ this->actor.speed = 15.0f;
+ this->actionFunc = func_80B0A638;
+}
+
+void func_80B0A638(BossHakugin* this, PlayState* play) {
+ Vec3f at;
+ Vec3f eyeTarget;
+ s32 var_v0;
+ s16 temp_a0;
+
+ SkelAnime_Update(&this->skelAnime);
+ at.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x;
+ at.y = this->actor.world.pos.y + 200.0f;
+ at.z = (Math_CosS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.z;
+ temp_a0 = this->actor.shape.rot.y - (this->unk_01B4 * 0x6000);
+ eyeTarget.x = (Math_SinS(temp_a0) * 400.0f) + this->actor.world.pos.x;
+ eyeTarget.y = this->actor.world.pos.y + 100.0f;
+ eyeTarget.z = Math_CosS(temp_a0) * 400.0f + this->actor.world.pos.z;
+ Math_Vec3f_StepTo(&this->unk_038C, &eyeTarget, 25.0f);
+ Play_SetCameraAtEye(play, this->unk_01AC, &at, &this->unk_038C);
+ this->unk_018D = 10;
+ this->unk_018E = 10;
+ this->unk_018F = 10;
+ func_80B07450(this, play);
+
+ if ((Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_019E, 0x300)) &&
+ ((this->unk_01BC <= 189.00002f) || (this->unk_01C0 <= 189.00002f))) {
+ func_80B0A87C(this);
+ } else {
+ if (((this->unk_01B4 == 1) && (this->unk_01BC <= 189.00002f)) ||
+ ((this->unk_01B4 == -1) && (this->unk_01C0 <= 189.00002f))) {
+ var_v0 = ABS_ALT(this->unk_019E);
+ if (var_v0 < 0x2000) {
+ this->actor.world.pos.z = -1389.0f;
+ } else if (var_v0 >= 0x6001) {
+ this->actor.world.pos.z = 1389.0f;
+ } else if (this->unk_019E > 0) {
+ this->actor.world.pos.x = -1389.0f;
+ } else {
+ this->actor.world.pos.x = 1389.0f;
+ }
+ }
+ }
+
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+}
+
+void func_80B0A87C(BossHakugin* this) {
+ this->unk_019C = 0;
+ this->actor.speed = 0.0f;
+ this->skelAnime.playSpeed = 0.5f;
+ func_80B0D9CC(this);
+ this->actionFunc = func_80B0A8C4;
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A8C4.s")
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 407fb4d24..3e7a92c40 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -40,7 +40,8 @@ typedef struct BossHakugin {
/* 0x0188 */ BossHakuginActionFunc actionFunc;
/* 0x018C */ char unk_018C[0x1];
/* 0x018D */ s8 unk_018D;
- /* 0x018E */ char unk_018E[2];
+ /* 0x018E */ s8 unk_018E;
+ /* 0x018F */ s8 unk_018F;
/* 0x0190 */ u8 unk_0190; // boolean?
/* 0x0191 */ u8 unk_0191;
/* 0x0192 */ u8 unk_0192;
@@ -60,11 +61,12 @@ typedef struct BossHakugin {
/* 0x01A8 */ char unk_01A8[2];
/* 0x01AA */ s16 unk_01AA;
/* 0x01AC */ s16 unk_01AC;
- /* 0x01AE */ char unk_01AE[0x2];
+ /* 0x01AE */ s16 unk_01AE;
/* 0x01B0 */ u32 unk_01B0;
/* 0x01B4 */ s32 unk_01B4;
/* 0x01B8 */ f32 unk_01B8;
- /* 0x01BC */ char unk_01BC[8];
+ /* 0x01BC */ f32 unk_01BC;
+ /* 0x01C0 */ f32 unk_01C0;
/* 0x01C4 */ f32 unk_01C4;
/* 0x01C8 */ f32 unk_01C8;
/* 0x01CC */ f32 unk_01CC;
From c6bd63e1b9b898a6a64034890779d0200f7ee27e Mon Sep 17 00:00:00 2001
From: Parker B <20159000+jpburnett@users.noreply.github.com>
Date: Sat, 30 Sep 2023 18:49:00 -0700
Subject: [PATCH 35/51] more matching
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 223 +++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 8 +-
2 files changed, 217 insertions(+), 14 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index e8d7fa4c9..c7abf8548 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -35,6 +35,7 @@ void func_80B091D8(BossHakugin* this, PlayState* play);
void func_80B094E0(BossHakugin* this, PlayState* play);
void func_80B098BC(BossHakugin* this, PlayState* play);
void func_80B09C78(BossHakugin* this, PlayState* play);
+void func_80B09DFC(BossHakugin* this);
void func_80B09E20(BossHakugin* this, PlayState* play);
void func_80B09EDC(BossHakugin* this, PlayState* play);
void func_80B0A2A4(BossHakugin* this, PlayState* play);
@@ -56,7 +57,7 @@ void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
void func_80B0D9CC(BossHakugin* this);
void func_80B0DFA8(BossHakugin* this);
-void func_80B0E548(Actor* this, PlayState* play);
+void func_80B0E548(Actor* thisx, PlayState* play2);
#if 0
ActorInit Boss_Hakugin_InitVars = {
@@ -459,6 +460,7 @@ void func_80B05EE0(BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06558.s")
+void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06600.s")
void func_80B0696C(BossHakugin* this, Vec3f* arg1);
@@ -536,7 +538,37 @@ void func_80B06F48(BossHakugin* this, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0728C.s")
+s32 func_80B0728C(BossHakugin* this) {
+ s16 rand;
+
+ rand = ((Rand_Next() >> 0x12) + 0x4000);
+ this->unk_0198 += rand;
+ if (this->unk_01A8 == 5) {
+ if (Math_SmoothStepToS(&this->unk_01A6, -0x900, 4, 0x200, 0x80) == 0) {
+ this->unk_01A8--;
+ }
+
+ this->unk_01C8 = (this->unk_01A6 + 0x480) * -0.026041666f;
+ this->unk_01C8 = CLAMP_MIN(this->unk_01C8, 0.001f);
+
+ this->unk_01D0 = (this->unk_01A6 - 0x700) * -0.00021059783f;
+ this->unk_01D0 = CLAMP_MAX(this->unk_01D0, 0.62f);
+
+ if (this->unk_01D0 > 0.0f) {
+ this->unk_01CC = -100.0f - (((0.62f / this->unk_01D0) - 1.0f) * 200.0f);
+ } else {
+ this->unk_01CC = -200.0f;
+ }
+
+ } else if (this->unk_01A8 > 0) {
+ this->unk_01A8--;
+ } else if (Math_ScaledStepToS(&this->unk_01A6, 0x700, 0x380) != 0) {
+ this->unk_01D0 = (0x700 - this->unk_01A6) * 0.00024414062f * 0.62f;
+ return 1;
+ }
+
+ return 0;
+}
void func_80B07450(BossHakugin* this, PlayState* play) {
Vec3f velocity;
@@ -963,9 +995,47 @@ void func_80B08C1C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08CB8.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09178.s")
+void func_80B09178(BossHakugin* this) {
+ Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.5f, 0.0f, 0.0f, 0, -3.0f);
+ this->actionFunc = func_80B091D8;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B091D8.s")
+// TODO: Probably a better way to clean some of this up
+void func_80B091D8(BossHakugin* this, PlayState* play) {
+ s16 temp_v0;
+ s16 var_v0;
+
+ Math_ScaledStepToS(&this->unk_01A6, 0x800, 0x100);
+ Math_StepToF(&this->actor.speed, 25.0f, 2.0f);
+ SkelAnime_Update(&this->skelAnime);
+ func_80B07450(this, play);
+ if ((this->unk_0454 < 0.0f) || (this->unk_0484.base.atFlags & 2)) {
+ func_80B08C1C(this);
+ } else {
+ if ((this->unk_01C0 < 89.100006f) || (this->unk_01BC < 89.100006f)) {
+ this->unk_019E = this->unk_01A0;
+ } else {
+ if (((this->unk_044C > 0.0f) && (this->unk_044C < this->unk_01C0)) ||
+ ((this->unk_044C <= 0.0f) && (-this->unk_044C < this->unk_01BC))) {
+ temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
+ var_v0 = CLAMP(temp_v0, -0x3000, 0x3000);
+ this->unk_019E = this->actor.shape.rot.y + var_v0;
+ } else {
+ this->unk_019E =
+ ((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) >> 1) + this->actor.shape.rot.y;
+ }
+ }
+
+ var_v0 = (this->unk_019E - this->unk_01A0);
+ if (var_v0 > 0x1800) {
+ this->unk_019E = this->unk_01A0 + 0x1800;
+ } else if (var_v0 < -0x1800) {
+ this->unk_019E = this->unk_01A0 - 0x1800;
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_019E, 5, 0x800, 0x100);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ }
+}
void func_80B093C0(BossHakugin* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGohtFallDownAnim, -3.0f);
@@ -1041,13 +1111,99 @@ void func_80B098BC(BossHakugin* this, PlayState* play) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09A94.s")
+void func_80B09A94(BossHakugin* this, PlayState* play) {
+ f32 var_fv1;
+ s16 atan;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09C78.s")
+ if (this->actionFunc != func_80B09E20) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &gGohtStationaryAnim, -5.0f);
+ this->actor.speed = 0.0f;
+ atan = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
+ if (atan < -0x4000) {
+ this->actor.world.pos.x = -1200.0f;
+ this->actor.shape.rot.y = 0x4000;
+ this->actor.world.pos.z = -1200.0f;
+ } else if (atan < 0) {
+ this->actor.world.pos.x = -1200.0f;
+ this->actor.shape.rot.y = -0x8000;
+ this->actor.world.pos.z = 1200.0f;
+ } else if (atan < 0x4000) {
+ this->actor.world.pos.x = 1200.0f;
+ this->actor.shape.rot.y = -0x4000;
+ this->actor.world.pos.z = 1200.0f;
+ } else {
+ this->actor.world.pos.x = 1200.0f;
+ this->actor.shape.rot.y = 0;
+ this->actor.world.pos.z = -1200.0f;
+ }
+ if (this->unk_01B4 == 1) {
+ var_fv1 = -1.0f;
+ this->actor.shape.rot.y -= 0x4000;
+ } else {
+ var_fv1 = 1.0f;
+ }
+ this->unk_01A0 = this->actor.shape.rot.y + (this->unk_01B4 * 0x6000);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ this->actor.world.pos.x += var_fv1 * 300.0f * Math_CosS(this->actor.shape.rot.y);
+ this->actor.world.pos.z -= var_fv1 * 300.0f * Math_SinS(this->actor.shape.rot.y);
+ this->actor.world.pos.y += 500.0f;
+ this->actor.world.pos.y =
+ BgCheck_EntityRaycastFloor1(&play->colCtx, &this->actor.floorPoly, &this->actor.world.pos);
+ this->unk_018C = 0;
+ }
+ this->unk_01A6 = 0x700;
+ this->unk_019C = 0x96;
+ this->unk_01CC = -100.0f;
+ this->actionFunc = func_80B09C78;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09DFC.s")
+void func_80B09C78(BossHakugin* this, PlayState* play) {
+ f32 temp_fv1;
+ f32 sp1C;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B09E20.s")
+ SkelAnime_Update(&this->skelAnime);
+ temp_fv1 = fabsf(this->unk_044C);
+ sp1C = temp_fv1;
+ Math_StepToF(&this->unk_01C8, 0.0f, 6.0f);
+ if ((this->unk_0454 < 0.0f) || (this->actor.xzDistToPlayer < 750.0f) || (this->unk_018C == 1)) {
+ func_80B08C1C(this);
+ return;
+ }
+
+ if ((this->unk_2618[0].unk_0C == 0) && (this->unk_01C8 < 0.1f) && (temp_fv1 < 400.0f) && (this->unk_0454 > 0.0f)) {
+ func_80B09DFC(this);
+ return;
+ }
+
+ if ((temp_fv1 > 400.0f) && ((play->gameplayFrames & 0xF) == 0xF)) {
+ func_80B06C08(this);
+ return;
+ }
+
+ if (this->unk_019C > 0) {
+ this->unk_019C--;
+ } else {
+ this->unk_01B4 = -this->unk_01B4;
+ this->unk_01A0 = this->actor.shape.rot.y;
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ func_80B08C1C(this);
+ }
+}
+
+void func_80B09DFC(BossHakugin* this) {
+ this->unk_01A8 = 5;
+ this->unk_01C8 = 0.0f;
+ this->actionFunc = func_80B09E20;
+}
+
+void func_80B09E20(BossHakugin* this, PlayState* play) {
+ SkelAnime_Update(&this->skelAnime);
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_THUNDER - SFX_FLAG);
+ if (func_80B0728C(this) != 0) {
+ func_80B06600(this, &this->unk_0380, play);
+ func_80B09A94(this, play);
+ }
+}
void func_80B09E84(BossHakugin* this) {
CutsceneManager_Queue(this->actor.csId);
@@ -1253,11 +1409,49 @@ void func_80B0A87C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B238.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B34C.s")
+void func_80B0B34C(BossHakugin* this) {
+ BossHakuginEffect* effect;
+ s32 i;
+
+ for (i = 0; i < 36; i++) {
+ effect = &this->unk_09F8[i];
+ Math_StepToF(&effect->unk_0.y, effect->unk_C.x, effect->unk_C.y);
+ if (effect->unk_C.y > 0.0f) {
+ effect->unk_C.y = effect->unk_C.y + 6.0f;
+ }
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B3F4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B548.s")
+void func_80B0B548(BossHakugin* this, PlayState* play) {
+ BossHakuginUnkStruct_2618* unk_str;
+ s16 rand;
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
+ unk_str = &this->unk_2618[i];
+
+ if (unk_str->unk_14.base.atFlags & 2) {
+ Player* player = GET_PLAYER(play);
+ this->unk_018C = 1;
+ Player_PlaySfx(player, NA_SE_EN_COMMON_E_BALL_HIT);
+ unk_str->unk_14.base.atFlags &= ~2;
+ }
+ if (unk_str->unk_0C > 0) {
+ unk_str->unk_0C -= 0x14;
+ if (unk_str->unk_0C <= 0) {
+ unk_str->unk_0C = 0;
+ } else if (unk_str->unk_0C < 0x100) {
+ rand = (s32)Rand_Next() >> 0x10;
+ unk_str->unk_0E.z = rand;
+ if (unk_str->unk_0C >= 0x3D) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &unk_str->unk_14.base);
+ }
+ }
+ }
+ }
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B660.s")
@@ -1762,7 +1956,14 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0DFA8.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0E548.s")
+void func_80B0E548(Actor* thisx, PlayState* play2) {
+ BossHakugin* this = THIS;
+ PlayState* play = play2;
+
+ func_80B0DFA8(this);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_0484.base);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_0484.base);
+}
void func_80B0E5A4(Actor* thisx, PlayState* play) {
BossHakugin* this = THIS;
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 3e7a92c40..c3603caaf 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -38,7 +38,7 @@ typedef struct BossHakugin {
/* 0x0000 */ Actor actor;
/* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ BossHakuginActionFunc actionFunc;
- /* 0x018C */ char unk_018C[0x1];
+ /* 0x018C */ u8 unk_018C;
/* 0x018D */ s8 unk_018D;
/* 0x018E */ s8 unk_018E;
/* 0x018F */ s8 unk_018F;
@@ -58,7 +58,7 @@ typedef struct BossHakugin {
/* 0x01A2 */ s16 unk_01A2;
/* 0x01A4 */ s16 unk_01A4;
/* 0x01A6 */ s16 unk_01A6;
- /* 0x01A8 */ char unk_01A8[2];
+ /* 0x01A8 */ s16 unk_01A8; // Counter of some kind?
/* 0x01AA */ s16 unk_01AA;
/* 0x01AC */ s16 unk_01AC;
/* 0x01AE */ s16 unk_01AE;
@@ -83,7 +83,9 @@ typedef struct BossHakugin {
/* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
/* 0x0398 */ Vec3f bodyPartsPos[15];
- /* 0x044C */ char unk_044C[0xC];
+ /* 0x044C */ f32 unk_044C;
+ /* 0x0450 */ char unk_0450[4];
+ /* 0x0454 */ f32 unk_0454;
/* 0x0458 */ Vec3f unk_0458;
/* 0x0464 */ Vec3f unk_0464;
/* 0x0470 */ LightNode* lightNode;
From e9a46d8aba62e5f71313d707e2d64c25755a2c40 Mon Sep 17 00:00:00 2001
From: petrie911
Date: Tue, 3 Oct 2023 15:00:33 -0500
Subject: [PATCH 36/51] functions
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 310 +++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 6 +-
2 files changed, 296 insertions(+), 20 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index dc5a2b951..9957b2bba 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -238,6 +238,7 @@ static InitChainEntry D_80B0EAD8[] = {
extern ColliderJntSphElementInit D_80B0E700[19];
extern ColliderJntSphInit D_80B0E9AC;
extern ColliderTrisElementInit D_80B0E9BC[1];
+extern Vec3f D_80B0E9D4[3];
extern ColliderTrisInit D_80B0E9F8;
extern ColliderSphereInit D_80B0EA08;
extern ColliderCylinderInit D_80B0EA34;
@@ -543,25 +544,247 @@ void func_80B05EE0(BossHakugin* this, PlayState* play) {
BHEART_PARAM_NORMAL);
}
-void func_80B0607C(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0607C.s")
+void func_80B0607C(BossHakugin* this, PlayState* play) {
+ CollisionPoly* sp8C = NULL;
+ CollisionPoly* sp88 = NULL;
+ s32 sp84;
+ s16 sp82;
+ s16 sp80;
+ s16 var_v0;
+ Vec3f sp70;
+ Vec3f sp64;
+ Vec3f sp58;
+ Vec3f sp4C;
+ f32 sp48;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06558.s")
+ sp58.x = this->actor.world.pos.x + (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ sp58.y = this->actor.world.pos.y + 450.0f;
+ sp58.z = this->actor.world.pos.z + (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
-void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06600.s")
+ sp4C.x = sp58.x - Math_CosS(this->unk_01A0) * 1000.0f;
+ sp4C.y = sp58.y;
+ sp4C.z = sp58.z + (Math_SinS(this->unk_01A0) * 1000.0f);
-void func_80B0696C(BossHakugin* this, Vec3f* arg1);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0696C.s")
+ if (BgCheck_EntityLineTest1(&play->colCtx, &sp58, &sp4C, &sp70, &sp8C, 1, 1, 0, 1, &sp84)) {
+ sp82 =
+ Math_Atan2S_XY(sp8C->normal.z * COLPOLY_NORMAL_FRAC, sp8C->normal.x * COLPOLY_NORMAL_FRAC) - this->unk_01A0;
+ this->unk_01BC = Math_Vec3f_DistXZ(&sp58, &sp70);
+ } else {
+ sp82 = 0;
+ this->unk_01BC = 30000.0f;
+ }
+ sp4C.x = (2.0f * sp58.x) - sp4C.x;
+ sp4C.z = (2.0f * sp58.z) - sp4C.z;
+ if (BgCheck_EntityLineTest1(&play->colCtx, &sp58, &sp4C, &sp64, &sp88, 1, 1, 0, 1, &sp84)) {
+ sp80 =
+ Math_Atan2S_XY(sp88->normal.z * COLPOLY_NORMAL_FRAC, sp88->normal.x * COLPOLY_NORMAL_FRAC) - this->unk_01A0;
+ this->unk_01C0 = Math_Vec3f_DistXZ(&sp58, &sp64);
+ } else {
+ sp80 = 0;
+ this->unk_01C0 = 30000.0f;
+ }
+ if (this->unk_01B4 == 1) {
+ this->unk_01C0 -= 50.0f;
+ } else {
+ this->unk_01BC -= 50.0f;
+ }
+ if (this->unk_01BC <= 89.100006f) {
+ sp48 = (this->unk_01B4 == 1) ? 89.100006f : 139.1f;
+ this->actor.world.pos.x =
+ (sp70.x + (sp48 * Math_CosS(this->unk_01A0))) - (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ this->actor.world.pos.z =
+ (sp70.z - (sp48 * Math_SinS(this->unk_01A0))) - (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
+ } else if (this->unk_01C0 <= 89.100006f) {
+ sp48 = (this->unk_01B4 == 1) ? 139.1f : 89.100006f;
+ this->actor.world.pos.x =
+ (sp64.x - (sp48 * Math_CosS(this->unk_01A0))) - (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ this->actor.world.pos.z =
+ (sp64.z + (sp48 * Math_SinS(this->unk_01A0))) - (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
+ }
+ if ((this->unk_01C0 < 30000.0f) && (this->unk_01BC < 30000.0f)) {
+ var_v0 = (s16)(sp82 + sp80) >> 1;
+ if (((this->unk_01B4 == 1) && (var_v0 < 0)) || ((this->unk_01B4 == -1) && (var_v0 > 0))) {
+ this->unk_01A0 += var_v0;
+ }
+ }
+}
-void func_80B06B20(BossHakugin* this, Vec3f* arg1);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06B20.s")
+void func_80B06558(BossHakuginUnkStruct_2618* arg0) {
+ s32 i;
+ Vec3f sp38[3];
-void func_80B06C08(BossHakugin* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06C08.s")
+ Matrix_SetTranslateRotateYXZ(arg0->unk_00.x, arg0->unk_00.y, arg0->unk_00.z, &arg0->unk_0E);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ for (i = 0; i < 3; i++) {
+ Matrix_MultVec3f(&D_80B0E9D4[i], &sp38[i]);
+ }
+ Collider_SetTrisVertices(&arg0->unk_14, 0, &sp38[0], &sp38[1], &sp38[2]);
+}
-void func_80B06D38(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06D38.s")
+void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play) {
+ s32 i;
+ Player* player = GET_PLAYER(play);
+ CollisionPoly* spD4;
+ Vec3f spC8;
+ Vec3f spBC;
+ Vec3f spB0;
+ Vec3f spA4;
+ Vec3f sp98;
+ Vec3f sp8C;
+ BossHakuginUnkStruct_2618* effect;
+ s32 sp84;
+
+ Math_Vec3f_Copy(&spC8, arg1);
+ spBC.x = player->actor.world.pos.x - (Math_SinS(this->actor.shape.rot.y) * 50.0f);
+ spBC.y = player->actor.world.pos.y + 40.0f;
+ spBC.z = player->actor.world.pos.z - (Math_CosS(this->actor.shape.rot.y) * 50.0f);
+ Actor_OffsetOfPointInActorCoords(&this->actor, &sp98, &spBC);
+ Audio_PlaySfx_AtPos(&this->unk_0458, 0x384DU);
+ for (i = 0; i < 20; i++) {
+ effect = &this->unk_2618[i];
+ Actor_OffsetOfPointInActorCoords(&this->actor, &sp8C, &spC8);
+ if (sp98.z < sp8C.z) {
+ effect->unk_0E.y = this->actor.shape.rot.y + ((s32)Rand_Next() >> 0x13);
+ } else {
+ effect->unk_0E.y = Math_Vec3f_Yaw(&spC8, &spBC) + ((s32)Rand_Next() >> 0x13);
+ }
+ effect->unk_0E.x = Math_Vec3f_Pitch(&spC8, &spBC) + ((s32)Rand_Next() >> 0x13);
+ effect->unk_0E.z = 0;
+ effect->unk_00.x = spC8.x + (80.0f * Math_CosS(effect->unk_0E.x) * Math_SinS(effect->unk_0E.y));
+ effect->unk_00.y = spC8.y - (80.0f * Math_SinS(effect->unk_0E.x));
+ effect->unk_00.z = spC8.z + (80.0f * Math_CosS(effect->unk_0E.x) * Math_CosS(effect->unk_0E.y));
+ spB0.x = (2.0f * effect->unk_00.x) - spC8.x;
+ spB0.y = (2.0f * effect->unk_00.y) - spC8.y;
+ spB0.z = (2.0f * effect->unk_00.z) - spC8.z;
+ if (BgCheck_EntityLineTest1(&play->colCtx, &spC8, &spB0, &spA4, &spD4, 0, 1, 0, 1, &sp84)) {
+ effect->unk_0E.x -= 0x2000;
+ effect->unk_00.x = spC8.x + (80.0f * Math_CosS(effect->unk_0E.x) * Math_SinS(effect->unk_0E.y));
+ effect->unk_00.y = spC8.y - (80.0f * Math_SinS(effect->unk_0E.x));
+ effect->unk_00.z = spC8.z + (80.0f * Math_CosS(effect->unk_0E.x) * Math_CosS(effect->unk_0E.y));
+ spC8.x = (2.0f * effect->unk_00.x) - spC8.x;
+ spC8.y = (2.0f * effect->unk_00.y) - spC8.y;
+ spC8.z = (2.0f * effect->unk_00.z) - spC8.z;
+ } else {
+ Math_Vec3f_Copy(&spC8, &spB0);
+ }
+ effect->unk_0C = 0x113 + 0x14 * i;
+ func_80B06558(effect);
+ effect->unk_0E.z = (s32)Rand_Next() >> 0x10;
+ }
+}
+
+void func_80B0696C(BossHakugin* this, Vec3f* arg1) {
+ s32 i;
+ BossHakuginEffect* temp_s0;
+
+ for (i = 0; i < 180; i++) {
+ temp_s0 = &this->unk_09F8[i];
+ if (temp_s0->unk_18 < 0) {
+ s16 sp2E;
+ s16 sp2C;
+ f32 sp28;
+
+ Math_Vec3f_Copy(&temp_s0->unk_0, arg1);
+ sp2C = Rand_S16Offset(0x1000, 0x3000);
+ sp2E = this->actor.shape.rot.y + ((s32)Rand_Next() >> 0x12) + 0x8000;
+ sp28 = Rand_ZeroFloat(5.0f) + 7.0f;
+ temp_s0->unk_C.x = sp28 * Math_CosS(sp2C) * Math_SinS(sp2E);
+ temp_s0->unk_C.y = sp28 * Math_SinS(sp2C);
+ temp_s0->unk_C.z = sp28 * Math_CosS(sp2C) * Math_CosS(sp2E);
+ temp_s0->unk_0.x = arg1->x + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.x);
+ temp_s0->unk_0.y = arg1->y + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.y);
+ temp_s0->unk_0.z = arg1->z + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.z);
+ temp_s0->unk_24 = (Rand_ZeroFloat(6.0f) + 15.0f) * 0.0001f;
+ temp_s0->unk_18 = 0x28;
+ temp_s0->unk_1A = 0;
+ break;
+ }
+ }
+}
+
+void func_80B06B20(BossHakugin* this, Vec3f* arg1) {
+ Actor* sp1C;
+ s32 i;
+
+ if (((this->unk_044C.z < -200.0f) && (this->actor.speed > 10.0f) && (this->unk_018D == 0) &&
+ (Rand_ZeroOne() < 0.4f))) {
+ this->unk_018D = 4;
+ } else {
+ if (this->unk_018D > 0) {
+ this->unk_018D--;
+ }
+ return;
+ }
+
+ for (i = 0; i < 8; i++) {
+ sp1C = this->unk_09B0[i];
+
+ if (sp1C->params == 0) {
+ Math_Vec3f_Copy(&sp1C->world.pos, arg1);
+ sp1C->params = 1;
+ break;
+ }
+ }
+}
+
+void func_80B06C08(BossHakugin* this) {
+ s32 i;
+
+ if ((this->unk_018E == 0) && (this->actor.colChkInfo.health < 0x14) && (Rand_ZeroOne() < 0.35f)) {
+ this->unk_018E = 4;
+ } else {
+ if (this->unk_018E > 0) {
+ this->unk_018E--;
+ }
+ return;
+ }
+ for (i = 0; i < 10; i++) {
+ Actor* tmp = this->unk_09D0[i];
+
+ if (tmp->params == 0) {
+ tmp->params = 2;
+ return;
+ }
+ }
+}
+
+void func_80B06D38(BossHakugin* this, PlayState* play) {
+ EnBom* sp44;
+ s16 temp_a1;
+
+ if ((this->actor.speed > 10.0f) && ((s32)this->actor.colChkInfo.health < 0xA) && (this->unk_018F == 0) &&
+ (Rand_ZeroOne() < 0.35f)) {
+ this->unk_018F = 4;
+ } else {
+ if (this->unk_018F > 0) {
+ this->unk_018F--;
+ }
+ return;
+ }
+ sp44 =
+ (EnBom*) Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM,
+ this->unk_0484.elements[1].dim.worldSphere.center.x - (100.0f * Math_SinS(this->actor.shape.rot.y)),
+ this->unk_0484.elements[1].dim.worldSphere.center.y + 100.0f,
+ this->unk_0484.elements[1].dim.worldSphere.center.z - (Math_CosS(this->actor.shape.rot.y) * 100.0f),
+ 0, 0, 0, 0);
+ if (sp44 != NULL) {
+ temp_a1 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - 0x8000;
+ if (temp_a1 > 0x2000) {
+ sp44->actor.world.rot.y = this->actor.shape.rot.y + 0xA000;
+ } else if (temp_a1 < -0x2000) {
+ sp44->actor.world.rot.y = this->actor.shape.rot.y + 0x6000;
+ } else {
+ sp44->actor.world.rot.y = this->actor.yawTowardsPlayer;
+ }
+
+ sp44->timer = (Rand_Next() >> 0x1C) + 0x11;
+ sp44->actor.velocity.y = 2.0f;
+ sp44->actor.speed = this->actor.xzDistToPlayer * 0.01f;
+ sp44->actor.speed = CLAMP(sp44->actor.speed, 6.0f, 12.0f);
+
+ Actor_SetScale(&sp44->actor, 0.02f);
+ }
+}
void func_80B06F48(BossHakugin* this, PlayState* play) {
BossHakuginFhgFlashUnkStruct* iter;
@@ -723,8 +946,42 @@ void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2) {
EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 0x258);
}
-void func_80B0791C(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0791C.s")
+s32 func_80B0791C(BossHakugin* this, PlayState* play) {
+ Player* sp34 = GET_PLAYER(play);
+ s16 var_v1;
+ s32 var_v0_2;
+ f32 sp28;
+ f32 sp24;
+
+ if (this->unk_044C.z > 0.0f) {
+ return 0;
+ }
+ var_v1 = this->unk_01A0 - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
+ var_v0_2 = ABS_ALT(var_v1);
+
+ if (var_v0_2 < 0x4000) {
+ if (var_v0_2 < 0x1800) {
+ this->unk_018C = 0;
+ }
+ return 0;
+ }
+ if (this->unk_018C == 1) {
+ return 0;
+ }
+ sp24 = this->actor.world.pos.x * this->unk_01B4;
+ sp28 = this->actor.world.pos.z * this->unk_01B4;
+ if (((sp34->actor.world.pos.x > 1200.0f) && (sp34->actor.world.pos.z < 1200.0f) &&
+ (sp34->actor.world.pos.z > -1200.0f) && (this->actor.world.pos.x < 0.0f) && (sp28 > 1200.0f)) ||
+ ((sp34->actor.world.pos.x < -1200.0f) && (sp34->actor.world.pos.z < 1200.0f) &&
+ (sp34->actor.world.pos.z > -1200.0f) && (this->actor.world.pos.x > 0.0f) && (sp28 < -1200.0f)) ||
+ ((sp34->actor.world.pos.z > 1200.0f) && (sp34->actor.world.pos.x < 1200.0f) &&
+ (sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z < 0.0f) && (sp24 < -1200.0f)) ||
+ ((sp34->actor.world.pos.z < -1200.0f) && (sp34->actor.world.pos.x < 1200.0f) &&
+ (sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z > 0.0f) && (sp24 > 1200.0f))) {
+ return 1;
+ }
+ return 0;
+}
void func_80B07B88(BossHakugin* this, PlayState* play) {
if (this->unk_0196 == 0xA) {
@@ -1499,8 +1756,27 @@ void func_80B0AC30(BossHakugin* this, PlayState* play);
s32 func_80B0ADFC(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0ADFC.s")
-void func_80B0B238(BossHakugin* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B238.s")
+void func_80B0B238(BossHakugin* this) {
+ BossHakuginEffect* temp_s0;
+ s32 i;
+
+ for (i = 0; i < 180; i++) {
+ temp_s0 = &this->unk_09F8[i];
+
+ if (temp_s0->unk_18 >= 0) {
+ temp_s0->unk_18--;
+ temp_s0->unk_C.y += -1.0f;
+ Math_Vec3f_Sum(&temp_s0->unk_0, &temp_s0->unk_C, &temp_s0->unk_0);
+ if (temp_s0->unk_0.y < -500.0f) {
+ temp_s0->unk_18 = -1;
+ } else {
+ temp_s0->unk_1C.x += (s16)(0x700 + (Rand_Next() >> 0x17));
+ temp_s0->unk_1C.y += (s16)(0x900 + (Rand_Next() >> 0x17));
+ temp_s0->unk_1C.z += (s16)(0xB00 + (Rand_Next() >> 0x17));
+ }
+ }
+ }
+}
void func_80B0B34C(BossHakugin* this) {
BossHakuginEffect* effect;
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index e7aaaffb7..6662f11e0 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -39,9 +39,9 @@ typedef struct BossHakugin {
/* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ BossHakuginActionFunc actionFunc;
/* 0x018C */ u8 unk_018C;
- /* 0x018D */ s8 unk_018D;
- /* 0x018E */ s8 unk_018E;
- /* 0x018F */ s8 unk_018F;
+ /* 0x018D */ u8 unk_018D;
+ /* 0x018E */ u8 unk_018E;
+ /* 0x018F */ u8 unk_018F;
/* 0x0190 */ u8 unk_0190; // boolean?
/* 0x0191 */ u8 unk_0191;
/* 0x0192 */ u8 unk_0192;
From 70d467146d8a2574d2aceb72a268ccc3f26fdfaf Mon Sep 17 00:00:00 2001
From: petrie911 <69443847+petrie911@users.noreply.github.com>
Date: Tue, 3 Oct 2023 15:03:13 -0500
Subject: [PATCH 37/51] Goht collab (#9)
* Animation Cleanup: En_G* (#1395)
* wip
* more cleanup
* more cleanup
* one more thing
* one more default case
* missed brackets
* PR Review
* z_message_nes (1 NON_MATCHING) (#1394)
* Bring over progress
* Some docs
* scratch urls + format
* Fixes
* Match Message_DrawTextNES
* String macros
* color structs
* Document object_mk (#1389)
* Updated object_mk animation, limb, and skeleton names
* Updated object_mk texture and DList names
* Added comment to object_mk.xml
* Remove "ing" from Anim names
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
* Update z_en_mk.c to not use "ing" in names
* Running formatter
---------
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
* Player Docs: Initial framework for "Action Change Lists" (#1397)
* copy fig docs
* adjust wording
* another fix
* fix bool
* PR Suggestion
* Animation Cleanup: En_H* (#1399)
* begin H
* more cleanup
* Animation Cleanup: En_I* (#1400)
* cleanup I
* oops
* Start Player Item Docs (#1396)
* Copy Fig Docs
* small cleanup
* ItemChangeType comment
* bool
* item change comments
* PR Review
* rm comments
* Animation Cleanup: En_K* (#1402)
* cleanup k
* one more name
* Animation Cleanup: En_J* (#1401)
* cleanup J
* small fix
* functions
---------
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: Derek Hensley
Co-authored-by: Zach North
Co-authored-by: petrie911
---
assets/xml/objects/object_mk.xml | 83 +-
include/functions.h | 23 +-
include/macros.h | 1 +
include/variables.h | 10 +-
include/z64player.h | 12 +-
include/z64save.h | 17 +-
spec | 1 -
src/code/z_message.c | 8 +-
src/code/z_message_nes.c | 1728 ++++++++++++++++-
src/code/z_player_lib.c | 26 +-
src/code/z_skelanime.c | 3 +-
src/overlays/actors/ovl_Boss_04/z_boss_04.c | 2 +-
src/overlays/actors/ovl_Boss_04/z_boss_04.h | 2 +-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 547 +++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 10 +-
.../actors/ovl_En_Bombers/z_en_bombers.c | 2 +-
.../actors/ovl_En_Bombers/z_en_bombers.h | 2 +-
src/overlays/actors/ovl_En_Egol/z_en_egol.c | 2 +-
.../actors/ovl_En_Fishing/z_en_fishing.c | 5 +-
.../ovl_En_Guard_Nuts/z_en_guard_nuts.c | 3 +-
.../actors/ovl_En_Hanabi/z_en_hanabi.c | 1 +
.../actors/ovl_En_Heishi/z_en_heishi.c | 45 +-
.../actors/ovl_En_Heishi/z_en_heishi.h | 2 +-
src/overlays/actors/ovl_En_Hg/z_en_hg.c | 55 +-
src/overlays/actors/ovl_En_Hgo/z_en_hgo.c | 68 +-
.../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 107 +-
.../ovl_En_Hidden_Nuts/z_en_hidden_nuts.h | 9 +-
.../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 113 +-
.../actors/ovl_En_Hint_Skb/z_en_hint_skb.h | 5 +-
src/overlays/actors/ovl_En_Horse/z_en_horse.c | 148 +-
src/overlays/actors/ovl_En_Horse/z_en_horse.h | 6 +-
.../z_en_horse_link_child.c | 92 +-
src/overlays/actors/ovl_En_Hs/z_en_hs.c | 13 +-
src/overlays/actors/ovl_En_Ig/z_en_ig.c | 168 +-
src/overlays/actors/ovl_En_Ig/z_en_ig.h | 9 +-
src/overlays/actors/ovl_En_Ik/z_en_ik.c | 8 +-
src/overlays/actors/ovl_En_In/z_en_in.c | 174 +-
src/overlays/actors/ovl_En_In/z_en_in.h | 29 +-
.../actors/ovl_En_Insect/z_en_insect.c | 5 +-
.../actors/ovl_En_Insect/z_en_insect.h | 5 +-
.../z_en_invisible_ruppe.c | 3 +
src/overlays/actors/ovl_En_Ja/z_en_ja.c | 107 +-
src/overlays/actors/ovl_En_Ja/z_en_ja.h | 9 +-
.../actors/ovl_En_Jc_Mato/z_en_jc_mato.c | 2 +-
src/overlays/actors/ovl_En_Jg/z_en_jg.c | 115 +-
.../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 48 +-
src/overlays/actors/ovl_En_Js/z_en_js.c | 76 +-
.../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 50 +-
.../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 2 +-
.../actors/ovl_En_Kakasi/z_en_kakasi.c | 40 +-
src/overlays/actors/ovl_En_Kame/z_en_kame.c | 6 +-
src/overlays/actors/ovl_En_Kbt/z_en_kbt.c | 151 +-
src/overlays/actors/ovl_En_Kbt/z_en_kbt.h | 2 +-
.../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 53 +-
.../actors/ovl_En_Kendo_Js/z_en_kendo_js.h | 5 +-
src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 191 +-
src/overlays/actors/ovl_En_Kgy/z_en_kgy.h | 9 +-
.../actors/ovl_En_Kujiya/z_en_kujiya.c | 15 +
src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 7 +
src/overlays/actors/ovl_En_Mk/z_en_mk.c | 12 +-
src/overlays/actors/ovl_En_Mk/z_en_mk.h | 4 +-
src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 2 +-
src/overlays/actors/ovl_En_Pr2/z_en_pr2.h | 2 +-
.../actors/ovl_En_S_Goro/z_en_s_goro.c | 97 +-
src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 2 +-
src/overlays/actors/ovl_En_Ssh/z_en_ssh.h | 2 +-
.../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 3 +-
.../actors/ovl_player_actor/z_player.c | 996 ++++++----
tools/disasm/functions.txt | 88 +-
tools/disasm/variables.txt | 61 +-
tools/sizes/code_functions.csv | 8 +-
71 files changed, 4266 insertions(+), 1451 deletions(-)
diff --git a/assets/xml/objects/object_mk.xml b/assets/xml/objects/object_mk.xml
index 087fcc9e0..457eadf28 100644
--- a/assets/xml/objects/object_mk.xml
+++ b/assets/xml/objects/object_mk.xml
@@ -1,45 +1,46 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/functions.h b/include/functions.h
index c24ab583d..849329d94 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -884,7 +884,7 @@ s32 func_80123448(PlayState* play);
s32 Player_IsGoronOrDeku(Player* player);
s32 func_801234D4(PlayState* play);
s32 func_80123590(PlayState* play, Actor* actor);
-ItemId func_8012364C(PlayState* play, Player* player, s32 arg2);
+ItemId Player_GetItemOnButton(PlayState* play, Player* player, EquipSlot slot);
PlayerItemAction func_80123810(PlayState* play);
PlayerModelGroup Player_ActionToModelGroup(Player* player, PlayerItemAction itemAction);
void Player_SetModelsForHoldingShield(Player* player);
@@ -1009,14 +1009,14 @@ void func_80148B98(PlayState* play, u8 arg1);
void Message_DrawTextChar(PlayState* play, TexturePtr texture, Gfx** gfxP);
void func_80149C18(PlayState* play);
// void Message_FindMessage(void);
-void func_80149F74(PlayState* play, u32** ppuParm2);
+void Message_DrawItemIcon(PlayState* play, Gfx** gfxP);
void Message_HandleOcarina(PlayState* play);
void func_8014ADBC(PlayState* play, UNK_PTR puParm2);
void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 arg2);
-void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos);
+void Message_SetupLoadItemIcon(PlayState* play);
// void func_8014CCB4(void);
// void func_8014CDF0(void);
-// void func_8014CFDC(void);
+// void Message_SetupLoadItemIcon(void);
void func_8014D304(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
// void func_8014D62C(void);
// void func_8014D7B4(void);
@@ -1046,19 +1046,12 @@ void Message_Update(PlayState* play);
void func_801586A4(PlayState* play);
void Message_Init(PlayState* play);
void Message_FindMessageNES(PlayState* play, u16 textId);
-// void Message_LoadCharNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
-// void Message_LoadPluralRupeesNES(void);
-// void Message_LoadLocalizedRupeesNES(void);
-// void Message_LoadRupeesNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
-// void Message_LoadTimeNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
-// void Message_LoadOwlWarpTextNES(void);
-// void func_80159438(void);
-void func_8015966C(PlayState* play, UNK_PTR puParm2, UNK_TYPE arg3);
-// void func_8015A144(void);
-void func_8015B198(PlayState* play);
+void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos);
+void Message_DecodeNES(PlayState* play);
+void Message_FindCreditsMessage(PlayState* play, u16 textId);
void Message_FindCreditsMessage(PlayState* play, u16 textId);
void Message_DrawTextCredits(PlayState* play, Gfx** gfxP);
-// void func_8015F8A8(UNK_TYPE4 ctxt);
+void Message_DecodeCredits(PlayState* play);
uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param);
void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl);
diff --git a/include/macros.h b/include/macros.h
index 46932a0a6..bc7439394 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -38,6 +38,7 @@
#define DAY_LENGTH (CLOCK_TIME(24, 0))
#define TIME_TO_HOURS_F(time) ((time) * (24.0f / 0x10000))
+#define TIME_TO_HOURS_F_ALT(time) (TIME_TO_MINUTES_F(time) / 60.0f)
#define TIME_TO_MINUTES_F(time) ((time) * ((24.0f * 60.0f) / 0x10000)) // 0.021972656f
#define TIME_TO_MINUTES_ALT_F(time) ((time) / (0x10000 / (24.0f * 60.0f)))
#define TIME_TO_SECONDS_F(time) ((time) * ((24.0f * 60.0f * 60.0f) / 0x10000))
diff --git a/include/variables.h b/include/variables.h
index e071b2036..83427f55f 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -334,9 +334,9 @@ extern char D_801D039C[];
// extern UNK_TYPE1 D_801D045A;
// extern UNK_TYPE1 D_801D0462;
//extern UNK_TYPE1 D_801D0468;
-// extern UNK_TYPE1 D_801D0470;
-// extern char D_801D06F0[];
-// extern UNK_TYPE1 D_801D0710;
+// extern UNK_TYPE1 sNESFontWidths;
+// extern char sRupeesTextLocalization[];
+// extern UNK_TYPE1 sRupeesTextLength;
// extern char D_801D0714[];
// extern UNK_TYPE1 D_801D07C4;
// extern UNK_TYPE1 D_801D07DC;
@@ -348,8 +348,8 @@ extern char D_801D039C[];
// extern UNK_TYPE1 D_801D08CC;
// extern UNK_TYPE1 D_801D08D8;
// extern UNK_TYPE1 D_801D08E4;
-// extern UNK_TYPE1 D_801D08E8;
-// extern UNK_TYPE1 D_801D0900;
+// extern UNK_TYPE1 sMaskCodeTextENG;
+// extern UNK_TYPE1 sMaskCodeTextLengthENG;
extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[2];
// extern UNK_TYPE1 D_801D0B8C;
extern KaleidoMgrOverlay* gKaleidoMgrCurOvl;
diff --git a/include/z64player.h b/include/z64player.h
index 11145480e..3f0af150a 100644
--- a/include/z64player.h
+++ b/include/z64player.h
@@ -1040,7 +1040,7 @@ typedef enum PlayerCueId {
// breman mask march?
#define PLAYER_STATE3_20000000 (1 << 29)
//
-#define PLAYER_STATE3_40000000 (1 << 30)
+#define PLAYER_STATE3_START_CHANGING_HELD_ITEM (1 << 30)
// TARGETING_HOSTILE?
#define PLAYER_STATE3_80000000 (1 << 31)
@@ -1095,7 +1095,7 @@ typedef struct Player {
/* 0x14B */ u8 transformation; // PlayerTransformation enum
/* 0x14C */ u8 modelGroup; // PlayerModelGroup enum
/* 0x14D */ u8 nextModelGroup;
- /* 0x14E */ s8 unk_14E;
+ /* 0x14E */ s8 itemChangeType; // ItemChangeType enum
/* 0x14F */ u8 modelAnimType; // PlayerAnimType enum
/* 0x150 */ u8 leftHandType;
/* 0x151 */ u8 rightHandType;
@@ -1122,7 +1122,7 @@ typedef struct Player {
/* 0x238 */ OSMesg maskObjectLoadMsg;
/* 0x23C */ void* maskObjectSegment;
/* 0x240 */ SkelAnime skelAnime;
- /* 0x284 */ SkelAnime unk_284;
+ /* 0x284 */ SkelAnime skelAnimeUpper;
/* 0x2C8 */ SkelAnime unk_2C8;
/* 0x30C */ Vec3s jointTable[5];
/* 0x32A */ Vec3s morphTable[5];
@@ -1176,8 +1176,8 @@ typedef struct Player {
/* 0x74C */ u8 jointTableBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x7EB */ u8 morphTableBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x88A */ u8 blendTableBuffer[PLAYER_LIMB_BUF_SIZE];
- /* 0x929 */ u8 unk_929[PLAYER_LIMB_BUF_SIZE];
- /* 0x9C8 */ u8 unk_9C8[PLAYER_LIMB_BUF_SIZE];
+ /* 0x929 */ u8 jointTableUpperBuffer[PLAYER_LIMB_BUF_SIZE];
+ /* 0x9C8 */ u8 morphTableUpperBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0xA68 */ PlayerAgeProperties* ageProperties; // repurposed as "transformation properties"?
/* 0xA6C */ u32 stateFlags1;
/* 0xA70 */ u32 stateFlags2;
@@ -1206,7 +1206,7 @@ typedef struct Player {
/* 0xABC */ f32 unk_ABC;
/* 0xAC0 */ f32 unk_AC0;
/* 0xAC4 */ PlayerUpperActionFunc upperActionFunc; // Upper body/item action functions
- /* 0xAC8 */ f32 unk_AC8;
+ /* 0xAC8 */ f32 skelAnimeUpperBlendWeight;
/* 0xACC */ s16 unk_ACC;
/* 0xACE */ s8 unk_ACE;
/* 0xACF */ u8 putAwayCountdown; // Frames to wait before showing "Put Away" on A
diff --git a/include/z64save.h b/include/z64save.h
index c8075d9ec..1db5a566d 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -154,12 +154,22 @@ typedef enum {
/* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52
} HudVisibility;
+// Based on sRupeesTextLocalization
+typedef enum Language {
+ /* 0 */ LANGUAGE_JPN,
+ /* 1 */ LANGUAGE_ENG,
+ /* 2 */ LANGUAGE_GER,
+ /* 3 */ LANGUAGE_FRE,
+ /* 4 */ LANGUAGE_SPA,
+ /* 5 */ LANGUAGE_MAX
+} Language;
+
typedef enum HighScore {
/* 0 */ HS_BANK_RUPEES,
/* 1 */ HS_UNK_1,
/* 2 */ HS_FISHING, // Fishing flags
/* 3 */ HS_BOAT_ARCHERY,
- /* 4 */ HS_HOSRE_BACK_BALLOON,
+ /* 4 */ HS_HORSE_BACK_BALLOON,
/* 5 */ HS_LOTTERY_GUESS, // Lottery code chosen by player (only uses lower three hex digits)
/* 6 */ HS_SHOOTING_GALLERY, // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits.
/* 7 */ HS_MAX
@@ -520,6 +530,7 @@ typedef enum {
(gSaveContext.save.saveInfo.stolenItems = (gSaveContext.save.saveInfo.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10))
#define HIGH_SCORE(type) (gSaveContext.save.saveInfo.highScores[(type)])
+#define GET_HIGH_SCORE(type) ((void)0, gSaveContext.save.saveInfo.highScores[(type)])
#define HS_GET_BANK_RUPEES() (HIGH_SCORE(HS_BANK_RUPEES) & 0xFFFF)
#define HS_SET_BANK_RUPEES(rupees) (HIGH_SCORE(HS_BANK_RUPEES) = ((HIGH_SCORE(HS_BANK_RUPEES) & 0xFFFF0000) | (rupees)))
@@ -529,8 +540,8 @@ typedef enum {
#define HS_GET_BOAT_ARCHERY_HIGH_SCORE() ((HIGH_SCORE(HS_BOAT_ARCHERY) & 0xFFFF0000) >> 0x10)
#define HS_SET_BOAT_ARCHERY_HIGH_SCORE(score) (HIGH_SCORE(HS_BOAT_ARCHERY) = ((HIGH_SCORE(HS_BOAT_ARCHERY) & 0xFFFF) | ((u16)(score) << 0x10)))
-#define HS_GET_HORSE_BACK_BALLOON_TIME() ((s32)HIGH_SCORE(HS_HOSRE_BACK_BALLOON))
-#define HS_SET_HORSE_BACK_BALLOON_TIME(time) (HIGH_SCORE(HS_HOSRE_BACK_BALLOON) = (time))
+#define HS_GET_HORSE_BACK_BALLOON_TIME() ((s32)HIGH_SCORE(HS_HORSE_BACK_BALLOON))
+#define HS_SET_HORSE_BACK_BALLOON_TIME(time) (HIGH_SCORE(HS_HORSE_BACK_BALLOON) = (time))
#define HS_GET_LOTTERY_CODE_GUESS() (HIGH_SCORE(HS_LOTTERY_GUESS) & 0xFFFF)
#define HS_SET_LOTTERY_CODE_GUESS(guess) (HIGH_SCORE(HS_LOTTERY_GUESS) = ((HIGH_SCORE(HS_LOTTERY_GUESS) & 0xFFFF0000) | ((guess) & 0xFFFF)))
diff --git a/spec b/spec
index ae8d89485..2e2878c69 100644
--- a/spec
+++ b/spec
@@ -531,7 +531,6 @@ beginseg
include "build/data/code/z_message.data.o"
include "build/data/code/z_message.bss.o"
include "build/src/code/z_message_nes.o"
- include "build/data/code/z_message_nes.data.o"
include "build/src/code/z_message_staff.o"
include "build/src/code/z_player_call.o"
include "build/src/code/z_shrink_window.o"
diff --git a/src/code/z_message.c b/src/code/z_message.c
index 37e392aec..a922f237b 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -223,7 +223,7 @@ void Message_FindMessage(PlayState* play, u16 textId) {
font->messageEnd = nextSegment - foundSegment;
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80149F74.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_DrawItemIcon.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_HandleOcarina.s")
@@ -272,7 +272,7 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3)
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014CDF0.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014CFDC.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_SetupLoadItemIcon.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D304.s")
@@ -363,7 +363,7 @@ void func_80151A68(PlayState* play, u16 textId) {
msgCtx->msgLength = 0;
func_80150D08(play, textId);
func_80150A84(play);
- func_8015B198(play);
+ Message_DecodeNES(play);
msgCtx->msgMode = 0x45;
msgCtx->textDelayTimer = 0;
msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget = msgCtx->textColorAlpha = 0;
@@ -548,7 +548,7 @@ void func_80153E7C(PlayState* play, Gfx** gfxP) {
} else if (play->msgCtx.textIsCredits) {
Message_DrawTextCredits(play, gfxP);
} else {
- func_8015966C(play, gfxP, 0);
+ Message_DrawTextNES(play, gfxP, 0);
}
}
diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c
index 1dcb16474..6ace9acc1 100644
--- a/src/code/z_message_nes.c
+++ b/src/code/z_message_nes.c
@@ -2,59 +2,20 @@
#include "message_data_static.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
-#if 0
-
-//fontWidth
-extern f32 D_801D0470[159];
-
-//rupeesTextLocalization
-u8 D_801D06F0[4][8] = { { "rupee(s)" }, //EN
- { "rubin(e)" }, //DE
- { "rubis" }, //FR
- { "rupia(s)" } //SPA
- };
-
-// rupeesTextLength
-u8 D_801D0710[4] = {8,8,5,8};
-
-// sOwlWarpText
-char D_801D0714[OWL_WARP_MAX][16] = {
- "Great Bay Coast", // OWL_WARP_GREAT_BAY_COAST
- "Zora Cape", // OWL_WARP_ZORA_CAPE
- "Snowhead", // OWL_WARP_SNOWHEAD
- "Mountain Village", // OWL_WARP_MOUNTAIN_VILLAGE
- "Clock Town", // OWL_WARP_CLOCK_TOWN
- "Milk Road", // OWL_WARP_MILK_ROAD
- "Woodfall", // OWL_WARP_WOODFALL
- "Southern Swamp", // OWL_WARP_SOUTHERN_SWAMP
- "Ikana Canyon", // OWL_WARP_IKANA_CANYON
- "Stone Tower", // OWL_WARP_STONE_TOWER
- "Entrance", // OWL_WARP_ENTRANCE
+// fontWidth
+f32 sNESFontWidths[160] = {
+ 8.0f, 8.0f, 6.0f, 9.0f, 9.0f, 14.0f, 12.0f, 3.0f, 7.0f, 7.0f, 7.0f, 9.0f, 4.0f, 6.0f, 4.0f, 9.0f,
+ 10.0f, 5.0f, 9.0f, 9.0f, 10.0f, 9.0f, 9.0f, 9.0f, 9.0f, 9.0f, 6.0f, 6.0f, 9.0f, 11.0f, 9.0f, 11.0f,
+ 13.0f, 12.0f, 9.0f, 11.0f, 11.0f, 8.0f, 8.0f, 12.0f, 10.0f, 4.0f, 8.0f, 10.0f, 8.0f, 13.0f, 11.0f, 13.0f,
+ 9.0f, 13.0f, 10.0f, 10.0f, 9.0f, 10.0f, 11.0f, 15.0f, 11.0f, 10.0f, 10.0f, 7.0f, 10.0f, 7.0f, 10.0f, 9.0f,
+ 5.0f, 8.0f, 9.0f, 8.0f, 9.0f, 9.0f, 6.0f, 9.0f, 8.0f, 4.0f, 6.0f, 8.0f, 4.0f, 12.0f, 9.0f, 9.0f,
+ 9.0f, 9.0f, 7.0f, 8.0f, 7.0f, 8.0f, 9.0f, 12.0f, 8.0f, 9.0f, 8.0f, 7.0f, 5.0f, 7.0f, 10.0f, 6.0f,
+ 12.0f, 12.0f, 12.0f, 12.0f, 11.0f, 8.0f, 8.0f, 8.0f, 8.0f, 6.0f, 6.0f, 6.0f, 6.0f, 10.0f, 13.0f, 13.0f,
+ 13.0f, 13.0f, 10.0f, 10.0f, 10.0f, 10.0f, 9.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 9.0f, 9.0f, 9.0f, 9.0f,
+ 4.0f, 4.0f, 4.0f, 4.0f, 8.0f, 9.0f, 9.0f, 9.0f, 9.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 11.0f, 6.0f,
+ 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f, 14.0f,
};
-// sOwlWarpTextLength
-s16 D_801D07C4[OWL_WARP_MAX] = {
- 15, // OWL_WARP_GREAT_BAY_COAST
- 9, // OWL_WARP_ZORA_CAPE
- 8, // OWL_WARP_SNOWHEAD
- 16, // OWL_WARP_MOUNTAIN_VILLAGE
- 10, // OWL_WARP_CLOCK_TOWN
- 9, // OWL_WARP_MILK_ROAD
- 8, // OWL_WARP_WOODFALL
- 14, // OWL_WARP_SOUTHERN_SWAMP
- 12, // OWL_WARP_IKANA_CANYON
- 11, // OWL_WARP_STONE_TOWER
- 8, // OWL_WARP_ENTRANCE
-};
-
-#endif
-
-extern f32 D_801D0470[159];
-extern u8 D_801D06F0[4][8];
-extern u8 D_801D0710[4];
-extern u8 D_801D0714[OWL_WARP_MAX][16];
-extern s16 D_801D07C4[OWL_WARP_MAX];
-
void Message_FindMessageNES(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
Font* font = &msgCtx->font;
@@ -102,7 +63,7 @@ void Message_LoadPluralRupeesNES(PlayState* play, s16* decodedBufPos, s32* offse
s32 o = *offset;
f32 f = *arg3;
- msgCtx->decodedBuffer.schar[p] = 0x20;
+ msgCtx->decodedBuffer.schar[p] = ' ';
p++;
Font_LoadCharNES(play, 'R', o);
o += FONT_CHAR_TEX_SIZE;
@@ -134,6 +95,25 @@ void Message_LoadPluralRupeesNES(PlayState* play, s16* decodedBufPos, s32* offse
*arg3 = f;
}
+#define RUPEES_STR_EN "Rupee(s)"
+#define RUPEES_STR_DE "Rubin(e)"
+#define RUPEES_STR_FR "Rubis"
+#define RUPEES_STR_SPA "Rupia(s)"
+
+char sRupeesTextLocalization[LANGUAGE_MAX - 1][8] = {
+ RUPEES_STR_EN, // EN
+ RUPEES_STR_DE, // DE
+ RUPEES_STR_FR, // FR
+ RUPEES_STR_SPA, // SPA
+};
+
+u8 sRupeesTextLength[LANGUAGE_MAX - 1] = {
+ sizeof(RUPEES_STR_EN) - 1,
+ sizeof(RUPEES_STR_DE) - 1,
+ sizeof(RUPEES_STR_FR) - 1,
+ sizeof(RUPEES_STR_SPA) - 1,
+};
+
void Message_LoadLocalizedRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
@@ -144,15 +124,15 @@ void Message_LoadLocalizedRupeesNES(PlayState* play, s16* decodedBufPos, s32* of
msgCtx->decodedBuffer.schar[p] = ' ';
p++;
- for (j = 0; j < D_801D0710[gSaveContext.options.language - 1]; j++) {
- Font_LoadCharNES(play, D_801D06F0[gSaveContext.options.language - 1][j], o);
- msgCtx->decodedBuffer.schar[p] = D_801D06F0[gSaveContext.options.language - 1][j];
+ for (j = 0; j < sRupeesTextLength[gSaveContext.options.language - 1]; j++) {
+ Font_LoadCharNES(play, sRupeesTextLocalization[gSaveContext.options.language - 1][j], o);
+ msgCtx->decodedBuffer.schar[p] = sRupeesTextLocalization[gSaveContext.options.language - 1][j];
o += FONT_CHAR_TEX_SIZE;
p++;
}
p--;
- f += 16.0f * msgCtx->textCharScale * (D_801D0710[gSaveContext.options.language - 1] + 1);
+ f += 16.0f * msgCtx->textCharScale * (sRupeesTextLength[gSaveContext.options.language - 1] + 1);
*decodedBufPos = p;
*offset = o;
*arg3 = f;
@@ -201,7 +181,7 @@ void Message_LoadRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32
*arg3 = f;
}
-void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16* decodedBufPos) {
+void Message_LoadTimeNES(PlayState* play, u8 curChar, s32* offset, f32* arg3, s16* decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
@@ -211,12 +191,11 @@ void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16*
f32 timeLeftInMinutes;
s16 i;
- if (arg1 == 0xCF) {
+ if (curChar == 0xCF) {
timeLeft = TIME_UNTIL_MOON_CRASH;
} else {
timeLeft = TIME_UNTIL_NEW_DAY;
}
-
timeLeftInMinutes = TIME_TO_MINUTES_F(timeLeft);
digits[0] = 0;
@@ -252,6 +231,46 @@ void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16*
*arg3 = f;
}
+#define GREAT_BAY_COAST_STR "Great Bay Coast"
+#define ZORA_CAPE_STR "Zora Cape"
+#define SNOWHEAD_STR "Snowhead"
+#define MOUNTAIN_VILLAGE_STR "Mountain Village"
+#define CLOCK_TOWN_STR "Clock Town"
+#define MILK_ROAD_STR "Milk Road"
+#define WOODFALL_STR "Woodfall"
+#define SOUTHERN_SWAMP_STR "Southern Swamp"
+#define IKANA_CANYON_STR "Ikana Canyon"
+#define STONE_TOWER_STR "Stone Tower"
+#define ENTRANCE_STR "Entrance"
+
+char sOwlWarpTextENG[OWL_WARP_MAX][16] = {
+ GREAT_BAY_COAST_STR, // OWL_WARP_GREAT_BAY_COAST
+ ZORA_CAPE_STR, // OWL_WARP_ZORA_CAPE
+ SNOWHEAD_STR, // OWL_WARP_SNOWHEAD
+ MOUNTAIN_VILLAGE_STR, // OWL_WARP_MOUNTAIN_VILLAGE
+ CLOCK_TOWN_STR, // OWL_WARP_CLOCK_TOWN
+ MILK_ROAD_STR, // OWL_WARP_MILK_ROAD
+ WOODFALL_STR, // OWL_WARP_WOODFALL
+ SOUTHERN_SWAMP_STR, // OWL_WARP_SOUTHERN_SWAMP
+ IKANA_CANYON_STR, // OWL_WARP_IKANA_CANYON
+ STONE_TOWER_STR, // OWL_WARP_STONE_TOWER
+ ENTRANCE_STR, // OWL_WARP_ENTRANCE
+};
+
+s16 sOwlWarpTextLengthENG[OWL_WARP_MAX] = {
+ sizeof(GREAT_BAY_COAST_STR) - 1, // OWL_WARP_GREAT_BAY_COAST
+ sizeof(ZORA_CAPE_STR) - 1, // OWL_WARP_ZORA_CAPE
+ sizeof(SNOWHEAD_STR) - 1, // OWL_WARP_SNOWHEAD
+ sizeof(MOUNTAIN_VILLAGE_STR) - 1, // OWL_WARP_MOUNTAIN_VILLAGE
+ sizeof(CLOCK_TOWN_STR) - 1, // OWL_WARP_CLOCK_TOWN
+ sizeof(MILK_ROAD_STR) - 1, // OWL_WARP_MILK_ROAD
+ sizeof(WOODFALL_STR) - 1, // OWL_WARP_WOODFALL
+ sizeof(SOUTHERN_SWAMP_STR) - 1, // OWL_WARP_SOUTHERN_SWAMP
+ sizeof(IKANA_CANYON_STR) - 1, // OWL_WARP_IKANA_CANYON
+ sizeof(STONE_TOWER_STR) - 1, // OWL_WARP_STONE_TOWER
+ sizeof(ENTRANCE_STR) - 1, // OWL_WARP_ENTRANCE
+};
+
void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
@@ -267,18 +286,18 @@ void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* de
} else {
owlWarpId = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP];
}
- stringLimit = D_801D07C4[owlWarpId];
+ stringLimit = sOwlWarpTextLengthENG[owlWarpId];
for (i = 0; i < stringLimit; i++) {
- msgCtx->decodedBuffer.schar[p] = D_801D0714[owlWarpId][i];
+ msgCtx->decodedBuffer.schar[p] = sOwlWarpTextENG[owlWarpId][i];
currentChar = msgCtx->decodedBuffer.schar[p];
if (currentChar != ' ') {
- Font_LoadCharNES(play, D_801D0714[owlWarpId][i], o);
+ Font_LoadCharNES(play, sOwlWarpTextENG[owlWarpId][i], o);
o += FONT_CHAR_TEX_SIZE;
}
currentChar = msgCtx->decodedBuffer.schar[p];
p++;
- f += (D_801D0470[currentChar - ' '] * msgCtx->textCharScale);
+ f += (sNESFontWidths[currentChar - ' '] * msgCtx->textCharScale);
}
p--;
@@ -288,8 +307,1585 @@ void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* de
*arg2 = f;
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_nes/func_80159438.s")
+void Message_GetTimerDigitsNES(OSTime time, s16* digits) {
+ OSTime t = time;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_nes/func_8015966C.s")
+ // 6 minutes
+ digits[0] = t / SECONDS_TO_TIMER(360);
+ t -= (digits[0] * SECONDS_TO_TIMER(360));
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_nes/func_8015B198.s")
+ // minutes
+ digits[1] = t / SECONDS_TO_TIMER(60);
+ t -= (digits[1] * SECONDS_TO_TIMER(60));
+
+ digits[2] = '\'';
+
+ // 10 seconds
+ digits[3] = t / SECONDS_TO_TIMER(10);
+ t -= digits[3] * SECONDS_TO_TIMER(10);
+
+ // seconds
+ digits[4] = t / SECONDS_TO_TIMER(1);
+ t -= digits[4] * SECONDS_TO_TIMER(1);
+
+ digits[5] = '"';
+
+ // 100 milliseconds
+ digits[6] = t / SECONDS_TO_TIMER_PRECISE(0, 10);
+ t -= digits[6] * SECONDS_TO_TIMER_PRECISE(0, 10);
+
+ // 10 milliseconds
+ digits[7] = t;
+
+ digits[0] += '0';
+ digits[1] += '0';
+ digits[3] += '0';
+ digits[4] += '0';
+ digits[6] += '0';
+ digits[7] += '0';
+}
+
+Color_RGB16 D_801D07DC[] = {
+ { 255, 120, 0 }, { 70, 255, 80 }, { 80, 110, 255 }, { 255, 255, 30 },
+ { 90, 180, 255 }, { 210, 100, 255 }, { 170, 170, 170 }, { 255, 130, 30 },
+};
+
+Color_RGB16 D_801D080C[] = {
+ { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 },
+ { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 },
+};
+
+Color_RGB16 D_801D083C[] = {
+ { 255, 60, 60 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 },
+ { 80, 150, 255 }, { 255, 150, 180 }, { 180, 180, 200 }, { 255, 130, 30 },
+};
+
+Color_RGB16 D_801D086C[] = {
+ { 195, 0, 0 }, { 70, 255, 80 }, { 80, 90, 255 }, { 255, 255, 50 },
+ { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 },
+};
+
+Color_RGB16 D_801D089C[] = {
+ { 255, 60, 60 }, { 110, 170, 255 }, { 80, 90, 255 }, { 255, 255, 50 },
+ { 80, 150, 255 }, { 255, 150, 180 }, { 170, 170, 170 }, { 255, 130, 30 },
+};
+
+u8 D_801D08CC[] = {
+ 0x02, 0x01, 0x03, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x01, 0x06,
+};
+
+void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) {
+ MessageContext* msgCtx = &play->msgCtx;
+ u16 i;
+ u16 j;
+ Font* font = &msgCtx->font;
+ u16 charTexIndex;
+ u16 stateTimerHi;
+ Gfx* gfx = *gfxP;
+ u16 character;
+ s16 sp130;
+ s16 sp12E;
+ s16 sp12C;
+ s16 sp12A;
+
+ msgCtx->textPosX = msgCtx->unk11F1A[0] + msgCtx->unk11FF8;
+ msgCtx->textPosY = msgCtx->unk11FFA;
+
+ sp130 = 0;
+ if (!msgCtx->textIsCredits) {
+ msgCtx->textPosY = msgCtx->unk11FFA;
+ } else {
+ msgCtx->textPosY = 48;
+ }
+
+ if (msgCtx->itemId != 0xFE) {
+ Message_DrawItemIcon(play, &gfx);
+ }
+
+ msgCtx->textColorR = msgCtx->unk120C8;
+ msgCtx->textColorG = msgCtx->unk120CA;
+ msgCtx->textColorB = msgCtx->unk120CC;
+
+ charTexIndex = 0;
+
+ for (i = textDrawPos; i < msgCtx->textDrawPos; i++) {
+ character = msgCtx->decodedBuffer.schar[i];
+
+ switch (character) {
+ case 0x0:
+ if (play->pauseCtx.bombersNotebookOpen || (msgCtx->textBoxType == TEXTBOX_TYPE_D)) {
+ msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 0;
+ } else if (msgCtx->textBoxType == TEXTBOX_TYPE_5) {
+ msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 0;
+ } else {
+ msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 255;
+ }
+
+ if ((i + 1) == msgCtx->textDrawPos) {
+ msgCtx->textDrawPos++;
+ }
+ break;
+
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ case 0x7:
+ case 0x8:
+ if ((msgCtx->msgMode >= MSGMODE_NEW_CYCLE_0) && (msgCtx->msgMode <= MSGMODE_OWL_SAVE_2) &&
+ (character == 0x2)) {
+ msgCtx->textDrawPos = msgCtx->decodedTextLen;
+ if (msgCtx->unk120D6) {
+ msgCtx->unk120D4 += 25;
+ if (msgCtx->unk120D4 >= 100) {
+ msgCtx->unk120D6 = false;
+ }
+ } else {
+ msgCtx->unk120D4 -= 25;
+ if (msgCtx->unk120D4 <= -100) {
+ msgCtx->unk120D6 = true;
+ }
+ }
+
+ if (D_801D07DC[(s16)(character - 1)].r + msgCtx->unk120D4 < 0) {
+ msgCtx->textColorR = 0;
+ } else {
+ msgCtx->textColorR = D_801D07DC[(s16)(character - 1)].r + msgCtx->unk120D4;
+ }
+
+ if (D_801D07DC[(s16)(character - 1)].g + msgCtx->unk120D4 >= 255) {
+ msgCtx->textColorG = D_801D07DC[(s16)(character - 1)].g;
+ } else {
+ msgCtx->textColorG = D_801D07DC[(s16)(character - 1)].g + msgCtx->unk120D4;
+ }
+
+ if (D_801D07DC[(s16)(character - 1)].b + msgCtx->unk120D4 < 0) {
+ msgCtx->textColorB = 0;
+ } else {
+ msgCtx->textColorB = D_801D07DC[(s16)(character - 1)].b + msgCtx->unk120D4;
+ }
+
+ } else if (play->pauseCtx.bombersNotebookOpen) {
+ msgCtx->textColorR = D_801D089C[(s16)(character - 1)].r;
+ msgCtx->textColorG = D_801D089C[(s16)(character - 1)].g;
+ msgCtx->textColorB = D_801D089C[(s16)(character - 1)].b;
+ } else if (msgCtx->textBoxType == TEXTBOX_TYPE_1) {
+ msgCtx->textColorR = D_801D07DC[(s16)(character - 1)].r;
+ msgCtx->textColorG = D_801D07DC[(s16)(character - 1)].g;
+ msgCtx->textColorB = D_801D07DC[(s16)(character - 1)].b;
+ } else if (msgCtx->textBoxType == TEXTBOX_TYPE_D) {
+ msgCtx->textColorR = D_801D086C[(s16)(character - 1)].r;
+ msgCtx->textColorG = D_801D086C[(s16)(character - 1)].g;
+ msgCtx->textColorB = D_801D086C[(s16)(character - 1)].b;
+ } else {
+ msgCtx->textColorR = D_801D080C[(s16)(character - 1)].r;
+ msgCtx->textColorG = D_801D080C[(s16)(character - 1)].g;
+ msgCtx->textColorB = D_801D080C[(s16)(character - 1)].b;
+ }
+
+ if ((i + 1) == msgCtx->textDrawPos) {
+ msgCtx->textDrawPos++;
+ }
+ break;
+
+ case 0x20: // ` `
+ msgCtx->textPosX += 6;
+ break;
+
+ case 0x11:
+ msgCtx->textPosY += msgCtx->unk11FFC;
+ // fallthrough
+ case 0x13:
+ sp130++;
+
+ msgCtx->textPosX = msgCtx->unk11F1A[sp130] + msgCtx->unk11FF8;
+ if (msgCtx->choiceNum == 1) {
+ if (!play->pauseCtx.bombersNotebookOpen) {
+ msgCtx->textPosX += 16;
+ } else {
+ msgCtx->textPosX += 50;
+ }
+ } else if (msgCtx->choiceNum == 2) {
+ if (msgCtx->unk120D8 != 3) {
+ if (!play->pauseCtx.bombersNotebookOpen) {
+ msgCtx->textPosX += 10;
+ } else {
+ msgCtx->textPosX += 57;
+ }
+ } else if (sp130 >= 2) {
+ if (!play->pauseCtx.bombersNotebookOpen) {
+ msgCtx->textPosX += 10;
+ } else {
+ msgCtx->textPosX += 57;
+ }
+ }
+ }
+ continue;
+
+ case 0x10:
+ case 0x12:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ if (!msgCtx->textboxSkipped) {
+ Audio_PlaySfx(NA_SE_NONE);
+ msgCtx->msgMode = MSGMODE_TEXT_AWAIT_NEXT;
+ Font_LoadMessageBoxEndIcon(font, 0);
+ } else {
+ msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG;
+ msgCtx->textUnskippable = false;
+ msgCtx->msgBufPos++;
+ }
+ msgCtx->unk120CE = msgCtx->textColorR;
+ msgCtx->unk120D0 = msgCtx->textColorG;
+ msgCtx->unk120D2 = msgCtx->textColorB;
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x17: // MESSAGE_QUICKTEXT_ENABLE
+ if ((i + 1) == msgCtx->textDrawPos) {
+ j = i;
+ if ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) ||
+ ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING) && (msgCtx->msgMode <= MSGMODE_26))) {
+ //! FAKE:
+ dummy:;
+ while (true) {
+ if ((msgCtx->decodedBuffer.schar[j] != 0x18) && (msgCtx->decodedBuffer.schar[j] != 0x1A) &&
+ (msgCtx->decodedBuffer.schar[j] != 0x19) && (msgCtx->decodedBuffer.schar[j] != 0xE0) &&
+ (msgCtx->decodedBuffer.schar[j] != 0x10) && (msgCtx->decodedBuffer.schar[j] != 0x12)) {
+ j++;
+ continue;
+ }
+ break;
+ }
+ i = j - 1;
+ msgCtx->textDrawPos = i + 1;
+ }
+ }
+ break;
+
+ case 0x18: // MESSAGE_QUICKTEXT_DISABLE
+ break;
+
+ case 0x1B: // MESSAGE_BOX_BREAK_DELAYED
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8;
+ stateTimerHi |= msgCtx->decodedBuffer.schar[++i];
+ msgCtx->stateTimer = stateTimerHi;
+ msgCtx->msgMode = MSGMODE_TEXT_DELAYED_BREAK;
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x1C:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ if (msgCtx->unk11F0C == 3) {
+ msgCtx->textboxEndType = 0x55;
+ } else {
+ msgCtx->textboxEndType = 0x50;
+ }
+ stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8;
+ stateTimerHi |= msgCtx->decodedBuffer.schar[++i];
+ msgCtx->stateTimer = stateTimerHi;
+ Font_LoadMessageBoxEndIcon(font, 1);
+ if (play->csCtx.state == CS_STATE_IDLE) {
+ func_8011552C(play, DO_ACTION_RETURN);
+ }
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x1D:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ msgCtx->textboxEndType = 0x52;
+ stateTimerHi = msgCtx->decodedBuffer.schar[++i] << 8;
+ stateTimerHi |= msgCtx->decodedBuffer.schar[++i];
+ msgCtx->stateTimer = stateTimerHi;
+ Font_LoadMessageBoxEndIcon(font, 1);
+ if (play->csCtx.state == CS_STATE_IDLE) {
+ func_8011552C(play, DO_ACTION_RETURN);
+ }
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x1E: // MESSAGE_SFX
+ if (((i + 1) == msgCtx->textDrawPos) && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING)) {
+ stateTimerHi = msgCtx->decodedBuffer.schar[i + 1] << 8;
+ stateTimerHi |= msgCtx->decodedBuffer.schar[i + 2];
+ Audio_PlaySfx(stateTimerHi);
+ }
+ if ((i + 1) == msgCtx->textDrawPos) {
+ msgCtx->textDrawPos += 2;
+ }
+ i += 2;
+ break;
+
+ case 0x1F:
+ if (((i + 1) == msgCtx->textDrawPos) && (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING)) {
+ msgCtx->msgMode = MSGMODE_9;
+ stateTimerHi = msgCtx->decodedBuffer.schar[i + 1] << 8;
+ stateTimerHi |= msgCtx->decodedBuffer.schar[i + 2];
+ msgCtx->textDelayTimer = stateTimerHi;
+ }
+ i += 2;
+ break;
+
+ case 0xA:
+ i++;
+ character = msgCtx->decodedBuffer.schar[i];
+ switch (character) {
+ case 0x0:
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ msgCtx->textDelay = character - 0x0;
+ if ((i + 1) == msgCtx->textDrawPos) {
+ msgCtx->textDrawPos++;
+ }
+ break;
+ }
+ break;
+
+ case 0xC1: // MESSAGE_BACKGROUND
+ msgCtx->textPosX = 0x2D;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Audio_PlaySfx(NA_SE_NONE);
+ }
+
+ gDPPipeSync(gfx++);
+ gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, msgCtx->textColorAlpha);
+ gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + 0x1000, G_IM_FMT_I, 96, 48, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, (msgCtx->unk12012 + 1) << 2,
+ (msgCtx->textPosX + 0x60) << 2, (msgCtx->unk12012 + 0x31) << 2, G_TX_RENDERTILE, 0,
+ 0, 1 << 10, 1 << 10);
+ gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + 0x1900, G_IM_FMT_I, 96, 48, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x60) << 2, (msgCtx->unk12012 + 1) << 2,
+ (msgCtx->textPosX + 0xC1) << 2, (msgCtx->unk12012 + 0x31) << 2, G_TX_RENDERTILE, 0,
+ 0, 1 << 10, 1 << 10);
+
+ gDPPipeSync(gfx++);
+ gDPSetPrimColor(gfx++, 0, 0, 255, 60, 0, msgCtx->textColorAlpha);
+ gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + 0x1000, G_IM_FMT_I, 96, 48, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, msgCtx->unk12012 << 2, (msgCtx->textPosX + 0x60) << 2,
+ (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+ gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + 0x1900, G_IM_FMT_I, 96, 48, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ gSPTextureRectangle(gfx++, (msgCtx->textPosX + 0x60) << 2, msgCtx->unk12012 << 2,
+ (msgCtx->textPosX + 0xC0) << 2, (msgCtx->unk12012 + 0x30) << 2, G_TX_RENDERTILE, 0,
+ 0, 1 << 10, 1 << 10);
+
+ gDPPipeSync(gfx++);
+ gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
+ PRIMITIVE, 0);
+
+ msgCtx->textPosX += 32;
+ break;
+
+ case 0xC2:
+ msgCtx->textboxEndType = 0x10;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->choiceTextId = msgCtx->currentTextId;
+ msgCtx->stateTimer = 4;
+ Font_LoadMessageBoxEndIcon(font, 2);
+ if (msgCtx->unk120D8 != 3) {
+ msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 0xE);
+ msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x1A);
+ msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x26);
+ }
+ }
+ break;
+
+ case 0xC3:
+ msgCtx->textboxEndType = 0x11;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->choiceTextId = msgCtx->currentTextId;
+ msgCtx->stateTimer = 4;
+ Font_LoadMessageBoxEndIcon(font, 2);
+ if (msgCtx->unk120D8 != 3) {
+ msgCtx->unk11FFE[0] = (s16)(msgCtx->textboxYTarget + 0xE);
+ msgCtx->unk11FFE[1] = (s16)(msgCtx->textboxYTarget + 0x1A);
+ msgCtx->unk11FFE[2] = (s16)(msgCtx->textboxYTarget + 0x26);
+ }
+ }
+ break;
+
+ case 0xCC:
+ msgCtx->textboxEndType = 0x60;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Font_LoadMessageBoxEndIcon(font, 1);
+ }
+ break;
+
+ case 0xD0:
+ msgCtx->textboxEndType = 0x61;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Font_LoadMessageBoxEndIcon(font, 1);
+ }
+ break;
+
+ case 0xD1:
+ msgCtx->textboxEndType = 0x62;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Font_LoadMessageBoxEndIcon(font, 1);
+ }
+ break;
+
+ case 0xD2:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ msgCtx->textboxEndType = 0x41;
+ Font_LoadMessageBoxEndIcon(font, 0);
+ Audio_PlaySfx(NA_SE_SY_MESSAGE_END);
+ }
+ break;
+
+ case 0xD5:
+ msgCtx->textboxEndType = 0x63;
+
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Font_LoadMessageBoxEndIcon(font, 1);
+ }
+ break;
+
+ case 0x15:
+ case 0xBF:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ if (msgCtx->textBoxType == TEXTBOX_TYPE_3) {
+ Message_HandleOcarina(play);
+ *gfxP = gfx;
+ return;
+ }
+
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ if (msgCtx->textboxEndType == 0) {
+ Audio_PlaySfx(NA_SE_SY_MESSAGE_END);
+ if (character == 0xBF) {
+ Font_LoadMessageBoxEndIcon(font, 1);
+ } else {
+ Font_LoadMessageBoxEndIcon(font, 0);
+ }
+ if (play->csCtx.state == CS_STATE_IDLE) {
+ func_8011552C(play, DO_ACTION_RETURN);
+ }
+ } else {
+ Audio_PlaySfx(NA_SE_NONE);
+ }
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x1A:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ Audio_PlaySfx(NA_SE_NONE);
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ msgCtx->textboxEndType = 0x30;
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0x19:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ msgCtx->textboxEndType = 0x40;
+ Font_LoadMessageBoxEndIcon(font, 0);
+ Audio_PlaySfx(NA_SE_SY_MESSAGE_END);
+ }
+ *gfxP = gfx;
+ return;
+
+ case 0xE0:
+ if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
+ msgCtx->msgMode = MSGMODE_TEXT_DONE;
+ msgCtx->textboxEndType = 0x42;
+ Font_LoadMessageBoxEndIcon(font, 1);
+ Audio_PlaySfx(NA_SE_SY_MESSAGE_END);
+ }
+ *gfxP = gfx;
+ return;
+
+ default:
+ switch (character) {
+ case 0x8169:
+ case 0x8175:
+ msgCtx->textPosX -= (s16)(6.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x8145:
+ msgCtx->textPosX -= (s16)(3.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x8148:
+ case 0x8149:
+ msgCtx->textPosX -= (s16)(2.0f * msgCtx->textCharScale);
+ break;
+
+ default:
+ break;
+ }
+ if ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) && ((i + 1) == msgCtx->textDrawPos)) {
+ Audio_PlaySfx(NA_SE_NONE);
+ }
+ if ((character >= 0xB0) && (character <= 0xBB)) {
+ sp12E = msgCtx->textColorR;
+ sp12C = msgCtx->textColorG;
+ sp12A = msgCtx->textColorB;
+ msgCtx->textColorR = D_801D083C[(s16)D_801D08CC[character - 0xB0]].r;
+ msgCtx->textColorG = D_801D083C[(s16)D_801D08CC[character - 0xB0]].g;
+ msgCtx->textColorB = D_801D083C[(s16)D_801D08CC[character - 0xB0]].b;
+ Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx);
+ msgCtx->textColorR = sp12E;
+ msgCtx->textColorG = sp12C;
+ msgCtx->textColorB = sp12A;
+ } else if (msgCtx->msgMode >= MSGMODE_OWL_SAVE_0) {
+ if ((i < (msgCtx->decodedTextLen - 6)) || (i >= (msgCtx->decodedTextLen - 4))) {
+ Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx);
+ }
+ } else {
+ Message_DrawTextChar(play, &font->charBuf[font->unk_11D88][charTexIndex], &gfx);
+ }
+ charTexIndex += FONT_CHAR_TEX_SIZE;
+
+ //! @TODO: u8 character but > 0x255 cases
+ switch (character) {
+ case 0x8144:
+ msgCtx->textPosX += (s16)(8.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x816A:
+ case 0x8176:
+ msgCtx->textPosX += (s16)(10.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x8141:
+ case 0x8142:
+ case 0x8168:
+ msgCtx->textPosX += (s16)(12.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x8194:
+ msgCtx->textPosX += (s16)(14.0f * msgCtx->textCharScale);
+ break;
+
+ case 0x8145:
+ msgCtx->textPosX += (s16)(15.0f * msgCtx->textCharScale);
+ break;
+
+ default:
+ if (((msgCtx->textboxEndType == 0x62) && (i >= msgCtx->unk120C0) &&
+ ((msgCtx->unk120C0 + 4) >= i)) ||
+ ((msgCtx->textboxEndType == 0x63) && (i >= msgCtx->unk120C0) &&
+ ((msgCtx->unk120C0 + 2) >= i)) ||
+ ((msgCtx->textboxEndType == 0x60) && (i >= msgCtx->unk120C0) &&
+ ((msgCtx->unk120C0 + 2) >= i)) ||
+ ((msgCtx->textboxEndType == 0x61) && (i >= msgCtx->unk120C0) &&
+ ((msgCtx->unk120C0 + 1) >= i))) {
+ msgCtx->textPosX += (s32)(16.0f * msgCtx->textCharScale);
+ } else {
+ msgCtx->textPosX += (s32)(sNESFontWidths[character - ' '] * msgCtx->textCharScale);
+ }
+ break;
+ }
+ break;
+ }
+ }
+
+ if (msgCtx->textDelayTimer == 0) {
+ msgCtx->textDrawPos = i + 1;
+ msgCtx->textDelayTimer = 0;
+ if (msgCtx->msgMode == MSGMODE_9) {
+ msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING;
+ }
+ } else {
+ msgCtx->textDelayTimer--;
+ }
+
+ *gfxP = gfx;
+}
+
+char D_801D08D8[][4] = {
+ "Fast",
+ "----",
+ "Slow",
+};
+
+u8 D_801D08E4[] = {
+ 0x01,
+ 0x03,
+ 0x04,
+ 0x02,
+};
+
+#define RED_STR "RED"
+#define BLUE_STR "BLUE"
+#define YELLOW_STR "YELLOW"
+#define GREEN_STR "GREEN"
+
+char sMaskCodeTextENG[][6] = {
+ RED_STR,
+ BLUE_STR,
+ YELLOW_STR,
+ GREEN_STR,
+};
+
+u8 sMaskCodeTextLengthENG[] = {
+ sizeof(RED_STR) - 1,
+ sizeof(BLUE_STR) - 1,
+ sizeof(YELLOW_STR) - 1,
+ sizeof(GREEN_STR) - 1,
+};
+
+#ifdef NON_MATCHING
+// https://decomp.me/scratch/w2ckG
+void Message_DecodeNES(PlayState* play) {
+ f32 var_fs0;
+ MessageContext* msgCtx = &play->msgCtx;
+ u8* ptr;
+ Font* font = &msgCtx->font; // spE0
+ Player* player; // spDC
+ s16 decodedBufPos; // spDA
+ s16 value;
+ u32 timeToMoonCrash;
+ s16 i; // s1
+ s16 spD0; // numLines
+ s16 digits[4]; // spC8/CA/CC/CE
+ s16 spC6;
+ f32 timeInSeconds;
+ s32 charTexIdx; // spBC
+ s16 loadChar;
+ s16 spA8[8];
+ f32 spA4;
+ s16 playerNameLen; // s0
+ s16 var_v1_3;
+ u8 curChar; // sp78
+ s8 charOffset;
+ s16 temp_s2_2;
+ s16 var_s2_9;
+
+ player = GET_PLAYER(play);
+ decodedBufPos = 0;
+ spC6 = 0;
+ charTexIdx = 0;
+ spD0 = 0;
+ msgCtx->textDelayTimer = 0;
+ msgCtx->textDelay = msgCtx->textDelayTimer;
+ msgCtx->textFade = 0;
+ spA4 = 0.0f;
+ font->unk_11D88 = (font->unk_11D88 ^ 1) & 1;
+ Message_SetupLoadItemIcon(play);
+
+ while (true) {
+ curChar = font->msgBuf.schar[msgCtx->msgBufPos];
+ msgCtx->decodedBuffer.schar[decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos];
+
+ if ((curChar == 0x10) || (curChar == 0x12) || (curChar == 0x1B) || (curChar == 0x1C) || (curChar == 0x1D) ||
+ (curChar == 0x19) || (curChar == 0xE0) || (curChar == 0xBF) || (curChar == 0x15) || (curChar == 0x1A)) {
+ msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING;
+ msgCtx->textDrawPos = 1;
+ if (msgCtx->textBoxType == TEXTBOX_TYPE_3) {
+ msgCtx->unk11FFA = msgCtx->textboxY + 2;
+ } else {
+ msgCtx->unk11FFA = msgCtx->textboxY + 8;
+ }
+ msgCtx->unk11F1A[spC6] = 0;
+ if (msgCtx->unk11F18 != 0) {
+ msgCtx->unk11F1A[spC6] = (s16)((msgCtx->textCharScale * 16.0f * 16.0f) - spA4) / 2;
+ }
+ spA4 = 0.0f;
+ if (curChar == 0x12) {
+ if ((msgCtx->textBoxType != TEXTBOX_TYPE_3) && (msgCtx->textBoxType != TEXTBOX_TYPE_4)) {
+ if (spD0 < 2) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(10);
+ } else if (spD0 == 2) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(11);
+ } else if (spD0 == 3) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(12);
+ }
+ }
+ } else {
+ if ((msgCtx->textBoxType != TEXTBOX_TYPE_3) && (msgCtx->textBoxType != TEXTBOX_TYPE_4)) {
+ if (spD0 == 0) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(13) + XREG(10);
+ } else if (spD0 == 1) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(13) + XREG(11);
+ } else if (spD0 == 2) {
+ msgCtx->unk11FFA = msgCtx->textboxY + XREG(13) + XREG(12);
+ }
+ }
+ }
+
+ //! FAKE: Perhaps a locally required temp for scoping
+ dummy:;
+ if ((curChar == 0x1B) || (curChar == 0x1C) || (curChar == 0x1D)) {
+ //! FAKE: & 0xFFFF to fix regalloc
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 1] & 0xFFFF;
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[msgCtx->msgBufPos + 2];
+ msgCtx->msgBufPos += 3;
+ }
+ msgCtx->decodedTextLen = decodedBufPos;
+ msgCtx->unk120D8 = spD0;
+ if (msgCtx->textboxSkipped || (msgCtx->textBoxType == TEXTBOX_TYPE_1) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_3) || (msgCtx->textBoxType == TEXTBOX_TYPE_6) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_8) || (msgCtx->textBoxType == TEXTBOX_TYPE_9) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_B) || (msgCtx->unk11F0C == 3)) {
+ msgCtx->textDrawPos = msgCtx->decodedTextLen;
+ }
+ msgCtx->unk120C8 = msgCtx->unk120CE;
+ msgCtx->unk120CA = msgCtx->unk120D0;
+ msgCtx->unk120CC = msgCtx->unk120D2;
+ break;
+ } else if (curChar == 0x16) {
+ // Substitute the player name control character for the file's player name.
+ for (playerNameLen = ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); playerNameLen > 0;
+ playerNameLen--) {
+ if (gSaveContext.save.saveInfo.playerData.playerName[playerNameLen - 1] != 0x3E) {
+ break;
+ }
+ }
+
+ for (i = 0; i < playerNameLen; i++) {
+ curChar = gSaveContext.save.saveInfo.playerData.playerName[i];
+ if (curChar == 0x3E) {
+ curChar = ' ';
+ } else if (curChar == 0x40) {
+ curChar = '.';
+ } else if (curChar == 0x3F) {
+ curChar = '-';
+ } else if (curChar < 0xA) {
+ charOffset = curChar;
+ curChar = '0' + charOffset;
+ } else if (curChar < 0x24) {
+ charOffset = curChar;
+ curChar = 'A' - 10 + charOffset;
+ } else if (curChar < 0x3E) {
+ charOffset = curChar;
+ curChar = 'a' - 36 + charOffset;
+ }
+ if (curChar != ' ') {
+ Font_LoadCharNES(play, curChar, charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ }
+ msgCtx->decodedBuffer.schar[decodedBufPos] = curChar;
+ decodedBufPos++;
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xC1) {
+ //! TODO: + 0x900 on the first one?
+ DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1000, SEGMENT_ROM_START(message_texture_static), 0x900);
+ DmaMgr_SendRequest0(msgCtx->textboxSegment + 0x1900,
+ (uintptr_t)SEGMENT_ROM_START(message_texture_static) + 0x900, 0x900);
+ spD0 = 2;
+ spC6 = 2;
+ msgCtx->unk12012 = msgCtx->textboxY + 8;
+ msgCtx->unk11F18 = 1;
+ msgCtx->unk12010 = XREG(47);
+ } else if (curChar == 0xC2) {
+ msgCtx->unk11F18 = 0;
+ msgCtx->choiceNum = 2;
+ } else if (curChar == 0xC3) {
+ msgCtx->unk11F18 = 0;
+ msgCtx->choiceNum = 3;
+ msgCtx->unk11FF8 = msgCtx->unk11FF8 + 0x16;
+ } else if (curChar == 0xC4) {
+ Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8);
+
+ loadChar = false;
+ for (i = 0; i < 5; i++) {
+ if ((i == 1) || (spA8[i + 3] != '0')) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, spA8[i + 3], &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ decodedBufPos--;
+ } else if ((curChar == 0xC5) || (curChar == 0xC6) || (curChar == 0xC7) || (curChar == 0xC8) ||
+ (curChar == 0xC9)) {
+ Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8);
+
+ loadChar = false;
+ for (i = 0; i < 8; i++) {
+ if ((i == 4) || ((i != 2) && (i != 5) && (spA8[i] != '0'))) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, spA8[i], &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xCA) {
+ digits[0] = 0;
+ timeInSeconds = TIME_TO_MINUTES_F(gSaveContext.save.time);
+
+ digits[1] = timeInSeconds / 60.0f;
+ while (digits[1] >= 10) {
+ digits[0]++;
+ digits[1] -= 10;
+ }
+
+ digits[2] = 0;
+ digits[3] = (s32)timeInSeconds % 60;
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ for (i = 0; i < 4; i++) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ if (i == 1) {
+ Font_LoadCharNES(play, '"', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = 0x22;
+ decodedBufPos++;
+ } else if (i == 3) {
+ Font_LoadCharNES(play, 0x27, charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = 0x27;
+ }
+ }
+ spA4 += 6 * (16.0f * msgCtx->textCharScale);
+ } else if (curChar == 0xCB) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = Flags_GetAllTreasure(play);
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xCC) {
+ decodedBufPos++;
+ msgCtx->unk120BE = spC6;
+ msgCtx->unk120C0 = decodedBufPos;
+ msgCtx->unk120C2 = 2;
+ msgCtx->bankRupeesSelected = 0;
+ msgCtx->unk120C4 = charTexIdx;
+ digits[0] = digits[1] = digits[2] = 0;
+
+ for (i = 0; i < 3; i++) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ Message_LoadLocalizedRupeesNES(play, &decodedBufPos, &charTexIdx, &spA4);
+ } else if (curChar == 0xCD) {
+ digits[0] = digits[1] = 0;
+ digits[2] = msgCtx->bankRupeesSelected;
+
+ while (digits[2] >= 100) {
+ digits[0]++;
+ digits[2] -= 100;
+ }
+
+ while (digits[2] >= 10) {
+ digits[1]++;
+ digits[2] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 3; i++) {
+ if ((i == 2) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ Message_LoadRupeesNES(play, &decodedBufPos, &charTexIdx, &spA4, msgCtx->bankRupeesSelected);
+ } else if (curChar == 0xCE) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = msgCtx->bankRupees;
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ Message_LoadRupeesNES(play, &decodedBufPos, &charTexIdx, &spA4, msgCtx->bankRupees);
+ } else if (curChar == 0xCF) {
+ Message_LoadTimeNES(play, curChar, &charTexIdx, &spA4, &decodedBufPos);
+ } else if (curChar == 0xC) {
+ digits[0] = digits[1] = 0;
+ digits[2] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex];
+
+ while (digits[2] >= 100) {
+ digits[0]++;
+ digits[2] -= 100;
+ }
+ while (digits[2] >= 10) {
+ digits[1]++;
+ digits[2] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 3; i++) {
+ if ((i == 2) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+
+ if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 1) ||
+ (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 21)) {
+ Message_LoadCharNES(play, 's', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 't', &charTexIdx, &spA4, decodedBufPos);
+ } else if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 2) ||
+ (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 22)) {
+ Message_LoadCharNES(play, 'n', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'd', &charTexIdx, &spA4, decodedBufPos);
+ } else if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 3) ||
+ (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 23)) {
+ Message_LoadCharNES(play, 'r', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'd', &charTexIdx, &spA4, decodedBufPos);
+ } else {
+ Message_LoadCharNES(play, 't', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'h', &charTexIdx, &spA4, decodedBufPos);
+ }
+ } else if (curChar == 0xD) {
+ digits[0] = digits[1] = 0;
+ digits[2] = Inventory_GetSkullTokenCount(play->sceneId);
+
+ while (digits[2] >= 100) {
+ digits[0]++;
+ digits[2] -= 100;
+ }
+ while (digits[2] >= 10) {
+ digits[1]++;
+ digits[2] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 3; i++) {
+ if ((i == 2) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+
+ if ((Inventory_GetSkullTokenCount(play->sceneId) == 1) ||
+ (Inventory_GetSkullTokenCount(play->sceneId) == 21)) {
+ Message_LoadCharNES(play, 's', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 't', &charTexIdx, &spA4, decodedBufPos);
+ } else if ((Inventory_GetSkullTokenCount(play->sceneId) == 2) ||
+ (Inventory_GetSkullTokenCount(play->sceneId) == 22)) {
+ Message_LoadCharNES(play, 'n', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'd', &charTexIdx, &spA4, decodedBufPos);
+ } else if ((Inventory_GetSkullTokenCount(play->sceneId) == 3) ||
+ (Inventory_GetSkullTokenCount(play->sceneId) == 23)) {
+ Message_LoadCharNES(play, 'r', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'd', &charTexIdx, &spA4, decodedBufPos);
+ } else {
+ Message_LoadCharNES(play, 't', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'h', &charTexIdx, &spA4, decodedBufPos);
+ }
+ } else if (curChar == 0xE) {
+ digits[0] = 0;
+ digits[1] = gSaveContext.minigameScore;
+
+ while (digits[1] >= 10) {
+ digits[0]++;
+ digits[1] -= 10;
+ }
+
+ for (i = 0; i < 2; i++) {
+ if ((i == 1) || (digits[i] != 0)) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+
+ decodedBufPos--;
+ } else if (curChar == 0xF) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = gSaveContext.minigameScore;
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xD0) {
+ decodedBufPos++;
+ msgCtx->unk120BE = spC6;
+ msgCtx->unk120C0 = decodedBufPos;
+ msgCtx->unk120C2 = 0;
+ msgCtx->bankRupeesSelected = 0;
+ msgCtx->unk120C4 = charTexIdx;
+ digits[0] = digits[1] = digits[2] = 0;
+ for (i = 0; i < 2; i++) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIdx, &spA4);
+ } else if (curChar == 0xD1) {
+ decodedBufPos++;
+ msgCtx->unk120BE = spC6;
+ msgCtx->unk120C0 = decodedBufPos;
+ msgCtx->unk120C2 = 0;
+ msgCtx->bankRupeesSelected = 0;
+ msgCtx->unk120C4 = charTexIdx;
+
+ for (i = 0; i < 5; i++) {
+ msgCtx->unk12054[i] = 1;
+ Message_LoadCharNES(play, '1', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xD3) {
+ if (gSaveContext.save.timeSpeedOffset == 18) {
+ var_s2_9 = 0;
+ } else if (gSaveContext.save.timeSpeedOffset == 0) {
+ var_s2_9 = 1;
+ } else {
+ var_s2_9 = 2;
+ }
+
+ for (i = 0; i < 4; i++) {
+ msgCtx->decodedBuffer.schar[decodedBufPos] = D_801D08D8[var_s2_9][i];
+ Font_LoadCharNES(play, D_801D08D8[var_s2_9][i], charTexIdx);
+ decodedBufPos++;
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ }
+ decodedBufPos--;
+ spA4 += 3.0f * (16.0f * msgCtx->textCharScale);
+ msgCtx->choiceIndex = var_s2_9;
+ } else if (curChar == 0xD4) {
+ Message_LoadOwlWarpTextNES(play, &charTexIdx, &spA4, &decodedBufPos);
+ } else if (curChar == 0xD5) {
+ decodedBufPos++;
+ msgCtx->unk120BE = spC6;
+ msgCtx->unk120C0 = decodedBufPos;
+ msgCtx->unk120C2 = 0;
+ msgCtx->bankRupeesSelected = 0;
+ msgCtx->unk120C4 = charTexIdx;
+
+ for (i = 0; i < 3; i++) {
+ msgCtx->unk12054[i] = 1;
+ Font_LoadCharNES(play, '1', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = '1';
+ spA4 += 16.0f * msgCtx->textCharScale;
+ decodedBufPos++;
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xD6) {
+ for (i = 0; i < 6; i++) {
+ msgCtx->decodedBuffer.schar[decodedBufPos] =
+ (s8)D_801D08E4[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])];
+ decodedBufPos++;
+ Message_LoadCharNES(play, i + '1', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ msgCtx->decodedBuffer.schar[decodedBufPos] = 0;
+ } else if ((curChar >= 0xD7) && (curChar < 0xDB)) {
+ digits[0] = digits[1] = 0;
+ digits[2] = 15 - gSaveContext.save.saveInfo.inventory.strayFairies[curChar - 0xD7];
+
+ while (digits[2] >= 100) {
+ digits[0]++;
+ digits[2] -= 100;
+ }
+ while (digits[2] >= 10) {
+ digits[1]++;
+ digits[2] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 3; i++) {
+ if ((i == 2) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ } else if (curChar == 0xDB) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = gSaveContext.minigameScore;
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ decodedBufPos--;
+ } else if ((curChar == 0xDC) || (curChar == 0xDD)) {
+ if (curChar == 0xDC) {
+ digits[0] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0];
+ digits[1] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][1];
+ digits[2] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][2];
+ } else {
+ digits[0] = (HS_GET_LOTTERY_CODE_GUESS() & 0xF00) >> 8;
+ digits[1] = (HS_GET_LOTTERY_CODE_GUESS() & 0xF0) >> 4;
+ digits[2] = HS_GET_LOTTERY_CODE_GUESS() & 0xF;
+ }
+
+ for (i = 0; i < 3; i++) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ decodedBufPos--;
+ } else if (curChar == 0xDE) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = gItemPrices[GET_CUR_FORM_BTN_ITEM(player->heldItemButton)];
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ Message_LoadPluralRupeesNES(play, &decodedBufPos, &charTexIdx, &spA4);
+ } else if (curChar == 0xDF) {
+ for (i = 0; i < 5; i++) {
+ digits[i] = gSaveContext.save.saveInfo.bomberCode[i];
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ decodedBufPos--;
+ } else if ((curChar >= 0xE1) && (curChar < 0xE7)) {
+ msgCtx->decodedBuffer.schar[decodedBufPos] =
+ D_801D08E4[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])];
+ temp_s2_2 = sMaskCodeTextLengthENG[(
+ (void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])];
+ decodedBufPos++;
+
+ for (i = 0; i < temp_s2_2; i++) {
+ Message_LoadCharNES(
+ play,
+ sMaskCodeTextENG[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0xE1)])]
+ [i],
+ &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+
+ msgCtx->decodedBuffer.schar[decodedBufPos] = 0;
+ } else if (curChar == 0xE7) {
+ timeToMoonCrash = TIME_UNTIL_MOON_CRASH;
+ digits[0] = 0;
+ digits[1] = TIME_TO_HOURS_F_ALT(timeToMoonCrash);
+
+ while (digits[1] >= 10) {
+ digits[0]++;
+ digits[1] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 2; i++) {
+ if ((i == 1) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Message_LoadCharNES(play, digits[i] + '0', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ }
+ }
+ msgCtx->decodedBuffer.schar[decodedBufPos] = ' ';
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'h', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'o', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'u', &charTexIdx, &spA4, decodedBufPos);
+ decodedBufPos++;
+ Message_LoadCharNES(play, 'r', &charTexIdx, &spA4, decodedBufPos);
+ if ((digits[0] != 0) || (digits[1] != 1)) {
+ decodedBufPos++;
+ Message_LoadCharNES(play, 's', &charTexIdx, &spA4, decodedBufPos);
+ }
+ } else if (curChar == 0xE8) {
+ Message_LoadTimeNES(play, curChar, &charTexIdx, &spA4, &decodedBufPos);
+
+ } else if ((curChar == 0xF0) || (curChar == 0xF1) || (curChar == 0xF2) || (curChar == 0xF8)) {
+ if (curChar == 0xF8) {
+ value = (s32)HS_GET_HIGH_SCORE_3_LOWER();
+ } else {
+ value = HIGH_SCORE(curChar - 0xF0);
+ }
+ if (curChar == 0xF2) {
+ if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
+ value &= 0x7F;
+ } else {
+ value = (s16)((HIGH_SCORE((u8)font->msgBuf.schar[msgCtx->msgBufPos]) & 0xFF000000) >> 0x18) & 0x7F;
+ }
+ }
+ digits[3] = value;
+ digits[0] = digits[1] = digits[2] = 0;
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ decodedBufPos--;
+ } else if ((curChar == 0xF7) || (curChar == 0xF9) || (curChar == 0xFA) || (curChar == 0xFB) ||
+ (curChar == 0xFC)) {
+ var_fs0 = 8.0f;
+ if (curChar == 0xF7) {
+ Message_GetTimerDigitsNES(GET_HIGH_SCORE(HS_UNK_1), spA8);
+ } else if (curChar == 0xF9) {
+ Message_GetTimerDigitsNES(GET_HIGH_SCORE(HS_HORSE_BACK_BALLOON), spA8);
+ } else {
+ Message_GetTimerDigitsNES(
+ ((void)0, gSaveContext.save.saveInfo.dekuPlaygroundHighScores[curChar - 0xFA]), spA8);
+ }
+
+ loadChar = false;
+ for (i = 0; i < 8; i++) {
+ if ((i == 4) || ((i != 2) && (i != 5) && (spA8[i] != '\0'))) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, spA8[i], charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = spA8[i];
+ decodedBufPos++;
+ } else {
+ var_fs0 -= 1.0f;
+ }
+ }
+ spA4 += var_fs0 * (16.0f * msgCtx->textCharScale);
+ decodedBufPos--;
+ } else if ((curChar == 0xF3) || (curChar == 0xF4) || (curChar == 0xF5)) {
+ value = HIGH_SCORE(curChar - 0xF3 + HS_BOAT_ARCHERY);
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = value;
+
+ while (digits[3] >= 60) {
+ digits[1]++;
+ if (digits[1] >= 10) {
+ digits[0]++;
+ digits[1] -= 10;
+ }
+ digits[3] -= 60;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ for (i = 0; i < 4; i++) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ if (i == 1) {
+ Font_LoadCharNES(play, '"', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = '"';
+ decodedBufPos++;
+ } else if (i == 3) {
+ Font_LoadCharNES(play, 0x27, charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = 0x27;
+ }
+ }
+ spA4 += 4.0f * (16.0f * msgCtx->textCharScale);
+ } else if (curChar == 0xF6) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = HS_GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE();
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ decodedBufPos--;
+ } else if ((curChar == 0xFD) || (curChar == 0xFE) || (curChar == 0xFF)) {
+ for (playerNameLen = 8; playerNameLen > 0; playerNameLen--) {
+ if (gSaveContext.save.saveInfo.inventory
+ .dekuPlaygroundPlayerName[(s16)(curChar - 0xFD)][playerNameLen - 1] != 0x3E) {
+ break;
+ }
+ }
+
+ for (i = 0; i < playerNameLen; i++) {
+ ptr = &font->fontBuf[((void)0, gSaveContext.save.saveInfo.inventory
+ .dekuPlaygroundPlayerName[(s16)(curChar - 0xFD)][i]) *
+ FONT_CHAR_TEX_SIZE];
+ msgCtx->decodedBuffer.schar[decodedBufPos + i] = 0xFD;
+
+ for (var_v1_3 = 0; var_v1_3 < FONT_CHAR_TEX_SIZE; var_v1_3 += 4) {
+ font->charBuf[font->unk_11D88][charTexIdx + var_v1_3 + 0] = ptr[var_v1_3 + 0];
+ font->charBuf[font->unk_11D88][charTexIdx + var_v1_3 + 1] = ptr[var_v1_3 + 1];
+ font->charBuf[font->unk_11D88][charTexIdx + var_v1_3 + 2] = ptr[var_v1_3 + 2];
+ font->charBuf[font->unk_11D88][charTexIdx + var_v1_3 + 3] = ptr[var_v1_3 + 3];
+ }
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ }
+ decodedBufPos += playerNameLen - 1;
+ spA4 += playerNameLen * (16.0f * msgCtx->textCharScale);
+ } else if (curChar == 0xB) {
+ digits[0] = digits[1] = digits[2] = 0;
+ digits[3] = HS_GET_BOAT_ARCHERY_HIGH_SCORE();
+
+ while (digits[3] >= 1000) {
+ digits[0]++;
+ digits[3] -= 1000;
+ }
+ while (digits[3] >= 100) {
+ digits[1]++;
+ digits[3] -= 100;
+ }
+ while (digits[3] >= 10) {
+ digits[2]++;
+ digits[3] -= 10;
+ }
+
+ loadChar = false;
+ for (i = 0; i < 4; i++) {
+ if ((i == 3) || (digits[i] != 0)) {
+ loadChar = true;
+ }
+ if (loadChar) {
+ Font_LoadCharNES(play, digits[i] + '0', charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ msgCtx->decodedBuffer.schar[decodedBufPos] = digits[i] + '0';
+ decodedBufPos++;
+ spA4 += 16.0f * msgCtx->textCharScale;
+ }
+ }
+ decodedBufPos--;
+ } else if (curChar == 0x14) {
+ decodedBufPos--;
+ for (i = 0; i < font->msgBuf.schar[msgCtx->msgBufPos + 1]; i++) {
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = ' ';
+ spA4 += 6.0f;
+ }
+ msgCtx->msgBufPos++;
+ } else if ((curChar == 0x13) || (curChar == 0x11)) {
+ msgCtx->unk11F1A[spC6] = 0;
+ if (msgCtx->unk11F18 != 0) {
+ msgCtx->unk11F1A[spC6] = ((msgCtx->textCharScale * 16.0f * 16.0f) - spA4) * 0.5f;
+ }
+ spC6++;
+ spA4 = 0.0f;
+ if (curChar == 0x11) {
+ spD0++;
+ }
+ } else if ((curChar == 0x17) || (curChar == 0x18) || (curChar == 0x1A)) {
+ // pass
+ } else if (curChar == 0xA) {
+ decodedBufPos++;
+ } else if (curChar == 0x1C) {
+ msgCtx->textFade = true;
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ } else if (curChar == 0x1E) {
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ if (msgCtx->textboxSkipped || (msgCtx->textBoxType == TEXTBOX_TYPE_1) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_3) || (msgCtx->textBoxType == TEXTBOX_TYPE_6) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_8) || (msgCtx->textBoxType == TEXTBOX_TYPE_9) ||
+ (msgCtx->textBoxType == TEXTBOX_TYPE_B) || (msgCtx->unk11F0C == 3)) {
+ Audio_PlaySfx((msgCtx->decodedBuffer.schar[decodedBufPos - 1] << 8) |
+ msgCtx->decodedBuffer.schar[decodedBufPos]);
+ }
+ } else if (curChar == 0x1F) {
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ msgCtx->decodedBuffer.schar[++decodedBufPos] = font->msgBuf.schar[++msgCtx->msgBufPos];
+ } else if ((curChar != 0x20) && (curChar >= 9)) {
+ Font_LoadCharNES(play, curChar, charTexIdx);
+ charTexIdx += FONT_CHAR_TEX_SIZE;
+ spA4 += sNESFontWidths[curChar - ' '] * msgCtx->textCharScale;
+ } else if (curChar == 0x20) {
+ spA4 += 6.0f;
+ }
+ decodedBufPos++;
+ msgCtx->msgBufPos++;
+ }
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_nes/Message_DecodeNES.s")
+#endif
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index db9a8c974..24b55cfea 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -570,12 +570,12 @@ s32 func_801235DC(PlayState* play, f32 arg1, s16 arg2) {
return false;
}
-ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
- if (arg2 >= 4) {
+ItemId Player_GetItemOnButton(PlayState* play, Player* player, EquipSlot slot) {
+ if (slot >= EQUIP_SLOT_A) {
return ITEM_NONE;
}
- if (arg2 == 0) {
+ if (slot == EQUIP_SLOT_B) {
ItemId item = Inventory_GetBtnBItem(play);
if (item >= ITEM_FD) {
@@ -597,18 +597,24 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
return item;
}
- if (arg2 == 1) {
+ if (slot == EQUIP_SLOT_C_LEFT) {
return C_BTN_ITEM(EQUIP_SLOT_C_LEFT);
}
- if (arg2 == 2) {
+ if (slot == EQUIP_SLOT_C_DOWN) {
return C_BTN_ITEM(EQUIP_SLOT_C_DOWN);
}
+ // EQUIP_SLOT_C_RIGHT
+
return C_BTN_ITEM(EQUIP_SLOT_C_RIGHT);
}
-u16 sCItemButtons[] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT };
+u16 sCItemButtons[] = {
+ BTN_CLEFT,
+ BTN_CDOWN,
+ BTN_CRIGHT,
+};
PlayerItemAction func_80123810(PlayState* play) {
Player* player = GET_PLAYER(play);
@@ -630,7 +636,7 @@ PlayerItemAction func_80123810(PlayState* play) {
for (i = 0; i < ARRAY_COUNT(sCItemButtons); i++) {
if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, sCItemButtons[i])) {
i++;
- itemId = func_8012364C(play, player, i);
+ itemId = Player_GetItemOnButton(play, player, i);
play->interfaceCtx.unk_222 = 0;
play->interfaceCtx.unk_224 = 0;
@@ -2092,7 +2098,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
EnArrow* bubble = NULL;
if (((player->skelAnime.animation == &gPlayerAnim_pn_drinkend)) ||
- (player->unk_284.animation == &gPlayerAnim_pn_tamahaki) ||
+ (player->skelAnimeUpper.animation == &gPlayerAnim_pn_tamahaki) ||
((player->stateFlags3 & PLAYER_STATE3_40) && ((bubble = (EnArrow*)player->heldActor) != NULL))) {
Matrix_TranslateRotateZYX(pos, rot);
func_80125340();
@@ -2108,7 +2114,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
} else if (player->skelAnime.animation == &gPlayerAnim_pn_drinkend) {
func_80124618(D_801C03E0, player->skelAnime.curFrame, player->unk_AF0);
} else {
- func_80124618(D_801C03C0, player->unk_284.curFrame, player->unk_AF0);
+ func_80124618(D_801C03C0, player->skelAnimeUpper.curFrame, player->unk_AF0);
}
Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY);
@@ -3784,7 +3790,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G
Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &player->actor.focus.pos);
Matrix_MultVec3f(&D_801C0E94, sPlayerCurBodyPartPos);
if ((player->skelAnime.animation == &gPlayerAnim_pn_drinkend) ||
- (player->unk_284.animation == &gPlayerAnim_pn_tamahaki) ||
+ (player->skelAnimeUpper.animation == &gPlayerAnim_pn_tamahaki) ||
((player->stateFlags3 & PLAYER_STATE3_40) && ((spA8 = player->heldActor) != NULL))) {
if (spA8 != NULL) {
static Vec3f D_801C0EA0 = { 1300.0f, -400.0f, 0.0f };
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 79af1b73f..675487072 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -1680,7 +1680,8 @@ void SkelAnime_AnimateFrame(SkelAnime* skelAnime) {
s32 frame = skelAnime->curFrame;
f32 partialFrame = skelAnime->curFrame - frame;
- if (++frame >= (s32)skelAnime->animLength) {
+ frame++;
+ if (frame >= (s32)skelAnime->animLength) {
frame = 0;
}
SkelAnime_GetFrameData(skelAnime->animation, frame, skelAnime->limbCount, nextjointTable);
diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
index 82495ea1e..c35e6e9b1 100644
--- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c
+++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
@@ -173,7 +173,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) {
this->unk_6F8 = 1.0f;
Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements);
Collider_InitAndSetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements);
- SkelAnime_InitFlex(play, &this->skelAnime, &gWartSkel, &gWartIdleAnim, this->jointTable, this->morphtable,
+ SkelAnime_InitFlex(play, &this->skelAnime, &gWartSkel, &gWartIdleAnim, this->jointTable, this->morphTable,
WART_LIMB_MAX);
spA8.y = this->actor.world.pos.y + 200.0f;
diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.h b/src/overlays/actors/ovl_Boss_04/z_boss_04.h
index 6aa153597..97c296b84 100644
--- a/src/overlays/actors/ovl_Boss_04/z_boss_04.h
+++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.h
@@ -12,7 +12,7 @@ typedef struct Boss04 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[WART_LIMB_MAX];
- /* 0x1BE */ Vec3s morphtable[WART_LIMB_MAX];
+ /* 0x1BE */ Vec3s morphTable[WART_LIMB_MAX];
/* 0x1F4 */ s16 unk_1F4;
/* 0x1F6 */ u8 unk_1F6;
/* 0x1F7 */ u8 unk_1F7;
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index c7abf8548..9957b2bba 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -238,6 +238,7 @@ static InitChainEntry D_80B0EAD8[] = {
extern ColliderJntSphElementInit D_80B0E700[19];
extern ColliderJntSphInit D_80B0E9AC;
extern ColliderTrisElementInit D_80B0E9BC[1];
+extern Vec3f D_80B0E9D4[3];
extern ColliderTrisInit D_80B0E9F8;
extern ColliderSphereInit D_80B0EA08;
extern ColliderCylinderInit D_80B0EA34;
@@ -247,6 +248,8 @@ extern TexturePtr D_80B0EA88;
extern s8 D_80B0EA8C[]; // sLimbToBodyParts
extern s8 D_80B0EAAC;
extern s32 D_80B0EAB0[5];
+extern Color_RGBA8 D_80B0EAC4;
+extern Color_RGBA8 D_80B0EAC8;
extern Color_RGB8 D_80B0EACC;
extern Color_RGB8 D_80B0EAD0;
extern s32 D_80B0EAD4;
@@ -398,7 +401,39 @@ void func_80B057A4(Vec3f* arg0, Vec3f* arg1, f32 arg2) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B058C0.s")
+void func_80B058C0(BossHakugin* this) {
+ s32 i = 0;
+ Actor* last;
+ Actor* now = this->unk_09D0[i++];
+
+ now->params = 4;
+ now->world.pos.x = -500.0f;
+ now->world.pos.y = this->actor.world.pos.y;
+ now->world.pos.z = -1266.6666667f;
+ now->shape.rot.y = this->actor.shape.rot.y + 0x4000;
+
+ while (i < 6) {
+ last = now;
+ now = this->unk_09D0[i++];
+
+ now->params = 4;
+ now->world.pos.x = last->world.pos.x;
+ now->world.pos.y = this->actor.world.pos.y;
+ now->world.pos.z = last->world.pos.z - 133.333333f;
+ now->shape.rot.y = last->shape.rot.y;
+ }
+
+ while (i < 10) {
+ last = (i < 8) ? this->unk_09D0[i - 6] : this->unk_09D0[i - 4];
+ now = this->unk_09D0[i++];
+
+ now->params = 4;
+ now->world.pos.x = this->actor.world.pos.x;
+ now->world.pos.y = this->actor.world.pos.y;
+ now->world.pos.z = last->world.pos.z;
+ now->shape.rot.y = this->actor.shape.rot.y - 0x4000;
+ }
+}
void func_80B05A64(BossHakugin* this, PlayState* play, s16 speed, s32 y, s16 duration) {
s16 quakeIndex;
@@ -412,11 +447,64 @@ void func_80B05A64(BossHakugin* this, PlayState* play, s16 speed, s32 y, s16 dur
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05B04.s")
+void func_80B05B04(BossHakugin* this, PlayState* play) {
+ Vec3f sp34;
+ s32 var_v0;
+ f32 sp2C;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05CBC.s")
+ if (((this->actionFunc == func_80B0813C) || (this->actionFunc == func_80B08018)) && (Rand_ZeroOne() < 0.1f)) {
+ sp2C = Rand_ZeroOne();
+ var_v0 = (Rand_ZeroOne() < 0.5f) ? -1 : 1;
+ sp34.x = (var_v0 * (15.0f + (sp2C * 15.0f)) * 4.0f) + this->actor.world.pos.x;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B05D4C.s")
+ sp34.y = (((Rand_ZeroOne() * 90.0f) + 10.0f) * 2.7f) + this->actor.world.pos.y;
+
+ sp2C = Rand_ZeroOne();
+ var_v0 = (Rand_ZeroOne() < 0.5f) ? -1 : 1;
+ sp34.z = (var_v0 * (15.0f + (sp2C * 15.0f)) * 4.0f) + this->actor.world.pos.z;
+
+ EffectSsKirakira_SpawnDispersed(play, &sp34, &gZeroVec3f, &gZeroVec3f, &D_80B0EAC4, &D_80B0EAC8, (s16)0x7D0, 5);
+ }
+}
+
+void func_80B05CBC(BossHakugin* this, Player* player) {
+ if (!this->unk_0194 && (player->stateFlags3 & 0x80000) && !(player->actor.bgCheckFlags & 1) &&
+ (player->actor.velocity.y > 5.0f)) {
+ player->actor.velocity.y *= 1.3f;
+ player->linearVelocity *= 1.3f;
+ this->unk_0194 = true;
+ } else if (player->actor.bgCheckFlags & 1) {
+ this->unk_0194 = false;
+ }
+}
+
+void func_80B05D4C(BossHakugin* this) {
+ Vec3f* var_t0 = &this->actor.world.pos;
+ s32 i;
+ s16 var_t1 = 0;
+
+ for (i = 0; i < 20; i++) {
+ if (this->unk_2618[i].unk_0C == 0xFF) {
+ var_t0 = &this->unk_2618[i].unk_00;
+ var_t1 = 0x1388;
+ break;
+ }
+ }
+ if (i == 20) {
+ if (this->unk_01C8 > 0.0f) {
+ var_t0 = &this->unk_0380;
+ var_t1 = (this->unk_01C8 / 30.0f) * 5000.0f;
+ } else if ((this->unk_0192 == 3) || (this->unk_0192 == 2)) {
+ var_t0 = &this->unk_3734[0];
+ var_t1 = 0x1388;
+ } else if (this->unk_0192 == 4) {
+ var_t0 = &this->unk_3734[this->unk_01AA];
+ var_t1 = (10 - this->unk_01AA) * 500.0f;
+ }
+ }
+ Lights_PointNoGlowSetInfo(&this->lightInfo, var_t0->x, var_t0->y, var_t0->z, D_80B0EACC.r, D_80B0EACC.g,
+ D_80B0EACC.b, var_t1);
+}
void func_80B05EE0(BossHakugin* this, PlayState* play) {
s16 atan;
@@ -456,24 +544,247 @@ void func_80B05EE0(BossHakugin* this, PlayState* play) {
BHEART_PARAM_NORMAL);
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0607C.s")
+void func_80B0607C(BossHakugin* this, PlayState* play) {
+ CollisionPoly* sp8C = NULL;
+ CollisionPoly* sp88 = NULL;
+ s32 sp84;
+ s16 sp82;
+ s16 sp80;
+ s16 var_v0;
+ Vec3f sp70;
+ Vec3f sp64;
+ Vec3f sp58;
+ Vec3f sp4C;
+ f32 sp48;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06558.s")
+ sp58.x = this->actor.world.pos.x + (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ sp58.y = this->actor.world.pos.y + 450.0f;
+ sp58.z = this->actor.world.pos.z + (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
-void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06600.s")
+ sp4C.x = sp58.x - Math_CosS(this->unk_01A0) * 1000.0f;
+ sp4C.y = sp58.y;
+ sp4C.z = sp58.z + (Math_SinS(this->unk_01A0) * 1000.0f);
-void func_80B0696C(BossHakugin* this, Vec3f* arg1);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0696C.s")
+ if (BgCheck_EntityLineTest1(&play->colCtx, &sp58, &sp4C, &sp70, &sp8C, 1, 1, 0, 1, &sp84)) {
+ sp82 =
+ Math_Atan2S_XY(sp8C->normal.z * COLPOLY_NORMAL_FRAC, sp8C->normal.x * COLPOLY_NORMAL_FRAC) - this->unk_01A0;
+ this->unk_01BC = Math_Vec3f_DistXZ(&sp58, &sp70);
+ } else {
+ sp82 = 0;
+ this->unk_01BC = 30000.0f;
+ }
+ sp4C.x = (2.0f * sp58.x) - sp4C.x;
+ sp4C.z = (2.0f * sp58.z) - sp4C.z;
+ if (BgCheck_EntityLineTest1(&play->colCtx, &sp58, &sp4C, &sp64, &sp88, 1, 1, 0, 1, &sp84)) {
+ sp80 =
+ Math_Atan2S_XY(sp88->normal.z * COLPOLY_NORMAL_FRAC, sp88->normal.x * COLPOLY_NORMAL_FRAC) - this->unk_01A0;
+ this->unk_01C0 = Math_Vec3f_DistXZ(&sp58, &sp64);
+ } else {
+ sp80 = 0;
+ this->unk_01C0 = 30000.0f;
+ }
+ if (this->unk_01B4 == 1) {
+ this->unk_01C0 -= 50.0f;
+ } else {
+ this->unk_01BC -= 50.0f;
+ }
+ if (this->unk_01BC <= 89.100006f) {
+ sp48 = (this->unk_01B4 == 1) ? 89.100006f : 139.1f;
+ this->actor.world.pos.x =
+ (sp70.x + (sp48 * Math_CosS(this->unk_01A0))) - (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ this->actor.world.pos.z =
+ (sp70.z - (sp48 * Math_SinS(this->unk_01A0))) - (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
+ } else if (this->unk_01C0 <= 89.100006f) {
+ sp48 = (this->unk_01B4 == 1) ? 139.1f : 89.100006f;
+ this->actor.world.pos.x =
+ (sp64.x - (sp48 * Math_CosS(this->unk_01A0))) - (Math_SinS(this->unk_01A0) * (5.0f * this->actor.speed));
+ this->actor.world.pos.z =
+ (sp64.z + (sp48 * Math_SinS(this->unk_01A0))) - (Math_CosS(this->unk_01A0) * (5.0f * this->actor.speed));
+ }
+ if ((this->unk_01C0 < 30000.0f) && (this->unk_01BC < 30000.0f)) {
+ var_v0 = (s16)(sp82 + sp80) >> 1;
+ if (((this->unk_01B4 == 1) && (var_v0 < 0)) || ((this->unk_01B4 == -1) && (var_v0 > 0))) {
+ this->unk_01A0 += var_v0;
+ }
+ }
+}
-void func_80B06B20(BossHakugin* this, Vec3f* arg1);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06B20.s")
+void func_80B06558(BossHakuginUnkStruct_2618* arg0) {
+ s32 i;
+ Vec3f sp38[3];
-void func_80B06C08(BossHakugin* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06C08.s")
+ Matrix_SetTranslateRotateYXZ(arg0->unk_00.x, arg0->unk_00.y, arg0->unk_00.z, &arg0->unk_0E);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ for (i = 0; i < 3; i++) {
+ Matrix_MultVec3f(&D_80B0E9D4[i], &sp38[i]);
+ }
+ Collider_SetTrisVertices(&arg0->unk_14, 0, &sp38[0], &sp38[1], &sp38[2]);
+}
-void func_80B06D38(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B06D38.s")
+void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play) {
+ s32 i;
+ Player* player = GET_PLAYER(play);
+ CollisionPoly* spD4;
+ Vec3f spC8;
+ Vec3f spBC;
+ Vec3f spB0;
+ Vec3f spA4;
+ Vec3f sp98;
+ Vec3f sp8C;
+ BossHakuginUnkStruct_2618* effect;
+ s32 sp84;
+
+ Math_Vec3f_Copy(&spC8, arg1);
+ spBC.x = player->actor.world.pos.x - (Math_SinS(this->actor.shape.rot.y) * 50.0f);
+ spBC.y = player->actor.world.pos.y + 40.0f;
+ spBC.z = player->actor.world.pos.z - (Math_CosS(this->actor.shape.rot.y) * 50.0f);
+ Actor_OffsetOfPointInActorCoords(&this->actor, &sp98, &spBC);
+ Audio_PlaySfx_AtPos(&this->unk_0458, 0x384DU);
+ for (i = 0; i < 20; i++) {
+ effect = &this->unk_2618[i];
+ Actor_OffsetOfPointInActorCoords(&this->actor, &sp8C, &spC8);
+ if (sp98.z < sp8C.z) {
+ effect->unk_0E.y = this->actor.shape.rot.y + ((s32)Rand_Next() >> 0x13);
+ } else {
+ effect->unk_0E.y = Math_Vec3f_Yaw(&spC8, &spBC) + ((s32)Rand_Next() >> 0x13);
+ }
+ effect->unk_0E.x = Math_Vec3f_Pitch(&spC8, &spBC) + ((s32)Rand_Next() >> 0x13);
+ effect->unk_0E.z = 0;
+ effect->unk_00.x = spC8.x + (80.0f * Math_CosS(effect->unk_0E.x) * Math_SinS(effect->unk_0E.y));
+ effect->unk_00.y = spC8.y - (80.0f * Math_SinS(effect->unk_0E.x));
+ effect->unk_00.z = spC8.z + (80.0f * Math_CosS(effect->unk_0E.x) * Math_CosS(effect->unk_0E.y));
+ spB0.x = (2.0f * effect->unk_00.x) - spC8.x;
+ spB0.y = (2.0f * effect->unk_00.y) - spC8.y;
+ spB0.z = (2.0f * effect->unk_00.z) - spC8.z;
+ if (BgCheck_EntityLineTest1(&play->colCtx, &spC8, &spB0, &spA4, &spD4, 0, 1, 0, 1, &sp84)) {
+ effect->unk_0E.x -= 0x2000;
+ effect->unk_00.x = spC8.x + (80.0f * Math_CosS(effect->unk_0E.x) * Math_SinS(effect->unk_0E.y));
+ effect->unk_00.y = spC8.y - (80.0f * Math_SinS(effect->unk_0E.x));
+ effect->unk_00.z = spC8.z + (80.0f * Math_CosS(effect->unk_0E.x) * Math_CosS(effect->unk_0E.y));
+ spC8.x = (2.0f * effect->unk_00.x) - spC8.x;
+ spC8.y = (2.0f * effect->unk_00.y) - spC8.y;
+ spC8.z = (2.0f * effect->unk_00.z) - spC8.z;
+ } else {
+ Math_Vec3f_Copy(&spC8, &spB0);
+ }
+ effect->unk_0C = 0x113 + 0x14 * i;
+ func_80B06558(effect);
+ effect->unk_0E.z = (s32)Rand_Next() >> 0x10;
+ }
+}
+
+void func_80B0696C(BossHakugin* this, Vec3f* arg1) {
+ s32 i;
+ BossHakuginEffect* temp_s0;
+
+ for (i = 0; i < 180; i++) {
+ temp_s0 = &this->unk_09F8[i];
+ if (temp_s0->unk_18 < 0) {
+ s16 sp2E;
+ s16 sp2C;
+ f32 sp28;
+
+ Math_Vec3f_Copy(&temp_s0->unk_0, arg1);
+ sp2C = Rand_S16Offset(0x1000, 0x3000);
+ sp2E = this->actor.shape.rot.y + ((s32)Rand_Next() >> 0x12) + 0x8000;
+ sp28 = Rand_ZeroFloat(5.0f) + 7.0f;
+ temp_s0->unk_C.x = sp28 * Math_CosS(sp2C) * Math_SinS(sp2E);
+ temp_s0->unk_C.y = sp28 * Math_SinS(sp2C);
+ temp_s0->unk_C.z = sp28 * Math_CosS(sp2C) * Math_CosS(sp2E);
+ temp_s0->unk_0.x = arg1->x + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.x);
+ temp_s0->unk_0.y = arg1->y + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.y);
+ temp_s0->unk_0.z = arg1->z + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.z);
+ temp_s0->unk_24 = (Rand_ZeroFloat(6.0f) + 15.0f) * 0.0001f;
+ temp_s0->unk_18 = 0x28;
+ temp_s0->unk_1A = 0;
+ break;
+ }
+ }
+}
+
+void func_80B06B20(BossHakugin* this, Vec3f* arg1) {
+ Actor* sp1C;
+ s32 i;
+
+ if (((this->unk_044C.z < -200.0f) && (this->actor.speed > 10.0f) && (this->unk_018D == 0) &&
+ (Rand_ZeroOne() < 0.4f))) {
+ this->unk_018D = 4;
+ } else {
+ if (this->unk_018D > 0) {
+ this->unk_018D--;
+ }
+ return;
+ }
+
+ for (i = 0; i < 8; i++) {
+ sp1C = this->unk_09B0[i];
+
+ if (sp1C->params == 0) {
+ Math_Vec3f_Copy(&sp1C->world.pos, arg1);
+ sp1C->params = 1;
+ break;
+ }
+ }
+}
+
+void func_80B06C08(BossHakugin* this) {
+ s32 i;
+
+ if ((this->unk_018E == 0) && (this->actor.colChkInfo.health < 0x14) && (Rand_ZeroOne() < 0.35f)) {
+ this->unk_018E = 4;
+ } else {
+ if (this->unk_018E > 0) {
+ this->unk_018E--;
+ }
+ return;
+ }
+ for (i = 0; i < 10; i++) {
+ Actor* tmp = this->unk_09D0[i];
+
+ if (tmp->params == 0) {
+ tmp->params = 2;
+ return;
+ }
+ }
+}
+
+void func_80B06D38(BossHakugin* this, PlayState* play) {
+ EnBom* sp44;
+ s16 temp_a1;
+
+ if ((this->actor.speed > 10.0f) && ((s32)this->actor.colChkInfo.health < 0xA) && (this->unk_018F == 0) &&
+ (Rand_ZeroOne() < 0.35f)) {
+ this->unk_018F = 4;
+ } else {
+ if (this->unk_018F > 0) {
+ this->unk_018F--;
+ }
+ return;
+ }
+ sp44 =
+ (EnBom*) Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM,
+ this->unk_0484.elements[1].dim.worldSphere.center.x - (100.0f * Math_SinS(this->actor.shape.rot.y)),
+ this->unk_0484.elements[1].dim.worldSphere.center.y + 100.0f,
+ this->unk_0484.elements[1].dim.worldSphere.center.z - (Math_CosS(this->actor.shape.rot.y) * 100.0f),
+ 0, 0, 0, 0);
+ if (sp44 != NULL) {
+ temp_a1 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - 0x8000;
+ if (temp_a1 > 0x2000) {
+ sp44->actor.world.rot.y = this->actor.shape.rot.y + 0xA000;
+ } else if (temp_a1 < -0x2000) {
+ sp44->actor.world.rot.y = this->actor.shape.rot.y + 0x6000;
+ } else {
+ sp44->actor.world.rot.y = this->actor.yawTowardsPlayer;
+ }
+
+ sp44->timer = (Rand_Next() >> 0x1C) + 0x11;
+ sp44->actor.velocity.y = 2.0f;
+ sp44->actor.speed = this->actor.xzDistToPlayer * 0.01f;
+ sp44->actor.speed = CLAMP(sp44->actor.speed, 6.0f, 12.0f);
+
+ Actor_SetScale(&sp44->actor, 0.02f);
+ }
+}
void func_80B06F48(BossHakugin* this, PlayState* play) {
BossHakuginFhgFlashUnkStruct* iter;
@@ -635,7 +946,42 @@ void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2) {
EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 0x258);
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0791C.s")
+s32 func_80B0791C(BossHakugin* this, PlayState* play) {
+ Player* sp34 = GET_PLAYER(play);
+ s16 var_v1;
+ s32 var_v0_2;
+ f32 sp28;
+ f32 sp24;
+
+ if (this->unk_044C.z > 0.0f) {
+ return 0;
+ }
+ var_v1 = this->unk_01A0 - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
+ var_v0_2 = ABS_ALT(var_v1);
+
+ if (var_v0_2 < 0x4000) {
+ if (var_v0_2 < 0x1800) {
+ this->unk_018C = 0;
+ }
+ return 0;
+ }
+ if (this->unk_018C == 1) {
+ return 0;
+ }
+ sp24 = this->actor.world.pos.x * this->unk_01B4;
+ sp28 = this->actor.world.pos.z * this->unk_01B4;
+ if (((sp34->actor.world.pos.x > 1200.0f) && (sp34->actor.world.pos.z < 1200.0f) &&
+ (sp34->actor.world.pos.z > -1200.0f) && (this->actor.world.pos.x < 0.0f) && (sp28 > 1200.0f)) ||
+ ((sp34->actor.world.pos.x < -1200.0f) && (sp34->actor.world.pos.z < 1200.0f) &&
+ (sp34->actor.world.pos.z > -1200.0f) && (this->actor.world.pos.x > 0.0f) && (sp28 < -1200.0f)) ||
+ ((sp34->actor.world.pos.z > 1200.0f) && (sp34->actor.world.pos.x < 1200.0f) &&
+ (sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z < 0.0f) && (sp24 < -1200.0f)) ||
+ ((sp34->actor.world.pos.z < -1200.0f) && (sp34->actor.world.pos.x < 1200.0f) &&
+ (sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z > 0.0f) && (sp24 > 1200.0f))) {
+ return 1;
+ }
+ return 0;
+}
void func_80B07B88(BossHakugin* this, PlayState* play) {
if (this->unk_0196 == 0xA) {
@@ -1009,14 +1355,14 @@ void func_80B091D8(BossHakugin* this, PlayState* play) {
Math_StepToF(&this->actor.speed, 25.0f, 2.0f);
SkelAnime_Update(&this->skelAnime);
func_80B07450(this, play);
- if ((this->unk_0454 < 0.0f) || (this->unk_0484.base.atFlags & 2)) {
+ if ((this->unk_044C.z < 0.0f) || (this->unk_0484.base.atFlags & 2)) {
func_80B08C1C(this);
} else {
if ((this->unk_01C0 < 89.100006f) || (this->unk_01BC < 89.100006f)) {
this->unk_019E = this->unk_01A0;
} else {
- if (((this->unk_044C > 0.0f) && (this->unk_044C < this->unk_01C0)) ||
- ((this->unk_044C <= 0.0f) && (-this->unk_044C < this->unk_01BC))) {
+ if (((this->unk_044C.x > 0.0f) && (this->unk_044C.x < this->unk_01C0)) ||
+ ((this->unk_044C.x <= 0.0f) && (-this->unk_044C.x < this->unk_01BC))) {
temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
var_v0 = CLAMP(temp_v0, -0x3000, 0x3000);
this->unk_019E = this->actor.shape.rot.y + var_v0;
@@ -1162,15 +1508,16 @@ void func_80B09C78(BossHakugin* this, PlayState* play) {
f32 sp1C;
SkelAnime_Update(&this->skelAnime);
- temp_fv1 = fabsf(this->unk_044C);
+ temp_fv1 = fabsf(this->unk_044C.x);
sp1C = temp_fv1;
Math_StepToF(&this->unk_01C8, 0.0f, 6.0f);
- if ((this->unk_0454 < 0.0f) || (this->actor.xzDistToPlayer < 750.0f) || (this->unk_018C == 1)) {
+ if ((this->unk_044C.z < 0.0f) || (this->actor.xzDistToPlayer < 750.0f) || (this->unk_018C == 1)) {
func_80B08C1C(this);
return;
}
- if ((this->unk_2618[0].unk_0C == 0) && (this->unk_01C8 < 0.1f) && (temp_fv1 < 400.0f) && (this->unk_0454 > 0.0f)) {
+ if ((this->unk_2618[0].unk_0C == 0) && (this->unk_01C8 < 0.1f) && (temp_fv1 < 400.0f) &&
+ (this->unk_044C.z > 0.0f)) {
func_80B09DFC(this);
return;
}
@@ -1403,11 +1750,33 @@ void func_80B0A87C(BossHakugin* this) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A8C4.s")
+void func_80B0AC30(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0AC30.s")
+s32 func_80B0ADFC(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0ADFC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B238.s")
+void func_80B0B238(BossHakugin* this) {
+ BossHakuginEffect* temp_s0;
+ s32 i;
+
+ for (i = 0; i < 180; i++) {
+ temp_s0 = &this->unk_09F8[i];
+
+ if (temp_s0->unk_18 >= 0) {
+ temp_s0->unk_18--;
+ temp_s0->unk_C.y += -1.0f;
+ Math_Vec3f_Sum(&temp_s0->unk_0, &temp_s0->unk_C, &temp_s0->unk_0);
+ if (temp_s0->unk_0.y < -500.0f) {
+ temp_s0->unk_18 = -1;
+ } else {
+ temp_s0->unk_1C.x += (s16)(0x700 + (Rand_Next() >> 0x17));
+ temp_s0->unk_1C.y += (s16)(0x900 + (Rand_Next() >> 0x17));
+ temp_s0->unk_1C.z += (s16)(0xB00 + (Rand_Next() >> 0x17));
+ }
+ }
+ }
+}
void func_80B0B34C(BossHakugin* this) {
BossHakuginEffect* effect;
@@ -1422,7 +1791,28 @@ void func_80B0B34C(BossHakugin* this) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B3F4.s")
+void func_80B0B3F4(BossHakugin* this) {
+ s32 i;
+ s32 j;
+
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 15; j++) {
+ BossHakuginFhgFlashUnkStruct* effect = &this->unk_3158[i][j];
+
+ if (effect->unk_10 > 0) {
+ effect->unk_12--;
+ effect->unk_00.y += 3.5f;
+ effect->unk_0C += 0.003f;
+ if (effect->unk_12 < 0) {
+ effect->unk_10 -= 0xF;
+ if (effect->unk_10 < 0) {
+ effect->unk_10 = 0;
+ }
+ }
+ }
+ }
+ }
+}
void func_80B0B548(BossHakugin* this, PlayState* play) {
BossHakuginUnkStruct_2618* unk_str;
@@ -1453,9 +1843,114 @@ void func_80B0B548(BossHakugin* this, PlayState* play) {
}
}
+void func_80B0B660(BossHakugin* this, PlayState* play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B660.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Update.s")
+void BossHakugin_Update(Actor* thisx, PlayState* play) {
+ s32 pad;
+ BossHakugin* this = (BossHakugin*)thisx;
+ Vec3s sp70;
+ Player* player = GET_PLAYER(play);
+
+ this->unk_0190 = 0;
+ DECR(this->unk_019A);
+
+ if ((this->actionFunc != func_80B09EDC) && (func_80B0ADFC(this, play) == 0)) {
+ func_80B0AC30(this, play);
+ }
+ func_80B0607C(this, play);
+ Actor_OffsetOfPointInActorCoords(&this->actor, (Vec3f*)&this->unk_044C.x, &player->actor.world.pos);
+ this->actionFunc(this, play);
+ Actor_MoveWithGravity(&this->actor);
+ Actor_UpdateBgCheckInfo(play, &this->actor, 450.0f, 89.100006f, 0.0f, 0x1DU);
+ func_800BE3D0(&this->actor, this->actor.shape.rot.y, &sp70);
+ Math_ScaledStepToS(&this->actor.shape.rot.x, sp70.x, 0x100);
+ Math_ScaledStepToS(&this->actor.shape.rot.z, sp70.z, 0x100);
+ if (this->actionFunc == func_80B0A8C4) {
+ func_80B0B34C(this);
+ } else {
+ func_80B0B238(this);
+ }
+ func_80B0B3F4(this);
+ func_80B0B548(this, play);
+ func_80B0B660(this, play);
+ func_80B05B04(this, play);
+ func_80B05CBC(this, player);
+ func_80B05D4C(this);
+ if ((this->unk_0484.base.atFlags & 1) && (this->actor.colorFilterTimer == 0)) {
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_0484.base);
+ } else {
+ this->unk_0484.base.atFlags &= ~2;
+ }
+ if (this->unk_01A4 == 0) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_0484.base);
+ } else {
+ this->unk_0484.base.acFlags &= ~2;
+ this->unk_01A4--;
+ }
+ if (this->unk_0484.base.ocFlags1 & 1) {
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_0484.base);
+ } else {
+ this->unk_0484.base.ocFlags1 &= ~2;
+ }
+ if (this->unk_01E4 > 0.0f) {
+ if (this->unk_0196 != 0xA) {
+ Math_StepToF(&this->unk_01E4, 0.0f, 0.05f);
+ this->unk_01DC = (this->unk_01E4 + 1.0f) * 1.25f;
+ this->unk_01DC = CLAMP_MAX(this->unk_01DC, 2.5f);
+ } else if (!Math_StepToF(&this->unk_01E0, 2.5f, 0.41666666f)) {
+ Actor_PlaySfx_Flagged(&this->actor, 0x20B2U);
+ } else {
+ func_80B07B88(this, play);
+ }
+ }
+
+ if (player->actor.floorHeight < -400.0f) {
+ CollisionPoly* sp68 = NULL;
+ Vec3f sp5C;
+ Vec3f sp50;
+ s32 sp4C;
+
+ if ((fabsf(player->actor.world.pos.z) < 1200.0f) && (fabsf(player->actor.world.pos.x) < 1200.0f)) {
+ s16 temp_v0_5 = Math_Atan2S_XY(player->actor.world.pos.z, player->actor.world.pos.x);
+
+ sp50.x = Math_SinS(temp_v0_5) * 2000.0f;
+ sp50.z = Math_CosS(temp_v0_5) * 2000.0f;
+ } else {
+ if (player->actor.world.pos.z > 1200.0f) {
+ sp50.z = 1500.0f;
+ } else if (player->actor.world.pos.z < -1200.0f) {
+ sp50.z = -1500.0f;
+ } else {
+ sp50.z = player->actor.world.pos.z;
+ }
+ if (player->actor.world.pos.x > 1200.0f) {
+ sp50.x = 1500.0f;
+ } else if (player->actor.world.pos.x < -1200.0f) {
+ sp50.x = -1500.0f;
+ } else {
+ sp50.x = player->actor.world.pos.x;
+ }
+ }
+ sp50.y = 100.0f;
+
+ if (BgCheck_EntityLineTest1(&play->colCtx, &sp50, &player->actor.world.pos, &sp5C, &sp68, true, true, false,
+ true, &sp4C)) {
+ Math_Vec3f_Copy(&player->actor.world.pos, &sp5C);
+ Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos);
+ Math_Vec3f_Copy(&player->actor.prevPos, &player->actor.world.pos);
+ player->actor.floorHeight = player->actor.world.pos.y;
+ player->actor.world.pos.y = player->actor.world.pos.y + 1.0f;
+ } else {
+ player->actor.world.pos.x = 0.0f;
+ player->actor.world.pos.y = 1.0f;
+ player->actor.world.pos.z = -1200.0f;
+ Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos);
+ Math_Vec3f_Copy(&player->actor.prevPos, &player->actor.world.pos);
+ player->actor.floorHeight = player->actor.world.pos.y;
+ }
+ }
+}
#ifdef NON_MATCHING
// requires in-function static, too lazy to import all the data right now
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index c3603caaf..6662f11e0 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -39,9 +39,9 @@ typedef struct BossHakugin {
/* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ BossHakuginActionFunc actionFunc;
/* 0x018C */ u8 unk_018C;
- /* 0x018D */ s8 unk_018D;
- /* 0x018E */ s8 unk_018E;
- /* 0x018F */ s8 unk_018F;
+ /* 0x018D */ u8 unk_018D;
+ /* 0x018E */ u8 unk_018E;
+ /* 0x018F */ u8 unk_018F;
/* 0x0190 */ u8 unk_0190; // boolean?
/* 0x0191 */ u8 unk_0191;
/* 0x0192 */ u8 unk_0192;
@@ -83,9 +83,7 @@ typedef struct BossHakugin {
/* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
/* 0x0398 */ Vec3f bodyPartsPos[15];
- /* 0x044C */ f32 unk_044C;
- /* 0x0450 */ char unk_0450[4];
- /* 0x0454 */ f32 unk_0454;
+ /* 0x044C */ Vec3f unk_044C;
/* 0x0458 */ Vec3f unk_0458;
/* 0x0464 */ Vec3f unk_0464;
/* 0x0470 */ LightNode* lightNode;
diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
index 21d8bf309..4f4b15545 100644
--- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
+++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
@@ -142,7 +142,7 @@ void EnBombers_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f);
this->actor.gravity = -1.0f;
SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable,
- this->morphtable, OBJECT_CS_LIMB_MAX);
+ this->morphTable, OBJECT_CS_LIMB_MAX);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.targetMode = TARGET_MODE_0;
Actor_SetScale(&this->actor, 0.01f);
diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h
index 76013781b..500fff573 100644
--- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h
+++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h
@@ -25,7 +25,7 @@ typedef struct EnBombers {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX];
- /* 0x206 */ Vec3s morphtable[OBJECT_CS_LIMB_MAX];
+ /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX];
/* 0x284 */ EnBombersActionFunc actionFunc;
/* 0x288 */ s16 unk_288;
/* 0x28A */ s16 unk_28A;
diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c
index 30dc3de26..89ee2e5fd 100644
--- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c
+++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c
@@ -933,7 +933,7 @@ void EnEgol_Slam(EnEgol* this, PlayState* play) {
}
EnEgol_DestroyBlocks(this, play, this->rightHandPos, this->leftHandPos);
}
- if (this->animEndFrame <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
EnEgol_SetupSlamWait(this);
} else if ((this->skelAnime.curFrame <= 17.0f) && (this->skelAnime.curFrame >= 10.0f)) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base);
diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
index 39269c2ac..08f97aa93 100644
--- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
+++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
@@ -3931,10 +3931,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
SkelAnime_Free(&this->skelAnime, play);
if (this->unk_148 == 0) {
- SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, 0, 0, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, NULL, NULL, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingBassAnim, 0.0f);
} else {
- SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL,
+ 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f);
}
}
diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
index 7fcf32bf4..e00f3b523 100644
--- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
+++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
@@ -329,7 +329,8 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) {
s32 pad;
if (this->blinkTimer == 0) {
- if (++(this->eyeState) >= 3) {
+ this->eyeState++;
+ if (this->eyeState >= 3) {
this->eyeState = 0;
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
index 841e6f539..85000e5cb 100644
--- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
+++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
@@ -194,6 +194,7 @@ void EnHanabi_Init(Actor* thisx, PlayState* play2) {
EnHanabi* this = THIS;
s32 i;
+ //! FAKE:
if (1) {}
Actor_SetScale(thisx, 1.0f);
diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c
index 83973d9e9..19c2a34a8 100644
--- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c
+++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c
@@ -20,14 +20,6 @@ void EnHeishi_SetHeadRotation(EnHeishi* this);
void EnHeishi_SetupIdle(EnHeishi* this);
void EnHeishi_Idle(EnHeishi* this, PlayState* play);
-typedef enum {
- /* 0 */ HEISHI_ANIM_STAND_HAND_ON_HIP,
- /* 1 */ HEISHI_ANIM_CHEER_WITH_SPEAR,
- /* 2 */ HEISHI_ANIM_WAVE,
- /* 3 */ HEISHI_ANIM_SIT_AND_REACH,
- /* 4 */ HEISHI_ANIM_STAND_UP
-} EnHeishiAnimation;
-
ActorInit En_Heishi_InitVars = {
ACTOR_EN_HEISHI,
ACTORCAT_NPC,
@@ -97,19 +89,36 @@ void EnHeishi_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->colliderCylinder);
}
+typedef enum EnHeishiAnimation {
+ /* 0 */ HEISHI_ANIM_STAND_HAND_ON_HIP,
+ /* 1 */ HEISHI_ANIM_CHEER_WITH_SPEAR,
+ /* 2 */ HEISHI_ANIM_WAVE,
+ /* 3 */ HEISHI_ANIM_SIT_AND_REACH,
+ /* 4 */ HEISHI_ANIM_STAND_UP,
+ /* 5 */ HEISHI_ANIM_MAX
+} EnHeishiAnimation;
+
+static AnimationHeader* sAnimations[HEISHI_ANIM_MAX] = {
+ &gSoldierStandHandOnHip, // HEISHI_ANIM_STAND_HAND_ON_HIP
+ &gSoldierCheerWithSpear, // HEISHI_ANIM_CHEER_WITH_SPEAR
+ &gSoldierWave, // HEISHI_ANIM_WAVE
+ &gSoldierSitAndReach, // HEISHI_ANIM_SIT_AND_REACH
+ &gSoldierStandUp, // HEISHI_ANIM_STAND_UP
+};
+
+static u8 sAnimationModes[HEISHI_ANIM_MAX] = {
+ ANIMMODE_LOOP, // HEISHI_ANIM_STAND_HAND_ON_HIP
+ ANIMMODE_LOOP, // HEISHI_ANIM_CHEER_WITH_SPEAR
+ ANIMMODE_LOOP, // HEISHI_ANIM_WAVE
+ ANIMMODE_LOOP, // HEISHI_ANIM_SIT_AND_REACH
+ ANIMMODE_ONCE, // HEISHI_ANIM_STAND_UP
+};
+
void EnHeishi_ChangeAnim(EnHeishi* this, s32 animIndex) {
- static AnimationHeader* sAnimations[] = {
- &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp,
- };
- static u8 sAnimationModes[] = {
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP,
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP,
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP,
- };
this->animIndex = animIndex;
- this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]);
- Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount,
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]);
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], -10.0f);
}
diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h
index 1758ceae6..4d886cb3c 100644
--- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h
+++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h
@@ -25,7 +25,7 @@ typedef struct EnHeishi {
/* 0x26C */ s32 shouldSetHeadRotation;
/* 0x270 */ s16 timer;
/* 0x272 */ s16 yawTowardsPlayer;
- /* 0x274 */ f32 frameCount;
+ /* 0x274 */ f32 animEndFrame;
/* 0x278 */ s16 unk278; // set and not used
/* 0x27C */ UNK_TYPE1 unk_27C[0x8];
/* 0x284 */ ColliderCylinder colliderCylinder;
diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c
index 2c652f11c..ded070de4 100644
--- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c
+++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c
@@ -29,17 +29,6 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play);
s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
-typedef enum {
- /* 0 */ HG_ANIM_IDLE,
- /* 1 */ HG_ANIM_LURCH_FORWARD,
- /* 2 */ HG_ANIM_RECOIL,
- /* 3 */ HG_ANIM_LEAN_FORWARD,
- /* 4 */ HG_ANIM_REACH_FORWARD,
- /* 5 */ HG_ANIM_CURL_UP,
- /* 6 */ HG_ANIM_CROUCHED_PANIC,
- /* 7 */ HG_ANIM_PANIC
-} HgAnimation;
-
typedef enum {
/* 0 */ HG_CS_FIRST_ENCOUNTER,
/* 1 */ HG_CS_GET_MASK,
@@ -118,15 +107,27 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = {
0, 0, 0, 0, 0x80,
};
-static AnimationInfo sAnimationInfo[] = {
- { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f },
- { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f },
- { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
+typedef enum {
+ /* 0 */ HG_ANIM_IDLE,
+ /* 1 */ HG_ANIM_LURCH_FORWARD,
+ /* 2 */ HG_ANIM_RECOIL,
+ /* 3 */ HG_ANIM_LEAN_FORWARD,
+ /* 4 */ HG_ANIM_REACH_FORWARD,
+ /* 5 */ HG_ANIM_CURL_UP,
+ /* 6 */ HG_ANIM_CROUCHED_PANIC,
+ /* 7 */ HG_ANIM_PANIC,
+ /* 8 */ HG_ANIM_MAX
+} HgAnimation;
+
+static AnimationInfo sAnimationInfo[HG_ANIM_MAX] = {
+ { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_IDLE
+ { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_LURCH_FORWARD
+ { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_RECOIL
+ { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_LEAN_FORWARD
+ { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_REACH_FORWARD
+ { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_CURL_UP
+ { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_CROUCHED_PANIC
+ { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_PANIC
};
static u32 sHasSoundPlayed = false;
@@ -192,7 +193,7 @@ void EnHg_ChasePlayer(EnHg* this, PlayState* play) {
s32 pad;
this->actor.speed = 1.6f;
- if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) {
+ if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) {
if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) ||
((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) {
Actor_MoveWithGravity(&this->actor);
@@ -233,7 +234,6 @@ void EnHg_ReactToHit(EnHg* this, PlayState* play) {
void EnHg_HandleTatlDialog(EnHg* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
- // "...Sort of looks different..."
Message_StartTextbox(play, 0x24F, &this->actor);
} else {
Actor_OfferTalk(&this->actor, play, 80.0f);
@@ -295,7 +295,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) {
this->csIdList[3] = play->csCtx.actorCues[cueChannel]->id;
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
- this->animIndex = 0;
+ this->animIndex = HG_ANIM_IDLE;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_IDLE);
break;
@@ -329,6 +329,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_75_20);
Actor_Kill(&this->actor);
break;
+
+ default:
+ break;
}
} else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
switch (this->animIndex) {
@@ -341,6 +344,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) {
this->animIndex = HG_ANIM_CROUCHED_PANIC;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_CROUCHED_PANIC);
break;
+
+ default:
+ break;
}
}
@@ -360,6 +366,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG);
}
break;
+
+ default:
+ break;
}
Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel);
diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c
index 15bfd598b..c4d9c0371 100644
--- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c
+++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c
@@ -38,16 +38,6 @@ typedef enum {
/* 2 */ HGO_EYE_CLOSED
} EyeState;
-typedef enum {
- /* 0 */ HGO_ANIM_ARMS_FOLDED,
- /* 1 */ HGO_ANIM_ASTONISHED,
- /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG,
- /* 3 */ HGO_ANIM_CONSOLE,
- /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP,
- /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT,
- /* 6 */ HGO_ANIM_TOSS
-} HgoAnimation;
-
ActorInit En_Hgo_InitVars = {
ACTOR_EN_HGO,
ACTORCAT_NPC,
@@ -60,14 +50,25 @@ ActorInit En_Hgo_InitVars = {
(ActorFunc)EnHgo_Draw,
};
-static AnimationInfo sAnimationInfo[] = {
- { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f },
- { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f },
- { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
+typedef enum {
+ /* 0 */ HGO_ANIM_ARMS_FOLDED,
+ /* 1 */ HGO_ANIM_ASTONISHED,
+ /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG,
+ /* 3 */ HGO_ANIM_CONSOLE,
+ /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP,
+ /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT,
+ /* 6 */ HGO_ANIM_TOSS,
+ /* 7 */ HGO_ANIM_MAX
+} HgoAnimation;
+
+static AnimationInfo sAnimationInfo[HGO_ANIM_MAX] = {
+ { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HGO_ANIM_ARMS_FOLDED
+ { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_ASTONISHED
+ { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_KNEEL_DOWN_AND_HUG
+ { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE
+ { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE_HEAD_UP
+ { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_REACH_DOWN_TO_LIFT
+ { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_TOSS
};
static ColliderCylinderInit sCylinderInit = {
@@ -109,6 +110,7 @@ void EnHgo_Init(Actor* thisx, PlayState* play) {
this->textId = 0;
this->talkFlags = TALK_FLAG_NONE;
this->isInCutscene = false;
+
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) {
EnHgo_SetupTalk(this);
} else {
@@ -143,7 +145,7 @@ void EnHgo_UpdateCollision(EnHgo* this, PlayState* play) {
}
void EnHgo_SetupTalk(EnHgo* this) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED);
this->actionFunc = EnHgo_Talk;
}
@@ -206,6 +208,9 @@ void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play) {
EnHgo_SetupTalk(this);
}
break;
+
+ default:
+ break;
}
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x71C, 0xB6);
@@ -271,6 +276,9 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) {
Message_CloseTextbox(play);
EnHgo_SetupTalk(this);
break;
+
+ default:
+ break;
}
}
}
@@ -285,33 +293,36 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) {
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
this->animIndex = HGO_ANIM_ARMS_FOLDED;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED);
break;
case 2:
this->actor.draw = EnHgo_Draw;
this->animIndex = HGO_ANIM_ASTONISHED;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ASTONISHED);
break;
case 3:
this->animIndex = HGO_ANIM_KNEEL_DOWN_AND_HUG;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_KNEEL_DOWN_AND_HUG);
break;
case 4:
this->animIndex = HGO_ANIM_CONSOLE;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE);
break;
case 5:
this->animIndex = HGO_ANIM_CONSOLE_HEAD_UP;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE_HEAD_UP);
break;
case 6:
this->animIndex = HGO_ANIM_REACH_DOWN_TO_LIFT;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_REACH_DOWN_TO_LIFT);
+ break;
+
+ default:
break;
}
} else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
@@ -328,12 +339,15 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) {
case HGO_ANIM_KNEEL_DOWN_AND_HUG:
this->animIndex = HGO_ANIM_CONSOLE;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE);
break;
case HGO_ANIM_REACH_DOWN_TO_LIFT:
this->animIndex = HGO_ANIM_TOSS;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_TOSS);
+
+ default:
+ break;
}
}
diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c
index e07dfb8a9..5d1e0ee24 100644
--- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c
+++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c
@@ -6,7 +6,6 @@
#include "z_en_hidden_nuts.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
-#include "objects/object_hintnuts/object_hintnuts.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_2000000)
@@ -63,15 +62,41 @@ static ColliderCylinderInit sCylinderInit = {
{ 30, 20, 0, { 0, 0, 0 } },
};
-static AnimationHeader* D_80BDC0FC[] = {
- &object_hintnuts_Anim_000168, &object_hintnuts_Anim_0024CC, &object_hintnuts_Anim_0026C4,
- &object_hintnuts_Anim_002894, &object_hintnuts_Anim_002B90, &object_hintnuts_Anim_002F7C,
- &object_hintnuts_Anim_003128, &object_hintnuts_Anim_0029BC, &object_hintnuts_Anim_0024CC,
+typedef enum EnHiddenNutsAnimation {
+ /* 0 */ ENHIDDENNUTS_ANIM_0,
+ /* 1 */ ENHIDDENNUTS_ANIM_1,
+ /* 2 */ ENHIDDENNUTS_ANIM_2,
+ /* 3 */ ENHIDDENNUTS_ANIM_3,
+ /* 4 */ ENHIDDENNUTS_ANIM_4,
+ /* 5 */ ENHIDDENNUTS_ANIM_5,
+ /* 6 */ ENHIDDENNUTS_ANIM_6,
+ /* 7 */ ENHIDDENNUTS_ANIM_7,
+ /* 8 */ ENHIDDENNUTS_ANIM_8,
+ /* 9 */ ENHIDDENNUTS_ANIM_MAX
+} EnHiddenNutsAnimation;
+
+static AnimationHeader* sAnimations[ENHIDDENNUTS_ANIM_MAX] = {
+ &object_hintnuts_Anim_000168, // ENHIDDENNUTS_ANIM_0
+ &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_1
+ &object_hintnuts_Anim_0026C4, // ENHIDDENNUTS_ANIM_2
+ &object_hintnuts_Anim_002894, // ENHIDDENNUTS_ANIM_3
+ &object_hintnuts_Anim_002B90, // ENHIDDENNUTS_ANIM_4
+ &object_hintnuts_Anim_002F7C, // ENHIDDENNUTS_ANIM_5
+ &object_hintnuts_Anim_003128, // ENHIDDENNUTS_ANIM_6
+ &object_hintnuts_Anim_0029BC, // ENHIDDENNUTS_ANIM_7
+ &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_8
};
-u8 D_80BDC120[] = {
- ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE,
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP,
+static u8 sAnimationModes[ENHIDDENNUTS_ANIM_MAX] = {
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_0
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_1
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_2
+ ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_3
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_4
+ ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_5
+ ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_6
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_7
+ ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_8
};
void EnHiddenNuts_Init(Actor* thisx, PlayState* play) {
@@ -79,7 +104,7 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC,
- this->jointTable, this->morphTable, 10);
+ this->jointTable, this->morphTable, OBJECT_HINTNUTS_LIMB_MAX);
Actor_SetScale(&this->actor, 0.01f);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@@ -116,27 +141,29 @@ void EnHiddenNuts_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
-void func_80BDB1B4(EnHiddenNuts* this, s32 arg1) {
- f32 sp34;
- f32 sp30;
+void EnHiddenNuts_ChangeAnim(EnHiddenNuts* this, s32 animIndex) {
+ f32 startFrame;
+ f32 morphFrames;
- this->unk_220 = arg1;
- sp34 = 0.0f;
- sp30 = -4.0f;
- this->unk_22C = Animation_GetLastFrame(D_80BDC0FC[arg1]);
- if (this->unk_220 == 1) {
- sp34 = this->unk_22C;
- sp30 = 0.0f;
+ this->animIndex = animIndex;
+ startFrame = 0.0f;
+ morphFrames = -4.0f;
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
+
+ if (this->animIndex == ENHIDDENNUTS_ANIM_1) {
+ startFrame = this->animEndFrame;
+ morphFrames = 0.0f;
}
- Animation_Change(&this->skelAnime, D_80BDC0FC[this->unk_220], 1.0f, sp34, this->unk_22C, D_80BDC120[this->unk_220],
- sp30);
+
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->animEndFrame,
+ sAnimationModes[this->animIndex], morphFrames);
}
void func_80BDB268(EnHiddenNuts* this) {
this->actor.textId = 0x234;
this->unk_228 = 1600.0f;
this->actor.shape.yOffset = 1600.0f;
- func_80BDB1B4(this, 1);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_1);
this->unk_21A = 0;
this->actionFunc = func_80BDB2B8;
}
@@ -148,12 +175,12 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG);
if (player->stateFlags2 & PLAYER_STATE2_8000000) {
- if (this->unk_20A == 0) {
+ if (!this->unk_20A) {
Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR);
- this->unk_20A = 1;
+ this->unk_20A = true;
}
} else {
- this->unk_20A = 0;
+ this->unk_20A = false;
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@@ -263,20 +290,20 @@ void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) {
EffectSsHahen_SpawnBurst(play, &sp3C, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP);
- func_80BDB1B4(this, 7);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_7);
this->actionFunc = func_80BDB8F4;
}
void func_80BDB8F4(EnHiddenNuts* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
- if (this->unk_22C <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
func_80BDB930(this);
}
}
void func_80BDB930(EnHiddenNuts* this) {
- func_80BDB1B4(this, 3);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_3);
this->unk_21A = 3;
this->unk_228 = 500.0f;
this->actionFunc = func_80BDB978;
@@ -290,7 +317,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NUT_FAINT);
}
- if (this->unk_22C <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
this->unk_224++;
if (this->unk_224 >= 2) {
func_80BDBA28(this, play);
@@ -301,7 +328,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) {
void func_80BDBA28(EnHiddenNuts* this, PlayState* play) {
Vec3f sp44;
- func_80BDB1B4(this, 2);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_2);
this->unk_228 = 0.0f;
Math_Vec3f_Copy(&sp44, &this->actor.world.pos);
@@ -326,10 +353,10 @@ void func_80BDBA28(EnHiddenNuts* this, PlayState* play) {
void func_80BDBB48(EnHiddenNuts* this, PlayState* play) {
s32 pad[3];
- f32 sp58 = this->skelAnime.curFrame;
+ f32 curFrame = this->skelAnime.curFrame;
WaterBox* sp54;
f32 sp50;
- s16 sp4E = 0;
+ s16 sp4E = false;
Vec3f sp40;
if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) &&
@@ -346,23 +373,23 @@ void func_80BDBB48(EnHiddenNuts* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
Animation_OnFrame(&this->skelAnime, 10.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER);
- sp4E = 1;
+ sp4E = true;
}
}
- if ((sp4E != 0) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
- Animation_OnFrame(&this->skelAnime, 10.0f))) {
+ if (sp4E && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
+ Animation_OnFrame(&this->skelAnime, 10.0f))) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK);
}
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C), 1, 0x1388, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x3E8, 0);
- if (this->unk_220 == 2) {
- if (this->unk_22C <= sp58) {
+ if (this->animIndex == ENHIDDENNUTS_ANIM_2) {
+ if (curFrame >= this->animEndFrame) {
this->actor.speed = 0.0f;
this->actor.velocity.y = 0.0f;
- func_80BDB1B4(this, 6);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_6);
}
} else {
Math_ApproachF(&this->actor.world.pos.x, this->unk_20C.x, 0.5f,
@@ -387,7 +414,7 @@ void func_80BDBE70(EnHiddenNuts* this, PlayState* play) {
if (this->switchFlag >= 0) {
Flags_SetSwitch(play, this->switchFlag);
}
- func_80BDB1B4(this, 8);
+ EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_8);
this->unk_21A = 5;
this->actionFunc = func_80BDBED4;
}
@@ -396,7 +423,7 @@ void func_80BDBED4(EnHiddenNuts* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
Vec3f sp38;
- if (this->unk_22C <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
Math_Vec3f_Copy(&sp38, &this->actor.world.pos);
sp38.y = this->actor.floorHeight;
diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h
index 03a0a52b7..df8275aa4 100644
--- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h
+++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h
@@ -2,6 +2,7 @@
#define Z_EN_HIDDEN_NUTS_H
#include "global.h"
+#include "objects/object_hintnuts/object_hintnuts.h"
struct EnHiddenNuts;
@@ -16,8 +17,8 @@ typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*);
typedef struct EnHiddenNuts {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s jointTable[10];
- /* 0x1C4 */ Vec3s morphTable[10];
+ /* 0x188 */ Vec3s jointTable[OBJECT_HINTNUTS_LIMB_MAX];
+ /* 0x1C4 */ Vec3s morphTable[OBJECT_HINTNUTS_LIMB_MAX];
/* 0x200 */ EnHiddenNutsActionFunc actionFunc;
/* 0x204 */ Path* path;
/* 0x208 */ s16 unk_208;
@@ -27,11 +28,11 @@ typedef struct EnHiddenNuts {
/* 0x21A */ s16 unk_21A;
/* 0x21C */ s16 switchFlag;
/* 0x21E */ s16 pathIndex;
- /* 0x220 */ s32 unk_220;
+ /* 0x220 */ s32 animIndex;
/* 0x224 */ s16 unk_224;
/* 0x226 */ s16 csId;
/* 0x228 */ f32 unk_228;
- /* 0x22C */ f32 unk_22C;
+ /* 0x22C */ f32 animEndFrame;
/* 0x230 */ UNK_TYPE1 unk230[4];
/* 0x234 */ ColliderCylinder collider;
} EnHiddenNuts; // size = 0x280
diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
index 5ad3e9dcf..f9e51b55c 100644
--- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
+++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
@@ -6,7 +6,6 @@
#include "z_en_hint_skb.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
-#include "objects/object_skb/object_skb.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@@ -126,20 +125,37 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0xF),
};
-static AnimationInfo sAnimationInfo[] = {
- { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f },
- { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f },
- { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
- { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
- { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
- { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
- { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f },
- { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
- { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
- { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
+typedef enum EnHinkSkbAnimation {
+ /* 0 */ ENHINTSKB_ANIM_0,
+ /* 1 */ ENHINTSKB_ANIM_1,
+ /* 2 */ ENHINTSKB_ANIM_2,
+ /* 3 */ ENHINTSKB_ANIM_3,
+ /* 4 */ ENHINTSKB_ANIM_4,
+ /* 5 */ ENHINTSKB_ANIM_5,
+ /* 6 */ ENHINTSKB_ANIM_6,
+ /* 7 */ ENHINTSKB_ANIM_7,
+ /* 8 */ ENHINTSKB_ANIM_8,
+ /* 9 */ ENHINTSKB_ANIM_9,
+ /* 10 */ ENHINTSKB_ANIM_10,
+ /* 11 */ ENHINTSKB_ANIM_11,
+ /* 12 */ ENHINTSKB_ANIM_12,
+ /* 13 */ ENHINTSKB_ANIM_MAX
+} EnHinkSkbAnimation;
+
+static AnimationInfo sAnimationInfo[ENHINTSKB_ANIM_MAX] = {
+ { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_0
+ { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // ENHINTSKB_ANIM_1
+ { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, // ENHINTSKB_ANIM_2
+ { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENHINTSKB_ANIM_3
+ { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENHINTSKB_ANIM_4
+ { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_5
+ { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_6
+ { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_7
+ { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_8
+ { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, // ENHINTSKB_ANIM_9
+ { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_10
+ { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_11
+ { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENHINTSKB_ANIM_12
};
static InitChainEntry sInitChain[] = {
@@ -153,7 +169,7 @@ void EnHintSkb_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable,
- this->morphtable, 20);
+ this->morphTable, OBJECT_SKB_LIMB_MAX);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElement);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
@@ -181,7 +197,7 @@ void func_80C1FE20(EnHintSkb* this, PlayState* play) {
}
void func_80C1FE30(EnHintSkb* this) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_0);
this->actor.speed = 1.6f;
this->actionFunc = func_80C1FE80;
}
@@ -200,7 +216,7 @@ void func_80C1FE80(EnHintSkb* this, PlayState* play) {
void func_80C1FF30(EnHintSkb* this) {
this->collider.base.atFlags &= ~AT_BOUNCED;
this->actor.speed = 0.0f;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_2);
this->actionFunc = func_80C1FF88;
}
@@ -274,12 +290,12 @@ void func_80C2016C(EnHintSkb* this, PlayState* play) {
void func_80C20274(EnHintSkb* this) {
if (this->skelAnime.animation == &object_skb_Anim_00697C) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_8);
this->actor.gravity = -1.0f;
this->actor.speed = 1.0f;
} else {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->actor.speed = -4.0f;
}
@@ -317,7 +333,7 @@ void func_80C20334(EnHintSkb* this, PlayState* play) {
}
void func_80C20484(EnHintSkb* this) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_4);
this->unk_3E8 |= 4;
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->actor.speed = -6.0f;
@@ -349,7 +365,7 @@ void func_80C20590(EnHintSkb* this, PlayState* play) {
this->drawDmgEffAlpha = 0.0f;
if (this->actor.colChkInfo.health != 0) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
this->unk_3E8 |= 1;
func_80C20274(this);
@@ -376,7 +392,7 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) {
this->drawDmgEffAlpha = 0.0f;
if (this->actor.colChkInfo.health != 0) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
this->unk_3E8 |= 1;
func_80C20274(this);
@@ -405,10 +421,10 @@ void func_80C2077C(EnHintSkb* this, PlayState* play) {
this->actor.speed = 2.4f;
this->actor.gravity = -1.0f;
this->actor.velocity.y = 3.0f;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_8);
}
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_11);
Message_StartTextbox(play, 0x1148, &this->actor);
this->unk_3E6 = 0x1148;
}
@@ -449,6 +465,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) {
case TEXT_STATE_NONE:
case TEXT_STATE_1:
case TEXT_STATE_CLOSING:
+ default:
break;
}
@@ -467,7 +484,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) {
Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Message_StartTextbox(play, 0x1147, &this->actor);
this->unk_3E6 = 0x1147;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_0);
}
}
@@ -542,7 +559,7 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) {
case 0x1147:
Message_StartTextbox(play, 0x1148, &this->actor);
this->unk_3E6 = 0x1148;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_11);
break;
case 0x1148:
@@ -578,6 +595,9 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) {
func_80C2075C(this);
}
break;
+
+ default:
+ break;
}
}
@@ -591,7 +611,7 @@ void func_80C20D64(EnHintSkb* this, PlayState* play) {
this->actor.hintId = TATL_HINT_ID_NONE;
this->actor.textId = 0;
if (this->actionFunc == func_80C1FE80) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_12);
}
func_80C2075C(this);
}
@@ -682,6 +702,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) {
this->unk_3E8 |= 1;
func_80C20274(this);
break;
+
case 3:
if (this->actor.colChkInfo.health != 0) {
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
@@ -695,6 +716,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
func_80C20540(this);
break;
+
case 4:
this->drawDmgEffTimer = 40;
this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS;
@@ -702,14 +724,14 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) {
this->drawDmgEffScale = 0.5f;
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3);
func_80C2066C(this);
break;
case 12:
case 14:
this->unk_3E8 |= 1;
-
+ // fallthrough
case 15:
if ((player->meleeWeaponAnimation == PLAYER_MWA_RIGHT_SLASH_1H) ||
(player->meleeWeaponAnimation == PLAYER_MWA_LEFT_COMBO_2H) ||
@@ -717,11 +739,11 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) {
(player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)) {
this->unk_3E8 |= 1;
}
-
+ // fallthrough
case 13:
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3);
func_80C20274(this);
break;
@@ -731,6 +753,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) {
case 8:
case 9:
case 10:
+ default:
break;
}
}
@@ -850,7 +873,7 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
EnHintSkb* this = THIS;
f32 temp_f10;
- if (limbIndex == 11) {
+ if (limbIndex == OBJECT_SKB_LIMB_0B) {
OPEN_DISPS(play->state.gfxCtx);
temp_f10 = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f;
@@ -859,13 +882,13 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
gDPSetEnvColor(POLY_OPA_DISP++, (s16)temp_f10, (s16)temp_f10, (s16)temp_f10, 255);
CLOSE_DISPS(play->state.gfxCtx);
- } else if (limbIndex == 10) {
+ } else if (limbIndex == OBJECT_SKB_LIMB_0A) {
Matrix_MultZero(&this->actor.focus.pos);
- } else if ((limbIndex == 12) && (this->unk_3DE == 1)) {
+ } else if ((limbIndex == OBJECT_SKB_LIMB_0C) && (this->unk_3DE == 1)) {
Matrix_RotateZS(0x71C, MTXMODE_APPLY);
}
- if (((limbIndex == 11) || (limbIndex == 12)) && (this->unk_3E8 & 2)) {
+ if (((limbIndex == OBJECT_SKB_LIMB_0B) || (limbIndex == OBJECT_SKB_LIMB_0C)) && (this->unk_3E8 & 2)) {
*dList = NULL;
}
@@ -879,21 +902,25 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s*
if (!(this->unk_3E8 & 8)) {
Collider_UpdateSpheres(limbIndex, &this->collider);
- if ((limbIndex == 11) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) {
+ if ((limbIndex == OBJECT_SKB_LIMB_0B) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) {
Actor_SpawnBodyParts(&this->actor, play, 1, dList);
this->unk_3E8 |= 2;
- } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && ((limbIndex != 11) || !(this->unk_3E8 & 1)) &&
- (limbIndex != 12)) {
+ } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) &&
+ ((limbIndex != OBJECT_SKB_LIMB_0B) || !(this->unk_3E8 & 1)) && (limbIndex != OBJECT_SKB_LIMB_0C)) {
Actor_SpawnBodyParts(&this->actor, play, 1, dList);
}
if (this->drawDmgEffTimer != 0) {
- if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) ||
- (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) ||
- (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) {
+ if ((limbIndex == OBJECT_SKB_LIMB_02) || (limbIndex == OBJECT_SKB_LIMB_04) ||
+ (limbIndex == OBJECT_SKB_LIMB_05) || (limbIndex == OBJECT_SKB_LIMB_06) ||
+ (limbIndex == OBJECT_SKB_LIMB_07) || (limbIndex == OBJECT_SKB_LIMB_08) ||
+ (limbIndex == OBJECT_SKB_LIMB_09) || (limbIndex == OBJECT_SKB_LIMB_0D) ||
+ (limbIndex == OBJECT_SKB_LIMB_0E) || (limbIndex == OBJECT_SKB_LIMB_0F) ||
+ (limbIndex == OBJECT_SKB_LIMB_10) || (limbIndex == OBJECT_SKB_LIMB_11) ||
+ (limbIndex == OBJECT_SKB_LIMB_12)) {
Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]);
this->bodyPartsCount++;
- } else if ((limbIndex == 11) && !(this->unk_3E8 & 2)) {
+ } else if ((limbIndex == OBJECT_SKB_LIMB_0B) && !(this->unk_3E8 & 2)) {
Matrix_MultVec3f(&D_80C21E70, &this->bodyPartsPos[this->bodyPartsCount]);
this->bodyPartsCount++;
}
diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h
index e263b9de0..95576210d 100644
--- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h
+++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h
@@ -2,6 +2,7 @@
#define Z_EN_HINT_SKB_H
#include "global.h"
+#include "objects/object_skb/object_skb.h"
struct EnHintSkb;
@@ -37,8 +38,8 @@ typedef struct EnHintSkb {
/* 0x2D4 */ f32 drawDmgEffAlpha;
/* 0x2D8 */ f32 drawDmgEffScale;
/* 0x2DC */ s32 bodyPartsCount;
- /* 0x2E0 */ Vec3s jointTable[20];
- /* 0x358 */ Vec3s morphtable[20];
+ /* 0x2E0 */ Vec3s jointTable[OBJECT_SKB_LIMB_MAX];
+ /* 0x358 */ Vec3s morphTable[OBJECT_SKB_LIMB_MAX];
/* 0x3D0 */ UNK_TYPE1 unk3D0[0xC];
/* 0x3DC */ s16 unk_3DC;
/* 0x3DE */ s16 unk_3DE;
diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
index 00a5fd3b1..088e3fae0 100644
--- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c
+++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
@@ -40,10 +40,10 @@ void EnHorse_StartReversing(EnHorse* this);
void EnHorse_StartLowJump(EnHorse* this, PlayState* play);
void EnHorse_StartHighJump(EnHorse* this, PlayState* play);
void EnHorse_InitInactive(EnHorse* this);
-void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames);
+void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames);
void EnHorse_ResetIdleAnimation(EnHorse* this);
void EnHorse_StartIdleRidable(EnHorse* this);
-void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames);
+void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames);
void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play);
void EnHorse_InitIngoHorse(EnHorse* this);
void EnHorse_UpdateIngoHorseAnim(EnHorse* this);
@@ -109,33 +109,56 @@ typedef struct {
/* 0x4 */ RaceWaypoint* waypoints;
} RaceInfo; // size = 0x8
-static AnimationHeader* sEponaAnimations[] = {
- &gEponaIdleAnim,
- &gEponaWhinnyAnim,
- &object_horse_link_child_Anim_005F64,
- &object_horse_link_child_Anim_004DE8,
- &gEponaWalkAnim,
- &gEponaTrotAnim,
- &gEponaGallopAnim,
- &object_horse_link_child_Anim_0035B0,
- &object_horse_link_child_Anim_003D38,
+static AnimationHeader* sEponaAnimations[ENHORSE_ANIM_MAX] = {
+ &gEponaIdleAnim, // ENHORSE_ANIM_IDLE
+ &gEponaWhinnyAnim, // ENHORSE_ANIM_WHINNY
+ &object_horse_link_child_Anim_005F64, // ENHORSE_ANIM_STOPPING
+ &object_horse_link_child_Anim_004DE8, // ENHORSE_ANIM_REARING
+ &gEponaWalkAnim, // ENHORSE_ANIM_WALK
+ &gEponaTrotAnim, // ENHORSE_ANIM_TROT
+ &gEponaGallopAnim, // ENHORSE_ANIM_GALLOP
+ &object_horse_link_child_Anim_0035B0, // ENHORSE_ANIM_LOW_JUMP
+ &object_horse_link_child_Anim_003D38, // ENHORSE_ANIM_HIGH_JUMP
};
-static AnimationHeader* sHniAnimations[] = {
- &gHorseIdleAnim, &gHorseShakeHeadAnim, &gHorseStopAnim, &gHorseWhinnyAnim, &gHorseWalkAnim,
- &gHorseTrotAnim, &gHorseGallopAnim, &gHorseJumpLowAnim, &gHorseJumpHighAnim,
+static AnimationHeader* sHniAnimations[ENHORSE_ANIM_MAX] = {
+ &gHorseIdleAnim, // ENHORSE_ANIM_IDLE
+ &gHorseShakeHeadAnim, // ENHORSE_ANIM_WHINNY
+ &gHorseStopAnim, // ENHORSE_ANIM_STOPPING
+ &gHorseWhinnyAnim, // ENHORSE_ANIM_REARING @TODO: Does not line up
+ &gHorseWalkAnim, // ENHORSE_ANIM_WALK
+ &gHorseTrotAnim, // ENHORSE_ANIM_TROT
+ &gHorseGallopAnim, // ENHORSE_ANIM_GALLOP
+ &gHorseJumpLowAnim, // ENHORSE_ANIM_LOW_JUMP
+ &gHorseJumpHighAnim, // ENHORSE_ANIM_HIGH_JUMP
};
-static AnimationHeader** sAnimationHeaders[] = {
- NULL, NULL, sEponaAnimations, sHniAnimations, sHniAnimations,
+static AnimationHeader** sAnimationHeaders[HORSE_TYPE_MAX] = {
+ NULL, // HORSE_TYPE_EPONA
+ NULL, // HORSE_TYPE_HNI
+ sEponaAnimations, // HORSE_TYPE_2
+ sHniAnimations, // HORSE_TYPE_BANDIT
+ sHniAnimations, // HORSE_TYPE_DONKEY
};
-static f32 sPlaybackSpeeds[] = {
- 2.0f / 3.0f, 2.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f,
+static f32 sPlaybackSpeeds[ENHORSE_ANIM_MAX] = {
+ 2.0f / 3.0f, // ENHORSE_ANIM_IDLE
+ 2.0f / 3.0f, // ENHORSE_ANIM_WHINNY
+ 3.0f / 3.0f, // ENHORSE_ANIM_STOPPING
+ 3.0f / 3.0f, // ENHORSE_ANIM_REARING
+ 3.0f / 3.0f, // ENHORSE_ANIM_WALK
+ 3.0f / 3.0f, // ENHORSE_ANIM_TROT
+ 3.0f / 3.0f, // ENHORSE_ANIM_GALLOP
+ 2.0f / 3.0f, // ENHORSE_ANIM_LOW_JUMP
+ 2.0f / 3.0f, // ENHORSE_ANIM_HIGH_JUMP
};
-static SkeletonHeader* sSkeletonHeaders[] = {
- NULL, NULL, &gEponaSkel, NULL, NULL,
+static SkeletonHeader* sSkeletonHeaders[HORSE_TYPE_MAX] = {
+ NULL, // HORSE_TYPE_EPONA
+ NULL, // HORSE_TYPE_HNI
+ &gEponaSkel, // HORSE_TYPE_2
+ NULL, // HORSE_TYPE_BANDIT
+ NULL, // HORSE_TYPE_DONKEY
};
ActorInit En_Horse_InitVars = {
@@ -570,7 +593,8 @@ void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) {
} else {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST);
}
- } else if ((this->animIndex == 3) && (this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) {
+ } else if ((this->animIndex == ENHORSE_ANIM_REARING) && (this->curFrame > 25.0f) &&
+ !(this->stateFlags & ENHORSE_LAND2_SOUND)) {
this->stateFlags |= ENHORSE_LAND2_SOUND;
if (this->type == HORSE_TYPE_2) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2);
@@ -836,7 +860,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]);
}
- this->animIndex = 0;
+ this->animIndex = ENHORSE_ANIM_IDLE;
this->numBoosts = 6;
this->boostRegenTime = 0;
this->postDrawFunc = NULL;
@@ -1900,21 +1924,21 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) {
}
}
-void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) {
+void EnHorse_PlayIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) {
this->action = ENHORSE_ACTION_IDLE;
this->actor.speed = 0.0f;
- if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNY) && (anim != ENHORSE_ANIM_REARING)) {
- anim = ENHORSE_ANIM_IDLE;
+ if ((animIndex != ENHORSE_ANIM_IDLE) && (animIndex != ENHORSE_ANIM_WHINNY) && (animIndex != ENHORSE_ANIM_REARING)) {
+ animIndex = ENHORSE_ANIM_IDLE;
}
- if (sAnimationHeaders[this->type][anim] == NULL) {
- anim = ENHORSE_ANIM_IDLE;
+ if (sAnimationHeaders[this->type][animIndex] == NULL) {
+ animIndex = ENHORSE_ANIM_IDLE;
}
- if (anim != this->animIndex) {
- this->animIndex = anim;
- if (anim == ENHORSE_ANIM_IDLE) {
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
+ if (animIndex == ENHORSE_ANIM_IDLE) {
this->stateFlags &= ~ENHORSE_SANDDUST_SOUND;
} else {
if (this->animIndex == ENHORSE_ANIM_WHINNY) {
@@ -1942,8 +1966,8 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta
}
}
-void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames) {
- EnHorse_PlayIdleAnimation(this, anim, morphFrames, this->curFrame);
+void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames) {
+ EnHorse_PlayIdleAnimation(this, animIndex, morphFrames, this->curFrame);
}
void EnHorse_ResetIdleAnimation(EnHorse* this) {
@@ -1999,16 +2023,16 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) {
}
}
-void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) {
+void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) {
this->action = ENHORSE_ACTION_FOLLOW_PLAYER;
this->stateFlags &= ~ENHORSE_TURNING_TO_PLAYER;
- if ((anim != ENHORSE_ANIM_TROT) && (anim != ENHORSE_ANIM_GALLOP) && (anim != ENHORSE_ANIM_WALK)) {
- anim = ENHORSE_ANIM_WALK;
+ if ((animIndex != ENHORSE_ANIM_TROT) && (animIndex != ENHORSE_ANIM_GALLOP) && (animIndex != ENHORSE_ANIM_WALK)) {
+ animIndex = ENHORSE_ANIM_WALK;
}
- if (anim != this->animIndex) {
- this->animIndex = anim;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames,
Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE,
morphFrames);
@@ -2019,38 +2043,38 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32
}
void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) {
- s32 anim = ENHORSE_ANIM_WALK;
+ s32 animIndex = ENHORSE_ANIM_WALK;
f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
if (distToPlayer > 400.0f) {
- anim = ENHORSE_ANIM_GALLOP;
+ animIndex = ENHORSE_ANIM_GALLOP;
} else if (!(distToPlayer <= 300.0f) && (distToPlayer <= 400.0f)) {
- anim = ENHORSE_ANIM_TROT;
+ animIndex = ENHORSE_ANIM_TROT;
}
if (this->animIndex == ENHORSE_ANIM_GALLOP) {
if (distToPlayer > 400.0f) {
- anim = ENHORSE_ANIM_GALLOP;
+ animIndex = ENHORSE_ANIM_GALLOP;
} else {
- anim = ENHORSE_ANIM_TROT;
+ animIndex = ENHORSE_ANIM_TROT;
}
} else if (this->animIndex == ENHORSE_ANIM_TROT) {
if (distToPlayer > 400.0f) {
- anim = ENHORSE_ANIM_GALLOP;
+ animIndex = ENHORSE_ANIM_GALLOP;
} else if (distToPlayer < 300.0f) {
- anim = ENHORSE_ANIM_WALK;
+ animIndex = ENHORSE_ANIM_WALK;
} else {
- anim = ENHORSE_ANIM_TROT;
+ animIndex = ENHORSE_ANIM_TROT;
}
} else if (this->animIndex == ENHORSE_ANIM_WALK) {
if (distToPlayer > 300.0f) {
- anim = ENHORSE_ANIM_TROT;
+ animIndex = ENHORSE_ANIM_TROT;
} else {
- anim = ENHORSE_ANIM_WALK;
+ animIndex = ENHORSE_ANIM_WALK;
}
}
- EnHorse_StartMovingAnimation(this, anim, -3.0f, 0.0f);
+ EnHorse_StartMovingAnimation(this, animIndex, -3.0f, 0.0f);
}
void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) {
@@ -2155,7 +2179,7 @@ void EnHorse_InitIngoHorse(EnHorse* this) {
void EnHorse_SetIngoAnimation(s32 animIndex, f32 curFrame, s32 arg2, s16* animIndexOut) {
*animIndexOut = sIngoAnimIndices[animIndex];
- if (arg2 == ENIN_ANIM_1) {
+ if (arg2 == 1) {
if (animIndex == ENHORSE_ANIM_TROT) {
*animIndexOut = ENIN_ANIM_4;
} else if (animIndex == ENHORSE_ANIM_GALLOP) {
@@ -2286,7 +2310,7 @@ void func_80881290(EnHorse* this, PlayState* play) {
void func_80881398(EnHorse* this, PlayState* play) {
Vec3s* jointTable;
f32 y;
- s32 animeUpdated;
+ s32 isAnimFinished;
f32 curFrame;
this->stateFlags |= ENHORSE_JUMPING;
@@ -2294,7 +2318,7 @@ void func_80881398(EnHorse* this, PlayState* play) {
this->actor.speed = 14.0f;
}
- animeUpdated = SkelAnime_Update(&this->skin.skelAnime);
+ isAnimFinished = SkelAnime_Update(&this->skin.skelAnime);
curFrame = this->skin.skelAnime.curFrame;
if (curFrame > 23.0f) {
@@ -2313,8 +2337,8 @@ void func_80881398(EnHorse* this, PlayState* play) {
this->actor.world.pos.y = this->jumpStartY + (y * 0.01f * this->unk_528 * 0.01f);
}
- if (animeUpdated || ((curFrame > 17.0f) &&
- (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) {
+ if (isAnimFinished || ((curFrame > 17.0f) &&
+ (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) {
if (this->type == HORSE_TYPE_2) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND);
} else {
@@ -2467,10 +2491,10 @@ void func_808819D8(EnHorse* this, PlayState* play) {
}
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) {
- this->rider->unk488 = 7;
+ this->rider->animIndex2 = ENIN_ANIM2_7;
} else {
EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1,
- &this->rider->unk488);
+ &this->rider->animIndex2);
}
}
@@ -2962,7 +2986,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) {
f32 playerDistToHome;
f32 distToPlayer;
s32 nextAnimIndex = this->animIndex;
- s32 animFinished;
+ s32 isAnimFinished;
s16 yaw;
if (gHorsePlayedEponasSong || (this->type == HORSE_TYPE_HNI)) {
@@ -3041,7 +3065,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.world.rot.y;
}
- animFinished = SkelAnime_Update(&this->skin.skelAnime);
+ isAnimFinished = SkelAnime_Update(&this->skin.skelAnime);
if (((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) &&
((nextAnimIndex == ENHORSE_ANIM_GALLOP) || (nextAnimIndex == ENHORSE_ANIM_TROT) ||
@@ -3054,7 +3078,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) {
} else if (this->animIndex == ENHORSE_ANIM_TROT) {
func_8087C178(this);
}
- } else if (animFinished) {
+ } else if (isAnimFinished) {
if (nextAnimIndex == ENHORSE_ANIM_GALLOP) {
func_8087C1C0(this);
} else if (nextAnimIndex == ENHORSE_ANIM_TROT) {
@@ -3423,10 +3447,10 @@ void func_80884E0C(EnHorse* this, PlayState* play) {
this->unk_56C = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos);
if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) {
- this->rider->unk488 = 7;
+ this->rider->animIndex2 = ENIN_ANIM2_7;
} else {
EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1,
- &this->rider->unk488);
+ &this->rider->animIndex2);
}
pos = this->actor.world.pos;
@@ -3499,7 +3523,7 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType,
this->actor.world.pos = this->lastPos;
this->stateFlags |= ENHORSE_OBSTACLE;
if (this->playerControlled == 0) {
- if (this->animIndex != 3) {}
+ if (this->animIndex != ENHORSE_ANIM_REARING) {}
} else if (this->action != ENHORSE_ACTION_MOUNTED_REARING) {
if (this->stateFlags & ENHORSE_JUMPING) {
this->stateFlags &= ~ENHORSE_JUMPING;
diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h
index 75f0254fc..f3c868c85 100644
--- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h
+++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h
@@ -93,7 +93,8 @@ typedef enum EnHorseAnimation {
/* 5 */ ENHORSE_ANIM_TROT,
/* 6 */ ENHORSE_ANIM_GALLOP,
/* 7 */ ENHORSE_ANIM_LOW_JUMP,
- /* 8 */ ENHORSE_ANIM_HIGH_JUMP
+ /* 8 */ ENHORSE_ANIM_HIGH_JUMP,
+ /* 9 */ ENHORSE_ANIM_MAX
} EnHorseAnimation;
typedef enum HorseType {
@@ -101,7 +102,8 @@ typedef enum HorseType {
/* 1 */ HORSE_TYPE_HNI,
/* 2 */ HORSE_TYPE_2,
/* 3 */ HORSE_TYPE_BANDIT,
- /* 4 */ HORSE_TYPE_DONKEY // Cremia's donkey
+ /* 4 */ HORSE_TYPE_DONKEY, // Cremia's donkey
+ /* 5 */ HORSE_TYPE_MAX
} HorseType;
#define ENHORSE_PARAM_BANDIT 0x2000
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 bba55073b..78d6f8624 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
@@ -19,7 +19,7 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play);
void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play);
void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play);
-void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex);
+void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex);
void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this);
void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play);
@@ -51,7 +51,7 @@ typedef enum {
/* 5 */ OOT_CHILD_EPONA_ANIM_MAX
} OoTEponaAnimation;
-AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = {
+static AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = {
&gEponaIdleAnim, // OOT_CHILD_EPONA_ANIM_IDLE
&gEponaWhinnyAnim, // OOT_CHILD_EPONA_ANIM_WHINNY
&gEponaWalkAnim, // OOT_CHILD_EPONA_ANIM_WALK
@@ -221,7 +221,7 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) {
void EnHorseLinkChild_SetupActionFunc0(EnHorseLinkChild* this) {
this->action = OOT_CHILD_EPONA_ACTION_0;
this->animIndex++;
- if (this->animIndex >= ARRAY_COUNT(sAnimPlaySpeeds)) {
+ if (this->animIndex >= OOT_CHILD_EPONA_ANIM_MAX) {
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
}
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animIndex]);
@@ -238,16 +238,16 @@ void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play) {
}
}
-void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex) {
+void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex) {
this->action = OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER;
this->actor.speed = 0.0f;
- if ((nextAnimIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (nextAnimIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE;
+ if ((animIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (animIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) {
+ animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
}
- if (nextAnimIndex != this->animIndex) {
- this->animIndex = nextAnimIndex;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
}
@@ -258,7 +258,7 @@ void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimInd
*/
void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) {
f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
- s32 nextAnimIndex;
+ s32 animIndex;
if (SkelAnime_Update(&this->skin.skelAnime)) {
if ((distToPlayer < 1000.0f) && (distToPlayer > 70.0f)) {
@@ -267,13 +267,13 @@ void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) {
}
if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE;
+ animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
} else {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WHINNY;
+ animIndex = OOT_CHILD_EPONA_ANIM_WHINNY;
}
- if (nextAnimIndex != this->animIndex) {
- this->animIndex = nextAnimIndex;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
@@ -297,7 +297,7 @@ void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this) {
void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) {
f32 distToPlayer;
s16 yawTowardPlayerDiff;
- s32 nextAnimIndex;
+ s32 animIndex;
if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) {
@@ -321,13 +321,13 @@ void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) {
}
if ((distToPlayer < 1000.0f) && (distToPlayer >= 300.0f)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
+ animIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if ((distToPlayer < 300.0f) && (distToPlayer >= 150.0f)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
+ animIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if ((distToPlayer < 150.0f) && (distToPlayer >= 70.0f)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
+ animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
@@ -335,8 +335,8 @@ void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) {
return;
}
- if (nextAnimIndex != this->animIndex) {
- this->animIndex = nextAnimIndex;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
@@ -394,16 +394,16 @@ void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) {
Player* player;
f32 distToPlayer;
s32 isAnimFinished;
- s32 nextAnimIndex;
+ s32 animIndex;
func_808DF088(this, play);
player = GET_PLAYER(play);
distToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor);
- nextAnimIndex = this->animIndex;
+ animIndex = this->animIndex;
isAnimFinished = SkelAnime_Update(&this->skin.skelAnime);
- if ((isAnimFinished) || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) ||
+ if (isAnimFinished || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE)) {
//! @bug: The carry-over of this flag from OoT was not done correctly
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_ZORA_HALL)) {
@@ -412,55 +412,53 @@ void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) {
if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) > 250.0f) {
if (distToHome >= 300.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
+ animIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if ((distToHome < 300.0f) && (distToHome >= 150.0f)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
+ animIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if ((distToHome < 150.0f) && (distToHome >= 70.0f)) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
+ animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
this->actor.speed = 0.0f;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
- nextAnimIndex =
- (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
- nextAnimIndex =
- (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
} else if (distToPlayer < 200.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
+ animIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (distToPlayer < 300.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
+ animIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if (distToPlayer < 400.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
+ animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
this->actor.speed = 0.0f;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
- nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
- nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
} else {
this->actor.speed = 0.0f;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
- nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
- nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
+ animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
}
- if ((nextAnimIndex != this->animIndex) || (isAnimFinished == true)) {
- this->animIndex = nextAnimIndex;
+ if ((this->animIndex != animIndex) || (isAnimFinished == true)) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
@@ -526,7 +524,7 @@ void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this) {
void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 distToTargetPos;
- s32 nextAnimIndex;
+ s32 animIndex;
this->timer++;
if (this->timer > 300) {
@@ -551,24 +549,24 @@ void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) {
if (!this->isReturningHome) {
if (distToTargetPos >= 300.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
+ animIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (distToTargetPos >= 150.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
+ animIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
+ animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
}
} else if (distToTargetPos >= 300.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
+ animIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (distToTargetPos >= 150.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
+ animIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if (distToTargetPos >= 70.0f) {
- nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
+ animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
@@ -576,8 +574,8 @@ void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) {
return;
}
- if (nextAnimIndex != this->animIndex) {
- this->animIndex = nextAnimIndex;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c
index 5146f4fcd..b665b5d02 100644
--- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c
+++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c
@@ -110,7 +110,7 @@ void EnHs_UpdateChickPos(Vec3f* dst, Vec3f src, f32 offset) {
Math_Vec3f_Diff(&src, dst, &diff);
- distance = SQ(diff.x) + SQ(diff.z); // gets un-squared after we check if we are too close
+ distance = SQXZ(diff); // gets un-squared after we check if we are too close
if (SQ(offset) > distance) {
return;
@@ -176,20 +176,20 @@ void func_80953098(EnHs* this, PlayState* play) {
void func_80953180(EnHs* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
switch (play->msgCtx.currentTextId) {
- case 0x33F4: // text: laughing that they are all roosters (!)
- case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood
+ case 0x33F4: // laughing that they are all roosters (!)
+ case 0x33F6: // Grog regrets not being able to see his chicks reach adult hood
Message_CloseTextbox(play);
this->actionFunc = func_8095345C;
break;
- case 0x33F7: // text: notice his chicks are grown up, happy, wants to give you bunny hood
+ case 0x33F7: // notice his chicks are grown up, happy, wants to give you bunny hood
this->actor.flags &= ~ACTOR_FLAG_10000;
Message_CloseTextbox(play);
this->actionFunc = func_80953098;
func_80953098(this, play);
break;
- case 0x33F9: // text: laughing that they are all roosters (.)
+ case 0x33F9: // laughing that they are all roosters (.)
this->actor.flags &= ~ACTOR_FLAG_10000;
Message_CloseTextbox(play);
this->actionFunc = func_8095345C;
@@ -341,6 +341,9 @@ s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
return false;
}
break;
+
+ default:
+ break;
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
index bd90f48c1..3006c7bfe 100644
--- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c
+++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
@@ -6,7 +6,6 @@
#include "z_en_ig.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
-#include "objects/object_dai/object_dai.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@@ -143,17 +142,32 @@ static ColliderSphereInit sSphereInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
-static AnimationInfoS sAnimationInfo[] = {
- { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
- { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
+typedef enum EnIgAnimation {
+ /* -1 */ ENIG_ANIM_NONE = -1,
+ /* 0 */ ENIG_ANIM_0,
+ /* 1 */ ENIG_ANIM_1,
+ /* 2 */ ENIG_ANIM_2,
+ /* 3 */ ENIG_ANIM_3,
+ /* 4 */ ENIG_ANIM_4,
+ /* 5 */ ENIG_ANIM_5,
+ /* 6 */ ENIG_ANIM_6,
+ /* 7 */ ENIG_ANIM_7,
+ /* 8 */ ENIG_ANIM_8,
+ /* 9 */ ENIG_ANIM_9,
+ /* 10 */ ENIG_ANIM_MAX
+} EnIgAnimation;
+
+static AnimationInfoS sAnimationInfo[ENIG_ANIM_MAX] = {
+ { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_0
+ { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_1
+ { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_2
+ { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_3
+ { &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_4
+ { &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_5
+ { &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_6
+ { &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIG_ANIM_7
+ { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_8
+ { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_9
};
Actor* func_80BF1150(EnIg* this, PlayState* play, u8 actorCat, s16 actorId) {
@@ -204,44 +218,44 @@ EnDoor* func_80BF1200(PlayState* play, s32 arg1) {
return SubS_FindDoor(play, phi_a1);
}
-void func_80BF1258(EnIg* this) {
- this->skelAnime.playSpeed = this->unk_3D4;
+void EnIg_UpdateSkelAnime(EnIg* this) {
+ this->skelAnime.playSpeed = this->animPlaySpeed;
SkelAnime_Update(&this->skelAnime);
}
-s32 func_80BF1284(EnIg* this, s32 arg1) {
- s32 phi_v1 = false;
- s32 ret = false;
+s32 EnIg_ChangeAnim(EnIg* this, s32 animIndex) {
+ s32 changeAnim = false;
+ s32 didAnimChange = false;
- switch (arg1) {
- case 0:
- case 1:
- if ((this->unk_3FC != 0) && (this->unk_3FC != 1)) {
- phi_v1 = true;
+ switch (animIndex) {
+ case ENIG_ANIM_0:
+ case ENIG_ANIM_1:
+ if ((this->animIndex != ENIG_ANIM_0) && (this->animIndex != ENIG_ANIM_1)) {
+ changeAnim = true;
}
break;
- case 2:
- case 3:
- if ((this->unk_3FC != 2) && (this->unk_3FC != 3)) {
- phi_v1 = true;
+ case ENIG_ANIM_2:
+ case ENIG_ANIM_3:
+ if ((this->animIndex != ENIG_ANIM_2) && (this->animIndex != ENIG_ANIM_3)) {
+ changeAnim = true;
}
break;
default:
- if (arg1 != this->unk_3FC) {
- phi_v1 = true;
+ if (this->animIndex != animIndex) {
+ changeAnim = true;
}
break;
}
- if (phi_v1) {
- this->unk_3FC = arg1;
- ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1);
- this->unk_3D4 = this->skelAnime.playSpeed;
+ if (changeAnim) {
+ this->animIndex = animIndex;
+ didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
+ this->animPlaySpeed = this->skelAnime.playSpeed;
}
- return ret;
+ return didAnimChange;
}
void func_80BF1354(EnIg* this, PlayState* play) {
@@ -358,16 +372,18 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) {
switch (this->unk_3F6) {
case 0:
- if (func_80BF16C8(this, csId)) {
- case 2:
- case 4:
- if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) {
- Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)),
- this->actor.child);
- }
- this->unk_3F6++;
- ret = true;
+ if (!func_80BF16C8(this, csId)) {
+ break;
}
+ // fallthrough
+ case 2:
+ case 4:
+ if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) {
+ Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)),
+ this->actor.child);
+ }
+ this->unk_3F6++;
+ ret = true;
break;
case 1:
@@ -387,6 +403,9 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) {
this->unk_3F6++;
ret = true;
break;
+
+ default:
+ break;
}
return ret;
}
@@ -438,10 +457,10 @@ s32 func_80BF19A0(EnIg* this, PlayState* play) {
void func_80BF1A60(EnIg* this, PlayState* play) {
if (this->unk_3F4 == 0) {
- func_80BF1284(this, 4);
+ EnIg_ChangeAnim(this, ENIG_ANIM_4);
this->unk_3F4++;
} else if ((this->unk_3F4 == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
- func_80BF1284(this, 5);
+ EnIg_ChangeAnim(this, ENIG_ANIM_5);
this->unk_3F4++;
}
}
@@ -449,7 +468,7 @@ void func_80BF1A60(EnIg* this, PlayState* play) {
s32 func_80BF1AE0(EnIg* this, PlayState* play) {
switch (this->scheduleResult) {
case 3:
- func_80BF1284(this, 0);
+ EnIg_ChangeAnim(this, ENIG_ANIM_0);
break;
case 10:
@@ -457,7 +476,10 @@ s32 func_80BF1AE0(EnIg* this, PlayState* play) {
case 12:
case 13:
case 14:
- func_80BF1284(this, 2);
+ EnIg_ChangeAnim(this, ENIG_ANIM_2);
+ break;
+
+ default:
break;
}
return true;
@@ -471,8 +493,8 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) {
if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400 | PLAYER_STATE1_800)) {
this->unk_3D0 |= 0x400;
if (this->unk_3D2 != temp) {
- if ((this->unk_3FC == 2) || (this->unk_3FC == 3)) {
- func_80BF1284(this, 0);
+ if ((this->animIndex == ENIG_ANIM_2) || (this->animIndex == ENIG_ANIM_3)) {
+ EnIg_ChangeAnim(this, ENIG_ANIM_0);
}
if ((temp == 0x28B0) || (temp == 0x28B7)) {
@@ -484,7 +506,10 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) {
} else if (this->unk_3D0 & 0x400) {
this->unk_3D2 = 0;
this->unk_3D0 &= ~0x400;
+
+ //! FAKE:
if (1) {}
+
func_80BF1AE0(this, play);
}
@@ -529,7 +554,7 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 sp2C = 0;
if (func_80BF1C44(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) {
- func_80BF1284(this, 0);
+ EnIg_ChangeAnim(this, ENIG_ANIM_0);
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x20;
this->unk_3D0 |= 0x100;
@@ -575,7 +600,7 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3E2 = sp56 - scheduleOutput->time0;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->unk_3D0 |= 0x100;
- func_80BF1284(this, 3);
+ EnIg_ChangeAnim(this, ENIG_ANIM_3);
this->actor.gravity = 0.0f;
ret = true;
}
@@ -626,7 +651,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3D0 &= ~0x10;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
- func_80BF1284(this, 2);
+ EnIg_ChangeAnim(this, ENIG_ANIM_2);
this->actor.gravity = -1.0f;
ret = true;
}
@@ -662,7 +687,7 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.home.rot.y += 0x8000;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
- func_80BF1284(this, 1);
+ EnIg_ChangeAnim(this, ENIG_ANIM_1);
break;
case 4:
@@ -670,7 +695,10 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.shape.rot.y = this->actor.world.rot.y;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
- func_80BF1284(this, 8);
+ EnIg_ChangeAnim(this, ENIG_ANIM_8);
+ break;
+
+ default:
break;
}
ret = true;
@@ -710,6 +738,9 @@ s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
case 3:
ret = func_80BF1D78(this, play, scheduleOutput);
break;
+
+ default:
+ break;
}
return ret;
}
@@ -765,6 +796,7 @@ s32 func_80BF25E8(EnIg* this, PlayState* play) {
s32 pad;
SubS_TimePathing_FillKnots(knots, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER);
+
if (!(this->unk_3D0 & 8)) {
timePathTargetPos = gZeroVec3f;
SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime,
@@ -830,11 +862,11 @@ s32 func_80BF293C(EnIg* this, PlayState* play) {
Math_ApproachS(&this->actor.world.rot.y, this->actor.home.rot.y, 3, 0x2AA8);
} else {
this->actor.world.rot.y = this->actor.home.rot.y;
- func_80BF1284(this, 7);
+ EnIg_ChangeAnim(this, ENIG_ANIM_7);
}
- } else if ((this->unk_3FC == 7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ } else if ((this->animIndex == ENIG_ANIM_7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
- func_80BF1284(this, 9);
+ EnIg_ChangeAnim(this, ENIG_ANIM_9);
}
return true;
}
@@ -868,6 +900,9 @@ void func_80BF2A50(EnIg* this, PlayState* play) {
case 4:
func_80BF2890(this, play);
break;
+
+ default:
+ break;
}
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8);
}
@@ -916,9 +951,10 @@ void EnIg_Init(Actor* thisx, PlayState* play) {
EnIg* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19);
- this->unk_3FC = -1;
- func_80BF1284(this, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable,
+ OBJECT_DAI_LIMB_MAX);
+ this->animIndex = ENIG_ANIM_NONE;
+ EnIg_ChangeAnim(this, ENIG_ANIM_0);
Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit);
Collider_InitAndSetSphere(play, &this->collider2, &this->actor, &sSphereInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
@@ -946,7 +982,7 @@ void EnIg_Update(Actor* thisx, PlayState* play) {
func_80BF1B40(this, play);
if (this->scheduleResult != 0) {
- func_80BF1258(this);
+ EnIg_UpdateSkelAnime(this);
func_80BF13E4(this);
func_80BF15EC(this);
SubS_Offer(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk_3D0 & SUBS_OFFER_MODE_MASK);
@@ -960,7 +996,7 @@ s32 EnIg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
Gfx** gfx) {
EnIg* this = THIS;
- if (limbIndex == 10) {
+ if (limbIndex == OBJECT_DAI_LIMB_0A) {
*dList = NULL;
}
return false;
@@ -973,7 +1009,7 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnIg* this = THIS;
Vec3f sp2C;
- if (limbIndex == 11) {
+ if (limbIndex == OBJECT_DAI_LIMB_0B) {
Matrix_MultVec3f(&D_80BF3528, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
@@ -981,17 +1017,17 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
gSPDisplayList((*gfx)++, object_dai_DL_0087B8);
}
- if (limbIndex == 12) {
+ if (limbIndex == OBJECT_DAI_LIMB_0C) {
gSPDisplayList((*gfx)++, object_dai_DL_0089D8);
}
- if (limbIndex == 9) {
+ if (limbIndex == OBJECT_DAI_LIMB_09) {
gSPDisplayList((*gfx)++, object_dai_DL_008B00);
Matrix_MultVec3f(&D_80BF351C, &sp2C);
Math_Vec3f_ToVec3s(&this->collider2.dim.worldSphere.center, &sp2C);
}
- if (limbIndex == 10) {
+ if (limbIndex == OBJECT_DAI_LIMB_0A) {
Matrix_Get(&this->unk_190);
}
}
@@ -1013,7 +1049,7 @@ void EnIg_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx**
stepRot = false;
}
- if (limbIndex == 9) {
+ if (limbIndex == OBJECT_DAI_LIMB_09) {
SubS_UpdateLimb(this->unk_3E8 + 0x4000, this->unk_3EA + this->actor.shape.rot.y + 0x4000, &this->unk_2D4,
&this->unk_2E6, stepRot, overrideRot);
Matrix_Pop();
diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.h b/src/overlays/actors/ovl_En_Ig/z_en_ig.h
index 274338a11..71c7c509d 100644
--- a/src/overlays/actors/ovl_En_Ig/z_en_ig.h
+++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.h
@@ -2,6 +2,7 @@
#define Z_EN_IG_H
#include "global.h"
+#include "objects/object_dai/object_dai.h"
struct EnIg;
@@ -38,11 +39,11 @@ typedef struct EnIg {
/* 0x2D4 */ Vec3f unk_2D4;
/* 0x2E0 */ UNK_TYPE1 unk2E0[0x6];
/* 0x2E6 */ Vec3s unk_2E6;
- /* 0x2EC */ Vec3s jointTable[19];
- /* 0x35E */ Vec3s morphTable[19];
+ /* 0x2EC */ Vec3s jointTable[OBJECT_DAI_LIMB_MAX];
+ /* 0x35E */ Vec3s morphTable[OBJECT_DAI_LIMB_MAX];
/* 0x3D0 */ u16 unk_3D0;
/* 0x3D2 */ u16 unk_3D2;
- /* 0x3D4 */ f32 unk_3D4;
+ /* 0x3D4 */ f32 animPlaySpeed;
/* 0x3D8 */ UNK_TYPE1 unk3D8[0x8];
/* 0x3E0 */ s16 unk_3E0;
/* 0x3E2 */ s16 unk_3E2;
@@ -57,7 +58,7 @@ typedef struct EnIg {
/* 0x3F4 */ s16 unk_3F4;
/* 0x3F6 */ s16 unk_3F6;
/* 0x3F8 */ EnIgUnkFunc unk_3F8;
- /* 0x3FC */ s32 unk_3FC;
+ /* 0x3FC */ s32 animIndex;
/* 0x400 */ UNK_TYPE1 unk400[0x8];
/* 0x408 */ s32 unk_408;
} EnIg; // size = 0x40C
diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c
index 96ce3db8c..7f3ed6de4 100644
--- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c
+++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c
@@ -365,15 +365,15 @@ void EnIk_CheckActions(EnIk* this, PlayState* play) {
}
void EnIk_SetupIdle(EnIk* this) {
- f32 frameCount = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim);
+ f32 endFrame = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim);
if (this->drawArmorFlags != 0) {
this->timer = 10;
} else {
this->timer = 0;
}
- Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, frameCount, frameCount,
- ANIMMODE_ONCE, this->timer);
+ Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE,
+ this->timer);
this->actionFunc = EnIk_Idle;
this->actor.speed = 0.0f;
}
@@ -461,7 +461,7 @@ void EnIk_SetupVerticalAttack(EnIk* this) {
playbackSpeed = 1.2f;
}
Animation_Change(&this->skelAnime, &gIronKnuckleVerticalAttackAnim, playbackSpeed, 0.0f,
- Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), 3, -4.0f);
+ Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), ANIMMODE_ONCE_INTERP, -4.0f);
this->timer = 0;
this->blurEffectSpawnLock = -1;
this->actionFunc = EnIk_VerticalAttack;
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index 1c0fc091d..19fbd436e 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -118,25 +118,25 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
-static AnimationInfoS sAnimationInfo[] = {
- { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
- { &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
+static AnimationInfoS sAnimationInfo[ENIN_ANIM_MAX] = {
+ { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_0
+ { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_1
+ { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_2
+ { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_3
+ { &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_4
+ { &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_5
+ { &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_6
+ { &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_7
+ { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_8
+ { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_9
+ { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_10
+ { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_11
+ { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_12
+ { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_13
+ { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_14
+ { &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIN_ANIM_15
+ { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_16
+ { &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIN_ANIM_17
};
static TrackOptionsSet sTrackOptions = {
@@ -147,20 +147,20 @@ static TrackOptionsSet sTrackOptions = {
};
s32 EnIn_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
- s16 frameCount;
- s32 ret = false;
+ s16 endFrame;
+ s32 didAnimChange = false;
- if ((animIndex >= 0) && (animIndex < 18)) {
- ret = true;
- frameCount = sAnimationInfo[animIndex].frameCount;
- if (frameCount < 0) {
- frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation);
+ if ((animIndex > ENIN_ANIM_NONE) && (animIndex < ENIN_ANIM_MAX)) {
+ didAnimChange = true;
+ endFrame = sAnimationInfo[animIndex].frameCount;
+ if (endFrame < 0) {
+ endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation);
}
Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed,
- sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode,
+ sAnimationInfo[animIndex].startFrame, endFrame, sAnimationInfo[animIndex].mode,
sAnimationInfo[animIndex].morphFrames);
}
- return ret;
+ return didAnimChange;
}
s32 func_808F3178(EnIn* this, PlayState* play) {
@@ -298,12 +298,19 @@ void func_808F3690(EnIn* this, PlayState* play) {
}
void func_808F374C(EnIn* this, PlayState* play) {
- AnimationHeader* sAnimations[] = {
- &object_in_Anim_015E38, &object_in_Anim_016A60, &object_in_Anim_0177AC, &object_in_Anim_016484,
- &object_in_Anim_0170DC, &object_in_Anim_018240, &object_in_Anim_0187C8, &object_in_Anim_0198A8,
+ AnimationHeader* sAnimations[ENIN_ANIM2_MAX] = {
+ &object_in_Anim_015E38, // ENIN_ANIM2_0
+ &object_in_Anim_016A60, // ENIN_ANIM2_1
+ &object_in_Anim_0177AC, // ENIN_ANIM2_2
+ &object_in_Anim_016484, // ENIN_ANIM2_3
+ &object_in_Anim_0170DC, // ENIN_ANIM2_4
+ &object_in_Anim_018240, // ENIN_ANIM2_5
+ &object_in_Anim_0187C8, // ENIN_ANIM2_6
+ &object_in_Anim_0198A8, // ENIN_ANIM2_7
};
- if (this->skelAnime.animation == &object_in_Anim_016484 || this->skelAnime.animation == &object_in_Anim_0170DC) {
+ if ((this->skelAnime.animation == &object_in_Anim_016484) ||
+ (this->skelAnime.animation == &object_in_Anim_0170DC)) {
if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
Audio_PlaySfx_Randomized(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2);
if (Rand_ZeroOne() < 0.3f) {
@@ -312,14 +319,16 @@ void func_808F374C(EnIn* this, PlayState* play) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_IT_LASH);
}
}
- if (this->skelAnime.animation == &object_in_Anim_0198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) {
+
+ if ((this->skelAnime.animation == &object_in_Anim_0198A8) && Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_CRY_0);
}
+
if (SkelAnime_Update(&this->skelAnime)) {
- this->unk488 %= ARRAY_COUNT(sAnimations);
- this->unk486 = this->unk488;
- Animation_Change(&this->skelAnime, sAnimations[this->unk488], 1.0f, 0.0f,
- Animation_GetLastFrame(sAnimations[this->unk488]), ANIMMODE_ONCE, -10.0f);
+ this->animIndex2 %= ENIN_ANIM2_MAX;
+ this->unk486 = this->animIndex2;
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex2], 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimations[this->animIndex2]), ANIMMODE_ONCE, -10.0f);
}
}
@@ -407,7 +416,7 @@ void func_808F3B40(EnIn* this, PlayState* play) {
this->actor.parent = NULL;
this->actor.flags |= ACTOR_FLAG_10000;
this->actionFunc = func_808F3AD4;
- textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4;
+ textId = (gSaveContext.save.day != 3) ? 0x3481 : 0x34A4;
this->actor.textId = textId;
} else {
Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f);
@@ -958,6 +967,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
ret = false;
}
break;
+
case 0x347E:
func_808F35D8(this, play);
if (Inventory_HasEmptyBottle()) {
@@ -1430,7 +1440,7 @@ void func_808F5A94(EnIn* this, PlayState* play) {
void func_808F5B58(EnIn* this, PlayState* play) {
if (Horse_IsActive(play, &play->actorCtx)) {
- if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
+ if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) {
if (gSaveContext.save.day == 3) {
func_808F5728(play, this, 6, &this->unk48C);
@@ -1438,8 +1448,8 @@ void func_808F5B58(EnIn* this, PlayState* play) {
func_808F5728(play, this, 2, &this->unk48C);
}
}
- } else if (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER ||
- (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) {
+ } else if ((Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER) ||
+ ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) {
if (gSaveContext.save.day == 3) {
func_808F5728(play, this, 4, &this->unk48C);
} else {
@@ -1452,7 +1462,7 @@ void func_808F5C98(EnIn* this, PlayState* play) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_END) {
this->actionFunc = func_808F5B58;
}
- if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
+ if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) {
if (gSaveContext.save.day != 3) {
func_808F5728(play, this, 2, &this->unk48C);
@@ -1484,7 +1494,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, 20);
+ SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable,
+ OBJECT_IN_LIMB_MAX);
EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0);
Collider_InitCylinder(play, &this->colliderCylinder);
Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit);
@@ -1499,7 +1510,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
}
if ((type == ENIN_HORSE_RIDER_YELLOW_SHIRT) || (type == ENIN_HORSE_RIDER_BLUE_SHIRT)) {
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
- this->unk488 = 1;
+ this->animIndex2 = ENIN_ANIM2_1;
Animation_Change(&this->skelAnime, &object_in_Anim_016A60, 1.0f, 0.0f,
Animation_GetLastFrame(&object_in_Anim_016A60), ANIMMODE_ONCE, 0.0f);
Actor_SetScale(&this->actor, 0.01f);
@@ -1623,41 +1634,41 @@ void func_808F6334(EnIn* this, PlayState* play) {
s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnIn* this = THIS;
s32 pad;
- Gfx* sp50[] = {
- NULL,
- NULL,
- object_in_DL_0149A8,
- object_in_DL_014AE0,
- object_in_DL_014C30,
- object_in_DL_0145D8,
- object_in_DL_014710,
- object_in_DL_014860,
- object_in_DL_014420,
- object_in_DL_012A78,
- object_in_DL_013DE0,
- object_in_DL_013F10,
- object_in_DL_014040,
- object_in_DL_0137A0,
- object_in_DL_0138D0,
- object_in_DL_013A00,
- object_in_DL_012DF8,
- object_in_DL_013670,
- object_in_DL_013540,
- object_in_DL_013440,
+ Gfx* sp50[OBJECT_IN_LIMB_MAX] = {
+ NULL, // OBJECT_IN_LIMB_NONE
+ NULL, // OBJECT_IN_LIMB_01
+ object_in_DL_0149A8, // OBJECT_IN_LIMB_02
+ object_in_DL_014AE0, // OBJECT_IN_LIMB_03
+ object_in_DL_014C30, // OBJECT_IN_LIMB_04
+ object_in_DL_0145D8, // OBJECT_IN_LIMB_05
+ object_in_DL_014710, // OBJECT_IN_LIMB_06
+ object_in_DL_014860, // OBJECT_IN_LIMB_07
+ object_in_DL_014420, // OBJECT_IN_LIMB_08
+ object_in_DL_012A78, // OBJECT_IN_LIMB_09
+ object_in_DL_013DE0, // OBJECT_IN_LIMB_0A
+ object_in_DL_013F10, // OBJECT_IN_LIMB_0B
+ object_in_DL_014040, // OBJECT_IN_LIMB_0C
+ object_in_DL_0137A0, // OBJECT_IN_LIMB_0D
+ object_in_DL_0138D0, // OBJECT_IN_LIMB_0E
+ object_in_DL_013A00, // OBJECT_IN_LIMB_0F
+ object_in_DL_012DF8, // OBJECT_IN_LIMB_10
+ object_in_DL_013670, // OBJECT_IN_LIMB_11
+ object_in_DL_013540, // OBJECT_IN_LIMB_12
+ object_in_DL_013440, // OBJECT_IN_LIMB_13
};
- if ((this->unk23C != 0) && (limbIndex != 16)) {
+ if ((this->unk23C != 0) && (limbIndex != OBJECT_IN_LIMB_10)) {
if (sp50[limbIndex] != NULL) {
*dList = sp50[limbIndex];
}
}
- if ((this->unk4AC & 4) && (limbIndex == 16)) {
+ if ((this->unk4AC & 4) && (limbIndex == OBJECT_IN_LIMB_10)) {
*dList = object_in_DL_01C528;
}
OPEN_DISPS(play->state.gfxCtx);
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_IN_LIMB_10) {
TexturePtr sp38[] = { object_in_Tex_0035E0, object_in_Tex_004820, object_in_Tex_004C20, object_in_Tex_0043E0 };
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp38[this->unk482]));
@@ -1668,31 +1679,34 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
CLOSE_DISPS(play->state.gfxCtx);
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_IN_LIMB_10) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
func_808F6334(this, play);
}
- if (limbIndex == 9) {
+
+ if (limbIndex == OBJECT_IN_LIMB_09) {
Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY);
Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY);
}
- if ((limbIndex == 9) || (limbIndex == 10) || (limbIndex == 13)) {
+
+ if ((limbIndex == OBJECT_IN_LIMB_09) || (limbIndex == OBJECT_IN_LIMB_0A) || (limbIndex == OBJECT_IN_LIMB_0D)) {
rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
+
if (this->unk4AC & 0x40) {
- if (limbIndex == 18) {
+ if (limbIndex == OBJECT_IN_LIMB_12) {
rot->x = 0x1F40;
rot->y = -0x3E8;
rot->z = 0x1D4C;
- } else if (limbIndex == 17) {
+ } else if (limbIndex == OBJECT_IN_LIMB_11) {
rot->x = -0x1F40;
rot->y = 0x3E8;
rot->z = 0x1D4C;
- } else if (limbIndex == 19) {
+ } else if (limbIndex == OBJECT_IN_LIMB_13) {
rot->x = 0;
rot->y = 0x7FFF;
rot->z = -0x2328;
@@ -1706,26 +1720,26 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp50 = { 1600.0f, 0.0f, 0.0f };
Vec3f sp44 = { 0.0f, 0.0f, 0.0f };
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_IN_LIMB_10) {
Matrix_MultVec3f(&sp50, &this->unk4B4);
Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk4B4);
}
if (this->unk23D == 0) {
Collider_UpdateSpheres(limbIndex, &this->colliderJntSph);
- if (limbIndex == 4) {
+ if (limbIndex == OBJECT_IN_LIMB_04) {
Matrix_MultVec3f(&sp44, &this->unk248);
}
- if (limbIndex == 7) {
+ if (limbIndex == OBJECT_IN_LIMB_07) {
Matrix_MultVec3f(&sp44, &this->unk254);
}
if (this->unk23C == 0) {
if (!(this->unk4AC & 8)) {
OPEN_DISPS(play->state.gfxCtx);
- if (limbIndex == 12) {
+ if (limbIndex == OBJECT_IN_LIMB_0C) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007A70);
}
- if (limbIndex == 15) {
+ if (limbIndex == OBJECT_IN_LIMB_0F) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48);
}
@@ -1736,7 +1750,7 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
if (this->unk4AC & 0x20) {
OPEN_DISPS(play->state.gfxCtx);
- if (limbIndex == 12) {
+ if (limbIndex == OBJECT_IN_LIMB_0C) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48);
}
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h
index c4833568c..ab774606a 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.h
+++ b/src/overlays/actors/ovl_En_In/z_en_in.h
@@ -16,7 +16,13 @@ typedef enum {
/* 4 */ ENIN_BLUE_SHIRT
} EnInType;
-typedef enum {
+#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF)
+#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE
+
+#define ENIN_PATH_INDEX_NONE 0x3F
+
+typedef enum EnInAnimation {
+ /* -1 */ ENIN_ANIM_NONE = -1,
/* 0 */ ENIN_ANIM_0,
/* 1 */ ENIN_ANIM_1,
/* 2 */ ENIN_ANIM_2,
@@ -34,13 +40,22 @@ typedef enum {
/* 14 */ ENIN_ANIM_14,
/* 15 */ ENIN_ANIM_15,
/* 16 */ ENIN_ANIM_16,
- /* 17 */ ENIN_ANIM_17
+ /* 17 */ ENIN_ANIM_17,
+ /* 18 */ ENIN_ANIM_MAX
} EnInAnimation;
-#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF)
-#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE
-
-#define ENIN_PATH_INDEX_NONE 0x3F
+typedef enum EnInAnimation2 {
+ /* -1 */ ENIN_ANIM2_NONE = -1,
+ /* 0 */ ENIN_ANIM2_0,
+ /* 1 */ ENIN_ANIM2_1,
+ /* 2 */ ENIN_ANIM2_2,
+ /* 3 */ ENIN_ANIM2_3,
+ /* 4 */ ENIN_ANIM2_4,
+ /* 5 */ ENIN_ANIM2_5,
+ /* 6 */ ENIN_ANIM2_6,
+ /* 7 */ ENIN_ANIM2_7,
+ /* 8 */ ENIN_ANIM2_MAX
+} EnInAnimation2;
typedef struct EnIn {
/* 0x000 */ Actor actor;
@@ -70,7 +85,7 @@ typedef struct EnIn {
/* 0x482 */ s16 unk482;
/* 0x484 */ s16 unk484;
/* 0x486 */ s16 unk486;
- /* 0x488 */ s16 unk488;
+ /* 0x488 */ s16 animIndex2;
/* 0x48A */ u16 unk48A;
/* 0x48C */ s32 unk48C;
/* 0x490 */ UNK_TYPE1 unk490[0x4];
diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c
index 6a51e9486..9d8667f0a 100644
--- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c
+++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c
@@ -5,7 +5,6 @@
*/
#include "z_en_insect.h"
-#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS 0x00000000
@@ -132,7 +131,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play) {
func_8091A8A0(this);
SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable,
- this->morphTable, 24);
+ this->morphTable, BUG_LIMB_MAX);
Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements);
@@ -278,7 +277,9 @@ void func_8091B07C(EnInsect* this, PlayState* play) {
yaw -= 0x2000;
}
+ //! FAKE:
if (play) {}
+
Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 0x7D0);
}
diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h
index 4e1f5b762..4fd2985f1 100644
--- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h
+++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h
@@ -2,6 +2,7 @@
#define Z_EN_INSECT_H
#include "global.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
struct EnInsect;
@@ -16,8 +17,8 @@ typedef struct EnInsect {
/* 0x144 */ ColliderJntSph collider;
/* 0x164 */ ColliderJntSphElement colliderElements[1];
/* 0x1A4 */ SkelAnime skelAnime;
- /* 0x1E8 */ Vec3s jointTable[24];
- /* 0x278 */ Vec3s morphTable[24];
+ /* 0x1E8 */ Vec3s jointTable[BUG_LIMB_MAX];
+ /* 0x278 */ Vec3s morphTable[BUG_LIMB_MAX];
/* 0x308 */ EnInsectActionFunc actionFunc;
/* 0x30C */ u16 unk_30C;
/* 0x30E */ s16 unk_30E;
diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c
index ef64e3954..3a6c54983 100644
--- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c
+++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c
@@ -75,6 +75,9 @@ void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_GET_RUPY);
Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED);
break;
+
+ default:
+ break;
}
if (this->unk_190 >= 0) {
diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
index 8cf9ce0e9..6bf6b4434 100644
--- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c
+++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
@@ -5,7 +5,6 @@
*/
#include "z_en_ja.h"
-#include "objects/object_boj/object_boj.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@@ -89,27 +88,41 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
-static AnimationInfoS sAnimationInfo[] = {
- { &object_boj_Anim_002734, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, 0 },
- { &object_boj_Anim_002734, 1.0f, 0, -1, 0, -4 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, -4 },
- { &object_boj_Anim_004078, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_005CE4, 1.0f, 0, -1, 0, 0 },
+typedef enum EnJaAnimation {
+ /* -1 */ ENJA_ANIM_NONE = -1,
+ /* 0 */ ENJA_ANIM_0,
+ /* 1 */ ENJA_ANIM_1,
+ /* 2 */ ENJA_ANIM_2,
+ /* 3 */ ENJA_ANIM_3,
+ /* 4 */ ENJA_ANIM_4,
+ /* 5 */ ENJA_ANIM_5,
+ /* 6 */ ENJA_ANIM_MAX
+} EnJaAnimation;
+
+static AnimationInfoS sAnimationInfo[ENJA_ANIM_MAX] = {
+ { &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_0
+ { &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_1
+ { &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_2
+ { &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_3
+ { &object_boj_Anim_004078, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_4
+ { &object_boj_Anim_005CE4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_5
};
-void func_80BC1900(EnJa* this) {
- this->skelAnime.playSpeed = this->unk_344;
+void EnJa_UpdateSkelAnime(EnJa* this) {
+ this->skelAnime.playSpeed = this->animPlaySpeed;
SkelAnime_Update(&this->skelAnime);
}
-s32 func_80BC192C(EnJa* this, s32 arg1) {
- s32 ret = false;
+s32 EnJa_ChangeAnim(EnJa* this, s32 animIndex) {
+ s32 didAnimChange = false;
- if (arg1 != this->unk_36C) {
- this->unk_36C = arg1;
- ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1);
- this->unk_344 = this->skelAnime.playSpeed;
+ if (this->animIndex != animIndex) {
+ this->animIndex = animIndex;
+ didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
+ this->animPlaySpeed = this->skelAnime.playSpeed;
}
- return ret;
+ return didAnimChange;
}
void func_80BC1984(EnJa* this, PlayState* play) {
@@ -246,7 +259,7 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (func_80BC1AE0(this, play)) {
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_340 |= 0x10;
- func_80BC192C(this, 5);
+ EnJa_ChangeAnim(this, ENJA_ANIM_5);
func_80BC2EA4(this);
ret = true;
}
@@ -258,9 +271,9 @@ s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (func_80BC1AE0(this, play)) {
if (ENJA_GET_3(&this->actor) == 0) {
- func_80BC192C(this, 1);
+ EnJa_ChangeAnim(this, ENJA_ANIM_1);
} else {
- func_80BC192C(this, 4);
+ EnJa_ChangeAnim(this, ENJA_ANIM_4);
}
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->actor.shape.shadowDraw = NULL;
@@ -284,6 +297,9 @@ s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
case 2:
ret = func_80BC203C(this, play, scheduleOutput);
break;
+
+ default:
+ break;
}
return ret;
}
@@ -329,8 +345,10 @@ s32* func_80BC2274(EnJa* this, PlayState* play) {
return D_80BC362C;
}
return D_80BC366C;
+
+ default:
+ return D_80BC360C;
}
- return D_80BC360C;
}
void func_80BC22F4(EnJa* this, PlayState* play) {
@@ -348,9 +366,10 @@ void EnJa_Init(Actor* thisx, PlayState* play) {
EnJa* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, 16);
- this->unk_36C = -1;
- func_80BC192C(this, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable,
+ OBJECT_BOJ_LIMB_MAX);
+ this->animIndex = ENJA_ANIM_NONE;
+ EnJa_ChangeAnim(this, ENJA_ANIM_0);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
Actor_SetScale(&this->actor, 0.01f);
@@ -380,7 +399,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->unk_1D8.unk_00 != 0) {
- func_80BC1900(this);
+ EnJa_UpdateSkelAnime(this);
func_80BC1A68(this);
func_80BC1D70(this, play);
@@ -403,7 +422,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) {
s32 EnJa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnJa* this = THIS;
- if (limbIndex == 15) {
+ if (limbIndex == OBJECT_BOJ_LIMB_0F) {
func_80BC1E40(this, play);
}
return false;
@@ -419,10 +438,10 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnJa* this = THIS;
s32 pad2;
- if (limbIndex == 15) {
+ if (limbIndex == OBJECT_BOJ_LIMB_0F) {
Matrix_MultVec3f(&D_80BC3780, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
- } else if ((this->unk_340 & 0x40) && (limbIndex == 11)) {
+ } else if ((this->unk_340 & 0x40) && (limbIndex == OBJECT_BOJ_LIMB_0B)) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@@ -437,8 +456,9 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
}
if (this->unk_1D8.unk_00 == 1) {
- if ((limbIndex == 11) && (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) ||
- ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) {
+ if ((limbIndex == OBJECT_BOJ_LIMB_0B) &&
+ (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) ||
+ ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@@ -475,7 +495,7 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx);
- } else if (limbIndex == 14) {
+ } else if (limbIndex == OBJECT_BOJ_LIMB_0E) {
if ((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 18.0f)) {
OPEN_DISPS(play->state.gfxCtx);
@@ -541,8 +561,8 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
overrideRot = false;
}
- if (limbIndex != 8) {
- if (limbIndex == 15) {
+ switch (limbIndex) {
+ case OBJECT_BOJ_LIMB_0F:
SubS_UpdateLimb(this->unk_354 + this->unk_358 + 0x4000,
this->unk_356 + this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1EC,
&this->unk_274, stepRot, overrideRot);
@@ -553,17 +573,22 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_RotateXS(this->unk_274.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_274.z, MTXMODE_APPLY);
Matrix_Push();
- }
- } else {
- SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
- &this->unk_27A, stepRot, overrideRot);
- Matrix_Pop();
- Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW);
- Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY);
- Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY);
- Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY);
- Matrix_Push();
+ break;
+
+ case OBJECT_BOJ_LIMB_08:
+ SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
+ &this->unk_27A, stepRot, overrideRot);
+ Matrix_Pop();
+ Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW);
+ Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
+ Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY);
+ Matrix_Push();
+ break;
+
+ default:
+ break;
}
}
diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.h b/src/overlays/actors/ovl_En_Ja/z_en_ja.h
index 00746ec63..fcbbf485f 100644
--- a/src/overlays/actors/ovl_En_Ja/z_en_ja.h
+++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.h
@@ -2,6 +2,7 @@
#define Z_EN_JA_H
#include "global.h"
+#include "objects/object_boj/object_boj.h"
struct EnJa;
@@ -37,10 +38,10 @@ typedef struct EnJa {
/* 0x234 */ EnJaStruct unk_234[4];
/* 0x274 */ Vec3s unk_274;
/* 0x27A */ Vec3s unk_27A;
- /* 0x280 */ Vec3s jointTable[16];
- /* 0x2E0 */ Vec3s morphTable[16];
+ /* 0x280 */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX];
+ /* 0x2E0 */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX];
/* 0x340 */ u16 unk_340;
- /* 0x344 */ f32 unk_344;
+ /* 0x344 */ f32 animPlaySpeed;
/* 0x348 */ f32 unk_348;
/* 0x34C */ f32 unk_34C;
/* 0x350 */ UNK_TYPE1 unk350[0x4];
@@ -55,7 +56,7 @@ typedef struct EnJa {
/* 0x364 */ s16 unk_364;
/* 0x366 */ s16 unk_366;
/* 0x368 */ void* unk_368;
- /* 0x36C */ s32 unk_36C;
+ /* 0x36C */ s32 animIndex;
/* 0x370 */ UNK_TYPE1 unk_370[4];
/* 0x374 */ s32 prevTalkState;
} EnJa; // size = 0x378
diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
index 314e94d1b..c66c9a355 100644
--- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
+++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
@@ -122,7 +122,7 @@ void EnJcMato_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
Collider_InitSphere(play, &this->collider);
Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit);
- this->collider.dim.worldSphere.radius = 0xF;
+ this->collider.dim.worldSphere.radius = 15;
this->actor.colChkInfo.damageTable = &sDamageTable;
Actor_SetScale(&this->actor, 0.008f);
this->hitFlag = false;
diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c
index 7e30676e2..137799af3 100644
--- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c
+++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c
@@ -34,29 +34,6 @@ s32 EnJg_GetNextTextId(EnJg* this);
s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play);
void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play);
-typedef enum {
- /* 0 */ EN_JG_ANIM_IDLE,
- /* 1 */ EN_JG_ANIM_WALK,
- /* 2 */ EN_JG_ANIM_WAVING,
- /* 3 */ EN_JG_ANIM_SHAKING_HEAD,
- /* 4 */ EN_JG_ANIM_SURPRISE_START,
- /* 5 */ EN_JG_ANIM_SURPRISE_LOOP,
- /* 6 */ EN_JG_ANIM_ANGRY,
- /* 7 */ EN_JG_ANIM_FROZEN_START,
- /* 8 */ EN_JG_ANIM_FROZEN_LOOP,
- /* 9 */ EN_JG_ANIM_WALK_2,
- /* 10 */ EN_JG_ANIM_TAKING_OUT_DRUM,
- /* 11 */ EN_JG_ANIM_DRUM_IDLE,
- /* 12 */ EN_JG_ANIM_PLAYING_DRUM,
- /* 13 */ EN_JG_ANIM_THINKING,
- /* 14 */ EN_JG_ANIM_REMEMBERING,
- /* 15 */ EN_JG_ANIM_STRONG_REMEMBERING,
- /* 16 */ EN_JG_ANIM_DEPRESSED,
- /* 17 */ EN_JG_ANIM_CUTSCENE_IDLE,
- /* 18 */ EN_JG_ANIM_CRADLE,
- /* 19 */ EN_JG_ANIM_MAX
-} EnJgAnimation;
-
typedef enum {
/* 0 */ EN_JG_ACTION_FIRST_THAW,
/* 1 */ EN_JG_ACTION_SPAWNING,
@@ -133,26 +110,49 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
-static AnimationInfoS sAnimationInfo[] = {
- { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 },
- { &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 },
- { &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 },
- { &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+typedef enum EnJgAnimation {
+ /* 0 */ EN_JG_ANIM_IDLE,
+ /* 1 */ EN_JG_ANIM_WALK,
+ /* 2 */ EN_JG_ANIM_WAVING,
+ /* 3 */ EN_JG_ANIM_SHAKING_HEAD,
+ /* 4 */ EN_JG_ANIM_SURPRISE_START,
+ /* 5 */ EN_JG_ANIM_SURPRISE_LOOP,
+ /* 6 */ EN_JG_ANIM_ANGRY,
+ /* 7 */ EN_JG_ANIM_FROZEN_START,
+ /* 8 */ EN_JG_ANIM_FROZEN_LOOP,
+ /* 9 */ EN_JG_ANIM_WALK_2,
+ /* 10 */ EN_JG_ANIM_TAKING_OUT_DRUM,
+ /* 11 */ EN_JG_ANIM_DRUM_IDLE,
+ /* 12 */ EN_JG_ANIM_PLAYING_DRUM,
+ /* 13 */ EN_JG_ANIM_THINKING,
+ /* 14 */ EN_JG_ANIM_REMEMBERING,
+ /* 15 */ EN_JG_ANIM_STRONG_REMEMBERING,
+ /* 16 */ EN_JG_ANIM_DEPRESSED,
+ /* 17 */ EN_JG_ANIM_CUTSCENE_IDLE,
+ /* 18 */ EN_JG_ANIM_CRADLE,
+ /* 19 */ EN_JG_ANIM_MAX
+} EnJgAnimation;
+
+static AnimationInfoS sAnimationInfo[EN_JG_ANIM_MAX] = {
+ { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_IDLE
+ { &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK
+ { &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WAVING
+ { &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SHAKING_HEAD
+ { &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 }, // EN_JG_ANIM_SURPRISE_START
+ { &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SURPRISE_LOOP
+ { &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_ANGRY
+ { &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_START
+ { &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_LOOP
+ { &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK_2
+ { &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_TAKING_OUT_DRUM
+ { &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DRUM_IDLE
+ { &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_PLAYING_DRUM
+ { &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_THINKING
+ { &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_REMEMBERING
+ { &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_STRONG_REMEMBERING
+ { &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DEPRESSED
+ { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CUTSCENE_IDLE
+ { &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CRADLE
};
static Vec3f sSfxPos = { 0.0f, 0.0f, 0.0f };
@@ -340,6 +340,9 @@ void EnJg_SetupTalk(EnJg* this, PlayState* play) {
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
this->actionFunc = EnJg_Talk;
break;
+
+ default:
+ break;
}
}
@@ -417,11 +420,11 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) {
*/
void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- s16 currentFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->animIndex == EN_JG_ANIM_SURPRISE_START) {
- if (currentFrame == lastFrame) {
+ if (curFrame == endFrame) {
this->animIndex = EN_JG_ANIM_SURPRISE_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
@@ -472,11 +475,11 @@ void EnJg_Walk(EnJg* this, PlayState* play) {
void EnJg_Talk(EnJg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- s16 currentFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
u16 temp;
- if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (currentFrame == lastFrame)) {
+ if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (curFrame == endFrame)) {
this->animIndex = EN_JG_ANIM_SURPRISE_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
@@ -542,13 +545,13 @@ void EnJg_SetupWalk(EnJg* this, PlayState* play) {
}
void EnJg_Freeze(EnJg* this, PlayState* play) {
- s16 currentFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->action == EN_JG_ACTION_SPAWNING) {
this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW;
this->freezeTimer = 1000;
- this->skelAnime.curFrame = lastFrame;
+ this->skelAnime.curFrame = endFrame;
this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x,
this->actor.world.rot.y, this->actor.world.rot.z, 0xFF50);
@@ -557,7 +560,7 @@ void EnJg_Freeze(EnJg* this, PlayState* play) {
this->actionFunc = EnJg_FrozenIdle;
} else if (this->animIndex == EN_JG_ANIM_FROZEN_START) {
this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW;
- if (currentFrame == lastFrame) {
+ if (curFrame == endFrame) {
this->freezeTimer = 1000;
this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x,
@@ -898,8 +901,8 @@ void EnJg_SpawnBreath(EnJg* this, PlayState* play) {
* handing it off to EnJg_Freeze.
*/
void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) {
- s16 currentFrame = this->skelAnime.curFrame;
- s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->flags |= FLAG_LOOKING_AT_PLAYER;
@@ -924,7 +927,7 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play
}
this->freezeTimer--;
- if ((this->freezeTimer <= 0) && (currentFrame == lastFrame)) {
+ if ((this->freezeTimer <= 0) && (curFrame == endFrame)) {
this->animIndex = EN_JG_ANIM_FROZEN_START;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_FREEZE_S);
diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
index 013fb5050..aba7cdeeb 100644
--- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
+++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
@@ -48,10 +48,18 @@ ActorInit En_Jgame_Tsn_InitVars = {
(ActorFunc)EnJgameTsn_Draw,
};
-static AnimationInfo sAnimationInfo[] = {
- { &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
- { &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
- { &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
+typedef enum EnJgameTsnAnimation {
+ /* -1 */ ENJGAMETSN_ANIM_NONE = -1,
+ /* 0 */ ENJGAMETSN_ANIM_0,
+ /* 1 */ ENJGAMETSN_ANIM_1,
+ /* 2 */ ENJGAMETSN_ANIM_2,
+ /* 3 */ ENJGAMETSN_ANIM_MAX
+} EnJgameTsnAnimation;
+
+static AnimationInfo sAnimationInfo[ENJGAMETSN_ANIM_MAX] = {
+ { &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_0
+ { &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_1
+ { &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_2
};
static ColliderCylinderInit sCylinderInit = {
@@ -145,7 +153,7 @@ void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) {
}
void func_80C13B74(EnJgameTsn* this) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0);
this->actionFunc = func_80C13BB8;
}
@@ -156,15 +164,15 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) {
if (this->actor.flags & ACTOR_FLAG_10000) {
this->actor.flags &= ~ACTOR_FLAG_10000;
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x10A2, &this->actor);
this->unk_300 = 0x10A2;
} else if (gSaveContext.minigameScore < 20) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x10A2, &this->actor);
this->unk_300 = 0x10A2;
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x10A3, &this->actor);
this->unk_300 = 0x10A3;
}
@@ -174,11 +182,11 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) {
this->unk_300 = 0x1094;
} else if (this->unk_2F8 == 0) {
this->unk_2F8 = 1;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1095, &this->actor);
this->unk_300 = 0x1095;
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1096, &this->actor);
this->unk_300 = 0x1096;
}
@@ -211,11 +219,11 @@ void func_80C13E90(EnJgameTsn* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_10000;
if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) ||
((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x1094, &this->actor);
this->unk_300 = 0x1094;
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1098, &this->actor);
this->unk_300 = 0x1098;
}
@@ -273,6 +281,9 @@ void func_80C14044(EnJgameTsn* this, PlayState* play) {
func_80C13B74(this);
}
break;
+
+ default:
+ break;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x71C, 0xB6);
@@ -335,7 +346,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) {
this->unk_2FC++;
if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && func_80C149B0(play, &this->unk_200)) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109F, &this->actor);
this->unk_300 = 0x109F;
player->stateFlags1 |= PLAYER_STATE1_20;
@@ -344,7 +355,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) {
func_80C14030(this);
} else if ((player->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) ||
(player->actor.bgCheckFlags & BGCHECKFLAG_WATER)) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x10A0, &this->actor);
this->unk_300 = 0x10A0;
player->stateFlags1 |= PLAYER_STATE1_20;
@@ -413,12 +424,12 @@ void func_80C14684(EnJgameTsn* this, PlayState* play) {
this->unk_300 = 0x109E;
Rupees_ChangeBy(-20);
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109D, &this->actor);
this->unk_300 = 0x109D;
}
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109C, &this->actor);
this->unk_300 = 0x109C;
}
@@ -461,7 +472,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) {
break;
case 0x109A:
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0);
Message_StartTextbox(play, 0x109B, &this->actor);
this->unk_300 = 0x109B;
break;
@@ -490,6 +501,9 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) {
func_80C14540(this);
func_80C14554(this, play);
break;
+
+ default:
+ break;
}
}
}
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 c0f5bc3fd..7d5185935 100644
--- a/src/overlays/actors/ovl_En_Js/z_en_js.c
+++ b/src/overlays/actors/ovl_En_Js/z_en_js.c
@@ -117,6 +117,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_84_20);
}
break;
+
case 1:
case 2:
case 3:
@@ -130,6 +131,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
return;
}
break;
+
case 5:
case 6:
case 7:
@@ -137,6 +139,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
this->maskType = ENJS_GET_TYPE(&this->actor) - 4;
this->actionFunc = func_8096A104;
break;
+
default:
break;
}
@@ -153,6 +156,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
case 0:
Play_DisableMotionBlur();
break;
+
case 5:
case 6:
case 7:
@@ -161,6 +165,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
func_80969400(ENJS_GET_TYPE(&this->actor));
}
break;
+
default:
break;
}
@@ -414,6 +419,7 @@ s32 func_809692A8(s32 arg0) {
return false;
}
return true;
+
case 5:
case 6:
case 7:
@@ -422,6 +428,7 @@ s32 func_809692A8(s32 arg0) {
return false;
}
return true;
+
default:
return false;
}
@@ -441,6 +448,7 @@ s32 func_8096933C(s32 arg0) {
} else {
return true;
}
+
case 5:
case 6:
case 7:
@@ -451,6 +459,7 @@ s32 func_8096933C(s32 arg0) {
} else {
return true;
}
+
default:
return false;
}
@@ -579,13 +588,18 @@ void func_80969898(EnJs* this, PlayState* play) {
Audio_PlaySfx_MessageDecide();
Message_ContinueTextbox(play, 0x2217);
break;
+
case 1:
Audio_PlaySfx_MessageCancel();
Message_ContinueTextbox(play, 0x2216);
break;
+
+ default:
+ break;
}
}
break;
+
case TEXT_STATE_5:
if (Message_ShouldAdvance(play)) {
switch (play->msgCtx.currentTextId) {
@@ -593,18 +607,21 @@ void func_80969898(EnJs* this, PlayState* play) {
this->unk_2B8 |= 1;
if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) {
Message_ContinueTextbox(play, 0x220F);
- break;
+ } else {
+ Message_ContinueTextbox(play, 0x220D);
}
- Message_ContinueTextbox(play, 0x220D);
break;
+
case 0x220D:
case 0x2213:
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
+
case 0x220E:
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969748;
break;
+
case 0x2210:
case 0x2211:
case 0x2212:
@@ -612,19 +629,23 @@ void func_80969898(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969748;
break;
+
case 0x2214:
case 0x2217:
if (!func_809695FC(this, play)) {
func_80969494(this, play);
- break;
}
break;
+
default:
func_80969494(this, play);
break;
}
}
break;
+
+ default:
+ break;
}
}
@@ -729,13 +750,16 @@ void func_80969DA4(EnJs* this, PlayState* play) {
Audio_PlaySfx_MessageDecide();
if (!func_809695FC(this, play)) {
func_809694E8(this, play);
- break;
}
break;
+
case 1:
Audio_PlaySfx_MessageCancel();
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
+
+ default:
+ break;
}
}
break;
@@ -745,49 +769,60 @@ void func_80969DA4(EnJs* this, PlayState* play) {
case 0x221B:
if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) {
Message_ContinueTextbox(play, 0x2219);
- break;
+ } else {
+ Message_ContinueTextbox(play, 0x221C);
}
- Message_ContinueTextbox(play, 0x221C);
break;
+
case 0x2224:
case 0x2226:
case 0x2228:
case 0x222A:
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
+
case 0x2225:
case 0x2227:
case 0x2229:
case 0x222B:
if (!func_809695FC(this, play)) {
func_809694E8(this, play);
- break;
}
break;
+
case 0x2222:
player->exchangeItemAction = PLAYER_IA_NONE;
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
+
case 0x2223:
switch (ENJS_GET_TYPE(&this->actor)) {
case 5:
Message_ContinueTextbox(play, 0x2224);
break;
+
case 6:
Message_ContinueTextbox(play, 0x2226);
break;
+
case 7:
Message_ContinueTextbox(play, 0x2228);
break;
+
case 8:
Message_ContinueTextbox(play, 0x222A);
break;
+
+ default:
+ break;
}
break;
+
case 0x221C:
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969C54;
break;
+
case 0x221D:
case 0x2220:
case 0x2221:
@@ -795,12 +830,16 @@ void func_80969DA4(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969C54;
break;
+
default:
func_809694E8(this, play);
break;
}
}
break;
+
+ default:
+ break;
}
}
@@ -892,6 +931,9 @@ void func_8096A38C(EnJs* this, PlayState* play) {
case 1:
Audio_PlaySfx_MessageCancel();
break;
+
+ default:
+ break;
}
switch (play->msgCtx.currentTextId) {
@@ -902,9 +944,13 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f);
this->unk_2B8 |= 0x10;
break;
+
case 1:
Message_ContinueTextbox(play, 0x21FD);
break;
+
+ default:
+ break;
}
break;
@@ -914,9 +960,13 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0x2200);
func_809696EC(this, 0);
break;
+
case 1:
Message_ContinueTextbox(play, 0x21FF);
break;
+
+ default:
+ break;
}
break;
@@ -927,13 +977,21 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f);
this->unk_2B8 |= 0x10;
break;
+
case 1:
Message_ContinueTextbox(play, 0x2204);
break;
+
+ default:
+ break;
}
+
+ default:
+ break;
}
}
break;
+
case TEXT_STATE_5:
if (Message_ShouldAdvance(play)) {
switch (play->msgCtx.currentTextId) {
@@ -962,7 +1020,6 @@ void func_8096A38C(EnJs* this, PlayState* play) {
break;
case 0x2201:
-
case 0x220A:
if (!func_809695FC(this, play)) {
func_80969530(this, play);
@@ -975,6 +1032,9 @@ void func_8096A38C(EnJs* this, PlayState* play) {
}
}
break;
+
+ default:
+ break;
}
}
diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
index cee6b38fa..d629c57b9 100644
--- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
+++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
@@ -442,8 +442,8 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) {
void EnKaizoku_ChangeAnim(EnKaizoku* this, EnKaizokuAnimation animIndex) {
this->animIndex = animIndex;
- this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]);
- Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount,
+ this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]);
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], 0.0f);
}
@@ -553,7 +553,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) {
break;
case 3:
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
sp54 = this->unk_2CA * 4 + this->unk_2C8;
if (Player_GetMask(play) == PLAYER_MASK_STONE) {
if (D_80B8A8D0[sp54] == 0x11A5) {
@@ -595,7 +595,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) {
case 6:
Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f);
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
this->unk_598 = 7;
this->unk_2F8.x = 1.0f;
this->unk_59C++;
@@ -700,7 +700,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) {
switch (this->unk_59C) {
case 0:
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14);
this->unk_2C8 = 3;
this->unk_598 = 0;
@@ -709,7 +709,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) {
break;
case 1:
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
s32 textId;
EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15);
@@ -787,7 +787,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) {
break;
case 1:
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
if (this->unk_2D9 == 0) {
Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH);
this->unk_2D9 = 1;
@@ -843,7 +843,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) {
255;
}
- if ((this->frameCount <= curFrame) && (this->unk_5A0 >= 0x28)) {
+ if ((curFrame >= this->animEndFrame) && (this->unk_5A0 >= 0x28)) {
this->picto.actor.draw = NULL;
this->unk_598 = 10;
Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f);
@@ -1127,7 +1127,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) {
}
this->unk_2D8 = 0;
- if ((this->frameCount <= curFrame) &&
+ if ((curFrame >= this->animEndFrame) &&
(this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) {
this->bodyCollider.info.elemType = ELEMTYPE_UNK1;
this->bodyCollider.base.colType = COLTYPE_HIT3;
@@ -1157,7 +1157,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
this->unk_2D8 = 0;
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) &&
(Rand_ZeroOne() < 0.2f)) {
func_80B88910(this);
@@ -1207,7 +1207,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) {
}
this->unk_2D8 = 0;
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
@@ -1252,7 +1252,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
this->unk_2D8 = 0;
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
this->picto.actor.speed = 0.0f;
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
@@ -1404,22 +1404,20 @@ void func_80B88964(EnKaizoku* this, PlayState* play) {
if (this->skelAnime.curFrame <= 8.0f) {
this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer;
- } else {
- if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
- Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
- Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
- this->swordState = 1;
- this->picto.actor.speed = 10.0f;
- Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK);
- } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) {
- this->picto.actor.speed = 0.0f;
- } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
- this->swordState = -1;
- }
+ } else if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
+ Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
+ Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
+ this->swordState = 1;
+ this->picto.actor.speed = 10.0f;
+ Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK);
+ } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) {
+ this->picto.actor.speed = 0.0f;
+ } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
+ this->swordState = -1;
}
this->unk_2D8 = 0;
- if ((this->frameCount <= curFrame) && (this->unk_2D0 < 2)) {
+ if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) {
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f;
@@ -1755,7 +1753,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) {
Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1);
SkelAnime_Update(&this->skelAnime);
- if (this->frameCount <= curFrame) {
+ if (curFrame >= this->animEndFrame) {
this->unk_2D8 = 0;
func_80B86B58(this);
} else if (Animation_OnFrame(&this->skelAnime, 10.0f)) {
diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h
index e2c53d34b..a119777a9 100644
--- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h
+++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h
@@ -80,7 +80,7 @@ typedef struct EnKaizoku {
/* 0x2D6 */ s16 csId;
/* 0x2D8 */ u8 unk_2D8;
/* 0x2D9 */ u8 unk_2D9;
- /* 0x2DC */ f32 frameCount;
+ /* 0x2DC */ f32 animEndFrame;
/* 0x2E0 */ f32 unk_2E0;
/* 0x2E4 */ EnKaizokuAnimation animIndex;
/* 0x2E8 */ s32 bodyPartIndex;
diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
index be787e8d9..d2c877ad3 100644
--- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
+++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
@@ -121,18 +121,32 @@ typedef enum {
/* 5 */ ENKAKASI_ANIM_ARMS_CROSSED_STILL, // arms crossed but still, also some noise sfx
/* 6 */ ENKAKASI_ANIM_WAVE, // "wave" short sideways shake, stops early, partial? unused?
/* 7 */ ENKAKASI_ANIM_SLOWROLL, // partial bounch, ends looking left, OFFER anim takes over
- /* 8 */ ENKAKASI_ANIM_IDLE // slow stretching wiggle, ends in regular position
+ /* 8 */ ENKAKASI_ANIM_IDLE, // slow stretching wiggle, ends in regular position
+ /* 9 */ ENKAKASI_ANIM_MAX
} EnKakasiAnimation;
-static AnimationHeader* sAnimations[] = {
- &object_ka_Anim_007444, &object_ka_Anim_00686C, &object_ka_Anim_0081A4,
- &object_ka_Anim_007B90, &object_ka_Anim_0071EC, &object_ka_Anim_007444,
- &object_ka_Anim_00686C, &object_ka_Anim_0081A4, &object_ka_Anim_000214,
+static AnimationHeader* sAnimations[ENKAKASI_ANIM_MAX] = {
+ &object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING
+ &object_ka_Anim_00686C, // ENKAKASI_ANIM_SIDEWAYS_SHAKING
+ &object_ka_Anim_0081A4, // ENKAKASI_ANIM_HOPPING_REGULAR
+ &object_ka_Anim_007B90, // ENKAKASI_ANIM_SPIN_REACH_OFFER
+ &object_ka_Anim_0071EC, // ENKAKASI_ANIM_TWIRL
+ &object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_STILL
+ &object_ka_Anim_00686C, // ENKAKASI_ANIM_WAVE
+ &object_ka_Anim_0081A4, // ENKAKASI_ANIM_SLOWROLL
+ &object_ka_Anim_000214, // ENKAKASI_ANIM_IDLE
};
-static u8 sAnimationModes[] = {
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE,
- ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE,
+static u8 sAnimationModes[ENKAKASI_ANIM_MAX] = {
+ ANIMMODE_LOOP, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING
+ ANIMMODE_LOOP, // ENKAKASI_ANIM_SIDEWAYS_SHAKING
+ ANIMMODE_LOOP, // ENKAKASI_ANIM_HOPPING_REGULAR
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_SPIN_REACH_OFFER
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_TWIRL
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_ARMS_CROSSED_STILL
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_WAVE
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_SLOWROLL
+ ANIMMODE_ONCE, // ENKAKASI_ANIM_IDLE
};
void EnKakasi_Destroy(Actor* thisx, PlayState* play) {
@@ -147,7 +161,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) {
s32 i;
Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0);
this->songSummonDist = KAKASI_GET_SUMMON_DISTANCE(&this->picto.actor) * 20.0f;
if (this->songSummonDist < 40.0f) {
@@ -278,7 +292,6 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) {
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_RIGHT) ||
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_LEFT) ||
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_UP)) {
- // why not 0 < x < 4? fewer branches
this->unk190++;
}
if ((this->unk190 != 0) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) {
@@ -364,7 +377,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) {
} else if ((day == 3) && gSaveContext.save.isNight) {
this->skelAnime.playSpeed = 1.0f;
if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) {
- EnKakasi_ChangeAnim(this, 1);
+ EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING);
}
} else if (this->animIndex != ENKAKASI_ANIM_IDLE) {
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_IDLE);
@@ -403,7 +416,8 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) {
// if dialogue: oh sorry come back again
if ((this->picto.actor.textId == 0x1651) || (this->picto.actor.textId == 0x1659)) {
if ((curFrame >= this->animEndFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) {
- if (++this->unkCounter1A4 >= 2) {
+ this->unkCounter1A4++;
+ if (this->unkCounter1A4 >= 2) {
this->unkCounter1A4 = 0;
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER);
}
@@ -1154,7 +1168,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) {
void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnKakasi* this = THIS;
- if (limbIndex == 4) {
+ if (limbIndex == OBJECT_KA_LIMB_04) {
Matrix_MultVec3f(&gZeroVec3f, &this->unk1BC);
}
}
diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c
index c400b3428..8171e56b4 100644
--- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c
+++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c
@@ -647,10 +647,10 @@ void EnKame_Stunned(EnKame* this, PlayState* play) {
}
void EnKame_SetupDamaged(EnKame* this) {
- s16 lastFrame = Animation_GetLastFrame(&gSnapperDamageAnim);
+ s16 endFrame = Animation_GetLastFrame(&gSnapperDamageAnim);
- Animation_Change(&this->snapperSkelAnime, &gSnapperDamageAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -3.0f);
- Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, lastFrame);
+ Animation_Change(&this->snapperSkelAnime, &gSnapperDamageAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE, -3.0f);
+ Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, endFrame);
Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DAMAGE);
this->collider.base.acFlags &= ~AC_ON;
this->actionFunc = EnKame_Damaged;
diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c
index 76d88fa94..01e781ecb 100644
--- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c
+++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c
@@ -17,11 +17,28 @@ void EnKbt_Draw(Actor* thisx, PlayState* play);
s32 func_80B33E64(PlayState* play);
s32 func_80B33E8C(PlayState* play);
-void func_80B33EF0(EnKbt* this, s16 arg1);
+void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex);
Actor* func_80B3403C(PlayState* play);
void func_80B34314(EnKbt* this, PlayState* play);
void func_80B34598(EnKbt* this, PlayState* play);
+typedef enum EnKbtAnimation {
+ /* 0 */ ENKBT_ANIM_0,
+ /* 1 */ ENKBT_ANIM_1,
+ /* 2 */ ENKBT_ANIM_2,
+ /* 3 */ ENKBT_ANIM_3,
+ /* 4 */ ENKBT_ANIM_4,
+ /* 5 */ ENKBT_ANIM_5,
+ /* 6 */ ENKBT_ANIM_6,
+ /* 7 */ ENKBT_ANIM_7,
+ /* 8 */ ENKBT_ANIM_8,
+ /* 9 */ ENKBT_ANIM_9,
+ /* 10 */ ENKBT_ANIM_10,
+ /* 11 */ ENKBT_ANIM_11,
+ /* 12 */ ENKBT_ANIM_12,
+ /* 13 */ ENKBT_ANIM_MAX
+} EnKbtAnimation;
+
ActorInit En_Kbt_InitVars = {
ACTOR_EN_KBT,
ACTORCAT_NPC,
@@ -44,13 +61,13 @@ void EnKbt_Init(Actor* thisx, PlayState* play) {
this->actor.home.rot.z = 0;
this->unk_27E = 4;
this->unk_27F = 0;
- this->unk_280 = 13;
+ this->animIndex = ENKBT_ANIM_MAX;
this->unk_282 = 13;
this->unk_278 = func_80B3403C(play);
this->unk_284 = 0;
this->actor.textId = 0;
if (func_80B33E64(play)) {
- func_80B33EF0(this, 6);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_6);
this->unk_282 = 11;
if (func_80B33E8C(play)) {
this->actor.textId = 0xC50;
@@ -60,7 +77,7 @@ void EnKbt_Init(Actor* thisx, PlayState* play) {
}
this->actionFunc = func_80B34314;
} else {
- func_80B33EF0(this, 0);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
this->unk_282 = 0;
this->actionFunc = func_80B34598;
}
@@ -82,27 +99,48 @@ s32 func_80B33E8C(PlayState* play) {
return false;
}
-void func_80B33EF0(EnKbt* this, s16 arg1) {
- static AnimationHeader* sAnimations[] = {
- &object_kbt_Anim_000670, &object_kbt_Anim_001674, &object_kbt_Anim_002084, &object_kbt_Anim_000FE8,
- &object_kbt_Anim_001940, &object_kbt_Anim_00E7BC, &object_kbt_Anim_00F0C8, &object_kbt_Anim_002710,
- &object_kbt_Anim_002DE0, &object_kbt_Anim_003414, &object_kbt_Anim_003D24, &object_kbt_Anim_001BF4,
- &object_kbt_Anim_002084,
+void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex) {
+ static AnimationHeader* sAnimations[ENKBT_ANIM_MAX] = {
+ &object_kbt_Anim_000670, // ENKBT_ANIM_0
+ &object_kbt_Anim_001674, // ENKBT_ANIM_1
+ &object_kbt_Anim_002084, // ENKBT_ANIM_2
+ &object_kbt_Anim_000FE8, // ENKBT_ANIM_3
+ &object_kbt_Anim_001940, // ENKBT_ANIM_4
+ &object_kbt_Anim_00E7BC, // ENKBT_ANIM_5
+ &object_kbt_Anim_00F0C8, // ENKBT_ANIM_6
+ &object_kbt_Anim_002710, // ENKBT_ANIM_7
+ &object_kbt_Anim_002DE0, // ENKBT_ANIM_8
+ &object_kbt_Anim_003414, // ENKBT_ANIM_9
+ &object_kbt_Anim_003D24, // ENKBT_ANIM_10
+ &object_kbt_Anim_001BF4, // ENKBT_ANIM_11
+ &object_kbt_Anim_002084, // ENKBT_ANIM_12
};
- u8 sp38[] = {
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP,
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE,
+ u8 animationModes[ENKBT_ANIM_MAX] = {
+ ANIMMODE_LOOP, // ENKBT_ANIM_0
+ ANIMMODE_LOOP, // ENKBT_ANIM_1
+ ANIMMODE_ONCE, // ENKBT_ANIM_2
+ ANIMMODE_LOOP, // ENKBT_ANIM_3
+ ANIMMODE_ONCE, // ENKBT_ANIM_4
+ ANIMMODE_LOOP, // ENKBT_ANIM_5
+ ANIMMODE_LOOP, // ENKBT_ANIM_6
+ ANIMMODE_LOOP, // ENKBT_ANIM_7
+ ANIMMODE_LOOP, // ENKBT_ANIM_8
+ ANIMMODE_LOOP, // ENKBT_ANIM_9
+ ANIMMODE_LOOP, // ENKBT_ANIM_10
+ ANIMMODE_ONCE, // ENKBT_ANIM_11
+ ANIMMODE_ONCE, // ENKBT_ANIM_12
};
- if (arg1 != this->unk_280) {
- if (arg1 >= 12) {
- Animation_Change(&this->skelAnime, sAnimations[arg1], -1.0f,
- Animation_GetLastFrame(sAnimations[arg1]) - 1.0f, 0.0f, sp38[arg1], -5.0f);
+ if (this->animIndex != animIndex) {
+ if (animIndex >= ENKBT_ANIM_12) {
+ Animation_Change(&this->skelAnime, sAnimations[animIndex], -1.0f,
+ Animation_GetLastFrame(sAnimations[animIndex]) - 1.0f, 0.0f, animationModes[animIndex],
+ -5.0f);
} else {
- Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[arg1]),
- sp38[arg1], -5.0f);
+ Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimations[animIndex]), animationModes[animIndex], -5.0f);
}
- this->unk_280 = arg1;
+ this->animIndex = animIndex;
}
}
@@ -124,11 +162,11 @@ void func_80B34078(EnKbt* this) {
if (this->unk_284 > 0) {
this->unk_284--;
} else {
- switch (this->unk_280) {
- case 2:
+ switch (this->animIndex) {
+ case ENKBT_ANIM_2:
switch (this->unk_282) {
case 0:
- func_80B33EF0(this, 12);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_12);
break;
case 5:
@@ -136,21 +174,24 @@ void func_80B34078(EnKbt* this) {
break;
default:
- func_80B33EF0(this, 5);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_5);
break;
}
break;
- case 12:
- func_80B33EF0(this, 0);
+ case ENKBT_ANIM_12:
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
this->actor.home.rot.z = 0;
break;
- case 4:
- func_80B33EF0(this, 1);
+ case ENKBT_ANIM_4:
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_1);
this->unk_27E = 2;
this->actor.home.rot.z = 0;
break;
+
+ default:
+ break;
}
}
}
@@ -169,67 +210,70 @@ void func_80B3415C(EnKbt* this) {
switch (this->unk_282) {
case 0:
- if ((this->unk_280 != 2) && (this->unk_280 != 12)) {
- func_80B33EF0(this, 0);
+ if ((this->animIndex != ENKBT_ANIM_2) && (this->animIndex != ENKBT_ANIM_12)) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
}
break;
case 1:
- func_80B33EF0(this, 2);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 0;
break;
case 2:
- if (this->unk_280 != 12) {
- func_80B33EF0(this, 3);
+ if (this->animIndex != ENKBT_ANIM_12) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_3);
}
break;
case 3:
- if (this->unk_280 != 1) {
- func_80B33EF0(this, 4);
+ if (this->animIndex != ENKBT_ANIM_1) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_4);
}
break;
case 10:
- func_80B33EF0(this, 11);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_11);
break;
case 4:
- func_80B33EF0(this, 2);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 6;
break;
case 6:
- if (this->unk_280 != 2) {
- func_80B33EF0(this, 5);
+ if (this->animIndex != ENKBT_ANIM_2) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_5);
}
break;
case 11:
- func_80B33EF0(this, 6);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_6);
break;
case 7:
- if (this->unk_280 != 2) {
- func_80B33EF0(this, 7);
+ if (this->animIndex != ENKBT_ANIM_2) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
}
break;
case 8:
- if (this->unk_280 != 2) {
- func_80B33EF0(this, 8);
+ if (this->animIndex != ENKBT_ANIM_2) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_8);
}
break;
case 9:
- if (this->unk_280 != 2) {
- func_80B33EF0(this, 9);
+ if (this->animIndex != ENKBT_ANIM_2) {
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_9);
}
break;
case 12:
- func_80B33EF0(this, 10);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_10);
+ break;
+
+ default:
break;
}
}
@@ -327,7 +371,7 @@ void func_80B34598(EnKbt* this, PlayState* play) {
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_282 = 0;
- func_80B33EF0(this, 12);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_12);
break;
case 0x6:
@@ -411,26 +455,26 @@ void func_80B34598(EnKbt* this, PlayState* play) {
case 0xC35:
this->unk_27E = 4;
this->unk_27F = 0;
- func_80B33EF0(this, 2);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 5;
break;
case 0xC36:
this->unk_27E = 1;
this->unk_27F = 1;
- func_80B33EF0(this, 7);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
this->unk_282 = 7;
break;
case 0xC37:
- func_80B33EF0(this, 10);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_10);
this->unk_27E = 0;
this->unk_27F = 1;
break;
case 0xC38:
case 0xC39:
- func_80B33EF0(this, 7);
+ EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
this->unk_27E = 0;
this->unk_27F = 1;
break;
@@ -517,6 +561,9 @@ void func_80B34598(EnKbt* this, PlayState* play) {
this->unk_27F = 1;
this->unk_282 = 12;
break;
+
+ default:
+ break;
}
this->actor.textId = 0;
diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h
index eb491bf28..9a7a5cdf0 100644
--- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h
+++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h
@@ -17,7 +17,7 @@ typedef struct EnKbt {
/* 0x27C */ u16 unk_27C;
/* 0x27E */ u8 unk_27E;
/* 0x27F */ u8 unk_27F;
- /* 0x280 */ s16 unk_280;
+ /* 0x280 */ s16 animIndex;
/* 0x282 */ s16 unk_282;
/* 0x284 */ s16 unk_284;
/* 0x288 */ EnKbtActionFunc actionFunc;
diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c
index ce3011e6d..31d98abf0 100644
--- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c
+++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c
@@ -6,7 +6,6 @@
#include "z_en_kendo_js.h"
#include "overlays/actors/ovl_En_Maruta/z_en_maruta.h"
-#include "objects/object_js/object_js.h"
#define FLAGS \
(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON)
@@ -72,12 +71,21 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
-static AnimationInfo sAnimationInfo[] = {
- { &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
- { &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
- { &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
- { &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
- { &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
+typedef enum EnKendoJsAnimation {
+ /* 0 */ ENKENDOJS_ANIM_0,
+ /* 1 */ ENKENDOJS_ANIM_1,
+ /* 2 */ ENKENDOJS_ANIM_2,
+ /* 3 */ ENKENDOJS_ANIM_3,
+ /* 4 */ ENKENDOJS_ANIM_4,
+ /* 5 */ ENKENDOJS_ANIM_MAX
+} EnKendoJsAnimation;
+
+static AnimationInfo sAnimationInfo[ENKENDOJS_ANIM_MAX] = {
+ { &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_0
+ { &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_1
+ { &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_2
+ { &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENKENDOJS_ANIM_3
+ { &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_4
};
s16 D_80B27CE0[][3] = {
@@ -110,7 +118,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
SkelAnime_InitFlex(play, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable,
- this->morphTable, 13);
+ this->morphTable, OBJECT_JS_LIMB_MAX);
if ((CURRENT_DAY == 3) &&
!((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) {
@@ -120,7 +128,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) {
this->actor.home.rot.z, 0x10);
Actor_Kill(&this->actor);
} else {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_4);
}
} else if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) {
Actor_Kill(&this->actor);
@@ -224,7 +232,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x272C, &this->actor);
this->unk_288 = 0x272C;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
} else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x2718, &this->actor);
@@ -242,7 +250,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x272C, &this->actor);
this->unk_288 = 0x272C;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
} else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk12070) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x2718, &this->actor);
@@ -259,6 +267,9 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
Message_StartTextbox(play, 0x2717, &this->actor);
this->unk_288 = 0x2717;
+
+ default:
+ break;
}
}
}
@@ -310,6 +321,9 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) {
func_80B276C4(this);
func_80B276D8(this, play);
break;
+
+ default:
+ break;
}
}
@@ -332,7 +346,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) {
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
if (this->unk_288 == 0x272C) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3);
}
if ((this->unk_288 == 0x272E) || (this->unk_288 == 0x272F) || (this->unk_288 == 0x2730)) {
@@ -347,6 +361,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) {
case TEXT_STATE_1:
case TEXT_STATE_CLOSING:
case TEXT_STATE_3:
+ default:
break;
}
}
@@ -443,6 +458,9 @@ s32 func_80B26BF8(EnKendoJs* this, PlayState* play) {
return 1;
}
break;
+
+ default:
+ break;
}
return 2;
}
@@ -477,6 +495,9 @@ s32 func_80B26F6C(EnKendoJs* this, PlayState* play) {
return true;
}
break;
+
+ default:
+ break;
}
return false;
}
@@ -523,7 +544,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
func_80B26F14(this, play);
} else if (!func_80B26F6C(this, play)) {
if (this->skelAnime.animation == &object_js_Anim_00016C) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3);
}
this->unk_286 = 2;
Message_CloseTextbox(play);
@@ -548,7 +569,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
player->stateFlags1 |= PLAYER_STATE1_20;
Message_StartTextbox(play, 0x2729, &this->actor);
this->unk_288 = 0x2729;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
break;
default:
@@ -564,7 +585,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
if ((this->skelAnime.animation == &object_js_Anim_0003DC) &&
Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_1);
}
if (this->unk_284 == 7) {
@@ -764,7 +785,7 @@ void EnKendoJs_Update(Actor* thisx, PlayState* play) {
s32 EnKendoJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnKendoJs* this = THIS;
- if (limbIndex == 12) {
+ if (limbIndex == OBJECT_JS_LIMB_0C) {
rot->y -= this->unk_278.y;
}
return false;
diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h
index 1992f7234..8602550e0 100644
--- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h
+++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h
@@ -2,6 +2,7 @@
#define Z_EN_KENDO_JS_H
#include "global.h"
+#include "objects/object_js/object_js.h"
struct EnKendoJs;
@@ -17,8 +18,8 @@ typedef struct EnKendoJs {
/* 0x144 */ ColliderCylinder collider;
/* 0x190 */ SkelAnime skelAnime;
/* 0x1D4 */ EnKendoJsActionFunc actionFunc;
- /* 0x1D8 */ Vec3s jointTable[13];
- /* 0x226 */ Vec3s morphTable[13];
+ /* 0x1D8 */ Vec3s jointTable[OBJECT_JS_LIMB_MAX];
+ /* 0x226 */ Vec3s morphTable[OBJECT_JS_LIMB_MAX];
/* 0x274 */ Vec3s* unk_274;
/* 0x278 */ Vec3s unk_278;
/* 0x27E */ Vec3s unk_27E;
diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
index b5819e333..62d4a1f62 100644
--- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
+++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
@@ -5,7 +5,6 @@
*/
#include "z_en_kgy.h"
-#include "objects/object_kgy/object_kgy.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@@ -31,6 +30,21 @@ void func_80B425A0(EnKgy* this, PlayState* play);
void func_80B42714(EnKgy* this, PlayState* play);
void func_80B42D28(EnKgy* this, PlayState* play);
+typedef enum EnKgyAnimation {
+ /* -1 */ ENKGY_ANIM_NONE = -1,
+ /* 0 */ ENKGY_ANIM_0,
+ /* 1 */ ENKGY_ANIM_1,
+ /* 2 */ ENKGY_ANIM_2,
+ /* 3 */ ENKGY_ANIM_3,
+ /* 4 */ ENKGY_ANIM_4,
+ /* 5 */ ENKGY_ANIM_5,
+ /* 6 */ ENKGY_ANIM_6,
+ /* 7 */ ENKGY_ANIM_7,
+ /* 8 */ ENKGY_ANIM_8,
+ /* 9 */ ENKGY_ANIM_9,
+ /* 10 */ ENKGY_ANIM_MAX
+} EnKgyAnimation;
+
ActorInit En_Kgy_InitVars = {
ACTOR_EN_KGY,
ACTORCAT_NPC,
@@ -50,11 +64,11 @@ void EnKgy_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_kgy_Skel_00F910, &object_kgy_Anim_004B98, this->jointTable,
- this->morphTable, 23);
- this->unk_2D2 = -1;
+ this->morphTable, OBJECT_KGY_LIMB_MAX);
+ this->animIndex = ENKGY_ANIM_NONE;
this->unk_29C = 0;
this->unk_2E4 = 0;
- this->unk_2E2 = -1;
+ this->animIndex2 = ENKGY_ANIM_NONE;
this->zubora = EnKgy_FindZubora(play);
this->iceBlock = EnKgy_FindIceBlock(play);
Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1);
@@ -64,25 +78,25 @@ void EnKgy_Init(Actor* thisx, PlayState* play) {
play->envCtx.lightSettingOverride = 1;
SET_WEEKEVENTREG(WEEKEVENTREG_21_01);
if (!func_80B40D64(play)) {
- EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
this->actionFunc = func_80B425A0;
this->actor.textId = 0xC35;
} else if (!func_80B40DB4(play)) {
- EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0);
this->actionFunc = func_80B419B0;
this->actor.textId = 0xC4E;
this->unk_29C |= 1;
this->getItemId = GI_RUPEE_10;
} else {
- EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
this->actionFunc = func_80B42714;
this->actor.textId = 0xC50;
}
} else {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_80)) {
- EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
} else {
- EnKgy_ChangeAnim(this, 0, ANIMMODE_LOOP, 0);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_0, ANIMMODE_LOOP, 0);
}
this->actionFunc = func_80B42D28;
}
@@ -109,21 +123,28 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
}
-void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) {
- static AnimationHeader* sAnimations[] = {
- &object_kgy_Anim_004B98, &object_kgy_Anim_0008FC, &object_kgy_Anim_00292C, &object_kgy_Anim_0042E4,
- &object_kgy_Anim_0101F0, &object_kgy_Anim_001764, &object_kgy_Anim_003334, &object_kgy_Anim_010B84,
- &object_kgy_Anim_001EA4, &object_kgy_Anim_003D88,
- };
+static AnimationHeader* sAnimations[ENKGY_ANIM_MAX] = {
+ &object_kgy_Anim_004B98, // ENKGY_ANIM_0
+ &object_kgy_Anim_0008FC, // ENKGY_ANIM_1
+ &object_kgy_Anim_00292C, // ENKGY_ANIM_2
+ &object_kgy_Anim_0042E4, // ENKGY_ANIM_3
+ &object_kgy_Anim_0101F0, // ENKGY_ANIM_4
+ &object_kgy_Anim_001764, // ENKGY_ANIM_5
+ &object_kgy_Anim_003334, // ENKGY_ANIM_6
+ &object_kgy_Anim_010B84, // ENKGY_ANIM_7
+ &object_kgy_Anim_001EA4, // ENKGY_ANIM_8
+ &object_kgy_Anim_003D88, // ENKGY_ANIM_9
+};
+void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
- this->unk_2D2 = animIndex;
+ this->animIndex = animIndex;
}
-void func_80B40BC0(EnKgy* this, s16 arg1) {
- if (arg1 != this->unk_2D2) {
- EnKgy_ChangeAnim(this, arg1, ANIMMODE_LOOP, -5.0f);
+void EnKgy_ChangeAnimLoopMorph(EnKgy* this, s16 animIndex) {
+ if (this->animIndex != animIndex) {
+ EnKgy_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f);
}
}
@@ -218,13 +239,13 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
if (this->unk_2E4 > 0) {
this->unk_2E4--;
- if ((this->unk_2E4 == 0) && (this->unk_2E2 >= 0)) {
- if (this->unk_2E2 == 3) {
- EnKgy_ChangeAnim(this, 3, ANIMMODE_ONCE, -5.0f);
+ if ((this->unk_2E4 == 0) && (this->animIndex2 > ENKGY_ANIM_NONE)) {
+ if (this->animIndex2 == ENKGY_ANIM_3) {
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_3, ANIMMODE_ONCE, -5.0f);
} else {
- func_80B40BC0(this, this->unk_2E2);
+ EnKgy_ChangeAnimLoopMorph(this, this->animIndex2);
}
- this->unk_2E2 = -1;
+ this->animIndex2 = ENKGY_ANIM_NONE;
}
}
@@ -258,14 +279,14 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
switch (this->actor.textId) {
case 0xC22:
this->unk_2E4 = 20;
- this->unk_2E2 = 3;
+ this->animIndex2 = ENKGY_ANIM_3;
break;
case 0xC43:
if (func_80B40D64(play)) {
- func_80B40BC0(this, 7);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
} else {
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
}
this->unk_2E4 = 30;
this->actionFunc = func_80B41A48;
@@ -273,7 +294,10 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
case 0xC52:
case 0xC54:
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
+ break;
+
+ default:
break;
}
}
@@ -288,7 +312,7 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
if (this->unk_2E8 == 0) {
if ((this->actor.textId == 0xC1D) || (this->actor.textId == 0xC2D)) {
this->unk_2E4 = 20;
- this->unk_2E2 = 3;
+ this->animIndex2 = ENKGY_ANIM_3;
func_80B40EBC(this, play, this->actor.textId);
} else {
func_80B40EBC(this, play, this->actor.textId);
@@ -339,6 +363,9 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) {
}
this->csIdIndex = 4;
break;
+
+ default:
+ break;
}
}
@@ -419,16 +446,16 @@ void func_80B4163C(EnKgy* this, PlayState* play) {
this->actor.focus.pos = this->unk_2A8;
if (SkelAnime_Update(&this->skelAnime)) {
- if (this->unk_2D2 == 6) {
+ if (this->animIndex == ENKGY_ANIM_6) {
if (this->getItemId > GI_NONE) {
- EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0.0f);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0.0f);
this->getItemId--;
} else {
- EnKgy_ChangeAnim(this, 9, ANIMMODE_ONCE, -5.0f);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_9, ANIMMODE_ONCE, -5.0f);
this->getItemId = (s32)Rand_ZeroFloat(GI_RUPEE_PURPLE - GI_RUPEE_BLUE) + GI_RUPEE_BLUE;
}
} else {
- EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, -5.0f);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, -5.0f);
}
SkelAnime_Update(&this->skelAnime);
}
@@ -446,6 +473,9 @@ void func_80B4163C(EnKgy* this, PlayState* play) {
this->unk_300 = 200;
Actor_PlaySfx(&this->actor, NA_SE_EV_SWORD_FORGE);
break;
+
+ default:
+ break;
}
this->lightInfo.params.point.radius = this->unk_300;
@@ -608,11 +638,11 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
- if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 3)) {
- func_80B40BC0(this, 4);
+ if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_3)) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
- if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && func_80B40E54(this) == 0) {
+ if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0)) {
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
@@ -636,6 +666,9 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
func_80B40EBC(this, play, textId);
break;
+
+ default:
+ break;
}
break;
@@ -650,8 +683,14 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
func_80B40E74(this, play, 0xC3C);
break;
+
+ default:
+ break;
}
break;
+
+ default:
+ break;
}
}
break;
@@ -683,13 +722,13 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B425A0;
func_80B413C8(this);
func_80B40E18(this, 5);
- func_80B40BC0(this, 4);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
this->actor.textId = 0xC35;
break;
case 0xC3A:
func_80B40E74(this, play, func_80B41528(play));
- func_80B40BC0(this, 4);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
break;
case 0xC3C:
@@ -758,7 +797,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
break;
case 0xC47:
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
if (this->unk_29C & 8) {
player->exchangeItemAction = PLAYER_IA_NONE;
this->unk_29C &= ~8;
@@ -780,7 +819,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
case 0xC4A:
case 0xC4B:
- func_80B40BC0(this, 4);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
Message_CloseTextbox(play);
this->actionFunc = func_80B41C54;
this->actor.textId = 0xC4B;
@@ -817,9 +856,15 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
func_80B413C8(this);
func_80B40E18(this, 8);
break;
+
+ default:
+ break;
}
}
break;
+
+ default:
+ break;
}
}
@@ -844,7 +889,7 @@ void func_80B425A0(EnKgy* this, PlayState* play) {
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B41E18;
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
func_80B411DC(this, play, 0);
func_80B40E18(this, this->actor.textId);
} else if (this->actor.xzDistToPlayer < 200.0f) {
@@ -887,11 +932,11 @@ void func_80B427C8(EnKgy* this, PlayState* play) {
u16 textId;
if (SkelAnime_Update(&this->skelAnime)) {
- if (this->unk_2D2 == 5) {
- func_80B40BC0(this, 7);
+ if (this->animIndex == ENKGY_ANIM_5) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
}
- if (this->unk_2D2 == 3) {
- func_80B40BC0(this, 4);
+ if (this->animIndex == ENKGY_ANIM_3) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
}
@@ -923,26 +968,29 @@ void func_80B427C8(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B41C54;
func_80B413C8(this);
func_80B40E18(this, 6);
- func_80B40BC0(this, 4);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
this->actor.textId = 0xC3A;
break;
+
+ default:
+ break;
}
}
func_80B40EE8(this, play);
}
void func_80B4296C(EnKgy* this, PlayState* play) {
- if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
- func_80B40BC0(this, 2);
+ if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2);
}
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B427C8;
- if (this->unk_2D2 == 4) {
- func_80B40BC0(this, 7);
+ if (this->animIndex == ENKGY_ANIM_4) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
} else {
- EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f);
}
func_80B411DC(this, play, 0);
func_80B40E18(this, this->actor.textId);
@@ -958,12 +1006,12 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
s32 pad;
if (SkelAnime_Update(&this->skelAnime)) {
- if (this->unk_2D2 == 5) {
- func_80B40BC0(this, 1);
+ if (this->animIndex == ENKGY_ANIM_5) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
}
- if (this->unk_2D2 == 3) {
- func_80B40BC0(this, 4);
+ if (this->animIndex == ENKGY_ANIM_3) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
}
@@ -995,7 +1043,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
case 0xC20:
case 0xC28:
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
play->msgCtx.msgLength = 0;
this->unk_29C |= 4;
this->unk_2E8 = 3;
@@ -1027,7 +1075,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
case 0xC2A:
this->unk_2E4 = 20;
- this->unk_2E2 = 3;
+ this->animIndex2 = ENKGY_ANIM_3;
func_80B40EBC(this, play, this->actor.textId);
break;
@@ -1038,23 +1086,26 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
func_80B413C8(this);
func_80B40E18(this, 1);
break;
+
+ default:
+ break;
}
}
func_80B40EE8(this, play);
}
void func_80B42D28(EnKgy* this, PlayState* play) {
- if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
- func_80B40BC0(this, 2);
+ if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) {
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2);
}
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B42A8C;
if (this->actor.textId == 0xC2D) {
- func_80B40BC0(this, 1);
+ EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
} else {
- EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f);
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f);
SET_WEEKEVENTREG(WEEKEVENTREG_20_80);
}
func_80B411DC(this, play, 0);
@@ -1065,7 +1116,7 @@ void func_80B42D28(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B4296C;
SET_WEEKEVENTREG(WEEKEVENTREG_21_01);
} else if (this->actor.xzDistToPlayer < 200.0f) {
- if (this->unk_2D2 == 4) {
+ if (this->animIndex == ENKGY_ANIM_4) {
this->actor.textId = 0xC2D;
} else {
this->actor.textId = 0xC1D;
@@ -1073,8 +1124,8 @@ void func_80B42D28(EnKgy* this, PlayState* play) {
Actor_OfferTalk(&this->actor, play, 210.0f);
}
- if ((this->unk_2D2 == 0) && (this->actor.xzDistToPlayer < 200.0f)) {
- EnKgy_ChangeAnim(this, 8, ANIMMODE_ONCE, 5.0f);
+ if ((this->animIndex == ENKGY_ANIM_0) && (this->actor.xzDistToPlayer < 200.0f)) {
+ EnKgy_ChangeAnim(this, ENKGY_ANIM_8, ANIMMODE_ONCE, 5.0f);
}
}
}
@@ -1085,7 +1136,7 @@ void EnKgy_Update(Actor* thisx, PlayState* play) {
Vec3s sp30;
this->actionFunc(this, play);
- if (this->unk_2D2 == 2) {
+ if (this->animIndex == ENKGY_ANIM_2) {
sp30.z = 0;
sp30.y = 0;
sp30.x = 0;
@@ -1100,14 +1151,14 @@ s32 EnKgy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
EnKgy* this = THIS;
if (!(this->unk_29C & 1)) {
- if (limbIndex == 17) {
+ if (limbIndex == OBJECT_KGY_LIMB_11) {
*dList = NULL;
}
- } else if (limbIndex == 16) {
+ } else if (limbIndex == OBJECT_KGY_LIMB_10) {
*dList = NULL;
}
- if (limbIndex == 11) {
+ if (limbIndex == OBJECT_KGY_LIMB_0B) {
rot->x += this->unk_2CC.y;
}
@@ -1119,11 +1170,11 @@ void EnKgy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
static Vec3f D_80B432E4 = { 3000.0f, 4000.0f, 300.0f };
EnKgy* this = THIS;
- if (limbIndex == 11) {
+ if (limbIndex == OBJECT_KGY_LIMB_0B) {
Matrix_MultVec3f(&D_80B432D8, &this->unk_2A8);
}
- if (limbIndex == 16) {
+ if (limbIndex == OBJECT_KGY_LIMB_10) {
Matrix_MultVec3f(&D_80B432E4, &this->unk_2C0);
}
}
diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h
index 94f2aabd5..9a037ba9e 100644
--- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h
+++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h
@@ -2,6 +2,7 @@
#define Z_EN_KGY_H
#include "global.h"
+#include "objects/object_kgy/object_kgy.h"
#include "overlays/actors/ovl_En_Kbt/z_en_kbt.h"
#include "overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h"
@@ -15,8 +16,8 @@ typedef void (*EnKgyActionFunc)(struct EnKgy*, PlayState*);
typedef struct EnKgy {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s jointTable[23];
- /* 0x212 */ Vec3s morphTable[23];
+ /* 0x188 */ Vec3s jointTable[OBJECT_KGY_LIMB_MAX];
+ /* 0x212 */ Vec3s morphTable[OBJECT_KGY_LIMB_MAX];
/* 0x29C */ u16 unk_29C;
/* 0x2A0 */ EnKbt* zubora;
/* 0x2A4 */ ObjIcePoly* iceBlock;
@@ -24,10 +25,10 @@ typedef struct EnKgy {
/* 0x2B4 */ Vec3f unk_2B4;
/* 0x2C0 */ Vec3f unk_2C0;
/* 0x2CC */ Vec3s unk_2CC;
- /* 0x2D2 */ s16 unk_2D2;
+ /* 0x2D2 */ s16 animIndex;
/* 0x2D4 */ s16 csIdList[6];
/* 0x2E0 */ s16 csIdIndex;
- /* 0x2E2 */ s16 unk_2E2;
+ /* 0x2E2 */ s16 animIndex2;
/* 0x2E4 */ s16 unk_2E4;
/* 0x2E6 */ s16 unk_2E6;
/* 0x2E8 */ s16 unk_2E8;
diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c
index beb994374..24fa855c5 100644
--- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c
+++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c
@@ -173,6 +173,9 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) {
EnKujiya_SetupGivePrize(this);
EnKujiya_GivePrize(this, play);
break;
+
+ default:
+ break;
}
}
}
@@ -207,6 +210,9 @@ void EnKujiya_Talk(EnKujiya* this, PlayState* play) {
this->textId = 0x2B60; // Will announce winning numbers after 6
}
break;
+
+ default:
+ break;
}
}
@@ -251,6 +257,9 @@ s32 EnKujiya_CheckBoughtTicket(void) {
return true;
}
break;
+
+ default:
+ break;
}
return false;
}
@@ -268,6 +277,9 @@ void EnKujiya_SetBoughtTicket(void) {
case 3:
SET_WEEKEVENTREG(WEEKEVENTREG_33_40);
break;
+
+ default:
+ break;
}
}
@@ -287,6 +299,9 @@ void EnKujiya_UnsetBoughtTicket(void) {
case 3:
CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_40);
break;
+
+ default:
+ break;
}
}
diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
index 8bbbaca14..890fafd37 100644
--- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
+++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
@@ -571,6 +571,9 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) {
EnKusa_SetupUprootedWaitRegrow(this);
this->actor.shape.shadowDraw = NULL;
break;
+
+ default:
+ break;
}
} else {
@@ -621,9 +624,13 @@ void EnKusa_SetupCut(EnKusa* this) {
case ENKUSA_TYPE_GRASS_2:
this->actionFunc = EnKusa_DoNothing;
break;
+
case ENKUSA_TYPE_REGROWING_GRASS:
this->actionFunc = EnKusa_CutWaitRegrow;
break;
+
+ default:
+ break;
}
this->timer = 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 ac816517c..43f9a3d99 100644
--- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c
+++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c
@@ -57,8 +57,8 @@ static ColliderCylinderInit sCylinderInit = {
s32 func_809592E0(EnMk* this, s16 index) {
AnimationHeader* sAnimations[] = {
- &object_mk_Anim_001C38, &object_mk_Anim_000438, &object_mk_Anim_0007D8,
- &object_mk_Anim_0010F4, &object_mk_Anim_001964,
+ &gMarineResearcherIdleAnim, &gMarineResearcherHeadWaggleAnim, &gMarineResearcherYellAnim,
+ &gMarineResearcherShakeInFearAnim, &gMarineResearcherStrokeChinAnim,
};
if (index == this->unk_27C) {
@@ -82,8 +82,8 @@ void EnMk_Init(Actor* thisx, PlayState* play) {
this->actor.terminalVelocity = -4.0f;
this->actor.gravity = -1.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_006CA0, &object_mk_Anim_001C38, this->jointTable,
- this->morphTable, OBJECT_MK_LIMB_MAX);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gMarineResearcherSkel, &gMarineResearcherIdleAnim, this->jointTable,
+ this->morphTable, MARINE_RESEARCHER_LIMB_MAX);
this->unk_27C = -1;
func_809592E0(this, 0);
@@ -463,7 +463,7 @@ void EnMk_Update(Actor* thisx, PlayState* play) {
s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnMk* this = THIS;
- if (limbIndex == OBJECT_MK_LIMB_0B) {
+ if (limbIndex == MARINE_RESEARCHER_LIMB_HEAD) {
rot->y -= this->unk_270.y;
rot->z += this->unk_270.x;
}
@@ -475,7 +475,7 @@ Vec3f D_8095A2A0 = { 1000.0f, -100.0f, 0.0f };
void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnMk* this = THIS;
- if (limbIndex == OBJECT_MK_LIMB_0B) {
+ if (limbIndex == MARINE_RESEARCHER_LIMB_HEAD) {
Matrix_MultVec3f(&D_8095A2A0, &this->actor.focus.pos);
}
}
diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h
index 518b0406d..9d32e9374 100644
--- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h
+++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h
@@ -12,8 +12,8 @@ typedef struct EnMk {
/* 0x000 */ Actor actor;
/* 0x144 */ ColliderCylinder collider;
/* 0x190 */ SkelAnime skelAnime;
- /* 0x1D4 */ Vec3s jointTable[OBJECT_MK_LIMB_MAX];
- /* 0x222 */ Vec3s morphTable[OBJECT_MK_LIMB_MAX];
+ /* 0x1D4 */ Vec3s jointTable[MARINE_RESEARCHER_LIMB_MAX];
+ /* 0x222 */ Vec3s morphTable[MARINE_RESEARCHER_LIMB_MAX];
/* 0x270 */ Vec3s unk_270;
/* 0x276 */ s16 csIdList[2];
/* 0x27A */ u16 unk_27A;
diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
index 73f1111a5..5ebdcd43f 100644
--- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
+++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
@@ -115,7 +115,7 @@ void EnPr2_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.damageTable = &sDamageTable;
SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable,
- this->morphtable, 5);
+ this->morphTable, 5);
this->unk_1E0 = ENPR2_GET_F(&this->actor);
this->actor.colChkInfo.mass = 10;
Math_Vec3f_Copy(&this->unk_228, &this->actor.home.pos);
diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h
index 94fb7e033..7d462b639 100644
--- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h
+++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h
@@ -17,7 +17,7 @@ typedef struct EnPr2 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[5];
- /* 0x1A6 */ Vec3s morphtable[5];
+ /* 0x1A6 */ Vec3s morphTable[5];
/* 0x1C4 */ EnPr2ActionFunc actionFunc;
/* 0x1C8 */ s16 pathIndex;
/* 0x1CC */ Path* path;
diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c
index 6b2e06f0b..3e3ecc621 100644
--- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c
+++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c
@@ -1381,53 +1381,62 @@ void EnSGoro_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
s32 overrideRot;
EnSGoro* this = THIS;
- if (limbIndex != GORON_LIMB_BODY) {
- if ((limbIndex == GORON_LIMB_HEAD) && (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY)) {
- if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
- overrideRot = true;
- } else {
- overrideRot = false;
+ switch (limbIndex) {
+ case GORON_LIMB_HEAD:
+ if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
+ if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
+ overrideRot = true;
+ } else {
+ overrideRot = false;
+ }
+ if (this->loseAttentionTimer != 0) {
+ stepRot = true;
+ } else {
+ stepRot = false;
+ }
+
+ EnSGoro_UpdateLimb(this->headRotZ + this->bodyRotZ + 0x4000,
+ this->headRotY + this->bodyRotY + this->actor.shape.rot.y + 0x4000,
+ &this->headTranslate, &this->headRotate, stepRot, overrideRot);
+
+ Matrix_Pop();
+ Matrix_Translate(this->headTranslate.x, this->headTranslate.y, this->headTranslate.z, MTXMODE_NEW);
+ Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
+ Matrix_RotateYS(this->headRotate.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->headRotate.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->headRotate.z, MTXMODE_APPLY);
+ Matrix_Push();
}
- if (this->loseAttentionTimer != 0) {
- stepRot = true;
- } else {
- stepRot = false;
+ break;
+
+ case GORON_LIMB_BODY:
+ if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
+ if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
+ overrideRot = true;
+ } else {
+ overrideRot = false;
+ }
+ if (this->loseAttentionTimer != 0) {
+ stepRot = true;
+ } else {
+ stepRot = false;
+ }
+
+ EnSGoro_UpdateLimb(this->bodyRotZ + 0x4000, this->bodyRotY + this->actor.shape.rot.y + 0x4000,
+ &this->bodyTranslate, &this->bodyRotate, stepRot, overrideRot);
+
+ Matrix_Pop();
+ Matrix_Translate(this->bodyTranslate.x, this->bodyTranslate.y, this->bodyTranslate.z, MTXMODE_NEW);
+ Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
+ Matrix_RotateYS(this->bodyRotate.y, MTXMODE_APPLY);
+ Matrix_RotateXS(this->bodyRotate.x, MTXMODE_APPLY);
+ Matrix_RotateZS(this->bodyRotate.z, MTXMODE_APPLY);
+ Matrix_Push();
}
+ break;
- EnSGoro_UpdateLimb(this->headRotZ + this->bodyRotZ + 0x4000,
- this->headRotY + this->bodyRotY + this->actor.shape.rot.y + 0x4000, &this->headTranslate,
- &this->headRotate, stepRot, overrideRot);
-
- Matrix_Pop();
- Matrix_Translate(this->headTranslate.x, this->headTranslate.y, this->headTranslate.z, MTXMODE_NEW);
- Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- Matrix_RotateYS(this->headRotate.y, MTXMODE_APPLY);
- Matrix_RotateXS(this->headRotate.x, MTXMODE_APPLY);
- Matrix_RotateZS(this->headRotate.z, MTXMODE_APPLY);
- Matrix_Push();
- }
- } else if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
- if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
- overrideRot = true;
- } else {
- overrideRot = false;
- }
- if (this->loseAttentionTimer != 0) {
- stepRot = true;
- } else {
- stepRot = false;
- }
-
- EnSGoro_UpdateLimb(this->bodyRotZ + 0x4000, this->bodyRotY + this->actor.shape.rot.y + 0x4000,
- &this->bodyTranslate, &this->bodyRotate, stepRot, overrideRot);
-
- Matrix_Pop();
- Matrix_Translate(this->bodyTranslate.x, this->bodyTranslate.y, this->bodyTranslate.z, MTXMODE_NEW);
- Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- Matrix_RotateYS(this->bodyRotate.y, MTXMODE_APPLY);
- Matrix_RotateXS(this->bodyRotate.x, MTXMODE_APPLY);
- Matrix_RotateZS(this->bodyRotate.z, MTXMODE_APPLY);
- Matrix_Push();
+ default:
+ break;
}
}
diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
index 605761711..c7006f087 100644
--- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
+++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
@@ -636,7 +636,7 @@ void EnSsh_Init(Actor* thisx, PlayState* play) {
EnSsh* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
- SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphtable, 30);
+ SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphTable, 30);
Animation_Change(&this->skelAnime, &object_ssh_Anim_001494, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f);
this->blureIdx = EnSsh_CreateBlureEffect(play);
EnSsh_InitColliders(this, play);
diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h
index 6f19a5e51..8c95ea628 100644
--- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h
+++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h
@@ -31,7 +31,7 @@ typedef struct EnSsh {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[30];
- /* 0x23C */ Vec3s morphtable[30];
+ /* 0x23C */ Vec3s morphTable[30];
/* 0x2F0 */ EnSshActionFunc actionFunc;
/* 0x2F4 */ ColliderCylinder collider1[6];
/* 0x4BC */ ColliderJntSph collider2;
diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
index 5dc86c745..cbd94d808 100644
--- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
+++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
@@ -248,7 +248,8 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
}
} else {
- if (++sNumLitTorchesInGroup >= groupSize) {
+ sNumLitTorchesInGroup++;
+ if (sNumLitTorchesInGroup >= groupSize) {
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH;
} else {
this->snuffTimer =
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index 22fca02c8..d01dbd3be 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -64,9 +64,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input);
s32 Player_StartFishing(PlayState* play);
void func_8085B170(PlayState* play, Player* this);
s32 func_8083A658(PlayState* play, Player* this);
-void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction);
+void Player_InitItemAction(PlayState* play, Player* this, PlayerItemAction itemAction);
-void func_80831990(PlayState* play, Player* this, ItemId item);
+void Player_UseItem(PlayState* play, Player* this, ItemId item);
void func_80836988(Player* this, PlayState* play);
@@ -210,7 +210,7 @@ void Player_Action_97(Player* this, PlayState* play);
s32 Player_UpperAction_0(Player* this, PlayState* play);
s32 Player_UpperAction_1(Player* this, PlayState* play);
-s32 Player_UpperAction_2(Player* this, PlayState* play);
+s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play);
s32 Player_UpperAction_3(Player* this, PlayState* play);
s32 Player_UpperAction_4(Player* this, PlayState* play);
s32 Player_UpperAction_5(Player* this, PlayState* play);
@@ -233,21 +233,21 @@ void Player_InitItemAction_SpawnExplosive(PlayState* play, Player* this);
void Player_InitItemAction_SpawnHookshot(PlayState* play, Player* this);
void Player_InitItemAction_5(PlayState* play, Player* this);
-s32 func_80839518(Player* this, PlayState* play);
-s32 func_808365DC(Player* this, PlayState* play);
-s32 func_8083D23C(Player* this, PlayState* play);
-s32 func_8083CCB4(Player* this, PlayState* play);
-s32 func_808391D8(Player* this, PlayState* play);
-s32 func_8083DFC4(Player* this, PlayState* play);
-s32 func_8083A114(Player* this, PlayState* play);
-s32 func_80848570(Player* this, PlayState* play);
-s32 func_8083A580(Player* this, PlayState* play);
-s32 func_8083D78C(Player* this, PlayState* play);
-s32 func_80839B18(Player* this, PlayState* play);
-s32 func_8083A274(Player* this, PlayState* play);
-s32 func_80834DFC(Player* this, PlayState* play);
-s32 func_80838A90(Player* this, PlayState* play);
-s32 func_8083A0CC(Player* this, PlayState* play);
+s32 Player_ActionChange_0(Player* this, PlayState* play);
+s32 Player_ActionChange_1(Player* this, PlayState* play);
+s32 Player_ActionChange_2(Player* this, PlayState* play);
+s32 Player_ActionChange_3(Player* this, PlayState* play);
+s32 Player_ActionChange_4(Player* this, PlayState* play);
+s32 Player_ActionChange_5(Player* this, PlayState* play);
+s32 Player_ActionChange_6(Player* this, PlayState* play);
+s32 Player_ActionChange_7(Player* this, PlayState* play);
+s32 Player_ActionChange_8(Player* this, PlayState* play);
+s32 Player_ActionChange_9(Player* this, PlayState* play);
+s32 Player_ActionChange_10(Player* this, PlayState* play);
+s32 Player_ActionChange_11(Player* this, PlayState* play);
+s32 Player_ActionChange_12(Player* this, PlayState* play);
+s32 Player_ActionChange_13(Player* this, PlayState* play);
+s32 Player_ActionChange_14(Player* this, PlayState* play);
/* Init Mode functions */
void Player_InitMode_0(PlayState* play, Player* this);
@@ -468,10 +468,10 @@ typedef struct MeleeWeaponDamageInfo {
/* 0x7 */ u8 dmgHumanStrong;
} MeleeWeaponDamageInfo; // size = 0x8
-typedef struct struct_8085CC88 {
+typedef struct ItemChangeInfo {
/* 0x0 */ PlayerAnimationHeader* anim;
- /* 0x4 */ u8 frame;
-} struct_8085CC88; // size = 0x8
+ /* 0x4 */ u8 changeFrame;
+} ItemChangeInfo; // size = 0x8
typedef struct {
/* 0x0 */ u8 itemId;
@@ -504,7 +504,7 @@ typedef struct struct_8085D200 {
f32 sPlayerControlStickMagnitude;
s16 sPlayerControlStickAngle;
s16 D_80862B02; // analog stick yaw + camera yaw
-s32 D_80862B04; // boolean, set to the return value of func_8083216C
+s32 D_80862B04; // boolean, set to the return value of Player_UpdateUpperBody
FloorType sPlayerFloorType;
u32 sPlayerTouchedWallFlags;
ConveyorSpeed sPlayerConveyorSpeedIndex;
@@ -520,10 +520,10 @@ Vec3f sPlayerInteractWallCheckResult;
f32 D_80862B3C;
FloorEffect sPlayerFloorEffect;
Input* sPlayerControlInput;
-s32 D_80862B48;
-s32 D_80862B4C;
-EnvLightSettings D_80862B50; // backup of play->envCtx.lightSettings
-s32 D_80862B6C; // this->skelAnime.moveFlags // sPlayerSkelMoveFlags?
+s32 sPlayerUseHeldItem; // When true, the current held item is used. Is reset to false every frame.
+s32 sPlayerHeldItemButtonIsHeldDown; // Indicates if the button for the current held item is held down.
+EnvLightSettings D_80862B50; // backup of play->envCtx.lightSettings
+s32 D_80862B6C; // this->skelAnime.moveFlags // sPlayerSkelMoveFlags?
s32 func_8082DA90(PlayState* play) {
return (play->transitionTrigger != TRANS_TRIGGER_OFF) || (play->transitionMode != TRANS_MODE_OFF);
@@ -586,7 +586,7 @@ void func_8082DC64(PlayState* play, Player* this) {
this->stateFlags2 &= ~(PLAYER_STATE2_400 | PLAYER_STATE2_800);
}
-void func_8082DCA0(PlayState* play, Player* this) {
+void Player_DetachHeldActor(PlayState* play, Player* this) {
Actor* heldActor = this->heldActor;
if ((heldActor != NULL) && !Player_IsHoldingHookshot(this)) {
@@ -598,7 +598,7 @@ void func_8082DCA0(PlayState* play, Player* this) {
}
if (Player_GetExplosiveHeld(this) > PLAYER_EXPLOSIVE_NONE) {
- func_8082F8BC(play, this, PLAYER_IA_NONE);
+ Player_InitItemAction(play, this, PLAYER_IA_NONE);
this->heldItemId = ITEM_FE;
}
}
@@ -632,7 +632,7 @@ void func_8082DD2C(PlayState* play, Player* this) {
s32 func_8082DE14(PlayState* play, Player* this) {
if (this->heldItemAction > PLAYER_IA_LAST_USED) {
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
return true;
} else {
return false;
@@ -641,7 +641,7 @@ s32 func_8082DE14(PlayState* play, Player* this) {
void func_8082DE50(PlayState* play, Player* this) {
func_8082DD2C(play, this);
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
}
s32 func_8082DE88(Player* this, s32 arg1, s32 arg2) {
@@ -663,7 +663,7 @@ void func_8082DF2C(PlayState* play) {
}
}
-u8 D_8085B9F0[PLAYER_LIMB_MAX] = {
+u8 sPlayerUpperBodyLimbCopyMap[PLAYER_LIMB_MAX] = {
false, // PLAYER_LIMB_NONE
false, // PLAYER_LIMB_ROOT
false, // PLAYER_LIMB_WAIST
@@ -2863,30 +2863,30 @@ void func_8082F1AC(PlayState* play, Player* this) {
void Player_SetUpperAction(PlayState* play, Player* this, PlayerUpperActionFunc upperActionFunc) {
this->upperActionFunc = upperActionFunc;
this->unk_ACE = 0;
- this->unk_AC8 = 0.0f;
+ this->skelAnimeUpperBlendWeight = 0.0f;
func_8082E00C(this);
}
#define GET_PLAYER_ANIM(group, type) ((PlayerAnimationHeader**)D_8085BE84)[group * PLAYER_ANIMTYPE_MAX + type]
-void func_8082F470(PlayState* play, Player* this, PlayerItemAction itemAction) {
+void Player_InitItemActionWithAnim(PlayState* play, Player* this, PlayerItemAction itemAction) {
PlayerAnimationHeader* curAnim = this->skelAnime.animation;
PlayerAnimationHeader*(*iter)[PLAYER_ANIMTYPE_MAX] = (void*)&D_8085BE84[0][this->modelAnimType];
- s32 i;
+ s32 animGroup;
this->stateFlags1 &= ~(PLAYER_STATE1_8 | PLAYER_STATE1_1000000);
- for (i = 0; i < PLAYER_ANIMGROUP_MAX; i++) {
+ for (animGroup = 0; animGroup < PLAYER_ANIMGROUP_MAX; animGroup++) {
if (curAnim == **iter) {
break;
}
iter++;
}
- func_8082F8BC(play, this, itemAction);
+ Player_InitItemAction(play, this, itemAction);
- if (i < PLAYER_ANIMGROUP_MAX) {
- this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType);
+ if (animGroup < PLAYER_ANIMGROUP_MAX) {
+ this->skelAnime.animation = GET_PLAYER_ANIM(animGroup, this->modelAnimType);
}
}
@@ -2988,7 +2988,7 @@ PlayerItemAction Player_ItemToItemAction(Player* this, ItemId item) {
}
}
-PlayerUpperActionFunc D_8085C9F0[PLAYER_IA_MAX] = {
+PlayerUpperActionFunc sPlayerUpperActionUpdateFuncs[PLAYER_IA_MAX] = {
Player_UpperAction_0, // PLAYER_IA_NONE
Player_UpperAction_0, // PLAYER_IA_LAST_USED
Player_UpperAction_0, // PLAYER_IA_FISHING_ROD
@@ -3076,7 +3076,7 @@ PlayerUpperActionFunc D_8085C9F0[PLAYER_IA_MAX] = {
typedef void (*PlayerInitItemActionFunc)(PlayState*, Player*);
-PlayerInitItemActionFunc sPlayerInitItemActionFuncs[PLAYER_IA_MAX] = {
+PlayerInitItemActionFunc sPlayerItemActionInitFuncs[PLAYER_IA_MAX] = {
Player_InitItemAction_DoNothing, // PLAYER_IA_NONE
Player_InitItemAction_DoNothing, // PLAYER_IA_LAST_USED
Player_InitItemAction_DoNothing, // PLAYER_IA_FISHING_ROD
@@ -3189,27 +3189,94 @@ void func_8082F5FC(Player* this, Actor* actor) {
this->stateFlags1 |= PLAYER_STATE1_800;
}
-struct_8085CC88 D_8085CC88[] = {
- { &gPlayerAnim_link_normal_free2free, 12 },
- { &gPlayerAnim_link_normal_normal2fighter, 6 },
- { &gPlayerAnim_link_hammer_normal2long, 8 },
- { &gPlayerAnim_link_normal_normal2free, 8 },
- { &gPlayerAnim_link_fighter_fighter2long, 8 },
- { &gPlayerAnim_link_normal_fighter2free, 10 },
- { &gPlayerAnim_link_hammer_long2free, 7 },
- { &gPlayerAnim_link_hammer_long2long, 11 },
- { &gPlayerAnim_link_normal_free2free, 12 },
- { &gPlayerAnim_link_normal_normal2bom, 4 },
- { &gPlayerAnim_link_normal_long2bom, 4 },
- { &gPlayerAnim_link_normal_free2bom, 4 },
- { &gPlayerAnim_link_anchor_anchor2fighter, 5 },
- { &gPlayerAnim_link_normal_free2freeB, 13 },
- { &gPlayerAnim_pz_bladeon, 4 },
+typedef enum ItemChangeType {
+ /* 0 */ PLAYER_ITEM_CHG_0,
+ /* 1 */ PLAYER_ITEM_CHG_1,
+ /* 2 */ PLAYER_ITEM_CHG_2,
+ /* 3 */ PLAYER_ITEM_CHG_3,
+ /* 4 */ PLAYER_ITEM_CHG_4,
+ /* 5 */ PLAYER_ITEM_CHG_5,
+ /* 6 */ PLAYER_ITEM_CHG_6,
+ /* 7 */ PLAYER_ITEM_CHG_7,
+ /* 8 */ PLAYER_ITEM_CHG_8,
+ /* 9 */ PLAYER_ITEM_CHG_9,
+ /* 10 */ PLAYER_ITEM_CHG_10,
+ /* 11 */ PLAYER_ITEM_CHG_11,
+ /* 12 */ PLAYER_ITEM_CHG_12,
+ /* 13 */ PLAYER_ITEM_CHG_13,
+ /* 14 */ PLAYER_ITEM_CHG_14,
+ /* 15 */ PLAYER_ITEM_CHG_MAX
+} ItemChangeType;
+
+ItemChangeInfo sPlayerItemChangeInfo[PLAYER_ITEM_CHG_MAX] = {
+ { &gPlayerAnim_link_normal_free2free, 12 }, // PLAYER_ITEM_CHG_0
+ { &gPlayerAnim_link_normal_normal2fighter, 6 }, // PLAYER_ITEM_CHG_1
+ { &gPlayerAnim_link_hammer_normal2long, 8 }, // PLAYER_ITEM_CHG_2
+ { &gPlayerAnim_link_normal_normal2free, 8 }, // PLAYER_ITEM_CHG_3
+ { &gPlayerAnim_link_fighter_fighter2long, 8 }, // PLAYER_ITEM_CHG_4
+ { &gPlayerAnim_link_normal_fighter2free, 10 }, // PLAYER_ITEM_CHG_5
+ { &gPlayerAnim_link_hammer_long2free, 7 }, // PLAYER_ITEM_CHG_6
+ { &gPlayerAnim_link_hammer_long2long, 11 }, // PLAYER_ITEM_CHG_7
+ { &gPlayerAnim_link_normal_free2free, 12 }, // PLAYER_ITEM_CHG_8
+ { &gPlayerAnim_link_normal_normal2bom, 4 }, // PLAYER_ITEM_CHG_9
+ { &gPlayerAnim_link_normal_long2bom, 4 }, // PLAYER_ITEM_CHG_10
+ { &gPlayerAnim_link_normal_free2bom, 4 }, // PLAYER_ITEM_CHG_11
+ { &gPlayerAnim_link_anchor_anchor2fighter, 5 }, // PLAYER_ITEM_CHG_12
+ { &gPlayerAnim_link_normal_free2freeB, 13 }, // PLAYER_ITEM_CHG_13
+ { &gPlayerAnim_pz_bladeon, 4 }, // PLAYER_ITEM_CHG_14
};
-s8 D_8085CD00[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = {
- { 8, -5, -3, -6, 8, 0xB }, { 5, 0, -1, 4, 5, 9 }, { 3, 1, 0, 2, 3, 9 },
- { 6, -4, -2, 7, 6, 0xA }, { 8, -5, -3, -6, 8, 0xB }, { 8, -5, -3, -6, 8, 0xB },
+// Maps the appropriate ItemChangeType based on current and next animtype.
+// A negative type value means the corresponding animation should be played in reverse.
+s8 sPlayerItemChangeTypes[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = {
+ {
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_DEFAULT
+ -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_1
+ -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_2
+ -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_5
+ },
+ {
+ PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_DEFAULT
+ PLAYER_ITEM_CHG_0, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_1
+ -PLAYER_ITEM_CHG_1, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_2
+ PLAYER_ITEM_CHG_4, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_9, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_5
+ },
+ {
+ PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_DEFAULT
+ PLAYER_ITEM_CHG_1, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_1
+ PLAYER_ITEM_CHG_0, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_2
+ PLAYER_ITEM_CHG_2, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_9, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_5
+ },
+ {
+ PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_DEFAULT
+ -PLAYER_ITEM_CHG_4, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_1
+ -PLAYER_ITEM_CHG_2, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_2
+ PLAYER_ITEM_CHG_7, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_10, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_5
+ },
+ {
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_DEFAULT
+ -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_1
+ -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_2
+ -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_5
+ },
+ {
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_DEFAULT
+ -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_1
+ -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_2
+ -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_3
+ PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_4
+ PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_5
+ },
};
ExplosiveInfo sPlayerExplosiveInfo[PLAYER_EXPLOSIVE_MAX] = {
@@ -3271,7 +3338,7 @@ void Player_InitItemAction_SpawnHookshot(PlayState* play, Player* this) {
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0);
if (this->heldActor == NULL) {
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
return;
}
armsHook = (ArmsHook*)this->heldActor;
@@ -3283,7 +3350,7 @@ void Player_InitItemAction_5(PlayState* play, Player* this) {
this->stateFlags1 |= PLAYER_STATE1_1000000;
}
-void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction) {
+void Player_InitItemAction(PlayState* play, Player* this, PlayerItemAction itemAction) {
this->itemAction = this->heldItemAction = itemAction;
this->modelGroup = this->nextModelGroup;
@@ -3293,7 +3360,7 @@ void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction) {
this->unk_B0C = 0.0f;
this->unk_B28 = 0;
- sPlayerInitItemActionFuncs[itemAction](play, this);
+ sPlayerItemActionInitFuncs[itemAction](play, this);
Player_SetModelGroup(this, this->modelGroup);
}
@@ -3528,7 +3595,7 @@ void func_8082FC60(Player* this) {
this->unk_B40 = 0.0f;
}
-s32 func_8082FC78(Player* this, ItemId item) {
+s32 Player_ItemIsInUse(Player* this, ItemId item) {
if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == this->itemAction)) {
return true;
} else {
@@ -3536,7 +3603,7 @@ s32 func_8082FC78(Player* this, ItemId item) {
}
}
-s32 func_8082FCC4(Player* this, ItemId item, PlayerItemAction itemAction) {
+s32 Player_ItemIsItemAction(Player* this, ItemId item, PlayerItemAction itemAction) {
if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == itemAction)) {
return true;
} else {
@@ -3548,7 +3615,7 @@ EquipSlot func_8082FD0C(Player* this, PlayerItemAction itemAction) {
s32 btn;
for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) {
- if (func_8082FCC4(this, GET_CUR_FORM_BTN_ITEM(btn), itemAction)) {
+ if (Player_ItemIsItemAction(this, GET_CUR_FORM_BTN_ITEM(btn), itemAction)) {
return btn;
}
}
@@ -3556,7 +3623,7 @@ EquipSlot func_8082FD0C(Player* this, PlayerItemAction itemAction) {
return EQUIP_SLOT_NONE;
}
-u16 D_8085CFA8[] = {
+u16 sPlayerItemButtons[] = {
BTN_B,
BTN_CLEFT,
BTN_CDOWN,
@@ -3567,8 +3634,8 @@ u16 D_8085CFA8[] = {
EquipSlot func_8082FDC4(void) {
EquipSlot i;
- for (i = 0; i < ARRAY_COUNT(D_8085CFA8); i++) {
- if (CHECK_BTN_ALL(sPlayerControlInput->press.button, D_8085CFA8[i])) {
+ for (i = 0; i < ARRAY_COUNT(sPlayerItemButtons); i++) {
+ if (CHECK_BTN_ALL(sPlayerControlInput->press.button, sPlayerItemButtons[i])) {
break;
}
}
@@ -3576,7 +3643,10 @@ EquipSlot func_8082FDC4(void) {
return i;
}
-void func_8082FE0C(Player* this, PlayState* play) {
+/**
+ * Handles the high level item usage and changing process based on the B and C buttons.
+ */
+void Player_ProcessItemButtons(Player* this, PlayState* play) {
if (this->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000)) {
return;
}
@@ -3602,7 +3672,7 @@ void func_8082FE0C(Player* this, PlayState* play) {
if ((maskIdMinusOne < PLAYER_MASK_TRUTH - 1) || (maskIdMinusOne >= PLAYER_MASK_MAX - 1)) {
maskIdMinusOne = this->currentMask - 1;
}
- func_80831990(play, this, Player_MaskIdToItemId(maskIdMinusOne));
+ Player_UseItem(play, this, Player_MaskIdToItemId(maskIdMinusOne));
return;
}
@@ -3616,10 +3686,11 @@ void func_8082FE0C(Player* this, PlayState* play) {
if (((this->actor.id == ACTOR_PLAYER) && (this->itemAction >= PLAYER_IA_FISHING_ROD)) &&
!(((Player_GetHeldBButtonSword(this) == PLAYER_B_SWORD_NONE) || (gSaveContext.jinxTimer == 0)) &&
- (func_8082FC78(this, (IREG(1) != 0) ? ITEM_FISHING_ROD : Inventory_GetBtnBItem(play)) ||
- func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_LEFT)) || func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_DOWN)) ||
- func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_RIGHT))))) {
- func_80831990(play, this, ITEM_NONE);
+ (Player_ItemIsInUse(this, (IREG(1) != 0) ? ITEM_FISHING_ROD : Inventory_GetBtnBItem(play)) ||
+ Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_LEFT)) ||
+ Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_DOWN)) ||
+ Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_RIGHT))))) {
+ Player_UseItem(play, this, ITEM_NONE);
} else {
s32 pad;
ItemId item;
@@ -3630,17 +3701,18 @@ void func_8082FE0C(Player* this, PlayState* play) {
? EQUIP_SLOT_B
: i;
- item = func_8012364C(play, this, i);
+ item = Player_GetItemOnButton(play, this, i);
+
if (item >= ITEM_FD) {
- for (i = 0; i < ARRAY_COUNT(D_8085CFA8); i++) {
- if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, D_8085CFA8[i])) {
+ for (i = 0; i < ARRAY_COUNT(sPlayerItemButtons); i++) {
+ if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, sPlayerItemButtons[i])) {
break;
}
}
- item = func_8012364C(play, this, i);
+ item = Player_GetItemOnButton(play, this, i);
if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == this->heldItemAction)) {
- D_80862B4C = 1;
+ sPlayerHeldItemButtonIsHeldDown = true;
}
} else if (item == ITEM_F0) {
if (this->blastMaskTimer == 0) {
@@ -3664,44 +3736,45 @@ void func_8082FE0C(Player* this, PlayState* play) {
}
} else {
this->heldItemButton = i;
- func_80831990(play, this, item);
+ Player_UseItem(play, this, item);
}
}
}
-void func_808302CC(Player* this, PlayState* play) {
+void Player_StartChangingHeldItem(Player* this, PlayState* play) {
PlayerAnimationHeader* anim;
s32 pad[3];
u8 nextModelAnimType;
- s32 var_v1;
- s8 itemAction = Player_ItemToItemAction(this, this->heldItemId);
+ s32 itemChangeType;
+ s8 heldItemAction = Player_ItemToItemAction(this, this->heldItemId);
s32 pad3;
f32 startFrame;
f32 endFrame;
f32 frameSpeed;
- Player_SetUpperAction(play, this, Player_UpperAction_2);
+ Player_SetUpperAction(play, this, Player_UpperAction_ChangeHeldItem);
nextModelAnimType = gPlayerModelTypes[this->nextModelGroup].modelAnimType;
- var_v1 = D_8085CD00[gPlayerModelTypes[this->modelGroup].modelAnimType][nextModelAnimType];
+ itemChangeType = sPlayerItemChangeTypes[gPlayerModelTypes[this->modelGroup].modelAnimType][nextModelAnimType];
- if ((itemAction == PLAYER_IA_ZORA_FINS) || (this->heldItemAction == PLAYER_IA_ZORA_FINS)) {
- var_v1 = (itemAction == PLAYER_IA_NONE) ? -14 : 14;
- } else if ((itemAction == PLAYER_IA_BOTTLE_EMPTY) || (itemAction == PLAYER_IA_11) ||
- ((itemAction == PLAYER_IA_NONE) &&
+ if ((heldItemAction == PLAYER_IA_ZORA_FINS) || (this->heldItemAction == PLAYER_IA_ZORA_FINS)) {
+ itemChangeType = (heldItemAction == PLAYER_IA_NONE) ? -PLAYER_ITEM_CHG_14 : PLAYER_ITEM_CHG_14;
+ } else if ((heldItemAction == PLAYER_IA_BOTTLE_EMPTY) || (heldItemAction == PLAYER_IA_11) ||
+ ((heldItemAction == PLAYER_IA_NONE) &&
((this->heldItemAction == PLAYER_IA_BOTTLE_EMPTY) || (this->heldItemAction == PLAYER_IA_11)))) {
- var_v1 = (itemAction == PLAYER_IA_NONE) ? -13 : 13;
+ itemChangeType = (heldItemAction == PLAYER_IA_NONE) ? -PLAYER_ITEM_CHG_13 : PLAYER_ITEM_CHG_13;
}
- this->unk_14E = ABS_ALT(var_v1);
- anim = D_8085CC88[this->unk_14E].anim;
+ this->itemChangeType = ABS_ALT(itemChangeType);
+ anim = sPlayerItemChangeInfo[this->itemChangeType].anim;
+
if ((anim == &gPlayerAnim_link_normal_fighter2free) && (this->currentShield == PLAYER_SHIELD_NONE)) {
anim = &gPlayerAnim_link_normal_free2fighter_free;
}
endFrame = Animation_GetLastFrame(anim);
- if (var_v1 >= 0) {
+ if (itemChangeType >= 0) {
frameSpeed = 1.2f;
startFrame = 0.0f;
} else {
@@ -3710,30 +3783,31 @@ void func_808302CC(Player* this, PlayState* play) {
endFrame = 0.0f;
}
- if (itemAction != PLAYER_IA_NONE) {
+ if (heldItemAction != PLAYER_IA_NONE) {
frameSpeed *= 2.0f;
}
- PlayerAnimation_Change(play, &this->unk_284, anim, frameSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f);
- this->stateFlags3 &= ~PLAYER_STATE3_40000000;
+ PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, frameSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f);
+
+ this->stateFlags3 &= ~PLAYER_STATE3_START_CHANGING_HELD_ITEM;
}
-void func_808304BC(Player* this, PlayState* play) {
- if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags3 & PLAYER_STATE3_40000000)) {
+void Player_UpdateItems(Player* this, PlayState* play) {
+ if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM)) {
if ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_400000)) {
if ((gSaveContext.save.saveInfo.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE)) {
if ((this->csMode == PLAYER_CSMODE_NONE) && (play->unk_1887C == 0) &&
(play->activeCamId == CAM_ID_MAIN)) {
if (!func_8082DA90(play) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] != TIMER_STATE_STOP)) {
- func_8082FE0C(this, play);
+ Player_ProcessItemButtons(this, play);
}
}
}
}
}
- if (this->stateFlags3 & PLAYER_STATE3_40000000) {
- func_808302CC(this, play);
+ if (this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) {
+ Player_StartChangingHeldItem(this, play);
}
}
@@ -3836,8 +3910,7 @@ s32 func_808306F8(Player* this, PlayState* play) {
return false;
}
-// Take out / put away sounds?
-void func_808308DC(PlayState* play, Player* this) {
+void Player_FinishItemChange(PlayState* play, Player* this) {
s32 isGoronOrDeku = (this->transformation == PLAYER_FORM_GORON) || (this->transformation == PLAYER_FORM_DEKU);
if ((this->heldItemAction != PLAYER_IA_NONE) && !isGoronOrDeku) {
@@ -3848,7 +3921,7 @@ void func_808308DC(PlayState* play, Player* this) {
}
}
- func_80831990(play, this, this->heldItemId);
+ Player_UseItem(play, this, this->heldItemId);
if (!isGoronOrDeku) {
if (Player_SwordFromIA(this, this->heldItemAction) > PLAYER_SWORD_NONE) {
@@ -3860,15 +3933,15 @@ void func_808308DC(PlayState* play, Player* this) {
}
void func_808309CC(PlayState* play, Player* this) {
- if (Player_UpperAction_2 == this->upperActionFunc) {
- func_808308DC(play, this);
+ if (Player_UpperAction_ChangeHeldItem == this->upperActionFunc) {
+ Player_FinishItemChange(play, this);
}
- Player_SetUpperAction(play, this, D_8085C9F0[this->heldItemAction]);
+ Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]);
this->unk_ACC = 0;
this->unk_AA4 = 0;
- func_8082DCA0(play, this);
- this->stateFlags3 &= ~PLAYER_STATE3_40000000;
+ Player_DetachHeldActor(play, this);
+ this->stateFlags3 &= ~PLAYER_STATE3_START_CHANGING_HELD_ITEM;
}
PlayerAnimationHeader* D_8085CFBC[2] = {
@@ -3894,7 +3967,7 @@ PlayerAnimationHeader* D_8085CFDC[2] = {
PlayerAnimationHeader* func_80830A58(PlayState* play, Player* this) {
Player_SetUpperAction(play, this, Player_UpperAction_3);
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
if (this->unk_B40 < 0.5f) {
return D_8085CFBC[Player_IsHoldingTwoHandedWeapon(this)];
@@ -3933,9 +4006,9 @@ s32 func_80830B88(PlayState* play, Player* this) {
(this->currentShield != PLAYER_SHIELD_NONE))) &&
func_8082FBE8(this))) {
PlayerAnimationHeader* anim = func_80830A58(play, this);
- f32 lastFrame = Animation_GetLastFrame(anim);
+ f32 endFrame = Animation_GetLastFrame(anim);
- PlayerAnimation_Change(play, &this->unk_284, anim, 3.0f / 3.0f, lastFrame, lastFrame,
+ PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, 3.0f / 3.0f, endFrame, endFrame,
ANIMMODE_ONCE, 0.0f);
func_80830AE8(this);
return true;
@@ -3955,26 +4028,28 @@ void func_80830CE8(PlayState* play, Player* this) {
func_80123C58(this);
}
- Animation_Reverse(&this->unk_284);
+ Animation_Reverse(&this->skelAnimeUpper);
func_80830B38(this);
}
-void func_80830D40(PlayState* play, Player* this) {
- struct_8085CC88* entry = &D_8085CC88[this->unk_14E];
- f32 frame = entry->frame;
+void Player_WaitToFinishItemChange(PlayState* play, Player* this) {
+ ItemChangeInfo* itemChangeEntry = &sPlayerItemChangeInfo[this->itemChangeType];
+ f32 changeFrame = itemChangeEntry->changeFrame;
- if (this->unk_284.playSpeed < 0.0f) {
- frame -= 1.0f;
+ if (this->skelAnimeUpper.playSpeed < 0.0f) {
+ changeFrame -= 1.0f;
}
- if (PlayerAnimation_OnFrame(&this->unk_284, frame)) {
- func_808308DC(play, this);
+
+ if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, changeFrame)) {
+ Player_FinishItemChange(play, this);
}
+
func_8082FB68(this);
}
s32 func_80830DF0(Player* this, PlayState* play) {
- if (this->stateFlags3 & PLAYER_STATE3_40000000) {
- func_808302CC(this, play);
+ if (this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) {
+ Player_StartChangingHeldItem(this, play);
} else {
return false;
}
@@ -3985,7 +4060,7 @@ s32 func_80830E30(Player* this, PlayState* play) {
if ((this->heldItemAction == PLAYER_IA_11) || (this->transformation == PLAYER_FORM_ZORA)) {
Player_SetUpperAction(play, this, Player_UpperAction_12);
- PlayerAnimation_PlayOnce(play, &this->unk_284,
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper,
(this->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_LEFT)
? &gPlayerAnim_pz_cutterwaitA
: ((this->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_COMBO)
@@ -3997,7 +4072,7 @@ s32 func_80830E30(Player* this, PlayState* play) {
return false;
}
- PlayerAnimation_PlayOnce(play, &this->unk_284,
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper,
(Player_IsHoldingHookshot(this))
? &gPlayerAnim_link_hook_shot_ready
: ((this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_tamahakidf
@@ -4036,7 +4111,7 @@ s32 func_80831010(Player* this, PlayState* play) {
s32 func_80831094(Player* this, PlayState* play) {
if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_2000000)) {
- if ((D_80862B48 != 0) || func_80830F9C(play)) {
+ if (sPlayerUseHeldItem || func_80830F9C(play)) {
if (func_80830E30(this, play)) {
return func_80831010(this, play);
}
@@ -4122,7 +4197,7 @@ s32 func_808313A8(PlayState* play, Player* this, Actor* actor) {
void func_808313F0(Player* this, PlayState* play) {
if (!func_808313A8(play, this, this->heldActor)) {
Player_SetUpperAction(play, this, Player_UpperAction_10);
- PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_link_normal_carryB_wait);
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait);
}
}
@@ -4163,7 +4238,7 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc,
}
} else if ((this->transformation == PLAYER_FORM_GORON) &&
(Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE)) {
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
}
func_800AEF44(Effect_GetByIndex(this->meleeWeaponEffectIndex[2]));
@@ -4175,7 +4250,7 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc,
if (!(arg3 & 1) && !(this->stateFlags1 & PLAYER_STATE1_800)) {
func_808309CC(play, this);
- PlayerAnimation_PlayLoop(play, &this->unk_284, func_8082ED20(this));
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, func_8082ED20(this));
this->stateFlags1 &= ~PLAYER_STATE1_400000;
}
@@ -4237,7 +4312,7 @@ void Player_SetAction_PreserveItemAction(PlayState* play, Player* this, PlayerAc
}
}
-void func_808317C4(Player* this) {
+void Player_DestroyHookshot(Player* this) {
if (Player_IsHoldingHookshot(this)) {
if (this->heldActor != NULL) {
Actor_Kill(this->heldActor);
@@ -4277,13 +4352,12 @@ void func_808318C0(PlayState* play) {
// Toggle Lens from a button press
void func_80831944(PlayState* play, Player* this) {
- if (func_8012364C(play, this, func_8082FDC4()) == ITEM_LENS_OF_TRUTH) {
+ if (Player_GetItemOnButton(play, this, func_8082FDC4()) == ITEM_LENS_OF_TRUTH) {
func_808318C0(play);
}
}
-// Proposed name: Player_UseItem
-void func_80831990(PlayState* play, Player* this, ItemId item) {
+void Player_UseItem(PlayState* play, Player* this, ItemId item) {
PlayerItemAction itemAction = Player_ItemToItemAction(this, item);
if ((((this->heldItemAction == this->itemAction) &&
@@ -4336,15 +4410,20 @@ void func_80831990(PlayState* play, Player* this, ItemId item) {
((explosiveType = Player_ExplosiveFromIA(this, itemAction)) > PLAYER_EXPLOSIVE_NONE) &&
((AMMO(sPlayerExplosiveInfo[explosiveType].itemId) == 0) ||
(play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].length >= 3)))) {
+ // Prevent some items from being used if player is out of ammo.
+ // Also prevent explosives from being used if too many are active
Audio_PlaySfx(NA_SE_SY_ERROR);
} else if (itemAction == PLAYER_IA_LENS_OF_TRUTH) {
+ // Handle Lens of Truth
func_808318C0(play);
} else if (itemAction == PLAYER_IA_PICTOGRAPH_BOX) {
+ // Handle Pictograph Box
if (!func_80831814(this, play, PLAYER_UNKAA5_2)) {
Audio_PlaySfx(NA_SE_SY_ERROR);
}
} else if ((itemAction == PLAYER_IA_DEKU_NUT) &&
((this->transformation != PLAYER_FORM_DEKU) || (this->heldItemButton != 0))) {
+ // Handle Deku Nuts
if (AMMO(ITEM_DEKU_NUT) != 0) {
func_8083A658(play, this);
} else {
@@ -4354,6 +4433,7 @@ void func_80831990(PlayState* play, Player* this, ItemId item) {
(itemAction < PLAYER_IA_MASK_GIANT)) {
PlayerMask maskId = GET_MASK_FROM_IA(itemAction);
+ // Handle wearable masks
this->prevMask = this->currentMask;
if (maskId == this->currentMask) {
this->currentMask = PLAYER_MASK_NONE;
@@ -4367,26 +4447,30 @@ void func_80831990(PlayState* play, Player* this, ItemId item) {
((this->heldActor == NULL) && (Player_ExplosiveFromIA(this, itemAction) > PLAYER_EXPLOSIVE_NONE))) {
u8 nextAnimType;
+ // Handle using a new held item
this->nextModelGroup = Player_ActionToModelGroup(this, itemAction);
nextAnimType = gPlayerModelTypes[this->nextModelGroup].modelAnimType;
var_v1 = ((this->transformation != PLAYER_FORM_GORON) || (itemAction == PLAYER_IA_POWDER_KEG));
if (var_v1 && (this->heldItemAction >= 0) && (item != this->heldItemId) &&
- (D_8085CD00[gPlayerModelTypes[this->modelGroup].modelAnimType][nextAnimType] != 0)) {
+ (sPlayerItemChangeTypes[gPlayerModelTypes[this->modelGroup].modelAnimType][nextAnimType] !=
+ PLAYER_ITEM_CHG_0)) {
+ // Start the held item change process
this->heldItemId = item;
- this->stateFlags3 |= PLAYER_STATE3_40000000;
+ this->stateFlags3 |= PLAYER_STATE3_START_CHANGING_HELD_ITEM;
} else {
- func_808317C4(this);
- func_8082DCA0(play, this);
- func_8082F470(play, this, itemAction);
+ // Init new held item for use
+ Player_DestroyHookshot(this);
+ Player_DetachHeldActor(play, this);
+ Player_InitItemActionWithAnim(play, this, itemAction);
if (!var_v1) {
- D_80862B48 = 1;
- D_80862B4C = 1;
+ sPlayerUseHeldItem = true;
+ sPlayerHeldItemButtonIsHeldDown = true;
}
}
} else {
- D_80862B48 = 1;
- D_80862B4C = 1;
+ sPlayerUseHeldItem = true;
+ sPlayerHeldItemButtonIsHeldDown = true;
}
}
}
@@ -4429,11 +4513,11 @@ void func_80831F34(PlayState* play, Player* this, PlayerAnimationHeader* anim) {
}
}
-s32 func_80832090(Player* this) {
+s32 Player_CanUpdateItems(Player* this) {
return (!(Player_Action_34 == this->actionFunc) ||
- (((this->stateFlags3 & PLAYER_STATE3_40000000)) &&
+ ((this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) &&
((this->heldItemId == ITEM_FC) || (this->heldItemId == ITEM_NONE)))) &&
- (!(Player_UpperAction_2 == this->upperActionFunc) ||
+ (!(Player_UpperAction_ChangeHeldItem == this->upperActionFunc) ||
Player_ItemToItemAction(this, this->heldItemId) == this->heldItemAction);
}
@@ -4442,7 +4526,7 @@ s32 func_8083213C(Player* this) {
return (Player_Action_11 == this->actionFunc) || (Player_Action_12 == this->actionFunc);
}
-s32 func_8083216C(Player* this, PlayState* play) {
+s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
if (!(this->stateFlags1 & PLAYER_STATE1_800000) && (this->actor.parent != NULL) && Player_IsHoldingHookshot(this)) {
Player_SetAction(play, this, Player_Action_92, 1);
this->stateFlags3 |= PLAYER_STATE3_80;
@@ -4456,8 +4540,8 @@ s32 func_8083216C(Player* this, PlayState* play) {
return true;
}
- if (func_80832090(this)) {
- func_808304BC(this, play);
+ if (Player_CanUpdateItems(this)) {
+ Player_UpdateItems(this, play);
if (Player_Action_64 == this->actionFunc) {
return true;
}
@@ -4467,23 +4551,23 @@ s32 func_8083216C(Player* this, PlayState* play) {
return false;
}
- if (this->unk_AC8 != 0.0f) {
+ if (this->skelAnimeUpperBlendWeight != 0.0f) {
if ((func_8082ED94(this) == 0) || (this->linearVelocity != 0.0f)) {
- AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->unk_284.jointTable,
- this->skelAnime.jointTable, D_8085B9F0);
+ AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnimeUpper.jointTable,
+ this->skelAnime.jointTable, sPlayerUpperBodyLimbCopyMap);
}
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->skelAnime.moveFlags & ANIM_FLAG_8)) {
- Math_StepToF(&this->unk_AC8, 0.0f, 0.25f);
+ Math_StepToF(&this->skelAnimeUpperBlendWeight, 0.0f, 0.25f);
AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable, 1.0f - this->unk_AC8);
+ this->skelAnimeUpper.jointTable, 1.0f - this->skelAnimeUpperBlendWeight);
}
} else if ((func_8082ED94(this) == 0) || (this->linearVelocity != 0.0f) ||
(this->skelAnime.moveFlags & ANIM_FLAG_8)) {
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable, D_8085B9F0);
+ this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap);
} else {
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable);
+ this->skelAnimeUpper.jointTable);
}
return true;
@@ -4817,38 +4901,204 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw
return false;
}
- *outYawTarget += Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]);
+ *outYawTarget += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
return true;
}
+typedef enum ActionChangeIndex {
+ /* 0x0 */ PLAYER_ACTION_CHG_0,
+ /* 0x1 */ PLAYER_ACTION_CHG_1,
+ /* 0x2 */ PLAYER_ACTION_CHG_2,
+ /* 0x3 */ PLAYER_ACTION_CHG_3,
+ /* 0x4 */ PLAYER_ACTION_CHG_4,
+ /* 0x5 */ PLAYER_ACTION_CHG_5,
+ /* 0x6 */ PLAYER_ACTION_CHG_6,
+ /* 0x7 */ PLAYER_ACTION_CHG_7,
+ /* 0x8 */ PLAYER_ACTION_CHG_8,
+ /* 0x9 */ PLAYER_ACTION_CHG_9,
+ /* 0xA */ PLAYER_ACTION_CHG_10,
+ /* 0xB */ PLAYER_ACTION_CHG_11,
+ /* 0xC */ PLAYER_ACTION_CHG_12,
+ /* 0xD */ PLAYER_ACTION_CHG_13,
+ /* 0xE */ PLAYER_ACTION_CHG_14,
+ /* 0xF */ PLAYER_ACTION_CHG_MAX
+} ActionChangeIndex;
+
/**
- * The values of following arrays are used as indices for the `D_8085D054` array.
+ * The values of following arrays are used as indices for the `sPlayerActionChangeFuncs` array.
* Each index correspond to a function which will be called sequentially until any of them return `true`.
* Negative marks the end of the array.
*/
-s8 D_8085CFE4[] = { 13, 2, 4, 9, 10, 11, 8, -7 };
-s8 D_8085CFEC[] = { 13, 1, 2, 5, 3, 4, 9, 10, 11, 7, 8, -6 };
-s8 D_8085CFF8[] = { 13, 1, 2, 3, 4, 9, 10, 11, 8, 7, -6 };
-s8 D_8085D004[] = { 13, 2, 4, 9, 10, 11, 8, -7 };
-s8 D_8085D00C[] = { 13, 2, 4, 9, 10, 11, 12, 8, -7 };
-s8 D_8085D018[] = { -7 };
-s8 D_8085D01C[] = { 0, 11, 1, 2, 3, 5, 4, 9, 8, 7, -6 };
-s8 D_8085D028[] = { 0, 11, 1, 2, 3, 12, 5, 4, 9, 8, 7, -6 };
-s8 D_8085D034[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 };
-s8 D_8085D044[] = { 10, 8, -7 };
-s8 D_8085D048[] = { 0, 12, 5, 4, -14 };
-s8 D_8085D050[] = { 13, 2, -4 };
-
-s32 (*D_8085D054[])(Player*, PlayState*) = {
- func_80839518, func_808365DC, func_8083D23C, func_8083CCB4, func_808391D8,
- func_8083DFC4, func_8083A114, func_80848570, func_8083A580, func_8083D78C,
- func_80839B18, func_8083A274, func_80834DFC, func_80838A90, func_8083A0CC,
+s8 sPlayerActionChangeList1[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_2,
+ /* 2 */ PLAYER_ACTION_CHG_4,
+ /* 3 */ PLAYER_ACTION_CHG_9,
+ /* 4 */ PLAYER_ACTION_CHG_10,
+ /* 5 */ PLAYER_ACTION_CHG_11,
+ /* 6 */ PLAYER_ACTION_CHG_8,
+ /* 7 */ -PLAYER_ACTION_CHG_7,
};
-s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) {
+s8 sPlayerActionChangeList2[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_1,
+ /* 2 */ PLAYER_ACTION_CHG_2,
+ /* 3 */ PLAYER_ACTION_CHG_5,
+ /* 4 */ PLAYER_ACTION_CHG_3,
+ /* 5 */ PLAYER_ACTION_CHG_4,
+ /* 6 */ PLAYER_ACTION_CHG_9,
+ /* 7 */ PLAYER_ACTION_CHG_10,
+ /* 8 */ PLAYER_ACTION_CHG_11,
+ /* 9 */ PLAYER_ACTION_CHG_7,
+ /* 10 */ PLAYER_ACTION_CHG_8,
+ /* 11 */ -PLAYER_ACTION_CHG_6,
+};
+
+s8 sPlayerActionChangeList3[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_1,
+ /* 2 */ PLAYER_ACTION_CHG_2,
+ /* 3 */ PLAYER_ACTION_CHG_3,
+ /* 4 */ PLAYER_ACTION_CHG_4,
+ /* 5 */ PLAYER_ACTION_CHG_9,
+ /* 6 */ PLAYER_ACTION_CHG_10,
+ /* 7 */ PLAYER_ACTION_CHG_11,
+ /* 8 */ PLAYER_ACTION_CHG_8,
+ /* 9 */ PLAYER_ACTION_CHG_7,
+ /* 10 */ -PLAYER_ACTION_CHG_6,
+};
+
+s8 sPlayerActionChangeList4[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_2,
+ /* 2 */ PLAYER_ACTION_CHG_4,
+ /* 3 */ PLAYER_ACTION_CHG_9,
+ /* 4 */ PLAYER_ACTION_CHG_10,
+ /* 5 */ PLAYER_ACTION_CHG_11,
+ /* 6 */ PLAYER_ACTION_CHG_8,
+ /* 7 */ -PLAYER_ACTION_CHG_7,
+};
+
+s8 sPlayerActionChangeList5[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_2,
+ /* 2 */ PLAYER_ACTION_CHG_4,
+ /* 3 */ PLAYER_ACTION_CHG_9,
+ /* 4 */ PLAYER_ACTION_CHG_10,
+ /* 5 */ PLAYER_ACTION_CHG_11,
+ /* 6 */ PLAYER_ACTION_CHG_12,
+ /* 7 */ PLAYER_ACTION_CHG_8,
+ /* 8 */ -PLAYER_ACTION_CHG_7,
+};
+
+s8 sPlayerActionChangeList6[] = {
+ /* 0 */ -PLAYER_ACTION_CHG_7,
+};
+
+s8 sPlayerActionChangeList7[] = {
+ /* 0 */ PLAYER_ACTION_CHG_0,
+ /* 1 */ PLAYER_ACTION_CHG_11,
+ /* 2 */ PLAYER_ACTION_CHG_1,
+ /* 3 */ PLAYER_ACTION_CHG_2,
+ /* 4 */ PLAYER_ACTION_CHG_3,
+ /* 5 */ PLAYER_ACTION_CHG_5,
+ /* 6 */ PLAYER_ACTION_CHG_4,
+ /* 7 */ PLAYER_ACTION_CHG_9,
+ /* 8 */ PLAYER_ACTION_CHG_8,
+ /* 9 */ PLAYER_ACTION_CHG_7,
+ /* 10 */ -PLAYER_ACTION_CHG_6,
+};
+
+s8 sPlayerActionChangeList8[] = {
+ /* 0 */ PLAYER_ACTION_CHG_0,
+ /* 1 */ PLAYER_ACTION_CHG_11,
+ /* 2 */ PLAYER_ACTION_CHG_1,
+ /* 3 */ PLAYER_ACTION_CHG_2,
+ /* 4 */ PLAYER_ACTION_CHG_3,
+ /* 5 */ PLAYER_ACTION_CHG_12,
+ /* 6 */ PLAYER_ACTION_CHG_5,
+ /* 7 */ PLAYER_ACTION_CHG_4,
+ /* 8 */ PLAYER_ACTION_CHG_9,
+ /* 9 */ PLAYER_ACTION_CHG_8,
+ /* 10 */ PLAYER_ACTION_CHG_7,
+ /* 11 */ -PLAYER_ACTION_CHG_6,
+};
+
+s8 sPlayerActionChangeList9[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_1,
+ /* 2 */ PLAYER_ACTION_CHG_2,
+ /* 3 */ PLAYER_ACTION_CHG_3,
+ /* 4 */ PLAYER_ACTION_CHG_12,
+ /* 5 */ PLAYER_ACTION_CHG_5,
+ /* 6 */ PLAYER_ACTION_CHG_4,
+ /* 7 */ PLAYER_ACTION_CHG_9,
+ /* 8 */ PLAYER_ACTION_CHG_10,
+ /* 9 */ PLAYER_ACTION_CHG_11,
+ /* 10 */ PLAYER_ACTION_CHG_8,
+ /* 11 */ PLAYER_ACTION_CHG_7,
+ /* 12 */ -PLAYER_ACTION_CHG_6,
+};
+
+s8 sPlayerActionChangeList10[] = {
+ /* 0 */ PLAYER_ACTION_CHG_10,
+ /* 1 */ PLAYER_ACTION_CHG_8,
+ /* 2 */ -PLAYER_ACTION_CHG_7,
+};
+
+s8 sPlayerActionChangeList11[] = {
+ /* 0 */ PLAYER_ACTION_CHG_0,
+ /* 1 */ PLAYER_ACTION_CHG_12,
+ /* 2 */ PLAYER_ACTION_CHG_5,
+ /* 3 */ PLAYER_ACTION_CHG_4,
+ /* 4 */ -PLAYER_ACTION_CHG_14,
+};
+
+s8 sPlayerActionChangeList12[] = {
+ /* 0 */ PLAYER_ACTION_CHG_13,
+ /* 1 */ PLAYER_ACTION_CHG_2,
+ /* 2 */ -PLAYER_ACTION_CHG_4,
+};
+
+s32 (*sPlayerActionChangeFuncs[PLAYER_ACTION_CHG_MAX])(Player*, PlayState*) = {
+ Player_ActionChange_0, // PLAYER_ACTION_CHG_0
+ Player_ActionChange_1, // PLAYER_ACTION_CHG_1
+ Player_ActionChange_2, // PLAYER_ACTION_CHG_2
+ Player_ActionChange_3, // PLAYER_ACTION_CHG_3
+ Player_ActionChange_4, // PLAYER_ACTION_CHG_4
+ Player_ActionChange_5, // PLAYER_ACTION_CHG_5
+ Player_ActionChange_6, // PLAYER_ACTION_CHG_6
+ Player_ActionChange_7, // PLAYER_ACTION_CHG_7
+ Player_ActionChange_8, // PLAYER_ACTION_CHG_8
+ Player_ActionChange_9, // PLAYER_ACTION_CHG_9
+ Player_ActionChange_10, // PLAYER_ACTION_CHG_10
+ Player_ActionChange_11, // PLAYER_ACTION_CHG_11
+ Player_ActionChange_12, // PLAYER_ACTION_CHG_12
+ Player_ActionChange_13, // PLAYER_ACTION_CHG_13
+ Player_ActionChange_14, // PLAYER_ACTION_CHG_14
+};
+
+/**
+ * This function processes "Action Change Lists", which run various functions that
+ * check if it is appropriate to change to a new action.
+ *
+ * Action Change Lists are a list of indices for the `sPlayerActionChangeFuncs` array.
+ * The functions are ran in order until one of them returns true, or the end of the list is reached.
+ * An Action Change index having a negative value indicates that it is the last member in the list.
+ *
+ * Because these lists are processed sequentially, the order of the indices in the list determines its priority.
+ *
+ * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Change List
+ * is processed. This allows for Upper Action functions to run.
+ *
+ * @return true if a new action has been chosen
+ *
+ */
+s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeList, s32 updateUpperBody) {
if (!(this->stateFlags1 & (PLAYER_STATE1_1 | PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) && !func_8082DA90(play)) {
- if (arg3) {
- D_80862B04 = func_8083216C(this, play);
+ if (updateUpperBody) {
+ D_80862B04 = Player_UpdateUpperBody(this, play);
if (Player_Action_64 == this->actionFunc) {
return true;
}
@@ -4859,15 +5109,18 @@ s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) {
return true;
}
- if (!(this->stateFlags3 & PLAYER_STATE3_40000000) && (Player_UpperAction_2 != this->upperActionFunc)) {
- while (*arg2 >= 0) {
- if (D_8085D054[*arg2](this, play)) {
+ if (!(this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) &&
+ (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) {
+ // Process all entries in the Action Change List with a positive index
+ while (*actionChangeList >= 0) {
+ if (sPlayerActionChangeFuncs[*actionChangeList](this, play)) {
return true;
}
- arg2++;
+ actionChangeList++;
}
- if (D_8085D054[-*arg2](this, play)) {
+ // Try the last entry in the list. Negate the index to make it positive again.
+ if (sPlayerActionChangeFuncs[-*actionChangeList](this, play)) {
return true;
}
}
@@ -4876,7 +5129,7 @@ s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) {
return true;
}
} else if (this->stateFlags1 & PLAYER_STATE1_800) {
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
}
return false;
@@ -4887,7 +5140,7 @@ s32 func_808331FC(PlayState* play, Player* this, SkelAnime* skelAnime, f32 frame
f32 speedTarget;
s16 yawTarget;
- if (func_80833058(play, this, D_8085D01C, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true)) {
return 0;
}
@@ -5524,7 +5777,7 @@ s32 func_80834600(Player* this, PlayState* play) {
Player_SetUpperAction(play, this, Player_UpperAction_4);
var_a2 = (this->unk_B40 < 0.5f) ? D_8085CFD4[Player_IsHoldingTwoHandedWeapon(this)]
: D_8085CFCC[Player_IsHoldingTwoHandedWeapon(this)];
- PlayerAnimation_PlayOnce(play, &this->unk_284, var_a2);
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, var_a2);
} else {
Player_AnimationPlayOnce(play, this, D_8085CFDC[Player_IsHoldingTwoHandedWeapon(this)]);
}
@@ -5637,7 +5890,7 @@ void func_80834DB8(Player* this, PlayerAnimationHeader* anim, f32 speed, PlaySta
func_80834D50(play, this, anim, speed, NA_SE_VO_LI_SWORD_N);
}
-s32 func_80834DFC(Player* this, PlayState* play) {
+s32 Player_ActionChange_12(Player* this, PlayState* play) {
if ((this->transformation != PLAYER_FORM_GORON) &&
((this->transformation != PLAYER_FORM_DEKU) || func_801242B4(this) ||
(this->ledgeClimbType <= PLAYER_LEDGE_CLIMB_3)) &&
@@ -6229,7 +6482,7 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) {
}
// door stuff
-s32 func_808365DC(Player* this, PlayState* play) {
+s32 Player_ActionChange_1(Player* this, PlayState* play) {
if ((gSaveContext.save.saveInfo.playerData.health != 0) && (this->doorType != PLAYER_DOORTYPE_NONE)) {
if ((this->actor.category != ACTORCAT_PLAYER) ||
((((this->doorType <= PLAYER_DOORTYPE_TALKING) && CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) ||
@@ -7205,7 +7458,7 @@ PlayerAnimationHeader* D_8085D1F8[] = {
&gPlayerAnim_link_normal_take_out, // Hold up cutscene item; "this item doesn't work here"
};
-s32 func_80838A90(Player* this, PlayState* play) {
+s32 Player_ActionChange_13(Player* this, PlayState* play) {
PlayerBottle bottleAction;
if (this->unk_AA5 != PLAYER_UNKAA5_0) {
@@ -7382,7 +7635,7 @@ s32 func_80838A90(Player* this, PlayState* play) {
return false;
}
-s32 func_808391D8(Player* this, PlayState* play) {
+s32 Player_ActionChange_4(Player* this, PlayState* play) {
if (gSaveContext.save.saveInfo.playerData.health != 0) {
Actor* talkActor = this->talkActor;
Actor* lockOnActor = this->lockOnActor;
@@ -7468,9 +7721,9 @@ s32 func_808391D8(Player* this, PlayState* play) {
return false;
}
-s32 func_80839518(Player* this, PlayState* play) {
+s32 Player_ActionChange_0(Player* this, PlayState* play) {
if (this->unk_AA5 != PLAYER_UNKAA5_0) {
- func_80838A90(this, play);
+ Player_ActionChange_13(this, play);
return true;
} else if ((this->lockOnActor != NULL) &&
(CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_40000) ||
@@ -7510,7 +7763,7 @@ s32 func_808396B8(PlayState* play, Player* this) {
((Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) &&
((this->transformation != PLAYER_FORM_GORON) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) &&
((this->transformation != PLAYER_FORM_ZORA) || !(this->stateFlags1 & PLAYER_STATE1_2000000)) &&
- (D_80862B48 != 0)))) {
+ sPlayerUseHeldItem))) {
return true;
}
@@ -7599,7 +7852,7 @@ s32 func_80839A84(PlayState* play, Player* this) {
return true;
}
-s32 func_80839B18(Player* this, PlayState* play) {
+s32 Player_ActionChange_10(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) &&
(play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sPlayerFloorType != FLOOR_TYPE_7) &&
(sPlayerFloorEffect != FLOOR_EFFECT_1)) {
@@ -7614,8 +7867,8 @@ s32 func_80839B18(Player* this, PlayState* play) {
func_80836B3C(play, this, 0.0f);
}
} else if (!(this->stateFlags1 & PLAYER_STATE1_8000000) &&
- (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && func_80832090(this) &&
- (this->transformation != PLAYER_FORM_GORON)) {
+ (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) &&
+ Player_CanUpdateItems(this) && (this->transformation != PLAYER_FORM_GORON)) {
func_808395F0(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f);
} else if (!func_80839A84(play, this)) {
func_80836B3C(play, this, 0.0f);
@@ -7719,14 +7972,14 @@ void func_8083A04C(Player* this) {
}
}
-s32 func_8083A0CC(Player* this, PlayState* play) {
+s32 Player_ActionChange_14(Player* this, PlayState* play) {
if (!D_80862B04 && (this->transformation == PLAYER_FORM_ZORA)) {
func_8083A04C(this);
}
return false;
}
-s32 func_8083A114(Player* this, PlayState* play) {
+s32 Player_ActionChange_6(Player* this, PlayState* play) {
if (!D_80862B04 && !(this->stateFlags1 & PLAYER_STATE1_800000) && !func_8082FB68(this)) {
if ((this->transformation == PLAYER_FORM_ZORA) && (this->stateFlags1 & PLAYER_STATE1_8000000)) {
func_8083A04C(this);
@@ -7741,7 +7994,7 @@ s32 func_8083A114(Player* this, PlayState* play) {
if ((this->putAwayCountdown == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_KOKIRI) &&
(this->transformation != PLAYER_FORM_FIERCE_DEITY)) {
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
} else {
this->stateFlags2 ^= PLAYER_STATE2_100000;
}
@@ -7751,7 +8004,7 @@ s32 func_8083A114(Player* this, PlayState* play) {
return false;
}
-s32 func_8083A274(Player* this, PlayState* play) {
+s32 Player_ActionChange_11(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_R) && (this->unk_AA5 == PLAYER_UNKAA5_0) &&
(play->unk_1887C == 0)) {
if (Player_IsGoronOrDeku(this) ||
@@ -7759,7 +8012,7 @@ s32 func_8083A274(Player* this, PlayState* play) {
((this->transformation == PLAYER_FORM_HUMAN) && (this->currentShield != PLAYER_SHIELD_NONE))) &&
!func_80123434(this) && (this->lockOnActor == NULL))) {
func_8082DC38(this);
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
if (Player_SetAction(play, this, Player_Action_18, 0)) {
this->stateFlags1 |= PLAYER_STATE1_400000;
if (this->transformation != PLAYER_FORM_GORON) {
@@ -7821,7 +8074,7 @@ void func_8083A548(Player* this) {
}
}
-s32 func_8083A580(Player* this, PlayState* play) {
+s32 Player_ActionChange_8(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) {
if (!(this->stateFlags1 & PLAYER_STATE1_400000) &&
(Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE)) {
@@ -7857,7 +8110,7 @@ struct_8085D200 D_8085D200[] = {
};
s32 func_8083A6C0(PlayState* play, Player* this) {
- if (D_80862B48 != 0) {
+ if (sPlayerUseHeldItem) {
if (Player_GetBottleHeld(this) > PLAYER_BOTTLE_NONE) {
Player_SetAction(play, this, Player_Action_68, 0);
if (this->actor.depthInWater > 12.0f) {
@@ -8656,7 +8909,7 @@ u16 D_8085D25C[] = {
};
// Player_MountHorse
-s32 func_8083CCB4(Player* this, PlayState* play) {
+s32 Player_ActionChange_3(Player* this, PlayState* play) {
EnHorse* rideActor = (EnHorse*)this->rideActor;
if (rideActor != NULL) {
@@ -8797,7 +9050,7 @@ void func_8083D168(PlayState* play, Player* this, GetItemEntry* giEntry) {
Audio_PlaySfx((this->getItemId < GI_NONE) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM);
}
-s32 func_8083D23C(Player* this, PlayState* play) {
+s32 Player_ActionChange_2(Player* this, PlayState* play) {
if (gSaveContext.save.saveInfo.playerData.health != 0) {
Actor* interactRangeActor = this->interactRangeActor;
@@ -8809,7 +9062,7 @@ s32 func_8083D23C(Player* this, PlayState* play) {
interactRangeActor->parent = &this->actor;
if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) ||
((s16)giEntry->objectId == OBJECT_GI_BOMB_2)) {
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
func_80838830(this, giEntry->objectId);
if (!(this->stateFlags2 & PLAYER_STATE2_400) ||
@@ -8923,7 +9176,7 @@ s32 func_8083D738(Player* this, Actor* heldActor) {
return true;
}
-s32 func_8083D78C(Player* this, PlayState* play) {
+s32 Player_ActionChange_9(Player* this, PlayState* play) {
if (this->stateFlags1 & PLAYER_STATE1_800) {
if ((this->heldActor != NULL) &&
CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_B | BTN_A)) {
@@ -9120,7 +9373,7 @@ void func_8083DF38(Player* this, PlayerAnimationHeader* anim, PlayState* play) {
this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000;
}
-s32 func_8083DFC4(Player* this, PlayState* play) {
+s32 Player_ActionChange_5(Player* this, PlayState* play) {
if (!(this->stateFlags1 & PLAYER_STATE1_800) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) &&
(sPlayerShapeYawToTouchedWall < 0x3000)) {
if ((this->linearVelocity > 0.0f) && func_8083D860(this, play)) {
@@ -9290,7 +9543,7 @@ s32 func_8083E7F8(Player* this, f32* arg1, s16* arg2, PlayState* play) {
func_8083C6E8(this, play);
if ((*arg1 != 0.0f) || (ABS_ALT(this->unk_B4C) > 0x190)) {
- s16 temp_a0 = *arg2 - (u16)Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]);
+ s16 temp_a0 = *arg2 - (u16)Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
u16 temp;
temp = (ABS_ALT(temp_a0) - 0x2000);
@@ -9371,7 +9624,7 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) {
s32 animIndex;
s32 rand;
f32 morphFrames;
- s16 lastFrame;
+ s16 endFrame;
if (((this->actor.id != ACTOR_PLAYER) && !(healthIsCritical = (this->actor.colChkInfo.health < 0x64))) ||
((this->actor.id == ACTOR_PLAYER) &&
@@ -9418,7 +9671,7 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) {
}
}
- lastFrame = Animation_GetLastFrame(anim);
+ endFrame = Animation_GetLastFrame(anim);
if ((this->skelAnime.animation == anim) || (this->skelAnime.animation == &gPlayerAnim_pz_attackAend) ||
(this->skelAnime.animation == &gPlayerAnim_pz_attackBend) ||
(this->skelAnime.animation == &gPlayerAnim_pz_attackCend)) {
@@ -9427,7 +9680,7 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) {
morphFrames = -6.0f;
}
- PlayerAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_8085C3E4, 0.0f, lastFrame, ANIMMODE_ONCE,
+ PlayerAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_8085C3E4, 0.0f, endFrame, ANIMMODE_ONCE,
morphFrames);
}
@@ -9716,7 +9969,7 @@ s32 func_8083FCF0(PlayState* play, Player* this, f32 arg2, f32 arg3, f32 arg4) {
// Crouch-stabbing
s32 func_8083FD80(Player* this, PlayState* play) {
if (!Player_IsGoronOrDeku(this) && (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) &&
- (this->transformation != PLAYER_FORM_ZORA) && (D_80862B48 != 0)) {
+ (this->transformation != PLAYER_FORM_ZORA) && sPlayerUseHeldItem) {
//! Calling this function sets the meleeWeaponQuads' damage properties correctly, patching "Power Crouch Stab".
func_8083375C(this, PLAYER_MWA_STAB_1H);
Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru);
@@ -9730,7 +9983,7 @@ s32 func_8083FD80(Player* this, PlayState* play) {
}
s32 func_8083FE38(Player* this, PlayState* play) {
- return func_80838A90(this, play) || func_808391D8(this, play) || func_8083D23C(this, play);
+ return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play);
}
void Player_RequestQuakeAndRumble(PlayState* play, Player* this, u16 sfxId) {
@@ -9741,7 +9994,7 @@ void Player_RequestQuakeAndRumble(PlayState* play, Player* this, u16 sfxId) {
void func_8083FEF4(PlayState* play, Player* this) {
Inventory_ChangeAmmo(ITEM_DEKU_STICK, -1);
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
}
s32 func_8083FF30(PlayState* play, Player* this) {
@@ -9766,7 +10019,7 @@ s32 func_8083FFEC(PlayState* play, Player* this) {
gSaveContext.save.saveInfo.playerData.swordHealth--;
if (gSaveContext.save.saveInfo.playerData.swordHealth <= 0) {
Item_Give(play, ITEM_SWORD_KOKIRI);
- func_80831990(play, this, ITEM_SWORD_KOKIRI);
+ Player_UseItem(play, this, ITEM_SWORD_KOKIRI);
Player_PlaySfx(this, NA_SE_IT_MAJIN_SWORD_BROKEN);
if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) {
Message_StartTextbox(play, 0xF9, NULL);
@@ -10209,11 +10462,11 @@ void func_80841358(PlayState* play, Player* this, s32 arg2) {
//! @bug OoB read if player is goron, deku or human
item = D_8085D2B0[this->transformation];
itemAction = sItemItemActions[item];
- func_808317C4(this);
- func_8082DCA0(play, this);
+ Player_DestroyHookshot(this);
+ Player_DetachHeldActor(play, this);
this->heldItemId = item;
this->nextModelGroup = Player_ActionToModelGroup(this, itemAction);
- func_8082F8BC(play, this, itemAction);
+ Player_InitItemAction(play, this, itemAction);
func_808309CC(play, this);
if (arg2) {
Player_PlaySfx(this, NA_SE_IT_SWORD_PICKOUT);
@@ -10296,7 +10549,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP),
};
-Vec3s D_8085D2C4 = { -57, 3377, 0 };
+Vec3s sPlayerSkeletonBaseTransl = { -57, 3377, 0 };
void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) {
Actor_ProcessInitChain(&this->actor, sInitChain);
@@ -10308,11 +10561,11 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe
func_808309CC(play, this);
SkelAnime_InitPlayer(play, &this->skelAnime, skelHeader, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType],
1 | 8, this->jointTableBuffer, this->morphTableBuffer, PLAYER_LIMB_MAX);
- this->skelAnime.baseTransl = D_8085D2C4;
+ this->skelAnime.baseTransl = sPlayerSkeletonBaseTransl;
- SkelAnime_InitPlayer(play, &this->unk_284, skelHeader, func_8082ED20(this), 1 | 8, this->unk_929, this->unk_9C8,
- PLAYER_LIMB_MAX);
- this->unk_284.baseTransl = D_8085D2C4;
+ SkelAnime_InitPlayer(play, &this->skelAnimeUpper, skelHeader, func_8082ED20(this), 1 | 8,
+ this->jointTableUpperBuffer, this->morphTableUpperBuffer, PLAYER_LIMB_MAX);
+ this->skelAnimeUpper.baseTransl = sPlayerSkeletonBaseTransl;
if (this->transformation == PLAYER_FORM_GORON) {
SkelAnime_InitFlex(play, &this->unk_2C8, &gLinkGoronShieldingSkel, &gLinkGoronShieldingAnim,
@@ -10468,7 +10721,7 @@ void Player_Init(Actor* thisx, PlayState* play) {
this->heldItemAction = PLAYER_IA_NONE;
this->heldItemId = ITEM_NONE;
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
Player_SetEquipmentData(play, this);
this->prevBoots = this->currentBoots;
Player_InitCommon(this, play, gPlayerSkeletons[this->transformation]);
@@ -10613,7 +10866,7 @@ void Player_Init(Actor* thisx, PlayState* play) {
if (gSaveContext.powderKegTimer != 0) {
this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_POWDER_KEG);
this->heldItemId = ITEM_POWDER_KEG;
- func_8082F8BC(play, this, PLAYER_IA_POWDER_KEG);
+ Player_InitItemAction(play, this, PLAYER_IA_POWDER_KEG);
func_808313F0(this, play);
} else if (gSaveContext.unk_1014 != 0) {
func_8082F5FC(this, Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MM,
@@ -11329,7 +11582,7 @@ void func_808442D8(PlayState* play, Player* this) {
f32 temp_fv1;
if (this->unk_B0C == 0.0f) {
- func_80831990(play, this, ITEM_NONE);
+ Player_UseItem(play, this, ITEM_NONE);
return;
}
@@ -11944,7 +12197,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
D_8085C3E4 = (this->stateFlags1 & PLAYER_STATE1_8000000) ? 0.5f : 1.0f;
D_8085C3E8 = 1.0f / D_8085C3E4;
- D_80862B48 = D_80862B4C = 0;
+ sPlayerUseHeldItem = sPlayerHeldItemButtonIsHeldDown = false;
var_v1 = Play_InCsMode(play);
D_80862B2C = this->currentMask;
@@ -12150,7 +12403,7 @@ void Player_Update(Actor* thisx, PlayState* play) {
}
if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) {
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
}
if ((play->actorCtx.unk268 != 0) && (this == GET_PLAYER(play))) {
@@ -12644,7 +12897,7 @@ s32 func_80847880(PlayState* play, Player* this) {
func_8082DE50(play, this);
Player_SetAction(play, this, Player_Action_81, 0);
if (!func_800B7118(this) || Player_IsHoldingHookshot(this)) {
- func_80831990(play, this, ITEM_BOW);
+ Player_UseItem(play, this, ITEM_BOW);
}
Player_AnimationPlayOnce(play, this, func_8082ED20(this));
this->csMode = PLAYER_CSMODE_NONE;
@@ -12662,7 +12915,7 @@ s32 func_80847994(PlayState* play, Player* this) {
this->stateFlags3 &= ~PLAYER_STATE3_20;
this->itemAction = PLAYER_IA_OCARINA;
this->unk_AA5 = PLAYER_UNKAA5_5;
- func_80838A90(this, play);
+ Player_ActionChange_13(this, play);
return true;
}
return false;
@@ -12966,7 +13219,7 @@ void func_808484F0(Player* this) {
}
}
-s32 func_80848570(Player* this, PlayState* play) {
+s32 Player_ActionChange_7(Player* this, PlayState* play) {
if (!func_8083A6C0(play, this)) {
if (func_808396B8(play, this)) {
PlayerMeleeWeaponAnimation meleeWeaponAnim = func_808335F4(this);
@@ -13030,30 +13283,32 @@ s32 Player_UpperAction_1(Player* this, PlayState* play) {
return false;
}
-s32 Player_UpperAction_2(Player* this, PlayState* play) {
- if (PlayerAnimation_Update(play, &this->unk_284) ||
+s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper) ||
((Player_ItemToItemAction(this, this->heldItemId) == this->heldItemAction) &&
- (D_80862B48 = D_80862B48 || ((this->modelAnimType != PLAYER_ANIMTYPE_3) &&
- (this->heldItemAction != PLAYER_IA_DEKU_STICK) && (play->unk_1887C == 0))))) {
- Player_SetUpperAction(play, this, D_8085C9F0[this->heldItemAction]);
+ (sPlayerUseHeldItem =
+ (sPlayerUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) &&
+ (this->heldItemAction != PLAYER_IA_DEKU_STICK) && (play->unk_1887C == 0)))))) {
+ Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]);
this->unk_ACC = 0;
this->unk_AA4 = 0;
- D_80862B4C = D_80862B48;
+ sPlayerHeldItemButtonIsHeldDown = sPlayerUseHeldItem;
return this->upperActionFunc(this, play);
}
if (func_8082ED94(this) != 0) {
- func_80830D40(play, this);
+ Player_WaitToFinishItemChange(play, this);
Player_AnimationPlayOnce(play, this, func_8082ED20(this));
this->unk_AA4 = 0;
} else {
- func_80830D40(play, this);
+ Player_WaitToFinishItemChange(play, this);
}
+
return true;
}
s32 Player_UpperAction_3(Player* this, PlayState* play) {
- PlayerAnimation_Update(play, &this->unk_284);
+ PlayerAnimation_Update(play, &this->skelAnimeUpper);
if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_R)) {
func_80830CE8(play, this);
} else {
@@ -13067,13 +13322,13 @@ s32 Player_UpperAction_3(Player* this, PlayState* play) {
}
s32 Player_UpperAction_4(Player* this, PlayState* play) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
PlayerAnimationHeader* anim;
- f32 lastFrame;
+ f32 endFrame;
anim = func_80830A58(play, this);
- lastFrame = Animation_GetLastFrame(anim);
- PlayerAnimation_Change(play, &this->unk_284, anim, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f);
+ endFrame = Animation_GetLastFrame(anim);
+ PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE, 0.0f);
}
this->stateFlags1 |= PLAYER_STATE1_400000;
@@ -13082,11 +13337,10 @@ s32 Player_UpperAction_4(Player* this, PlayState* play) {
}
s32 Player_UpperAction_5(Player* this, PlayState* play) {
- // possibly a case of if ((D_80862B48 = D_80862B4C) || PlayerAnimation_Update(play, &this->unk_284))
- D_80862B48 = D_80862B4C;
- if ((D_80862B48 != 0) || PlayerAnimation_Update(play, &this->unk_284)) {
- Player_SetUpperAction(play, this, D_8085C9F0[this->heldItemAction]);
- PlayerAnimation_PlayLoop(play, &this->unk_284, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType]);
+ sPlayerUseHeldItem = sPlayerHeldItemButtonIsHeldDown;
+ if (sPlayerUseHeldItem || PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
+ Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]);
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType]);
this->unk_AA4 = 0;
this->upperActionFunc(this, play);
return false;
@@ -13144,10 +13398,10 @@ s32 Player_UpperAction_7(Player* this, PlayState* play) {
if ((this->unk_ACE == 0) && (func_8082ED94(this) == 0) &&
(this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) {
- PlayerAnimation_PlayOnce(play, &this->unk_284, D_8085D5E4[index]);
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, D_8085D5E4[index]);
this->unk_ACE = -1;
- } else if (PlayerAnimation_Update(play, &this->unk_284)) {
- PlayerAnimation_PlayLoop(play, &this->unk_284, D_8085D5F0[index]);
+ } else if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, D_8085D5F0[index]);
this->unk_ACE = 1;
} else if (this->unk_ACE == 1) {
this->unk_ACE = 2;
@@ -13158,7 +13412,7 @@ s32 Player_UpperAction_7(Player* this, PlayState* play) {
}
func_80831010(this, play);
- if ((this->unk_ACE > 0) && ((this->unk_B28 < 0) || ((D_80862B4C == 0) && !func_80830FD4(play)))) {
+ if ((this->unk_ACE > 0) && ((this->unk_B28 < 0) || (!sPlayerHeldItemButtonIsHeldDown && !func_80830FD4(play)))) {
Player_SetUpperAction(play, this, Player_UpperAction_8);
if (this->unk_B28 >= 0) {
if (index != 0) {
@@ -13167,7 +13421,8 @@ s32 Player_UpperAction_7(Player* this, PlayState* play) {
}
if (this->transformation == PLAYER_FORM_DEKU) {
- PlayerAnimation_PlayOnceSetSpeed(play, &this->unk_284, &gPlayerAnim_pn_tamahaki, 2.0f / 3.0f);
+ PlayerAnimation_PlayOnceSetSpeed(play, &this->skelAnimeUpper, &gPlayerAnim_pn_tamahaki,
+ 2.0f / 3.0f);
}
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
func_80831194(play, this);
@@ -13183,15 +13438,15 @@ s32 Player_UpperAction_7(Player* this, PlayState* play) {
}
s32 Player_UpperAction_8(Player* this, PlayState* play) {
- s32 animFinished = PlayerAnimation_Update(play, &this->unk_284);
+ s32 animFinished = PlayerAnimation_Update(play, &this->skelAnimeUpper);
if (Player_IsHoldingHookshot(this) && !func_80831124(play, this)) {
return true;
}
if (!func_80830B88(play, this) &&
- ((((this->unk_B28 < 0) && (D_80862B4C != 0)) ||
- ((animFinished || (this->transformation != PLAYER_FORM_DEKU)) && (D_80862B48 != 0))) ||
+ ((((this->unk_B28 < 0) && sPlayerHeldItemButtonIsHeldDown) ||
+ ((animFinished || (this->transformation != PLAYER_FORM_DEKU)) && sPlayerUseHeldItem)) ||
func_80830F9C(play))) {
this->unk_B28 = ABS_ALT(this->unk_B28);
@@ -13199,7 +13454,7 @@ s32 Player_UpperAction_8(Player* this, PlayState* play) {
if (Player_IsHoldingHookshot(this)) {
this->unk_ACE = 1;
} else {
- PlayerAnimation_PlayOnce(play, &this->unk_284,
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper,
(this->transformation == PLAYER_FORM_DEKU)
? &gPlayerAnim_pn_tamahakidf
: &gPlayerAnim_link_bow_bow_shoot_next);
@@ -13221,7 +13476,7 @@ s32 Player_UpperAction_8(Player* this, PlayState* play) {
Player_SetUpperAction(play, this, Player_UpperAction_6);
} else {
Player_SetUpperAction(play, this, Player_UpperAction_9);
- PlayerAnimation_PlayOnce(play, &this->unk_284,
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper,
(this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_tamahakidf
: &gPlayerAnim_link_bow_bow_shoot_end);
}
@@ -13232,7 +13487,7 @@ s32 Player_UpperAction_8(Player* this, PlayState* play) {
}
s32 Player_UpperAction_9(Player* this, PlayState* play) {
- if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || PlayerAnimation_Update(play, &this->unk_284)) {
+ if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
Player_SetUpperAction(play, this, Player_UpperAction_6);
}
return true;
@@ -13250,8 +13505,8 @@ s32 Player_UpperAction_10(Player* this, PlayState* play) {
}
if (this->stateFlags1 & PLAYER_STATE1_800) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
- PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_link_normal_carryB_wait);
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait);
}
if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) {
@@ -13279,31 +13534,31 @@ s32 Player_UpperAction_11(Player* this, PlayState* play) {
}
s32 Player_UpperAction_12(Player* this, PlayState* play) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
Player_SetUpperAction(play, this, Player_UpperAction_13);
- PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_pz_cutterwaitanim);
+ PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cutterwaitanim);
}
- if (this->unk_284.animation == &gPlayerAnim_pz_cutterwaitanim) {
+ if (this->skelAnimeUpper.animation == &gPlayerAnim_pz_cutterwaitanim) {
func_80831010(this, play);
}
return true;
}
s32 Player_UpperAction_13(Player* this, PlayState* play) {
- PlayerAnimation_Update(play, &this->unk_284);
+ PlayerAnimation_Update(play, &this->skelAnimeUpper);
func_80831010(this, play);
- if (D_80862B4C == 0) {
+ if (!sPlayerHeldItemButtonIsHeldDown) {
Player_SetUpperAction(play, this, Player_UpperAction_14);
- PlayerAnimation_PlayOnce(play, &this->unk_284, &gPlayerAnim_pz_cutterattack);
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cutterattack);
}
return true;
}
s32 Player_UpperAction_14(Player* this, PlayState* play) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
Player_SetUpperAction(play, this, Player_UpperAction_15);
this->unk_ACC = 0;
- } else if (PlayerAnimation_OnFrame(&this->unk_284, 6.0f)) {
+ } else if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 6.0f)) {
Vec3f pos;
s16 untargetedRotY;
@@ -13367,7 +13622,7 @@ s32 Player_UpperAction_15(Player* this, PlayState* play) {
if (this->stateFlags3 & PLAYER_STATE3_800000) {
Player_SetUpperAction(play, this, Player_UpperAction_16);
- PlayerAnimation_PlayOnce(play, &this->unk_284, &gPlayerAnim_pz_cuttercatch);
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cuttercatch);
this->stateFlags3 &= ~PLAYER_STATE3_800000;
Player_PlaySfx(this, NA_SE_PL_CATCH_BOOMERANG);
Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_SWORD_N);
@@ -13378,7 +13633,7 @@ s32 Player_UpperAction_15(Player* this, PlayState* play) {
}
s32 Player_UpperAction_16(Player* this, PlayState* play) {
- if (!Player_UpperAction_11(this, play) && PlayerAnimation_Update(play, &this->unk_284)) {
+ if (!Player_UpperAction_11(this, play) && PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
if (this->stateFlags1 & PLAYER_STATE1_2000000) {
Player_SetUpperAction(play, this, Player_UpperAction_15);
this->unk_ACC = 0;
@@ -13411,7 +13666,7 @@ void Player_Action_0(Player* this, PlayState* play) {
void Player_Action_1(Player* this, PlayState* play) {
this->stateFlags3 |= PLAYER_STATE3_10000000;
PlayerAnimation_Update(play, &this->skelAnime);
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
if (R_PLAY_FILL_SCREEN_ON == 0) {
R_PLAY_FILL_SCREEN_ON = 20;
@@ -13498,7 +13753,7 @@ void Player_Action_2(Player* this, PlayState* play) {
}
func_80832F24(this);
- if (func_80833058(play, this, D_8085CFE4, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList1, true)) {
return;
}
@@ -13553,7 +13808,7 @@ void Player_Action_3(Player* this, PlayState* play) {
}
func_80832F24(this);
- if (func_80833058(play, this, D_8085CFEC, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList2, true)) {
return;
}
@@ -13622,7 +13877,8 @@ void Player_Action_4(Player* this, PlayState* play) {
}
func_80832F24(this);
- if ((this->actionVar2 == 0) && !func_80847880(play, this) && !func_80833058(play, this, D_8085D01C, 1)) {
+ if ((this->actionVar2 == 0) && !func_80847880(play, this) &&
+ !Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true)) {
if (func_8082FB68(this)) {
func_8083B23C(this, play);
return;
@@ -13689,7 +13945,7 @@ void Player_Action_5(Player* this, PlayState* play) {
Player_AnimSfx_PlayFloorWalk(this, this->linearVelocity);
}
- if (func_80833058(play, this, D_8085CFF8, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList3, true)) {
return;
}
@@ -13741,7 +13997,7 @@ void Player_Action_6(Player* this, PlayState* play) {
s32 sp2C;
func_8083EE60(this, play);
- if (func_80833058(play, this, D_8085D004, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) {
return;
}
@@ -13781,7 +14037,7 @@ void Player_Action_7(Player* this, PlayState* play) {
func_80832F24(this);
- if (func_80833058(play, this, D_8085D004, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) {
return;
}
@@ -13802,7 +14058,7 @@ void Player_Action_7(Player* this, PlayState* play) {
void Player_Action_8(Player* this, PlayState* play) {
s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime);
- if (func_80833058(play, this, D_8085D004, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) {
return;
}
@@ -13817,7 +14073,7 @@ void Player_Action_9(Player* this, PlayState* play) {
s32 var_v0;
func_8083F27C(play, this);
- if (func_80833058(play, this, D_8085D00C, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList5, true)) {
return;
}
@@ -13878,7 +14134,7 @@ void Player_Action_10(Player* this, PlayState* play) {
AnimationContext_SetLoadFrame(play, func_8082ED20(this), 0, this->skelAnime.limbCount,
this->skelAnime.morphTable);
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->skelAnime.morphTable, D_8085B9F0);
+ this->skelAnime.morphTable, sPlayerUpperBodyLimbCopyMap);
}
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play);
@@ -13887,7 +14143,7 @@ void Player_Action_10(Player* this, PlayState* play) {
yawTarget = this->actor.home.rot.y;
}
- if (func_80833058(play, this, D_8085D018, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList6, true)) {
return;
}
@@ -13910,8 +14166,8 @@ void Player_Action_11(Player* this, PlayState* play) {
}
PlayerAnimation_Update(play, &this->skelAnime);
- if (!func_80847880(play, this) &&
- (!func_80833058(play, this, D_8085D01C, 1) || (Player_Action_11 == this->actionFunc))) {
+ if (!func_80847880(play, this) && (!Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true) ||
+ (Player_Action_11 == this->actionFunc))) {
f32 speedTarget;
f32 temp_fv0;
f32 temp_fv1;
@@ -13951,7 +14207,8 @@ void Player_Action_12(Player* this, PlayState* play) {
PlayerAnimation_Update(play, &this->skelAnime);
func_80832F24(this);
if (!func_80847880(play, this)) {
- if (!func_80833058(play, this, D_8085D01C, 0) || (Player_Action_12 == this->actionFunc)) {
+ if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList7, false) ||
+ (Player_Action_12 == this->actionFunc)) {
if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) {
func_80839E74(this, play);
}
@@ -13965,7 +14222,7 @@ void Player_Action_13(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_20;
func_8083F57C(this, play);
- if (func_80833058(play, this, D_8085D028, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList8, true)) {
return;
}
@@ -13996,7 +14253,7 @@ void Player_Action_14(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_20;
func_8083F57C(this, play);
- if (func_80833058(play, this, D_8085D034, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList9, true)) {
return;
}
@@ -14026,7 +14283,7 @@ void Player_Action_15(Player* this, PlayState* play) {
f32 speedTarget;
s16 yawTarget;
- if (func_80833058(play, this, D_8085D00C, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList5, true)) {
return;
}
@@ -14053,7 +14310,7 @@ void Player_Action_16(Player* this, PlayState* play) {
s16 yawTarget;
func_80832F24(this);
- if (func_80833058(play, this, D_8085D044, 1)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList10, true)) {
return;
}
@@ -14080,7 +14337,7 @@ void Player_Action_17(Player* this, PlayState* play) {
}
if (DECR(this->actionVar2) == 0) {
- if (!func_80838A90(this, play)) {
+ if (!Player_ActionChange_13(this, play)) {
func_80836A98(this, D_8085BE84[PLAYER_ANIMGROUP_33][this->modelAnimType], play);
}
this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED;
@@ -14096,7 +14353,7 @@ void Player_Action_18(Player* this, PlayState* play) {
SkelAnime_Update(&this->unk_2C8);
if (!func_8083FE38(this, play)) {
- if (!func_8083A274(this, play)) {
+ if (!Player_ActionChange_11(this, play)) {
this->stateFlags1 &= ~PLAYER_STATE1_400000;
if (this->itemAction <= PLAYER_IA_MINUS1) {
@@ -14124,7 +14381,7 @@ void Player_Action_18(Player* this, PlayState* play) {
if (!Player_IsGoronOrDeku(this)) {
this->stateFlags1 |= PLAYER_STATE1_400000;
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
this->stateFlags1 &= ~PLAYER_STATE1_400000;
if (this->transformation == PLAYER_FORM_ZORA) {
func_8082F164(this, BTN_R | BTN_B);
@@ -14134,7 +14391,7 @@ void Player_Action_18(Player* this, PlayState* play) {
if (this->actionVar2 != 0) {
f32 yStick = sPlayerControlInput->rel.stick_y * 180;
f32 xStick = sPlayerControlInput->rel.stick_x * -120;
- s16 temp_a0 = this->actor.shape.rot.y - Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]);
+ s16 temp_a0 = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
s16 var_a1;
s16 temp_ft5;
s16 var_a2;
@@ -14164,7 +14421,7 @@ void Player_Action_18(Player* this, PlayState* play) {
this->actionVar1 = 0;
}
} else if (!func_8083FE38(this, play)) {
- if (func_8083A274(this, play)) {
+ if (Player_ActionChange_11(this, play)) {
func_8083FD80(this, play);
} else {
this->stateFlags1 &= ~PLAYER_STATE1_400000;
@@ -14198,8 +14455,9 @@ void Player_Action_18(Player* this, PlayState* play) {
void Player_Action_19(Player* this, PlayState* play) {
func_80832F24(this);
if (this->actionVar1 == 0) {
- D_80862B04 = func_8083216C(this, play);
- if ((Player_UpperAction_3 == this->upperActionFunc) || (func_808331FC(play, this, &this->unk_284, 4.0f) > 0)) {
+ D_80862B04 = Player_UpdateUpperBody(this, play);
+ if ((Player_UpperAction_3 == this->upperActionFunc) ||
+ (func_808331FC(play, this, &this->skelAnimeUpper, 4.0f) > 0)) {
Player_SetAction(play, this, Player_Action_2, 1);
}
} else {
@@ -14209,13 +14467,13 @@ void Player_Action_19(Player* this, PlayState* play) {
temp_v0 = func_808331FC(play, this, &this->skelAnime, 4.0f);
if ((temp_v0 != 0) && ((temp_v0 > 0) || PlayerAnimation_Update(play, &this->skelAnime))) {
PlayerAnimationHeader* anim;
- f32 lastFrame;
+ f32 endFrame;
Player_SetAction(play, this, Player_Action_18, 1);
Player_SetModelsForHoldingShield(this);
anim = D_8085BE84[PLAYER_ANIMGROUP_19][this->modelAnimType];
- lastFrame = Animation_GetLastFrame(anim);
- PlayerAnimation_Change(play, &this->skelAnime, anim, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f);
+ endFrame = Animation_GetLastFrame(anim);
+ PlayerAnimation_Change(play, &this->skelAnime, anim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE, 0.0f);
}
}
}
@@ -14405,7 +14663,7 @@ void Player_Action_25(Player* this, PlayState* play) {
func_8083CBC4(this, speedTarget, yawTarget, 1.0f, 0.05f, 0.1f, 0xC8);
}
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
if ((((this->stateFlags2 & PLAYER_STATE2_80000) && ((this->actionVar1 == 2) || (this->actionVar1 >= 4))) ||
!func_80839770(this, play)) &&
(this->actor.velocity.y < 0.0f)) {
@@ -14461,10 +14719,10 @@ void Player_Action_25(Player* this, PlayState* play) {
}
} else {
func_80837134(play, this);
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
}
- func_80838A90(this, play);
+ Player_ActionChange_13(this, play);
}
// sPlayerRollingAnimSfx
@@ -14510,7 +14768,7 @@ void Player_Action_26(Player* this, PlayState* play) {
}
}
} else if (!func_80840A30(play, this, &this->linearVelocity, 6.0f)) {
- if ((this->skelAnime.curFrame < 15.0f) || !func_80848570(this, play)) {
+ if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) {
f32 speedTarget;
s16 yawTarget;
@@ -14843,15 +15101,15 @@ void Player_Action_34(Player* this, PlayState* play) {
PlayerAnimation_Update(play, &this->skelAnime);
func_8083249C(this);
- temp_v0 = func_8083216C(this, play);
+ temp_v0 = Player_UpdateUpperBody(this, play);
if (((this->stateFlags1 & PLAYER_STATE1_800) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) ||
- (temp_v0 == 0)) {
+ !temp_v0) {
this->unk_D58(play, this);
}
}
void Player_Action_35(Player* this, PlayState* play) {
- if (func_80838A90(this, play) == 0) {
+ if (!Player_ActionChange_13(this, play)) {
if ((this->stateFlags3 & PLAYER_STATE3_10) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
func_80833AA0(this, play);
this->stateFlags1 |= PLAYER_STATE1_20000000;
@@ -15005,7 +15263,7 @@ void Player_Action_35(Player* this, PlayState* play) {
if (play->sceneId == SCENE_20SICHITAI) {
play->unk_1887C = 0;
}
- } else if (!func_808391D8(this, play)) {
+ } else if (!Player_ActionChange_4(this, play)) {
func_8083B2E4(this, play);
}
}
@@ -15013,7 +15271,7 @@ void Player_Action_35(Player* this, PlayState* play) {
}
if (this->stateFlags1 & PLAYER_STATE1_800) {
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
}
}
@@ -15032,7 +15290,7 @@ void Player_Action_36(Player* this, PlayState* play) {
}
animFinished = PlayerAnimation_Update(play, &this->skelAnime);
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
if (animFinished) {
if (this->actionVar2 == 0) {
@@ -15189,7 +15447,7 @@ void Player_Action_43(Player* this, PlayState* play) {
if (this->unk_AA5 == PLAYER_UNKAA5_3) {
if (func_800B7118(this) || func_8082ECCC(this)) {
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
}
}
@@ -15206,7 +15464,7 @@ void Player_Action_43(Player* this, PlayState* play) {
((this->unk_AA5 == PLAYER_UNKAA5_1) &&
CHECK_BTN_ANY(sPlayerControlInput->press.button,
BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_R | BTN_B | BTN_A))) ||
- func_808391D8(this, play)))) {
+ Player_ActionChange_4(this, play)))) {
func_80839ED0(this, play);
Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP);
} else if ((DECR(this->actionVar2) == 0) || (this->unk_AA5 != PLAYER_UNKAA5_3)) {
@@ -15224,7 +15482,7 @@ void Player_Action_44(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_20;
func_8083249C(this);
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED;
if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY)) {
@@ -15239,7 +15497,7 @@ void Player_Action_44(Player* this, PlayState* play) {
func_80837BD0(play, this);
this->actionVar2 = sp44;
} else if (!func_80847994(play, this) && !func_80847880(play, this) && !func_808387A0(play, this) &&
- ((this->talkActor != this->interactRangeActor) || !func_8083D23C(this, play))) {
+ ((this->talkActor != this->interactRangeActor) || !Player_ActionChange_2(this, play))) {
if (func_801242B4(this)) {
func_808353DC(play, this);
} else {
@@ -15277,24 +15535,24 @@ void Player_Action_44(Player* this, PlayState* play) {
this->actor.shape.rot.y = this->currentYaw;
if (this->actionVar1 != 0) {
if (!(this->stateFlags1 & PLAYER_STATE1_800)) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
this->actionVar1--;
if (this->actionVar1 != 0) {
- PlayerAnimation_Change(play, &this->unk_284, &gPlayerAnim_link_normal_talk_free, 1.0f, 0.0f,
- Animation_GetLastFrame(&gPlayerAnim_link_normal_talk_free),
+ PlayerAnimation_Change(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_talk_free, 1.0f,
+ 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_normal_talk_free),
ANIMMODE_ONCE, -6.0f);
}
}
}
AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable, D_8085B9F0);
+ this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap);
} else if (!(this->stateFlags1 & PLAYER_STATE1_800) &&
(this->skelAnime.animation == &gPlayerAnim_link_normal_talk_free_wait)) {
s32 temp_v0 = this->actor.focus.rot.y - this->actor.shape.rot.y;
if (ABS_ALT(temp_v0) > 0xFA0) {
PlayerAnimation_Change(
- play, &this->unk_284, D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType], 0.4f, 0.0f,
+ play, &this->skelAnimeUpper, D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType], 0.4f, 0.0f,
Animation_GetLastFrame(D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType]), ANIMMODE_ONCE, -6.0f);
this->actionVar1 = 2;
}
@@ -15831,7 +16089,7 @@ void Player_Action_52(Player* this, PlayState* play) {
this->unk_AA5 = PLAYER_UNKAA5_0;
this->actionVar1 = 0;
} else if ((this->actionVar2 < 2) || (this->actionVar2 >= 4)) {
- D_80862B04 = func_8083216C(this, play);
+ D_80862B04 = Player_UpdateUpperBody(this, play);
if (D_80862B04) {
this->actionVar1 = 0;
}
@@ -15845,27 +16103,27 @@ void Player_Action_52(Player* this, PlayState* play) {
if (!D_80862B04) {
if (this->actionVar1 != 0) {
- if (PlayerAnimation_Update(play, &this->unk_284)) {
+ if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) {
rideActor->stateFlags &= ~ENHORSE_FLAG_8;
this->actionVar1 = 0;
}
- if (this->unk_284.animation == &gPlayerAnim_link_uma_stop_muti) {
- if (PlayerAnimation_OnFrame(&this->unk_284, 23.0f)) {
+ if (this->skelAnimeUpper.animation == &gPlayerAnim_link_uma_stop_muti) {
+ if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 23.0f)) {
Player_PlaySfx(this, NA_SE_IT_LASH);
Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_LASH);
}
AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable);
+ this->skelAnimeUpper.jointTable);
} else {
- if (PlayerAnimation_OnFrame(&this->unk_284, 10.0f)) {
+ if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 10.0f)) {
Player_PlaySfx(this, NA_SE_IT_LASH);
Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_LASH);
}
AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
- this->unk_284.jointTable, D_8085B9F0);
+ this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap);
}
} else if (!CHECK_FLAG_ALL(this->actor.flags, 0x100)) {
PlayerAnimationHeader* anim = NULL;
@@ -15879,7 +16137,7 @@ void Player_Action_52(Player* this, PlayState* play) {
}
if (anim != NULL) {
- PlayerAnimation_PlayOnce(play, &this->unk_284, anim);
+ PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, anim);
this->actionVar1 = 1;
}
}
@@ -15893,8 +16151,8 @@ void Player_Action_52(Player* this, PlayState* play) {
func_8084FD7C(play, this, &rideActor->actor);
}
} else if ((this->csMode != PLAYER_CSMODE_NONE) ||
- (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !func_808391D8(this, play)) &&
- !func_80847BF0(this, play) && !func_80838A90(this, play))) {
+ (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionChange_4(this, play)) &&
+ !func_80847BF0(this, play) && !Player_ActionChange_13(this, play))) {
if (this->lockOnActor != NULL) {
if (func_800B7128(this)) {
this->upperLimbRot.y = func_8083C62C(this, true) - this->actor.shape.rot.y;
@@ -16007,7 +16265,7 @@ void Player_Action_54(Player* this, PlayState* play) {
this->actionVar2 = 0;
}
- if (!func_8082DAFC(play) && !func_80833058(play, this, D_8085D048, 1) &&
+ if (!func_8082DAFC(play) && !Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) &&
!func_8083B3B4(play, this, sPlayerControlInput) && ((this->actionVar2 != 0) || !func_80850734(play, this))) {
speedTarget = 0.0f;
yawTarget = this->actor.shape.rot.y;
@@ -16044,7 +16302,7 @@ void Player_Action_54(Player* this, PlayState* play) {
}
void Player_Action_55(Player* this, PlayState* play) {
- if (!func_80838A90(this, play)) {
+ if (!Player_ActionChange_13(this, play)) {
this->stateFlags2 |= PLAYER_STATE2_20;
func_808477D0(play, this, NULL, this->linearVelocity);
func_808475B4(this);
@@ -16090,7 +16348,7 @@ void Player_Action_56(Player* this, PlayState* play) {
func_808475B4(this);
func_8082F164(this, BTN_R);
- if (func_80833058(play, this, D_8085D048, false)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList11, false)) {
return;
}
@@ -16217,8 +16475,8 @@ void Player_Action_57(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_20;
func_808475B4(this);
func_8082F164(this, BTN_R);
- if (!func_80833058(play, this, D_8085D048, 1) && !func_8083B3B4(play, this, sPlayerControlInput) &&
- !func_80850854(play, this)) {
+ if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) &&
+ !func_8083B3B4(play, this, sPlayerControlInput) && !func_80850854(play, this)) {
func_808477D0(play, this, sPlayerControlInput, this->linearVelocity);
if (func_8082DA90(play)) {
speedTarget = this->linearVelocity;
@@ -16249,7 +16507,8 @@ void Player_Action_58(Player* this, PlayState* play) {
func_808475B4(this);
func_8082F164(this, BTN_R);
- if (!func_80833058(play, this, D_8085D048, 1) && !func_8083B3B4(play, this, sPlayerControlInput)) {
+ if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) &&
+ !func_8083B3B4(play, this, sPlayerControlInput)) {
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play);
if (speedTarget == 0.0f) {
@@ -16268,10 +16527,10 @@ void Player_Action_59(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_20;
this->actor.gravity = 0.0f;
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
func_8082F164(this, BTN_R);
- if (func_80838A90(this, play)) {
+ if (Player_ActionChange_13(this, play)) {
return;
}
@@ -16292,7 +16551,7 @@ void Player_Action_59(Player* this, PlayState* play) {
func_808477D0(play, this, sPlayerControlInput, this->actor.velocity.y);
this->unk_AAA = 0x3E80;
- if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) && !func_8083D23C(this, play) &&
+ if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) &&
!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.depthInWater < 120.0f)) {
func_808481CC(play, this, -2.0f);
} else {
@@ -16596,7 +16855,7 @@ void Player_Action_63(Player* this, PlayState* play) {
this->talkActor = this->tatlActor;
this->tatlActor->textId = -this->tatlTextId;
Player_TalkWithPlayer(play, this->talkActor);
- } else if (!func_80838A90(this, play)) {
+ } else if (!Player_ActionChange_13(this, play)) {
func_80836A5C(this, play);
Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]);
}
@@ -16775,8 +17034,8 @@ void Player_Action_65(Player* this, PlayState* play) {
} else {
if ((this->skelAnime.animation == &gPlayerAnim_link_demo_get_itemB) ||
(this->skelAnime.animation == &gPlayerAnim_pn_getB)) {
- Math_ScaledStepToS(&this->actor.shape.rot.y,
- BINANG_ADD(Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]), 0x8000), 0xFA0);
+ Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)), 0x8000),
+ 0xFA0);
} else if ((this->skelAnime.animation == &gPlayerAnim_pn_getA) &&
PlayerAnimation_OnFrame(&this->skelAnime, 10.0f)) {
Player_AnimSfx_PlayFloorLand(this);
@@ -16978,7 +17237,7 @@ void Player_Action_68(Player* this, PlayState* play) {
Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER);
}
- if (func_8012364C(play, this, this->heldItemButton) == ITEM_BOTTLE) {
+ if (Player_GetItemOnButton(play, this, this->heldItemButton) == ITEM_BOTTLE) {
Actor* interactRangeActor = this->interactRangeActor;
if (interactRangeActor != NULL) {
@@ -17090,7 +17349,7 @@ void Player_Action_70(Player* this, PlayState* play) {
if (PlayerAnimation_Update(play, &this->skelAnime)) {
Player_StopCutscene(this);
- if (!func_80838A90(this, play)) {
+ if (!Player_ActionChange_13(this, play)) {
func_80839E74(this, play);
}
} else if (PlayerAnimation_OnFrame(&this->skelAnime, 76.0f)) {
@@ -17198,11 +17457,11 @@ void Player_Action_73(Player* this, PlayState* play) {
Audio_PlaySfx_AtPosWithSyncedFreqAndVolume(
&this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), this->actor.speed);
- if (func_80838A90(this, play)) {
+ if (Player_ActionChange_13(this, play)) {
return;
}
- if ((this->transformation == PLAYER_FORM_GORON) && func_8083A114(this, play)) {
+ if ((this->transformation == PLAYER_FORM_GORON) && Player_ActionChange_6(this, play)) {
return;
}
@@ -17326,7 +17585,7 @@ void Player_Action_77(Player* this, PlayState* play) {
}
void Player_Action_78(Player* this, PlayState* play) {
- func_808365DC(this, play);
+ Player_ActionChange_1(this, play);
}
void Player_Action_79(Player* this, PlayState* play) {
@@ -17360,7 +17619,7 @@ void Player_Action_80(Player* this, PlayState* play) {
} else {
this->stateFlags1 &= ~PLAYER_STATE1_100000;
if ((play->sceneId == SCENE_20SICHITAI) &&
- (func_8012364C(play, this, func_8082FDC4()) == ITEM_PICTOGRAPH_BOX)) {
+ (Player_GetItemOnButton(play, this, func_8082FDC4()) == ITEM_PICTOGRAPH_BOX)) {
s32 requiredScopeTemp;
play->actorCtx.flags |= ACTORCTX_FLAG_PICTO_BOX_ON;
@@ -17383,7 +17642,7 @@ void Player_Action_81(Player* this, PlayState* play) {
this->unk_AA5 = PLAYER_UNKAA5_3;
func_8083868C(play, this);
PlayerAnimation_Update(play, &this->skelAnime);
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
this->upperLimbRot.y = func_80847190(play, this, 1) - this->actor.shape.rot.y;
this->unk_AA6 |= 0x80;
@@ -17480,9 +17739,9 @@ void Player_Action_84(Player* this, PlayState* play) {
((this->meleeWeaponAnimation >= PLAYER_MWA_FLIPSLASH_FINISH) &&
(this->meleeWeaponAnimation <= PLAYER_MWA_ZORA_JUMPKICK_FINISH) && (this->skelAnime.curFrame > 2.0f) &&
func_808333CC(this))) {
- D_80862B48 = this->actionVar2;
+ sPlayerUseHeldItem = this->actionVar2;
- if (!func_80848570(this, play)) {
+ if (!Player_ActionChange_7(this, play)) {
PlayerAnimationHeader* anim = func_80123420(this) ? attackInfoEntry->unk_8 : attackInfoEntry->unk_4;
func_8082DC38(this);
@@ -17494,8 +17753,8 @@ void Player_Action_84(Player* this, PlayState* play) {
u8 moveFlags = this->skelAnime.moveFlags;
if (this->transformation == PLAYER_FORM_ZORA) {
- if (func_8083A580(this, play)) {
- anim = this->unk_284.animation;
+ if (Player_ActionChange_8(this, play)) {
+ anim = this->skelAnimeUpper.animation;
}
this->unk_ADC = 0;
} else if ((anim == &gPlayerAnim_link_fighter_Lpower_jump_kiru_end) &&
@@ -17737,10 +17996,10 @@ void Player_Action_86(Player* this, PlayState* play) {
func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_MASK_TRANSFORMATION]);
sPlayerControlInput = play->state.input;
- Camera_ChangeMode(play->cameraPtrs[play->activeCamId],
+ Camera_ChangeMode(GET_ACTIVE_CAM(play),
(this->transformation == PLAYER_FORM_HUMAN) ? CAM_MODE_NORMAL : CAM_MODE_JUMP);
this->stateFlags2 |= PLAYER_STATE2_40;
- this->actor.shape.rot.y = Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]) + 0x8000;
+ this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000;
func_80855218(play, this, &sp4C);
@@ -17814,8 +18073,7 @@ void Player_Action_86(Player* this, PlayState* play) {
}
void Player_Action_87(Player* this, PlayState* play) {
- Camera_ChangeMode(play->cameraPtrs[play->activeCamId],
- (this->prevMask == PLAYER_MASK_NONE) ? CAM_MODE_NORMAL : CAM_MODE_JUMP);
+ Camera_ChangeMode(GET_ACTIVE_CAM(play), (this->prevMask == PLAYER_MASK_NONE) ? CAM_MODE_NORMAL : CAM_MODE_JUMP);
if (R_PLAY_FILL_SCREEN_ON != 0) {
R_PLAY_FILL_SCREEN_ALPHA -= R_PLAY_FILL_SCREEN_ON;
@@ -18027,7 +18285,7 @@ void Player_Action_93(Player* this, PlayState* play) {
PlayerAnimation_Update(play, &this->skelAnime);
- if (func_80838A90(this, play)) {
+ if (Player_ActionChange_13(this, play)) {
return;
}
@@ -18048,7 +18306,7 @@ void Player_Action_93(Player* this, PlayState* play) {
if (this->unk_ABC < -3900.0f) {
this->unk_ABC = -3900.0f;
this->actionVar1 = 2;
- this->actor.shape.rot.y = Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]);
+ this->actor.shape.rot.y = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
this->actor.scale.y = 0.01f;
this->currentYaw = this->actor.world.rot.y = this->actor.shape.rot.y;
} else {
@@ -18211,7 +18469,7 @@ void Player_Action_94(Player* this, PlayState* play) {
this->boomerangActor = NULL;
}
- if (func_80838A90(this, play)) {
+ if (Player_ActionChange_13(this, play)) {
return;
}
@@ -18404,7 +18662,7 @@ void Player_Action_95(Player* this, PlayState* play) {
PlayerAnimation_Update(play, &this->skelAnime);
Player_SetCylinderForAttack(this, DMG_DEKU_SPIN, 1, 30);
- if (!func_80838A90(this, play)) {
+ if (!Player_ActionChange_13(this, play)) {
s16 prevYaw = this->currentYaw;
f32 speedTarget;
s16 yawTarget;
@@ -18554,7 +18812,7 @@ void func_80857AEC(PlayState* play, Player* this) {
// Goron rolling related
void Player_Action_96(Player* this, PlayState* play) {
- if (func_80833058(play, this, D_8085D050, 0)) {
+ if (Player_TryActionChangeList(play, this, sPlayerActionChangeList12, false)) {
return;
}
@@ -19500,9 +19758,9 @@ void Player_CsAction_0(PlayState* play, Player* this, CsCmdActorCue* cue) {
} else {
PlayerAnimation_Update(play, &this->skelAnime);
if (func_801240DC(this) || (this->stateFlags1 & PLAYER_STATE1_800)) {
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
} else if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) {
- func_8083D23C(this, play);
+ Player_ActionChange_2(this, play);
}
}
}
@@ -19537,7 +19795,7 @@ void Player_CsAction_2(PlayState* play, Player* this, CsCmdActorCue* cue) {
} else {
PlayerAnimation_Update(play, &this->skelAnime);
if (func_801240DC(this) || (this->stateFlags1 & PLAYER_STATE1_800)) {
- func_8083216C(this, play);
+ Player_UpdateUpperBody(this, play);
}
}
}
@@ -19920,7 +20178,7 @@ void Player_CsAction_38(PlayState* play, Player* this, CsCmdActorCue* cue) {
void Player_CsAction_39(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_CsAnim_11(play, this, cue);
- if (func_8083D23C(this, play)) {
+ if (Player_ActionChange_2(this, play)) {
play->csCtx.state = CS_STATE_STOP;
CutsceneManager_Stop(CutsceneManager_GetCurrentCsId());
}
@@ -20010,8 +20268,8 @@ void Player_CsAction_End(PlayState* play, Player* this, CsCmdActorCue* cue) {
func_8082DC64(play, this);
} else {
func_80839ED0(this, play);
- if (!func_808391D8(this, play)) {
- func_8083D23C(this, play);
+ if (!Player_ActionChange_4(this, play)) {
+ Player_ActionChange_2(this, play);
}
}
@@ -20062,7 +20320,7 @@ void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, PlayerCsMo
void func_8085AD5C(PlayState* play, Player* this, PlayerCsMode csMode) {
if ((csMode != PLAYER_CSMODE_1) && (csMode != PLAYER_CSMODE_WAIT) && (csMode != PLAYER_CSMODE_20) &&
(csMode != PLAYER_CSMODE_END)) {
- func_8082DCA0(play, this);
+ Player_DetachHeldActor(play, this);
}
}
@@ -20079,7 +20337,7 @@ void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue) {
if ((sPlayerCsModes[this->cueId] == PLAYER_CSMODE_68) && (play->sceneId == SCENE_OKUJOU)) {
this->unk_AA5 = PLAYER_UNKAA5_5;
- if (func_80838A90(this, play)) {
+ if (Player_ActionChange_13(this, play)) {
this->csMode = PLAYER_CSMODE_NONE;
}
return;
@@ -20156,7 +20414,7 @@ s32 Player_StartFishing(PlayState* play) {
Player* player = GET_PLAYER(play);
func_8082DE50(play, player);
- func_80831990(play, player, ITEM_FISHING_ROD);
+ Player_UseItem(play, player, ITEM_FISHING_ROD);
return 1;
}
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index a78a55e4f..5fcd7bf88 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -2199,7 +2199,7 @@
0x801234D4:("func_801234D4",),
0x80123590:("func_80123590",),
0x801235DC:("func_801235DC",),
- 0x8012364C:("func_8012364C",),
+ 0x8012364C:("Player_GetItemOnButton",),
0x80123810:("func_80123810",),
0x80123960:("Player_ActionToModelGroup",),
0x801239AC:("Player_SetModelsForHoldingShield",),
@@ -2838,14 +2838,14 @@
0x8014995C:("Message_DrawTextChar",),
0x80149C18:("func_80149C18",),
0x80149EBC:("Message_FindMessage",),
- 0x80149F74:("func_80149F74",),
+ 0x80149F74:("Message_DrawItemIcon",),
0x8014AAD0:("Message_HandleOcarina",),
0x8014ADBC:("func_8014ADBC",),
0x8014C70C:("Message_LoadItemIcon",),
0x8014CC14:("Message_LoadChar",),
0x8014CCB4:("func_8014CCB4",),
0x8014CDF0:("func_8014CDF0",),
- 0x8014CFDC:("func_8014CFDC",),
+ 0x8014CFDC:("Message_SetupLoadItemIcon",),
0x8014D304:("func_8014D304",),
0x8014D62C:("func_8014D62C",),
0x8014D7B4:("func_8014D7B4",),
@@ -2881,9 +2881,9 @@
0x80158D98:("Message_LoadRupeesNES",),
0x80158FB0:("Message_LoadTimeNES",),
0x8015926C:("Message_LoadOwlWarpTextNES",),
- 0x80159438:("func_80159438",),
- 0x8015966C:("func_8015966C",),
- 0x8015B198:("func_8015B198",),
+ 0x80159438:("Message_GetTimerDigitsNES",),
+ 0x8015966C:("Message_DrawTextNES",),
+ 0x8015B198:("Message_DecodeNES",),
0x8015E750:("Message_FindCreditsMessage",),
0x8015E7EC:("Message_DrawTextCredits",),
0x8015F8A8:("Message_DecodeCredits",),
@@ -4256,7 +4256,7 @@
0x8082DC28:("func_8082DC28",),
0x8082DC38:("func_8082DC38",),
0x8082DC64:("func_8082DC64",),
- 0x8082DCA0:("func_8082DCA0",),
+ 0x8082DCA0:("Player_DetachHeldActor",),
0x8082DD2C:("func_8082DD2C",),
0x8082DE14:("func_8082DE14",),
0x8082DE50:("func_8082DE50",),
@@ -4314,7 +4314,7 @@
0x8082F164:("func_8082F164",),
0x8082F1AC:("func_8082F1AC",),
0x8082F43C:("Player_SetUpperAction",),
- 0x8082F470:("func_8082F470",),
+ 0x8082F470:("Player_InitItemActionWithAnim",),
0x8082F524:("Player_ItemToItemAction",),
0x8082F594:("Player_InitItemAction_DoNothing",),
0x8082F5A4:("Player_InitItemAction_DekuStick",),
@@ -4323,30 +4323,30 @@
0x8082F62C:("Player_InitItemAction_SpawnExplosive",),
0x8082F7F4:("Player_InitItemAction_SpawnHookshot",),
0x8082F8A0:("Player_InitItemAction_5",),
- 0x8082F8BC:("func_8082F8BC",),
+ 0x8082F8BC:("Player_InitItemAction",),
0x8082F938:("Player_OverrideBlureColors",),
0x8082FA5C:("func_8082FA5C",),
0x8082FB68:("func_8082FB68",),
0x8082FBE8:("func_8082FBE8",),
0x8082FC24:("func_8082FC24",),
0x8082FC60:("func_8082FC60",),
- 0x8082FC78:("func_8082FC78",),
- 0x8082FCC4:("func_8082FCC4",),
+ 0x8082FC78:("Player_ItemIsInUse",),
+ 0x8082FCC4:("Player_ItemIsItemAction",),
0x8082FD0C:("func_8082FD0C",),
0x8082FDC4:("func_8082FDC4",),
- 0x8082FE0C:("func_8082FE0C",),
- 0x808302CC:("func_808302CC",),
- 0x808304BC:("func_808304BC",),
+ 0x8082FE0C:("Player_ProcessItemButtons",),
+ 0x808302CC:("Player_StartChangingHeldItem",),
+ 0x808304BC:("Player_UpdateItems",),
0x808305BC:("func_808305BC",),
0x808306F8:("func_808306F8",),
- 0x808308DC:("func_808308DC",),
+ 0x808308DC:("Player_FinishItemChange",),
0x808309CC:("func_808309CC",),
0x80830A58:("func_80830A58",),
0x80830AE8:("func_80830AE8",),
0x80830B38:("func_80830B38",),
0x80830B88:("func_80830B88",),
0x80830CE8:("func_80830CE8",),
- 0x80830D40:("func_80830D40",),
+ 0x80830D40:("Player_WaitToFinishItemChange",),
0x80830DF0:("func_80830DF0",),
0x80830E30:("func_80830E30",),
0x80830F9C:("func_80830F9C",),
@@ -4362,15 +4362,15 @@
0x80831494:("Player_SetAction",),
0x8083172C:("Player_SetAction_PreserveMoveFlags",),
0x80831760:("Player_SetAction_PreserveItemAction",),
- 0x808317C4:("func_808317C4",),
+ 0x808317C4:("Player_DestroyHookshot",),
0x80831814:("func_80831814",),
0x808318C0:("func_808318C0",),
0x80831944:("func_80831944",),
- 0x80831990:("func_80831990",),
+ 0x80831990:("Player_UseItem",),
0x80831F34:("func_80831F34",),
- 0x80832090:("func_80832090",),
+ 0x80832090:("Player_CanUpdateItems",),
0x8083213C:("func_8083213C",),
- 0x8083216C:("func_8083216C",),
+ 0x8083216C:("Player_UpdateUpperBody",),
0x808323C0:("func_808323C0",),
0x80832444:("func_80832444",),
0x8083249C:("func_8083249C",),
@@ -4383,7 +4383,7 @@
0x80832CAC:("Player_CalcSpeedAndYawFromControlStick",),
0x80832F24:("func_80832F24",),
0x80832F78:("Player_GetMovementSpeedAndYaw",),
- 0x80833058:("func_80833058",),
+ 0x80833058:("Player_TryActionChangeList",),
0x808331FC:("func_808331FC",),
0x808332A0:("func_808332A0",),
0x808333CC:("func_808333CC",),
@@ -4413,7 +4413,7 @@
0x80834CD0:("func_80834CD0",),
0x80834D50:("func_80834D50",),
0x80834DB8:("func_80834DB8",),
- 0x80834DFC:("func_80834DFC",),
+ 0x80834DFC:("Player_ActionChange_12",),
0x80835324:("func_80835324",),
0x808353DC:("func_808353DC",),
0x80835428:("func_80835428",),
@@ -4430,7 +4430,7 @@
0x80835EAC:("Player_Door_Staircase",),
0x8083604C:("Player_Door_Sliding",),
0x80836258:("Player_Door_Knob",),
- 0x808365DC:("func_808365DC",),
+ 0x808365DC:("Player_ActionChange_1",),
0x80836888:("func_80836888",),
0x8083692C:("func_8083692C",),
0x80836988:("func_80836988",),
@@ -4470,9 +4470,9 @@
0x808388B8:("func_808388B8",),
0x808389BC:("func_808389BC",),
0x80838A20:("func_80838A20",),
- 0x80838A90:("func_80838A90",),
- 0x808391D8:("func_808391D8",),
- 0x80839518:("func_80839518",),
+ 0x80838A90:("Player_ActionChange_13",),
+ 0x808391D8:("Player_ActionChange_4",),
+ 0x80839518:("Player_ActionChange_0",),
0x808395F0:("func_808395F0",),
0x808396B8:("func_808396B8",),
0x80839770:("func_80839770",),
@@ -4481,19 +4481,19 @@
0x80839978:("func_80839978",),
0x80839A10:("func_80839A10",),
0x80839A84:("func_80839A84",),
- 0x80839B18:("func_80839B18",),
+ 0x80839B18:("Player_ActionChange_10",),
0x80839CD8:("func_80839CD8",),
0x80839E3C:("func_80839E3C",),
0x80839E74:("func_80839E74",),
0x80839ED0:("func_80839ED0",),
0x80839F98:("func_80839F98",),
0x8083A04C:("func_8083A04C",),
- 0x8083A0CC:("func_8083A0CC",),
- 0x8083A114:("func_8083A114",),
- 0x8083A274:("func_8083A274",),
+ 0x8083A0CC:("Player_ActionChange_14",),
+ 0x8083A114:("Player_ActionChange_6",),
+ 0x8083A274:("Player_ActionChange_11",),
0x8083A4A4:("func_8083A4A4",),
0x8083A548:("func_8083A548",),
- 0x8083A580:("func_8083A580",),
+ 0x8083A580:("Player_ActionChange_8",),
0x8083A658:("func_8083A658",),
0x8083A6C0:("func_8083A6C0",),
0x8083A794:("func_8083A794",),
@@ -4531,19 +4531,19 @@
0x8083CB04:("func_8083CB04",),
0x8083CB58:("func_8083CB58",),
0x8083CBC4:("func_8083CBC4",),
- 0x8083CCB4:("func_8083CCB4",),
+ 0x8083CCB4:("Player_ActionChange_3",),
0x8083CF68:("Player_HandleSlopes",),
0x8083D168:("func_8083D168",),
- 0x8083D23C:("func_8083D23C",),
+ 0x8083D23C:("Player_ActionChange_2",),
0x8083D6DC:("func_8083D6DC",),
0x8083D738:("func_8083D738",),
- 0x8083D78C:("func_8083D78C",),
+ 0x8083D78C:("Player_ActionChange_9",),
0x8083D860:("func_8083D860",),
0x8083DCC4:("func_8083DCC4",),
0x8083DD1C:("func_8083DD1C",),
0x8083DEE4:("func_8083DEE4",),
0x8083DF38:("func_8083DF38",),
- 0x8083DFC4:("func_8083DFC4",),
+ 0x8083DFC4:("Player_ActionChange_5",),
0x8083E14C:("func_8083E14C",),
0x8083E234:("func_8083E234",),
0x8083E28C:("func_8083E28C",),
@@ -4642,11 +4642,11 @@
0x808482E0:("func_808482E0",),
0x808484CC:("func_808484CC",),
0x808484F0:("func_808484F0",),
- 0x80848570:("func_80848570",),
+ 0x80848570:("Player_ActionChange_7",),
0x80848640:("func_80848640",),
0x80848780:("Player_UpperAction_0",),
0x808487B8:("Player_UpperAction_1",),
- 0x80848808:("Player_UpperAction_2",),
+ 0x80848808:("Player_UpperAction_ChangeHeldItem",),
0x8084894C:("Player_UpperAction_3",),
0x80848A0C:("Player_UpperAction_4",),
0x80848AB0:("Player_UpperAction_5",),
@@ -13493,7 +13493,7 @@
0x80B33E54:("EnKbt_Destroy",),
0x80B33E64:("func_80B33E64",),
0x80B33E8C:("func_80B33E8C",),
- 0x80B33EF0:("func_80B33EF0",),
+ 0x80B33EF0:("EnKbt_ChangeAnim",),
0x80B3403C:("func_80B3403C",),
0x80B34078:("func_80B34078",),
0x80B3415C:("func_80B3415C",),
@@ -13678,7 +13678,7 @@
0x80B40800:("EnKgy_Init",),
0x80B40B04:("EnKgy_Destroy",),
0x80B40B38:("func_80B40B38",),
- 0x80B40BC0:("func_80B40BC0",),
+ 0x80B40BC0:("EnKgy_ChangeAnimLoopMorph",),
0x80B40BFC:("func_80B40BFC",),
0x80B40C38:("func_80B40C38",),
0x80B40C74:("func_80B40C74",),
@@ -15482,8 +15482,8 @@
0x80BC11B4:("EnNb_PostLimbDraw",),
0x80BC1278:("EnNb_TransformLimbDraw",),
0x80BC1374:("EnNb_Draw",),
- 0x80BC1900:("func_80BC1900",),
- 0x80BC192C:("func_80BC192C",),
+ 0x80BC1900:("EnJa_UpdateSkelAnime",),
+ 0x80BC192C:("EnJa_ChangeAnim",),
0x80BC1984:("func_80BC1984",),
0x80BC19FC:("func_80BC19FC",),
0x80BC1A68:("func_80BC1A68",),
@@ -15951,7 +15951,7 @@
0x80BDAF24:("ObjHsStump_Draw",),
0x80BDB040:("EnHiddenNuts_Init",),
0x80BDB188:("EnHiddenNuts_Destroy",),
- 0x80BDB1B4:("func_80BDB1B4",),
+ 0x80BDB1B4:("EnHiddenNuts_ChangeAnim",),
0x80BDB268:("func_80BDB268",),
0x80BDB2B8:("func_80BDB2B8",),
0x80BDB580:("func_80BDB580",),
@@ -16283,8 +16283,8 @@
0x80BF0F10:("EffStk_Draw",),
0x80BF1150:("func_80BF1150",),
0x80BF1200:("func_80BF1200",),
- 0x80BF1258:("func_80BF1258",),
- 0x80BF1284:("func_80BF1284",),
+ 0x80BF1258:("EnIg_UpdateSkelAnime",),
+ 0x80BF1284:("EnIg_ChangeAnim",),
0x80BF1354:("func_80BF1354",),
0x80BF13E4:("func_80BF13E4",),
0x80BF146C:("func_80BF146C",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index c5d4d208f..e69d2e296 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -2058,10 +2058,10 @@
0x801D045A:("D_801D045A","UNK_TYPE1","",0x1),
0x801D0462:("D_801D0462","UNK_TYPE1","",0x1),
0x801D0468:("D_801D0468","UNK_TYPE1","",0x1),
- 0x801D0470:("D_801D0470","UNK_TYPE1","",0x1),
- 0x801D06F0:("D_801D06F0","char","[]",0x18),
+ 0x801D0470:("sNESFontWidths","UNK_TYPE1","",0x1),
+ 0x801D06F0:("sRupeesTextLocalization","char","[]",0x18),
0x801D0708:("D_801D0708","char","[]",1),
- 0x801D0710:("D_801D0710","UNK_TYPE1","",0x1),
+ 0x801D0710:("sRupeesTextLength","UNK_TYPE1","",0x1),
0x801D0714:("D_801D0714","char","[]",0x1),
0x801D0724:("D_801D0724","char","[]",0x1),
0x801D0730:("D_801D0730","char","[]",0x1),
@@ -2083,14 +2083,13 @@
0x801D07DC:("D_801D07DC","UNK_TYPE1","",0x1),
0x801D080C:("D_801D080C","UNK_TYPE1","",0x1),
0x801D083C:("D_801D083C","UNK_TYPE1","",0x1),
- 0x801D086C:("D_801D086C","UNK_TYPE1","",0x1),
- 0x801D0890:("D_801D0890","UNK_TYPE1","",0x1),
+ 0x801D086C:("D_801D086C","UNK_TYPE1","",0x30),
0x801D089C:("D_801D089C","UNK_TYPE1","",0x1),
0x801D08CC:("D_801D08CC","UNK_TYPE1","",0x1),
0x801D08D8:("D_801D08D8","UNK_TYPE1","",0x1),
0x801D08E4:("D_801D08E4","UNK_TYPE1","",0x1),
- 0x801D08E8:("D_801D08E8","UNK_TYPE1","",0x1),
- 0x801D0900:("D_801D0900","UNK_TYPE1","",0x1),
+ 0x801D08E8:("sMaskCodeTextENG","UNK_TYPE1","",0x1),
+ 0x801D0900:("sMaskCodeTextLengthENG","UNK_TYPE1","",0x1),
0x801D0B50:("Player_InitVars","ActorInit","",0x20),
0x801D0B70:("gKaleidoMgrOverlayTable","KaleidoMgrOverlay","",0x38),
0x801D0BA8:("sKaleidoAreaPtr","void*","",0x4),
@@ -4915,7 +4914,7 @@
0x8082DA82:("sPauseZRCursorGreen","UNK_TYPE1","",0x1),
0x8082DA84:("sPauseZRCursorBlue","UNK_TYPE1","",0x1),
0x8082DA86:("sPauseZRCursorAlpha","UNK_TYPE1","",0x1),
- 0x8085B9F0:("D_8085B9F0","UNK_TYPE1","",0x1),
+ 0x8085B9F0:("sPlayerUpperBodyLimbCopyMap","UNK_TYPE1","",0x1),
0x8085BA08:("D_8085BA08","UNK_TYPE1","",0x1),
0x8085BA20:("D_8085BA20","UNK_TYPE1","",0x1),
0x8085BA38:("sPlayerAgeProperties","UNK_TYPE1","",0x1),
@@ -4945,10 +4944,10 @@
0x8085C96C:("D_8085C96C","UNK_TYPE1","",0x1),
0x8085C98C:("sZoraBarrierEnvLighting","UNK_TYPE1","",0x1),
0x8085C99C:("sItemActionParams","UNK_TYPE1","",0x1),
- 0x8085C9F0:("D_8085C9F0","UNK_PTR","",0x4),
- 0x8085CB3C:("sPlayerInitItemActionFuncs","UNK_PTR","",0x4),
- 0x8085CC88:("D_8085CC88","UNK_TYPE1","",0x1),
- 0x8085CD00:("D_8085CD00","s8","[36]",0x24),
+ 0x8085C9F0:("sPlayerUpperActionUpdateFuncs","UNK_PTR","",0x4),
+ 0x8085CB3C:("sPlayerItemActionInitFuncs","UNK_PTR","",0x4),
+ 0x8085CC88:("sPlayerItemChangeInfo","UNK_TYPE1","",0x1),
+ 0x8085CD00:("sPlayerItemChangeTypes","s8","[36]",0x24),
0x8085CD24:("sPlayerExplosiveInfo","UNK_TYPE1","",0x1),
0x8085CD30:("sMeleeAttackAnimInfo","UNK_TYPE1","",0x220),
0x8085CF50:("D_8085CF50","UNK_TYPE1","",0x1),
@@ -4960,7 +4959,7 @@
0x8085CF80:("D_8085CF80","UNK_TYPE1","",0x1),
0x8085CF84:("D_8085CF84","UNK_TYPE1","",0x1),
0x8085CF88:("D_8085CF88","BlureColors","[2]",0x20),
- 0x8085CFA8:("D_8085CFA8","u16","[4]",0x8),
+ 0x8085CFA8:("sPlayerItemButtons","u16","[4]",0x8),
0x8085CFB0:("D_8085CFB0","UNK_TYPE1","",0x1),
0x8085CFB8:("sMagicArrowCosts","u8","[4]",0x4),
0x8085CFBC:("D_8085CFBC","UNK_TYPE1","",0x1),
@@ -4968,19 +4967,19 @@
0x8085CFCC:("D_8085CFCC","UNK_TYPE1","",0x1),
0x8085CFD4:("D_8085CFD4","UNK_TYPE1","",0x1),
0x8085CFDC:("D_8085CFDC","UNK_TYPE1","",0x1),
- 0x8085CFE4:("D_8085CFE4","UNK_TYPE1","",0x1),
- 0x8085CFEC:("D_8085CFEC","UNK_TYPE1","",0x1),
- 0x8085CFF8:("D_8085CFF8","UNK_TYPE1","",0x1),
- 0x8085D004:("D_8085D004","UNK_TYPE1","",0x1),
- 0x8085D00C:("D_8085D00C","UNK_TYPE1","",0x1),
- 0x8085D018:("D_8085D018","UNK_TYPE1","",0x1),
- 0x8085D01C:("D_8085D01C","UNK_TYPE1","",0x1),
- 0x8085D028:("D_8085D028","UNK_TYPE1","",0x1),
- 0x8085D034:("D_8085D034","UNK_TYPE1","",0x1),
- 0x8085D044:("D_8085D044","UNK_TYPE1","",0x1),
- 0x8085D048:("D_8085D048","UNK_TYPE1","",0x1),
- 0x8085D050:("D_8085D050","UNK_TYPE1","",0x1),
- 0x8085D054:("D_8085D054","UNK_PTR","",0x4),
+ 0x8085CFE4:("sPlayerActionChangeList1","UNK_TYPE1","",0x1),
+ 0x8085CFEC:("sPlayerActionChangeList2","UNK_TYPE1","",0x1),
+ 0x8085CFF8:("sPlayerActionChangeList3","UNK_TYPE1","",0x1),
+ 0x8085D004:("sPlayerActionChangeList4","UNK_TYPE1","",0x1),
+ 0x8085D00C:("sPlayerActionChangeList5","UNK_TYPE1","",0x1),
+ 0x8085D018:("sPlayerActionChangeList6","UNK_TYPE1","",0x1),
+ 0x8085D01C:("sPlayerActionChangeList7","UNK_TYPE1","",0x1),
+ 0x8085D028:("sPlayerActionChangeList8","UNK_TYPE1","",0x1),
+ 0x8085D034:("sPlayerActionChangeList9","UNK_TYPE1","",0x1),
+ 0x8085D044:("sPlayerActionChangeList10","UNK_TYPE1","",0x1),
+ 0x8085D048:("sPlayerActionChangeList11","UNK_TYPE1","",0x1),
+ 0x8085D050:("sPlayerActionChangeList12","UNK_TYPE1","",0x1),
+ 0x8085D054:("sPlayerActionChangeFuncs","UNK_PTR","",0x4),
0x8085D090:("D_8085D090","UNK_TYPE1","",0x1),
0x8085D094:("D_8085D094","UNK_TYPE1","",0x6),
0x8085D09C:("D_8085D09C","UNK_TYPE4","",0x4),
@@ -5018,7 +5017,7 @@
0x8085D2B0:("D_8085D2B0","UNK_TYPE1","",0x1),
0x8085D2B4:("D_8085D2B4","UNK_TYPE1","",0x1),
0x8085D2C0:("sInitChain","ActorInitVar","",0x4),
- 0x8085D2C4:("D_8085D2C4","UNK_TYPE4","",0x4),
+ 0x8085D2C4:("sPlayerSkeletonBaseTransl","UNK_TYPE4","",0x4),
0x8085D2CC:("D_8085D2CC","UNK_PTR","",0x4),
0x8085D30C:("D_8085D30C","EffectBlureInit2","",0x24),
0x8085D330:("D_8085D330","EffectTireMarkInit","",0x8),
@@ -5378,8 +5377,8 @@
0x80862B3C:("D_80862B3C","f32","",0x4),
0x80862B40:("sPlayerFloorEffect","UNK_TYPE1","",0x1),
0x80862B44:("sPlayerControlInput","UNK_TYPE1","",0x1),
- 0x80862B48:("D_80862B48","UNK_TYPE1","",0x1),
- 0x80862B4C:("D_80862B4C","UNK_TYPE1","",0x1),
+ 0x80862B48:("sPlayerUseHeldItem","UNK_TYPE1","",0x1),
+ 0x80862B4C:("sPlayerHeldItemButtonIsHeldDown","UNK_TYPE1","",0x1),
0x80862B50:("D_80862B50","UNK_TYPE1","",0x1),
0x80862B6C:("D_80862B6C","UNK_TYPE1","",0x1),
0x808637B0:("En_Test_InitVars","ActorInit","",0x20),
@@ -15805,8 +15804,8 @@
0x80BDAFA0:("D_80BDAFA0","f32","",0x4),
0x80BDC0B0:("En_Hidden_Nuts_InitVars","UNK_TYPE1","",0x1),
0x80BDC0D0:("D_80BDC0D0","UNK_TYPE1","",0x1),
- 0x80BDC0FC:("D_80BDC0FC","UNK_TYPE1","",0x1),
- 0x80BDC120:("D_80BDC120","UNK_TYPE1","",0x1),
+ 0x80BDC0FC:("sAnimations","UNK_TYPE1","",0x1),
+ 0x80BDC120:("sAnimationModes","UNK_TYPE1","",0x1),
0x80BDC12C:("D_80BDC12C","UNK_TYPE1","",0x1),
0x80BDC138:("D_80BDC138","UNK_TYPE1","",0x1),
0x80BDC144:("D_80BDC144","UNK_TYPE1","",0x1),
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index 767d81514..5194497c7 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -1713,7 +1713,7 @@ asm/non_matchings/code/z_player_lib/Player_IsGoronOrDeku.s,Player_IsGoronOrDeku,
asm/non_matchings/code/z_player_lib/func_801234D4.s,func_801234D4,0x801234D4,0x2F
asm/non_matchings/code/z_player_lib/func_80123590.s,func_80123590,0x80123590,0x13
asm/non_matchings/code/z_player_lib/func_801235DC.s,func_801235DC,0x801235DC,0x1C
-asm/non_matchings/code/z_player_lib/func_8012364C.s,func_8012364C,0x8012364C,0x71
+asm/non_matchings/code/z_player_lib/Player_GetItemOnButton.s,Player_GetItemOnButton,0x8012364C,0x71
asm/non_matchings/code/z_player_lib/func_80123810.s,func_80123810,0x80123810,0x54
asm/non_matchings/code/z_player_lib/Player_ActionToModelGroup.s,Player_ActionToModelGroup,0x80123960,0x13
asm/non_matchings/code/z_player_lib/Player_SetModelsForHoldingShield.s,Player_SetModelsForHoldingShield,0x801239AC,0x3E
@@ -2350,16 +2350,16 @@ asm/non_matchings/code/z_message/func_801491DC.s,func_801491DC,0x801491DC,0x9E
asm/non_matchings/code/z_message/func_80149454.s,func_80149454,0x80149454,0x9D
asm/non_matchings/code/z_message/func_801496C8.s,func_801496C8,0x801496C8,0xA5
asm/non_matchings/code/z_message/func_8014995C.s,func_8014995C,0x8014995C,0xAF
-asm/non_matchings/code/z_message/func_80149C18.s,func_80149C18,0x80149C18,0xA9
+asm/non_matchings/code/z_message/Message_DrawItemIcon.s,Message_DrawItemIcon,0x80149C18,0xA9
asm/non_matchings/code/z_message/Message_FindMessage.s,Message_FindMessage,0x80149EBC,0x2E
-asm/non_matchings/code/z_message/func_80149F74.s,func_80149F74,0x80149F74,0x2D7
+asm/non_matchings/code/z_message/Message_DrawItemIcon.s,Message_DrawItemIcon,0x80149F74,0x2D7
asm/non_matchings/code/z_message/func_8014AAD0.s,func_8014AAD0,0x8014AAD0,0xBB
asm/non_matchings/code/z_message/func_8014ADBC.s,func_8014ADBC,0x8014ADBC,0x654
asm/non_matchings/code/z_message/func_8014C70C.s,func_8014C70C,0x8014C70C,0x142
asm/non_matchings/code/z_message/Message_LoadChar.s,Message_LoadChar,0x8014CC14,0x28
asm/non_matchings/code/z_message/func_8014CCB4.s,func_8014CCB4,0x8014CCB4,0x4F
asm/non_matchings/code/z_message/func_8014CDF0.s,func_8014CDF0,0x8014CDF0,0x7B
-asm/non_matchings/code/z_message/func_8014CFDC.s,func_8014CFDC,0x8014CFDC,0xCA
+asm/non_matchings/code/z_message/Message_SetupLoadItemIcon.s,Message_SetupLoadItemIcon,0x8014CFDC,0xCA
asm/non_matchings/code/z_message/func_8014D304.s,func_8014D304,0x8014D304,0xCA
asm/non_matchings/code/z_message/func_8014D62C.s,func_8014D62C,0x8014D62C,0x62
asm/non_matchings/code/z_message/func_8014D7B4.s,func_8014D7B4,0x8014D7B4,0xCB4
From 195b02c6221d19ba56e4145e2f7d662338b27bee Mon Sep 17 00:00:00 2001
From: engineer124
Date: Wed, 4 Oct 2023 15:56:07 +1100
Subject: [PATCH 38/51] hotfix
---
tools/sizes/code_functions.csv | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index 6575afdf5..02e1bf9cd 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -2349,22 +2349,6 @@ asm/non_matchings/code/z_message/func_80149048.s,func_80149048,0x80149048,0x65
asm/non_matchings/code/z_message/func_801491DC.s,func_801491DC,0x801491DC,0x9E
asm/non_matchings/code/z_message/func_80149454.s,func_80149454,0x80149454,0x9D
asm/non_matchings/code/z_message/func_801496C8.s,func_801496C8,0x801496C8,0xA5
-<<<<<<< HEAD
-asm/non_matchings/code/z_message/func_8014995C.s,func_8014995C,0x8014995C,0xAF
-asm/non_matchings/code/z_message/Message_DrawItemIcon.s,Message_DrawItemIcon,0x80149C18,0xA9
-asm/non_matchings/code/z_message/Message_FindMessage.s,Message_FindMessage,0x80149EBC,0x2E
-asm/non_matchings/code/z_message/Message_DrawItemIcon.s,Message_DrawItemIcon,0x80149F74,0x2D7
-asm/non_matchings/code/z_message/func_8014AAD0.s,func_8014AAD0,0x8014AAD0,0xBB
-asm/non_matchings/code/z_message/func_8014ADBC.s,func_8014ADBC,0x8014ADBC,0x654
-asm/non_matchings/code/z_message/func_8014C70C.s,func_8014C70C,0x8014C70C,0x142
-asm/non_matchings/code/z_message/Message_LoadChar.s,Message_LoadChar,0x8014CC14,0x28
-asm/non_matchings/code/z_message/func_8014CCB4.s,func_8014CCB4,0x8014CCB4,0x4F
-asm/non_matchings/code/z_message/func_8014CDF0.s,func_8014CDF0,0x8014CDF0,0x7B
-asm/non_matchings/code/z_message/Message_SetupLoadItemIcon.s,Message_SetupLoadItemIcon,0x8014CFDC,0xCA
-asm/non_matchings/code/z_message/func_8014D304.s,func_8014D304,0x8014D304,0xCA
-asm/non_matchings/code/z_message/func_8014D62C.s,func_8014D62C,0x8014D62C,0x62
-asm/non_matchings/code/z_message/func_8014D7B4.s,func_8014D7B4,0x8014D7B4,0xCB4
-=======
asm/non_matchings/code/z_message/Message_DrawTextChar.s,Message_DrawTextChar,0x8014995C,0xAF
asm/non_matchings/code/z_message/Message_GrowTextbox.s,Message_GrowTextbox,0x80149C18,0xA9
asm/non_matchings/code/z_message/Message_FindMessage.s,Message_FindMessage,0x80149EBC,0x2E
@@ -2379,7 +2363,6 @@ asm/non_matchings/code/z_message/Message_SetupLoadItemIcon.s,Message_SetupLoadIt
asm/non_matchings/code/z_message/Message_LoadTime.s,Message_LoadTime,0x8014D304,0xCA
asm/non_matchings/code/z_message/Message_LoadOwlWarpText.s,Message_LoadOwlWarpText,0x8014D62C,0x62
asm/non_matchings/code/z_message/Message_Decode.s,Message_Decode,0x8014D7B4,0xCB4
->>>>>>> main
asm/non_matchings/code/z_message/func_80150A84.s,func_80150A84,0x80150A84,0xA1
asm/non_matchings/code/z_message/Message_OpenText.s,Message_OpenText,0x80150D08,0x1EA
asm/non_matchings/code/z_message/func_801514B0.s,func_801514B0,0x801514B0,0x100
From 45dc74ed06303556f7b3c44646e21e86b76fe0ba Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 07:57:25 -0500
Subject: [PATCH 39/51] all functions decomped
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 541 +++++++++++++++++-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 4 +-
2 files changed, 523 insertions(+), 22 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 9957b2bba..f263f8980 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -52,6 +52,8 @@ void func_80B08550(BossHakugin* this, PlayState* play);
void func_80B08848(BossHakugin* this, PlayState* play);
void func_80B0A5EC(BossHakugin* this);
void func_80B0A87C(BossHakugin* this);
+void func_80B09178(BossHakugin* this);
+void func_80B09A94(BossHakugin* this, PlayState* play);
void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
@@ -761,12 +763,12 @@ void func_80B06D38(BossHakugin* this, PlayState* play) {
}
return;
}
- sp44 =
- (EnBom*) Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM,
- this->unk_0484.elements[1].dim.worldSphere.center.x - (100.0f * Math_SinS(this->actor.shape.rot.y)),
- this->unk_0484.elements[1].dim.worldSphere.center.y + 100.0f,
- this->unk_0484.elements[1].dim.worldSphere.center.z - (Math_CosS(this->actor.shape.rot.y) * 100.0f),
- 0, 0, 0, 0);
+ sp44 = (EnBom*)Actor_Spawn(
+ &play->actorCtx, play, ACTOR_EN_BOM,
+ this->unk_0484.elements[1].dim.worldSphere.center.x - (100.0f * Math_SinS(this->actor.shape.rot.y)),
+ this->unk_0484.elements[1].dim.worldSphere.center.y + 100.0f,
+ this->unk_0484.elements[1].dim.worldSphere.center.z - (Math_CosS(this->actor.shape.rot.y) * 100.0f), 0, 0, 0,
+ 0);
if (sp44 != NULL) {
temp_a1 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - 0x8000;
if (temp_a1 > 0x2000) {
@@ -1339,7 +1341,81 @@ void func_80B08C1C(BossHakugin* this) {
this->actionFunc = func_80B08CB8;
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08CB8.s")
+void func_80B08CB8(BossHakugin* this, PlayState* play) {
+ s16 temp_a0;
+
+ if (this->unk_01A4 == 0) {
+ this->unk_0484.base.atFlags |= 1;
+ }
+ if (this->unk_0192 == 1) {
+ if (func_80B0728C(this)) {
+ Math_Vec3f_Copy(this->unk_3734, &this->unk_0380);
+ this->unk_01B8 = this->actor.speed + 100.0f;
+ this->unk_37AC.x = Math_CosS(0xA00) * Math_SinS(this->actor.shape.rot.y);
+ this->unk_37AC.y = Math_SinS(0xA00);
+ this->unk_37AC.z = Math_CosS(0xA00) * Math_CosS(this->actor.shape.rot.y);
+ this->unk_0192 = 2;
+ this->unk_01C8 = 0.0f;
+ Audio_PlaySfx_AtPos(&this->unk_0458, 0x3852U);
+ this->unk_37B8.base.atFlags |= 1;
+ }
+ } else {
+ Math_ScaledStepToS(&this->unk_01A6, 0, 0x100);
+ }
+ if (func_80B0791C(this, play)) {
+ func_80B09A94(this, play);
+ } else {
+ if (this->unk_019A >= 0x38) {
+ this->unk_019A = 0;
+ this->unk_019C = 0x28;
+ this->unk_01C4 = 27.0f;
+ }
+ if ((this->unk_019C == 0x28) &&
+ (Math_SmoothStepToF(&this->actor.speed, this->unk_01C4, 0.15f, 1.0f, 0.1f) < 0.05f)) {
+ this->unk_019C -= 1;
+ } else {
+ if (this->unk_019C != 0x28) {
+ this->unk_019C--;
+ if (this->unk_019C == 0) {
+ if (this->actor.xzDistToPlayer > 1500.0f) {
+ this->unk_01C4 = 12.5f;
+ } else if (this->unk_044C.z > 0.0f) {
+ this->unk_01C4 = 21.0f;
+ } else {
+ this->unk_01C4 = 14.5f;
+ }
+ this->unk_01C4 += (0x1E - this->actor.colChkInfo.health) * (1.0f / 30.0f);
+ this->unk_019C = 0x28;
+ }
+ }
+ }
+ this->skelAnime.playSpeed = (this->actor.speed * 0.03125f) + 0.5f;
+ SkelAnime_Update(&this->skelAnime);
+ func_80B07450(this, play);
+ if ((this->unk_01BC < (this->unk_01C0 * 0.5f)) || (this->unk_01BC < 89.100006f)) {
+ this->unk_019E = (Rand_ZeroFloat(0.4f) + 0.6f) * 1536.0f;
+ } else if ((this->unk_01C0 < (this->unk_01BC * 0.5f)) || (this->unk_01C0 < 89.100006f)) {
+ this->unk_019E = -((Rand_ZeroFloat(0.4f) + 0.6f) * 1536.0f);
+ } else if ((this->unk_01A2 == this->unk_019E) && (Rand_ZeroOne() < 0.005f)) {
+ if (this->unk_019E > 0) {
+ this->unk_019E = -((Rand_ZeroFloat(0.4f) + 0.6f) * 1536.0f);
+ } else {
+ this->unk_019E = ((Rand_ZeroFloat(0.4f) + 0.6f) * 1536.0f);
+ }
+ }
+ Math_SmoothStepToS(&this->unk_01A2, this->unk_019E, 5, 0x800, 0x10);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_01A0 + this->unk_01A2, 5, 0x800, 0x10);
+
+ temp_a0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ if ((this->unk_018C != 1) && (this->actor.xzDistToPlayer > 750.0f) && (this->actor.xzDistToPlayer < 1650.0f) &&
+ (ABS_ALT(temp_a0) < 0x3000)) {
+ func_80B09178(this);
+ }
+ }
+}
+
+// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08CB8.s")
void func_80B09178(BossHakugin* this) {
Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.5f, 0.0f, 0.0f, 0, -3.0f);
@@ -1393,9 +1469,9 @@ void func_80B093C0(BossHakugin* this) {
if (this->unk_0192 == 1) {
Math_Vec3f_Copy(&this->unk_3734[0], &this->unk_0380);
this->unk_01B8 = this->actor.speed + 100.0f;
- this->unk_37AC = Math_CosS(0xA00) * Math_SinS(this->actor.shape.rot.y);
- this->unk_37B0 = Math_SinS(0xA00);
- this->unk_37B4 = Math_CosS(0xA00) * Math_CosS(this->actor.shape.rot.y);
+ this->unk_37AC.x = Math_CosS(0xA00) * Math_SinS(this->actor.shape.rot.y);
+ this->unk_37AC.y = Math_SinS(0xA00);
+ this->unk_37AC.z = Math_CosS(0xA00) * Math_CosS(this->actor.shape.rot.y);
this->unk_0192 = 2;
this->unk_01C8 = 0.0f;
Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_E_BALL_THR);
@@ -1406,7 +1482,61 @@ void func_80B093C0(BossHakugin* this) {
this->actionFunc = func_80B094E0;
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B094E0.s")
+void func_80B094E0(BossHakugin* this, PlayState* play) {
+ CollisionPoly* spBC;
+ Vec3f spB0;
+ Vec3f spA4;
+ s32 i;
+ s32 sp9C;
+
+ Actor_PlaySfx_Flagged(&this->actor, 0x301BU);
+ if (SkelAnime_Update(&this->skelAnime)) {
+ if (this->unk_0195 == 0) {
+ this->unk_0195 = 1;
+ func_80B05A64(this, play, 0x4268, 7, 0xA);
+ }
+
+ if (this->actor.speed > 5.0f) {
+
+ for (i = 0; i < 2; i++) {
+ s16 temp1 = this->actor.shape.rot.y + (u32)(0xF000 * i - 0x7800); // TODO: seems fake
+ s16 temp2;
+ f32 temp_fs1;
+
+ spB0.x = 2.0f * Math_SinS(temp1);
+ spB0.y = 1.0f;
+ spB0.z = 2.0f * Math_CosS(temp1);
+
+ temp2 = this->actor.shape.rot.y + (u32)(0x8000 * i - 0x4000);
+ temp_fs1 = Rand_ZeroFloat(190.0f);
+ spA4.x = this->actor.world.pos.x + (80.0f * Math_SinS(temp2)) +
+ (Math_SinS(this->actor.shape.rot.y) * temp_fs1);
+ spA4.z = this->actor.world.pos.z + (80.0f * Math_CosS(temp2)) +
+ (Math_CosS(this->actor.shape.rot.y) * temp_fs1);
+ spA4.y = this->actor.world.pos.y + 300.0f;
+ spA4.y = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &spBC, &sp9C, &this->actor, &spA4) + 10.0f;
+ func_800B12F0(play, &spA4, &spB0, &gZeroVec3f, Rand_S16Offset(0x2EE, 0x64), 0xA, 0x1E);
+ }
+ }
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_01A0, 5, 0x800, 0x10);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ if (this->actor.speed < 0.1f) {
+ this->unk_019C--;
+ this->actor.world.pos.x = this->actor.home.pos.x + Rand_CenteredFloat(5.0f);
+ this->actor.world.pos.y = this->actor.home.pos.y + Rand_CenteredFloat(5.0f);
+ this->actor.world.pos.z = this->actor.home.pos.z + Rand_CenteredFloat(5.0f);
+ if (this->unk_019C == 0) {
+ this->unk_0484.base.acFlags |= 4;
+ Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos);
+ func_80B08C1C(this);
+ this->unk_01A4 = 0x14;
+ }
+ } else if (Math_StepToF(&this->actor.speed, 5.0f, 0.3f)) {
+ Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
+ this->actor.speed = 0.0f;
+ }
+}
void func_80B09840(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
@@ -1748,13 +1878,204 @@ void func_80B0A87C(BossHakugin* this) {
this->actionFunc = func_80B0A8C4;
}
+#ifdef NON_MATCHING
+// non-matchings seem to be caused by accesses to D_80B0EB38
+typedef struct {
+ s32 unk_00;
+ s32 unk_04;
+} BossHakuginUnkStruct_80B0A8C4;
+
+extern BossHakuginUnkStruct_80B0A8C4 D_80B0EB38[5];
+extern s32 D_80B0EB24[5];
+
+void func_80B0A8C4(BossHakugin* this, PlayState* play) {
+ EnBom* bomb;
+ Vec3s* test;
+ Camera* camera;
+ Vec3f eyeTarget;
+ s16 temp_s0;
+ s32 sp60;
+ s32 i;
+ s32 pad;
+
+ camera = Play_GetCamera(play, this->unk_01AC);
+ SkelAnime_Update(&this->skelAnime);
+ sp60 = this->unk_019C / 6;
+ temp_s0 = this->actor.shape.rot.y + (0x6000 * this->unk_01B4);
+ eyeTarget.x = (Math_SinS(temp_s0) * 500.0f) + this->actor.world.pos.x;
+ eyeTarget.y = this->actor.world.pos.y + 250.0f;
+ eyeTarget.z = (Math_CosS(temp_s0) * 500.0f) + this->actor.world.pos.z;
+ Math_Vec3f_StepTo(&this->unk_038C, &eyeTarget, 25.0f);
+ Play_SetCameraAtEye(play, this->unk_01AC, &camera->at, &this->unk_038C);
+ if (sp60 == 30) {
+ Camera* camera2 = Play_GetCamera(play, 0);
+
+ Play_DisableMotionBlur();
+ CutsceneManager_Stop(this->actor.csId);
+ Play_SetCameraAtEye(play, this->unk_01AC, &camera2->at, &camera2->eye);
+ func_80B05EE0(this, play);
+ func_80B0DFA8(this);
+ this->actor.draw = func_80B0E5A4;
+ this->actor.update = func_80B0E548;
+ } else if (((this->unk_019C % 6) == 0) && (sp60 < 6)) {
+ test = &this->unk_0484.elements[D_80B0EB38[sp60].unk_00].dim.worldSphere.center;
+ bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, test->x, test->y, test->z, 1, 0, 0, 0);
+ if (bomb != NULL) {
+ bomb->timer = 0;
+ }
+ this->unk_01B0 &= ~D_80B0EB38[sp60].unk_04;
+ if (sp60 == 5) {
+ AudioSeq_QueueSeqCmd(0x8021U);
+ }
+ }
+
+ if (((this->unk_019C + 3) % 6) == 0) {
+ sp60 = (this->unk_019C + 3) / 6 - 1;
+ if (sp60 < 4) {
+ for (i = D_80B0EB24[sp60]; i < D_80B0EB24[sp60 + 1]; i++) {
+ this->unk_09F8[i].unk_C.y = Rand_ZeroFloat(5.0f) + 5.0f;
+ }
+ }
+ if (sp60 < 6) {
+ if (sp60 & 1) {
+ Audio_PlaySfx_AtPos(&this->unk_0458, 0x393EU);
+ } else {
+ Audio_PlaySfx_AtPos(&this->unk_0458, 0x393DU);
+ }
+ }
+ if (1) {} // TODO: probably fake
+ }
+
+ this->unk_019C++;
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A8C4.s")
+#endif
-void func_80B0AC30(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0AC30.s")
+void func_80B0AC30(BossHakugin* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
-s32 func_80B0ADFC(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0ADFC.s")
+ if ((this->unk_0484.base.atFlags & 2) &&
+ ((this->actionFunc == func_80B091D8) || !(player->stateFlags3 & 0x80000))) {
+ if ((this->actionFunc == func_80B091D8) && (this->unk_0484.elements->info.toucherFlags & 2) &&
+ !(this->unk_0484.base.atFlags & 4) && (play->grabPlayer(play, player))) {
+ func_80B09840(this, play);
+ } else if (player->stateFlags3 & 0x1000) {
+ player->unk_B08 = player->linearVelocity = -5.0f;
+ player->unk_B0C += player->unk_B08 * 0.05f;
+ player->actor.velocity.y = 10.0f;
+ player->unk_B8C = 4;
+ player->actor.shape.rot.y = player->actor.home.rot.y = player->currentYaw = player->actor.world.rot.y;
+
+ } else if (!(this->unk_0484.base.atFlags & 4)) {
+ s16 var_a3 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
+
+ if (var_a3 > 0) {
+ var_a3 = this->actor.shape.rot.y + (s32)(var_a3 / 2.0f) + 0x4000;
+ } else {
+ var_a3 = this->actor.shape.rot.y + (s32)(var_a3 / 2.0f) - 0x4000;
+ }
+ func_800B8D50(play, &this->actor, 5.0f, var_a3, 6.0f, 0U);
+ }
+ }
+}
+
+s32 func_80B0ADFC(BossHakugin* this, PlayState* play) {
+ if (this->unk_0484.base.acFlags & 2) {
+ s32 i;
+
+ for (i = 0; i < 19; i++) {
+ if (this->unk_0484.elements[i].info.bumperFlags & 2) {
+ break;
+ }
+ }
+ if (i == 19) {
+ return 0;
+ }
+ if ((this->unk_0196 == 0xA) && (this->unk_0484.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) {
+ return 0;
+ }
+ func_80B07B88(this, play);
+ if (this->actionFunc == func_80B094E0) {
+ Actor_SetColorFilter(&this->actor, 0x4000U, 0xFFU, 0U, (u16)0xF);
+ func_80B07BFC(this, play, i);
+ if (Actor_ApplyDamage(&this->actor) == 0) {
+ Enemy_StartFinishingBlow(play, &this->actor);
+ Actor_PlaySfx(&this->actor, 0x3950U);
+ func_80B09E84(this);
+ } else {
+ Actor_PlaySfx(&this->actor, 0x3951U);
+ }
+ this->unk_01A4 = 0xF;
+ return 1;
+ }
+ if (((this->actor.colChkInfo.damageEffect == 0xF) || (this->actor.colChkInfo.damageEffect == 0xE) ||
+ (this->actor.colChkInfo.damageEffect == 2) || (this->actor.colChkInfo.damageEffect == 3) ||
+ (this->actor.colChkInfo.damageEffect == 4) || (this->actor.colChkInfo.damageEffect == 0xD) ||
+ (this->actor.colChkInfo.damageEffect == 0xC)) &&
+ ((this->actionFunc == func_80B08CB8) || (this->actionFunc == func_80B09E20) ||
+ (this->actionFunc == func_80B09C78) || (this->actionFunc == func_80B091D8))) {
+ Player* player = GET_PLAYER(play);
+
+ if (this->actor.colChkInfo.damageEffect == 0xF) {
+ player->pushedSpeed = 15.0f;
+ if ((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) > 0) {
+ player->pushedYaw = this->actor.shape.rot.y + 0x4000;
+ } else {
+ player->pushedYaw = this->actor.shape.rot.y - 0x4000;
+ }
+ }
+ this->unk_01A4 = 0xF;
+ Actor_SetColorFilter(&this->actor, 0x4000U, 0xFF, 0, 0xF);
+ this->unk_019A += 0x23;
+ func_80B07BFC(this, play, i);
+ this->actor.colChkInfo.damage = this->unk_0484.elements[i].info.acHitInfo->toucher.damage;
+ if (Actor_ApplyDamage(&this->actor) == 0) {
+ Enemy_StartFinishingBlow(play, &this->actor);
+ Actor_PlaySfx(&this->actor, 0x3950U);
+ func_80B09E84(this);
+ } else {
+ if ((this->actor.colChkInfo.damageEffect == 0xC) ||
+ ((this->actor.colChkInfo.damageEffect == 0xF) && (this->actionFunc != func_80B091D8) &&
+ ((this->unk_0484.elements[0].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[1].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[2].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[3].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[6].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[9].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[13].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[17].info.bumperFlags & 2) ||
+ (this->unk_0484.elements[18].info.bumperFlags & 2)))) {
+ func_80B093C0(this);
+ } else if ((this->unk_0192 == 0) && (this->unk_01AA == 0) && (this->actionFunc == func_80B08CB8) &&
+ (this->actor.colChkInfo.damageEffect == 0xF)) {
+ this->unk_01A8 = 5;
+ this->unk_0192 = 1;
+ }
+ Actor_PlaySfx(&this->actor, 0x3951U);
+ }
+ return 1;
+ } else {
+ s32 j;
+
+ this->unk_01A4 = 0x14;
+ for (j = 0; j < 19; j++) {
+ Vec3f sp40;
+ ColliderInfo* hurtbox = &this->unk_0484.elements[j].info;
+
+ if ((hurtbox->bumperFlags & 2) && (hurtbox->acHitInfo != NULL) &&
+ !(hurtbox->acHitInfo->toucherFlags & 0x18)) {
+ Math_Vec3s_ToVec3f(&sp40, &hurtbox->bumper.hitPos);
+ EffectSsHitmark_SpawnFixedScale(play, 3, &sp40);
+ CollisionCheck_SpawnShieldParticlesMetalSound(play, &sp40, &this->actor.projectedPos);
+ break;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
void func_80B0B238(BossHakugin* this) {
BossHakuginEffect* temp_s0;
@@ -1843,8 +2164,98 @@ void func_80B0B548(BossHakugin* this, PlayState* play) {
}
}
-void func_80B0B660(BossHakugin* this, PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0B660.s")
+void func_80B0B660(BossHakugin* this, PlayState* play) {
+ Player* spA4 = GET_PLAYER(play);
+ CollisionPoly* spA0 = NULL;
+ Vec3f sp94;
+ Vec3f sp88;
+ Vec3f sp7C;
+ Vec3f sp70;
+ Vec3f* sp6C;
+ Vec3f* var_s0;
+ s32 var_s0_2;
+ f32 sp60;
+ s32 sp5C;
+ s32 sp58 = 0;
+ s16 temp_v1;
+
+ sp6C = this->unk_3734;
+
+ if (this->unk_0192 == 2) {
+ if (Math_StepToF(&this->unk_01B8, 50.0f, 3.5f)) {
+ this->unk_0192 = 3;
+ }
+ } else if (this->unk_0192 == 3) {
+ sp60 = BINANG_TO_RAD(Math3D_Vec3fDistSq(sp6C, &spA4->actor.world.pos) * (1.0f / SQ(120.0f)) * 32.0f);
+ if (sp60 > M_PI / 4.0f) {
+ sp60 = M_PI / 4.0f;
+ }
+ Math_Vec3f_Diff(&spA4->actor.world.pos, sp6C, &sp70);
+ if (func_80B0573C(&sp70)) {
+ func_80B057A4(&this->unk_37AC, &sp70, sp60);
+ }
+ } else if (this->unk_0192 != 4) {
+ return;
+ }
+ Audio_PlaySfx_AtPos(&this->unk_0464, 0x304CU);
+ if (this->unk_01AA < 0xA) {
+ this->unk_01AA++;
+ }
+ if ((this->unk_0192 == 4) && (this->unk_01AA == 9)) {
+ this->unk_0192 = 0;
+ this->unk_01AA = 0;
+ } else {
+ var_s0 = &this->unk_3734[9];
+ while (var_s0 != sp6C) {
+ Math_Vec3f_Copy(var_s0, var_s0 - 1);
+ var_s0--;
+ }
+ this->unk_0198 += (s16)(0x4000 + (Rand_Next() >> 0x12));
+ if (this->unk_0192 != 4) {
+ if (this->unk_37B8.base.atFlags & 2) {
+ this->unk_0192 = 4;
+ this->unk_01AA = 0;
+ this->unk_37B8.base.atFlags &= ~2;
+ this->unk_37B8.base.atFlags &= ~1;
+ sp58 = 1;
+ Audio_PlaySfx_AtPos(&this->unk_0464, 0x384EU);
+ }
+ sp88.x = sp6C->x + (this->unk_01B8 * this->unk_37AC.x);
+ sp88.y = sp6C->y + (this->unk_01B8 * this->unk_37AC.y);
+ sp88.z = sp6C->z + (this->unk_01B8 * this->unk_37AC.z);
+ if (BgCheck_EntityLineTest1(&play->colCtx, sp6C, &sp88, &sp94, &spA0, 1, 1, 1, 1, &sp5C)) {
+ var_s0_2 = 0;
+ Math_Vec3f_Copy(sp6C, &sp94);
+
+ if ((spA0->normal.y >= -0x6664) && (spA0->normal.y < 0x3FFF)) {
+ temp_v1 =
+ Math_Vec3f_Yaw(sp6C, &spA4->actor.world.pos) -
+ Math_Atan2S_XY(spA0->normal.z * COLPOLY_NORMAL_FRAC, spA0->normal.x * COLPOLY_NORMAL_FRAC);
+ var_s0_2 = (ABS_ALT(temp_v1) > 0x4000) ? 1 : 0LL; // TODO: make less fake
+ }
+ if ((this->unk_0192 == 3) && (var_s0_2 || (spA0->normal.y >= 0x4000))) {
+ this->unk_0192 = 4;
+ this->unk_01AA = 0;
+ if (sp58 == 0) {
+ Audio_PlaySfx_AtPos(&this->unk_0464, 0x384EU);
+ }
+ } else {
+ sp7C.x = spA0->normal.x * COLPOLY_NORMAL_FRAC;
+ sp7C.y = spA0->normal.y * COLPOLY_NORMAL_FRAC;
+ sp7C.z = spA0->normal.z * COLPOLY_NORMAL_FRAC;
+ func_80179F64(&this->unk_37AC, &sp7C, &sp70);
+ Math_Vec3f_Copy(&this->unk_37AC, &sp70);
+ }
+ } else {
+ Math_Vec3f_Copy(sp6C, &sp88);
+ }
+ this->unk_37B8.dim.worldSphere.center.x = sp6C->x;
+ this->unk_37B8.dim.worldSphere.center.y = sp6C->y;
+ this->unk_37B8.dim.worldSphere.center.z = sp6C->z;
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_37B8.base);
+ }
+ }
+}
void BossHakugin_Update(Actor* thisx, PlayState* play) {
s32 pad;
@@ -2447,9 +2858,101 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
CLOSE_DISPS(gfxCtx);
}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
+#ifdef NON_MATCHING
+void func_80B0D9CC(BossHakugin* this) {
+ s32 var_s3;
+ Vec3f spC8;
+ s32 var_s1 = 0xF;
+ BossHakuginEffect* var_s0 = this->unk_09F8;
+ s32 var_v1;
+ s32 temp_a0;
+ f32 spB4 = Math_SinS(this->actor.shape.rot.y) * 65.0f;
+ f32 spB0 = Math_CosS(this->actor.shape.rot.y) * 65.0f;
+ f32 spAC = Math_SinS(this->actor.shape.rot.z) * 65.0f;
+ f32 temp1;
+ f32 temp2;
+ f32 temp3;
+ f32 temp4;
+ f32 temp5;
+ f32 pad;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0DFA8.s")
+ for (var_s3 = 4; var_s3 > 0; var_s3--, var_s1 -= 4) {
+ spC8.x = this->actor.world.pos.x - (var_s3 * spB4) + (2.3076923f * spB4);
+ spC8.y = this->actor.world.pos.y + (85.0f * (4 - var_s3)) + 20.0f;
+ spC8.z = this->actor.world.pos.z - (var_s3 * spB0) + (2.3076923f * spB0);
+
+ var_s0->unk_24 = ((var_s3 * 4.5f) + 22.0f) * 0.001f;
+ Math_Vec3f_Copy(&var_s0->unk_0, &spC8);
+
+ temp_a0 = var_s1 >> 1;
+ if (temp_a0 == 0) {
+ break;
+ }
+ var_s0++;
+
+ temp1 = (var_s3 / (f32)temp_a0);
+ temp2 = (spB0 + spB4) * temp1;
+ temp3 = (spB0 - spB4) * temp1;
+
+ for (var_v1 = 0; var_v1 < temp_a0; var_v1++, var_s0++) {
+ var_s0->unk_0.x = spC8.x + temp2 * (temp_a0 - var_v1);
+ var_s0->unk_0.y = spC8.y + var_s3 * spAC;
+ var_s0->unk_0.z = spC8.z + temp3 * (temp_a0 - var_v1);
+ var_s0->unk_24 = ((var_s3 * 4.5f) + 22.0f) * 0.001f;
+ }
+
+ temp4 = (spB4 - spB0) * temp1;
+ temp5 = (spB0 + spB4) * temp1;
+
+ for (var_v1 = 0; var_v1 < temp_a0; var_v1++, var_s0++) {
+ var_s0->unk_0.x = spC8.x + temp4 * (temp_a0 - var_v1);
+ var_s0->unk_0.y = spC8.y - var_s3 * spAC;
+ var_s0->unk_0.z = spC8.z + temp5 * (temp_a0 - var_v1);
+ var_s0->unk_24 = ((var_s3 * 4.5f) + 22.0f) * 0.001f;
+ }
+ }
+
+ for (var_s3 = 0; var_s3 < 36; var_s3++) {
+ var_s0 = &this->unk_09F8[var_s3];
+
+ var_s0->unk_24 += Rand_ZeroFloat(5.0f) * 0.001f;
+ var_s0->unk_1C.x = (s32)Rand_Next() >> 0x10;
+ var_s0->unk_1C.y = (s32)Rand_Next() >> 0x10;
+ var_s0->unk_1C.z = (s32)Rand_Next() >> 0x10;
+ var_s0->unk_C.x = var_s0->unk_0.y;
+ var_s0->unk_C.y = 0.0f;
+ var_s0->unk_0.y += 850.0f;
+ }
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
+#endif
+
+void func_80B0DFA8(BossHakugin* this) {
+ s32 i;
+ BossHakuginEffect* effect;
+ ColliderJntSphElement* element;
+
+ for (i = 0; i < 18; i++) {
+ effect = &this->unk_09F8[i << 1];
+ element = &this->unk_0484.elements[i];
+
+ element->dim.worldSphere.center.x = effect->unk_0.x;
+ element->dim.worldSphere.center.y = effect->unk_0.y;
+ element->dim.worldSphere.center.z = effect->unk_0.z;
+ element->dim.worldSphere.radius = effect->unk_24 * 3000.0f;
+ element->info.bumper.dmgFlags = 0xF3CFBBFF;
+ element->info.bumperFlags &= ~0x40;
+
+ element->info.elemType = 0;
+ }
+ for (; i < 19; i++) {
+ this->unk_0484.elements[i].info.bumperFlags &= ~1;
+ this->unk_0484.elements[i].info.ocElemFlags &= ~1;
+ }
+
+ this->unk_0484.base.colType = 0xC;
+}
void func_80B0E548(Actor* thisx, PlayState* play2) {
BossHakugin* this = THIS;
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 6662f11e0..bc03f14ca 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -98,9 +98,7 @@ typedef struct BossHakugin {
/* 0x2618 */ BossHakuginUnkStruct_2618 unk_2618[20];
/* 0x3158 */ BossHakuginFhgFlashUnkStruct unk_3158[5][15];
/* 0x3734 */ Vec3f unk_3734[10];
- /* 0x37AC */ f32 unk_37AC;
- /* 0x37B0 */ f32 unk_37B0;
- /* 0x37B4 */ f32 unk_37B4;
+ /* 0x37AC */ Vec3f unk_37AC;
/* 0x37B8 */ ColliderSphere unk_37B8;
} BossHakugin; // size = 0x3810
From a9897faf0d438772b746d8bb8ad0932075e55455 Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 07:59:49 -0500
Subject: [PATCH 40/51] all functions decomped
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index f263f8980..7ff79abf5 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -1415,8 +1415,6 @@ void func_80B08CB8(BossHakugin* this, PlayState* play) {
}
}
-// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B08CB8.s")
-
void func_80B09178(BossHakugin* this) {
Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.5f, 0.0f, 0.0f, 0, -3.0f);
this->actionFunc = func_80B091D8;
From 657ac449f5f82ad6433b1930b9b984309ed6fe66 Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 09:11:19 -0500
Subject: [PATCH 41/51] Now with more data
---
spec | 2 +-
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 384 ++++++++++++------
2 files changed, 265 insertions(+), 121 deletions(-)
diff --git a/spec b/spec
index 339a701c8..1ae14b9b2 100644
--- a/spec
+++ b/spec
@@ -3519,7 +3519,7 @@ beginseg
name "ovl_Boss_Hakugin"
compress
include "build/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.o"
- include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.data.o"
+ // include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.data.o"
include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.reloc.o"
endseg
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 7ff79abf5..b789f0ef8 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -61,7 +61,6 @@ void func_80B0D9CC(BossHakugin* this);
void func_80B0DFA8(BossHakugin* this);
void func_80B0E548(Actor* thisx, PlayState* play2);
-#if 0
ActorInit Boss_Hakugin_InitVars = {
ACTOR_BOSS_HAKUGIN,
ACTORCAT_BOSS,
@@ -74,121 +73,298 @@ ActorInit Boss_Hakugin_InitVars = {
(ActorFunc)BossHakugin_Draw,
};
-// static ColliderJntSphElementInit sJntSphElementsInit[19] = {
-static ColliderJntSphElementInit D_80B0E700[19] = {
+static ColliderJntSphElementInit sJntSphElementsInit[19] = {
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NONE,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 16, { { 1300, 200, 0 }, 30 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 15, { { 1400, 300, 0 }, 35 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 2, { { 1600, -400, 0 }, 26 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 6, { { 1700, 200, 400 }, 18 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 8, { { 1000, 0, 0 }, 10 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 9, { { 500, 0, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 11, { { 1700, 200, -400 }, 18 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 13, { { 1000, 0, 0 }, 10 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 14, { { 500, 0, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 21, { { 800, 0, 400 }, 15 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 22, { { 500, 200, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 24, { { 300, 0, 0 }, 8 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 25, { { 500, 100, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 28, { { 800, 0, -400 }, 15 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 29, { { 500, 200, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 31, { { 300, 0, 0 }, 8 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 32, { { 500, 100, 0 }, 9 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 16, { { 2400, -400, -2900 }, 12 }, 270 },
},
{
- { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_HITMARK, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK2,
+ { 0xF7CFFFFF, 0x00, 0x04 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_NO_HITMARK,
+ OCELEM_ON,
+ },
{ 16, { { 2400, -400, 2900 }, 12 }, 270 },
},
};
-// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_80B0E9AC = {
- { COLTYPE_METAL, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- ARRAY_COUNT(sJntSphElementsInit), D_80B0E700, // sJntSphElementsInit,
+static ColliderJntSphInit sJntSphInit = {
+ {
+ COLTYPE_METAL,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ ARRAY_COUNT(sJntSphElementsInit),
+ sJntSphElementsInit,
};
-// static ColliderTrisElementInit sTrisElementsInit[1] = {
-static ColliderTrisElementInit D_80B0E9BC[1] = {
+static ColliderTrisElementInit sTrisElementsInit[1] = {
{
- { ELEMTYPE_UNK5, { 0x20000000, 0x03, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_NONE, OCELEM_NONE, },
+ {
+ ELEMTYPE_UNK5,
+ { 0x20000000, 0x03, 0x08 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NONE,
+ BUMP_NONE,
+ OCELEM_NONE,
+ },
{ { { 22.0f, 0.0f, 100.0f }, { 0.0f, 0.0f, -100.0f }, { -22.0f, 0.0f, 100.0f } } },
},
};
-// static ColliderTrisInit sTrisInit = {
-static ColliderTrisInit D_80B0E9F8 = {
- { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_TYPE_1, COLSHAPE_TRIS, },
- ARRAY_COUNT(sTrisElementsInit), D_80B0E9BC, // sTrisElementsInit,
+static ColliderTrisInit sTrisInit = {
+ {
+ COLTYPE_NONE,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_NONE,
+ OC1_NONE,
+ OC2_TYPE_1,
+ COLSHAPE_TRIS,
+ },
+ ARRAY_COUNT(sTrisElementsInit),
+ sTrisElementsInit,
};
-// static ColliderSphereInit sSphereInit = {
-static ColliderSphereInit D_80B0EA08 = {
- { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_TYPE_2, COLSHAPE_SPHERE, },
- { ELEMTYPE_UNK5, { 0x20000000, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_NONE, OCELEM_NONE, },
+static ColliderSphereInit sSphereInit = {
+ {
+ COLTYPE_NONE,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_NONE,
+ OC1_NONE,
+ OC2_TYPE_2,
+ COLSHAPE_SPHERE,
+ },
+ {
+ ELEMTYPE_UNK5,
+ { 0x20000000, 0x00, 0x08 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_HARD,
+ BUMP_NONE,
+ OCELEM_NONE,
+ },
{ 1, { { 0, 0, 0 }, 23 }, 100 },
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80B0EA34 = {
- { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x02, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_ON, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_HARD,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x02, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NONE,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 170, 40, 0, { 0, 0, 0 } },
};
-// static DamageTable sDamageTable = {
static DamageTable D_80B0EA60 = {
/* Deku Nut */ DMG_ENTRY(0, 0x0),
/* Deku Stick */ DMG_ENTRY(1, 0x0),
@@ -224,48 +400,29 @@ static DamageTable D_80B0EA60 = {
/* Powder Keg */ DMG_ENTRY(1, 0xC),
};
-// sColChkInfoInit
static CollisionCheckInfoInit D_80B0EA80 = { 30, 80, 100, MASS_IMMOVABLE };
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_80B0EAD8[] = {
- ICHAIN_S8(hintId, 27, ICHAIN_CONTINUE),
- ICHAIN_VEC3F_DIV1000(scale, 27, ICHAIN_CONTINUE),
- ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
- ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
+TexturePtr D_80B0EA88 = gGohtMetalPlateWithCirclePatternTex;
+
+s8 D_80B0EA8C[0x20] = {
+ -1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1,
+ 2, -1, -1, -1, -1, 9, 0xA, -1, -1, 0xB, -1, -1, 0xC, 0xD, -1, -1,
};
+s8 D_80B0EAAC = 0xE;
+s32 D_80B0EAB0[5] = { 0x1C, 0x18, 0x11, 0xD, 6 };
+Color_RGBA8 D_80B0EAC4 = { 0xFA, 0xFA, 0xFA, 0xFF };
+Color_RGBA8 D_80B0EAC8 = { 0xB4, 0xB4, 0xB4, 0xFF };
+Color_RGB8 D_80B0EACC = { 0, 0x96, 0xFF };
+Color_RGB8 D_80B0EAD0 = { 0, 0xFF, 0xFF };
-#endif
-
-extern ColliderJntSphElementInit D_80B0E700[19];
-extern ColliderJntSphInit D_80B0E9AC;
-extern ColliderTrisElementInit D_80B0E9BC[1];
-extern Vec3f D_80B0E9D4[3];
-extern ColliderTrisInit D_80B0E9F8;
-extern ColliderSphereInit D_80B0EA08;
-extern ColliderCylinderInit D_80B0EA34;
-extern DamageTable D_80B0EA60;
-extern CollisionCheckInfoInit D_80B0EA80;
-extern TexturePtr D_80B0EA88;
-extern s8 D_80B0EA8C[]; // sLimbToBodyParts
-extern s8 D_80B0EAAC;
-extern s32 D_80B0EAB0[5];
-extern Color_RGBA8 D_80B0EAC4;
-extern Color_RGBA8 D_80B0EAC8;
-extern Color_RGB8 D_80B0EACC;
-extern Color_RGB8 D_80B0EAD0;
-extern s32 D_80B0EAD4;
-extern InitChainEntry D_80B0EAD8[];
-extern Vec3f D_80B0EAE8;
-extern Vec3f D_80B0EAF4;
-extern Vec3f D_80B0EB00;
-extern Vec3f D_80B0EB0C;
-extern Vec3f D_80B0EB18;
-
-#ifdef NON_MATCHING
-// requires in-function static, too lazy to import all the data right now
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
static s32 D_80B0EAD4 = 0;
+ static InitChainEntry D_80B0EAD8[] = {
+ ICHAIN_S8(hintId, 27, ICHAIN_CONTINUE),
+ ICHAIN_VEC3F_DIV1000(scale, 27, ICHAIN_CONTINUE),
+ ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
+ ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
+ };
PlayState* play = play2;
BossHakugin* this = THIS;
Actor** actorPtr;
@@ -280,14 +437,14 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
D_80B0EA88 = Lib_SegmentedToVirtual(D_80B0EA88);
}
- Collider_InitAndSetJntSph(play, &this->unk_0484, &this->actor, &D_80B0E9AC, this->unk_04A4);
+ Collider_InitAndSetJntSph(play, &this->unk_0484, &this->actor, &sJntSphInit, this->unk_04A4);
for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
- Collider_InitAndSetTris(play, &this->unk_2618[i].unk_14, &this->actor, &D_80B0E9F8, &this->unk_2618[i].unk_34);
+ Collider_InitAndSetTris(play, &this->unk_2618[i].unk_14, &this->actor, &sTrisInit, &this->unk_2618[i].unk_34);
}
- Collider_InitAndSetSphere(play, &this->unk_37B8, &this->actor, &D_80B0EA08);
+ Collider_InitAndSetSphere(play, &this->unk_37B8, &this->actor, &sSphereInit);
this->unk_37B8.dim.worldSphere.radius = 40;
- Collider_InitAndSetCylinder(play, &this->unk_0964, &this->actor, &D_80B0EA34);
+ Collider_InitAndSetCylinder(play, &this->unk_0964, &this->actor, &sCylinderInit);
this->unk_0964.dim.pos.x = (this->actor.world.pos.x - 50.0f);
this->unk_0964.dim.pos.y = this->actor.world.pos.y;
this->unk_0964.dim.pos.z = this->actor.world.pos.z;
@@ -340,9 +497,22 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
func_80B09E84(this);
}
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_Init.s")
-#endif
+
+Vec3f D_80B0EAE8 = { 492.0f, 28.0f, -1478.0f };
+Vec3f D_80B0EAF4 = { 894.0f, 176.0f, -1600.0f };
+Vec3f D_80B0EB00 = { 972.0f, 176.0f, -1600.0f };
+Vec3f D_80B0EB0C = { 377.0f, 140.0f, -1600.0f };
+Vec3f D_80B0EB18 = { 282.0f, 108.0f, -1600.0f };
+s32 D_80B0EB24[5] = { 0, 0xF, 0x1A, 0x21, 0x24 };
+
+typedef struct {
+ s32 unk_00;
+ u32 unk_04;
+} BossHakuginUnkStruct_80B0A8C4;
+
+BossHakuginUnkStruct_80B0A8C4 D_80B0EB38[6] = {
+ { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
+};
void BossHakugin_Destroy(Actor* thisx, PlayState* play) {
BossHakugin* this = THIS;
@@ -618,7 +788,7 @@ void func_80B06558(BossHakuginUnkStruct_2618* arg0) {
Matrix_SetTranslateRotateYXZ(arg0->unk_00.x, arg0->unk_00.y, arg0->unk_00.z, &arg0->unk_0E);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
for (i = 0; i < 3; i++) {
- Matrix_MultVec3f(&D_80B0E9D4[i], &sp38[i]);
+ Matrix_MultVec3f(&sTrisElementsInit[0].dim.vtx[i], &sp38[i]);
}
Collider_SetTrisVertices(&arg0->unk_14, 0, &sp38[0], &sp38[1], &sp38[2]);
}
@@ -1420,9 +1590,7 @@ void func_80B09178(BossHakugin* this) {
this->actionFunc = func_80B091D8;
}
-// TODO: Probably a better way to clean some of this up
void func_80B091D8(BossHakugin* this, PlayState* play) {
- s16 temp_v0;
s16 var_v0;
Math_ScaledStepToS(&this->unk_01A6, 0x800, 0x100);
@@ -1437,8 +1605,8 @@ void func_80B091D8(BossHakugin* this, PlayState* play) {
} else {
if (((this->unk_044C.x > 0.0f) && (this->unk_044C.x < this->unk_01C0)) ||
((this->unk_044C.x <= 0.0f) && (-this->unk_044C.x < this->unk_01BC))) {
- temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
- var_v0 = CLAMP(temp_v0, -0x3000, 0x3000);
+ var_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
+ var_v0 = CLAMP(var_v0, -0x3000, 0x3000);
this->unk_019E = this->actor.shape.rot.y + var_v0;
} else {
this->unk_019E =
@@ -1878,14 +2046,6 @@ void func_80B0A87C(BossHakugin* this) {
#ifdef NON_MATCHING
// non-matchings seem to be caused by accesses to D_80B0EB38
-typedef struct {
- s32 unk_00;
- s32 unk_04;
-} BossHakuginUnkStruct_80B0A8C4;
-
-extern BossHakuginUnkStruct_80B0A8C4 D_80B0EB38[5];
-extern s32 D_80B0EB24[5];
-
void func_80B0A8C4(BossHakugin* this, PlayState* play) {
EnBom* bomb;
Vec3s* test;
@@ -2361,8 +2521,6 @@ void BossHakugin_Update(Actor* thisx, PlayState* play) {
}
}
-#ifdef NON_MATCHING
-// requires in-function static, too lazy to import all the data right now
s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {
static s32 D_80B0EB68 = 4;
@@ -2390,8 +2548,8 @@ s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dL
if (limbIndex == GOHT_LIMB_HEAD) {
rot->z += this->unk_01A6;
if (this->actionFunc == func_80B0A2A4) {
- rot->z += this->unk_0374.y;
- rot->y += this->unk_0374.z;
+ rot->z += this->unk_0374.z;
+ rot->y += this->unk_0374.y;
}
} else if (limbIndex == GOHT_LIMB_THORAX_WRAPPER) {
rot->z += (s16)(this->unk_01A6 * 2);
@@ -2401,10 +2559,6 @@ s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dL
return false;
}
-#else
-s32 BossHakugin_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/BossHakugin_OverrideLimbDraw.s")
-#endif
void BossHakugin_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
BossHakugin* this = THIS;
@@ -2711,23 +2865,12 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
}
}
-#if 0
s32 D_80B0EB70[6] = { 1, 2, 3, 3, 2, 1 };
s32 D_80B0EB88[7] = { 2, 3, 4, 4, 4, 3, 2 };
s32 D_80B0EBA4[8] = { 2, 3, 4, 4, 4, 4, 3, 2 };
-s32 D_80B0EBC4[14] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
-s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 10, 0, 12, 13 };
-u8 D_80B0EC38[15] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3 };
-#else
-// These are the different sizes wdiths
-extern s32 D_80B0EB70[];
-extern s32 D_80B0EB88[];
-extern s32 D_80B0EBA4[];
-extern s32 D_80B0EBC4[];
-
-extern s32 D_80B0EBFC[]; // sParentBodyParts
-extern u8 D_80B0EC38[]; // sShadowSizes
-#endif
+s32 D_80B0EBC4[0xE] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
+s32 D_80B0EBFC[0xF] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 0xA, 0, 0xC, 0xD };
+u8 D_80B0EC38[0x18] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
s32 index;
@@ -2857,6 +3000,7 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
}
#ifdef NON_MATCHING
+// Saved float register alloc. Seems related to spB4.
void func_80B0D9CC(BossHakugin* this) {
s32 var_s3;
Vec3f spC8;
From 0795a16e5eb9d3489cd2af8e32a4afc110b518c0 Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 09:26:18 -0500
Subject: [PATCH 42/51] small fix
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index b789f0ef8..c928079ee 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -406,9 +406,8 @@ TexturePtr D_80B0EA88 = gGohtMetalPlateWithCirclePatternTex;
s8 D_80B0EA8C[0x20] = {
-1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1,
- 2, -1, -1, -1, -1, 9, 0xA, -1, -1, 0xB, -1, -1, 0xC, 0xD, -1, -1,
+ 2, -1, -1, -1, -1, 9, 0xA, -1, -1, 0xB, -1, -1, 0xC, 0xD, -1, -1, 0xE
};
-s8 D_80B0EAAC = 0xE;
s32 D_80B0EAB0[5] = { 0x1C, 0x18, 0x11, 0xD, 6 };
Color_RGBA8 D_80B0EAC4 = { 0xFA, 0xFA, 0xFA, 0xFF };
Color_RGBA8 D_80B0EAC8 = { 0xB4, 0xB4, 0xB4, 0xFF };
From 2985b27b664bbbdd55059702de09d2c61c9f1357 Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 09:29:09 -0500
Subject: [PATCH 43/51] another small fix
---
spec | 1 -
1 file changed, 1 deletion(-)
diff --git a/spec b/spec
index 1ae14b9b2..fc11178da 100644
--- a/spec
+++ b/spec
@@ -3519,7 +3519,6 @@ beginseg
name "ovl_Boss_Hakugin"
compress
include "build/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.o"
- // include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.data.o"
include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.reloc.o"
endseg
From a01242766644776aad7360095c85455432ab508e Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 09:32:09 -0500
Subject: [PATCH 44/51] ok last small fix I swear
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index c928079ee..66460a63b 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -404,7 +404,7 @@ static CollisionCheckInfoInit D_80B0EA80 = { 30, 80, 100, MASS_IMMOVABLE };
TexturePtr D_80B0EA88 = gGohtMetalPlateWithCirclePatternTex;
-s8 D_80B0EA8C[0x20] = {
+s8 D_80B0EA8C[] = {
-1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1,
2, -1, -1, -1, -1, 9, 0xA, -1, -1, 0xB, -1, -1, 0xC, 0xD, -1, -1, 0xE
};
From 64e0b5ab6f9118b21cce90e1dfd9ed26663b894c Mon Sep 17 00:00:00 2001
From: petrie911
Date: Thu, 5 Oct 2023 13:59:52 -0500
Subject: [PATCH 45/51] cleanup
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 535 +++++++++---------
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 4 +-
2 files changed, 279 insertions(+), 260 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 66460a63b..108a25552 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -18,48 +18,48 @@
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((BossHakugin*)thisx)
+#define GOHT_LIMB_FLAG(limbIndex) (1 << ((limbIndex)-1))
void BossHakugin_Init(Actor* thisx, PlayState* play2);
void BossHakugin_Destroy(Actor* thisx, PlayState* play);
void BossHakugin_Update(Actor* thisx, PlayState* play);
+void func_80B0E548(Actor* thisx, PlayState* play2);
void BossHakugin_Draw(Actor* thisx, PlayState* play);
void func_80B0E5A4(Actor* thisx, PlayState* play);
-void func_80B08018(BossHakugin* this, PlayState* play);
-void func_80B0813C(BossHakugin* this, PlayState* play);
-void func_80B082AC(BossHakugin* this, PlayState* play);
-void func_80B0863C(BossHakugin* this, PlayState* play);
-void func_80B08960(BossHakugin* this, PlayState* play);
-void func_80B08CB8(BossHakugin* this, PlayState* play);
-void func_80B091D8(BossHakugin* this, PlayState* play);
-void func_80B094E0(BossHakugin* this, PlayState* play);
-void func_80B098BC(BossHakugin* this, PlayState* play);
-void func_80B09C78(BossHakugin* this, PlayState* play);
-void func_80B09DFC(BossHakugin* this);
-void func_80B09E20(BossHakugin* this, PlayState* play);
-void func_80B09EDC(BossHakugin* this, PlayState* play);
-void func_80B0A2A4(BossHakugin* this, PlayState* play);
-void func_80B0A638(BossHakugin* this, PlayState* play);
-void func_80B0A8C4(BossHakugin* this, PlayState* play);
void func_80B058C0(BossHakugin* this);
void func_80B05EE0(BossHakugin* this, PlayState* play);
-void func_80B08124(BossHakugin* this);
-void func_80B08C1C(BossHakugin* this);
-void func_80B09E84(BossHakugin* this);
-void func_80B0825C(BossHakugin* this);
-void func_80B09F7C(BossHakugin* this);
-void func_80B08550(BossHakugin* this, PlayState* play);
-void func_80B08848(BossHakugin* this, PlayState* play);
-void func_80B0A5EC(BossHakugin* this);
-void func_80B0A87C(BossHakugin* this);
-void func_80B09178(BossHakugin* this);
-void func_80B09A94(BossHakugin* this, PlayState* play);
-
void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this);
void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play);
void func_80B0D9CC(BossHakugin* this);
void func_80B0DFA8(BossHakugin* this);
-void func_80B0E548(Actor* thisx, PlayState* play2);
+
+void func_80B08018(BossHakugin* this, PlayState* play);
+void func_80B08124(BossHakugin* this);
+void func_80B0813C(BossHakugin* this, PlayState* play);
+void func_80B082AC(BossHakugin* this, PlayState* play);
+void func_80B08550(BossHakugin* this, PlayState* play);
+void func_80B0863C(BossHakugin* this, PlayState* play);
+void func_80B08848(BossHakugin* this, PlayState* play);
+void func_80B08960(BossHakugin* this, PlayState* play);
+void func_80B08C1C(BossHakugin* this);
+void func_80B08CB8(BossHakugin* this, PlayState* play);
+void func_80B09178(BossHakugin* this);
+void func_80B091D8(BossHakugin* this, PlayState* play);
+void func_80B094E0(BossHakugin* this, PlayState* play);
+void func_80B098BC(BossHakugin* this, PlayState* play);
+void func_80B09A94(BossHakugin* this, PlayState* play);
+void func_80B09C78(BossHakugin* this, PlayState* play);
+void func_80B09DFC(BossHakugin* this);
+void func_80B09E20(BossHakugin* this, PlayState* play);
+void func_80B09E84(BossHakugin* this);
+void func_80B09EDC(BossHakugin* this, PlayState* play);
+void func_80B09F7C(BossHakugin* this);
+void func_80B0A2A4(BossHakugin* this, PlayState* play);
+void func_80B0A5EC(BossHakugin* this);
+void func_80B0A638(BossHakugin* this, PlayState* play);
+void func_80B0A87C(BossHakugin* this);
+void func_80B0A8C4(BossHakugin* this, PlayState* play);
ActorInit Boss_Hakugin_InitVars = {
ACTOR_BOSS_HAKUGIN,
@@ -83,7 +83,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 16, { { 1300, 200, 0 }, 30 }, 270 },
+ { GOHT_LIMB_HEAD, { { 1300, 200, 0 }, 30 }, 270 },
},
{
{
@@ -94,7 +94,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 15, { { 1400, 300, 0 }, 35 }, 270 },
+ { GOHT_LIMB_THORAX, { { 1400, 300, 0 }, 35 }, 270 },
},
{
{
@@ -105,7 +105,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 2, { { 1600, -400, 0 }, 26 }, 270 },
+ { GOHT_LIMB_PELVIS, { { 1600, -400, 0 }, 26 }, 270 },
},
{
{
@@ -116,7 +116,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 6, { { 1700, 200, 400 }, 18 }, 270 },
+ { GOHT_LIMB_FRONT_RIGHT_UPPER_LEG, { { 1700, 200, 400 }, 18 }, 270 },
},
{
{
@@ -127,7 +127,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 8, { { 1000, 0, 0 }, 10 }, 270 },
+ { GOHT_LIMB_FRONT_RIGHT_LOWER_LEG, { { 1000, 0, 0 }, 10 }, 270 },
},
{
{
@@ -138,7 +138,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 9, { { 500, 0, 0 }, 9 }, 270 },
+ { GOHT_LIMB_FRONT_RIGHT_HOOF, { { 500, 0, 0 }, 9 }, 270 },
},
{
{
@@ -149,7 +149,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 11, { { 1700, 200, -400 }, 18 }, 270 },
+ { GOHT_LIMB_FRONT_LEFT_UPPER_LEG, { { 1700, 200, -400 }, 18 }, 270 },
},
{
{
@@ -160,7 +160,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 13, { { 1000, 0, 0 }, 10 }, 270 },
+ { GOHT_LIMB_FRONT_LEFT_LOWER_LEG, { { 1000, 0, 0 }, 10 }, 270 },
},
{
{
@@ -171,7 +171,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 14, { { 500, 0, 0 }, 9 }, 270 },
+ { GOHT_LIMB_FRONT_LEFT_HOOF, { { 500, 0, 0 }, 9 }, 270 },
},
{
{
@@ -182,7 +182,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 21, { { 800, 0, 400 }, 15 }, 270 },
+ { GOHT_LIMB_BACK_RIGHT_THIGH, { { 800, 0, 400 }, 15 }, 270 },
},
{
{
@@ -193,7 +193,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 22, { { 500, 200, 0 }, 9 }, 270 },
+ { GOHT_LIMB_BACK_RIGHT_SHIN, { { 500, 200, 0 }, 9 }, 270 },
},
{
{
@@ -204,7 +204,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 24, { { 300, 0, 0 }, 8 }, 270 },
+ { GOHT_LIMB_BACK_RIGHT_PASTERN, { { 300, 0, 0 }, 8 }, 270 },
},
{
{
@@ -215,7 +215,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 25, { { 500, 100, 0 }, 9 }, 270 },
+ { GOHT_LIMB_BACK_RIGHT_HOOF, { { 500, 100, 0 }, 9 }, 270 },
},
{
{
@@ -226,7 +226,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 28, { { 800, 0, -400 }, 15 }, 270 },
+ { GOHT_LIMB_BACK_LEFT_THIGH, { { 800, 0, -400 }, 15 }, 270 },
},
{
{
@@ -237,7 +237,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 29, { { 500, 200, 0 }, 9 }, 270 },
+ { GOHT_LIMB_BACK_LEFT_SHIN, { { 500, 200, 0 }, 9 }, 270 },
},
{
{
@@ -248,7 +248,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 31, { { 300, 0, 0 }, 8 }, 270 },
+ { GOHT_LIMB_BACK_LEFT_PASTERN, { { 300, 0, 0 }, 8 }, 270 },
},
{
{
@@ -259,7 +259,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 32, { { 500, 100, 0 }, 9 }, 270 },
+ { GOHT_LIMB_BACK_LEFT_HOOF, { { 500, 100, 0 }, 9 }, 270 },
},
{
{
@@ -270,7 +270,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 16, { { 2400, -400, -2900 }, 12 }, 270 },
+ { GOHT_LIMB_HEAD, { { 2400, -400, -2900 }, 12 }, 270 },
},
{
{
@@ -281,7 +281,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = {
BUMP_ON | BUMP_NO_HITMARK,
OCELEM_ON,
},
- { 16, { { 2400, -400, 2900 }, 12 }, 270 },
+ { GOHT_LIMB_HEAD, { { 2400, -400, 2900 }, 12 }, 270 },
},
};
@@ -404,15 +404,16 @@ static CollisionCheckInfoInit D_80B0EA80 = { 30, 80, 100, MASS_IMMOVABLE };
TexturePtr D_80B0EA88 = gGohtMetalPlateWithCirclePatternTex;
-s8 D_80B0EA8C[] = {
- -1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1,
- 2, -1, -1, -1, -1, 9, 0xA, -1, -1, 0xB, -1, -1, 0xC, 0xD, -1, -1, 0xE
+s8 D_80B0EA8C[] = { -1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1, 2,
+ -1, -1, -1, -1, 9, 10, -1, -1, 11, -1, -1, 12, 13, -1, -1, 14 };
+s32 D_80B0EAB0[5] = {
+ GOHT_LIMB_BACK_LEFT_THIGH, GOHT_LIMB_BACK_RIGHT_PASTERN, GOHT_LIMB_JAW_ROOT,
+ GOHT_LIMB_FRONT_LEFT_LOWER_LEG, GOHT_LIMB_FRONT_RIGHT_UPPER_LEG,
};
-s32 D_80B0EAB0[5] = { 0x1C, 0x18, 0x11, 0xD, 6 };
-Color_RGBA8 D_80B0EAC4 = { 0xFA, 0xFA, 0xFA, 0xFF };
-Color_RGBA8 D_80B0EAC8 = { 0xB4, 0xB4, 0xB4, 0xFF };
-Color_RGB8 D_80B0EACC = { 0, 0x96, 0xFF };
-Color_RGB8 D_80B0EAD0 = { 0, 0xFF, 0xFF };
+Color_RGBA8 D_80B0EAC4 = { 250, 250, 250, 255 };
+Color_RGBA8 D_80B0EAC8 = { 180, 180, 180, 255 };
+Color_RGB8 D_80B0EACC = { 0, 150, 255 };
+Color_RGB8 D_80B0EAD0 = { 0, 255, 255 };
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
static s32 D_80B0EAD4 = 0;
@@ -431,8 +432,8 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
Actor_ProcessInitChain(&this->actor, D_80B0EAD8);
SkelAnime_InitFlex(play, &this->skelAnime, &gGohtSkel, &gGohtRunAnim, this->jointTable, this->morphTable,
GOHT_LIMB_MAX);
- if (D_80B0EAD4 == 0) {
- D_80B0EAD4 = 1;
+ if (!D_80B0EAD4) {
+ D_80B0EAD4 = true;
D_80B0EA88 = Lib_SegmentedToVirtual(D_80B0EA88);
}
@@ -460,7 +461,7 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
}
for (i = 0; i < ARRAY_COUNT(this->unk_09B0); i++) {
- actorPtr = &this->unk_09B0[i];
+ actorPtr = &this->unk_09B0[i]; // fake?
*actorPtr = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_HAKUROCK, 0.0f, 0.0f, 0.0f, 0, 0,
0, EN_HAKUROCK_TYPE_BOULDER);
}
@@ -476,7 +477,7 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B0EA60, &D_80B0EA80);
this->unk_01A0 = this->actor.shape.rot.y;
- this->unk_01B0 = -1;
+ this->unk_01B0 = 0xFFFFFFFF;
if (CHECK_EVENTINF(EVENTINF_53)) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC);
@@ -497,22 +498,6 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
}
}
-Vec3f D_80B0EAE8 = { 492.0f, 28.0f, -1478.0f };
-Vec3f D_80B0EAF4 = { 894.0f, 176.0f, -1600.0f };
-Vec3f D_80B0EB00 = { 972.0f, 176.0f, -1600.0f };
-Vec3f D_80B0EB0C = { 377.0f, 140.0f, -1600.0f };
-Vec3f D_80B0EB18 = { 282.0f, 108.0f, -1600.0f };
-s32 D_80B0EB24[5] = { 0, 0xF, 0x1A, 0x21, 0x24 };
-
-typedef struct {
- s32 unk_00;
- u32 unk_04;
-} BossHakuginUnkStruct_80B0A8C4;
-
-BossHakuginUnkStruct_80B0A8C4 D_80B0EB38[6] = {
- { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
-};
-
void BossHakugin_Destroy(Actor* thisx, PlayState* play) {
BossHakugin* this = THIS;
s32 pad;
@@ -580,7 +565,7 @@ void func_80B058C0(BossHakugin* this) {
now->params = 4;
now->world.pos.x = -500.0f;
now->world.pos.y = this->actor.world.pos.y;
- now->world.pos.z = -1266.6666667f;
+ now->world.pos.z = -1266.6666667f; // 3800 / 3
now->shape.rot.y = this->actor.shape.rot.y + 0x4000;
while (i < 6) {
@@ -590,11 +575,11 @@ void func_80B058C0(BossHakugin* this) {
now->params = 4;
now->world.pos.x = last->world.pos.x;
now->world.pos.y = this->actor.world.pos.y;
- now->world.pos.z = last->world.pos.z - 133.333333f;
+ now->world.pos.z = last->world.pos.z - 133.333333f; // 4000 / 3
now->shape.rot.y = last->shape.rot.y;
}
- while (i < 10) {
+ while (i < ARRAY_COUNT(this->unk_09D0)) {
last = (i < 8) ? this->unk_09D0[i - 6] : this->unk_09D0[i - 4];
now = this->unk_09D0[i++];
@@ -634,17 +619,17 @@ void func_80B05B04(BossHakugin* this, PlayState* play) {
var_v0 = (Rand_ZeroOne() < 0.5f) ? -1 : 1;
sp34.z = (var_v0 * (15.0f + (sp2C * 15.0f)) * 4.0f) + this->actor.world.pos.z;
- EffectSsKirakira_SpawnDispersed(play, &sp34, &gZeroVec3f, &gZeroVec3f, &D_80B0EAC4, &D_80B0EAC8, (s16)0x7D0, 5);
+ EffectSsKirakira_SpawnDispersed(play, &sp34, &gZeroVec3f, &gZeroVec3f, &D_80B0EAC4, &D_80B0EAC8, 2000, 5);
}
}
void func_80B05CBC(BossHakugin* this, Player* player) {
- if (!this->unk_0194 && (player->stateFlags3 & 0x80000) && !(player->actor.bgCheckFlags & 1) &&
- (player->actor.velocity.y > 5.0f)) {
+ if (!this->unk_0194 && (player->stateFlags3 & PLAYER_STATE3_80000) &&
+ !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (player->actor.velocity.y > 5.0f)) {
player->actor.velocity.y *= 1.3f;
player->linearVelocity *= 1.3f;
this->unk_0194 = true;
- } else if (player->actor.bgCheckFlags & 1) {
+ } else if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->unk_0194 = false;
}
}
@@ -654,20 +639,20 @@ void func_80B05D4C(BossHakugin* this) {
s32 i;
s16 var_t1 = 0;
- for (i = 0; i < 20; i++) {
- if (this->unk_2618[i].unk_0C == 0xFF) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
+ if (this->unk_2618[i].unk_0C == 255) {
var_t0 = &this->unk_2618[i].unk_00;
- var_t1 = 0x1388;
+ var_t1 = 5000;
break;
}
}
- if (i == 20) {
+ if (i == ARRAY_COUNT(this->unk_2618)) {
if (this->unk_01C8 > 0.0f) {
var_t0 = &this->unk_0380;
var_t1 = (this->unk_01C8 / 30.0f) * 5000.0f;
} else if ((this->unk_0192 == 3) || (this->unk_0192 == 2)) {
var_t0 = &this->unk_3734[0];
- var_t1 = 0x1388;
+ var_t1 = 5000;
} else if (this->unk_0192 == 4) {
var_t0 = &this->unk_3734[this->unk_01AA];
var_t1 = (10 - this->unk_01AA) * 500.0f;
@@ -810,8 +795,8 @@ void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play) {
spBC.y = player->actor.world.pos.y + 40.0f;
spBC.z = player->actor.world.pos.z - (Math_CosS(this->actor.shape.rot.y) * 50.0f);
Actor_OffsetOfPointInActorCoords(&this->actor, &sp98, &spBC);
- Audio_PlaySfx_AtPos(&this->unk_0458, 0x384DU);
- for (i = 0; i < 20; i++) {
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_THUNDER_THR);
+ for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
effect = &this->unk_2618[i];
Actor_OffsetOfPointInActorCoords(&this->actor, &sp8C, &spC8);
if (sp98.z < sp8C.z) {
@@ -838,7 +823,7 @@ void func_80B06600(BossHakugin* this, Vec3f* arg1, PlayState* play) {
} else {
Math_Vec3f_Copy(&spC8, &spB0);
}
- effect->unk_0C = 0x113 + 0x14 * i;
+ effect->unk_0C = 255 + 20 * (i + 1);
func_80B06558(effect);
effect->unk_0E.z = (s32)Rand_Next() >> 0x10;
}
@@ -848,7 +833,7 @@ void func_80B0696C(BossHakugin* this, Vec3f* arg1) {
s32 i;
BossHakuginEffect* temp_s0;
- for (i = 0; i < 180; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09F8); i++) {
temp_s0 = &this->unk_09F8[i];
if (temp_s0->unk_18 < 0) {
s16 sp2E;
@@ -866,7 +851,7 @@ void func_80B0696C(BossHakugin* this, Vec3f* arg1) {
temp_s0->unk_0.y = arg1->y + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.y);
temp_s0->unk_0.z = arg1->z + (Rand_ZeroFloat(3.0f) * temp_s0->unk_C.z);
temp_s0->unk_24 = (Rand_ZeroFloat(6.0f) + 15.0f) * 0.0001f;
- temp_s0->unk_18 = 0x28;
+ temp_s0->unk_18 = 40;
temp_s0->unk_1A = 0;
break;
}
@@ -887,7 +872,7 @@ void func_80B06B20(BossHakugin* this, Vec3f* arg1) {
return;
}
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09B0); i++) {
sp1C = this->unk_09B0[i];
if (sp1C->params == 0) {
@@ -901,7 +886,7 @@ void func_80B06B20(BossHakugin* this, Vec3f* arg1) {
void func_80B06C08(BossHakugin* this) {
s32 i;
- if ((this->unk_018E == 0) && (this->actor.colChkInfo.health < 0x14) && (Rand_ZeroOne() < 0.35f)) {
+ if ((this->unk_018E == 0) && (this->actor.colChkInfo.health < 20) && (Rand_ZeroOne() < 0.35f)) {
this->unk_018E = 4;
} else {
if (this->unk_018E > 0) {
@@ -909,7 +894,7 @@ void func_80B06C08(BossHakugin* this) {
}
return;
}
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09D0); i++) {
Actor* tmp = this->unk_09D0[i];
if (tmp->params == 0) {
@@ -923,7 +908,7 @@ void func_80B06D38(BossHakugin* this, PlayState* play) {
EnBom* sp44;
s16 temp_a1;
- if ((this->actor.speed > 10.0f) && ((s32)this->actor.colChkInfo.health < 0xA) && (this->unk_018F == 0) &&
+ if ((this->actor.speed > 10.0f) && ((s32)this->actor.colChkInfo.health < 10) && (this->unk_018F == 0) &&
(Rand_ZeroOne() < 0.35f)) {
this->unk_018F = 4;
} else {
@@ -948,7 +933,7 @@ void func_80B06D38(BossHakugin* this, PlayState* play) {
sp44->actor.world.rot.y = this->actor.yawTowardsPlayer;
}
- sp44->timer = (Rand_Next() >> 0x1C) + 0x11;
+ sp44->timer = (Rand_Next() >> 0x1C) + 17;
sp44->actor.velocity.y = 2.0f;
sp44->actor.speed = this->actor.xzDistToPlayer * 0.01f;
sp44->actor.speed = CLAMP(sp44->actor.speed, 6.0f, 12.0f);
@@ -969,12 +954,12 @@ void func_80B06F48(BossHakugin* this, PlayState* play) {
s32 pad;
sp9C = this->unk_0191 + 3;
- if (sp9C >= 15) {
+ if (sp9C >= ARRAY_COUNT(this->unk_3158[0])) {
sp9C = 0;
}
for (i = 0; i < ARRAY_COUNT(this->unk_3158); i++) {
- if (((15 - (3 * i)) < this->actor.colChkInfo.health) || !((1 << (D_80B0EAB0[i] + 0x1F)) & this->unk_01B0)) {
+ if (((15 - (3 * i)) < this->actor.colChkInfo.health) || !(GOHT_LIMB_FLAG(D_80B0EAB0[i]) & this->unk_01B0)) {
break;
}
@@ -986,8 +971,8 @@ void func_80B06F48(BossHakugin* this, PlayState* play) {
spA0.y -= 3.5f;
var_s4 = Math3D_Vec3fMagnitude(&spA0) / 10.0f;
- if (var_s4 >= 2) {
- if (var_s4 >= 4) {
+ if (var_s4 > 1) {
+ if (var_s4 > 3) {
var_s4 = 3;
}
Math_Vec3f_Scale(&spA0, 1.0f / var_s4);
@@ -1030,10 +1015,10 @@ s32 func_80B0728C(BossHakugin* this) {
this->unk_01A8--;
}
- this->unk_01C8 = (this->unk_01A6 + 0x480) * -0.026041666f;
+ this->unk_01C8 = (this->unk_01A6 + 0x480) * -0.026041666f; // 30 / 0x480
this->unk_01C8 = CLAMP_MIN(this->unk_01C8, 0.001f);
- this->unk_01D0 = (this->unk_01A6 - 0x700) * -0.00021059783f;
+ this->unk_01D0 = (this->unk_01A6 - 0x700) * -0.00021059783f; // 0.62 / 0xB80
this->unk_01D0 = CLAMP_MAX(this->unk_01D0, 0.62f);
if (this->unk_01D0 > 0.0f) {
@@ -1044,12 +1029,12 @@ s32 func_80B0728C(BossHakugin* this) {
} else if (this->unk_01A8 > 0) {
this->unk_01A8--;
- } else if (Math_ScaledStepToS(&this->unk_01A6, 0x700, 0x380) != 0) {
- this->unk_01D0 = (0x700 - this->unk_01A6) * 0.00024414062f * 0.62f;
- return 1;
+ } else if (Math_ScaledStepToS(&this->unk_01A6, 0x700, 0x380)) {
+ this->unk_01D0 = (0x700 - this->unk_01A6) / 4096.0f * 0.62f;
+ return true;
}
- return 0;
+ return false;
}
void func_80B07450(BossHakugin* this, PlayState* play) {
@@ -1062,7 +1047,7 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_FOOTSTEP_OLD);
Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_FRONT_LEFT_HOOF]]);
if (this->actor.xzDistToPlayer < 1500.0f) {
- temp = (1500.0f - this->actor.xzDistToPlayer) * 0.00066666666f;
+ temp = (1500.0f - this->actor.xzDistToPlayer) * (1.0f / 1500.0f);
func_80B05A64(this, play, 17000, 6.5f * temp, 10);
}
@@ -1114,7 +1099,7 @@ void func_80B07700(BossHakugin* this, PlayState* play, s32 arg2) {
}
vel.y += 0.8f;
- EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 0x258);
+ EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 600);
}
s32 func_80B0791C(BossHakugin* this, PlayState* play) {
@@ -1125,7 +1110,7 @@ s32 func_80B0791C(BossHakugin* this, PlayState* play) {
f32 sp24;
if (this->unk_044C.z > 0.0f) {
- return 0;
+ return false;
}
var_v1 = this->unk_01A0 - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
var_v0_2 = ABS_ALT(var_v1);
@@ -1134,10 +1119,10 @@ s32 func_80B0791C(BossHakugin* this, PlayState* play) {
if (var_v0_2 < 0x1800) {
this->unk_018C = 0;
}
- return 0;
+ return false;
}
if (this->unk_018C == 1) {
- return 0;
+ return false;
}
sp24 = this->actor.world.pos.x * this->unk_01B4;
sp28 = this->actor.world.pos.z * this->unk_01B4;
@@ -1149,16 +1134,16 @@ s32 func_80B0791C(BossHakugin* this, PlayState* play) {
(sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z < 0.0f) && (sp24 < -1200.0f)) ||
((sp34->actor.world.pos.z < -1200.0f) && (sp34->actor.world.pos.x < 1200.0f) &&
(sp34->actor.world.pos.x > -1200.0f) && (this->actor.world.pos.z > 0.0f) && (sp24 > 1200.0f))) {
- return 1;
+ return true;
}
- return 0;
+ return false;
}
void func_80B07B88(BossHakugin* this, PlayState* play) {
- if (this->unk_0196 == 0xA) {
+ if (this->unk_0196 == 10) {
this->unk_0196 = 0;
this->unk_01E4 = 0.0f;
- Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 0xF, 3, 0.7f, 0.5f);
+ Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 3, 0.7f, 0.5f);
}
}
@@ -1168,7 +1153,7 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_01E4 = 3.0f;
this->unk_01DC = 2.5f;
} else if (this->actor.colChkInfo.damageEffect == 0x4) {
- this->unk_0196 = 0x14;
+ this->unk_0196 = 20;
this->unk_01E4 = 3.0f;
this->unk_01DC = 2.5f;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->unk_0484.elements[arg2].info.bumper.hitPos.x,
@@ -1176,12 +1161,12 @@ void func_80B07BFC(BossHakugin* this, PlayState* play, s32 arg2) {
this->unk_0484.elements[arg2].info.bumper.hitPos.z, 0, 0, 0,
CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS));
} else if (this->actor.colChkInfo.damageEffect == 0x3) {
- this->unk_0196 = 0xA;
+ this->unk_0196 = 10;
this->unk_01DC = 2.5f;
this->unk_01E0 = 3.75f;
this->unk_01E4 = 1.0f;
} else if (this->actor.colChkInfo.damageEffect == 0xD) {
- this->unk_0196 = 0x15;
+ this->unk_0196 = 21;
this->unk_01DC = 2.5f;
this->unk_01E4 = 3.0f;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->unk_0484.elements[arg2].info.bumper.hitPos.x,
@@ -1234,6 +1219,8 @@ void func_80B07EEC(BossHakugin* this, PlayState* play) {
}
void func_80B08018(BossHakugin* this, PlayState* play) {
+ static Vec3f D_80B0EAE8 = { 492.0f, 28.0f, -1478.0f };
+
this->unk_019C++;
if (this->unk_019C == 30) {
this->unk_038C.x = 417.0f;
@@ -1250,7 +1237,7 @@ void func_80B08018(BossHakugin* this, PlayState* play) {
return;
}
- if (this->unk_019C >= 31) {
+ if (this->unk_019C > 30) {
func_80B07DA4(this, play, 5.0f, 0xC0);
}
}
@@ -1267,7 +1254,7 @@ void func_80B0813C(BossHakugin* this, PlayState* play) {
DECR(this->unk_019C);
}
- if ((this->unk_0964.base.acFlags & AC_HIT) && (this->unk_0964.info.acHitInfo->toucher.dmgFlags == 0x800)) {
+ if ((this->unk_0964.base.acFlags & AC_HIT) && (this->unk_0964.info.acHitInfo->toucher.dmgFlags == DMG_FIRE_ARROW)) {
this->unk_0964.base.atFlags &= ~AT_HIT;
this->unk_0964.base.acFlags &= ~AC_HIT;
this->unk_0964.base.ocFlags1 &= ~OC1_HIT;
@@ -1354,6 +1341,8 @@ void func_80B082AC(BossHakugin* this, PlayState* play) {
}
void func_80B08550(BossHakugin* this, PlayState* play) {
+ static Vec3f D_80B0EAF4 = { 894.0f, 176.0f, -1600.0f };
+ static Vec3f D_80B0EB00 = { 972.0f, 176.0f, -1600.0f };
Player* player = GET_PLAYER(play);
Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_STEAM_DEMO_UP_OLD);
@@ -1373,6 +1362,8 @@ void func_80B08550(BossHakugin* this, PlayState* play) {
}
void func_80B0863C(BossHakugin* this, PlayState* play) {
+ static Vec3f D_80B0EB0C = { 377.0f, 140.0f, -1600.0f };
+ static Vec3f D_80B0EB18 = { 282.0f, 108.0f, -1600.0f };
s32 i;
this->unk_019C--;
@@ -1440,7 +1431,7 @@ void func_80B08848(BossHakugin* this, PlayState* play) {
this->actor.speed = 5.0f;
func_800B7298(play, &this->actor, PLAYER_CSMODE_END);
player->stateFlags1 |= PLAYER_STATE1_20;
- play->actorCtx.unk268 = 1;
+ play->actorCtx.unk268 = true;
this->actionFunc = func_80B08960;
}
@@ -1453,7 +1444,7 @@ void func_80B08960(BossHakugin* this, PlayState* play) {
Math_ScaledStepToS(&this->unk_01A6, 0x800, 0x80);
Math_StepToF(&this->actor.speed, 25.0f, 0.5f);
- this->skelAnime.playSpeed = (this->actor.speed * 0.03125f) + 0.5f;
+ this->skelAnime.playSpeed = (this->actor.speed / 32.0f) + 0.5f;
func_80B07450(this, play);
this->unk_018D = 10;
SkelAnime_Update(&this->skelAnime);
@@ -1490,10 +1481,10 @@ void func_80B08960(BossHakugin* this, PlayState* play) {
if (this->unk_0484.base.atFlags & AT_HIT) {
func_800B8D50(play, &this->actor, 10.0f, 0, 6.0f, 0);
} else {
- play->actorCtx.unk268 = 1;
+ play->actorCtx.unk268 = true;
}
- if (this->unk_019C >= 5) {
+ if (this->unk_019C > 4) {
var_fv0 = (this->unk_019C - 4) * 5.0f;
var_fv0 = CLAMP_MAX(var_fv0, 60.0f);
func_800B6F20(play, &play->actorCtx.unk_26C, var_fv0, -0x4000);
@@ -1514,19 +1505,19 @@ void func_80B08CB8(BossHakugin* this, PlayState* play) {
s16 temp_a0;
if (this->unk_01A4 == 0) {
- this->unk_0484.base.atFlags |= 1;
+ this->unk_0484.base.atFlags |= AT_ON;
}
if (this->unk_0192 == 1) {
if (func_80B0728C(this)) {
- Math_Vec3f_Copy(this->unk_3734, &this->unk_0380);
+ Math_Vec3f_Copy(&this->unk_3734[0], &this->unk_0380);
this->unk_01B8 = this->actor.speed + 100.0f;
this->unk_37AC.x = Math_CosS(0xA00) * Math_SinS(this->actor.shape.rot.y);
this->unk_37AC.y = Math_SinS(0xA00);
this->unk_37AC.z = Math_CosS(0xA00) * Math_CosS(this->actor.shape.rot.y);
this->unk_0192 = 2;
this->unk_01C8 = 0.0f;
- Audio_PlaySfx_AtPos(&this->unk_0458, 0x3852U);
- this->unk_37B8.base.atFlags |= 1;
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_E_BALL_THR);
+ this->unk_37B8.base.atFlags |= AT_ON;
}
} else {
Math_ScaledStepToS(&this->unk_01A6, 0, 0x100);
@@ -1534,16 +1525,16 @@ void func_80B08CB8(BossHakugin* this, PlayState* play) {
if (func_80B0791C(this, play)) {
func_80B09A94(this, play);
} else {
- if (this->unk_019A >= 0x38) {
+ if (this->unk_019A > 55) {
this->unk_019A = 0;
- this->unk_019C = 0x28;
+ this->unk_019C = 40;
this->unk_01C4 = 27.0f;
}
- if ((this->unk_019C == 0x28) &&
+ if ((this->unk_019C == 40) &&
(Math_SmoothStepToF(&this->actor.speed, this->unk_01C4, 0.15f, 1.0f, 0.1f) < 0.05f)) {
this->unk_019C -= 1;
} else {
- if (this->unk_019C != 0x28) {
+ if (this->unk_019C != 40) {
this->unk_019C--;
if (this->unk_019C == 0) {
if (this->actor.xzDistToPlayer > 1500.0f) {
@@ -1553,12 +1544,12 @@ void func_80B08CB8(BossHakugin* this, PlayState* play) {
} else {
this->unk_01C4 = 14.5f;
}
- this->unk_01C4 += (0x1E - this->actor.colChkInfo.health) * (1.0f / 30.0f);
- this->unk_019C = 0x28;
+ this->unk_01C4 += (30 - this->actor.colChkInfo.health) * (1.0f / 30.0f);
+ this->unk_019C = 40;
}
}
}
- this->skelAnime.playSpeed = (this->actor.speed * 0.03125f) + 0.5f;
+ this->skelAnime.playSpeed = (this->actor.speed / 32.0f) + 0.5f;
SkelAnime_Update(&this->skelAnime);
func_80B07450(this, play);
if ((this->unk_01BC < (this->unk_01C0 * 0.5f)) || (this->unk_01BC < 89.100006f)) {
@@ -1596,7 +1587,7 @@ void func_80B091D8(BossHakugin* this, PlayState* play) {
Math_StepToF(&this->actor.speed, 25.0f, 2.0f);
SkelAnime_Update(&this->skelAnime);
func_80B07450(this, play);
- if ((this->unk_044C.z < 0.0f) || (this->unk_0484.base.atFlags & 2)) {
+ if ((this->unk_044C.z < 0.0f) || (this->unk_0484.base.atFlags & AT_HIT)) {
func_80B08C1C(this);
} else {
if ((this->unk_01C0 < 89.100006f) || (this->unk_01BC < 89.100006f)) {
@@ -1629,7 +1620,7 @@ void func_80B093C0(BossHakugin* this) {
this->unk_0484.base.atFlags &= ~AT_ON;
this->unk_0484.base.acFlags &= ~AC_HARD;
this->unk_01A6 = 0;
- this->unk_0195 = 0;
+ this->unk_0195 = false;
this->unk_01C8 = 0.0f;
if (this->unk_0192 == 1) {
Math_Vec3f_Copy(&this->unk_3734[0], &this->unk_0380);
@@ -1654,11 +1645,11 @@ void func_80B094E0(BossHakugin* this, PlayState* play) {
s32 i;
s32 sp9C;
- Actor_PlaySfx_Flagged(&this->actor, 0x301BU);
+ Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_WEAKENED - SFX_FLAG);
if (SkelAnime_Update(&this->skelAnime)) {
- if (this->unk_0195 == 0) {
- this->unk_0195 = 1;
- func_80B05A64(this, play, 0x4268, 7, 0xA);
+ if (!this->unk_0195) {
+ this->unk_0195 = true;
+ func_80B05A64(this, play, 17000, 7, 10);
}
if (this->actor.speed > 5.0f) {
@@ -1680,7 +1671,7 @@ void func_80B094E0(BossHakugin* this, PlayState* play) {
(Math_CosS(this->actor.shape.rot.y) * temp_fs1);
spA4.y = this->actor.world.pos.y + 300.0f;
spA4.y = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &spBC, &sp9C, &this->actor, &spA4) + 10.0f;
- func_800B12F0(play, &spA4, &spB0, &gZeroVec3f, Rand_S16Offset(0x2EE, 0x64), 0xA, 0x1E);
+ func_800B12F0(play, &spA4, &spB0, &gZeroVec3f, Rand_S16Offset(750, 100), 10, 30);
}
}
}
@@ -1692,10 +1683,10 @@ void func_80B094E0(BossHakugin* this, PlayState* play) {
this->actor.world.pos.y = this->actor.home.pos.y + Rand_CenteredFloat(5.0f);
this->actor.world.pos.z = this->actor.home.pos.z + Rand_CenteredFloat(5.0f);
if (this->unk_019C == 0) {
- this->unk_0484.base.acFlags |= 4;
+ this->unk_0484.base.acFlags |= AC_HARD;
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos);
func_80B08C1C(this);
- this->unk_01A4 = 0x14;
+ this->unk_01A4 = 20;
}
} else if (Math_StepToF(&this->actor.speed, 5.0f, 0.3f)) {
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
@@ -1732,7 +1723,7 @@ void func_80B098BC(BossHakugin* this, PlayState* play) {
}
} else {
if (Math_ScaledStepToS(&this->unk_01A6, -0x800, 0x1C0)) {
- player->actionVar2 = 0x64;
+ player->actionVar2 = 100;
player->actor.parent = NULL;
player->invincibilityTimer = 0;
player->actor.shape.rot.x = 0;
@@ -1793,7 +1784,7 @@ void func_80B09A94(BossHakugin* this, PlayState* play) {
this->unk_018C = 0;
}
this->unk_01A6 = 0x700;
- this->unk_019C = 0x96;
+ this->unk_019C = 150;
this->unk_01CC = -100.0f;
this->actionFunc = func_80B09C78;
}
@@ -1841,7 +1832,7 @@ void func_80B09DFC(BossHakugin* this) {
void func_80B09E20(BossHakugin* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_COMMON_THUNDER - SFX_FLAG);
- if (func_80B0728C(this) != 0) {
+ if (func_80B0728C(this)) {
func_80B06600(this, &this->unk_0380, play);
func_80B09A94(this, play);
}
@@ -1948,7 +1939,8 @@ void func_80B0A2A4(BossHakugin* this, PlayState* play) {
func_80B07450(this, play);
Math_SmoothStepToS(&this->actor.home.rot.y, this->unk_01A0, 5, 0x800, 0x100);
this->unk_019C--;
- this->actor.shape.rot.y = (s32)(Math_SinF(this->unk_019C * 0.17453294f) * this->unk_01A2) + this->actor.home.rot.y;
+ this->actor.shape.rot.y =
+ (s32)(Math_SinF(this->unk_019C * (M_PI / 18.0f)) * this->unk_01A2) + this->actor.home.rot.y;
if (this->unk_019C == 0) {
if (this->unk_01A2 > 0) {
@@ -1956,13 +1948,13 @@ void func_80B0A2A4(BossHakugin* this, PlayState* play) {
} else {
this->unk_01A2 = Rand_S16Offset(0x800, 0x800);
}
- this->unk_019C = 0x12;
+ this->unk_019C = 18;
this->unk_01AE = Rand_ZeroFloat(6144.0f);
}
- this->unk_0374.z = (8192.0f * Math_SinS(this->unk_01AE)) * Math_SinF(this->unk_019C * 0.34906587f);
- this->unk_0374.y = (8192.0f * Math_CosS(this->unk_01AE)) * Math_SinF(this->unk_019C * 0.34906587f);
- this->actor.shape.rot.z = Math_SinF(this->unk_019C * 0.17453294f) * -(this->unk_01A2 * 0.3f);
+ this->unk_0374.z = (8192.0f * Math_SinS(this->unk_01AE)) * Math_SinF(this->unk_019C * (M_PI / 9));
+ this->unk_0374.y = (8192.0f * Math_CosS(this->unk_01AE)) * Math_SinF(this->unk_019C * (M_PI / 9));
+ this->actor.shape.rot.z = Math_SinF(this->unk_019C * (M_PI / 18)) * -(this->unk_01A2 * 0.3f);
this->actor.world.rot.y = this->actor.shape.rot.y;
at.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x;
at.y = this->actor.world.pos.y + 200.0f;
@@ -2022,7 +2014,7 @@ void func_80B0A638(BossHakugin* this, PlayState* play) {
var_v0 = ABS_ALT(this->unk_019E);
if (var_v0 < 0x2000) {
this->actor.world.pos.z = -1389.0f;
- } else if (var_v0 >= 0x6001) {
+ } else if (var_v0 > 0x6000) {
this->actor.world.pos.z = 1389.0f;
} else if (this->unk_019E > 0) {
this->actor.world.pos.x = -1389.0f;
@@ -2044,9 +2036,31 @@ void func_80B0A87C(BossHakugin* this) {
}
#ifdef NON_MATCHING
+typedef struct {
+ s32 unk_00;
+ u32 unk_04;
+} BossHakuginStruct_B0A8C4;
+static s32 D_80B0EB24[5] = { 0, 15, 26, 33, 36 };
+// static u32 D_80B0EB38[6][2] = {
+// { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
+// };
+static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
+ { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
+};
+// static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
+// { 0, GOHT_LIMB_FLAG(GOHT_LIMB_HEAD) | GOHT_LIMB_FLAG(GOHT_LIMB_JAW) },
+// { 4, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_UPPER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_LOWER_LEG) |
+// GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_HOOF) }, { 7, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_UPPER_LEG) |
+// GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_LOWER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_HOOF)}, { 14,
+// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_SHIN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_PASTERN) |
+// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_HOOF)}, { 10, GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_SHIN) |
+// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_PASTERN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_HOOF)}, { 1,
+// GOHT_LIMB_FLAG(GOHT_LIMB_PELVIS) | GOHT_LIMB_FLAG(GOHT_LIMB_THORAX) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_THIGH)
+// | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_THIGH)},
+// };
// non-matchings seem to be caused by accesses to D_80B0EB38
void func_80B0A8C4(BossHakugin* this, PlayState* play) {
- EnBom* bomb;
+ EnBom* bomb = GOHT_LIMB_BACK_LEFT_HOOF;
Vec3s* test;
Camera* camera;
Vec3f eyeTarget;
@@ -2082,7 +2096,7 @@ void func_80B0A8C4(BossHakugin* this, PlayState* play) {
}
this->unk_01B0 &= ~D_80B0EB38[sp60].unk_04;
if (sp60 == 5) {
- AudioSeq_QueueSeqCmd(0x8021U);
+ SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC);
}
}
@@ -2095,9 +2109,9 @@ void func_80B0A8C4(BossHakugin* this, PlayState* play) {
}
if (sp60 < 6) {
if (sp60 & 1) {
- Audio_PlaySfx_AtPos(&this->unk_0458, 0x393EU);
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_LAST1_DEMO_WALL);
} else {
- Audio_PlaySfx_AtPos(&this->unk_0458, 0x393DU);
+ Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_LAST1_DEMO_BREAK);
}
}
if (1) {} // TODO: probably fake
@@ -2106,25 +2120,30 @@ void func_80B0A8C4(BossHakugin* this, PlayState* play) {
this->unk_019C++;
}
#else
+s32 D_80B0EB24[5] = { 0, 0xF, 0x1A, 0x21, 0x24 };
+s32 D_80B0EB38[6][2] = {
+ { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
+};
+
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A8C4.s")
#endif
void func_80B0AC30(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if ((this->unk_0484.base.atFlags & 2) &&
- ((this->actionFunc == func_80B091D8) || !(player->stateFlags3 & 0x80000))) {
- if ((this->actionFunc == func_80B091D8) && (this->unk_0484.elements->info.toucherFlags & 2) &&
- !(this->unk_0484.base.atFlags & 4) && (play->grabPlayer(play, player))) {
+ if ((this->unk_0484.base.atFlags & AT_HIT) &&
+ ((this->actionFunc == func_80B091D8) || !(player->stateFlags3 & PLAYER_STATE3_80000))) {
+ if ((this->actionFunc == func_80B091D8) && (this->unk_0484.elements->info.toucherFlags & TOUCH_HIT) &&
+ !(this->unk_0484.base.atFlags & AT_BOUNCED) && (play->grabPlayer(play, player))) {
func_80B09840(this, play);
- } else if (player->stateFlags3 & 0x1000) {
+ } else if (player->stateFlags3 & PLAYER_STATE3_1000) {
player->unk_B08 = player->linearVelocity = -5.0f;
player->unk_B0C += player->unk_B08 * 0.05f;
player->actor.velocity.y = 10.0f;
player->unk_B8C = 4;
player->actor.shape.rot.y = player->actor.home.rot.y = player->currentYaw = player->actor.world.rot.y;
- } else if (!(this->unk_0484.base.atFlags & 4)) {
+ } else if (!(this->unk_0484.base.atFlags & AT_BOUNCED)) {
s16 var_a3 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (var_a3 > 0) {
@@ -2132,39 +2151,41 @@ void func_80B0AC30(BossHakugin* this, PlayState* play) {
} else {
var_a3 = this->actor.shape.rot.y + (s32)(var_a3 / 2.0f) - 0x4000;
}
- func_800B8D50(play, &this->actor, 5.0f, var_a3, 6.0f, 0U);
+ func_800B8D50(play, &this->actor, 5.0f, var_a3, 6.0f, 0);
}
}
}
s32 func_80B0ADFC(BossHakugin* this, PlayState* play) {
- if (this->unk_0484.base.acFlags & 2) {
+ if (this->unk_0484.base.acFlags & AC_HIT) {
s32 i;
- for (i = 0; i < 19; i++) {
- if (this->unk_0484.elements[i].info.bumperFlags & 2) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_04A4); i++) {
+ if (this->unk_0484.elements[i].info.bumperFlags & BUMP_HIT) {
break;
}
}
- if (i == 19) {
- return 0;
+ if (i == ARRAY_COUNT(this->unk_04A4)) {
+ return false;
}
- if ((this->unk_0196 == 0xA) && (this->unk_0484.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) {
- return 0;
+ // DMG_DEKU_NUT | DMG_DEKU_STICK | DMG_ZORA_BOOMERANG | DMG_NORMAL_ARROW | DMG_HOOKSHOT | DMG_ICE_ARROW
+ // | DMG_LIGHT_ARROW | DMG_DEKU_SPIN | DMG_DEKU_BUBBLE | DMG_DEKU_LAUNCH | DMG_ZORA_BARRIER
+ if ((this->unk_0196 == 10) && (this->unk_0484.elements[i].info.acHitInfo->toucher.dmgFlags & 0x000DB0B3)) {
+ return false;
}
func_80B07B88(this, play);
if (this->actionFunc == func_80B094E0) {
- Actor_SetColorFilter(&this->actor, 0x4000U, 0xFFU, 0U, (u16)0xF);
+ Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 15);
func_80B07BFC(this, play, i);
if (Actor_ApplyDamage(&this->actor) == 0) {
Enemy_StartFinishingBlow(play, &this->actor);
- Actor_PlaySfx(&this->actor, 0x3950U);
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_DEAD_OLD);
func_80B09E84(this);
} else {
- Actor_PlaySfx(&this->actor, 0x3951U);
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_DAMAGE_OLD);
}
- this->unk_01A4 = 0xF;
- return 1;
+ this->unk_01A4 = 15;
+ return true;
}
if (((this->actor.colChkInfo.damageEffect == 0xF) || (this->actor.colChkInfo.damageEffect == 0xE) ||
(this->actor.colChkInfo.damageEffect == 2) || (this->actor.colChkInfo.damageEffect == 3) ||
@@ -2182,46 +2203,46 @@ s32 func_80B0ADFC(BossHakugin* this, PlayState* play) {
player->pushedYaw = this->actor.shape.rot.y - 0x4000;
}
}
- this->unk_01A4 = 0xF;
- Actor_SetColorFilter(&this->actor, 0x4000U, 0xFF, 0, 0xF);
- this->unk_019A += 0x23;
+ this->unk_01A4 = 15;
+ Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 15);
+ this->unk_019A += 35;
func_80B07BFC(this, play, i);
this->actor.colChkInfo.damage = this->unk_0484.elements[i].info.acHitInfo->toucher.damage;
if (Actor_ApplyDamage(&this->actor) == 0) {
Enemy_StartFinishingBlow(play, &this->actor);
- Actor_PlaySfx(&this->actor, 0x3950U);
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_DEAD_OLD);
func_80B09E84(this);
} else {
if ((this->actor.colChkInfo.damageEffect == 0xC) ||
((this->actor.colChkInfo.damageEffect == 0xF) && (this->actionFunc != func_80B091D8) &&
- ((this->unk_0484.elements[0].info.bumperFlags & 2) ||
- (this->unk_0484.elements[1].info.bumperFlags & 2) ||
- (this->unk_0484.elements[2].info.bumperFlags & 2) ||
- (this->unk_0484.elements[3].info.bumperFlags & 2) ||
- (this->unk_0484.elements[6].info.bumperFlags & 2) ||
- (this->unk_0484.elements[9].info.bumperFlags & 2) ||
- (this->unk_0484.elements[13].info.bumperFlags & 2) ||
- (this->unk_0484.elements[17].info.bumperFlags & 2) ||
- (this->unk_0484.elements[18].info.bumperFlags & 2)))) {
+ ((this->unk_0484.elements[0].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[1].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[2].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[3].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[6].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[9].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[13].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[17].info.bumperFlags & BUMP_HIT) ||
+ (this->unk_0484.elements[18].info.bumperFlags & BUMP_HIT)))) {
func_80B093C0(this);
} else if ((this->unk_0192 == 0) && (this->unk_01AA == 0) && (this->actionFunc == func_80B08CB8) &&
(this->actor.colChkInfo.damageEffect == 0xF)) {
this->unk_01A8 = 5;
this->unk_0192 = 1;
}
- Actor_PlaySfx(&this->actor, 0x3951U);
+ Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_DAMAGE_OLD);
}
- return 1;
+ return true;
} else {
s32 j;
- this->unk_01A4 = 0x14;
- for (j = 0; j < 19; j++) {
+ this->unk_01A4 = 20;
+ for (j = 0; j < ARRAY_COUNT(this->unk_04A4); j++) {
Vec3f sp40;
ColliderInfo* hurtbox = &this->unk_0484.elements[j].info;
- if ((hurtbox->bumperFlags & 2) && (hurtbox->acHitInfo != NULL) &&
- !(hurtbox->acHitInfo->toucherFlags & 0x18)) {
+ if ((hurtbox->bumperFlags & BUMP_HIT) && (hurtbox->acHitInfo != NULL) &&
+ !(hurtbox->acHitInfo->toucherFlags & TOUCH_SFX_NONE)) {
Math_Vec3s_ToVec3f(&sp40, &hurtbox->bumper.hitPos);
EffectSsHitmark_SpawnFixedScale(play, 3, &sp40);
CollisionCheck_SpawnShieldParticlesMetalSound(play, &sp40, &this->actor.projectedPos);
@@ -2231,14 +2252,14 @@ s32 func_80B0ADFC(BossHakugin* this, PlayState* play) {
}
}
- return 0;
+ return false;
}
void func_80B0B238(BossHakugin* this) {
BossHakuginEffect* temp_s0;
s32 i;
- for (i = 0; i < 180; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_09F8); i++) {
temp_s0 = &this->unk_09F8[i];
if (temp_s0->unk_18 >= 0) {
@@ -2273,8 +2294,8 @@ void func_80B0B3F4(BossHakugin* this) {
s32 i;
s32 j;
- for (i = 0; i < 5; i++) {
- for (j = 0; j < 15; j++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_3158); i++) {
+ for (j = 0; j < ARRAY_COUNT(this->unk_3158[0]); j++) {
BossHakuginFhgFlashUnkStruct* effect = &this->unk_3158[i][j];
if (effect->unk_10 > 0) {
@@ -2282,7 +2303,7 @@ void func_80B0B3F4(BossHakugin* this) {
effect->unk_00.y += 3.5f;
effect->unk_0C += 0.003f;
if (effect->unk_12 < 0) {
- effect->unk_10 -= 0xF;
+ effect->unk_10 -= 15;
if (effect->unk_10 < 0) {
effect->unk_10 = 0;
}
@@ -2300,20 +2321,20 @@ void func_80B0B548(BossHakugin* this, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
unk_str = &this->unk_2618[i];
- if (unk_str->unk_14.base.atFlags & 2) {
+ if (unk_str->unk_14.base.atFlags & AT_HIT) {
Player* player = GET_PLAYER(play);
this->unk_018C = 1;
Player_PlaySfx(player, NA_SE_EN_COMMON_E_BALL_HIT);
- unk_str->unk_14.base.atFlags &= ~2;
+ unk_str->unk_14.base.atFlags &= ~AT_HIT;
}
if (unk_str->unk_0C > 0) {
- unk_str->unk_0C -= 0x14;
+ unk_str->unk_0C -= 20;
if (unk_str->unk_0C <= 0) {
unk_str->unk_0C = 0;
- } else if (unk_str->unk_0C < 0x100) {
+ } else if (unk_str->unk_0C <= 255) {
rand = (s32)Rand_Next() >> 0x10;
unk_str->unk_0E.z = rand;
- if (unk_str->unk_0C >= 0x3D) {
+ if (unk_str->unk_0C > 60) {
CollisionCheck_SetAT(play, &play->colChkCtx, &unk_str->unk_14.base);
}
}
@@ -2333,10 +2354,10 @@ void func_80B0B660(BossHakugin* this, PlayState* play) {
s32 var_s0_2;
f32 sp60;
s32 sp5C;
- s32 sp58 = 0;
+ s32 sp58 = false;
s16 temp_v1;
- sp6C = this->unk_3734;
+ sp6C = &this->unk_3734[0];
if (this->unk_0192 == 2) {
if (Math_StepToF(&this->unk_01B8, 50.0f, 3.5f)) {
@@ -2354,8 +2375,8 @@ void func_80B0B660(BossHakugin* this, PlayState* play) {
} else if (this->unk_0192 != 4) {
return;
}
- Audio_PlaySfx_AtPos(&this->unk_0464, 0x304CU);
- if (this->unk_01AA < 0xA) {
+ Audio_PlaySfx_AtPos(&this->unk_0464, NA_SE_EN_COMMON_E_BALL - SFX_FLAG);
+ if (this->unk_01AA < 10) {
this->unk_01AA++;
}
if ((this->unk_0192 == 4) && (this->unk_01AA == 9)) {
@@ -2369,13 +2390,13 @@ void func_80B0B660(BossHakugin* this, PlayState* play) {
}
this->unk_0198 += (s16)(0x4000 + (Rand_Next() >> 0x12));
if (this->unk_0192 != 4) {
- if (this->unk_37B8.base.atFlags & 2) {
+ if (this->unk_37B8.base.atFlags & AT_HIT) {
this->unk_0192 = 4;
this->unk_01AA = 0;
- this->unk_37B8.base.atFlags &= ~2;
- this->unk_37B8.base.atFlags &= ~1;
- sp58 = 1;
- Audio_PlaySfx_AtPos(&this->unk_0464, 0x384EU);
+ this->unk_37B8.base.atFlags &= ~AT_HIT;
+ this->unk_37B8.base.atFlags &= ~AT_ON;
+ sp58 = true;
+ Audio_PlaySfx_AtPos(&this->unk_0464, NA_SE_EN_COMMON_E_BALL_HIT);
}
sp88.x = sp6C->x + (this->unk_01B8 * this->unk_37AC.x);
sp88.y = sp6C->y + (this->unk_01B8 * this->unk_37AC.y);
@@ -2384,7 +2405,7 @@ void func_80B0B660(BossHakugin* this, PlayState* play) {
var_s0_2 = 0;
Math_Vec3f_Copy(sp6C, &sp94);
- if ((spA0->normal.y >= -0x6664) && (spA0->normal.y < 0x3FFF)) {
+ if ((spA0->normal.y > -0x6665) && (spA0->normal.y < 0x3FFF)) {
temp_v1 =
Math_Vec3f_Yaw(sp6C, &spA4->actor.world.pos) -
Math_Atan2S_XY(spA0->normal.z * COLPOLY_NORMAL_FRAC, spA0->normal.x * COLPOLY_NORMAL_FRAC);
@@ -2393,8 +2414,8 @@ void func_80B0B660(BossHakugin* this, PlayState* play) {
if ((this->unk_0192 == 3) && (var_s0_2 || (spA0->normal.y >= 0x4000))) {
this->unk_0192 = 4;
this->unk_01AA = 0;
- if (sp58 == 0) {
- Audio_PlaySfx_AtPos(&this->unk_0464, 0x384EU);
+ if (!sp58) {
+ Audio_PlaySfx_AtPos(&this->unk_0464, NA_SE_EN_COMMON_E_BALL_HIT);
}
} else {
sp7C.x = spA0->normal.x * COLPOLY_NORMAL_FRAC;
@@ -2420,17 +2441,17 @@ void BossHakugin_Update(Actor* thisx, PlayState* play) {
Vec3s sp70;
Player* player = GET_PLAYER(play);
- this->unk_0190 = 0;
+ this->unk_0190 = false;
DECR(this->unk_019A);
- if ((this->actionFunc != func_80B09EDC) && (func_80B0ADFC(this, play) == 0)) {
+ if ((this->actionFunc != func_80B09EDC) && !func_80B0ADFC(this, play)) {
func_80B0AC30(this, play);
}
func_80B0607C(this, play);
- Actor_OffsetOfPointInActorCoords(&this->actor, (Vec3f*)&this->unk_044C.x, &player->actor.world.pos);
+ Actor_OffsetOfPointInActorCoords(&this->actor, &this->unk_044C, &player->actor.world.pos);
this->actionFunc(this, play);
Actor_MoveWithGravity(&this->actor);
- Actor_UpdateBgCheckInfo(play, &this->actor, 450.0f, 89.100006f, 0.0f, 0x1DU);
+ Actor_UpdateBgCheckInfo(play, &this->actor, 450.0f, 89.100006f, 0.0f, 0x1D); // flags
func_800BE3D0(&this->actor, this->actor.shape.rot.y, &sp70);
Math_ScaledStepToS(&this->actor.shape.rot.x, sp70.x, 0x100);
Math_ScaledStepToS(&this->actor.shape.rot.z, sp70.z, 0x100);
@@ -2445,29 +2466,29 @@ void BossHakugin_Update(Actor* thisx, PlayState* play) {
func_80B05B04(this, play);
func_80B05CBC(this, player);
func_80B05D4C(this);
- if ((this->unk_0484.base.atFlags & 1) && (this->actor.colorFilterTimer == 0)) {
+ if ((this->unk_0484.base.atFlags & AT_ON) && (this->actor.colorFilterTimer == 0)) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_0484.base);
} else {
- this->unk_0484.base.atFlags &= ~2;
+ this->unk_0484.base.atFlags &= ~AT_HIT;
}
if (this->unk_01A4 == 0) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_0484.base);
} else {
- this->unk_0484.base.acFlags &= ~2;
+ this->unk_0484.base.acFlags &= ~AC_HIT;
this->unk_01A4--;
}
- if (this->unk_0484.base.ocFlags1 & 1) {
+ if (this->unk_0484.base.ocFlags1 & OC1_ON) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_0484.base);
} else {
- this->unk_0484.base.ocFlags1 &= ~2;
+ this->unk_0484.base.ocFlags1 &= ~OC1_HIT;
}
if (this->unk_01E4 > 0.0f) {
- if (this->unk_0196 != 0xA) {
+ if (this->unk_0196 != 10) {
Math_StepToF(&this->unk_01E4, 0.0f, 0.05f);
this->unk_01DC = (this->unk_01E4 + 1.0f) * 1.25f;
this->unk_01DC = CLAMP_MAX(this->unk_01DC, 2.5f);
- } else if (!Math_StepToF(&this->unk_01E0, 2.5f, 0.41666666f)) {
- Actor_PlaySfx_Flagged(&this->actor, 0x20B2U);
+ } else if (!Math_StepToF(&this->unk_01E0, 2.5f, 5.0f / 12.0f)) {
+ Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
} else {
func_80B07B88(this, play);
}
@@ -2530,12 +2551,12 @@ s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dL
if (limbIndex == GOHT_LIMB_ROOT) {
pos->y -= this->actor.shape.yOffset;
}
- if (!(this->unk_01B0 & (1 << (limbIndex + 0x1F)))) {
+ if (!(this->unk_01B0 & GOHT_LIMB_FLAG(limbIndex))) {
*dList = NULL;
}
}
- if ((this->unk_0190 == 0) && (limbIndex == D_80B0EB6C)) {
+ if (!this->unk_0190 && (limbIndex == D_80B0EB6C)) {
Matrix_MultZero(&this->unk_3158[D_80B0EB68][this->unk_0191].unk_00);
D_80B0EB68--;
if (D_80B0EB68 < 0) {
@@ -2721,7 +2742,7 @@ void func_80B0CAF0(BossHakugin* this, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(this->unk_2618); i++) {
iter = &this->unk_2618[i];
- if ((iter->unk_0C > 0) && (iter->unk_0C < 256)) {
+ if ((iter->unk_0C > 0) && (iter->unk_0C <= 255)) {
Matrix_SetTranslateRotateYXZ(iter->unk_00.x, iter->unk_00.y, iter->unk_00.z, &iter->unk_0E);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
@@ -2807,7 +2828,7 @@ void func_80B0CF24(BossHakugin* this, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames & 0xFF, 32, 16, 1, 0,
- (play->gameplayFrames * 2) & 0xFF, 64, 32));
+ (play->gameplayFrames * 2) & 0xFF, 64, 32)); // check
gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_0193);
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL);
@@ -2834,10 +2855,10 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_0380, &this->unk_0458);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_3734[0], &this->unk_0464);
- if (this->unk_0190 == 0) {
+ if (!this->unk_0190) {
func_80B06F48(this, play);
}
- this->unk_0190 = 1;
+ this->unk_0190 = true;
if (this->actor.colorFilterTimer != 0) {
func_800AE5A0(play);
@@ -2867,9 +2888,9 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 D_80B0EB70[6] = { 1, 2, 3, 3, 2, 1 };
s32 D_80B0EB88[7] = { 2, 3, 4, 4, 4, 3, 2 };
s32 D_80B0EBA4[8] = { 2, 3, 4, 4, 4, 4, 3, 2 };
-s32 D_80B0EBC4[0xE] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
-s32 D_80B0EBFC[0xF] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 0xA, 0, 0xC, 0xD };
-u8 D_80B0EC38[0x18] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+s32 D_80B0EBC4[14] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
+s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 10, 0, 12, 13 };
+u8 D_80B0EC38[15] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3 };
void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
s32 index;
@@ -2885,7 +2906,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
Vec3f pos;
Vec3f startVec;
- for (i = 0; i < 15; i++) {
+ for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) {
if ((weight == 0.0f) || (y = D_80B0EBFC[i]) > BODYPART_NONE) {
bodyPartPos = &this->bodyPartsPos[i];
if (weight > 0.0f) {
@@ -2910,7 +2931,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
baseY = (u16)((s32)startVec.y * 64);
if (D_80B0EC38[i] == 2) {
- for (y = 0, addY = -0x180; y < 14; y++, addY += 0x40) {
+ for (y = 0, addY = -0x180; y < ARRAY_COUNT(D_80B0EBC4); y++, addY += 0x40) {
for (x = -D_80B0EBC4[y]; x < D_80B0EBC4[y]; x++) {
index = baseX + x + baseY + addY;
if ((index >= 0) && (index < 0x1000)) {
@@ -2919,7 +2940,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
}
}
} else if (D_80B0EC38[i] == 1) {
- for (y = 0, addY = -0x100; y < 8; y++, addY += 0x40) {
+ for (y = 0, addY = -0x100; y < ARRAY_COUNT(D_80B0EBA4); y++, addY += 0x40) {
for (x = -D_80B0EBA4[y]; x < D_80B0EBA4[y]; x++) {
index = baseX + x + baseY + addY;
if ((index >= 0) && (index < 0x1000)) {
@@ -2928,7 +2949,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
}
}
} else if (D_80B0EC38[i] == 0) {
- for (y = 0, addY = -0xC0; y < 7; y++, addY += 0x40) {
+ for (y = 0, addY = -0xC0; y < ARRAY_COUNT(D_80B0EB88); y++, addY += 0x40) {
for (x = -D_80B0EB88[y]; x < D_80B0EB88[y]; x++) {
index = baseX + x + baseY + addY;
if ((index >= 0) && (index < 0x1000)) {
@@ -2937,7 +2958,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
}
}
} else {
- for (y = 0, addY = -0x80; y < 6; y++, addY += 0x40) {
+ for (y = 0, addY = -0x80; y < ARRAY_COUNT(D_80B0EB70); y++, addY += 0x40) {
for (x = -D_80B0EB70[y]; x < D_80B0EB70[y]; x++) {
index = baseX + x + baseY + addY;
if ((index >= 0) && (index < 0x1000)) {
@@ -2975,7 +2996,7 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);
- alpha = (400.0f - this->actor.world.pos.y) * 0.0025f;
+ alpha = (400.0f - this->actor.world.pos.y) * (1.0f / 400.0f);
alpha = CLAMP_MIN(alpha, 0.0f);
alpha = CLAMP_MAX(alpha, 1.0f);
@@ -3003,8 +3024,8 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
void func_80B0D9CC(BossHakugin* this) {
s32 var_s3;
Vec3f spC8;
- s32 var_s1 = 0xF;
- BossHakuginEffect* var_s0 = this->unk_09F8;
+ s32 var_s1 = 15;
+ BossHakuginEffect* var_s0 = &this->unk_09F8[0];
s32 var_v1;
s32 temp_a0;
f32 spB4 = Math_SinS(this->actor.shape.rot.y) * 65.0f;
@@ -3018,9 +3039,9 @@ void func_80B0D9CC(BossHakugin* this) {
f32 pad;
for (var_s3 = 4; var_s3 > 0; var_s3--, var_s1 -= 4) {
- spC8.x = this->actor.world.pos.x - (var_s3 * spB4) + (2.3076923f * spB4);
+ spC8.x = this->actor.world.pos.x - (var_s3 * spB4) + (2.3076923f * spB4); // 30 / 13
spC8.y = this->actor.world.pos.y + (85.0f * (4 - var_s3)) + 20.0f;
- spC8.z = this->actor.world.pos.z - (var_s3 * spB0) + (2.3076923f * spB0);
+ spC8.z = this->actor.world.pos.z - (var_s3 * spB0) + (2.3076923f * spB0); // 30 / 13
var_s0->unk_24 = ((var_s3 * 4.5f) + 22.0f) * 0.001f;
Math_Vec3f_Copy(&var_s0->unk_0, &spC8);
@@ -3074,7 +3095,7 @@ void func_80B0DFA8(BossHakugin* this) {
BossHakuginEffect* effect;
ColliderJntSphElement* element;
- for (i = 0; i < 18; i++) {
+ for (i = 0; i < 36 / 2; i++) {
effect = &this->unk_09F8[i << 1];
element = &this->unk_0484.elements[i];
@@ -3083,16 +3104,16 @@ void func_80B0DFA8(BossHakugin* this) {
element->dim.worldSphere.center.z = effect->unk_0.z;
element->dim.worldSphere.radius = effect->unk_24 * 3000.0f;
element->info.bumper.dmgFlags = 0xF3CFBBFF;
- element->info.bumperFlags &= ~0x40;
+ element->info.bumperFlags &= ~BUMP_NO_HITMARK;
- element->info.elemType = 0;
+ element->info.elemType = ELEMTYPE_UNK0;
}
- for (; i < 19; i++) {
- this->unk_0484.elements[i].info.bumperFlags &= ~1;
- this->unk_0484.elements[i].info.ocElemFlags &= ~1;
+ for (; i < ARRAY_COUNT(this->unk_04A4); i++) {
+ this->unk_0484.elements[i].info.bumperFlags &= ~BUMP_ON;
+ this->unk_0484.elements[i].info.ocElemFlags &= ~OCELEM_ON;
}
- this->unk_0484.base.colType = 0xC;
+ this->unk_0484.base.colType = COLTYPE_HARD;
}
void func_80B0E548(Actor* thisx, PlayState* play2) {
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index bc03f14ca..3d9d80986 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -49,7 +49,6 @@ typedef struct BossHakugin {
/* 0x0194 */ u8 unk_0194;
/* 0x0194 */ u8 unk_0195;
/* 0x0196 */ u8 unk_0196;
- /* 0x0197 */ char unk_0197[0x1];
/* 0x0198 */ s16 unk_0198;
/* 0x019A */ s16 unk_019A;
/* 0x019C */ s16 unk_019C;
@@ -72,7 +71,7 @@ typedef struct BossHakugin {
/* 0x01CC */ f32 unk_01CC;
/* 0x01D0 */ f32 unk_01D0;
/* 0x01D4 */ f32 unk_01D4;
- /* 0x01D8 */ char unk_01D8[0x4];
+ /* 0x01D8 */ char unk_01D8[0x4]; // probably unused float
/* 0x01DC */ f32 unk_01DC;
/* 0x01E0 */ f32 unk_01E0;
/* 0x01E4 */ f32 unk_01E4;
@@ -88,7 +87,6 @@ typedef struct BossHakugin {
/* 0x0464 */ Vec3f unk_0464;
/* 0x0470 */ LightNode* lightNode;
/* 0x0474 */ LightInfo lightInfo;
- /* 0x0482 */ char unk_0482[0x2];
/* 0x0484 */ ColliderJntSph unk_0484;
/* 0x04A4 */ ColliderJntSphElement unk_04A4[19];
/* 0x0964 */ ColliderCylinder unk_0964;
From 92dd07e19bdf6d6c345b49f2721eefb7823606de Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 19 Oct 2023 07:03:35 -0700
Subject: [PATCH 46/51] func_80B0A8C4 OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 27 +++++++------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 108a25552..f8e948bdb 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -2035,15 +2035,13 @@ void func_80B0A87C(BossHakugin* this) {
this->actionFunc = func_80B0A8C4;
}
-#ifdef NON_MATCHING
typedef struct {
s32 unk_00;
u32 unk_04;
} BossHakuginStruct_B0A8C4;
+
static s32 D_80B0EB24[5] = { 0, 15, 26, 33, 36 };
-// static u32 D_80B0EB38[6][2] = {
-// { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
-// };
+
static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
{ 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
};
@@ -2058,16 +2056,15 @@ static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
// GOHT_LIMB_FLAG(GOHT_LIMB_PELVIS) | GOHT_LIMB_FLAG(GOHT_LIMB_THORAX) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_THIGH)
// | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_THIGH)},
// };
-// non-matchings seem to be caused by accesses to D_80B0EB38
void func_80B0A8C4(BossHakugin* this, PlayState* play) {
- EnBom* bomb = GOHT_LIMB_BACK_LEFT_HOOF;
+ EnBom* bomb;
Vec3s* test;
Camera* camera;
Vec3f eyeTarget;
s16 temp_s0;
s32 sp60;
s32 i;
- s32 pad;
+ BossHakuginStruct_B0A8C4* unkStruct;
camera = Play_GetCamera(play, this->unk_01AC);
SkelAnime_Update(&this->skelAnime);
@@ -2089,12 +2086,13 @@ void func_80B0A8C4(BossHakugin* this, PlayState* play) {
this->actor.draw = func_80B0E5A4;
this->actor.update = func_80B0E548;
} else if (((this->unk_019C % 6) == 0) && (sp60 < 6)) {
- test = &this->unk_0484.elements[D_80B0EB38[sp60].unk_00].dim.worldSphere.center;
+ unkStruct = &D_80B0EB38[sp60];
+ test = &this->unk_0484.elements[unkStruct->unk_00].dim.worldSphere.center;
bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, test->x, test->y, test->z, 1, 0, 0, 0);
if (bomb != NULL) {
bomb->timer = 0;
}
- this->unk_01B0 &= ~D_80B0EB38[sp60].unk_04;
+ this->unk_01B0 &= ~unkStruct->unk_04;
if (sp60 == 5) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC);
}
@@ -2114,19 +2112,12 @@ void func_80B0A8C4(BossHakugin* this, PlayState* play) {
Audio_PlaySfx_AtPos(&this->unk_0458, NA_SE_EN_LAST1_DEMO_BREAK);
}
}
- if (1) {} // TODO: probably fake
+ //! FAKE:
+ if (1) {}
}
this->unk_019C++;
}
-#else
-s32 D_80B0EB24[5] = { 0, 0xF, 0x1A, 0x21, 0x24 };
-s32 D_80B0EB38[6][2] = {
- { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
-};
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0A8C4.s")
-#endif
void func_80B0AC30(BossHakugin* this, PlayState* play) {
Player* player = GET_PLAYER(play);
From fdbbbf98a8a8e90ecef87b2228f9faae3f9dc6e0 Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Thu, 19 Oct 2023 12:09:01 -0700
Subject: [PATCH 47/51] func_80B0D9CC OK
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index f8e948bdb..e922cf5ca 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -3010,13 +3010,11 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
CLOSE_DISPS(gfxCtx);
}
-#ifdef NON_MATCHING
-// Saved float register alloc. Seems related to spB4.
void func_80B0D9CC(BossHakugin* this) {
s32 var_s3;
Vec3f spC8;
s32 var_s1 = 15;
- BossHakuginEffect* var_s0 = &this->unk_09F8[0];
+ BossHakuginEffect* var_s0 = this->unk_09F8;
s32 var_v1;
s32 temp_a0;
f32 spB4 = Math_SinS(this->actor.shape.rot.y) * 65.0f;
@@ -3027,12 +3025,15 @@ void func_80B0D9CC(BossHakugin* this) {
f32 temp3;
f32 temp4;
f32 temp5;
- f32 pad;
+ s32 pad;
for (var_s3 = 4; var_s3 > 0; var_s3--, var_s1 -= 4) {
- spC8.x = this->actor.world.pos.x - (var_s3 * spB4) + (2.3076923f * spB4); // 30 / 13
+ temp4 = (30.0f / 13.0f) * spB4;
+ temp5 = (30.0f / 13.0f) * spB0;
+
+ spC8.x = this->actor.world.pos.x - (var_s3 * spB4) + temp4;
spC8.y = this->actor.world.pos.y + (85.0f * (4 - var_s3)) + 20.0f;
- spC8.z = this->actor.world.pos.z - (var_s3 * spB0) + (2.3076923f * spB0); // 30 / 13
+ spC8.z = this->actor.world.pos.z - (var_s3 * spB0) + temp5;
var_s0->unk_24 = ((var_s3 * 4.5f) + 22.0f) * 0.001f;
Math_Vec3f_Copy(&var_s0->unk_0, &spC8);
@@ -3043,7 +3044,7 @@ void func_80B0D9CC(BossHakugin* this) {
}
var_s0++;
- temp1 = (var_s3 / (f32)temp_a0);
+ temp1 = var_s3 / (f32)temp_a0;
temp2 = (spB0 + spB4) * temp1;
temp3 = (spB0 - spB4) * temp1;
@@ -3077,9 +3078,6 @@ void func_80B0D9CC(BossHakugin* this) {
var_s0->unk_0.y += 850.0f;
}
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_Hakugin/func_80B0D9CC.s")
-#endif
void func_80B0DFA8(BossHakugin* this) {
s32 i;
From 747661a4fc65acb188ecbbcdce1c2853305b59c7 Mon Sep 17 00:00:00 2001
From: Tom Overton
Date: Thu, 19 Oct 2023 12:46:49 -0700
Subject: [PATCH 48/51] Use generated reloc for Goht + remove Goht's
undefined_syms
---
spec | 2 +-
undefined_syms.txt | 17 -----------------
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/spec b/spec
index fc11178da..b7b31a694 100644
--- a/spec
+++ b/spec
@@ -3519,7 +3519,7 @@ beginseg
name "ovl_Boss_Hakugin"
compress
include "build/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.o"
- include "build/data/ovl_Boss_Hakugin/ovl_Boss_Hakugin.reloc.o"
+ include "build/src/overlays/actors/ovl_Boss_Hakugin/ovl_Boss_Hakugin_reloc.o"
endseg
beginseg
diff --git a/undefined_syms.txt b/undefined_syms.txt
index 010f94c05..ab3b30447 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -316,23 +316,6 @@ D_06041B30 = 0x06041B30;
D_06042330 = 0x06042330;
D_06043330 = 0x06043330;
-// ovl_Boss_Hakugin
-
-D_06002054 = 0x06002054;
-D_0600319C = 0x0600319C;
-D_06010488 = 0x06010488;
-D_06010500 = 0x06010500;
-D_06011100 = 0x06011100;
-D_06011178 = 0x06011178;
-D_06011208 = 0x06011208;
-D_06011278 = 0x06011278;
-D_06012ED0 = 0x06012ED0;
-D_06012F40 = 0x06012F40;
-D_06013158 = 0x06013158;
-D_060134D0 = 0x060134D0;
-D_06013828 = 0x06013828;
-D_06014040 = 0x06014040;
-
// ovl_Dm_Tsg
D_06002D30 = 0x06002D30;
From e0fc8a614f3b5983cf7c03bbe331dd67ddc4463e Mon Sep 17 00:00:00 2001
From: Derek Hensley
Date: Sat, 21 Oct 2023 13:58:39 -0700
Subject: [PATCH 49/51] Bodyparts + other clean up
---
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 184 ++++++++++++------
.../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 25 ++-
tools/disasm/variables.txt | 6 +-
3 files changed, 153 insertions(+), 62 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index e922cf5ca..ced75a201 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -18,6 +18,7 @@
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((BossHakugin*)thisx)
+
#define GOHT_LIMB_FLAG(limbIndex) (1 << ((limbIndex)-1))
void BossHakugin_Init(Actor* thisx, PlayState* play2);
@@ -365,7 +366,7 @@ static ColliderCylinderInit sCylinderInit = {
{ 170, 40, 0, { 0, 0, 0 } },
};
-static DamageTable D_80B0EA60 = {
+static DamageTable sDamageTable = {
/* Deku Nut */ DMG_ENTRY(0, 0x0),
/* Deku Stick */ DMG_ENTRY(1, 0x0),
/* Horse trample */ DMG_ENTRY(1, 0x0),
@@ -400,24 +401,59 @@ static DamageTable D_80B0EA60 = {
/* Powder Keg */ DMG_ENTRY(1, 0xC),
};
-static CollisionCheckInfoInit D_80B0EA80 = { 30, 80, 100, MASS_IMMOVABLE };
+static CollisionCheckInfoInit sColChkInfoInit = { 30, 80, 100, MASS_IMMOVABLE };
TexturePtr D_80B0EA88 = gGohtMetalPlateWithCirclePatternTex;
-s8 D_80B0EA8C[] = { -1, -1, 0, -1, -1, -1, 3, -1, 4, 5, -1, 6, -1, 7, 8, 1, 2,
- -1, -1, -1, -1, 9, 10, -1, -1, 11, -1, -1, 12, 13, -1, -1, 14 };
+static s8 sLimbToBodyParts[GOHT_LIMB_MAX] = {
+ BODYPART_NONE, // GOHT_LIMB_NONE
+ BODYPART_NONE, // GOHT_LIMB_ROOT
+ GOHT_BODYPART_PELVIS, // GOHT_LIMB_PELVIS
+ BODYPART_NONE, // GOHT_LIMB_THORAX_ROOT
+ BODYPART_NONE, // GOHT_LIMB_THORAX_WRAPPER
+ BODYPART_NONE, // GOHT_LIMB_FRONT_RIGHT_LEG_ROOT
+ GOHT_BODYPART_FRONT_RIGHT_UPPER_LEG, // GOHT_LIMB_FRONT_RIGHT_UPPER_LEG
+ BODYPART_NONE, // GOHT_LIMB_FRONT_RIGHT_LOWER_LEG_ROOT
+ GOHT_BODYPART_FRONT_RIGHT_LOWER_LEG, // GOHT_LIMB_FRONT_RIGHT_LOWER_LEG
+ GOHT_BODYPART_FRONT_RIGHT_HOOF, // GOHT_LIMB_FRONT_RIGHT_HOOF
+ BODYPART_NONE, // GOHT_LIMB_FRONT_LEFT_LEG_ROOT
+ GOHT_BODYPART_FRONT_LEFT_UPPER_LEG, // GOHT_LIMB_FRONT_LEFT_UPPER_LEG
+ BODYPART_NONE, // GOHT_LIMB_FRONT_LEFT_LOWER_LEG_ROOT
+ GOHT_BODYPART_FRONT_LEFT_LOWER_LEG, // GOHT_LIMB_FRONT_LEFT_LOWER_LEG
+ GOHT_BODYPART_FRONT_LEFT_HOOF, // GOHT_LIMB_FRONT_LEFT_HOOF
+ GOHT_BODYPART_THORAX, // GOHT_LIMB_THORAX
+ GOHT_BODYPART_HEAD, // GOHT_LIMB_HEAD
+ BODYPART_NONE, // GOHT_LIMB_JAW_ROOT
+ BODYPART_NONE, // GOHT_LIMB_JAW
+ BODYPART_NONE, // GOHT_LIMB_BACK_RIGHT_LEG_ROOT
+ BODYPART_NONE, // GOHT_LIMB_BACK_RIGHT_LEG_WRAPPER
+ GOHT_BODYPART_BACK_RIGHT_THIGH, // GOHT_LIMB_BACK_RIGHT_THIGH
+ GOHT_BODYPART_BACK_RIGHT_SHIN, // GOHT_LIMB_BACK_RIGHT_SHIN
+ BODYPART_NONE, // GOHT_LIMB_BACK_RIGHT_PASTERN_ROOT
+ BODYPART_NONE, // GOHT_LIMB_BACK_RIGHT_PASTERN
+ GOHT_BODYPART_BACK_RIGHT_HOOF, // GOHT_LIMB_BACK_RIGHT_HOOF
+ BODYPART_NONE, // GOHT_LIMB_BACK_LEFT_LEG_ROOT
+ BODYPART_NONE, // GOHT_LIMB_BACK_LEFT_LEG_WRAPPER
+ GOHT_BODYPART_BACK_LEFT_THIGH, // GOHT_LIMB_BACK_LEFT_THIGH
+ GOHT_BODYPART_BACK_LEFT_SHIN, // GOHT_LIMB_BACK_LEFT_SHIN
+ BODYPART_NONE, // GOHT_LIMB_BACK_LEFT_PASTERN_ROOT
+ BODYPART_NONE, // GOHT_LIMB_BACK_LEFT_PASTERN
+ GOHT_BODYPART_BACK_LEFT_HOOF, // GOHT_LIMB_BACK_LEFT_HOOF
+};
+
s32 D_80B0EAB0[5] = {
GOHT_LIMB_BACK_LEFT_THIGH, GOHT_LIMB_BACK_RIGHT_PASTERN, GOHT_LIMB_JAW_ROOT,
GOHT_LIMB_FRONT_LEFT_LOWER_LEG, GOHT_LIMB_FRONT_RIGHT_UPPER_LEG,
};
+
Color_RGBA8 D_80B0EAC4 = { 250, 250, 250, 255 };
Color_RGBA8 D_80B0EAC8 = { 180, 180, 180, 255 };
Color_RGB8 D_80B0EACC = { 0, 150, 255 };
Color_RGB8 D_80B0EAD0 = { 0, 255, 255 };
void BossHakugin_Init(Actor* thisx, PlayState* play2) {
- static s32 D_80B0EAD4 = 0;
- static InitChainEntry D_80B0EAD8[] = {
+ static s32 sTextureDesegmented = false;
+ static InitChainEntry sInitChain[] = {
ICHAIN_S8(hintId, 27, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 27, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
@@ -429,11 +465,11 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
s32 pad;
s32 i;
- Actor_ProcessInitChain(&this->actor, D_80B0EAD8);
+ Actor_ProcessInitChain(&this->actor, sInitChain);
SkelAnime_InitFlex(play, &this->skelAnime, &gGohtSkel, &gGohtRunAnim, this->jointTable, this->morphTable,
GOHT_LIMB_MAX);
- if (!D_80B0EAD4) {
- D_80B0EAD4 = true;
+ if (!sTextureDesegmented) {
+ sTextureDesegmented = true;
D_80B0EA88 = Lib_SegmentedToVirtual(D_80B0EA88);
}
@@ -475,7 +511,7 @@ void BossHakugin_Init(Actor* thisx, PlayState* play2) {
this->unk_09F8[i].unk_18 = -1;
}
- CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B0EA60, &D_80B0EA80);
+ CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->unk_01A0 = this->actor.shape.rot.y;
this->unk_01B0 = 0xFFFFFFFF;
@@ -517,9 +553,8 @@ void BossHakugin_Destroy(Actor* thisx, PlayState* play) {
}
s32 func_80B0573C(Vec3f* arg0) {
- f32 magnitude;
+ f32 magnitude = Math3D_Vec3fMagnitude(arg0);
- magnitude = Math3D_Vec3fMagnitude(arg0);
if (magnitude < 0.0001f) {
return false;
}
@@ -531,10 +566,9 @@ s32 func_80B0573C(Vec3f* arg0) {
void func_80B057A4(Vec3f* arg0, Vec3f* arg1, f32 arg2) {
Vec3f sp34;
Vec3f sp28;
- f32 temp_fa0;
+ f32 temp_fa0 = (arg0->x * arg1->x) + (arg0->y * arg1->y) + (arg0->z * arg1->z);
f32 var_fv1;
- temp_fa0 = (arg0->x * arg1->x) + (arg0->y * arg1->y) + (arg0->z * arg1->z);
if (fabsf(temp_fa0) < 1.0f) {
var_fv1 = Math_FAcosF(temp_fa0);
} else if (temp_fa0 >= 1.0f) {
@@ -663,14 +697,13 @@ void func_80B05D4C(BossHakugin* this) {
}
void func_80B05EE0(BossHakugin* this, PlayState* play) {
- s16 atan;
+ s16 atan = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
Vec3f warpPos;
Vec3f heartPos;
f32 sp50;
f32 sin;
f32 cos;
- atan = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
if (atan > 0x4000) {
warpPos.x = 1400.0f;
warpPos.y = 0.0f;
@@ -947,13 +980,12 @@ void func_80B06F48(BossHakugin* this, PlayState* play) {
BossHakuginFhgFlashUnkStruct* iter2;
BossHakuginFhgFlashUnkStruct* iter3;
Vec3f spA0;
- s32 sp9C;
+ s32 sp9C = this->unk_0191 + 3;
s32 var_s4;
s32 i;
s32 j;
s32 pad;
- sp9C = this->unk_0191 + 3;
if (sp9C >= ARRAY_COUNT(this->unk_3158[0])) {
sp9C = 0;
}
@@ -1006,9 +1038,8 @@ void func_80B06F48(BossHakugin* this, PlayState* play) {
}
s32 func_80B0728C(BossHakugin* this) {
- s16 rand;
+ s16 rand = (Rand_Next() >> 0x12) + 0x4000;
- rand = ((Rand_Next() >> 0x12) + 0x4000);
this->unk_0198 += rand;
if (this->unk_01A8 == 5) {
if (Math_SmoothStepToS(&this->unk_01A6, -0x900, 4, 0x200, 0x80) == 0) {
@@ -1045,7 +1076,7 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_ICEB_FOOTSTEP_OLD);
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_FRONT_LEFT_HOOF]]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[sLimbToBodyParts[GOHT_LIMB_FRONT_LEFT_HOOF]]);
if (this->actor.xzDistToPlayer < 1500.0f) {
temp = (1500.0f - this->actor.xzDistToPlayer) * (1.0f / 1500.0f);
func_80B05A64(this, play, 17000, 6.5f * temp, 10);
@@ -1053,13 +1084,13 @@ void func_80B07450(BossHakugin* this, PlayState* play) {
func_80B06C08(this);
} else if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_BACK_LEFT_HOOF]]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[sLimbToBodyParts[GOHT_LIMB_BACK_LEFT_HOOF]]);
func_80B06B20(this, &pos);
} else if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_FRONT_RIGHT_HOOF]]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[sLimbToBodyParts[GOHT_LIMB_FRONT_RIGHT_HOOF]]);
func_80B06D38(this, play);
} else if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
- Math_Vec3f_Copy(&pos, &this->bodyPartsPos[D_80B0EA8C[GOHT_LIMB_BACK_RIGHT_HOOF]]);
+ Math_Vec3f_Copy(&pos, &this->bodyPartsPos[sLimbToBodyParts[GOHT_LIMB_BACK_RIGHT_HOOF]]);
func_80B06B20(this, &pos);
} else {
return;
@@ -1143,7 +1174,7 @@ void func_80B07B88(BossHakugin* this, PlayState* play) {
if (this->unk_0196 == 10) {
this->unk_0196 = 0;
this->unk_01E4 = 0.0f;
- Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 3, 0.7f, 0.5f);
+ Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, GOHT_BODYPART_MAX, 3, 0.7f, 0.5f);
}
}
@@ -2043,19 +2074,19 @@ typedef struct {
static s32 D_80B0EB24[5] = { 0, 15, 26, 33, 36 };
static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
- { 0, 0x28000 }, { 4, 0x1A0 }, { 7, 0x3400 }, { 0xE, 0xD0000000 }, { 0xA, 0x01A00000 }, { 1, 0x08104002 },
+ { 0, GOHT_LIMB_FLAG(GOHT_LIMB_HEAD) | GOHT_LIMB_FLAG(GOHT_LIMB_JAW) },
+ { 4, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_UPPER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_LOWER_LEG) |
+ GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_HOOF) },
+ { 7, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_UPPER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_LOWER_LEG) |
+ GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_HOOF) },
+ { 14, GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_SHIN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_PASTERN) |
+ GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_HOOF) },
+ { 10, GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_SHIN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_PASTERN) |
+ GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_HOOF) },
+ { 1, GOHT_LIMB_FLAG(GOHT_LIMB_PELVIS) | GOHT_LIMB_FLAG(GOHT_LIMB_THORAX) |
+ GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_THIGH) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_THIGH) },
};
-// static BossHakuginStruct_B0A8C4 D_80B0EB38[] = {
-// { 0, GOHT_LIMB_FLAG(GOHT_LIMB_HEAD) | GOHT_LIMB_FLAG(GOHT_LIMB_JAW) },
-// { 4, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_UPPER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_LOWER_LEG) |
-// GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_RIGHT_HOOF) }, { 7, GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_UPPER_LEG) |
-// GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_LOWER_LEG) | GOHT_LIMB_FLAG(GOHT_LIMB_FRONT_LEFT_HOOF)}, { 14,
-// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_SHIN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_PASTERN) |
-// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_HOOF)}, { 10, GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_SHIN) |
-// GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_PASTERN) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_HOOF)}, { 1,
-// GOHT_LIMB_FLAG(GOHT_LIMB_PELVIS) | GOHT_LIMB_FLAG(GOHT_LIMB_THORAX) | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_RIGHT_THIGH)
-// | GOHT_LIMB_FLAG(GOHT_LIMB_BACK_LEFT_THIGH)},
-// };
+
void func_80B0A8C4(BossHakugin* this, PlayState* play) {
EnBom* bomb;
Vec3s* test;
@@ -2314,6 +2345,7 @@ void func_80B0B548(BossHakugin* this, PlayState* play) {
if (unk_str->unk_14.base.atFlags & AT_HIT) {
Player* player = GET_PLAYER(play);
+
this->unk_018C = 1;
Player_PlaySfx(player, NA_SE_EN_COMMON_E_BALL_HIT);
unk_str->unk_14.base.atFlags &= ~AT_HIT;
@@ -2442,7 +2474,9 @@ void BossHakugin_Update(Actor* thisx, PlayState* play) {
Actor_OffsetOfPointInActorCoords(&this->actor, &this->unk_044C, &player->actor.world.pos);
this->actionFunc(this, play);
Actor_MoveWithGravity(&this->actor);
- Actor_UpdateBgCheckInfo(play, &this->actor, 450.0f, 89.100006f, 0.0f, 0x1D); // flags
+ Actor_UpdateBgCheckInfo(play, &this->actor, 450.0f, 89.100006f, 0.0f,
+ UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 |
+ UPDBGCHECKINFO_FLAG_10);
func_800BE3D0(&this->actor, this->actor.shape.rot.y, &sp70);
Math_ScaledStepToS(&this->actor.shape.rot.x, sp70.x, 0x100);
Math_ScaledStepToS(&this->actor.shape.rot.z, sp70.z, 0x100);
@@ -2535,7 +2569,7 @@ void BossHakugin_Update(Actor* thisx, PlayState* play) {
s32 BossHakugin_OverrideLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {
static s32 D_80B0EB68 = 4;
- static s32 D_80B0EB6C = 6;
+ static s32 D_80B0EB6C = GOHT_LIMB_FRONT_RIGHT_UPPER_LEG;
BossHakugin* this = THIS;
if (this->actionFunc == func_80B0A8C4) {
@@ -2579,7 +2613,7 @@ void BossHakugin_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s
s16 angle;
Collider_UpdateSpheres(limbIndex, &this->unk_0484);
- bodyPartIndex = D_80B0EA8C[limbIndex];
+ bodyPartIndex = sLimbToBodyParts[limbIndex];
if (bodyPartIndex > BODYPART_NONE) {
for (i = 0; i < ARRAY_COUNT(this->unk_04A4); i++) {
if (this->unk_0484.elements[i].dim.limb == limbIndex) {
@@ -2829,7 +2863,7 @@ void func_80B0CF24(BossHakugin* this, PlayState* play) {
void BossHakugin_Draw(Actor* thisx, PlayState* play) {
s32 pad;
BossHakugin* this = THIS;
- u8* tex = GRAPH_ALLOC(play->state.gfxCtx, sizeof(u8[64][64]));
+ u8* tex = GRAPH_ALLOC(play->state.gfxCtx, GOHT_SHADOW_TEX_SIZE);
OPEN_DISPS(play->state.gfxCtx);
@@ -2840,8 +2874,8 @@ void BossHakugin_Draw(Actor* thisx, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
- Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->unk_01DC,
- this->unk_01E0, this->unk_01E4, this->unk_0196);
+ Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, GOHT_BODYPART_MAX, this->unk_01DC, this->unk_01E0,
+ this->unk_01E4, this->unk_0196);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_0380, &this->unk_0458);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &this->unk_3734[0], &this->unk_0464);
@@ -2880,8 +2914,42 @@ s32 D_80B0EB70[6] = { 1, 2, 3, 3, 2, 1 };
s32 D_80B0EB88[7] = { 2, 3, 4, 4, 4, 3, 2 };
s32 D_80B0EBA4[8] = { 2, 3, 4, 4, 4, 4, 3, 2 };
s32 D_80B0EBC4[14] = { 2, 4, 5, 6, 7, 8, 8, 8, 8, 7, 6, 5, 4, 2 };
-s32 D_80B0EBFC[15] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 0, 9, 10, 0, 12, 13 };
-u8 D_80B0EC38[15] = { 1, 2, 1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3 };
+
+static s32 sParentShadowBodyParts[GOHT_BODYPART_MAX] = {
+ GOHT_BODYPART_THORAX, // GOHT_BODYPART_PELVIS
+ BODYPART_NONE, // GOHT_BODYPART_THORAX
+ GOHT_BODYPART_THORAX, // GOHT_BODYPART_HEAD
+ GOHT_BODYPART_THORAX, // GOHT_BODYPART_FRONT_RIGHT_UPPER_LEG
+ GOHT_BODYPART_FRONT_RIGHT_UPPER_LEG, // GOHT_BODYPART_FRONT_RIGHT_LOWER_LEG
+ GOHT_BODYPART_FRONT_RIGHT_LOWER_LEG, // GOHT_BODYPART_FRONT_RIGHT_HOOF
+ GOHT_BODYPART_THORAX, // GOHT_BODYPART_FRONT_LEFT_UPPER_LEG
+ GOHT_BODYPART_FRONT_LEFT_UPPER_LEG, // GOHT_BODYPART_FRONT_LEFT_LOWER_LEG
+ GOHT_BODYPART_FRONT_LEFT_LOWER_LEG, // GOHT_BODYPART_FRONT_LEFT_HOOF
+ GOHT_BODYPART_PELVIS, // GOHT_BODYPART_BACK_RIGHT_THIGH
+ GOHT_BODYPART_BACK_RIGHT_THIGH, // GOHT_BODYPART_BACK_RIGHT_SHIN
+ GOHT_BODYPART_BACK_RIGHT_SHIN, // GOHT_BODYPART_BACK_RIGHT_HOOF
+ GOHT_BODYPART_PELVIS, // GOHT_BODYPART_BACK_LEFT_THIGH
+ GOHT_BODYPART_BACK_LEFT_THIGH, // GOHT_BODYPART_BACK_LEFT_SHIN
+ GOHT_BODYPART_BACK_LEFT_SHIN // GOHT_BODYPART_BACK_LEFT_HOOF
+};
+
+static u8 sShadowSizes[GOHT_BODYPART_MAX] = {
+ 1, // GOHT_BODYPART_PELVIS
+ 2, // GOHT_BODYPART_THORAX
+ 1, // GOHT_BODYPART_HEAD
+ 0, // GOHT_BODYPART_FRONT_RIGHT_UPPER_LEG
+ 3, // GOHT_BODYPART_FRONT_RIGHT_LOWER_LEG
+ 3, // GOHT_BODYPART_FRONT_RIGHT_HOOF
+ 0, // GOHT_BODYPART_FRONT_LEFT_UPPER_LEG
+ 3, // GOHT_BODYPART_FRONT_LEFT_LOWER_LEG
+ 3, // GOHT_BODYPART_FRONT_LEFT_HOOF
+ 0, // GOHT_BODYPART_BACK_RIGHT_THIGH
+ 3, // GOHT_BODYPART_BACK_RIGHT_SHIN
+ 3, // GOHT_BODYPART_BACK_RIGHT_HOOF
+ 0, // GOHT_BODYPART_BACK_LEFT_THIGH
+ 3, // GOHT_BODYPART_BACK_LEFT_SHIN
+ 3 // GOHT_BODYPART_BACK_LEFT_HOOF
+};
void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
s32 index;
@@ -2890,15 +2958,15 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
s32 baseY;
s32 addY;
s32 x;
- s32 y = -1;
+ s32 y = BODYPART_NONE;
Vec3f lerp;
Vec3f* parentBodyPartPos;
Vec3f* bodyPartPos;
Vec3f pos;
Vec3f startVec;
- for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) {
- if ((weight == 0.0f) || (y = D_80B0EBFC[i]) > BODYPART_NONE) {
+ for (i = 0; i < GOHT_BODYPART_MAX; i++) {
+ if ((weight == 0.0f) || (y = sParentShadowBodyParts[i]) > BODYPART_NONE) {
bodyPartPos = &this->bodyPartsPos[i];
if (weight > 0.0f) {
parentBodyPartPos = &this->bodyPartsPos[y];
@@ -2921,29 +2989,29 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
baseX = (u16)(s32)(startVec.x + 32.0f);
baseY = (u16)((s32)startVec.y * 64);
- if (D_80B0EC38[i] == 2) {
+ if (sShadowSizes[i] == 2) {
for (y = 0, addY = -0x180; y < ARRAY_COUNT(D_80B0EBC4); y++, addY += 0x40) {
for (x = -D_80B0EBC4[y]; x < D_80B0EBC4[y]; x++) {
index = baseX + x + baseY + addY;
- if ((index >= 0) && (index < 0x1000)) {
+ if ((index >= 0) && (index < GOHT_SHADOW_TEX_SIZE)) {
tex[index] = 255;
}
}
}
- } else if (D_80B0EC38[i] == 1) {
+ } else if (sShadowSizes[i] == 1) {
for (y = 0, addY = -0x100; y < ARRAY_COUNT(D_80B0EBA4); y++, addY += 0x40) {
for (x = -D_80B0EBA4[y]; x < D_80B0EBA4[y]; x++) {
index = baseX + x + baseY + addY;
- if ((index >= 0) && (index < 0x1000)) {
+ if ((index >= 0) && (index < GOHT_SHADOW_TEX_SIZE)) {
tex[index] = 255;
}
}
}
- } else if (D_80B0EC38[i] == 0) {
+ } else if (sShadowSizes[i] == 0) {
for (y = 0, addY = -0xC0; y < ARRAY_COUNT(D_80B0EB88); y++, addY += 0x40) {
for (x = -D_80B0EB88[y]; x < D_80B0EB88[y]; x++) {
index = baseX + x + baseY + addY;
- if ((index >= 0) && (index < 0x1000)) {
+ if ((index >= 0) && (index < GOHT_SHADOW_TEX_SIZE)) {
tex[index] = 255;
}
}
@@ -2952,7 +3020,7 @@ void BossHakugin_FillShadowTex(BossHakugin* this, u8* tex, f32 weight) {
for (y = 0, addY = -0x80; y < ARRAY_COUNT(D_80B0EB70); y++, addY += 0x40) {
for (x = -D_80B0EB70[y]; x < D_80B0EB70[y]; x++) {
index = baseX + x + baseY + addY;
- if ((index >= 0) && (index < 0x1000)) {
+ if ((index >= 0) && (index < GOHT_SHADOW_TEX_SIZE)) {
tex[index] = 255;
}
}
@@ -2966,7 +3034,7 @@ void BossHakugin_GenShadowTex(u8* tex, BossHakugin* this) {
s32* iter = (s32*)tex;
s16 i;
- for (i = 0; i < (s32)((sizeof(u8[64][64])) / sizeof(s32)); i++, iter++) {
+ for (i = 0; i < (s32)(GOHT_SHADOW_TEX_SIZE / sizeof(s32)); i++, iter++) {
*iter = 0;
}
@@ -3003,8 +3071,8 @@ void BossHakugin_DrawShadowTex(u8* tex, BossHakugin* this, PlayState* play) {
Matrix_Scale(4.25f, 1.0f, 4.25f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gShadowMaterialDL);
- gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP,
- G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
+ gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, GOHT_SHADOW_TEX_WIDTH, GOHT_SHADOW_TEX_HEIGHT, 0,
+ G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
gSPDisplayList(POLY_OPA_DISP++, gShadowModelDL);
CLOSE_DISPS(gfxCtx);
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index 3d9d80986..cd38dc044 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -6,6 +6,10 @@
struct BossHakugin;
+#define GOHT_SHADOW_TEX_WIDTH 64
+#define GOHT_SHADOW_TEX_HEIGHT 64
+#define GOHT_SHADOW_TEX_SIZE ((s32)sizeof(u8[GOHT_SHADOW_TEX_HEIGHT][GOHT_SHADOW_TEX_WIDTH]))
+
typedef void (*BossHakuginActionFunc)(struct BossHakugin*, PlayState*);
typedef struct BossHakuginEffect {
@@ -34,6 +38,25 @@ typedef struct BossHakuginFhgFlashUnkStruct {
/* 0x12 */ s16 unk_12;
} BossHakuginFhgFlashUnkStruct; // size = 0x14
+typedef enum GohtBodyPart {
+ /* 0 */ GOHT_BODYPART_PELVIS,
+ /* 1 */ GOHT_BODYPART_THORAX,
+ /* 2 */ GOHT_BODYPART_HEAD,
+ /* 3 */ GOHT_BODYPART_FRONT_RIGHT_UPPER_LEG,
+ /* 4 */ GOHT_BODYPART_FRONT_RIGHT_LOWER_LEG,
+ /* 5 */ GOHT_BODYPART_FRONT_RIGHT_HOOF,
+ /* 6 */ GOHT_BODYPART_FRONT_LEFT_UPPER_LEG,
+ /* 7 */ GOHT_BODYPART_FRONT_LEFT_LOWER_LEG,
+ /* 8 */ GOHT_BODYPART_FRONT_LEFT_HOOF,
+ /* 9 */ GOHT_BODYPART_BACK_RIGHT_THIGH,
+ /* 10 */ GOHT_BODYPART_BACK_RIGHT_SHIN,
+ /* 11 */ GOHT_BODYPART_BACK_RIGHT_HOOF,
+ /* 12 */ GOHT_BODYPART_BACK_LEFT_THIGH,
+ /* 13 */ GOHT_BODYPART_BACK_LEFT_SHIN,
+ /* 14 */ GOHT_BODYPART_BACK_LEFT_HOOF,
+ /* 15 */ GOHT_BODYPART_MAX
+} GohtBodyPart;
+
typedef struct BossHakugin {
/* 0x0000 */ Actor actor;
/* 0x0144 */ SkelAnime skelAnime;
@@ -81,7 +104,7 @@ typedef struct BossHakugin {
/* 0x037A */ Vec3s unk_037A;
/* 0x0380 */ Vec3f unk_0380;
/* 0x038C */ Vec3f unk_038C;
- /* 0x0398 */ Vec3f bodyPartsPos[15];
+ /* 0x0398 */ Vec3f bodyPartsPos[GOHT_BODYPART_MAX];
/* 0x044C */ Vec3f unk_044C;
/* 0x0458 */ Vec3f unk_0458;
/* 0x0464 */ Vec3f unk_0464;
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index 1711af990..b59c0be52 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -13444,7 +13444,7 @@
0x80B0EA60:("D_80B0EA60","UNK_TYPE1","",0x1),
0x80B0EA80:("D_80B0EA80","UNK_TYPE1","",0x1),
0x80B0EA88:("D_80B0EA88","UNK_TYPE4","",0x4),
- 0x80B0EA8C:("D_80B0EA8C","s8","[]", 0x20),
+ 0x80B0EA8C:("sLimbToBodyParts","s8","[]", 0x20),
0x80B0EAAC:("D_80B0EAAC","UNK_TYPE1","",0x1),
0x80B0EAB0:("D_80B0EAB0","UNK_TYPE1","",0x1),
0x80B0EAC4:("D_80B0EAC4","UNK_TYPE1","",0x1),
@@ -13467,8 +13467,8 @@
0x80B0EB88:("D_80B0EB88","UNK_TYPE4","",0x4),
0x80B0EBA4:("D_80B0EBA4","UNK_TYPE4","",0x4),
0x80B0EBC4:("D_80B0EBC4","UNK_TYPE4","",0x4),
- 0x80B0EBFC:("D_80B0EBFC","UNK_TYPE4","",0x4),
- 0x80B0EC38:("D_80B0EC38","UNK_TYPE1","",0x1),
+ 0x80B0EBFC:("sParentShadowBodyParts","UNK_TYPE4","",0x4),
+ 0x80B0EC38:("sShadowSizes","UNK_TYPE1","",0x1),
0x80B0EC50:("D_80B0EC50","f32","",0x4),
0x80B0EC54:("D_80B0EC54","f32","",0x4),
0x80B0EC58:("D_80B0EC58","f32","",0x4),
From 051d788351fca7ba76a281b96a1cbbd358d993b5 Mon Sep 17 00:00:00 2001
From: RevoSucks
Date: Mon, 30 Oct 2023 21:56:48 -0400
Subject: [PATCH 50/51] ovl_Boss_Hakugin
---
src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index a09bd1204..070c09b56 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -1244,7 +1244,7 @@ void func_80B07EEC(BossHakugin* this, PlayState* play) {
Play_SetCameraAtEye(play, this->unk_01AC, &sp20, &this->unk_038C);
this->unk_037A.x = Math_Atan2S_XY(70.0f, -20.0f);
this->unk_037A.y = player->actor.shape.rot.y + 0x8000;
- func_800B7298(play, &this->actor, PLAYER_CSMODE_21);
+ func_800B7298(play, &this->actor, PLAYER_CSACTION_21);
this->unk_019C = 0;
this->actionFunc = func_80B08018;
}
@@ -1388,7 +1388,7 @@ void func_80B08550(BossHakugin* this, PlayState* play) {
player->actor.world.pos.z = -1560.0f;
player->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000;
player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y;
- func_800B7298(play, &this->actor, PLAYER_CSMODE_131);
+ func_800B7298(play, &this->actor, PLAYER_CSACTION_131);
this->actionFunc = func_80B0863C;
}
@@ -1460,7 +1460,7 @@ void func_80B08848(BossHakugin* this, PlayState* play) {
Animation_Change(&this->skelAnime, &gGohtRunAnim, 1.5f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f);
this->unk_019C = 0;
this->actor.speed = 5.0f;
- func_800B7298(play, &this->actor, PLAYER_CSMODE_END);
+ func_800B7298(play, &this->actor, PLAYER_CSACTION_END);
player->stateFlags1 |= PLAYER_STATE1_20;
play->actorCtx.unk268 = true;
this->actionFunc = func_80B08960;
@@ -1754,7 +1754,7 @@ void func_80B098BC(BossHakugin* this, PlayState* play) {
}
} else {
if (Math_ScaledStepToS(&this->unk_01A6, -0x800, 0x1C0)) {
- player->actionVar2 = 100;
+ player->av2.actionVar2 = 100;
player->actor.parent = NULL;
player->invincibilityTimer = 0;
player->actor.shape.rot.x = 0;
@@ -1762,7 +1762,7 @@ void func_80B098BC(BossHakugin* this, PlayState* play) {
player->actor.world.pos.y += 30.0f;
this->unk_019C--;
} else {
- player->actionVar2 = 0;
+ player->av2.actionVar2 = 0;
sp32 = -this->unk_0374.z + 0x1F40;
player->actor.shape.rot.x = -this->unk_0374.z + 0x8FC0;
From 3ca1b5cbdca19b25db65ce919a30d1dc955e258b Mon Sep 17 00:00:00 2001
From: RevoSucks
Date: Mon, 30 Oct 2023 23:18:41 -0400
Subject: [PATCH 51/51] ovl_En_Wdhand
---
src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
index 03df6c0d9..aa1ed5f10 100644
--- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
+++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c
@@ -433,7 +433,7 @@ void func_80AF520C(EnWdhand* this, PlayState* play) {
SkelAnime_Update(&this->unk144);
this->unk1EC[0].z--;
- player->unk_AE8 = 0;
+ player->av2.actionVar2 = 0;
for (var_s1 = 0; var_s1 < 4; var_s1++) {
if (this->unk1EC[0].z < 0x4C) {
@@ -488,7 +488,7 @@ void func_80AF520C(EnWdhand* this, PlayState* play) {
Matrix_MultVecY(1000.0f, &player->actor.world.pos);
if ((this->unk1EC[0].z == 4) && (&this->actor == player->actor.parent)) {
- player->unk_AE8 = 100;
+ player->av2.actionVar2 = 100;
player->actor.parent = NULL;
Matrix_Transpose(&this->unk21C);
player->actor.shape.rot.x = 0;
@@ -651,7 +651,7 @@ void func_80AF5E3C(EnWdhand* this, PlayState* play) {
Actor_SetDropFlagJntSph(&this->actor, &this->unk274);
Enemy_StartFinishingBlow(play, &this->actor);
if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) {
- player->unk_AE8 = 100;
+ player->av2.actionVar2 = 100;
player->actor.parent = NULL;
player->actor.shape.rot.x = 0;
player->actor.shape.rot.z = 0;
@@ -701,7 +701,7 @@ void EnWdhand_Draw(Actor* thisx, PlayState* play) {
dl = POLY_OPA_DISP;
- gSPDisplayList(&dl[0], &gSetupDLs[25 * 6]);
+ gSPDisplayList(&dl[0], &gSetupDLs[25]); // same problem as ovl_En_Knight. TODO: This may be an issue
gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[2], object_wdhand_DL_0014C0);