mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-24 16:01:26 +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
|
@ -90,21 +90,21 @@ u16 func_80AA19A0(PlayState* play, Actor* thisx) {
|
|||
}
|
||||
|
||||
s16 func_80AA1A38(PlayState* play, Actor* thisx) {
|
||||
s16 ret = 1;
|
||||
s16 ret = NPC_TALK_STATE_TALKING;
|
||||
|
||||
switch (Message_GetState(&play->msgCtx)) {
|
||||
case TEXT_STATE_CLOSING:
|
||||
switch (thisx->textId) {
|
||||
case 0x2051:
|
||||
SET_INFTABLE(INFTABLE_8C);
|
||||
ret = 2;
|
||||
ret = NPC_TALK_STATE_ACTION;
|
||||
break;
|
||||
case 0x2053:
|
||||
SET_INFTABLE(INFTABLE_8D);
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
ret = NPC_TALK_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -123,18 +123,18 @@ s16 func_80AA1A38(PlayState* play, Actor* thisx) {
|
|||
|
||||
void func_80AA1AE4(EnMa2* 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;
|
||||
this->interactInfo.trackPos = player->actor.world.pos;
|
||||
this->interactInfo.yOffset = 0.0f;
|
||||
|
||||
func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3);
|
||||
Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode);
|
||||
}
|
||||
|
||||
u16 func_80AA1B58(EnMa2* this, PlayState* play) {
|
||||
|
@ -165,7 +165,7 @@ s32 func_80AA1C68(EnMa2* 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;
|
||||
|
@ -195,7 +195,7 @@ void EnMa2_ChangeAnim(EnMa2* this, s32 index) {
|
|||
|
||||
void func_80AA1DB4(EnMa2* this, PlayState* play) {
|
||||
if (this->skelAnime.animation == &gMalonAdultSingAnim) {
|
||||
if (this->unk_1E0.unk_00 == 0) {
|
||||
if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
|
||||
if (this->isNotSinging) {
|
||||
// Turn on singing
|
||||
Audio_ToggleMalonSinging(false);
|
||||
|
@ -246,7 +246,7 @@ void EnMa2_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->actor.targetMode = 6;
|
||||
this->unk_1E0.unk_00 = 0;
|
||||
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
|
||||
}
|
||||
|
||||
void EnMa2_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
@ -257,9 +257,9 @@ void EnMa2_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_80AA2018(EnMa2* 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,7 +300,7 @@ void func_80AA21C8(EnMa2* this, PlayState* play) {
|
|||
if (DECR(this->unk_208)) {
|
||||
player->stateFlags2 |= PLAYER_STATE2_23;
|
||||
} else {
|
||||
if (this->unk_1E0.unk_00 == 0) {
|
||||
if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
|
||||
this->actor.flags |= ACTOR_FLAG_16;
|
||||
Message_CloseTextbox(play);
|
||||
} else {
|
||||
|
@ -322,8 +322,8 @@ void EnMa2_Update(Actor* thisx, PlayState* play) {
|
|||
func_80AA1DB4(this, play);
|
||||
func_80AA1AE4(this, play);
|
||||
if (this->actionFunc != func_80AA20E4) {
|
||||
func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 30.0f, func_80AA19A0,
|
||||
func_80AA1A38);
|
||||
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f,
|
||||
func_80AA19A0, func_80AA1A38);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,13 +336,13 @@ s32 EnMa2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
}
|
||||
if (limbIndex == MALON_ADULT_HEAD_LIMB) {
|
||||
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_CHEST_AND_NECK_LIMB) {
|
||||
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 EnMa2 {
|
|||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnMa2ActionFunc 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