From 698e6969e30e249984d8d5dccbe993a9ec1aaf50 Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Sat, 3 Oct 2020 00:22:41 -0700 Subject: [PATCH] Match some interesting stuff --- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 117 ++++++++++++++++++++++-- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 12 ++- undefined_syms.txt | 4 + 3 files changed, 122 insertions(+), 11 deletions(-) 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 aec8aa41b7..f28d350119 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -33,10 +33,15 @@ void func_80A774F8(EnIk* this, GlobalContext* globalCtx); void func_80A77ED0(EnIk* this, GlobalContext* globalCtx); void func_80A77EDC(EnIk* this, GlobalContext* globalCtx); +void func_80A7510C(EnIk* this, GlobalContext* globalCtx); void func_80A745E4(EnIk* this, GlobalContext* globalCtx); void func_80A74AAC(EnIk* this); void func_80A74E2C(EnIk* this); +void func_80A74EBC(EnIk* this, GlobalContext* globalCtx); +void func_80A7506C(EnIk* this); void func_80A751C8(EnIk* this); +void func_80A75260(EnIk* this, GlobalContext* globalCtx); +void func_80A753D0(EnIk* this); void func_80A77148(EnIk* this); void func_80A77158(EnIk* this, GlobalContext* globalCtx); void func_80A771E4(EnIk* this); @@ -54,6 +59,10 @@ void EnIk_PostLimbDraw1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve extern UNK_TYPE D_02003F80; extern AnimationHeader D_0600C114; extern AnimationHeader D_0600DD50; +extern AnimationHeader D_06001C28; +extern AnimationHeader D_06002538; +extern AnimationHeader D_060029FC; +extern AnimationHeader D_060033C4; extern SkeletonHeader D_0601E178; extern AnimationHeader D_060203D8; extern SkeletonHeader D_060205C0; @@ -271,17 +280,111 @@ void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A74BA4.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A74E2C.s") +void func_80A74E2C(EnIk* this) { + f32 frames = SkelAnime_GetFrameCount(&D_06001C28.genericHeader); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A74EBC.s") + this->unk_2FF = 1; + this->unk_2F8 = 6; + this->actor.speedXZ = 0.0f; + SkelAnime_ChangeAnim(&this->skelAnime, &D_06001C28, 1.5f, 0.0f, frames, 2, -4.0f); + EnIk_SetupAction(this, func_80A74EBC); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7506C.s") +void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) { + Vec3f sp2C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7510C.s") + if (this->skelAnime.animCurrentFrame == 15.0f) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + } else if (this->skelAnime.animCurrentFrame == 21.0f) { + sp2C.x = this->actor.posRot.pos.x + Math_Sins(this->actor.shape.rot.y + 0x6A4) * 70.0f; + sp2C.z = this->actor.posRot.pos.z + Math_Coss(this->actor.shape.rot.y + 0x6A4) * 70.0f; + sp2C.y = this->actor.posRot.pos.y; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); + func_8005AA1C(&globalCtx->mainCamera, 2, 0x19, 5); + func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96); + func_80062CD4(globalCtx, &sp2C); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A751C8.s") + if ((17.0f < this->skelAnime.animCurrentFrame) && (this->skelAnime.animCurrentFrame < 23.0f)) { + this->unk_2FE = 1; + } else { + if ((this->unk_2FB != 0) && (this->skelAnime.animCurrentFrame < 10.0f)) { + Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1, 0x5DC, 0); + this->actor.shape.rot.y = this->actor.posRot.rot.y; + } + this->unk_2FE = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A75260.s") + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_80A7506C(this); + } +} + +void func_80A7506C(EnIk* this) { + f32 frames = SkelAnime_GetFrameCount(&D_060029FC.genericHeader); + + this->unk_2FE = 0; + this->unk_2F9 = (s8)frames; + this->unk_2F8 = 7; + this->unk_2FF = this->unk_2FE; + SkelAnime_ChangeAnim(&this->skelAnime, &D_060029FC, 1.0f, 0.0f, frames, 0, -4.0f); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_PULLOUT); + EnIk_SetupAction(this, func_80A7510C); +} + +void func_80A7510C(EnIk* this, GlobalContext* globalCtx) { + f32 frames; + + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) || (--this->unk_2F9 == 0)) { + if (this->unk_2F8 == 8) { + func_80A7489C(this); + } else { + frames = SkelAnime_GetFrameCount(&D_06002538.genericHeader); + this->unk_2F8 = 8; + SkelAnime_ChangeAnim(&this->skelAnime, &D_06002538, 1.5f, 0.0f, frames, 3, -4.0f); + } + } +} + +void func_80A751C8(EnIk* this) { + f32 frames = SkelAnime_GetFrameCount(&D_060033C4.genericHeader); + + this->unk_2FF = 2; + this->unk_300 = 0; + this->unk_2F8 = 6; + this->actor.speedXZ = 0.0f; + SkelAnime_ChangeAnim(&this->skelAnime, &D_060033C4, 0.0f, 0.0f, frames, 3, -6.0f); + this->unk_2FC = 0; + EnIk_SetupAction(this, func_80A75260); +} + +void func_80A75260(EnIk* this, GlobalContext* globalCtx) { + f32 temp_f0; + + this->unk_300 += 0x1C2; + temp_f0 = Math_Sins(this->unk_300); + this->skelAnime.animPlaybackSpeed = ABS(temp_f0); + + if (this->skelAnime.animCurrentFrame > 11.0f) { + this->unk_2FF = 3; + } + if (((1.0f < this->skelAnime.animCurrentFrame) && (this->skelAnime.animCurrentFrame < 9.0f)) || + ((13.0f < this->skelAnime.animCurrentFrame) && (this->skelAnime.animCurrentFrame < 18.0f))) { + if ((this->unk_2FC == 0) && (this->unk_2FB != 0) && (this->skelAnime.animCurrentFrame < 10.0f)) { + Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1, 0x5DC, 0); + this->actor.shape.rot.y = this->actor.posRot.rot.y; + } + if (this->unk_2FE < 0) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + } + this->unk_2FE = 1; + } else { + this->unk_2FE = 0; + } + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_80A753D0(this); + } +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A753D0.s") @@ -413,7 +516,7 @@ void func_80A772EC(EnIk* this, GlobalContext* globalCtx) { void func_80A7735C(EnIk* this, GlobalContext* globalCtx) { s32 pad[3]; - f32 frames = (f32)SkelAnime_GetFrameCount(&D_060203D8.genericHeader); + f32 frames = SkelAnime_GetFrameCount(&D_060203D8.genericHeader); SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060205C0, NULL, this->limbDrawTable, this->transitionDrawTable, 30); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index dfb1d59ae0..20d684a3e4 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -13,11 +13,15 @@ typedef struct EnIk { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ Vec3s limbDrawTable[30]; /* 0x0244 */ Vec3s transitionDrawTable[30]; - /* 0x02F8 */ s8 unk_2F8; - /* 0x02F9 */ char unk_2F9[0x02]; + /* 0x02F8 */ u8 unk_2F8; + /* 0x02F9 */ u8 unk_2F9; + /* 0x02F9 */ char unk_2FA[0x01]; /* 0x02FB */ u8 unk_2FB; - /* 0x02FC */ s8 unk_2FC; - /* 0x02FD */ char unk_2FD[0x05]; + /* 0x02FC */ u8 unk_2FC; + /* 0x02FD */ char unk_2FD[0x01]; + /* 0x02FE */ s8 unk_2FE; + /* 0x02FD */ s8 unk_2FF; + /* 0x0300 */ s16 unk_300; /* 0x0302 */ s16 switchFlags; /* 0x0304 */ EnIkActionFunc actionFunc; /* 0x0308 */ char unk_308[0x18]; diff --git a/undefined_syms.txt b/undefined_syms.txt index 974cb06d49..753e34ff89 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1112,6 +1112,10 @@ D_06000A60 = 0x06000A60; D_02003F80 = 0x02003F80; D_0600C114 = 0x0600C114; D_0600DD50 = 0x0600DD50; +D_06001C28 = 0x06001C28; +D_06002538 = 0x06002538; +D_060029FC = 0x060029FC; +D_060033C4 = 0x060033C4; D_0601E178 = 0x0601E178; D_060203D8 = 0x060203D8; D_060205C0 = 0x060205C0;