1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

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
This commit is contained in:
Lauri Koskela 2022-12-19 02:11:16 +02:00 committed by GitHub
parent 934d488420
commit 2ae64683a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 471 additions and 487 deletions

View file

@ -179,14 +179,14 @@ void func_80984DB8(DemoIm* this) {
void func_80984E58(DemoIm* this, PlayState* play) { void func_80984E58(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s16 yawDiff; s16 yawDiff;
s16 npcTrackingMode; s16 trackingMode;
this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) + 4.0f; this->interactInfo.yOffset = kREG(16) + 4.0f;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
npcTrackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; trackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, npcTrackingMode); Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, trackingMode);
} }
void func_80984F10(DemoIm* this, PlayState* play) { void func_80984F10(DemoIm* this, PlayState* play) {

View file

@ -523,8 +523,8 @@ void EnDivingGame_Update(Actor* thisx, PlayState* play2) {
this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.trackPos.y = player->actor.world.pos.y; this->interactInfo.trackPos.y = player->actor.world.pos.y;
Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
this->vec_284 = this->interactInfo.headRot; this->headRot = this->interactInfo.headRot;
this->vec_28A = this->interactInfo.torsoRot; this->torsoRot = this->interactInfo.torsoRot;
if ((play->gameplayFrames % 16) == 0) { if ((play->gameplayFrames % 16) == 0) {
pos = this->actor.world.pos; pos = this->actor.world.pos;
pos.y += 20.0f; pos.y += 20.0f;
@ -550,12 +550,12 @@ s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V
s32 pad; s32 pad;
if (limbIndex == 6) { if (limbIndex == 6) {
rot->x += this->vec_28A.y; rot->x += this->torsoRot.y;
} }
if (limbIndex == 15) { if (limbIndex == 15) {
rot->x += this->vec_284.y; rot->x += this->headRot.y;
rot->z += this->vec_284.z; rot->z += this->headRot.z;
} }
if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) {

View file

@ -14,8 +14,8 @@ typedef struct EnDivingGame {
/* 0x0190 */ Vec3s jointTable[20]; /* 0x0190 */ Vec3s jointTable[20];
/* 0x0208 */ Vec3s morphTable[20]; /* 0x0208 */ Vec3s morphTable[20];
/* 0x0280 */ EnDivingGameActionFunc actionFunc; /* 0x0280 */ EnDivingGameActionFunc actionFunc;
/* 0x0284 */ Vec3s vec_284; /* 0x0284 */ Vec3s headRot;
/* 0x028A */ Vec3s vec_28A; /* 0x028A */ Vec3s torsoRot;
/* 0x0290 */ s16 unk_290; // counter that only goes up /* 0x0290 */ s16 unk_290; // counter that only goes up
/* 0x0292 */ s16 unk_292; /* 0x0292 */ s16 unk_292;
/* 0x0294 */ s16 subCamTimer; /* 0x0294 */ s16 subCamTimer;

View file

@ -98,7 +98,7 @@ void EnDu_SetupAction(EnDu* this, EnDuActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;
} }
u16 func_809FDC38(PlayState* play, Actor* actor) { u16 EnDu_GetTextId(PlayState* play, Actor* actor) {
u16 reaction = Text_GetFaceReaction(play, 0x21); u16 reaction = Text_GetFaceReaction(play, 0x21);
if (reaction != 0) { 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)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_HAS_NEXT:
@ -561,26 +561,26 @@ void EnDu_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc != func_809FE4A4) { if (this->actionFunc != func_809FE4A4) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 116.0f, 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); this->actionFunc(this, play);
} }
s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnDu* this = (EnDu*)thisx; EnDu* this = (EnDu*)thisx;
Vec3s sp1C; Vec3s limbRot;
if (limbIndex == 16) { if (limbIndex == 16) {
Matrix_Translate(2400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(2400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp1C = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-2400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-2400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
sp1C = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
return 0; return 0;
} }

View file

@ -196,7 +196,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) {
} }
s16 EnGo_UpdateTalkState(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 xzRange;
f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f;
@ -207,51 +207,51 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
switch (thisx->textId) { switch (thisx->textId) {
case 0x3008: case 0x3008:
SET_INFTABLE(INFTABLE_E0); SET_INFTABLE(INFTABLE_E0);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x300B: case 0x300B:
SET_INFTABLE(INFTABLE_EB); SET_INFTABLE(INFTABLE_EB);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3014: case 0x3014:
SET_INFTABLE(INFTABLE_F0); SET_INFTABLE(INFTABLE_F0);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3016: case 0x3016:
SET_INFTABLE(INFTABLE_F4); SET_INFTABLE(INFTABLE_F4);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3018: case 0x3018:
SET_INFTABLE(INFTABLE_F8); SET_INFTABLE(INFTABLE_F8);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3036: case 0x3036:
Actor_OfferGetItem(thisx, play, GI_TUNIC_GORON, xzRange, yRange); Actor_OfferGetItem(thisx, play, GI_TUNIC_GORON, xzRange, yRange);
SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x3037: case 0x3037:
SET_INFTABLE(INFTABLE_10E); SET_INFTABLE(INFTABLE_10E);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3041: case 0x3041:
SET_INFTABLE(INFTABLE_10F); SET_INFTABLE(INFTABLE_10F);
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x3059: case 0x3059:
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x3052: case 0x3052:
case 0x3054: case 0x3054:
case 0x3055: case 0x3055:
case 0x305A: case 0x305A:
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x305E: case 0x305E:
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
default: default:
unkState = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
} }
break; break;
@ -269,7 +269,7 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
thisx->textId = 0x300D; thisx->textId = 0x300D;
} }
Message_ContinueTextbox(play, thisx->textId); Message_ContinueTextbox(play, thisx->textId);
unkState = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
break; break;
case 0x3034: case 0x3034:
if (play->msgCtx.choiceIndex == 0) { if (play->msgCtx.choiceIndex == 0) {
@ -284,16 +284,16 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
thisx->textId = 0x3033; thisx->textId = 0x3033;
} }
Message_ContinueTextbox(play, thisx->textId); Message_ContinueTextbox(play, thisx->textId);
unkState = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
break; break;
case 0x3054: case 0x3054:
case 0x3055: case 0x3055:
if (play->msgCtx.choiceIndex == 0) { if (play->msgCtx.choiceIndex == 0) {
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} else { } else {
thisx->textId = 0x3056; thisx->textId = 0x3056;
Message_ContinueTextbox(play, thisx->textId); Message_ContinueTextbox(play, thisx->textId);
unkState = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
} }
SET_INFTABLE(INFTABLE_B4); SET_INFTABLE(INFTABLE_B4);
break; break;
@ -310,17 +310,17 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
case 0x3033: case 0x3033:
thisx->textId = 0x3034; thisx->textId = 0x3034;
Message_ContinueTextbox(play, thisx->textId); Message_ContinueTextbox(play, thisx->textId);
unkState = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
break; break;
default: default:
unkState = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
} }
} }
break; break;
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
unkState = NPC_TALK_STATE_ITEM_GIVEN; talkState = NPC_TALK_STATE_ITEM_GIVEN;
} }
break; break;
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
@ -330,21 +330,21 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return unkState; return talkState;
} }
s32 func_80A3ED24(PlayState* play, EnGo* this, NpcInteractInfo* interactInfo, f32 arg3, NpcGetTextIdFunc getTextId, s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId,
NpcUpdateTalkStateFunc updateTalkState) { NpcUpdateTalkStateFunc updateTalkState) {
if (interactInfo->talkState != NPC_TALK_STATE_IDLE) { if (*talkState != NPC_TALK_STATE_IDLE) {
interactInfo->talkState = updateTalkState(play, &this->actor); *talkState = updateTalkState(play, thisx);
return false; return false;
} else if (Actor_ProcessTalkRequest(&this->actor, play)) { } else if (Actor_ProcessTalkRequest(thisx, play)) {
interactInfo->talkState = NPC_TALK_STATE_TALKING; *talkState = NPC_TALK_STATE_TALKING;
return true; return true;
} else if (!func_8002F2CC(&this->actor, play, arg3)) { } else if (!func_8002F2CC(thisx, play, interactRange)) {
return false; return false;
} else { } else {
this->actor.textId = getTextId(play, &this->actor); thisx->textId = getTextId(play, thisx);
return false; 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) { switch (this->actor.params & 0xF0) {
case 0x00: case 0x00:
return 10.0f; return 10.0f;
@ -396,16 +396,16 @@ f32 EnGo_GetGoronSize(EnGo* this) {
void func_80A3F060(EnGo* this, PlayState* play) { void func_80A3F060(EnGo* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s16 npcTrackingMode; s16 trackingMode;
if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc &&
this->actionFunc != func_80A40B1C) { this->actionFunc != func_80A40B1C) {
npcTrackingMode = NPC_TRACKING_NONE; trackingMode = NPC_TRACKING_NONE;
} }
this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = EnGo_GetGoronSize(this); this->interactInfo.yOffset = EnGo_GetPlayerTrackingYOffset(this);
Npc_TrackPoint(&this->actor, &this->interactInfo, 4, npcTrackingMode); Npc_TrackPoint(&this->actor, &this->interactInfo, 4, trackingMode);
} }
void func_80A3F0E4(EnGo* this) { 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) { void func_80A3F908(EnGo* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
f32 float1; f32 interactRange;
s32 isUnkCondition; s32 dialogStarted;
if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_GoronLinkRolling || if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_GoronLinkRolling ||
this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == EnGo_Eyedrops || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == EnGo_Eyedrops ||
this->actionFunc == func_80A40DCC || this->actionFunc == EnGo_GetItem || this->actionFunc == func_80A40C78 || this->actionFunc == func_80A40DCC || this->actionFunc == EnGo_GetItem || this->actionFunc == func_80A40C78 ||
this->actionFunc == func_80A40B1C) { this->actionFunc == func_80A40B1C) {
float1 = (this->collider.dim.radius + 30.0f); interactRange = (this->collider.dim.radius + 30.0f);
float1 *= (this->actor.scale.x / 0.01f); interactRange *= (this->actor.scale.x / 0.01f);
if ((this->actor.params & 0xF0) == 0x90) { if ((this->actor.params & 0xF0) == 0x90) {
float1 *= 4.8f; interactRange *= 4.8f;
} }
if ((this->actor.params & 0xF0) == 0x90) { if ((this->actor.params & 0xF0) == 0x90) {
isUnkCondition = dialogStarted = EnGo_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange,
func_80A3ED24(play, this, &this->interactInfo, float1, EnGo_GetTextID, EnGo_UpdateTalkState); EnGo_GetTextID, EnGo_UpdateTalkState);
} else { } else {
isUnkCondition = Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, float1, dialogStarted = Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange,
EnGo_GetTextID, EnGo_UpdateTalkState); 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 (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) {
if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) {
if (GET_INFTABLE(INFTABLE_B4)) { 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) { s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGo* this = (EnGo*)thisx; EnGo* this = (EnGo*)thisx;
Vec3s vec1; Vec3s limbRot;
f32 float1;
if (limb == 17) { if (limb == 17) {
Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec1 = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
float1 = BINANG_TO_RAD_ALT(vec1.y); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(float1, MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
Matrix_RotateZ(float1, MTXMODE_APPLY);
Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limb == 10) { if (limb == 10) {
vec1 = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
float1 = BINANG_TO_RAD_ALT(vec1.y); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateY(float1, MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
Matrix_RotateX(float1, MTXMODE_APPLY);
} }
if ((limb == 10) || (limb == 11) || (limb == 14)) { if ((limb == 10) || (limb == 11) || (limb == 14)) {
float1 = Math_SinS(this->jointTable[limb]); rot->y += Math_SinS(this->jointTable[limb]) * 200.0f;
rot->y += float1 * 200.0f; rot->z += Math_CosS(this->morphTable[limb]) * 200.0f;
float1 = Math_CosS(this->morphTable[limb]);
rot->z += float1 * 200.0f;
} }
return 0; return 0;

View file

@ -121,7 +121,7 @@ static EnGo2DataStruct2 D_80A481F8[14] = {
{ 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 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 }, { 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 }, { 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) { s32 func_80A44790(EnGo2* this, PlayState* play) {
if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) { 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, return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange,
EnGo2_UpdateTalkState); EnGo2_GetTextId, EnGo2_UpdateTalkState);
} else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && } else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) &&
!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
return false; return false;
@ -831,7 +831,7 @@ s32 func_80A44790(EnGo2* this, PlayState* play) {
} else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { } else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->interactInfo.talkState = EnGo2_UpdateTalkState(play, &this->actor); this->interactInfo.talkState = EnGo2_UpdateTalkState(play, &this->actor);
return false; 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); this->actor.textId = EnGo2_GetTextId(play, &this->actor);
} }
return false; return false;
@ -851,8 +851,8 @@ void EnGo2_SetShape(EnGo2* this) {
this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10; this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10;
Actor_SetScale(&this->actor, D_80A481F8[index].scale); Actor_SetScale(&this->actor, D_80A481F8[index].scale);
this->actor.targetMode = D_80A481F8[index].actor_unk_1F; this->actor.targetMode = D_80A481F8[index].actor_unk_1F;
this->unk_218 = D_80A481F8[index].unk_218; this->interactRange = D_80A481F8[index].interactRange;
this->unk_218 += this->collider.dim.radius; this->interactRange += this->collider.dim.radius;
} }
void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { void EnGo2_CheckCollision(EnGo2* this, PlayState* play) {
@ -1091,7 +1091,8 @@ void func_80A45288(EnGo2* this, PlayState* play) {
if (this->actionFunc != EnGo2_GoronFireGenericAction) { if (this->actionFunc != EnGo2_GoronFireGenericAction) {
this->interactInfo.trackPos = player->actor.world.pos; 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); Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode);
} }
if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { 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) { void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
Vec3s D_80A4854C = { 0x00, 0x00, 0x00 }; Vec3s zeroVec = { 0x00, 0x00, 0x00 };
switch (this->goronState) { switch (this->goronState) {
case 0: // Wake up case 0: // Wake up
@ -1914,8 +1915,8 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) {
this->animTimer = 60; this->animTimer = 60;
this->actor.gravity = 0.0f; this->actor.gravity = 0.0f;
this->actor.speedXZ = 2.0f; this->actor.speedXZ = 2.0f;
this->interactInfo.headRot = D_80A4854C; this->interactInfo.headRot = zeroVec;
this->interactInfo.torsoRot = D_80A4854C; this->interactInfo.torsoRot = zeroVec;
this->goronState++; this->goronState++;
this->goronState++; this->goronState++;
player->actor.world.rot.y = this->actor.world.rot.y; 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) { s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGo2* this = (EnGo2*)thisx; EnGo2* this = (EnGo2*)thisx;
Vec3s vec1; Vec3s limbRot;
f32 float1;
if (limb == 17) { if (limb == 17) {
Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec1 = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
float1 = BINANG_TO_RAD_ALT(vec1.y); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(float1, MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
Matrix_RotateZ(float1, MTXMODE_APPLY);
Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limb == 10) { if (limb == 10) {
vec1 = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
float1 = BINANG_TO_RAD_ALT(vec1.y); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateY(float1, MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
Matrix_RotateX(float1, MTXMODE_APPLY);
} }
if ((limb == 10) || (limb == 11) || (limb == 14)) { if ((limb == 10) || (limb == 11) || (limb == 14)) {
float1 = Math_SinS(this->unk_226[limb]); rot->y += Math_SinS(this->unk_226[limb]) * 200.0f;
rot->y += float1 * 200.0f; rot->z += Math_CosS(this->unk_24A[limb]) * 200.0f;
float1 = Math_CosS(this->unk_24A[limb]);
rot->z += float1 * 200.0f;
} }
return 0; return 0;
} }

View file

@ -53,7 +53,7 @@ typedef struct {
f32 shape_unk_10; f32 shape_unk_10;
f32 scale; f32 scale;
s8 actor_unk_1F; s8 actor_unk_1F;
f32 unk_218; f32 interactRange;
} EnGo2DataStruct2; // size = 0x10 } EnGo2DataStruct2; // size = 0x10
typedef struct { typedef struct {
@ -88,7 +88,7 @@ typedef struct EnGo2 {
/* 0x0214 */ u8 eyeTexIndex; /* 0x0214 */ u8 eyeTexIndex;
/* 0x0215 */ u8 mouthTexIndex; /* 0x0215 */ u8 mouthTexIndex;
/* 0x0216 */ u8 unk_216; // Set to z rotation, checked by waypoint /* 0x0216 */ u8 unk_216; // Set to z rotation, checked by waypoint
/* 0x0218 */ f32 unk_218; /* 0x0218 */ f32 interactRange;
/* 0x021C */ char unk_21C[0x04]; /* 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 /* 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; /* 0x0224 */ s16 blinkTimer;

View file

@ -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) { s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGuest* this = (EnGuest*)thisx; EnGuest* this = (EnGuest*)thisx;
Vec3s sp3C; Vec3s limbRot;
OPEN_DISPS(play->state.gfxCtx, "../z_en_guest.c", 352); OPEN_DISPS(play->state.gfxCtx, "../z_en_guest.c", 352);
if (limbIndex == 15) { if (limbIndex == 15) {
*dList = object_boj_DL_0059B0; *dList = object_boj_DL_0059B0;
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp3C = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp3C.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
sp3C = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp3C.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) {

View file

@ -262,7 +262,7 @@ void func_80A56900(EnHeishi4* this, PlayState* play) {
void func_80A56994(EnHeishi4* this, PlayState* play) { void func_80A56994(EnHeishi4* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime); 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)) { if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play); Message_CloseTextbox(play);
SET_INFTABLE(INFTABLE_6C); 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; this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
} }
Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
this->unk_260 = this->interactInfo.headRot; this->headRot = this->interactInfo.headRot;
this->unk_266 = this->interactInfo.torsoRot; this->torsoRot = this->interactInfo.torsoRot;
} }
this->unk_27E += 1; this->unk_27E += 1;
this->actionFunc(this, play); this->actionFunc(this, play);
@ -369,11 +369,11 @@ s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f
EnHeishi4* this = (EnHeishi4*)thisx; EnHeishi4* this = (EnHeishi4*)thisx;
if (limbIndex == 9) { if (limbIndex == 9) {
rot->x += this->unk_266.y; rot->x += this->torsoRot.y;
} }
if (limbIndex == 16) { if (limbIndex == 16) {
rot->x += this->unk_260.y; rot->x += this->headRot.y;
rot->z += this->unk_260.z; rot->z += this->headRot.z;
} }
return false; return false;
} }

View file

@ -21,8 +21,8 @@ typedef struct EnHeishi4 {
/* 0x0190 */ Vec3s jointTable[17]; /* 0x0190 */ Vec3s jointTable[17];
/* 0x01F6 */ Vec3s morphTable[17]; /* 0x01F6 */ Vec3s morphTable[17];
/* 0x025C */ EnHeishi4ActionFunc actionFunc; /* 0x025C */ EnHeishi4ActionFunc actionFunc;
/* 0x0260 */ Vec3s unk_260; /* 0x0260 */ Vec3s headRot;
/* 0x0266 */ Vec3s unk_266; /* 0x0266 */ Vec3s torsoRot;
/* 0x026C */ Vec3f pos; /* 0x026C */ Vec3f pos;
/* 0x0278 */ f32 height; /* 0x0278 */ f32 height;
/* 0x027C */ s16 unk_27C; /* 0x027C */ s16 unk_27C;

View file

@ -290,12 +290,12 @@ static EnHyColliderInfo sColliderInfo[] = {
}; };
typedef struct { typedef struct {
/* 0x00 */ u8 unkPresetIndex; /* 0x00 */ u8 presetIndex;
/* 0x04 */ f32 unkValueChild; /* 0x04 */ f32 childYOffset;
/* 0x08 */ f32 unkValueAdult; /* 0x08 */ f32 adultYOffset;
} EnHyInit1Info; // size = 0xC } EnHyPlayerTrackingInfo; // size = 0xC
static EnHyInit1Info sInit1Info[] = { static EnHyPlayerTrackingInfo sPlayerTrackingInfo[] = {
/* ENHY_TYPE_AOB */ { 0x06, 20.0f, 10.0f }, /* ENHY_TYPE_AOB */ { 0x06, 20.0f, 10.0f },
/* ENHY_TYPE_COB */ { 0x06, 20.0f, 10.0f }, /* ENHY_TYPE_COB */ { 0x06, 20.0f, 10.0f },
/* ENHY_TYPE_AHG_2 */ { 0x07, 40.0f, 20.0f }, /* ENHY_TYPE_AHG_2 */ { 0x07, 40.0f, 20.0f },
@ -324,7 +324,7 @@ typedef struct {
/* 0x04 */ Vec3f modelOffset; /* 0x04 */ Vec3f modelOffset;
/* 0x10 */ f32 scale; /* 0x10 */ f32 scale;
/* 0x14 */ s8 targetMode; /* 0x14 */ s8 targetMode;
/* 0x18 */ f32 unkRange; /* 0x18 */ f32 interactRange;
} EnHyInit2Info; // size = 0x1C } EnHyInit2Info; // size = 0x1C
static EnHyInit2Info sInit2Info[] = { static EnHyInit2Info sInit2Info[] = {
@ -414,7 +414,7 @@ void func_80A6F7CC(EnHy* this, PlayState* play, s32 getItemId) {
fabsf(this->actor.yDistToPlayer) + 1.0f); 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); Player* player = GET_PLAYER(play);
EnHy* this = (EnHy*)thisx; EnHy* this = (EnHy*)thisx;
u16 textId = Text_GetFaceReaction(play, (this->actor.params & 0x7F) + 37); 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; EnHy* this = (EnHy*)thisx;
s16 beggarItems[] = { ITEM_BOTTLE_BLUE_FIRE, ITEM_BOTTLE_FISH, ITEM_BOTTLE_BUG, ITEM_BOTTLE_FAIRY }; s16 beggarItems[] = { ITEM_BOTTLE_BLUE_FIRE, ITEM_BOTTLE_FISH, ITEM_BOTTLE_BUG, ITEM_BOTTLE_FAIRY };
s16 beggarRewards[] = { 150, 100, 50, 25 }; s16 beggarRewards[] = { 150, 100, 50, 25 };
@ -702,8 +702,8 @@ void EnHy_InitSetProperties(EnHy* this) {
Actor_SetScale(&this->actor, sInit2Info[type].scale); Actor_SetScale(&this->actor, sInit2Info[type].scale);
this->actor.targetMode = sInit2Info[type].targetMode; this->actor.targetMode = sInit2Info[type].targetMode;
this->modelOffset = sInit2Info[type].modelOffset; this->modelOffset = sInit2Info[type].modelOffset;
this->unkRange = sInit2Info[type].unkRange; this->interactRange = sInit2Info[type].interactRange;
this->unkRange += this->collider.dim.radius; this->interactRange += this->collider.dim.radius;
} }
void EnHy_UpdateCollider(EnHy* this, PlayState* play) { 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; this->interactInfo.trackPos = player->actor.world.pos;
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
this->interactInfo.yOffset = sInit1Info[this->actor.params & 0x7F].unkValueAdult; this->interactInfo.yOffset = sPlayerTrackingInfo[this->actor.params & 0x7F].adultYOffset;
} else { } 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); trackingMode);
if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unkRange, func_80A6F810, if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnHy_GetTextId,
func_80A70058)) { EnHy_UpdateTalkState)) {
func_80A70834(this, play); 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) { s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnHy* this = (EnHy*)thisx; EnHy* this = (EnHy*)thisx;
s32 pad; s32 pad;
Vec3s sp48; Vec3s limbRot;
u8 i; u8 i;
void* ptr; void* ptr;
@ -1125,16 +1125,16 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == 15) { if (limbIndex == 15) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp48 = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp48.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
sp48 = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp48.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) { if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {

View file

@ -53,7 +53,7 @@ typedef struct EnHy {
/* 0x021A */ s16 nextEyeIndexTimer; /* 0x021A */ s16 nextEyeIndexTimer;
/* 0x021C */ s16 unk_21C[16]; // bodyWiggleY ? /* 0x021C */ s16 unk_21C[16]; // bodyWiggleY ?
/* 0x023C */ s16 unk_23C[16]; // bodyWiggleZ ? /* 0x023C */ s16 unk_23C[16]; // bodyWiggleZ ?
/* 0x025C */ f32 unkRange; /* 0x025C */ f32 interactRange;
/* 0x0260 */ s32 unkGetItemId; /* 0x0260 */ s32 unkGetItemId;
/* 0x0264 */ Vec3f modelOffset; /* 0x0264 */ Vec3f modelOffset;
/* 0x0270 */ Vec3s jointTable[16]; /* 0x0270 */ Vec3s jointTable[16];

View file

@ -109,7 +109,7 @@ static Gfx* sAdultEraDLs[] = {
gIngoAdultEraMustacheDL, gIngoAdultEraMustacheDL,
}; };
u16 func_80A78FB0(PlayState* play) { u16 EnIn_GetTextIdChild(PlayState* play) {
if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
if (GET_INFTABLE(INFTABLE_97)) { if (GET_INFTABLE(INFTABLE_97)) {
return 0x2046; 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); Player* player = GET_PLAYER(play);
u16 temp_v0 = Text_GetFaceReaction(play, 25); u16 faceReaction = Text_GetFaceReaction(play, 25);
if (temp_v0 != 0) { if (faceReaction != 0) {
return temp_v0; return faceReaction;
} }
if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
if (IS_DAY) { if (IS_DAY) {
@ -177,40 +177,40 @@ u16 func_80A79010(PlayState* play) {
} }
} }
u16 func_80A79168(PlayState* play, Actor* thisx) { u16 EnIn_GetTextId(PlayState* play, Actor* thisx) {
u16 temp_v0 = Text_GetFaceReaction(play, 25); u16 faceReaction = Text_GetFaceReaction(play, 25);
if (temp_v0 != 0) { if (faceReaction != 0) {
return temp_v0; return faceReaction;
} }
if (!LINK_IS_ADULT) { if (!LINK_IS_ADULT) {
return func_80A78FB0(play); return EnIn_GetTextIdChild(play);
} else { } else {
return func_80A79010(play); return EnIn_GetTextIdAdult(play);
} }
} }
s16 func_80A791CC(PlayState* play, Actor* thisx) { s16 EnIn_UpdateTalkStateOnClosing(PlayState* play, Actor* thisx) {
s32 ret = NPC_TALK_STATE_IDLE; s32 talkState = NPC_TALK_STATE_IDLE;
switch (thisx->textId) { switch (thisx->textId) {
case 0x2045: case 0x2045:
SET_INFTABLE(INFTABLE_97); SET_INFTABLE(INFTABLE_97);
break; break;
case 0x203E: case 0x203E:
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x203F: case 0x203F:
SET_EVENTCHKINF(EVENTCHKINF_11); SET_EVENTCHKINF(EVENTCHKINF_11);
SET_INFTABLE(INFTABLE_94); SET_INFTABLE(INFTABLE_94);
break; break;
} }
return ret; return talkState;
} }
s16 func_80A7924C(PlayState* play, Actor* thisx) { s16 EnIn_UpdateTalkStateOnChoice(PlayState* play, Actor* thisx) {
EnIn* this = (EnIn*)thisx; EnIn* this = (EnIn*)thisx;
s32 sp18 = NPC_TALK_STATE_TALKING; s32 talkState = NPC_TALK_STATE_TALKING;
switch (this->actor.textId) { switch (this->actor.textId) {
case 0x2030: case 0x2030:
@ -237,7 +237,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
case 0x2036: case 0x2036:
case 0x2037: case 0x2037:
if (play->msgCtx.choiceIndex == 1) { if (play->msgCtx.choiceIndex == 1) {
sp18 = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} else { } else {
this->actor.textId = 0x201F; this->actor.textId = 0x201F;
Message_ContinueTextbox(play, this->actor.textId); Message_ContinueTextbox(play, this->actor.textId);
@ -245,7 +245,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
break; break;
case 0x2038: case 0x2038:
if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) {
sp18 = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} else { } else {
this->actor.textId = 0x2039; this->actor.textId = 0x2039;
Message_ContinueTextbox(play, this->actor.textId); Message_ContinueTextbox(play, this->actor.textId);
@ -254,7 +254,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
break; break;
case 0x205B: case 0x205B:
if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) { if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) {
sp18 = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} else { } else {
Message_ContinueTextbox(play, this->actor.textId = 0x2039); Message_ContinueTextbox(play, this->actor.textId = 0x2039);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
@ -266,24 +266,24 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
} }
if (!gSaveContext.rupees) {} if (!gSaveContext.rupees) {}
return sp18; return talkState;
} }
s16 func_80A7949C(PlayState* play, Actor* thisx) { s16 EnIn_UpdateTalkStateOnEvent(PlayState* play, Actor* thisx) {
s32 phi_v1 = NPC_TALK_STATE_TALKING; s32 talkState = NPC_TALK_STATE_TALKING;
if (thisx->textId == 0x2035) { if (thisx->textId == 0x2035) {
Rupees_ChangeBy(-10); Rupees_ChangeBy(-10);
thisx->textId = 0x205C; thisx->textId = 0x205C;
Message_ContinueTextbox(play, thisx->textId); Message_ContinueTextbox(play, thisx->textId);
} else { } 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 EnIn_UpdateTalkState(PlayState* play, Actor* thisx) {
s16 sp1E = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId); osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId);
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
@ -291,18 +291,18 @@ s16 func_80A79500(PlayState* play, Actor* thisx) {
case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_HAS_NEXT:
break; break;
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
sp1E = func_80A791CC(play, thisx); talkState = EnIn_UpdateTalkStateOnClosing(play, thisx);
break; break;
case TEXT_STATE_DONE_FADING: case TEXT_STATE_DONE_FADING:
break; break;
case TEXT_STATE_CHOICE: case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
sp1E = func_80A7924C(play, thisx); talkState = EnIn_UpdateTalkStateOnChoice(play, thisx);
} }
break; break;
case TEXT_STATE_EVENT: case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
sp1E = func_80A7949C(play, thisx); talkState = EnIn_UpdateTalkStateOnEvent(play, thisx);
} }
break; break;
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
@ -311,21 +311,21 @@ s16 func_80A79500(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return sp1E; return talkState;
} }
void func_80A795C8(EnIn* this, PlayState* play) { void func_80A795C8(EnIn* this, PlayState* play) {
Player* player = GET_PLAYER(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 || if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 ||
this->skelAnime.animation == &object_in_Anim_013D60) { this->skelAnime.animation == &object_in_Anim_013D60) {
npcTrackingMode = NPC_TRACKING_NONE; trackingMode = NPC_TRACKING_NONE;
} else { } else {
npcTrackingMode = NPC_TRACKING_PLAYER_AUTO_TURN; trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
} }
if (this->actionFunc == func_80A7A568) { if (this->actionFunc == func_80A7A568) {
npcTrackingMode = NPC_TRACKING_FULL_BODY; trackingMode = NPC_TRACKING_FULL_BODY;
} }
if (this->actionFunc == func_80A7B024) { if (this->actionFunc == func_80A7B024) {
this->interactInfo.trackPos = play->view.eye; 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.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = 16.0f; 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) { void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) {
@ -935,7 +935,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) {
} else { } else {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState,
((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius, ((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) { if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->unk_1FA = this->unk_1F8; this->unk_1FA = this->unk_1F8;
this->unk_1F8 = Message_GetState(&play->msgCtx); 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) { s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnIn* this = (EnIn*)thisx; EnIn* this = (EnIn*)thisx;
Vec3s sp2C; Vec3s limbRot;
if (this->actor.params > 0 && limbIndex != INGO_HEAD_LIMB) { if (this->actor.params > 0 && limbIndex != INGO_HEAD_LIMB) {
if (sAdultEraDLs[limbIndex] != NULL) { if (sAdultEraDLs[limbIndex] != NULL) {
@ -956,15 +956,15 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
} }
if (limbIndex == INGO_HEAD_LIMB) { if (limbIndex == INGO_HEAD_LIMB) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp2C = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == INGO_CHEST_LIMB) { if (limbIndex == INGO_CHEST_LIMB) {
sp2C = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_RotateY(BINANG_TO_RAD_ALT(sp2C.y), 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) { 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; rot->y += Math_SinS(this->unk_330[limbIndex].y) * 200.0f;

View file

@ -304,7 +304,7 @@ s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) {
return true; return true;
} }
u16 func_80A96FD0(PlayState* play, Actor* thisx) { u16 EnKo_GetTextIdChild(PlayState* play, Actor* thisx) {
EnKo* this = (EnKo*)thisx; EnKo* this = (EnKo*)thisx;
switch (ENKO_TYPE) { switch (ENKO_TYPE) {
case ENKO_TYPE_CHILD_FADO: case ENKO_TYPE_CHILD_FADO:
@ -403,7 +403,7 @@ u16 func_80A96FD0(PlayState* play, Actor* thisx) {
return 0; return 0;
} }
u16 func_80A97338(PlayState* play, Actor* thisx) { u16 EnKo_GetTextIdAdult(PlayState* play, Actor* thisx) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
EnKo* this = (EnKo*)thisx; 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; u16 faceReaction;
EnKo* this = (EnKo*)thisx; EnKo* this = (EnKo*)thisx;
@ -508,12 +508,12 @@ u16 func_80A97610(PlayState* play, Actor* thisx) {
return faceReaction; return faceReaction;
} }
if (LINK_IS_ADULT) { 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; EnKo* this = (EnKo*)thisx;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
@ -970,8 +970,8 @@ void func_80A9877C(EnKo* this, PlayState* play) {
return; return;
} }
} }
if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->lookDist, func_80A97610, if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->lookDist, EnKo_GetTextId,
func_80A97738) && EnKo_UpdateTalkState) &&
ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_LOST_WOODS) { ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_LOST_WOODS) {
this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; 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) { s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnKo* this = (EnKo*)thisx; EnKo* this = (EnKo*)thisx;
void* eyeTexture; void* eyeTexture;
Vec3s sp40; Vec3s limbRot;
u8 headId; u8 headId;
s32 pad; 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); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
sp40 = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp40.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if (limbIndex == 15) { if (limbIndex == 15) {
Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp40 = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp40.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) {

View file

@ -68,7 +68,7 @@ static AnimationInfo sAnimationInfo[] = {
{ &gKzMweepAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, { &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); Player* player = GET_PLAYER(play);
if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { 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); Player* player = GET_PLAYER(play);
if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_EYEBALL_FROG) { 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; EnKz* this = (EnKz*)thisx;
u16 reactionText = Text_GetFaceReaction(play, 0x1E); u16 reactionText = Text_GetFaceReaction(play, 0x1E);
@ -109,26 +109,26 @@ u16 EnKz_GetText(PlayState* play, Actor* thisx) {
} }
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
return EnKz_GetTextNoMaskAdult(play, this); return EnKz_GetTextIdAdult(play, this);
} else { } 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; EnKz* this = (EnKz*)thisx;
s16 ret = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
switch (this->actor.textId) { switch (this->actor.textId) {
case 0x4012: case 0x4012:
SET_INFTABLE(INFTABLE_139); SET_INFTABLE(INFTABLE_139);
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x401B: 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; break;
case 0x401F: case 0x401F:
SET_INFTABLE(INFTABLE_139); SET_INFTABLE(INFTABLE_139);
@ -155,7 +155,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
if (this->actor.textId == 0x4014) { if (this->actor.textId == 0x4014) {
if (play->msgCtx.choiceIndex == 0) { if (play->msgCtx.choiceIndex == 0) {
EnKz_SetupGetItem(this, play); EnKz_SetupGetItem(this, play);
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} else { } else {
this->actor.textId = 0x4016; this->actor.textId = 0x4016;
Message_ContinueTextbox(play, this->actor.textId); Message_ContinueTextbox(play, this->actor.textId);
@ -164,7 +164,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
break; break;
case TEXT_STATE_EVENT: case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} }
break; break;
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
@ -175,7 +175,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return ret; return talkState;
} }
void EnKz_UpdateEyes(EnKz* this) { 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, /**
* Custom version of Npc_UpdateTalking.
*
* @see Npc_UpdateTalking
*/
s32 EnKz_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId,
NpcUpdateTalkStateFunc updateTalkState) { NpcUpdateTalkStateFunc updateTalkState) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s16 sp32; s16 x;
s16 sp30; s16 y;
f32 xzDistToPlayer; f32 xzDistToPlayer;
f32 yaw; f32 yaw;
if (Actor_ProcessTalkRequest(&this->actor, play)) { if (Actor_ProcessTalkRequest(thisx, play)) {
*talkState = NPC_TALK_STATE_TALKING; *talkState = NPC_TALK_STATE_TALKING;
return 1; return true;
} }
if (*talkState != NPC_TALK_STATE_IDLE) { if (*talkState != NPC_TALK_STATE_IDLE) {
*talkState = updateTalkState(play, &this->actor); *talkState = updateTalkState(play, thisx);
return 0; return false;
} }
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); yaw = Math_Vec3f_Yaw(&thisx->home.pos, &player->actor.world.pos);
yaw -= this->actor.shape.rot.y; yaw -= thisx->shape.rot.y;
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) { if ((fabsf(yaw) > 1638.0f) || (thisx->xzDistToPlayer < 265.0f)) {
this->actor.flags &= ~ACTOR_FLAG_0; thisx->flags &= ~ACTOR_FLAG_0;
return 0; return false;
} }
this->actor.flags |= ACTOR_FLAG_0; thisx->flags |= ACTOR_FLAG_0;
Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); Actor_GetScreenPos(play, thisx, &x, &y);
if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) { if (!((x >= -30) && (x < 361) && (y >= -10) && (y < 241))) {
return 0; return false;
} }
xzDistToPlayer = this->actor.xzDistToPlayer; xzDistToPlayer = thisx->xzDistToPlayer;
this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos); thisx->xzDistToPlayer = Math_Vec3f_DistXZ(&thisx->home.pos, &player->actor.world.pos);
if (func_8002F2CC(&this->actor, play, unkf) == 0) { if (func_8002F2CC(thisx, play, interactRange) == 0) {
this->actor.xzDistToPlayer = xzDistToPlayer; thisx->xzDistToPlayer = xzDistToPlayer;
return 0; return false;
} }
this->actor.xzDistToPlayer = xzDistToPlayer; thisx->xzDistToPlayer = xzDistToPlayer;
this->actor.textId = getTextId(play, &this->actor); thisx->textId = getTextId(play, thisx);
return 0; return false;
} }
void func_80A9CB18(EnKz* this, PlayState* play) { void func_80A9CB18(EnKz* this, PlayState* play) {
Player* player = GET_PLAYER(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 ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_33)) {
if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) {
this->actor.textId = 0x401B; this->actor.textId = 0x401B;

View file

@ -14,9 +14,6 @@ void EnMa1_Destroy(Actor* thisx, PlayState* play);
void EnMa1_Update(Actor* thisx, PlayState* play); void EnMa1_Update(Actor* thisx, PlayState* play);
void EnMa1_Draw(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_80AA0D88(EnMa1* this, PlayState* play);
void func_80AA0EA0(EnMa1* this, PlayState* play); void func_80AA0EA0(EnMa1* this, PlayState* play);
void func_80AA0EFC(EnMa1* this, PlayState* play); void func_80AA0EFC(EnMa1* this, PlayState* play);
@ -88,7 +85,7 @@ static void* sEyeTextures[] = {
gMalonChildEyeClosedTex, gMalonChildEyeClosedTex,
}; };
u16 EnMa1_GetText(PlayState* play, Actor* thisx) { u16 EnMa1_GetTextId(PlayState* play, Actor* thisx) {
u16 faceReaction = Text_GetFaceReaction(play, 0x17); u16 faceReaction = Text_GetFaceReaction(play, 0x17);
if (faceReaction != 0) { if (faceReaction != 0) {
@ -123,8 +120,8 @@ u16 EnMa1_GetText(PlayState* play, Actor* thisx) {
return 0x2041; return 0x2041;
} }
s16 func_80AA0778(PlayState* play, Actor* thisx) { s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) {
s16 ret = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
@ -132,40 +129,40 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) {
case 0x2041: case 0x2041:
SET_INFTABLE(INFTABLE_84); SET_INFTABLE(INFTABLE_84);
SET_EVENTCHKINF(EVENTCHKINF_10); SET_EVENTCHKINF(EVENTCHKINF_10);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x2043: case 0x2043:
ret = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
break; break;
case 0x2047: case 0x2047:
SET_EVENTCHKINF(EVENTCHKINF_15); SET_EVENTCHKINF(EVENTCHKINF_15);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x2048: case 0x2048:
SET_INFTABLE(INFTABLE_85); SET_INFTABLE(INFTABLE_85);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x2049: case 0x2049:
SET_EVENTCHKINF(EVENTCHKINF_16); SET_EVENTCHKINF(EVENTCHKINF_16);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x2061: case 0x2061:
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
default: default:
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
} }
break; break;
case TEXT_STATE_CHOICE: case TEXT_STATE_CHOICE:
case TEXT_STATE_EVENT: case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
} }
break; break;
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
ret = NPC_TALK_STATE_ITEM_GIVEN; talkState = NPC_TALK_STATE_ITEM_GIVEN;
} }
break; break;
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
@ -174,10 +171,10 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE: case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8: case TEXT_STATE_8:
case TEXT_STATE_9: case TEXT_STATE_9:
ret = NPC_TALK_STATE_TALKING; talkState = NPC_TALK_STATE_TALKING;
break; break;
} }
return ret; return talkState;
} }
s32 func_80AA08C4(EnMa1* this, PlayState* play) { s32 func_80AA08C4(EnMa1* this, PlayState* play) {
@ -410,7 +407,7 @@ void EnMa1_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play); this->actionFunc(this, play);
if (this->actionFunc != EnMa1_DoNothing) { if (this->actionFunc != EnMa1_DoNothing) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f, 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_80AA0B74(this);
func_80AA0AF4(this, play); 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) { s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMa1* this = (EnMa1*)thisx; EnMa1* this = (EnMa1*)thisx;
Vec3s vec; Vec3s limbRot;
if ((limbIndex == 2) || (limbIndex == 5)) { if ((limbIndex == 2) || (limbIndex == 5)) {
*dList = NULL; *dList = NULL;
} }
if (limbIndex == 15) { if (limbIndex == 15) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
vec = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(-limbRot.x), MTXMODE_APPLY);
} }
return false; return false;
} }

View file

@ -8,9 +8,6 @@ void EnMa2_Destroy(Actor* thisx, PlayState* play);
void EnMa2_Update(Actor* thisx, PlayState* play); void EnMa2_Update(Actor* thisx, PlayState* play);
void EnMa2_Draw(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); void func_80AA1AE4(EnMa2* this, PlayState* play);
s32 func_80AA1C68(EnMa2* this); s32 func_80AA1C68(EnMa2* this);
void EnMa2_UpdateEyes(EnMa2* this); void EnMa2_UpdateEyes(EnMa2* this);
@ -68,7 +65,7 @@ static AnimationFrameCountInfo sAnimationInfo[] = {
{ &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, { &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); u16 faceReaction = Text_GetFaceReaction(play, 23);
if (faceReaction != 0) { if (faceReaction != 0) {
@ -89,22 +86,22 @@ u16 func_80AA19A0(PlayState* play, Actor* thisx) {
return 0x204C; return 0x204C;
} }
s16 func_80AA1A38(PlayState* play, Actor* thisx) { s16 EnMa2_UpdateTalkState(PlayState* play, Actor* thisx) {
s16 ret = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
switch (thisx->textId) { switch (thisx->textId) {
case 0x2051: case 0x2051:
SET_INFTABLE(INFTABLE_8C); SET_INFTABLE(INFTABLE_8C);
ret = NPC_TALK_STATE_ACTION; talkState = NPC_TALK_STATE_ACTION;
break; break;
case 0x2053: case 0x2053:
SET_INFTABLE(INFTABLE_8D); SET_INFTABLE(INFTABLE_8D);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
default: default:
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
} }
break; break;
@ -118,7 +115,7 @@ s16 func_80AA1A38(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return ret; return talkState;
} }
void func_80AA1AE4(EnMa2* this, PlayState* play) { void func_80AA1AE4(EnMa2* this, PlayState* play) {
@ -323,28 +320,28 @@ void EnMa2_Update(Actor* thisx, PlayState* play) {
func_80AA1AE4(this, play); func_80AA1AE4(this, play);
if (this->actionFunc != func_80AA20E4) { if (this->actionFunc != func_80AA20E4) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f, 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) { s32 EnMa2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMa2* this = (EnMa2*)thisx; EnMa2* this = (EnMa2*)thisx;
Vec3s vec; Vec3s limbRot;
if ((limbIndex == MALON_ADULT_LEFT_THIGH_LIMB) || (limbIndex == MALON_ADULT_RIGHT_THIGH_LIMB)) { if ((limbIndex == MALON_ADULT_LEFT_THIGH_LIMB) || (limbIndex == MALON_ADULT_RIGHT_THIGH_LIMB)) {
*dList = NULL; *dList = NULL;
} }
if (limbIndex == MALON_ADULT_HEAD_LIMB) { if (limbIndex == MALON_ADULT_HEAD_LIMB) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == MALON_ADULT_CHEST_AND_NECK_LIMB) { if (limbIndex == MALON_ADULT_CHEST_AND_NECK_LIMB) {
vec = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.x), 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) || if ((limbIndex == MALON_ADULT_CHEST_AND_NECK_LIMB) || (limbIndex == MALON_ADULT_LEFT_SHOULDER_LIMB) ||
(limbIndex == MALON_ADULT_RIGHT_SHOULDER_LIMB)) { (limbIndex == MALON_ADULT_RIGHT_SHOULDER_LIMB)) {

View file

@ -14,9 +14,6 @@ void EnMa3_Destroy(Actor* thisx, PlayState* play);
void EnMa3_Update(Actor* thisx, PlayState* play); void EnMa3_Update(Actor* thisx, PlayState* play);
void EnMa3_Draw(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); void func_80AA2E54(EnMa3* this, PlayState* play);
s32 func_80AA2EC8(EnMa3* this, PlayState* play); s32 func_80AA2EC8(EnMa3* this, PlayState* play);
s32 func_80AA2F28(EnMa3* this); s32 func_80AA2F28(EnMa3* this);
@ -71,7 +68,7 @@ static AnimationFrameCountInfo sAnimationInfo[] = {
{ &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, { &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); Player* player = GET_PLAYER(play);
if (!GET_INFTABLE(INFTABLE_B8)) { if (!GET_INFTABLE(INFTABLE_B8)) {
@ -113,8 +110,8 @@ u16 func_80AA2AA0(PlayState* play, Actor* thisx) {
return 0x2003; return 0x2003;
} }
s16 func_80AA2BD4(PlayState* play, Actor* thisx) { s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) {
s16 ret = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_EVENT: case TEXT_STATE_EVENT:
@ -145,7 +142,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
switch (thisx->textId) { switch (thisx->textId) {
case 0x2000: case 0x2000:
SET_INFTABLE(INFTABLE_B8); SET_INFTABLE(INFTABLE_B8);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x208F: case 0x208F:
SET_EVENTCHKINF(EVENTCHKINF_1E); SET_EVENTCHKINF(EVENTCHKINF_1E);
@ -159,7 +156,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
case 0x208E: case 0x208E:
CLEAR_EVENTINF(EVENTINF_HORSES_0A); CLEAR_EVENTINF(EVENTINF_HORSES_0A);
thisx->flags &= ~ACTOR_FLAG_16; thisx->flags &= ~ACTOR_FLAG_16;
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
gSaveContext.timerState = TIMER_STATE_STOP; gSaveContext.timerState = TIMER_STATE_STOP;
break; break;
case 0x2002: case 0x2002:
@ -167,11 +164,11 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
FALLTHROUGH; FALLTHROUGH;
case 0x2003: case 0x2003:
if (!GET_EVENTINF(EVENTINF_HORSES_0A)) { if (!GET_EVENTINF(EVENTINF_HORSES_0A)) {
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
} }
break; break;
default: default:
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
} }
break; break;
@ -184,7 +181,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return ret; return talkState;
} }
void func_80AA2E54(EnMa3* this, PlayState* play) { void func_80AA2E54(EnMa3* this, PlayState* play) {
@ -301,7 +298,7 @@ void EnMa3_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play); this->actionFunc(this, play);
func_80AA2E54(this, play); func_80AA2E54(this, play);
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 150.0f, 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->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (this->isNotSinging) { if (this->isNotSinging) {
// Turn on singing // 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) { s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMa3* this = (EnMa3*)thisx; EnMa3* this = (EnMa3*)thisx;
Vec3s vec; Vec3s limbRot;
if ((limbIndex == MALON_ADULT_LIMB_LEFT_THIGH) || (limbIndex == MALON_ADULT_LIMB_RIGHT_THIGH)) { if ((limbIndex == MALON_ADULT_LIMB_LEFT_THIGH) || (limbIndex == MALON_ADULT_LIMB_RIGHT_THIGH)) {
*dList = NULL; *dList = NULL;
} }
if (limbIndex == MALON_ADULT_LIMB_HEAD) { if (limbIndex == MALON_ADULT_LIMB_HEAD) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) { if (limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) {
vec = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.x), 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) || if ((limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) || (limbIndex == MALON_ADULT_LIMB_LEFT_SHOULDER) ||
(limbIndex == MALON_ADULT_LIMB_RIGHT_SHOULDER)) { (limbIndex == MALON_ADULT_LIMB_RIGHT_SHOULDER)) {

View file

@ -384,7 +384,7 @@ s16 func_80AAAC78(EnMd* this, PlayState* play) {
return dialogState; return dialogState;
} }
u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) { u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) {
u16 reactionText = Text_GetFaceReaction(play, 0x11); u16 reactionText = Text_GetFaceReaction(play, 0x11);
if (reactionText != 0) { if (reactionText != 0) {
@ -414,7 +414,7 @@ u16 EnMd_GetTextKokiriForest(PlayState* play, EnMd* this) {
return 0x102F; return 0x102F;
} }
u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) { u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) {
this->unk_208 = 0; this->unk_208 = 0;
this->unk_209 = TEXT_STATE_NONE; this->unk_209 = TEXT_STATE_NONE;
@ -425,7 +425,7 @@ u16 EnMd_GetTextKokiriHome(PlayState* play, EnMd* this) {
return 0x1046; return 0x1046;
} }
u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) { u16 EnMd_GetTextIdLostWoods(PlayState* play, EnMd* this) {
this->unk_208 = 0; this->unk_208 = 0;
this->unk_209 = TEXT_STATE_NONE; this->unk_209 = TEXT_STATE_NONE;
@ -447,22 +447,22 @@ u16 EnMd_GetTextLostWoods(PlayState* play, EnMd* this) {
return 0x1060; return 0x1060;
} }
u16 EnMd_GetText(PlayState* play, Actor* thisx) { u16 EnMd_GetTextId(PlayState* play, Actor* thisx) {
EnMd* this = (EnMd*)thisx; EnMd* this = (EnMd*)thisx;
switch (play->sceneId) { switch (play->sceneId) {
case SCENE_KOKIRI_FOREST: case SCENE_KOKIRI_FOREST:
return EnMd_GetTextKokiriForest(play, this); return EnMd_GetTextIdKokiriForest(play, this);
case SCENE_MIDOS_HOUSE: case SCENE_MIDOS_HOUSE:
return EnMd_GetTextKokiriHome(play, this); return EnMd_GetTextIdMidosHouse(play, this);
case SCENE_LOST_WOODS: case SCENE_LOST_WOODS:
return EnMd_GetTextLostWoods(play, this); return EnMd_GetTextIdLostWoods(play, this);
default: default:
return 0; return 0;
} }
} }
s16 func_80AAAF04(PlayState* play, Actor* thisx) { s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) {
EnMd* this = (EnMd*)thisx; EnMd* this = (EnMd*)thisx;
switch (func_80AAAC78(this, play)) { switch (func_80AAAC78(this, play)) {
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
@ -581,7 +581,7 @@ void func_80AAB158(EnMd* this, PlayState* play) {
if (this->actionFunc != func_80AABC10) { if (this->actionFunc != func_80AABC10) {
if (temp2) { if (temp2) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, 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) { s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnMd* this = (EnMd*)thisx; EnMd* this = (EnMd*)thisx;
Vec3s vec; Vec3s limbRot;
if (limbIndex == ENMD_LIMB_HEAD) { if (limbIndex == ENMD_LIMB_HEAD) {
Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == ENMD_LIMB_TORSO) { if (limbIndex == ENMD_LIMB_TORSO) {
vec = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_RotateY(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
} }
if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) || if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) ||

View file

@ -83,7 +83,7 @@ void EnMu_Interact(EnMu* this, PlayState* play) {
} }
if (i == 5) { if (i == 5) {
if (this->defFaceReaction == (textIdOffset[randomIndex] | 0x7000)) { if (this->defaultTextId == (textIdOffset[randomIndex] | 0x7000)) {
randomIndex++; randomIndex++;
if (randomIndex >= 5) { if (randomIndex >= 5) {
randomIndex = 0; randomIndex = 0;
@ -93,19 +93,19 @@ void EnMu_Interact(EnMu* this, PlayState* play) {
} }
textFlags |= bitmask[randomIndex]; 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; 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; 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; EnMu* this = (EnMu*)thisx;
u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A); u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A);
if (faceReaction != 0) { if (faceReaction != 0) {
return faceReaction; return faceReaction;
} }
return this->defFaceReaction; return this->defaultTextId;
} }
s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx) { 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); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
this->actionFunc(this, play); this->actionFunc(this, play);
talkDist = this->collider.dim.radius + 30.0f; talkDist = this->collider.dim.radius + 30.0f;
Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetFaceReaction, Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetTextId, EnMu_UpdateTalkState);
EnMu_UpdateTalkState);
this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 60.0f; this->actor.focus.pos.y += 60.0f;

View file

@ -14,7 +14,7 @@ typedef struct EnMu {
/* 0x0190 */ EnMuActionFunc actionFunc; /* 0x0190 */ EnMuActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider; /* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ NpcInteractInfo npcInfo; /* 0x01E0 */ NpcInteractInfo npcInfo;
/* 0x0208 */ u16 defFaceReaction; /* 0x0208 */ u16 defaultTextId;
/* 0x020A */ s16 unk_20A[16]; /* 0x020A */ s16 unk_20A[16];
/* 0x022A */ s16 unk_22A[17]; /* 0x022A */ s16 unk_22A[17];
} EnMu; // size = 0x024C } EnMu; // size = 0x024C

View file

@ -167,15 +167,15 @@ void func_80AB1040(EnNb* this, PlayState* play) {
void func_80AB10C4(EnNb* this) { void func_80AB10C4(EnNb* this) {
s32 pad2[2]; s32 pad2[2];
Vec3s* tempPtr; Vec3s* headRot;
Vec3s* tempPtr2; Vec3s* torsoRot;
tempPtr = &this->interactInfo.headRot; headRot = &this->interactInfo.headRot;
Math_SmoothStepToS(&tempPtr->x, 0, 20, 6200, 100); Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&tempPtr->y, 0, 20, 6200, 100); Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100);
tempPtr2 = &this->interactInfo.torsoRot; torsoRot = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&tempPtr2->x, 0, 20, 6200, 100); Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&tempPtr2->y, 0, 20, 6200, 100); Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100);
} }
void EnNb_UpdateEyes(EnNb* this) { void EnNb_UpdateEyes(EnNb* this) {

View file

@ -207,12 +207,12 @@ void EnNiwGirl_Update(Actor* thisx, PlayState* play) {
this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f; this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
} }
Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
this->unk_260 = this->interactInfo.headRot; this->headRot = this->interactInfo.headRot;
this->unk_266 = this->interactInfo.torsoRot; this->torsoRot = this->interactInfo.torsoRot;
} else { } else {
Math_SmoothStepToS(&this->unk_266.y, 0, 5, 3000, 0); Math_SmoothStepToS(&this->torsoRot.y, 0, 5, 3000, 0);
Math_SmoothStepToS(&this->unk_260.y, 0, 5, 3000, 0); Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0);
Math_SmoothStepToS(&this->unk_260.z, 0, 5, 3000, 0); Math_SmoothStepToS(&this->headRot.z, 0, 5, 3000, 0);
} }
if (this->blinkTimer != 0) { if (this->blinkTimer != 0) {
this->blinkTimer--; this->blinkTimer--;
@ -232,11 +232,11 @@ s32 EnNiwGirlOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f
EnNiwGirl* this = (EnNiwGirl*)thisx; EnNiwGirl* this = (EnNiwGirl*)thisx;
if (limbIndex == 3) { if (limbIndex == 3) {
rot->x += this->unk_266.y; rot->x += this->torsoRot.y;
} }
if (limbIndex == 4) { if (limbIndex == 4) {
rot->x += this->unk_260.y; rot->x += this->headRot.y;
rot->z += this->unk_260.z; rot->z += this->headRot.z;
} }
return false; return false;
} }

View file

@ -15,8 +15,8 @@ typedef struct EnNiwGirl {
/* 0x0190 */ Vec3s jointTable[17]; /* 0x0190 */ Vec3s jointTable[17];
/* 0x01F6 */ Vec3s morphTable[17]; /* 0x01F6 */ Vec3s morphTable[17];
/* 0x025C */ EnNiwGirlActionFunc actionFunc; /* 0x025C */ EnNiwGirlActionFunc actionFunc;
/* 0x0260 */ Vec3s unk_260; /* 0x0260 */ Vec3s headRot;
/* 0x0266 */ Vec3s unk_266; /* 0x0266 */ Vec3s torsoRot;
/* 0x026C */ s16 jumpTimer; // Controls how many frames she jumps for and how long until she jumps again /* 0x026C */ s16 jumpTimer; // Controls how many frames she jumps for and how long until she jumps again
/* 0x026E */ s16 unkUpTimer; /* 0x026E */ s16 unkUpTimer;
/* 0x0270 */ s16 unk_270; /* 0x0270 */ s16 unk_270;

View file

@ -501,10 +501,10 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) {
this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f; this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
} }
Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
this->unk_254 = this->interactInfo.headRot; this->headRot = this->interactInfo.headRot;
this->unk_25A = this->interactInfo.torsoRot; this->torsoRot = this->interactInfo.torsoRot;
if (this->unk_276 == 0) { 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); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment);
if (this->objectOsAnimeIndex >= 0) { if (this->objectOsAnimeIndex >= 0) {
@ -556,11 +556,11 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
s32 pad; s32 pad;
if (limbIndex == 15) { if (limbIndex == 15) {
rot->x += this->unk_254.y; rot->x += this->headRot.y;
rot->z += this->unk_254.x; rot->z += this->headRot.x;
} }
if (limbIndex == 8) { if (limbIndex == 8) {
rot->x += this->unk_25A.y; rot->x += this->torsoRot.y;
} }
if (this->unk_275 != 0) { if (this->unk_275 != 0) {
if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {

View file

@ -14,8 +14,8 @@ typedef struct EnNiwLady {
/* 0x0190 */ Vec3s jointTable[16]; /* 0x0190 */ Vec3s jointTable[16];
/* 0x01F0 */ Vec3s morphTable[16]; /* 0x01F0 */ Vec3s morphTable[16];
/* 0x0250 */ EnNiwLadyActionFunc actionFunc; /* 0x0250 */ EnNiwLadyActionFunc actionFunc;
/* 0x0254 */ Vec3s unk_254; /* 0x0254 */ Vec3s headRot;
/* 0x025A */ Vec3s unk_25A; /* 0x025A */ Vec3s torsoRot;
/* 0x0260 */ s16 unusedTimer; /* 0x0260 */ s16 unusedTimer;
/* 0x0262 */ s16 unk_262; // "message_end_code" /* 0x0262 */ s16 unk_262; // "message_end_code"
/* 0x0264 */ s16 unusedTimer2; /* 0x0264 */ s16 unusedTimer2;

View file

@ -1271,21 +1271,21 @@ void func_80AED738(EnRu1* this, PlayState* play) {
void func_80AED83C(EnRu1* this) { void func_80AED83C(EnRu1* this) {
s32 pad[2]; s32 pad[2];
Vec3s* tempPtr; Vec3s* headRot;
Vec3s* tempPtr2; Vec3s* torsoRot;
tempPtr = &this->interactInfo.headRot; headRot = &this->interactInfo.headRot;
Math_SmoothStepToS(&tempPtr->x, 0, 0x14, 0x1838, 0x64); Math_SmoothStepToS(&headRot->x, 0, 0x14, 0x1838, 0x64);
Math_SmoothStepToS(&tempPtr->y, 0, 0x14, 0x1838, 0x64); Math_SmoothStepToS(&headRot->y, 0, 0x14, 0x1838, 0x64);
tempPtr2 = &this->interactInfo.torsoRot; torsoRot = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&tempPtr2->x, 0, 0x14, 0x1838, 0x64); Math_SmoothStepToS(&torsoRot->x, 0, 0x14, 0x1838, 0x64);
Math_SmoothStepToS(&tempPtr2->y, 0, 0x14, 0x1838, 0x64); Math_SmoothStepToS(&torsoRot->y, 0, 0x14, 0x1838, 0x64);
} }
void func_80AED8DC(EnRu1* this) { void func_80AED8DC(EnRu1* this) {
s32 temp_hi; s32 temp_hi;
s16* unk_2AC = &this->unk_2AC; s16* unk_2AC = &this->unk_2AC;
s16* someY = &this->interactInfo.headRot.y; s16* headRotY = &this->interactInfo.headRot.y;
s16* unk_29E = &this->unk_29E; s16* unk_29E = &this->unk_29E;
s32 pad[2]; s32 pad[2];
@ -1303,14 +1303,14 @@ void func_80AED8DC(EnRu1* this) {
} }
if (this->unk_2B0 == 0) { if (this->unk_2B0 == 0) {
Math_SmoothStepToS(unk_29E, 0 - *someY, 1, 0x190, 0x190); Math_SmoothStepToS(unk_29E, 0 - *headRotY, 1, 0x190, 0x190);
Math_SmoothStepToS(someY, 0, 3, ABS(*unk_29E), 0x64); Math_SmoothStepToS(headRotY, 0, 3, ABS(*unk_29E), 0x64);
} else if (this->unk_2B0 == 1) { } else if (this->unk_2B0 == 1) {
Math_SmoothStepToS(unk_29E, -0x2AAA - *someY, 1, 0x190, 0x190); Math_SmoothStepToS(unk_29E, -0x2AAA - *headRotY, 1, 0x190, 0x190);
Math_SmoothStepToS(someY, -0x2AAA, 3, ABS(*unk_29E), 0x64); Math_SmoothStepToS(headRotY, -0x2AAA, 3, ABS(*unk_29E), 0x64);
} else { } else {
Math_SmoothStepToS(unk_29E, 0x2AAA - *someY, 1, 0x190, 0x190); Math_SmoothStepToS(unk_29E, 0x2AAA - *headRotY, 1, 0x190, 0x190);
Math_SmoothStepToS(someY, 0x2AAA, 3, ABS(*unk_29E), 0x64); 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) { void func_80AEEF68(EnRu1* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s16 something; s16 trackingPreset;
this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) - 3.0f; this->interactInfo.yOffset = kREG(16) - 3.0f;
something = kREG(17) + 0xC; trackingPreset = kREG(17) + 0xC;
Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_HEAD_AND_TORSO); Npc_TrackPoint(&this->actor, &this->interactInfo, trackingPreset, NPC_TRACKING_HEAD_AND_TORSO);
} }
void func_80AEEFEC(EnRu1* this, PlayState* play) { void func_80AEEFEC(EnRu1* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
s16 something; s16 trackingPreset;
this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) - 3.0f; this->interactInfo.yOffset = kREG(16) - 3.0f;
something = kREG(17) + 0xC; trackingPreset = kREG(17) + 0xC;
Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_FULL_BODY); Npc_TrackPoint(&this->actor, &this->interactInfo, trackingPreset, NPC_TRACKING_FULL_BODY);
this->actor.world.rot.y = this->actor.shape.rot.y; 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) { void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) {
Vec3s* vec1 = &this->interactInfo.torsoRot; Vec3s* torsoRot = &this->interactInfo.torsoRot;
Vec3s* vec2 = &this->interactInfo.headRot; Vec3s* headRot = &this->interactInfo.headRot;
switch (limbIndex) { switch (limbIndex) {
case RUTO_CHILD_LEFT_UPPER_ARM: case RUTO_CHILD_CHEST:
rot->x += vec1->y; rot->x += torsoRot->y;
rot->y -= vec1->x; rot->y -= torsoRot->x;
break; break;
case RUTO_CHILD_TORSO: case RUTO_CHILD_HEAD:
rot->x += vec2->y; rot->x += headRot->y;
rot->z += vec2->x; rot->z += headRot->x;
break; break;
} }
} }
@ -2293,7 +2293,7 @@ void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f vec1; Vec3f vec1;
Vec3f vec2; Vec3f vec2;
if (limbIndex == RUTO_CHILD_TORSO) { if (limbIndex == RUTO_CHILD_HEAD) {
vec1 = sMultVec; vec1 = sMultVec;
Matrix_MultVec3f(&vec1, &vec2); Matrix_MultVec3f(&vec1, &vec2);
this->actor.focus.pos.x = vec2.x; this->actor.focus.pos.x = vec2.x;

View file

@ -58,22 +58,23 @@ typedef struct EnRu1 {
} EnRu1; // size = 0x039C } EnRu1; // size = 0x039C
typedef enum { typedef enum {
/* 0 */ RUTO_CHILD_ROOT, /* 0 */ RUTO_CHILD_NONE,
/* 1 */ RUTO_CHILD_LEFT_THIGH, /* 1 */ RUTO_CHILD_ROOT,
/* 2 */ RUTO_CHILD_LEFT_SHIN, /* 2 */ RUTO_CHILD_LEFT_THIGH,
/* 3 */ RUTO_CHILD_LEFT_FOOT, /* 3 */ RUTO_CHILD_LEFT_SHIN,
/* 4 */ RUTO_CHILD_RIGHT_THIGH, /* 4 */ RUTO_CHILD_LEFT_FOOT,
/* 5 */ RUTO_CHILD_RIGHT_SHIN, /* 5 */ RUTO_CHILD_RIGHT_THIGH,
/* 6 */ RUTO_CHILD_RIGHT_FOOT, /* 6 */ RUTO_CHILD_RIGHT_SHIN,
/* 7 */ RUTO_CHILD_CHEST, /* 7 */ RUTO_CHILD_RIGHT_FOOT,
/* 8 */ RUTO_CHILD_LEFT_UPPER_ARM, /* 8 */ RUTO_CHILD_CHEST,
/* 9 */ RUTO_CHILD_LEFT_FIN, /* 9 */ RUTO_CHILD_LEFT_UPPER_ARM,
/* 10 */ RUTO_CHILD_LEFT_HAND, /* 10 */ RUTO_CHILD_LEFT_FIN,
/* 11 */ RUTO_CHILD_RIGHT_UPPER_ARM, /* 11 */ RUTO_CHILD_LEFT_HAND,
/* 12 */ RUTO_CHILD_RIGHT_FIN, /* 12 */ RUTO_CHILD_RIGHT_UPPER_ARM,
/* 13 */ RUTO_CHILD_RIGHT_HAND, /* 13 */ RUTO_CHILD_RIGHT_FIN,
/* 14 */ RUTO_CHILD_HEAD, /* 14 */ RUTO_CHILD_RIGHT_HAND,
/* 15 */ RUTO_CHILD_TORSO /* 15 */ RUTO_CHILD_HEAD,
/* 16 */ RUTO_CHILD_TORSO
} RutoLimb; } RutoLimb;
#endif #endif

View file

@ -138,7 +138,7 @@ s16 func_80AF5560(EnSa* this, PlayState* play) {
return textState; return textState;
} }
u16 func_80AF55E0(PlayState* play, Actor* thisx) { u16 EnSa_GetTextId(PlayState* play, Actor* thisx) {
EnSa* this = (EnSa*)thisx; EnSa* this = (EnSa*)thisx;
u16 reaction = Text_GetFaceReaction(play, 0x10); u16 reaction = Text_GetFaceReaction(play, 0x10);
@ -178,8 +178,8 @@ u16 func_80AF55E0(PlayState* play, Actor* thisx) {
return 0x1001; return 0x1001;
} }
s16 func_80AF56F4(PlayState* play, Actor* thisx) { s16 EnSa_UpdateTalkState(PlayState* play, Actor* thisx) {
s16 ret = NPC_TALK_STATE_TALKING; s16 talkState = NPC_TALK_STATE_TALKING;
EnSa* this = (EnSa*)thisx; EnSa* this = (EnSa*)thisx;
switch (func_80AF5560(this, play)) { switch (func_80AF5560(this, play)) {
@ -187,19 +187,19 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) {
switch (this->actor.textId) { switch (this->actor.textId) {
case 0x1002: case 0x1002:
SET_INFTABLE(INFTABLE_01); SET_INFTABLE(INFTABLE_01);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x1031: case 0x1031:
SET_EVENTCHKINF(EVENTCHKINF_03); SET_EVENTCHKINF(EVENTCHKINF_03);
SET_INFTABLE(INFTABLE_03); SET_INFTABLE(INFTABLE_03);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case 0x1047: case 0x1047:
SET_INFTABLE(INFTABLE_05); SET_INFTABLE(INFTABLE_05);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
default: default:
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
} }
break; break;
@ -213,7 +213,7 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) {
case TEXT_STATE_9: case TEXT_STATE_9:
break; break;
} }
return ret; return talkState;
} }
void func_80AF57D8(EnSa* this, PlayState* play) { 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 || ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 ||
this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, 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) { s32 EnSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnSa* this = (EnSa*)thisx; EnSa* this = (EnSa*)thisx;
s32 pad; s32 pad;
Vec3s sp18; Vec3s limbRot;
if (limbIndex == 16) { if (limbIndex == 16) {
Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
sp18 = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 9) { if (limbIndex == 9) {
sp18 = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if (play->sceneId == SCENE_SACRED_FOREST_MEADOW && limbIndex == 15) { if (play->sceneId == SCENE_SACRED_FOREST_MEADOW && limbIndex == 15) {

View file

@ -52,28 +52,28 @@ ActorInit En_Tg_InitVars = {
u16 EnTg_GetTextId(PlayState* play, Actor* thisx) { u16 EnTg_GetTextId(PlayState* play, Actor* thisx) {
EnTg* this = (EnTg*)thisx; EnTg* this = (EnTg*)thisx;
u16 temp; u16 faceReaction;
u32 phi; u32 textId;
// If the player is wearing a mask, return a special reaction text // If the player is wearing a mask, return a special reaction text
temp = Text_GetFaceReaction(play, 0x24); faceReaction = Text_GetFaceReaction(play, 0x24);
if (temp != 0) { if (faceReaction != 0) {
return temp; return faceReaction;
} }
if (play->sceneId == SCENE_KAKARIKO_VILLAGE) { if (play->sceneId == SCENE_KAKARIKO_VILLAGE) {
if (this->nextDialogue % 2 != 0) { if (this->nextDialogue % 2 != 0) {
phi = 0x5089; textId = 0x5089;
} else { } else {
phi = 0x508A; textId = 0x508A;
} }
return phi; return textId;
} else { } else {
if (this->nextDialogue % 2 != 0) { if (this->nextDialogue % 2 != 0) {
phi = 0x7025; textId = 0x7025;
} else { } 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_SONG_DEMO_DONE:
case TEXT_STATE_8: case TEXT_STATE_8:
case TEXT_STATE_9: case TEXT_STATE_9:
return 1; return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
switch (this->actor.textId) { switch (this->actor.textId) {
case 0x5089: case 0x5089:
@ -103,9 +103,9 @@ s16 EnTg_UpdateTalkState(PlayState* play, Actor* thisx) {
this->nextDialogue++; this->nextDialogue++;
break; break;
} }
return 0; return NPC_TALK_STATE_IDLE;
default: default:
return 1; return NPC_TALK_STATE_TALKING;
} }
} }

View file

@ -330,12 +330,12 @@ s32 EnTk_Orient(EnTk* this, PlayState* play) {
} }
} }
u16 func_80B1C54C(PlayState* play, Actor* thisx) { u16 EnTk_GetTextId(PlayState* play, Actor* thisx) {
u16 ret; u16 faceReaction;
ret = Text_GetFaceReaction(play, 14); faceReaction = Text_GetFaceReaction(play, 14);
if (ret != 0) { if (faceReaction != 0) {
return ret; return faceReaction;
} }
if (GET_INFTABLE(INFTABLE_D9)) { if (GET_INFTABLE(INFTABLE_D9)) {
@ -347,8 +347,8 @@ u16 func_80B1C54C(PlayState* play, Actor* thisx) {
} }
} }
s16 func_80B1C5A0(PlayState* play, Actor* thisx) { s16 EnTk_UpdateTalkState(PlayState* play, Actor* thisx) {
s32 ret = NPC_TALK_STATE_TALKING; s32 talkState = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
@ -359,7 +359,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
if (thisx->textId == 0x5028) { if (thisx->textId == 0x5028) {
SET_INFTABLE(INFTABLE_D8); SET_INFTABLE(INFTABLE_D8);
} }
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
break; break;
case TEXT_STATE_DONE_FADING: case TEXT_STATE_DONE_FADING:
break; break;
@ -384,7 +384,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
case TEXT_STATE_EVENT: case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) { if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) {
Message_CloseTextbox(play); Message_CloseTextbox(play);
ret = NPC_TALK_STATE_IDLE; talkState = NPC_TALK_STATE_IDLE;
} }
break; break;
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
@ -394,7 +394,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
break; break;
} }
return ret; return talkState;
} }
s32 EnTk_ChooseReward(EnTk* this) { 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, 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)) { } else if (EnTk_CheckFacingPlayer(this)) {
v1 = this->actor.shape.rot.y; v1 = this->actor.shape.rot.y;
v1 -= this->h_21E; v1 -= this->h_21E;
@ -537,7 +537,7 @@ void EnTk_Rest(EnTk* this, PlayState* play) {
this->actionCountdown = 0; this->actionCountdown = 0;
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, 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)) { } else if (Actor_ProcessTalkRequest(&this->actor, play)) {
v1 = this->actor.shape.rot.y; v1 = this->actor.shape.rot.y;
v1 -= this->h_21E; v1 -= this->h_21E;

View file

@ -136,13 +136,13 @@ void func_80B536B4(EnZl3* this) {
void func_80B536C4(EnZl3* this) { void func_80B536C4(EnZl3* this) {
s32 pad[2]; s32 pad[2];
Vec3s* vec1 = &this->interactInfo.headRot; Vec3s* headRot = &this->interactInfo.headRot;
Vec3s* vec2 = &this->interactInfo.torsoRot; Vec3s* torsoRot = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100); Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100); Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->x, 0, 20, 6200, 100); Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100); Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100);
} }
void func_80B53764(EnZl3* this, PlayState* play) { 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; Mtx* sp78;
MtxF sp38; MtxF sp38;
Vec3s sp30; Vec3s sp30;
Vec3s* unk_3F8_unk_08 = &this->interactInfo.headRot; Vec3s* headRot = &this->interactInfo.headRot;
Vec3s* unk_3F8_unk_0E = &this->interactInfo.torsoRot; Vec3s* torsoRot = &this->interactInfo.torsoRot;
if (limbIndex == 14) { if (limbIndex == 14) {
sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7);
rot->x += unk_3F8_unk_08->y; rot->x += headRot->y;
rot->z += unk_3F8_unk_08->x; rot->z += headRot->x;
gSPSegment((*gfx)++, 0x0C, sp78); gSPSegment((*gfx)++, 0x0C, sp78);
Matrix_Push(); Matrix_Push();
@ -678,8 +678,8 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
Matrix_Pop(); Matrix_Pop();
this->unk_2FC = 1; this->unk_2FC = 1;
} else if (limbIndex == 7) { } else if (limbIndex == 7) {
rot->x += unk_3F8_unk_0E->y; rot->x += torsoRot->y;
rot->y -= unk_3F8_unk_0E->x; rot->y -= torsoRot->x;
} }
return false; return false;
} }
@ -2440,12 +2440,12 @@ s32 func_80B5944C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
if (limbIndex == 14) { if (limbIndex == 14) {
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7); Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7);
EnZl3* this = (EnZl3*)thisx; EnZl3* this = (EnZl3*)thisx;
Vec3s* vec = &this->interactInfo.headRot; Vec3s* headRot = &this->interactInfo.headRot;
gSPSegment(gfx[0]++, 0x0C, mtx); gSPSegment(gfx[0]++, 0x0C, mtx);
rot->x += vec->y; rot->x += headRot->y;
rot->z += vec->x; rot->z += headRot->x;
Matrix_Push(); Matrix_Push();
Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY);
Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY);

View file

@ -198,10 +198,10 @@ void EnZl4_SetActiveCamMove(PlayState* play, s16 index) {
sCamMove[index].relativeToPlayer); sCamMove[index].relativeToPlayer);
} }
u16 EnZl4_GetText(PlayState* play, Actor* thisx) { u16 EnZl4_GetTextId(PlayState* play, Actor* thisx) {
u16 faceReaction = Text_GetFaceReaction(play, 22); u16 faceReaction = Text_GetFaceReaction(play, 22);
u16 stoneCount; u16 stoneCount;
s16 ret; s16 textId;
if (faceReaction != 0) { if (faceReaction != 0) {
return faceReaction; return faceReaction;
@ -219,14 +219,14 @@ u16 EnZl4_GetText(PlayState* play, Actor* thisx) {
} }
if (stoneCount > 1) { if (stoneCount > 1) {
ret = 0x703D; textId = 0x703D;
} else { } 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) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
return NPC_TALK_STATE_IDLE; return NPC_TALK_STATE_IDLE;
} }
@ -1210,7 +1210,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) {
void EnZl4_Idle(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, 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); 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) { s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnZl4* this = (EnZl4*)thisx; EnZl4* this = (EnZl4*)thisx;
Vec3s sp1C; Vec3s limbRot;
if (limbIndex == 17) { if (limbIndex == 17) {
sp1C = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 10) { if (limbIndex == 10) {
sp1C = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if ((limbIndex >= 3) && (limbIndex < 7)) { if ((limbIndex >= 3) && (limbIndex < 7)) {
*dList = NULL; *dList = NULL;

View file

@ -354,12 +354,12 @@ void EnZo_SpawnSplashes(EnZo* this) {
} }
} }
u16 func_80B61024(PlayState* play, Actor* thisx) { u16 EnZo_GetTextId(PlayState* play, Actor* thisx) {
u16 textId; u16 faceReaction;
textId = Text_GetFaceReaction(play, 29); faceReaction = Text_GetFaceReaction(play, 29);
if (textId != 0) { if (faceReaction != 0) {
return textId; return faceReaction;
} }
switch (thisx->params & 0x3F) { switch (thisx->params & 0x3F) {
@ -440,7 +440,7 @@ u16 func_80B61024(PlayState* play, Actor* thisx) {
return 0x4006; return 0x4006;
} }
s16 func_80B61298(PlayState* play, Actor* thisx) { s16 EnZo_UpdateTalkState(PlayState* play, Actor* thisx) {
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
case TEXT_STATE_DONE_HAS_NEXT: 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); Npc_TrackPoint(&this->actor, &this->interactInfo, 11, this->trackingMode);
if (this->canSpeak == true) { if (this->canSpeak == true) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, func_80B61024, Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, EnZo_GetTextId,
func_80B61298); 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) { s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnZo* this = (EnZo*)thisx; EnZo* this = (EnZo*)thisx;
Vec3s vec; Vec3s limbRot;
if (limbIndex == 15) { if (limbIndex == 15) {
Matrix_Translate(1800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(1800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
vec = this->interactInfo.headRot; limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1800.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(-1800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} }
if (limbIndex == 8) { if (limbIndex == 8) {
vec = this->interactInfo.torsoRot; limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) { if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {