From 6802960a77965f037cde6fba0564ff94c8ad6abc Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Wed, 30 Sep 2020 23:39:36 -0700 Subject: [PATCH] Progress --- .../{func_80A7709C.s => EnIk_GetNpcAction.s} | 2 +- .../overlays/actors/ovl_En_Ik/func_80A770C0.s | 2 +- .../overlays/actors/ovl_En_Ik/func_80A77264.s | 2 +- .../overlays/actors/ovl_En_Ik/func_80A774F8.s | 2 +- .../overlays/actors/ovl_En_Ik/func_80A779DC.s | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 50 +++++++++++++++++-- undefined_syms.txt | 3 ++ 7 files changed, 54 insertions(+), 9 deletions(-) rename asm/non_matchings/overlays/actors/ovl_En_Ik/{func_80A7709C.s => EnIk_GetNpcAction.s} (96%) diff --git a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7709C.s b/asm/non_matchings/overlays/actors/ovl_En_Ik/EnIk_GetNpcAction.s similarity index 96% rename from asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7709C.s rename to asm/non_matchings/overlays/actors/ovl_En_Ik/EnIk_GetNpcAction.s index 3a94592a6d..b733b10cfa 100644 --- a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7709C.s +++ b/asm/non_matchings/overlays/actors/ovl_En_Ik/EnIk_GetNpcAction.s @@ -1,4 +1,4 @@ -glabel func_80A7709C +glabel EnIk_GetNpcAction /* 02D8C 80A7709C 908E1D6C */ lbu $t6, 0x1D6C($a0) ## 00001D6C /* 02D90 80A770A0 00057880 */ sll $t7, $a1, 2 /* 02D94 80A770A4 008FC021 */ addu $t8, $a0, $t7 diff --git a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A770C0.s b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A770C0.s index 4ad5c97426..9386508fed 100644 --- a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A770C0.s +++ b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A770C0.s @@ -5,7 +5,7 @@ glabel func_80A770C0 /* 02DBC 80A770CC AFA5001C */ sw $a1, 0x001C($sp) /* 02DC0 80A770D0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 /* 02DC4 80A770D4 00C02825 */ or $a1, $a2, $zero ## $a1 = 00000000 -/* 02DC8 80A770D8 0C29DC27 */ jal func_80A7709C +/* 02DC8 80A770D8 0C29DC27 */ jal EnIk_GetNpcAction /* 02DCC 80A770DC AFA70018 */ sw $a3, 0x0018($sp) /* 02DD0 80A770E0 10400013 */ beq $v0, $zero, .L80A77130 /* 02DD4 80A770E4 8FA70018 */ lw $a3, 0x0018($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77264.s b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77264.s index 14309dc34e..13f4f23541 100644 --- a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77264.s +++ b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77264.s @@ -5,7 +5,7 @@ glabel func_80A77264 /* 02F60 80A77270 10C00008 */ beq $a2, $zero, .L80A77294 /* 02F64 80A77274 AFA5001C */ sw $a1, 0x001C($sp) /* 02F68 80A77278 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 02F6C 80A7727C 0C29DC27 */ jal func_80A7709C +/* 02F6C 80A7727C 0C29DC27 */ jal EnIk_GetNpcAction /* 02F70 80A77280 24050004 */ addiu $a1, $zero, 0x0004 ## $a1 = 00000004 /* 02F74 80A77284 10400003 */ beq $v0, $zero, .L80A77294 /* 02F78 80A77288 8FA40018 */ lw $a0, 0x0018($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A774F8.s b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A774F8.s index e9c67eca7c..fadbe43786 100644 --- a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A774F8.s +++ b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A774F8.s @@ -3,7 +3,7 @@ glabel func_80A774F8 /* 031EC 80A774FC AFA40018 */ sw $a0, 0x0018($sp) /* 031F0 80A77500 AFBF0014 */ sw $ra, 0x0014($sp) /* 031F4 80A77504 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 031F8 80A77508 0C29DC27 */ jal func_80A7709C +/* 031F8 80A77508 0C29DC27 */ jal EnIk_GetNpcAction /* 031FC 80A7750C 24050004 */ addiu $a1, $zero, 0x0004 ## $a1 = 00000004 /* 03200 80A77510 54400004 */ bnel $v0, $zero, .L80A77524 /* 03204 80A77514 8FBF0014 */ lw $ra, 0x0014($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A779DC.s b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A779DC.s index af0072cedb..1a8b870944 100644 --- a/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A779DC.s +++ b/asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A779DC.s @@ -22,7 +22,7 @@ glabel func_80A779DC /* 036DC 80A779EC 00A03025 */ or $a2, $a1, $zero ## $a2 = 00000000 /* 036E0 80A779F0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 /* 036E4 80A779F4 24050004 */ addiu $a1, $zero, 0x0004 ## $a1 = 00000004 -/* 036E8 80A779F8 0C29DC27 */ jal func_80A7709C +/* 036E8 80A779F8 0C29DC27 */ jal EnIk_GetNpcAction /* 036EC 80A779FC AFA6002C */ sw $a2, 0x002C($sp) /* 036F0 80A77A00 10400035 */ beq $v0, $zero, .L80A77AD8 /* 036F4 80A77A04 8FA6002C */ lw $a2, 0x002C($sp) 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 a647a805f0..fe86a74c9b 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -47,9 +47,12 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve s32 EnIk_OverrideLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor); void EnIk_PostLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor); +extern UNK_TYPE D_02003F80; extern AnimationHeader D_0600C114; extern AnimationHeader D_0600DD50; extern SkeletonHeader D_0601E178; +extern AnimationHeader D_060203D8; +extern SkeletonHeader D_060205C0; static ColliderCylinderInit sCylinderInit = { { COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x20, COLSHAPE_CYLINDER }, @@ -325,9 +328,24 @@ void EnIk_StartMusic(void) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7707C.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7709C.s") +CsCmdActorAction* EnIk_GetNpcAction(GlobalContext* globalCtx, s32 actionIdx) { + if (globalCtx->csCtx.state != 0) { + return globalCtx->csCtx.npcActions[actionIdx]; + } else { + return NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A770C0.s") +void func_80A770C0(EnIk* this, GlobalContext* globalCtx, s32 actionIdx) { + CsCmdActorAction* npcAction = EnIk_GetNpcAction(globalCtx, actionIdx); + + if (npcAction != NULL) { + this->actor.posRot.pos.x = npcAction->startPos.x; + this->actor.posRot.pos.y = npcAction->startPos.y; + this->actor.posRot.pos.z = npcAction->startPos.z; + this->actor.posRot.rot.y = this->actor.shape.rot.y = npcAction->rot.y; + } +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77140.s") @@ -350,7 +368,19 @@ void func_80A772EC(EnIk* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_IRONNACK_DEAD, &D_80A78FA0, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A7735C.s") +void func_80A7735C(EnIk* this, GlobalContext* globalCtx) { + s32 pad[3]; + f32 frames = (f32)SkelAnime_GetFrameCount(&D_060203D8.genericHeader); + + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060205C0, NULL, this->limbDrawTable, this->transitionDrawTable, + 30); + SkelAnime_ChangeAnim(&this->skelAnime, &D_060203D8, 1.0f, 0.0f, frames, 2, 0.0f); + this->action = 3; + this->drawMode = 2; + func_80A770C0(this, globalCtx, 4); + func_80A772EC(this, globalCtx); + this->actor.shape.unk_14 = 0xFF; +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A77434.s") @@ -462,7 +492,19 @@ void func_80A78160(EnIk* this, GlobalContext* globalCtx) { func_80A7489C(this); } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A781CC.s") +void func_80A781CC(Actor* thisx, GlobalContext* globalCtx) { + EnIk* this = THIS; + + if (!Gameplay_InCsMode(globalCtx)) { + this->actor.update = EnIk_Update; + this->actor.draw = EnIk_Draw; + Cutscene_SetSegment(globalCtx, &D_02003F80); + gSaveContext.cutsceneTrigger = 1; + Actor_SetScale(&this->actor, 0.01f); + gSaveContext.eventChkInf[3] |= 0x1000; + func_80A7735C(this, globalCtx); + } +} void EnIk_Init(Actor* thisx, GlobalContext* globalCtx) { EnIk* this = THIS; diff --git a/undefined_syms.txt b/undefined_syms.txt index 8d4cfbdc8c..974cb06d49 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1109,9 +1109,12 @@ D_060009D0 = 0x060009D0; D_06000A60 = 0x06000A60; // z_en_ik +D_02003F80 = 0x02003F80; D_0600C114 = 0x0600C114; D_0600DD50 = 0x0600DD50; D_0601E178 = 0x0601E178; +D_060203D8 = 0x060203D8; +D_060205C0 = 0x060205C0; // z_en_insect D_04035590 = 0x04035590;