From 597bd27f5b4ea4768c8d7f85dcaaf902383d768c Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Fri, 6 Jun 2025 12:17:11 -0400 Subject: [PATCH] Child Ruto Part 7: Limb draw functions (#2575) * Child Ruto Part 7: Limb draw functions * Add comment * Rename vectors, remove comment * Rename again --- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 25 ++++++++++++----------- src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 850d1177e3..575755d445 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -84,7 +84,7 @@ void func_80AEFC24(EnRu1* this, PlayState* play); void func_80AEFECC(EnRu1* this, PlayState* play); void func_80AEFF40(EnRu1* this, PlayState* play); -void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot); +void EnRu1_PreLimbDraw(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot); void EnRu1_DrawNothing(EnRu1* this, PlayState* play); void EnRu1_DrawOpa(EnRu1* this, PlayState* play); @@ -164,7 +164,7 @@ static EnRu1ActionFunc sActionFuncs[] = { }; static EnRu1PreLimbDrawFunc sPreLimbDrawFuncs[] = { - func_80AF0278, + EnRu1_PreLimbDraw, }; static Vec3f sMultVec = { 0.0f, 10.0f, 0.0f }; @@ -2343,7 +2343,7 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { } } -void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) { +void EnRu1_PreLimbDraw(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) { Vec3s* torsoRot = &this->interactInfo.torsoRot; Vec3s* headRot = &this->interactInfo.headRot; @@ -2363,11 +2363,12 @@ s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; - if ((this->unk_290 < 0) || (this->unk_290 > 0) || (*sPreLimbDrawFuncs[this->unk_290] == NULL)) { + if ((this->preLimbDrawIndex < 0) || (this->preLimbDrawIndex > 0) || + (*sPreLimbDrawFuncs[this->preLimbDrawIndex] == NULL)) { PRINTF(VT_FGCOL(RED) T("首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "Neck rotation mode is improper!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { - sPreLimbDrawFuncs[this->unk_290](this, play, limbIndex, rot); + sPreLimbDrawFuncs[this->preLimbDrawIndex](this, play, limbIndex, rot); } return false; } @@ -2376,14 +2377,14 @@ void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnRu1* this = (EnRu1*)thisx; if (limbIndex == RUTO_CHILD_HEAD) { - Vec3f vec1; - Vec3f vec2; + Vec3f multVec; + Vec3f focusPos; - vec1 = sMultVec; - Matrix_MultVec3f(&vec1, &vec2); - this->actor.focus.pos.x = vec2.x; - this->actor.focus.pos.y = vec2.y; - this->actor.focus.pos.z = vec2.z; + multVec = sMultVec; + Matrix_MultVec3f(&multVec, &focusPos); + this->actor.focus.pos.x = focusPos.x; + this->actor.focus.pos.y = focusPos.y; + this->actor.focus.pos.z = focusPos.z; this->actor.focus.rot.x = this->actor.world.rot.x; this->actor.focus.rot.y = this->actor.world.rot.y; this->actor.focus.rot.z = this->actor.world.rot.z; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h index b4faf8d3f4..6968b6fb0d 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -37,7 +37,7 @@ typedef struct EnRu1 { /* 0x0286 */ s8 roomNum3; /* 0x0288 */ f32 unk_288; /* 0x028C */ BgBdanObjects* bigOctoPlatform; - /* 0x0290 */ s32 unk_290; + /* 0x0290 */ s32 preLimbDrawIndex; /* 0x0294 */ char unk_294[0x4]; /* 0x0298 */ s32 unk_298; /* 0x029C */ char unk_29C[0x2];