From 2ae64683a5344393670df46ba49e89c0a99ad51c Mon Sep 17 00:00:00 2001 From: Lauri Koskela Date: Mon, 19 Dec 2022 02:11:16 +0200 Subject: [PATCH] Clean up NPC player interaction usages (#1458) * Clean up player tracking related things in NPCs * Cleanup Npc_UpdateTalking usages and related things * Reformat * Minor fixes based on review comments * Remove unneeded declarations * More consistent function names --- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 6 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 10 +- .../ovl_En_Diving_Game/z_en_diving_game.h | 4 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 20 ++-- src/overlays/actors/ovl_En_Go/z_en_go.c | 113 ++++++++---------- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 46 ++++--- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 4 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 14 +-- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 12 +- .../actors/ovl_En_Heishi4/z_en_heishi4.h | 4 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 44 +++---- src/overlays/actors/ovl_En_Hy/z_en_hy.h | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 88 +++++++------- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 30 ++--- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 84 +++++++------ src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 47 ++++---- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 33 +++-- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 35 +++--- src/overlays/actors/ovl_En_Md/z_en_md.c | 32 ++--- src/overlays/actors/ovl_En_Mu/z_en_mu.c | 11 +- src/overlays/actors/ovl_En_Mu/z_en_mu.h | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 18 +-- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 16 +-- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.h | 4 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 12 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.h | 4 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 60 +++++----- src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 33 ++--- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 32 ++--- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 28 ++--- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 24 ++-- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 30 ++--- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 28 ++--- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 30 ++--- 34 files changed, 472 insertions(+), 488 deletions(-) diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 5db7bc0a55..9879cbe95d 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -179,14 +179,14 @@ void func_80984DB8(DemoIm* this) { void func_80984E58(DemoIm* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 yawDiff; - s16 npcTrackingMode; + s16 trackingMode; this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = kREG(16) + 4.0f; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - npcTrackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; - Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, npcTrackingMode); + trackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, trackingMode); } void func_80984F10(DemoIm* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 46e099d022..dda38cb599 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -523,8 +523,8 @@ void EnDivingGame_Update(Actor* thisx, PlayState* play2) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos.y = player->actor.world.pos.y; Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); - this->vec_284 = this->interactInfo.headRot; - this->vec_28A = this->interactInfo.torsoRot; + this->headRot = this->interactInfo.headRot; + this->torsoRot = this->interactInfo.torsoRot; if ((play->gameplayFrames % 16) == 0) { pos = this->actor.world.pos; pos.y += 20.0f; @@ -550,12 +550,12 @@ s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V s32 pad; if (limbIndex == 6) { - rot->x += this->vec_28A.y; + rot->x += this->torsoRot.y; } if (limbIndex == 15) { - rot->x += this->vec_284.y; - rot->z += this->vec_284.z; + rot->x += this->headRot.y; + rot->z += this->headRot.z; } if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index d88217b5f7..177111b16b 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -14,8 +14,8 @@ typedef struct EnDivingGame { /* 0x0190 */ Vec3s jointTable[20]; /* 0x0208 */ Vec3s morphTable[20]; /* 0x0280 */ EnDivingGameActionFunc actionFunc; - /* 0x0284 */ Vec3s vec_284; - /* 0x028A */ Vec3s vec_28A; + /* 0x0284 */ Vec3s headRot; + /* 0x028A */ Vec3s torsoRot; /* 0x0290 */ s16 unk_290; // counter that only goes up /* 0x0292 */ s16 unk_292; /* 0x0294 */ s16 subCamTimer; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index b0a68f2c80..403deeec3f 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -98,7 +98,7 @@ void EnDu_SetupAction(EnDu* this, EnDuActionFunc actionFunc) { this->actionFunc = actionFunc; } -u16 func_809FDC38(PlayState* play, Actor* actor) { +u16 EnDu_GetTextId(PlayState* play, Actor* actor) { u16 reaction = Text_GetFaceReaction(play, 0x21); if (reaction != 0) { @@ -118,7 +118,7 @@ u16 func_809FDC38(PlayState* play, Actor* actor) { } } -s16 func_809FDCDC(PlayState* play, Actor* actor) { +s16 EnDu_UpdateTalkState(PlayState* play, Actor* actor) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: @@ -561,26 +561,26 @@ void EnDu_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_809FE4A4) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 116.0f, - func_809FDC38, func_809FDCDC); + EnDu_GetTextId, EnDu_UpdateTalkState); } this->actionFunc(this, play); } s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnDu* this = (EnDu*)thisx; - Vec3s sp1C; + Vec3s limbRot; if (limbIndex == 16) { Matrix_Translate(2400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp1C = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-2400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8) { - sp1C = this->interactInfo.torsoRot; - Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } return 0; } 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 94facaac4f..ef15112a18 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -196,7 +196,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { - s16 unkState = NPC_TALK_STATE_TALKING; + s16 talkState = NPC_TALK_STATE_TALKING; f32 xzRange; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f; @@ -207,51 +207,51 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { switch (thisx->textId) { case 0x3008: SET_INFTABLE(INFTABLE_E0); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x300B: SET_INFTABLE(INFTABLE_EB); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3014: SET_INFTABLE(INFTABLE_F0); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3016: SET_INFTABLE(INFTABLE_F4); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3018: SET_INFTABLE(INFTABLE_F8); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3036: Actor_OfferGetItem(thisx, play, GI_TUNIC_GORON, xzRange, yRange); SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x3037: SET_INFTABLE(INFTABLE_10E); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3041: SET_INFTABLE(INFTABLE_10F); - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x3059: - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x3052: case 0x3054: case 0x3055: case 0x305A: - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x305E: - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; default: - unkState = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; } break; @@ -269,7 +269,7 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { thisx->textId = 0x300D; } Message_ContinueTextbox(play, thisx->textId); - unkState = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; break; case 0x3034: if (play->msgCtx.choiceIndex == 0) { @@ -284,16 +284,16 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { thisx->textId = 0x3033; } Message_ContinueTextbox(play, thisx->textId); - unkState = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; break; case 0x3054: case 0x3055: if (play->msgCtx.choiceIndex == 0) { - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } else { thisx->textId = 0x3056; Message_ContinueTextbox(play, thisx->textId); - unkState = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; } SET_INFTABLE(INFTABLE_B4); break; @@ -310,17 +310,17 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { case 0x3033: thisx->textId = 0x3034; Message_ContinueTextbox(play, thisx->textId); - unkState = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; break; default: - unkState = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; } } break; case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - unkState = NPC_TALK_STATE_ITEM_GIVEN; + talkState = NPC_TALK_STATE_ITEM_GIVEN; } break; case TEXT_STATE_NONE: @@ -330,21 +330,21 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return unkState; + return talkState; } -s32 func_80A3ED24(PlayState* play, EnGo* this, NpcInteractInfo* interactInfo, f32 arg3, NpcGetTextIdFunc getTextId, - NpcUpdateTalkStateFunc updateTalkState) { - if (interactInfo->talkState != NPC_TALK_STATE_IDLE) { - interactInfo->talkState = updateTalkState(play, &this->actor); +s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, + NpcUpdateTalkStateFunc updateTalkState) { + if (*talkState != NPC_TALK_STATE_IDLE) { + *talkState = updateTalkState(play, thisx); return false; - } else if (Actor_ProcessTalkRequest(&this->actor, play)) { - interactInfo->talkState = NPC_TALK_STATE_TALKING; + } else if (Actor_ProcessTalkRequest(thisx, play)) { + *talkState = NPC_TALK_STATE_TALKING; return true; - } else if (!func_8002F2CC(&this->actor, play, arg3)) { + } else if (!func_8002F2CC(thisx, play, interactRange)) { return false; } else { - this->actor.textId = getTextId(play, &this->actor); + thisx->textId = getTextId(play, thisx); return false; } } @@ -377,7 +377,7 @@ s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { } } -f32 EnGo_GetGoronSize(EnGo* this) { +f32 EnGo_GetPlayerTrackingYOffset(EnGo* this) { switch (this->actor.params & 0xF0) { case 0x00: return 10.0f; @@ -396,16 +396,16 @@ f32 EnGo_GetGoronSize(EnGo* this) { void func_80A3F060(EnGo* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 npcTrackingMode; + s16 trackingMode; if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && this->actionFunc != func_80A40B1C) { - npcTrackingMode = NPC_TRACKING_NONE; + trackingMode = NPC_TRACKING_NONE; } this->interactInfo.trackPos = player->actor.world.pos; - this->interactInfo.yOffset = EnGo_GetGoronSize(this); - Npc_TrackPoint(&this->actor, &this->interactInfo, 4, npcTrackingMode); + this->interactInfo.yOffset = EnGo_GetPlayerTrackingYOffset(this); + Npc_TrackPoint(&this->actor, &this->interactInfo, 4, trackingMode); } void func_80A3F0E4(EnGo* this) { @@ -571,29 +571,29 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { void func_80A3F908(EnGo* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 float1; - s32 isUnkCondition; + f32 interactRange; + s32 dialogStarted; if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == EnGo_Eyedrops || this->actionFunc == func_80A40DCC || this->actionFunc == EnGo_GetItem || this->actionFunc == func_80A40C78 || this->actionFunc == func_80A40B1C) { - float1 = (this->collider.dim.radius + 30.0f); - float1 *= (this->actor.scale.x / 0.01f); + interactRange = (this->collider.dim.radius + 30.0f); + interactRange *= (this->actor.scale.x / 0.01f); if ((this->actor.params & 0xF0) == 0x90) { - float1 *= 4.8f; + interactRange *= 4.8f; } if ((this->actor.params & 0xF0) == 0x90) { - isUnkCondition = - func_80A3ED24(play, this, &this->interactInfo, float1, EnGo_GetTextID, EnGo_UpdateTalkState); - } else { - isUnkCondition = Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, float1, + dialogStarted = EnGo_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange, EnGo_GetTextID, EnGo_UpdateTalkState); + } else { + dialogStarted = Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange, + EnGo_GetTextID, EnGo_UpdateTalkState); } - if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) { + if (((this->actor.params & 0xF0) == 0x90) && (dialogStarted == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { @@ -1081,32 +1081,25 @@ void EnGo_DrawRolling(EnGo* this, PlayState* play) { s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; - Vec3s vec1; - f32 float1; + Vec3s limbRot; if (limb == 17) { Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec1 = this->interactInfo.headRot; - float1 = BINANG_TO_RAD_ALT(vec1.y); - Matrix_RotateX(float1, MTXMODE_APPLY); - float1 = BINANG_TO_RAD_ALT(vec1.x); - Matrix_RotateZ(float1, MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limb == 10) { - vec1 = this->interactInfo.torsoRot; - float1 = BINANG_TO_RAD_ALT(vec1.y); - Matrix_RotateY(float1, MTXMODE_APPLY); - float1 = BINANG_TO_RAD_ALT(vec1.x); - Matrix_RotateX(float1, MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limb == 10) || (limb == 11) || (limb == 14)) { - float1 = Math_SinS(this->jointTable[limb]); - rot->y += float1 * 200.0f; - float1 = Math_CosS(this->morphTable[limb]); - rot->z += float1 * 200.0f; + rot->y += Math_SinS(this->jointTable[limb]) * 200.0f; + rot->z += Math_CosS(this->morphTable[limb]) * 200.0f; } return 0; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a982b70aae..d52e18e5b8 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -121,7 +121,7 @@ static EnGo2DataStruct2 D_80A481F8[14] = { { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, }; -static f32 D_80A482D8[14][2] = { +static f32 sPlayerTrackingYOffsets[14][2] = { { 80.0f, 80.0f }, { -10.0f, -10.0f }, { 800.0f, 800.0f }, { 0.0f, 0.0f }, { 20.0f, 40.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, @@ -819,8 +819,8 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { s32 func_80A44790(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) { - return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unk_218, EnGo2_GetTextId, - EnGo2_UpdateTalkState); + return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, + EnGo2_GetTextId, EnGo2_UpdateTalkState); } else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; @@ -831,7 +831,7 @@ s32 func_80A44790(EnGo2* this, PlayState* play) { } else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->interactInfo.talkState = EnGo2_UpdateTalkState(play, &this->actor); return false; - } else if (func_8002F2CC(&this->actor, play, this->unk_218)) { + } else if (func_8002F2CC(&this->actor, play, this->interactRange)) { this->actor.textId = EnGo2_GetTextId(play, &this->actor); } return false; @@ -851,8 +851,8 @@ void EnGo2_SetShape(EnGo2* this) { this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10; Actor_SetScale(&this->actor, D_80A481F8[index].scale); this->actor.targetMode = D_80A481F8[index].actor_unk_1F; - this->unk_218 = D_80A481F8[index].unk_218; - this->unk_218 += this->collider.dim.radius; + this->interactRange = D_80A481F8[index].interactRange; + this->interactRange += this->collider.dim.radius; } void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { @@ -1091,7 +1091,8 @@ void func_80A45288(EnGo2* this, PlayState* play) { if (this->actionFunc != EnGo2_GoronFireGenericAction) { this->interactInfo.trackPos = player->actor.world.pos; - this->interactInfo.yOffset = D_80A482D8[this->actor.params & 0x1F][((void)0, gSaveContext.linkAge)]; + this->interactInfo.yOffset = + sPlayerTrackingYOffsets[this->actor.params & 0x1F][((void)0, gSaveContext.linkAge)]; Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode); } if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { @@ -1899,7 +1900,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3s D_80A4854C = { 0x00, 0x00, 0x00 }; + Vec3s zeroVec = { 0x00, 0x00, 0x00 }; switch (this->goronState) { case 0: // Wake up @@ -1914,8 +1915,8 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { this->animTimer = 60; this->actor.gravity = 0.0f; this->actor.speedXZ = 2.0f; - this->interactInfo.headRot = D_80A4854C; - this->interactInfo.torsoRot = D_80A4854C; + this->interactInfo.headRot = zeroVec; + this->interactInfo.torsoRot = zeroVec; this->goronState++; this->goronState++; player->actor.world.rot.y = this->actor.world.rot.y; @@ -2023,30 +2024,23 @@ s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; - Vec3s vec1; - f32 float1; + Vec3s limbRot; if (limb == 17) { Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec1 = this->interactInfo.headRot; - float1 = BINANG_TO_RAD_ALT(vec1.y); - Matrix_RotateX(float1, MTXMODE_APPLY); - float1 = BINANG_TO_RAD_ALT(vec1.x); - Matrix_RotateZ(float1, MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limb == 10) { - vec1 = this->interactInfo.torsoRot; - float1 = BINANG_TO_RAD_ALT(vec1.y); - Matrix_RotateY(float1, MTXMODE_APPLY); - float1 = BINANG_TO_RAD_ALT(vec1.x); - Matrix_RotateX(float1, MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limb == 10) || (limb == 11) || (limb == 14)) { - float1 = Math_SinS(this->unk_226[limb]); - rot->y += float1 * 200.0f; - float1 = Math_CosS(this->unk_24A[limb]); - rot->z += float1 * 200.0f; + rot->y += Math_SinS(this->unk_226[limb]) * 200.0f; + rot->z += Math_CosS(this->unk_24A[limb]) * 200.0f; } return 0; } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 0ee441ab09..e152841366 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -53,7 +53,7 @@ typedef struct { f32 shape_unk_10; f32 scale; s8 actor_unk_1F; - f32 unk_218; + f32 interactRange; } EnGo2DataStruct2; // size = 0x10 typedef struct { @@ -88,7 +88,7 @@ typedef struct EnGo2 { /* 0x0214 */ u8 eyeTexIndex; /* 0x0215 */ u8 mouthTexIndex; /* 0x0216 */ u8 unk_216; // Set to z rotation, checked by waypoint - /* 0x0218 */ f32 unk_218; + /* 0x0218 */ f32 interactRange; /* 0x021C */ char unk_21C[0x04]; /* 0x0220 */ f32 alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f /* 0x0224 */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 9a66656f1b..4ebf845e31 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -181,23 +181,23 @@ Gfx* func_80A50708(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGuest* this = (EnGuest*)thisx; - Vec3s sp3C; + Vec3s limbRot; OPEN_DISPS(play->state.gfxCtx, "../z_en_guest.c", 352); if (limbIndex == 15) { *dList = object_boj_DL_0059B0; Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp3C = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp3C.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8) { - sp3C = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(-sp3C.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index f05de5b6e0..851d4f9fd3 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -262,7 +262,7 @@ void func_80A56900(EnHeishi4* this, PlayState* play) { void func_80A56994(EnHeishi4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(play, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_6C); @@ -352,8 +352,8 @@ void EnHeishi4_Update(Actor* thisx, PlayState* play) { this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f; } Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); - this->unk_260 = this->interactInfo.headRot; - this->unk_266 = this->interactInfo.torsoRot; + this->headRot = this->interactInfo.headRot; + this->torsoRot = this->interactInfo.torsoRot; } this->unk_27E += 1; this->actionFunc(this, play); @@ -369,11 +369,11 @@ s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f EnHeishi4* this = (EnHeishi4*)thisx; if (limbIndex == 9) { - rot->x += this->unk_266.y; + rot->x += this->torsoRot.y; } if (limbIndex == 16) { - rot->x += this->unk_260.y; - rot->z += this->unk_260.z; + rot->x += this->headRot.y; + rot->z += this->headRot.z; } return false; } diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 44889af87b..2c3677adca 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -21,8 +21,8 @@ typedef struct EnHeishi4 { /* 0x0190 */ Vec3s jointTable[17]; /* 0x01F6 */ Vec3s morphTable[17]; /* 0x025C */ EnHeishi4ActionFunc actionFunc; - /* 0x0260 */ Vec3s unk_260; - /* 0x0266 */ Vec3s unk_266; + /* 0x0260 */ Vec3s headRot; + /* 0x0266 */ Vec3s torsoRot; /* 0x026C */ Vec3f pos; /* 0x0278 */ f32 height; /* 0x027C */ s16 unk_27C; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 38cd4fdbec..01d53d222a 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -290,12 +290,12 @@ static EnHyColliderInfo sColliderInfo[] = { }; typedef struct { - /* 0x00 */ u8 unkPresetIndex; - /* 0x04 */ f32 unkValueChild; - /* 0x08 */ f32 unkValueAdult; -} EnHyInit1Info; // size = 0xC + /* 0x00 */ u8 presetIndex; + /* 0x04 */ f32 childYOffset; + /* 0x08 */ f32 adultYOffset; +} EnHyPlayerTrackingInfo; // size = 0xC -static EnHyInit1Info sInit1Info[] = { +static EnHyPlayerTrackingInfo sPlayerTrackingInfo[] = { /* ENHY_TYPE_AOB */ { 0x06, 20.0f, 10.0f }, /* ENHY_TYPE_COB */ { 0x06, 20.0f, 10.0f }, /* ENHY_TYPE_AHG_2 */ { 0x07, 40.0f, 20.0f }, @@ -324,7 +324,7 @@ typedef struct { /* 0x04 */ Vec3f modelOffset; /* 0x10 */ f32 scale; /* 0x14 */ s8 targetMode; - /* 0x18 */ f32 unkRange; + /* 0x18 */ f32 interactRange; } EnHyInit2Info; // size = 0x1C static EnHyInit2Info sInit2Info[] = { @@ -414,7 +414,7 @@ void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) { fabsf(this->actor.yDistToPlayer) + 1.0f); } -u16 func_80A6F810(PlayState* play, Actor* thisx) { +u16 EnHy_GetTextId(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); EnHy* this = (EnHy*)thisx; u16 textId = Text_GetFaceReaction(play, (this->actor.params & 0x7F) + 37); @@ -552,7 +552,7 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) { } } -s16 func_80A70058(PlayState* play, Actor* thisx) { +s16 EnHy_UpdateTalkState(PlayState* play, Actor* thisx) { EnHy* this = (EnHy*)thisx; s16 beggarItems[] = { ITEM_BOTTLE_BLUE_FIRE, ITEM_BOTTLE_FISH, ITEM_BOTTLE_BUG, ITEM_BOTTLE_FAIRY }; s16 beggarRewards[] = { 150, 100, 50, 25 }; @@ -702,8 +702,8 @@ void EnHy_InitSetProperties(EnHy* this) { Actor_SetScale(&this->actor, sInit2Info[type].scale); this->actor.targetMode = sInit2Info[type].targetMode; this->modelOffset = sInit2Info[type].modelOffset; - this->unkRange = sInit2Info[type].unkRange; - this->unkRange += this->collider.dim.radius; + this->interactRange = sInit2Info[type].interactRange; + this->interactRange += this->collider.dim.radius; } void EnHy_UpdateCollider(EnHy* this, PlayState* play) { @@ -792,16 +792,16 @@ void func_80A70978(EnHy* this, PlayState* play) { this->interactInfo.trackPos = player->actor.world.pos; if (LINK_IS_ADULT) { - this->interactInfo.yOffset = sInit1Info[this->actor.params & 0x7F].unkValueAdult; + this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].adultYOffset; } else { - this->interactInfo.yOffset = sInit1Info[this->actor.params & 0x7F].unkValueChild; + this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].childYOffset; } - Npc_TrackPoint(&this->actor, &this->interactInfo, sInit1Info[this->actor.params & 0x7F].unkPresetIndex, + Npc_TrackPoint(&this->actor, &this->interactInfo, sPlayerTrackingInfo[this->actor.params & 0x7F].presetIndex, trackingMode); - if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unkRange, func_80A6F810, - func_80A70058)) { + if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnHy_GetTextId, + EnHy_UpdateTalkState)) { func_80A70834(this, play); } } @@ -1101,7 +1101,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) { s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnHy* this = (EnHy*)thisx; s32 pad; - Vec3s sp48; + Vec3s limbRot; u8 i; void* ptr; @@ -1125,16 +1125,16 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == 15) { Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp48 = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp48.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8) { - sp48 = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(-sp48.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) { diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index 41f1ea8f3d..086a4bf2e0 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -53,7 +53,7 @@ typedef struct EnHy { /* 0x021A */ s16 nextEyeIndexTimer; /* 0x021C */ s16 unk_21C[16]; // bodyWiggleY ? /* 0x023C */ s16 unk_23C[16]; // bodyWiggleZ ? - /* 0x025C */ f32 unkRange; + /* 0x025C */ f32 interactRange; /* 0x0260 */ s32 unkGetItemId; /* 0x0264 */ Vec3f modelOffset; /* 0x0270 */ Vec3s jointTable[16]; 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 a09d71d1a8..8ce6516218 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -109,7 +109,7 @@ static Gfx* sAdultEraDLs[] = { gIngoAdultEraMustacheDL, }; -u16 func_80A78FB0(PlayState* play) { +u16 EnIn_GetTextIdChild(PlayState* play) { if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { if (GET_INFTABLE(INFTABLE_97)) { return 0x2046; @@ -124,12 +124,12 @@ u16 func_80A78FB0(PlayState* play) { } } -u16 func_80A79010(PlayState* play) { +u16 EnIn_GetTextIdAdult(PlayState* play) { Player* player = GET_PLAYER(play); - u16 temp_v0 = Text_GetFaceReaction(play, 25); + u16 faceReaction = Text_GetFaceReaction(play, 25); - if (temp_v0 != 0) { - return temp_v0; + if (faceReaction != 0) { + return faceReaction; } if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { if (IS_DAY) { @@ -177,40 +177,40 @@ u16 func_80A79010(PlayState* play) { } } -u16 func_80A79168(PlayState* play, Actor* thisx) { - u16 temp_v0 = Text_GetFaceReaction(play, 25); +u16 EnIn_GetTextId(PlayState* play, Actor* thisx) { + u16 faceReaction = Text_GetFaceReaction(play, 25); - if (temp_v0 != 0) { - return temp_v0; + if (faceReaction != 0) { + return faceReaction; } if (!LINK_IS_ADULT) { - return func_80A78FB0(play); + return EnIn_GetTextIdChild(play); } else { - return func_80A79010(play); + return EnIn_GetTextIdAdult(play); } } -s16 func_80A791CC(PlayState* play, Actor* thisx) { - s32 ret = NPC_TALK_STATE_IDLE; +s16 EnIn_UpdateTalkStateOnClosing(PlayState* play, Actor* thisx) { + s32 talkState = NPC_TALK_STATE_IDLE; switch (thisx->textId) { case 0x2045: SET_INFTABLE(INFTABLE_97); break; case 0x203E: - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x203F: SET_EVENTCHKINF(EVENTCHKINF_11); SET_INFTABLE(INFTABLE_94); break; } - return ret; + return talkState; } -s16 func_80A7924C(PlayState* play, Actor* thisx) { +s16 EnIn_UpdateTalkStateOnChoice(PlayState* play, Actor* thisx) { EnIn* this = (EnIn*)thisx; - s32 sp18 = NPC_TALK_STATE_TALKING; + s32 talkState = NPC_TALK_STATE_TALKING; switch (this->actor.textId) { case 0x2030: @@ -237,7 +237,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) { case 0x2036: case 0x2037: if (play->msgCtx.choiceIndex == 1) { - sp18 = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } else { this->actor.textId = 0x201F; Message_ContinueTextbox(play, this->actor.textId); @@ -245,7 +245,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) { break; case 0x2038: if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { - sp18 = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } else { this->actor.textId = 0x2039; Message_ContinueTextbox(play, this->actor.textId); @@ -254,7 +254,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) { break; case 0x205B: if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { - sp18 = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } else { Message_ContinueTextbox(play, this->actor.textId = 0x2039); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); @@ -266,24 +266,24 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) { } if (!gSaveContext.rupees) {} - return sp18; + return talkState; } -s16 func_80A7949C(PlayState* play, Actor* thisx) { - s32 phi_v1 = NPC_TALK_STATE_TALKING; +s16 EnIn_UpdateTalkStateOnEvent(PlayState* play, Actor* thisx) { + s32 talkState = NPC_TALK_STATE_TALKING; if (thisx->textId == 0x2035) { Rupees_ChangeBy(-10); thisx->textId = 0x205C; Message_ContinueTextbox(play, thisx->textId); } else { - phi_v1 = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } - return phi_v1; + return talkState; } -s16 func_80A79500(PlayState* play, Actor* thisx) { - s16 sp1E = NPC_TALK_STATE_TALKING; +s16 EnIn_UpdateTalkState(PlayState* play, Actor* thisx) { + s16 talkState = NPC_TALK_STATE_TALKING; osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId); switch (Message_GetState(&play->msgCtx)) { @@ -291,18 +291,18 @@ s16 func_80A79500(PlayState* play, Actor* thisx) { case TEXT_STATE_DONE_HAS_NEXT: break; case TEXT_STATE_CLOSING: - sp1E = func_80A791CC(play, thisx); + talkState = EnIn_UpdateTalkStateOnClosing(play, thisx); break; case TEXT_STATE_DONE_FADING: break; case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { - sp1E = func_80A7924C(play, thisx); + talkState = EnIn_UpdateTalkStateOnChoice(play, thisx); } break; case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { - sp1E = func_80A7949C(play, thisx); + talkState = EnIn_UpdateTalkStateOnEvent(play, thisx); } break; case TEXT_STATE_DONE: @@ -311,21 +311,21 @@ s16 func_80A79500(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return sp1E; + return talkState; } void func_80A795C8(EnIn* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 npcTrackingMode; + s16 trackingMode; if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 || this->skelAnime.animation == &object_in_Anim_013D60) { - npcTrackingMode = NPC_TRACKING_NONE; + trackingMode = NPC_TRACKING_NONE; } else { - npcTrackingMode = NPC_TRACKING_PLAYER_AUTO_TURN; + trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN; } if (this->actionFunc == func_80A7A568) { - npcTrackingMode = NPC_TRACKING_FULL_BODY; + trackingMode = NPC_TRACKING_FULL_BODY; } if (this->actionFunc == func_80A7B024) { this->interactInfo.trackPos = play->view.eye; @@ -334,7 +334,7 @@ void func_80A795C8(EnIn* this, PlayState* play) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = 16.0f; } - Npc_TrackPoint(&this->actor, &this->interactInfo, 1, npcTrackingMode); + Npc_TrackPoint(&this->actor, &this->interactInfo, 1, trackingMode); } void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) { @@ -935,7 +935,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) { } else { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, ((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius, - func_80A79168, func_80A79500); + EnIn_GetTextId, EnIn_UpdateTalkState); if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->unk_1FA = this->unk_1F8; this->unk_1F8 = Message_GetState(&play->msgCtx); @@ -947,7 +947,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) { s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIn* this = (EnIn*)thisx; - Vec3s sp2C; + Vec3s limbRot; if (this->actor.params > 0 && limbIndex != INGO_HEAD_LIMB) { if (sAdultEraDLs[limbIndex] != NULL) { @@ -956,15 +956,15 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } if (limbIndex == INGO_HEAD_LIMB) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp2C = this->interactInfo.headRot; - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.y), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == INGO_CHEST_LIMB) { - sp2C = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY); - Matrix_RotateY(BINANG_TO_RAD_ALT(sp2C.y), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); } if (limbIndex == INGO_CHEST_LIMB || limbIndex == INGO_LEFT_SHOULDER_LIMB || limbIndex == INGO_RIGHT_SHOULDER_LIMB) { rot->y += Math_SinS(this->unk_330[limbIndex].y) * 200.0f; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 676cbfb94c..379348e4f5 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -304,7 +304,7 @@ s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) { return true; } -u16 func_80A96FD0(PlayState* play, Actor* thisx) { +u16 EnKo_GetTextIdChild(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; switch (ENKO_TYPE) { case ENKO_TYPE_CHILD_FADO: @@ -403,7 +403,7 @@ u16 func_80A96FD0(PlayState* play, Actor* thisx) { return 0; } -u16 func_80A97338(PlayState* play, Actor* thisx) { +u16 EnKo_GetTextIdAdult(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); EnKo* this = (EnKo*)thisx; @@ -488,7 +488,7 @@ u16 func_80A97338(PlayState* play, Actor* thisx) { } } -u16 func_80A97610(PlayState* play, Actor* thisx) { +u16 EnKo_GetTextId(PlayState* play, Actor* thisx) { u16 faceReaction; EnKo* this = (EnKo*)thisx; @@ -508,12 +508,12 @@ u16 func_80A97610(PlayState* play, Actor* thisx) { return faceReaction; } if (LINK_IS_ADULT) { - return func_80A97338(play, thisx); + return EnKo_GetTextIdAdult(play, thisx); } - return func_80A96FD0(play, thisx); + return EnKo_GetTextIdChild(play, thisx); } -s16 func_80A97738(PlayState* play, Actor* thisx) { +s16 EnKo_UpdateTalkState(PlayState* play, Actor* thisx) { EnKo* this = (EnKo*)thisx; switch (Message_GetState(&play->msgCtx)) { @@ -970,8 +970,8 @@ void func_80A9877C(EnKo* this, PlayState* play) { return; } } - if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->lookDist, func_80A97610, - func_80A97738) && + if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->lookDist, EnKo_GetTextId, + EnKo_UpdateTalkState) && ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_LOST_WOODS) { this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; @@ -1297,7 +1297,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) { s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnKo* this = (EnKo*)thisx; void* eyeTexture; - Vec3s sp40; + Vec3s limbRot; u8 headId; s32 pad; @@ -1314,15 +1314,15 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment); } if (limbIndex == 8) { - sp40 = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(-sp40.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if (limbIndex == 15) { Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp40 = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp40.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index edc7aae62f..a9c733c3b4 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -68,7 +68,7 @@ static AnimationInfo sAnimationInfo[] = { { &gKzMweepAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 EnKz_GetTextNoMaskChild(PlayState* play, EnKz* this) { +u16 EnKz_GetTextIdChild(PlayState* play, EnKz* this) { Player* player = GET_PLAYER(play); if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { @@ -81,7 +81,7 @@ u16 EnKz_GetTextNoMaskChild(PlayState* play, EnKz* this) { } } -u16 EnKz_GetTextNoMaskAdult(PlayState* play, EnKz* this) { +u16 EnKz_GetTextIdAdult(PlayState* play, EnKz* this) { Player* player = GET_PLAYER(play); if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_EYEBALL_FROG) { @@ -100,7 +100,7 @@ u16 EnKz_GetTextNoMaskAdult(PlayState* play, EnKz* this) { } } -u16 EnKz_GetText(PlayState* play, Actor* thisx) { +u16 EnKz_GetTextId(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; u16 reactionText = Text_GetFaceReaction(play, 0x1E); @@ -109,26 +109,26 @@ u16 EnKz_GetText(PlayState* play, Actor* thisx) { } if (LINK_IS_ADULT) { - return EnKz_GetTextNoMaskAdult(play, this); + return EnKz_GetTextIdAdult(play, this); } else { - return EnKz_GetTextNoMaskChild(play, this); + return EnKz_GetTextIdChild(play, this); } } -s16 func_80A9C6C0(PlayState* play, Actor* thisx) { +s16 EnKz_UpdateTalkState(PlayState* play, Actor* thisx) { EnKz* this = (EnKz*)thisx; - s16 ret = NPC_TALK_STATE_TALKING; + s16 talkState = NPC_TALK_STATE_TALKING; switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_DONE: - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; switch (this->actor.textId) { case 0x4012: SET_INFTABLE(INFTABLE_139); - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x401B: - ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION; + talkState = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION; break; case 0x401F: SET_INFTABLE(INFTABLE_139); @@ -155,7 +155,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) { if (this->actor.textId == 0x4014) { if (play->msgCtx.choiceIndex == 0) { EnKz_SetupGetItem(this, play); - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } else { this->actor.textId = 0x4016; Message_ContinueTextbox(play, this->actor.textId); @@ -164,7 +164,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) { break; case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } break; case TEXT_STATE_NONE: @@ -175,7 +175,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return ret; + return talkState; } void EnKz_UpdateEyes(EnKz* this) { @@ -188,54 +188,60 @@ void EnKz_UpdateEyes(EnKz* this) { } } -s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetTextIdFunc getTextId, - NpcUpdateTalkStateFunc updateTalkState) { +/** + * Custom version of Npc_UpdateTalking. + * + * @see Npc_UpdateTalking + */ +s32 EnKz_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, + NpcUpdateTalkStateFunc updateTalkState) { Player* player = GET_PLAYER(play); - s16 sp32; - s16 sp30; + s16 x; + s16 y; f32 xzDistToPlayer; f32 yaw; - if (Actor_ProcessTalkRequest(&this->actor, play)) { + if (Actor_ProcessTalkRequest(thisx, play)) { *talkState = NPC_TALK_STATE_TALKING; - return 1; + return true; } if (*talkState != NPC_TALK_STATE_IDLE) { - *talkState = updateTalkState(play, &this->actor); - return 0; + *talkState = updateTalkState(play, thisx); + return false; } - yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); - yaw -= this->actor.shape.rot.y; - if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) { - this->actor.flags &= ~ACTOR_FLAG_0; - return 0; + yaw = Math_Vec3f_Yaw(&thisx->home.pos, &player->actor.world.pos); + yaw -= thisx->shape.rot.y; + if ((fabsf(yaw) > 1638.0f) || (thisx->xzDistToPlayer < 265.0f)) { + thisx->flags &= ~ACTOR_FLAG_0; + return false; } - this->actor.flags |= ACTOR_FLAG_0; + thisx->flags |= ACTOR_FLAG_0; - Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); - if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) { - return 0; + Actor_GetScreenPos(play, thisx, &x, &y); + if (!((x >= -30) && (x < 361) && (y >= -10) && (y < 241))) { + return false; } - xzDistToPlayer = this->actor.xzDistToPlayer; - this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos); - if (func_8002F2CC(&this->actor, play, unkf) == 0) { - this->actor.xzDistToPlayer = xzDistToPlayer; - return 0; + xzDistToPlayer = thisx->xzDistToPlayer; + thisx->xzDistToPlayer = Math_Vec3f_DistXZ(&thisx->home.pos, &player->actor.world.pos); + if (func_8002F2CC(thisx, play, interactRange) == 0) { + thisx->xzDistToPlayer = xzDistToPlayer; + return false; } - this->actor.xzDistToPlayer = xzDistToPlayer; - this->actor.textId = getTextId(play, &this->actor); + thisx->xzDistToPlayer = xzDistToPlayer; + thisx->textId = getTextId(play, thisx); - return 0; + return false; } void func_80A9CB18(EnKz* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (func_80A9C95C(play, this, &this->interactInfo.talkState, 340.0f, EnKz_GetText, func_80A9C6C0)) { + if (EnKz_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, 340.0f, EnKz_GetTextId, + EnKz_UpdateTalkState)) { if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_33)) { if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actor.textId = 0x401B; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 3178dc0b97..170776b681 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -14,9 +14,6 @@ void EnMa1_Destroy(Actor* thisx, PlayState* play); void EnMa1_Update(Actor* thisx, PlayState* play); void EnMa1_Draw(Actor* thisx, PlayState* play); -u16 EnMa1_GetText(PlayState* play, Actor* thisx); -s16 func_80AA0778(PlayState* play, Actor* thisx); - void func_80AA0D88(EnMa1* this, PlayState* play); void func_80AA0EA0(EnMa1* this, PlayState* play); void func_80AA0EFC(EnMa1* this, PlayState* play); @@ -88,7 +85,7 @@ static void* sEyeTextures[] = { gMalonChildEyeClosedTex, }; -u16 EnMa1_GetText(PlayState* play, Actor* thisx) { +u16 EnMa1_GetTextId(PlayState* play, Actor* thisx) { u16 faceReaction = Text_GetFaceReaction(play, 0x17); if (faceReaction != 0) { @@ -123,8 +120,8 @@ u16 EnMa1_GetText(PlayState* play, Actor* thisx) { return 0x2041; } -s16 func_80AA0778(PlayState* play, Actor* thisx) { - s16 ret = NPC_TALK_STATE_TALKING; +s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) { + s16 talkState = NPC_TALK_STATE_TALKING; switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: @@ -132,40 +129,40 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) { case 0x2041: SET_INFTABLE(INFTABLE_84); SET_EVENTCHKINF(EVENTCHKINF_10); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x2043: - ret = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; break; case 0x2047: SET_EVENTCHKINF(EVENTCHKINF_15); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x2048: SET_INFTABLE(INFTABLE_85); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x2049: SET_EVENTCHKINF(EVENTCHKINF_16); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x2061: - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; default: - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; } break; case TEXT_STATE_CHOICE: case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; } break; case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - ret = NPC_TALK_STATE_ITEM_GIVEN; + talkState = NPC_TALK_STATE_ITEM_GIVEN; } break; case TEXT_STATE_NONE: @@ -174,10 +171,10 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) { case TEXT_STATE_SONG_DEMO_DONE: case TEXT_STATE_8: case TEXT_STATE_9: - ret = NPC_TALK_STATE_TALKING; + talkState = NPC_TALK_STATE_TALKING; break; } - return ret; + return talkState; } s32 func_80AA08C4(EnMa1* this, PlayState* play) { @@ -410,7 +407,7 @@ void EnMa1_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->actionFunc != EnMa1_DoNothing) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f, - EnMa1_GetText, func_80AA0778); + EnMa1_GetTextId, EnMa1_UpdateTalkState); } func_80AA0B74(this); func_80AA0AF4(this, play); @@ -418,22 +415,22 @@ void EnMa1_Update(Actor* thisx, PlayState* play) { s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa1* this = (EnMa1*)thisx; - Vec3s vec; + Vec3s limbRot; if ((limbIndex == 2) || (limbIndex == 5)) { *dList = NULL; } if (limbIndex == 15) { Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8) { - vec = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(-limbRot.x), MTXMODE_APPLY); } return false; } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index bf69635c0d..1a9c2d94e2 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -8,9 +8,6 @@ void EnMa2_Destroy(Actor* thisx, PlayState* play); void EnMa2_Update(Actor* thisx, PlayState* play); void EnMa2_Draw(Actor* thisx, PlayState* play); -u16 func_80AA19A0(PlayState* play, Actor* thisx); -s16 func_80AA1A38(PlayState* play, Actor* thisx); - void func_80AA1AE4(EnMa2* this, PlayState* play); s32 func_80AA1C68(EnMa2* this); void EnMa2_UpdateEyes(EnMa2* this); @@ -68,7 +65,7 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA19A0(PlayState* play, Actor* thisx) { +u16 EnMa2_GetTextId(PlayState* play, Actor* thisx) { u16 faceReaction = Text_GetFaceReaction(play, 23); if (faceReaction != 0) { @@ -89,22 +86,22 @@ u16 func_80AA19A0(PlayState* play, Actor* thisx) { return 0x204C; } -s16 func_80AA1A38(PlayState* play, Actor* thisx) { - s16 ret = NPC_TALK_STATE_TALKING; +s16 EnMa2_UpdateTalkState(PlayState* play, Actor* thisx) { + s16 talkState = NPC_TALK_STATE_TALKING; switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CLOSING: switch (thisx->textId) { case 0x2051: SET_INFTABLE(INFTABLE_8C); - ret = NPC_TALK_STATE_ACTION; + talkState = NPC_TALK_STATE_ACTION; break; case 0x2053: SET_INFTABLE(INFTABLE_8D); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; default: - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; } break; @@ -118,7 +115,7 @@ s16 func_80AA1A38(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return ret; + return talkState; } void func_80AA1AE4(EnMa2* this, PlayState* play) { @@ -323,28 +320,28 @@ void EnMa2_Update(Actor* thisx, PlayState* play) { func_80AA1AE4(this, play); if (this->actionFunc != func_80AA20E4) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f, - func_80AA19A0, func_80AA1A38); + EnMa2_GetTextId, EnMa2_UpdateTalkState); } } s32 EnMa2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa2* this = (EnMa2*)thisx; - Vec3s vec; + Vec3s limbRot; if ((limbIndex == MALON_ADULT_LEFT_THIGH_LIMB) || (limbIndex == MALON_ADULT_RIGHT_THIGH_LIMB)) { *dList = NULL; } if (limbIndex == MALON_ADULT_HEAD_LIMB) { Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == MALON_ADULT_CHEST_AND_NECK_LIMB) { - vec = this->interactInfo.torsoRot; - Matrix_RotateY(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.x), MTXMODE_APPLY); } if ((limbIndex == MALON_ADULT_CHEST_AND_NECK_LIMB) || (limbIndex == MALON_ADULT_LEFT_SHOULDER_LIMB) || (limbIndex == MALON_ADULT_RIGHT_SHOULDER_LIMB)) { diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 8e29bf6a2f..d051638d98 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -14,9 +14,6 @@ void EnMa3_Destroy(Actor* thisx, PlayState* play); void EnMa3_Update(Actor* thisx, PlayState* play); void EnMa3_Draw(Actor* thisx, PlayState* play); -u16 func_80AA2AA0(PlayState* play, Actor* thisx); -s16 func_80AA2BD4(PlayState* play, Actor* thisx); - void func_80AA2E54(EnMa3* this, PlayState* play); s32 func_80AA2EC8(EnMa3* this, PlayState* play); s32 func_80AA2F28(EnMa3* this); @@ -71,7 +68,7 @@ static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, }; -u16 func_80AA2AA0(PlayState* play, Actor* thisx) { +u16 EnMa3_GetTextId(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); if (!GET_INFTABLE(INFTABLE_B8)) { @@ -113,8 +110,8 @@ u16 func_80AA2AA0(PlayState* play, Actor* thisx) { return 0x2003; } -s16 func_80AA2BD4(PlayState* play, Actor* thisx) { - s16 ret = NPC_TALK_STATE_TALKING; +s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) { + s16 talkState = NPC_TALK_STATE_TALKING; switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_EVENT: @@ -145,7 +142,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) { switch (thisx->textId) { case 0x2000: SET_INFTABLE(INFTABLE_B8); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x208F: SET_EVENTCHKINF(EVENTCHKINF_1E); @@ -159,7 +156,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) { case 0x208E: CLEAR_EVENTINF(EVENTINF_HORSES_0A); thisx->flags &= ~ACTOR_FLAG_16; - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; gSaveContext.timerState = TIMER_STATE_STOP; break; case 0x2002: @@ -167,11 +164,11 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) { FALLTHROUGH; case 0x2003: if (!GET_EVENTINF(EVENTINF_HORSES_0A)) { - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; } break; default: - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; } break; @@ -184,7 +181,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return ret; + return talkState; } void func_80AA2E54(EnMa3* this, PlayState* play) { @@ -301,7 +298,7 @@ void EnMa3_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80AA2E54(this, play); Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 150.0f, - func_80AA2AA0, func_80AA2BD4); + EnMa3_GetTextId, EnMa3_UpdateTalkState); if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { if (this->isNotSinging) { // Turn on singing @@ -317,22 +314,22 @@ void EnMa3_Update(Actor* thisx, PlayState* play) { s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMa3* this = (EnMa3*)thisx; - Vec3s vec; + Vec3s limbRot; if ((limbIndex == MALON_ADULT_LIMB_LEFT_THIGH) || (limbIndex == MALON_ADULT_LIMB_RIGHT_THIGH)) { *dList = NULL; } if (limbIndex == MALON_ADULT_LIMB_HEAD) { Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) { - vec = this->interactInfo.torsoRot; - Matrix_RotateY(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.x), MTXMODE_APPLY); } if ((limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) || (limbIndex == MALON_ADULT_LIMB_LEFT_SHOULDER) || (limbIndex == MALON_ADULT_LIMB_RIGHT_SHOULDER)) { diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index b6abc06e0f..860057a1a0 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -384,7 +384,7 @@ s16 func_80AAAC78(EnMd* this, PlayState* play) { return dialogState; } -u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) { +u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { u16 reactionText = Text_GetFaceReaction(play, 0x11); if (reactionText != 0) { @@ -414,7 +414,7 @@ u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) { return 0x102F; } -u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) { +u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -425,7 +425,7 @@ u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) { return 0x1046; } -u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) { +u16 EnMd_GetTextIdLostWoods(PlayState* play, EnMd* this) { this->unk_208 = 0; this->unk_209 = TEXT_STATE_NONE; @@ -447,22 +447,22 @@ u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) { return 0x1060; } -u16 EnMd_GetText(PlayState* play, Actor* thisx) { +u16 EnMd_GetTextId(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; switch (play->sceneId) { case SCENE_KOKIRI_FOREST: - return EnMd_GetTextKokiriForest(play, this); + return EnMd_GetTextIdKokiriForest(play, this); case SCENE_MIDOS_HOUSE: - return EnMd_GetTextKokiriHome(play, this); + return EnMd_GetTextIdMidosHouse(play, this); case SCENE_LOST_WOODS: - return EnMd_GetTextLostWoods(play, this); + return EnMd_GetTextIdLostWoods(play, this); default: return 0; } } -s16 func_80AAAF04(PlayState* play, Actor* thisx) { +s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; switch (func_80AAAC78(this, play)) { case TEXT_STATE_NONE: @@ -581,7 +581,7 @@ void func_80AAB158(EnMd* this, PlayState* play) { if (this->actionFunc != func_80AABC10) { if (temp2) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - EnMd_GetText, func_80AAAF04); + EnMd_GetTextId, EnMd_UpdateTalkState); } } } @@ -836,19 +836,19 @@ void EnMd_Update(Actor* thisx, PlayState* play) { s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; - Vec3s vec; + Vec3s limbRot; if (limbIndex == ENMD_LIMB_HEAD) { Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == ENMD_LIMB_TORSO) { - vec = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); - Matrix_RotateY(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); } if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) || diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index c06d3db277..6be01cafd2 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -83,7 +83,7 @@ void EnMu_Interact(EnMu* this, PlayState* play) { } if (i == 5) { - if (this->defFaceReaction == (textIdOffset[randomIndex] | 0x7000)) { + if (this->defaultTextId == (textIdOffset[randomIndex] | 0x7000)) { randomIndex++; if (randomIndex >= 5) { randomIndex = 0; @@ -93,19 +93,19 @@ void EnMu_Interact(EnMu* this, PlayState* play) { } textFlags |= bitmask[randomIndex]; - this->defFaceReaction = textIdOffset[randomIndex] | 0x7000; + this->defaultTextId = textIdOffset[randomIndex] | 0x7000; textFlags &= EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK | 0xE0; gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] |= textFlags; } -u16 EnMu_GetFaceReaction(PlayState* play, Actor* thisx) { +u16 EnMu_GetTextId(PlayState* play, Actor* thisx) { EnMu* this = (EnMu*)thisx; u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A); if (faceReaction != 0) { return faceReaction; } - return this->defFaceReaction; + return this->defaultTextId; } s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx) { @@ -172,8 +172,7 @@ void EnMu_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); talkDist = this->collider.dim.radius + 30.0f; - Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetFaceReaction, - EnMu_UpdateTalkState); + Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetTextId, EnMu_UpdateTalkState); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h index c798e4fb85..22082271e5 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -14,7 +14,7 @@ typedef struct EnMu { /* 0x0190 */ EnMuActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ NpcInteractInfo npcInfo; - /* 0x0208 */ u16 defFaceReaction; + /* 0x0208 */ u16 defaultTextId; /* 0x020A */ s16 unk_20A[16]; /* 0x022A */ s16 unk_22A[17]; } EnMu; // size = 0x024C diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 1580e18ba3..cb2473a8e8 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -167,15 +167,15 @@ void func_80AB1040(EnNb* this, PlayState* play) { void func_80AB10C4(EnNb* this) { s32 pad2[2]; - Vec3s* tempPtr; - Vec3s* tempPtr2; - - tempPtr = &this->interactInfo.headRot; - Math_SmoothStepToS(&tempPtr->x, 0, 20, 6200, 100); - Math_SmoothStepToS(&tempPtr->y, 0, 20, 6200, 100); - tempPtr2 = &this->interactInfo.torsoRot; - Math_SmoothStepToS(&tempPtr2->x, 0, 20, 6200, 100); - Math_SmoothStepToS(&tempPtr2->y, 0, 20, 6200, 100); + Vec3s* headRot; + Vec3s* torsoRot; + + headRot = &this->interactInfo.headRot; + Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100); + Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100); + torsoRot = &this->interactInfo.torsoRot; + Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100); + Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100); } void EnNb_UpdateEyes(EnNb* this) { diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 904c1f2ef1..e59752e590 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -207,12 +207,12 @@ void EnNiwGirl_Update(Actor* thisx, PlayState* play) { this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f; } Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); - this->unk_260 = this->interactInfo.headRot; - this->unk_266 = this->interactInfo.torsoRot; + this->headRot = this->interactInfo.headRot; + this->torsoRot = this->interactInfo.torsoRot; } else { - Math_SmoothStepToS(&this->unk_266.y, 0, 5, 3000, 0); - Math_SmoothStepToS(&this->unk_260.y, 0, 5, 3000, 0); - Math_SmoothStepToS(&this->unk_260.z, 0, 5, 3000, 0); + Math_SmoothStepToS(&this->torsoRot.y, 0, 5, 3000, 0); + Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0); + Math_SmoothStepToS(&this->headRot.z, 0, 5, 3000, 0); } if (this->blinkTimer != 0) { this->blinkTimer--; @@ -232,11 +232,11 @@ s32 EnNiwGirlOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f EnNiwGirl* this = (EnNiwGirl*)thisx; if (limbIndex == 3) { - rot->x += this->unk_266.y; + rot->x += this->torsoRot.y; } if (limbIndex == 4) { - rot->x += this->unk_260.y; - rot->z += this->unk_260.z; + rot->x += this->headRot.y; + rot->z += this->headRot.z; } return false; } diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h index 308da0d260..e63e2df72f 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h @@ -15,8 +15,8 @@ typedef struct EnNiwGirl { /* 0x0190 */ Vec3s jointTable[17]; /* 0x01F6 */ Vec3s morphTable[17]; /* 0x025C */ EnNiwGirlActionFunc actionFunc; - /* 0x0260 */ Vec3s unk_260; - /* 0x0266 */ Vec3s unk_266; + /* 0x0260 */ Vec3s headRot; + /* 0x0266 */ Vec3s torsoRot; /* 0x026C */ s16 jumpTimer; // Controls how many frames she jumps for and how long until she jumps again /* 0x026E */ s16 unkUpTimer; /* 0x0270 */ s16 unk_270; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 82dcbe918d..e78a1113d5 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -501,10 +501,10 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f; } Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); - this->unk_254 = this->interactInfo.headRot; - this->unk_25A = this->interactInfo.torsoRot; + this->headRot = this->interactInfo.headRot; + this->torsoRot = this->interactInfo.torsoRot; if (this->unk_276 == 0) { - Math_SmoothStepToS(&this->unk_254.y, 0, 5, 3000, 0); + Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0); } gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment); if (this->objectOsAnimeIndex >= 0) { @@ -556,11 +556,11 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 s32 pad; if (limbIndex == 15) { - rot->x += this->unk_254.y; - rot->z += this->unk_254.x; + rot->x += this->headRot.y; + rot->z += this->headRot.x; } if (limbIndex == 8) { - rot->x += this->unk_25A.y; + rot->x += this->torsoRot.y; } if (this->unk_275 != 0) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h index 0789034984..f50f66494d 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h @@ -14,8 +14,8 @@ typedef struct EnNiwLady { /* 0x0190 */ Vec3s jointTable[16]; /* 0x01F0 */ Vec3s morphTable[16]; /* 0x0250 */ EnNiwLadyActionFunc actionFunc; - /* 0x0254 */ Vec3s unk_254; - /* 0x025A */ Vec3s unk_25A; + /* 0x0254 */ Vec3s headRot; + /* 0x025A */ Vec3s torsoRot; /* 0x0260 */ s16 unusedTimer; /* 0x0262 */ s16 unk_262; // "message_end_code" /* 0x0264 */ s16 unusedTimer2; 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 af08b7f943..e8c590b8bb 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -1271,21 +1271,21 @@ void func_80AED738(EnRu1* this, PlayState* play) { void func_80AED83C(EnRu1* this) { s32 pad[2]; - Vec3s* tempPtr; - Vec3s* tempPtr2; + Vec3s* headRot; + Vec3s* torsoRot; - tempPtr = &this->interactInfo.headRot; - Math_SmoothStepToS(&tempPtr->x, 0, 0x14, 0x1838, 0x64); - Math_SmoothStepToS(&tempPtr->y, 0, 0x14, 0x1838, 0x64); - tempPtr2 = &this->interactInfo.torsoRot; - Math_SmoothStepToS(&tempPtr2->x, 0, 0x14, 0x1838, 0x64); - Math_SmoothStepToS(&tempPtr2->y, 0, 0x14, 0x1838, 0x64); + headRot = &this->interactInfo.headRot; + Math_SmoothStepToS(&headRot->x, 0, 0x14, 0x1838, 0x64); + Math_SmoothStepToS(&headRot->y, 0, 0x14, 0x1838, 0x64); + torsoRot = &this->interactInfo.torsoRot; + Math_SmoothStepToS(&torsoRot->x, 0, 0x14, 0x1838, 0x64); + Math_SmoothStepToS(&torsoRot->y, 0, 0x14, 0x1838, 0x64); } void func_80AED8DC(EnRu1* this) { s32 temp_hi; s16* unk_2AC = &this->unk_2AC; - s16* someY = &this->interactInfo.headRot.y; + s16* headRotY = &this->interactInfo.headRot.y; s16* unk_29E = &this->unk_29E; s32 pad[2]; @@ -1303,14 +1303,14 @@ void func_80AED8DC(EnRu1* this) { } if (this->unk_2B0 == 0) { - Math_SmoothStepToS(unk_29E, 0 - *someY, 1, 0x190, 0x190); - Math_SmoothStepToS(someY, 0, 3, ABS(*unk_29E), 0x64); + Math_SmoothStepToS(unk_29E, 0 - *headRotY, 1, 0x190, 0x190); + Math_SmoothStepToS(headRotY, 0, 3, ABS(*unk_29E), 0x64); } else if (this->unk_2B0 == 1) { - Math_SmoothStepToS(unk_29E, -0x2AAA - *someY, 1, 0x190, 0x190); - Math_SmoothStepToS(someY, -0x2AAA, 3, ABS(*unk_29E), 0x64); + Math_SmoothStepToS(unk_29E, -0x2AAA - *headRotY, 1, 0x190, 0x190); + Math_SmoothStepToS(headRotY, -0x2AAA, 3, ABS(*unk_29E), 0x64); } else { - Math_SmoothStepToS(unk_29E, 0x2AAA - *someY, 1, 0x190, 0x190); - Math_SmoothStepToS(someY, 0x2AAA, 3, ABS(*unk_29E), 0x64); + Math_SmoothStepToS(unk_29E, 0x2AAA - *headRotY, 1, 0x190, 0x190); + Math_SmoothStepToS(headRotY, 0x2AAA, 3, ABS(*unk_29E), 0x64); } } @@ -1785,22 +1785,22 @@ void func_80AEEF5C(EnRu1* this, PlayState* play) { void func_80AEEF68(EnRu1* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 something; + s16 trackingPreset; this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = kREG(16) - 3.0f; - something = kREG(17) + 0xC; - Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_HEAD_AND_TORSO); + trackingPreset = kREG(17) + 0xC; + Npc_TrackPoint(&this->actor, &this->interactInfo, trackingPreset, NPC_TRACKING_HEAD_AND_TORSO); } void func_80AEEFEC(EnRu1* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 something; + s16 trackingPreset; this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = kREG(16) - 3.0f; - something = kREG(17) + 0xC; - Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_FULL_BODY); + trackingPreset = kREG(17) + 0xC; + Npc_TrackPoint(&this->actor, &this->interactInfo, trackingPreset, NPC_TRACKING_FULL_BODY); this->actor.world.rot.y = this->actor.shape.rot.y; } @@ -2260,17 +2260,17 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { } void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) { - Vec3s* vec1 = &this->interactInfo.torsoRot; - Vec3s* vec2 = &this->interactInfo.headRot; + Vec3s* torsoRot = &this->interactInfo.torsoRot; + Vec3s* headRot = &this->interactInfo.headRot; switch (limbIndex) { - case RUTO_CHILD_LEFT_UPPER_ARM: - rot->x += vec1->y; - rot->y -= vec1->x; + case RUTO_CHILD_CHEST: + rot->x += torsoRot->y; + rot->y -= torsoRot->x; break; - case RUTO_CHILD_TORSO: - rot->x += vec2->y; - rot->z += vec2->x; + case RUTO_CHILD_HEAD: + rot->x += headRot->y; + rot->z += headRot->x; break; } } @@ -2293,7 +2293,7 @@ void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f vec1; Vec3f vec2; - if (limbIndex == RUTO_CHILD_TORSO) { + if (limbIndex == RUTO_CHILD_HEAD) { vec1 = sMultVec; Matrix_MultVec3f(&vec1, &vec2); this->actor.focus.pos.x = vec2.x; 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 89aa106063..29570c980e 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -58,22 +58,23 @@ typedef struct EnRu1 { } EnRu1; // size = 0x039C typedef enum { - /* 0 */ RUTO_CHILD_ROOT, - /* 1 */ RUTO_CHILD_LEFT_THIGH, - /* 2 */ RUTO_CHILD_LEFT_SHIN, - /* 3 */ RUTO_CHILD_LEFT_FOOT, - /* 4 */ RUTO_CHILD_RIGHT_THIGH, - /* 5 */ RUTO_CHILD_RIGHT_SHIN, - /* 6 */ RUTO_CHILD_RIGHT_FOOT, - /* 7 */ RUTO_CHILD_CHEST, - /* 8 */ RUTO_CHILD_LEFT_UPPER_ARM, - /* 9 */ RUTO_CHILD_LEFT_FIN, - /* 10 */ RUTO_CHILD_LEFT_HAND, - /* 11 */ RUTO_CHILD_RIGHT_UPPER_ARM, - /* 12 */ RUTO_CHILD_RIGHT_FIN, - /* 13 */ RUTO_CHILD_RIGHT_HAND, - /* 14 */ RUTO_CHILD_HEAD, - /* 15 */ RUTO_CHILD_TORSO + /* 0 */ RUTO_CHILD_NONE, + /* 1 */ RUTO_CHILD_ROOT, + /* 2 */ RUTO_CHILD_LEFT_THIGH, + /* 3 */ RUTO_CHILD_LEFT_SHIN, + /* 4 */ RUTO_CHILD_LEFT_FOOT, + /* 5 */ RUTO_CHILD_RIGHT_THIGH, + /* 6 */ RUTO_CHILD_RIGHT_SHIN, + /* 7 */ RUTO_CHILD_RIGHT_FOOT, + /* 8 */ RUTO_CHILD_CHEST, + /* 9 */ RUTO_CHILD_LEFT_UPPER_ARM, + /* 10 */ RUTO_CHILD_LEFT_FIN, + /* 11 */ RUTO_CHILD_LEFT_HAND, + /* 12 */ RUTO_CHILD_RIGHT_UPPER_ARM, + /* 13 */ RUTO_CHILD_RIGHT_FIN, + /* 14 */ RUTO_CHILD_RIGHT_HAND, + /* 15 */ RUTO_CHILD_HEAD, + /* 16 */ RUTO_CHILD_TORSO } RutoLimb; #endif diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 50847cc7d3..5e7b343470 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -138,7 +138,7 @@ s16 func_80AF5560(EnSa* this, PlayState* play) { return textState; } -u16 func_80AF55E0(PlayState* play, Actor* thisx) { +u16 EnSa_GetTextId(PlayState* play, Actor* thisx) { EnSa* this = (EnSa*)thisx; u16 reaction = Text_GetFaceReaction(play, 0x10); @@ -178,8 +178,8 @@ u16 func_80AF55E0(PlayState* play, Actor* thisx) { return 0x1001; } -s16 func_80AF56F4(PlayState* play, Actor* thisx) { - s16 ret = NPC_TALK_STATE_TALKING; +s16 EnSa_UpdateTalkState(PlayState* play, Actor* thisx) { + s16 talkState = NPC_TALK_STATE_TALKING; EnSa* this = (EnSa*)thisx; switch (func_80AF5560(this, play)) { @@ -187,19 +187,19 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) { switch (this->actor.textId) { case 0x1002: SET_INFTABLE(INFTABLE_01); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x1031: SET_EVENTCHKINF(EVENTCHKINF_03); SET_INFTABLE(INFTABLE_03); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case 0x1047: SET_INFTABLE(INFTABLE_05); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; default: - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; } break; @@ -213,7 +213,7 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) { case TEXT_STATE_9: break; } - return ret; + return talkState; } void func_80AF57D8(EnSa* this, PlayState* play) { @@ -221,7 +221,7 @@ void func_80AF57D8(EnSa* this, PlayState* play) { ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - func_80AF55E0, func_80AF56F4); + EnSa_GetTextId, EnSa_UpdateTalkState); } } @@ -762,20 +762,20 @@ void EnSa_Update(Actor* thisx, PlayState* play) { s32 EnSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnSa* this = (EnSa*)thisx; s32 pad; - Vec3s sp18; + Vec3s limbRot; if (limbIndex == 16) { Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); - sp18 = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 9) { - sp18 = this->interactInfo.torsoRot; - Matrix_RotateY(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if (play->sceneId == SCENE_SACRED_FOREST_MEADOW && limbIndex == 15) { diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index b28f34c685..a492216214 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -52,28 +52,28 @@ ActorInit En_Tg_InitVars = { u16 EnTg_GetTextId(PlayState* play, Actor* thisx) { EnTg* this = (EnTg*)thisx; - u16 temp; - u32 phi; + u16 faceReaction; + u32 textId; // If the player is wearing a mask, return a special reaction text - temp = Text_GetFaceReaction(play, 0x24); - if (temp != 0) { - return temp; + faceReaction = Text_GetFaceReaction(play, 0x24); + if (faceReaction != 0) { + return faceReaction; } if (play->sceneId == SCENE_KAKARIKO_VILLAGE) { if (this->nextDialogue % 2 != 0) { - phi = 0x5089; + textId = 0x5089; } else { - phi = 0x508A; + textId = 0x508A; } - return phi; + return textId; } else { if (this->nextDialogue % 2 != 0) { - phi = 0x7025; + textId = 0x7025; } else { - phi = 0x7026; + textId = 0x7026; } - return phi; + return textId; } } @@ -90,7 +90,7 @@ s16 EnTg_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_SONG_DEMO_DONE: case TEXT_STATE_8: case TEXT_STATE_9: - return 1; + return NPC_TALK_STATE_TALKING; case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x5089: @@ -103,9 +103,9 @@ s16 EnTg_UpdateTalkState(PlayState* play, Actor* thisx) { this->nextDialogue++; break; } - return 0; + return NPC_TALK_STATE_IDLE; default: - return 1; + return NPC_TALK_STATE_TALKING; } } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 6dc7c31fcf..a2630acf0c 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -330,12 +330,12 @@ s32 EnTk_Orient(EnTk* this, PlayState* play) { } } -u16 func_80B1C54C(PlayState* play, Actor* thisx) { - u16 ret; +u16 EnTk_GetTextId(PlayState* play, Actor* thisx) { + u16 faceReaction; - ret = Text_GetFaceReaction(play, 14); - if (ret != 0) { - return ret; + faceReaction = Text_GetFaceReaction(play, 14); + if (faceReaction != 0) { + return faceReaction; } if (GET_INFTABLE(INFTABLE_D9)) { @@ -347,8 +347,8 @@ u16 func_80B1C54C(PlayState* play, Actor* thisx) { } } -s16 func_80B1C5A0(PlayState* play, Actor* thisx) { - s32 ret = NPC_TALK_STATE_TALKING; +s16 EnTk_UpdateTalkState(PlayState* play, Actor* thisx) { + s32 talkState = NPC_TALK_STATE_TALKING; switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: @@ -359,7 +359,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) { if (thisx->textId == 0x5028) { SET_INFTABLE(INFTABLE_D8); } - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; break; case TEXT_STATE_DONE_FADING: break; @@ -384,7 +384,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { Message_CloseTextbox(play); - ret = NPC_TALK_STATE_IDLE; + talkState = NPC_TALK_STATE_IDLE; } break; case TEXT_STATE_DONE: @@ -394,7 +394,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) { break; } - return ret; + return talkState; } s32 EnTk_ChooseReward(EnTk* this) { @@ -529,7 +529,7 @@ void EnTk_Rest(EnTk* this, PlayState* play) { } Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - func_80B1C54C, func_80B1C5A0); + EnTk_GetTextId, EnTk_UpdateTalkState); } else if (EnTk_CheckFacingPlayer(this)) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; @@ -537,7 +537,7 @@ void EnTk_Rest(EnTk* this, PlayState* play) { this->actionCountdown = 0; Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - func_80B1C54C, func_80B1C5A0); + EnTk_GetTextId, EnTk_UpdateTalkState); } else if (Actor_ProcessTalkRequest(&this->actor, play)) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index e1c65ac61f..e0c881f682 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -136,13 +136,13 @@ void func_80B536B4(EnZl3* this) { void func_80B536C4(EnZl3* this) { s32 pad[2]; - Vec3s* vec1 = &this->interactInfo.headRot; - Vec3s* vec2 = &this->interactInfo.torsoRot; + Vec3s* headRot = &this->interactInfo.headRot; + Vec3s* torsoRot = &this->interactInfo.torsoRot; - Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100); - Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100); - Math_SmoothStepToS(&vec2->x, 0, 20, 6200, 100); - Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); + Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100); + Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100); + Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100); + Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100); } void func_80B53764(EnZl3* this, PlayState* play) { @@ -588,13 +588,13 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Mtx* sp78; MtxF sp38; Vec3s sp30; - Vec3s* unk_3F8_unk_08 = &this->interactInfo.headRot; - Vec3s* unk_3F8_unk_0E = &this->interactInfo.torsoRot; + Vec3s* headRot = &this->interactInfo.headRot; + Vec3s* torsoRot = &this->interactInfo.torsoRot; if (limbIndex == 14) { sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); - rot->x += unk_3F8_unk_08->y; - rot->z += unk_3F8_unk_08->x; + rot->x += headRot->y; + rot->z += headRot->x; gSPSegment((*gfx)++, 0x0C, sp78); Matrix_Push(); @@ -678,8 +678,8 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Pop(); this->unk_2FC = 1; } else if (limbIndex == 7) { - rot->x += unk_3F8_unk_0E->y; - rot->y -= unk_3F8_unk_0E->x; + rot->x += torsoRot->y; + rot->y -= torsoRot->x; } return false; } @@ -2440,12 +2440,12 @@ s32 func_80B5944C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s if (limbIndex == 14) { Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); EnZl3* this = (EnZl3*)thisx; - Vec3s* vec = &this->interactInfo.headRot; + Vec3s* headRot = &this->interactInfo.headRot; gSPSegment(gfx[0]++, 0x0C, mtx); - rot->x += vec->y; - rot->z += vec->x; + rot->x += headRot->y; + rot->z += headRot->x; Matrix_Push(); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index d8a95940ef..e573f7c165 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -198,10 +198,10 @@ void EnZl4_SetActiveCamMove(PlayState* play, s16 index) { sCamMove[index].relativeToPlayer); } -u16 EnZl4_GetText(PlayState* play, Actor* thisx) { +u16 EnZl4_GetTextId(PlayState* play, Actor* thisx) { u16 faceReaction = Text_GetFaceReaction(play, 22); u16 stoneCount; - s16 ret; + s16 textId; if (faceReaction != 0) { return faceReaction; @@ -219,14 +219,14 @@ u16 EnZl4_GetText(PlayState* play, Actor* thisx) { } if (stoneCount > 1) { - ret = 0x703D; + textId = 0x703D; } else { - ret = 0x703C; + textId = 0x703C; } - return ret; + return textId; } -s16 func_80B5B9B0(PlayState* play, Actor* thisx) { +s16 EnZl4_UpdateTalkState(PlayState* play, Actor* thisx) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return NPC_TALK_STATE_IDLE; } @@ -1210,7 +1210,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) { void EnZl4_Idle(EnZl4* this, PlayState* play) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 60.0f, - EnZl4_GetText, func_80B5B9B0); + EnZl4_GetTextId, EnZl4_UpdateTalkState); func_80B5BB78(this, play); } @@ -1266,19 +1266,19 @@ void EnZl4_Update(Actor* thisx, PlayState* play) { s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnZl4* this = (EnZl4*)thisx; - Vec3s sp1C; + Vec3s limbRot; if (limbIndex == 17) { - sp1C = this->interactInfo.headRot; + limbRot = this->interactInfo.headRot; Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 10) { - sp1C = this->interactInfo.torsoRot; - Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); - Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limbIndex >= 3) && (limbIndex < 7)) { *dList = NULL; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index ad93a79f68..070a4c5574 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -354,12 +354,12 @@ void EnZo_SpawnSplashes(EnZo* this) { } } -u16 func_80B61024(PlayState* play, Actor* thisx) { - u16 textId; +u16 EnZo_GetTextId(PlayState* play, Actor* thisx) { + u16 faceReaction; - textId = Text_GetFaceReaction(play, 29); - if (textId != 0) { - return textId; + faceReaction = Text_GetFaceReaction(play, 29); + if (faceReaction != 0) { + return faceReaction; } switch (thisx->params & 0x3F) { @@ -440,7 +440,7 @@ u16 func_80B61024(PlayState* play, Actor* thisx) { return 0x4006; } -s16 func_80B61298(PlayState* play, Actor* thisx) { +s16 EnZo_UpdateTalkState(PlayState* play, Actor* thisx) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: @@ -514,8 +514,8 @@ void EnZo_Dialog(EnZo* this, PlayState* play) { } Npc_TrackPoint(&this->actor, &this->interactInfo, 11, this->trackingMode); if (this->canSpeak == true) { - Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, func_80B61024, - func_80B61298); + Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, EnZo_GetTextId, + EnZo_UpdateTalkState); } } @@ -755,20 +755,20 @@ void EnZo_Update(Actor* thisx, PlayState* play) { s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZo* this = (EnZo*)thisx; - Vec3s vec; + Vec3s limbRot; if (limbIndex == 15) { Matrix_Translate(1800.0f, 0.0f, 0.0f, MTXMODE_APPLY); - vec = this->interactInfo.headRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.headRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-1800.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8) { - vec = this->interactInfo.torsoRot; - Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); - Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); + limbRot = this->interactInfo.torsoRot; + Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {