mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-19 13:35:18 +00:00
Document NPC talking and player tracking (#1426)
* Rename npc dialog state variable * Rename and doc NPC actor talking funtion * Introduce NpcTalkState enum * Rename NPC_TALK_STATE enum values * Document NpcPlayerInteractionState and related functions * Rename player tracking opt enum variants * Rename npc functions, interact info * Minor npc actor function tweaks * Minor comment fixes for npc * Generalize NPC player tracking to point tracking * Change unused NpcInteractInfo field type and name Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Rename headRot and torsoRot * Rename GetTalkState to UpdateTalkState * Minor comment fixes * Rename rotateActorShape and clarify related comments * Remove unneeded parentheses in z_en_heishi4.c * Reformat * Remove unclear comment * Rename yPosOffset to yOffset Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
parent
9c35716fe2
commit
b57f2162ee
66 changed files with 936 additions and 808 deletions
|
@ -114,7 +114,7 @@ u16 func_80AA2AA0(PlayState* play, Actor* thisx) {
|
|||
}
|
||||
|
||||
s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
|
||||
s16 ret = 1;
|
||||
s16 ret = NPC_TALK_STATE_TALKING;
|
||||
|
||||
switch (Message_GetState(&play->msgCtx)) {
|
||||
case TEXT_STATE_EVENT:
|
||||
|
@ -145,7 +145,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
|
|||
switch (thisx->textId) {
|
||||
case 0x2000:
|
||||
SET_INFTABLE(INFTABLE_B8);
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
break;
|
||||
case 0x208F:
|
||||
SET_EVENTCHKINF(EVENTCHKINF_1E);
|
||||
|
@ -159,7 +159,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
|
|||
case 0x208E:
|
||||
CLEAR_EVENTINF(EVENTINF_HORSES_0A);
|
||||
thisx->flags &= ~ACTOR_FLAG_16;
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
gSaveContext.timerState = TIMER_STATE_STOP;
|
||||
break;
|
||||
case 0x2002:
|
||||
|
@ -167,11 +167,11 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
|
|||
FALLTHROUGH;
|
||||
case 0x2003:
|
||||
if (!GET_EVENTINF(EVENTINF_HORSES_0A)) {
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -189,17 +189,17 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
|
|||
|
||||
void func_80AA2E54(EnMa3* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
s16 phi_a3;
|
||||
s16 trackingMode;
|
||||
|
||||
if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) {
|
||||
phi_a3 = 1;
|
||||
if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->skelAnime.animation == &gMalonAdultSingAnim)) {
|
||||
trackingMode = NPC_TRACKING_NONE;
|
||||
} else {
|
||||
phi_a3 = 0;
|
||||
trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
|
||||
}
|
||||
|
||||
this->unk_1E0.unk_18 = player->actor.world.pos;
|
||||
this->unk_1E0.unk_14 = 0.0f;
|
||||
func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3);
|
||||
this->interactInfo.trackPos = player->actor.world.pos;
|
||||
this->interactInfo.yOffset = 0.0f;
|
||||
Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode);
|
||||
}
|
||||
|
||||
s32 func_80AA2EC8(EnMa3* this, PlayState* play) {
|
||||
|
@ -219,7 +219,7 @@ s32 func_80AA2F28(EnMa3* this) {
|
|||
if (this->skelAnime.animation != &gMalonAdultSingAnim) {
|
||||
return 0;
|
||||
}
|
||||
if (this->unk_1E0.unk_00 != 0) {
|
||||
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
|
||||
return 0;
|
||||
}
|
||||
this->blinkTimer = 0;
|
||||
|
@ -273,7 +273,7 @@ void EnMa3_Init(Actor* thisx, PlayState* play) {
|
|||
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->unk_1E0.unk_00 = (u16)0;
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
}
|
||||
|
||||
void EnMa3_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
@ -284,9 +284,9 @@ void EnMa3_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_80AA3200(EnMa3* this, PlayState* play) {
|
||||
if (this->unk_1E0.unk_00 == 2) {
|
||||
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_16;
|
||||
this->unk_1E0.unk_00 = 0;
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,9 +300,9 @@ void EnMa3_Update(Actor* thisx, PlayState* play) {
|
|||
EnMa3_UpdateEyes(this);
|
||||
this->actionFunc(this, play);
|
||||
func_80AA2E54(this, play);
|
||||
func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, func_80AA2AA0,
|
||||
func_80AA2BD4);
|
||||
if (this->unk_1E0.unk_00 == 0) {
|
||||
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 150.0f,
|
||||
func_80AA2AA0, func_80AA2BD4);
|
||||
if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
|
||||
if (this->isNotSinging) {
|
||||
// Turn on singing
|
||||
Audio_ToggleMalonSinging(false);
|
||||
|
@ -324,13 +324,13 @@ s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
}
|
||||
if (limbIndex == MALON_ADULT_LIMB_HEAD) {
|
||||
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
||||
vec = this->unk_1E0.unk_08;
|
||||
vec = this->interactInfo.headRot;
|
||||
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY);
|
||||
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
if (limbIndex == MALON_ADULT_LIMB_CHEST_AND_NECK) {
|
||||
vec = this->unk_1E0.unk_0E;
|
||||
vec = this->interactInfo.torsoRot;
|
||||
Matrix_RotateY(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct EnMa3 {
|
|||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnMa3ActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderCylinder collider;
|
||||
/* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
|
||||
/* 0x01E0 */ NpcInteractInfo interactInfo;
|
||||
/* 0x0208 */ s16 unk_208;
|
||||
/* 0x020A */ s16 isNotSinging;
|
||||
/* 0x020C */ s16 blinkTimer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue