summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Koskela <luryus@users.noreply.github.com>2022-11-25 19:52:28 +0200
committerGitHub <noreply@github.com>2022-11-25 12:52:28 -0500
commitb57f2162ee71b23643fd4e4133f7455905c2969a (patch)
tree72253c04906f043ec0815ddf8c9ee9c6e5b6f893
parent9c35716fe2c0ff6447525c23a1364694e6ade01f (diff)
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>
-rw-r--r--include/functions.h9
-rw-r--r--include/z64.h11
-rw-r--r--include/z64actor.h31
-rw-r--r--src/code/z_actor.c316
-rw-r--r--src/overlays/actors/ovl_Demo_Im/z_demo_im.c46
-rw-r--r--src/overlays/actors/ovl_Demo_Im/z_demo_im.h2
-rw-r--r--src/overlays/actors/ovl_En_Cs/z_en_cs.c16
-rw-r--r--src/overlays/actors/ovl_En_Cs/z_en_cs.h2
-rw-r--r--src/overlays/actors/ovl_En_Daiku/z_en_daiku.c18
-rw-r--r--src/overlays/actors/ovl_En_Daiku/z_en_daiku.h2
-rw-r--r--src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c14
-rw-r--r--src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h2
-rw-r--r--src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c10
-rw-r--r--src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h2
-rw-r--r--src/overlays/actors/ovl_En_Du/z_en_du.c48
-rw-r--r--src/overlays/actors/ovl_En_Du/z_en_du.h2
-rw-r--r--src/overlays/actors/ovl_En_Go/z_en_go.c105
-rw-r--r--src/overlays/actors/ovl_En_Go/z_en_go.h2
-rw-r--r--src/overlays/actors/ovl_En_Go2/z_en_go2.c224
-rw-r--r--src/overlays/actors/ovl_En_Go2/z_en_go2.h4
-rw-r--r--src/overlays/actors/ovl_En_Guest/z_en_guest.c12
-rw-r--r--src/overlays/actors/ovl_En_Guest/z_en_guest.h2
-rw-r--r--src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c14
-rw-r--r--src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h2
-rw-r--r--src/overlays/actors/ovl_En_Hy/z_en_hy.c50
-rw-r--r--src/overlays/actors/ovl_En_Hy/z_en_hy.h2
-rw-r--r--src/overlays/actors/ovl_En_In/z_en_in.c102
-rw-r--r--src/overlays/actors/ovl_En_In/z_en_in.h2
-rw-r--r--src/overlays/actors/ovl_En_Ko/z_en_ko.c109
-rw-r--r--src/overlays/actors/ovl_En_Ko/z_en_ko.h2
-rw-r--r--src/overlays/actors/ovl_En_Kz/z_en_kz.c38
-rw-r--r--src/overlays/actors/ovl_En_Kz/z_en_kz.h2
-rw-r--r--src/overlays/actors/ovl_En_Ma1/z_en_ma1.c62
-rw-r--r--src/overlays/actors/ovl_En_Ma1/z_en_ma1.h2
-rw-r--r--src/overlays/actors/ovl_En_Ma2/z_en_ma2.c42
-rw-r--r--src/overlays/actors/ovl_En_Ma2/z_en_ma2.h2
-rw-r--r--src/overlays/actors/ovl_En_Ma3/z_en_ma3.c42
-rw-r--r--src/overlays/actors/ovl_En_Ma3/z_en_ma3.h2
-rw-r--r--src/overlays/actors/ovl_En_Md/z_en_md.c57
-rw-r--r--src/overlays/actors/ovl_En_Md/z_en_md.h2
-rw-r--r--src/overlays/actors/ovl_En_Mu/z_en_mu.c13
-rw-r--r--src/overlays/actors/ovl_En_Mu/z_en_mu.h2
-rw-r--r--src/overlays/actors/ovl_En_Nb/z_en_nb.c26
-rw-r--r--src/overlays/actors/ovl_En_Nb/z_en_nb.h2
-rw-r--r--src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c10
-rw-r--r--src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h2
-rw-r--r--src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c10
-rw-r--r--src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h2
-rw-r--r--src/overlays/actors/ovl_En_Ru1/z_en_ru1.c22
-rw-r--r--src/overlays/actors/ovl_En_Ru1/z_en_ru1.h2
-rw-r--r--src/overlays/actors/ovl_En_Sa/z_en_sa.c46
-rw-r--r--src/overlays/actors/ovl_En_Sa/z_en_sa.h2
-rw-r--r--src/overlays/actors/ovl_En_Tg/z_en_tg.c6
-rw-r--r--src/overlays/actors/ovl_En_Tg/z_en_tg.h3
-rw-r--r--src/overlays/actors/ovl_En_Tk/z_en_tk.c28
-rw-r--r--src/overlays/actors/ovl_En_Tk/z_en_tk.h4
-rw-r--r--src/overlays/actors/ovl_En_Toryo/z_en_toryo.c20
-rw-r--r--src/overlays/actors/ovl_En_Toryo/z_en_toryo.h2
-rw-r--r--src/overlays/actors/ovl_En_Xc/z_en_xc.c14
-rw-r--r--src/overlays/actors/ovl_En_Xc/z_en_xc.h2
-rw-r--r--src/overlays/actors/ovl_En_Zl3/z_en_zl3.c28
-rw-r--r--src/overlays/actors/ovl_En_Zl3/z_en_zl3.h2
-rw-r--r--src/overlays/actors/ovl_En_Zl4/z_en_zl4.c21
-rw-r--r--src/overlays/actors/ovl_En_Zl4/z_en_zl4.h2
-rw-r--r--src/overlays/actors/ovl_En_Zo/z_en_zo.c57
-rw-r--r--src/overlays/actors/ovl_En_Zo/z_en_zo.h4
66 files changed, 937 insertions, 809 deletions
diff --git a/include/functions.h b/include/functions.h
index 5d072fda4..3741806fb 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -484,10 +484,11 @@ void func_8003424C(PlayState* play, Vec3f* arg1);
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration);
Hilite* func_800342EC(Vec3f* object, PlayState* play);
Hilite* func_8003435C(Vec3f* object, PlayState* play);
-s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange,
- u16 (*unkFunc1)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*));
-s16 func_800347E8(s16 arg0);
-void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3);
+s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange,
+ NpcGetTextIdFunc getTextId, NpcUpdateTalkStateFunc updateTalkState);
+s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex);
+void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex,
+ s16 trackingMode);
void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, Actor* actor, s16 alpha);
void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw,
diff --git a/include/z64.h b/include/z64.h
index 3fb20884f..200b435c1 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -1329,17 +1329,6 @@ typedef struct {
/* 0x08 */ f32 morphFrames;
} AnimationMinimalInfo; // size = 0xC
-typedef struct {
- /* 0x00 */ s16 unk_00;
- /* 0x02 */ s16 unk_02;
- /* 0x04 */ s16 unk_04;
- /* 0x06 */ s16 unk_06;
- /* 0x08 */ Vec3s unk_08;
- /* 0x0E */ Vec3s unk_0E;
- /* 0x14 */ f32 unk_14;
- /* 0x18 */ Vec3f unk_18;
- /* 0x24 */ s16 unk_24;
-} struct_80034A14_arg1; // size = 0x28
// Macros for `EntranceInfo.field`
#define ENTRANCE_INFO_CONTINUE_BGM_FLAG (1 << 15)
diff --git a/include/z64actor.h b/include/z64actor.h
index 7088919f4..e6a933ca2 100644
--- a/include/z64actor.h
+++ b/include/z64actor.h
@@ -19,8 +19,8 @@ struct Lights;
typedef void (*ActorFunc)(struct Actor*, struct PlayState*);
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*);
-typedef u16 (*callback1_800343CC)(struct PlayState*, struct Actor*);
-typedef s16 (*callback2_800343CC)(struct PlayState*, struct Actor*);
+typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*);
+typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*);
typedef struct {
Vec3f pos;
@@ -532,4 +532,31 @@ typedef enum {
#define UPDBGCHECKINFO_FLAG_6 (1 << 6) // disable water ripples
#define UPDBGCHECKINFO_FLAG_7 (1 << 7) // alternate wall check?
+typedef enum {
+ /* 0x0 */ NPC_TALK_STATE_IDLE, // NPC not currently talking to player
+ /* 0x1 */ NPC_TALK_STATE_TALKING, // NPC is currently talking to player
+ /* 0x2 */ NPC_TALK_STATE_ACTION, // An NPC-defined action triggered in the conversation
+ /* 0x3 */ NPC_TALK_STATE_ITEM_GIVEN // NPC finished giving an item and text box is done
+} NpcTalkState;
+
+typedef enum {
+ /* 0x0 */ NPC_TRACKING_PLAYER_AUTO_TURN, // Determine tracking mode based on player position, see Npc_UpdateAutoTurn
+ /* 0x1 */ NPC_TRACKING_NONE, // Don't track the target (usually the player)
+ /* 0x2 */ NPC_TRACKING_HEAD_AND_TORSO, // Track target by turning the head and the torso
+ /* 0x3 */ NPC_TRACKING_HEAD, // Track target by turning the head
+ /* 0x4 */ NPC_TRACKING_FULL_BODY // Track target by turning the body, torso and head
+} NpcTrackingMode;
+
+typedef struct {
+ /* 0x00 */ s16 talkState;
+ /* 0x02 */ s16 trackingMode;
+ /* 0x04 */ s16 autoTurnTimer;
+ /* 0x06 */ s16 autoTurnState;
+ /* 0x08 */ Vec3s headRot;
+ /* 0x0E */ Vec3s torsoRot;
+ /* 0x14 */ f32 yOffset; // Y position offset to add to actor position when calculating angle to target
+ /* 0x18 */ Vec3f trackPos;
+ /* 0x24 */ char unk_24[0x4];
+} NpcInteractInfo; // size = 0x28
+
#endif
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 618f80f97..0f30255d8 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -3659,24 +3659,40 @@ Hilite* func_8003435C(Vec3f* object, PlayState* play) {
return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx);
}
-s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1,
- callback2_800343CC unkFunc2) {
+/**
+ * Updates NPC talking state. Checks for a talk request and updates
+ * the talkState parameter when a dialog is ongoing. Otherwise checks if
+ * the actor is onscreen, advertises the interaction in a range and sets
+ * the current text id if necessary.
+ *
+ * The talk state values are defined in the NpcTalkState enum.
+ *
+ * @see NpcTalkState
+ *
+ * @param[in,out] talkState Talk state
+ * @param interactRange The interact (talking) range for the actor
+ * @param getTextId Callback for getting the next text id
+ * @param updateTalkState Callback for getting the next talkState value
+ * @return True if a new dialog was started (player talked to the actor). False otherwise.
+ */
+s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId,
+ NpcUpdateTalkStateFunc updateTalkState) {
s16 x;
s16 y;
if (Actor_ProcessTalkRequest(actor, play)) {
- *arg2 = 1;
+ *talkState = NPC_TALK_STATE_TALKING;
return true;
}
- if (*arg2 != 0) {
- *arg2 = unkFunc2(play, actor);
+ if (*talkState != NPC_TALK_STATE_IDLE) {
+ *talkState = updateTalkState(play, actor);
return false;
}
Actor_GetScreenPos(play, actor, &x, &y);
-
if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) {
+ // Actor is offscreen
return false;
}
@@ -3684,162 +3700,242 @@ s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, c
return false;
}
- actor->textId = unkFunc1(play, actor);
+ actor->textId = getTextId(play, actor);
return false;
}
typedef struct {
- /* 0x00 */ s16 unk_00;
- /* 0x02 */ s16 unk_02;
- /* 0x04 */ s16 unk_04;
- /* 0x06 */ s16 unk_06;
- /* 0x08 */ s16 unk_08;
- /* 0x0A */ s16 unk_0A;
- /* 0x0C */ u8 unk_0C;
-} struct_80116130_0; // size = 0x10
+ /* 0x00 */ s16 maxHeadYaw;
+ /* 0x02 */ s16 minHeadPitch;
+ /* 0x04 */ s16 maxHeadPitch;
+ /* 0x06 */ s16 maxTorsoYaw;
+ /* 0x08 */ s16 minTorsoPitch;
+ /* 0x0A */ s16 maxTorsoPitch;
+ /* 0x0C */ u8 rotateYaw;
+} NpcTrackingRotLimits; // size = 0x10
typedef struct {
- /* 0x00 */ struct_80116130_0 sub_00;
- /* 0x10 */ f32 unk_10;
- /* 0x14 */ s16 unk_14;
-} struct_80116130; // size = 0x18
-
-static struct_80116130 D_80116130[] = {
- { { 0x2AA8, 0xF1C8, 0x18E2, 0x1554, 0x0000, 0x0000, 1 }, 170.0f, 0x3FFC },
- { { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, 1 }, 170.0f, 0x3FFC },
- { { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, 1 }, 170.0f, 0x3FFC },
- { { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, 1 }, 170.0f, 0x3FFC },
- { { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, 1 }, 170.0f, 0x3FFC },
- { { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, 1 }, 170.0f, 0x3FFC },
- { { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
- { { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 1 }, 0.0f, 0x0000 },
- { { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
- { { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
- { { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 1 }, 0.0f, 0x0000 },
- { { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 1 }, 0.0f, 0x0000 },
- { { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
+ /* 0x00 */ NpcTrackingRotLimits rotLimits;
+ // Fields specific to NPC_TRACKING_PLAYER_AUTO_TURN mode
+ /* 0x10 */ f32 autoTurnDistanceRange; // Max distance to player to enable tracking and auto-turn
+ /* 0x14 */ s16 maxYawForPlayerTracking; // Player is tracked if within this yaw
+} NpcTrackingParams; // size = 0x18
+
+/**
+ * Npc tracking angle limit presets to use with Npc_TrackPoint.
+ *
+ * @see Npc_TrackPoint
+ */
+static NpcTrackingParams sNpcTrackingPresets[] = {
+ { { 0x2AA8, -0x0E38, 0x18E2, 0x1554, 0x0000, 0x0000, true }, 170.0f, 0x3FFC },
+ { { 0x2AA8, -0x1554, 0x1554, 0x1554, -0x071C, 0x0E38, true }, 170.0f, 0x3FFC },
+ { { 0x31C4, -0x1C70, 0x0E38, 0x0E38, -0x0E38, 0x071C, true }, 170.0f, 0x3FFC },
+ { { 0x1554, -0x0E38, 0x0000, 0x071C, -0x071C, 0x0000, true }, 170.0f, 0x3FFC },
+ { { 0x2AA8, -0x071C, 0x071C, 0x0E38, -0x2AA8, 0x2AA8, true }, 170.0f, 0x3FFC },
+ { { 0x0000, -0x1C70, 0x2AA8, 0x3FFC, -0x0E38, 0x0E38, true }, 170.0f, 0x3FFC },
+ { { 0x2AA8, -0x0E38, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
+ { { 0x2AA8, -0x0E38, 0x0000, 0x0E38, 0x0000, 0x1C70, true }, 0.0f, 0x0000 },
+ { { 0x2AA8, -0x0E38, -0x0E38, 0x0000, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
+ { { 0x071C, -0x0E38, 0x0E38, 0x1C70, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
+ { { 0x0E38, -0x0E38, 0x0000, 0x1C70, 0x0000, 0x0E38, true }, 0.0f, 0x0000 },
+ { { 0x2AA8, -0x1C70, 0x1C70, 0x0E38, -0x0E38, 0x0E38, true }, 0.0f, 0x0000 },
+ { { 0x18E2, -0x0E38, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 },
};
-void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7,
- u8 arg8) {
- s16 sp46;
- s16 sp44;
- s16 temp2;
- s16 sp40;
- s16 temp1;
- Vec3f sp30;
+/**
+ * Smoothly turns the actor's whole body and updates torso and head rotations in
+ * NpcInteractInfo so that the actor tracks the point specified in NpcInteractInfo.trackPos.
+ * Rotations are limited to specified angles.
+ *
+ * Head and torso rotation angles are determined by calculating the pitch and yaw
+ * from the actor position to the given target position.
+ *
+ * The y position of the actor is offset by NpcInteractInfo.yOffset
+ * before calculating the angles. It can be used to configure the height difference
+ * between the actor and the target.
+ *
+ * @param maxHeadYaw maximum head yaw difference from neutral position
+ * @param maxHeadPitch maximum head pitch angle
+ * @param minHeadPitch minimum head pitch angle
+ * @param maxTorsoYaw maximum torso yaw difference from neutral position
+ * @param maxTorsoPitch maximum torso pitch angle
+ * @param minTorsoPitch minimum torso pitch angle
+ * @param rotateYaw if true, the actor's yaw (shape.rot.y) is updated to turn the actor's whole body
+ */
+void Npc_TrackPointWithLimits(Actor* actor, NpcInteractInfo* interactInfo, s16 maxHeadYaw, s16 maxHeadPitch,
+ s16 minHeadPitch, s16 maxTorsoYaw, s16 maxTorsoPitch, s16 minTorsoPitch, u8 rotateYaw) {
+ s16 pitchTowardsTarget;
+ s16 yawTowardsTarget;
+ s16 torsoPitch;
+ s16 bodyYawDiff;
+ s16 temp;
+ Vec3f offsetActorPos;
- sp30.x = actor->world.pos.x;
- sp30.y = actor->world.pos.y + arg1->unk_14;
- sp30.z = actor->world.pos.z;
+ offsetActorPos.x = actor->world.pos.x;
+ offsetActorPos.y = actor->world.pos.y + interactInfo->yOffset;
+ offsetActorPos.z = actor->world.pos.z;
- sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18);
- sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18);
- sp40 = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18) - actor->shape.rot.y;
+ pitchTowardsTarget = Math_Vec3f_Pitch(&offsetActorPos, &interactInfo->trackPos);
+ yawTowardsTarget = Math_Vec3f_Yaw(&offsetActorPos, &interactInfo->trackPos);
+ bodyYawDiff = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos) - actor->shape.rot.y;
- temp1 = CLAMP(sp40, -arg2, arg2);
- Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1);
+ temp = CLAMP(bodyYawDiff, -maxHeadYaw, maxHeadYaw);
+ Math_SmoothStepToS(&interactInfo->headRot.y, temp, 6, 2000, 1);
- temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
- arg1->unk_08.y = CLAMP(arg1->unk_08.y, -temp1, temp1);
+ temp = (ABS(bodyYawDiff) >= 0x8000) ? 0 : ABS(bodyYawDiff);
+ interactInfo->headRot.y = CLAMP(interactInfo->headRot.y, -temp, temp);
- sp40 -= arg1->unk_08.y;
+ bodyYawDiff -= interactInfo->headRot.y;
- temp1 = CLAMP(sp40, -arg5, arg5);
- Math_SmoothStepToS(&arg1->unk_0E.y, temp1, 6, 2000, 1);
+ temp = CLAMP(bodyYawDiff, -maxTorsoYaw, maxTorsoYaw);
+ Math_SmoothStepToS(&interactInfo->torsoRot.y, temp, 6, 2000, 1);
- temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
- arg1->unk_0E.y = CLAMP(arg1->unk_0E.y, -temp1, temp1);
+ temp = (ABS(bodyYawDiff) >= 0x8000) ? 0 : ABS(bodyYawDiff);
+ interactInfo->torsoRot.y = CLAMP(interactInfo->torsoRot.y, -temp, temp);
- if (arg8) {
- Math_SmoothStepToS(&actor->shape.rot.y, sp44, 6, 2000, 1);
+ if (rotateYaw) {
+ Math_SmoothStepToS(&actor->shape.rot.y, yawTowardsTarget, 6, 2000, 1);
}
- temp1 = CLAMP(sp46, arg4, (s16)(u16)arg3);
- Math_SmoothStepToS(&arg1->unk_08.x, temp1, 6, 2000, 1);
+ temp = CLAMP(pitchTowardsTarget, minHeadPitch, (s16)(u16)maxHeadPitch);
+ Math_SmoothStepToS(&interactInfo->headRot.x, temp, 6, 2000, 1);
- temp2 = sp46 - arg1->unk_08.x;
+ torsoPitch = pitchTowardsTarget - interactInfo->headRot.x;
- temp1 = CLAMP(temp2, arg7, arg6);
- Math_SmoothStepToS(&arg1->unk_0E.x, temp1, 6, 2000, 1);
+ temp = CLAMP(torsoPitch, minTorsoPitch, maxTorsoPitch);
+ Math_SmoothStepToS(&interactInfo->torsoRot.x, temp, 6, 2000, 1);
}
-s16 func_800347E8(s16 arg0) {
- return D_80116130[arg0].unk_14;
+s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex) {
+ return sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking;
}
-s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, s16 arg4) {
+/**
+ * Handles NPC tracking modes and auto-turning towards the player when
+ * NPC_TRACKING_PLAYER_AUTO_TURN tracking mode is used.
+ *
+ * Returns a tracking mode that will determine which actor limbs
+ * will be rotated towards the target.
+ *
+ * When the player is behind the actor (i.e. not in the yaw range in front of the actor
+ * defined by maxYawForPlayerTracking), the actor will start an auto-turn sequence:
+ * - look forward for 30-60 frames
+ * - turn head to look at the player for 10-20 frames
+ * - look forward for 30-60 frames
+ * - turn the entire body to face the player
+ *
+ * @param distanceRange Max distance to player that tracking and auto-turning will be active for
+ * @param maxYawForPlayerTracking Maximum angle for tracking the player.
+ * @param trackingMode The tracking mode selected by the actor. If this is not
+ * NPC_TRACKING_PLAYER_AUTO_TURN this function does nothing
+ *
+ * @return The tracking mode (NpcTrackingMode) to use for the current frame.
+ */
+s16 Npc_UpdateAutoTurn(Actor* actor, NpcInteractInfo* interactInfo, f32 distanceRange, s16 maxYawForPlayerTracking,
+ s16 trackingMode) {
+
s32 pad;
- s16 var;
- s16 abs_var;
+ s16 yaw;
+ s16 yawDiff;
- if (arg4 != 0) {
- return arg4;
+ if (trackingMode != NPC_TRACKING_PLAYER_AUTO_TURN) {
+ return trackingMode;
}
- if (arg1->unk_00 != 0) {
- return 4;
+ if (interactInfo->talkState != NPC_TALK_STATE_IDLE) {
+ // When talking, always fully turn to face the player
+ return NPC_TRACKING_FULL_BODY;
}
- if (arg2 < Math_Vec3f_DistXYZ(&actor->world.pos, &arg1->unk_18)) {
- arg1->unk_04 = 0;
- arg1->unk_06 = 0;
- return 1;
+ if (distanceRange < Math_Vec3f_DistXYZ(&actor->world.pos, &interactInfo->trackPos)) {
+ // Player is too far away, do not track
+ interactInfo->autoTurnTimer = 0;
+ interactInfo->autoTurnState = 0;
+ return NPC_TRACKING_NONE;
}
- var = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18);
- abs_var = ABS((s16)((f32)var - actor->shape.rot.y));
- if (arg3 >= abs_var) {
- arg1->unk_04 = 0;
- arg1->unk_06 = 0;
- return 2;
+ yaw = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos);
+ yawDiff = ABS((s16)((f32)yaw - actor->shape.rot.y));
+ if (maxYawForPlayerTracking >= yawDiff) {
+ // Player is in front of the actor, track with the head and the torso
+ interactInfo->autoTurnTimer = 0;
+ interactInfo->autoTurnState = 0;
+ return NPC_TRACKING_HEAD_AND_TORSO;
}
- if (DECR(arg1->unk_04) != 0) {
- return arg1->unk_02;
+ // Player is behind the actor, run the auto-turn sequence.
+
+ if (DECR(interactInfo->autoTurnTimer) != 0) {
+ // While the timer is still running, return the previous tracking mode
+ return interactInfo->trackingMode;
}
- switch (arg1->unk_06) {
+ switch (interactInfo->autoTurnState) {
case 0:
case 2:
- arg1->unk_04 = Rand_S16Offset(30, 30);
- arg1->unk_06++;
- return 1;
+ // Just stand still, not tracking the player
+ interactInfo->autoTurnTimer = Rand_S16Offset(30, 30);
+ interactInfo->autoTurnState++;
+ return NPC_TRACKING_NONE;
case 1:
- arg1->unk_04 = Rand_S16Offset(10, 10);
- arg1->unk_06++;
- return 3;
+ // Glance at the player by only turning the head
+ interactInfo->autoTurnTimer = Rand_S16Offset(10, 10);
+ interactInfo->autoTurnState++;
+ return NPC_TRACKING_HEAD;
}
- return 4;
+ // Auto-turn sequence complete, turn towards the player
+ return NPC_TRACKING_FULL_BODY;
}
-void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) {
- struct_80116130_0 sp38;
+/**
+ * Rotates the actor's whole body, torso and head tracking the point specified in NpcInteractInfo.trackPos.
+ * Uses angle limits from a preset selected from from sNpcTrackingPresets.
+ *
+ * The trackingMode parameter controls whether the head and torso are turned towards the target.
+ * If not, they are smoothly turned towards zero. Setting the parameter to NPC_TRACKING_FULL_BODY
+ * causes the actor's whole body to be rotated to face the target.
+ *
+ * If NPC_TRACKING_PLAYER_AUTO_TURN is used, the actor will track the player with its head and torso as long
+ * as the player is in front of the actor (within a yaw angle specified in the option preset).
+ * If the player is outside of this angle, the actor will turn to face the player after a while.
+ *
+ * @see Npc_UpdateAutoTurn
+ * @see sNpcTrackingPresets
+ * @see NpcTrackingMode
+ *
+ * @param presetIndex The index to a preset in sNpcTrackingPresets
+ * @param trackingMode A value from NpcTrackingMode enum
+ */
+void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex, s16 trackingMode) {
+ NpcTrackingRotLimits rotLimits;
- arg1->unk_02 = func_80034810(actor, arg1, D_80116130[arg2].unk_10, D_80116130[arg2].unk_14, arg3);
+ interactInfo->trackingMode =
+ Npc_UpdateAutoTurn(actor, interactInfo, sNpcTrackingPresets[presetIndex].autoTurnDistanceRange,
+ sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking, trackingMode);
- sp38 = D_80116130[arg2].sub_00;
+ rotLimits = sNpcTrackingPresets[presetIndex].rotLimits;
- switch (arg1->unk_02) {
- case 1:
- sp38.unk_00 = 0;
- sp38.unk_04 = 0;
- sp38.unk_02 = 0;
+ switch (interactInfo->trackingMode) {
+ case NPC_TRACKING_NONE:
+ rotLimits.maxHeadYaw = 0;
+ rotLimits.maxHeadPitch = 0;
+ rotLimits.minHeadPitch = 0;
FALLTHROUGH;
- case 3:
- sp38.unk_06 = 0;
- sp38.unk_0A = 0;
- sp38.unk_08 = 0;
+ case NPC_TRACKING_HEAD:
+ rotLimits.maxTorsoYaw = 0;
+ rotLimits.maxTorsoPitch = 0;
+ rotLimits.minTorsoPitch = 0;
FALLTHROUGH;
- case 2:
- sp38.unk_0C = 0;
+ case NPC_TRACKING_HEAD_AND_TORSO:
+ rotLimits.rotateYaw = false;
break;
}
- func_800344BC(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, sp38.unk_06, sp38.unk_0A, sp38.unk_08,
- sp38.unk_0C);
+ Npc_TrackPointWithLimits(actor, interactInfo, rotLimits.maxHeadYaw, rotLimits.maxHeadPitch, rotLimits.minHeadPitch,
+ rotLimits.maxTorsoYaw, rotLimits.maxTorsoPitch, rotLimits.minTorsoPitch,
+ rotLimits.rotateYaw);
}
Gfx* func_80034B28(GraphicsContext* gfxCtx) {
diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c
index 3ede44a0f..44e52b91d 100644
--- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c
+++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c
@@ -166,44 +166,44 @@ void DemoIm_UpdateCollider(DemoIm* this, PlayState* play) {
void func_80984DB8(DemoIm* this) {
s32 pad[2];
- Vec3s* vec1 = &this->unk_2D4.unk_08;
- Vec3s* vec2 = &this->unk_2D4.unk_0E;
+ Vec3s* headRot = &this->interactInfo.headRot;
+ Vec3s* torsoRot = &this->interactInfo.torsoRot;
- Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100);
- Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100);
+ Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100);
+ Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100);
- Math_SmoothStepToS(&vec2->x, 0, 20, 6200, 100);
- Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100);
+ Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100);
+ Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100);
}
void func_80984E58(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 yawDiff;
- s16 phi_a3;
+ s16 npcTrackingMode;
- this->unk_2D4.unk_18 = player->actor.world.pos;
- this->unk_2D4.unk_14 = kREG(16) + 4.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) + 4.0f;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
- phi_a3 = (ABS(yawDiff) < 0x18E3) ? 2 : 1;
- func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, phi_a3);
+ npcTrackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, npcTrackingMode);
}
void func_80984F10(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_2D4.unk_18 = player->actor.world.pos;
- this->unk_2D4.unk_14 = kREG(16) + 12.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) + 12.0f;
- func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_HEAD_AND_TORSO);
}
void func_80984F94(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_2D4.unk_18 = player->actor.world.pos;
- this->unk_2D4.unk_14 = kREG(16) + 4.0f;
- func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 4);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) + 4.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_FULL_BODY);
}
void DemoIm_UpdateBgCheckInfo(DemoIm* this, PlayState* play) {
@@ -1137,17 +1137,17 @@ s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
s32* unk_2D0 = &this->unk_2D0;
if (this->unk_280 != 0) {
- Vec3s* unk_2D4_unk_0E = &this->unk_2D4.unk_0E;
- Vec3s* unk_2D4_unk_08 = &this->unk_2D4.unk_08;
+ Vec3s* torsoRot = &this->interactInfo.torsoRot;
+ Vec3s* headRot = &this->interactInfo.headRot;
switch (limbIndex) {
case IMPA_LIMB_CHEST:
- rot->x += unk_2D4_unk_0E->y;
- rot->y -= unk_2D4_unk_0E->x;
+ rot->x += torsoRot->y;
+ rot->y -= torsoRot->x;
break;
case IMPA_LIMB_HEAD:
- rot->x += unk_2D4_unk_08->y;
- rot->z += unk_2D4_unk_08->x;
+ rot->x += headRot->y;
+ rot->z += headRot->x;
break;
}
}
diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h
index 97192b39a..97511e042 100644
--- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h
+++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h
@@ -48,7 +48,7 @@ typedef struct DemoIm {
/* 0x0280 */ s32 unk_280;
/* 0x0284 */ ColliderCylinder collider;
/* 0x02D0 */ s32 unk_2D0;
- /* 0x02D4 */ struct_80034A14_arg1 unk_2D4;
+ /* 0x02D4 */ NpcInteractInfo interactInfo;
} DemoIm; // size = 0x02FC
#endif
diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c
index 81845a20e..37a746779 100644
--- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c
+++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c
@@ -403,10 +403,10 @@ void EnCs_Talk(EnCs* this, PlayState* play) {
}
this->flag |= 1;
- this->npcInfo.unk_18.x = player->actor.focus.pos.x;
- this->npcInfo.unk_18.y = player->actor.focus.pos.y;
- this->npcInfo.unk_18.z = player->actor.focus.pos.z;
- func_80034A14(&this->actor, &this->npcInfo, 0, 4);
+ this->interactInfo.trackPos.x = player->actor.focus.pos.x;
+ this->interactInfo.trackPos.y = player->actor.focus.pos.y;
+ this->interactInfo.trackPos.z = player->actor.focus.pos.z;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_FULL_BODY);
if (this->talkState == 0) {
EnCs_ChangeAnim(this, ENCS_ANIM_0, &this->currentAnimIndex);
@@ -494,12 +494,12 @@ s32 EnCs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (this->flag & 1) {
switch (limbIndex) {
case 8:
- rot->x += this->npcInfo.unk_0E.y;
- rot->y -= this->npcInfo.unk_0E.x;
+ rot->x += this->interactInfo.torsoRot.y;
+ rot->y -= this->interactInfo.torsoRot.x;
break;
case 15:
- rot->x += this->npcInfo.unk_08.y;
- rot->z += this->npcInfo.unk_08.x;
+ rot->x += this->interactInfo.headRot.y;
+ rot->z += this->interactInfo.headRot.x;
break;
}
}
diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.h b/src/overlays/actors/ovl_En_Cs/z_en_cs.h
index 0bc667652..843c8ad51 100644
--- a/src/overlays/actors/ovl_En_Cs/z_en_cs.h
+++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.h
@@ -28,7 +28,7 @@ typedef struct EnCs {
/* 0x0210 */ s32 currentAnimIndex;
/* 0x0214 */ char unk_214[4];
/* 0x0218 */ MtxF spookyMaskMtx;
- /* 0x0258 */ struct_80034A14_arg1 npcInfo;
+ /* 0x0258 */ NpcInteractInfo interactInfo;
/* 0x0280 */ s32 flag;
/* 0x0284 */ Vec3s jointTable[16];
/* 0x02E4 */ Vec3s morphTable[16];
diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
index 5284740e3..68bfc0056 100644
--- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
+++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
@@ -573,14 +573,14 @@ void EnDaiku_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->stateFlags & ENDAIKU_STATEFLAG_1) {
- this->unk_244.unk_18.x = player->actor.focus.pos.x;
- this->unk_244.unk_18.y = player->actor.focus.pos.y;
- this->unk_244.unk_18.z = player->actor.focus.pos.z;
+ this->interactInfo.trackPos.x = player->actor.focus.pos.x;
+ this->interactInfo.trackPos.y = player->actor.focus.pos.y;
+ this->interactInfo.trackPos.z = player->actor.focus.pos.z;
if (this->stateFlags & ENDAIKU_STATEFLAG_2) {
- func_80034A14(&this->actor, &this->unk_244, 0, 4);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_FULL_BODY);
} else {
- func_80034A14(&this->actor, &this->unk_244, 0, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_HEAD_AND_TORSO);
}
}
}
@@ -613,12 +613,12 @@ s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos,
switch (limb) {
case 8: // torso
- rot->x += this->unk_244.unk_0E.y;
- rot->y -= this->unk_244.unk_0E.x;
+ rot->x += this->interactInfo.torsoRot.y;
+ rot->y -= this->interactInfo.torsoRot.x;
break;
case 15: // head
- rot->x += this->unk_244.unk_08.y;
- rot->z += this->unk_244.unk_08.x;
+ rot->x += this->interactInfo.headRot.y;
+ rot->z += this->interactInfo.headRot.x;
break;
}
diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h
index 4bfe98513..82b7a0634 100644
--- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h
+++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h
@@ -30,7 +30,7 @@ typedef struct EnDaiku {
/* 0x0230 */ Vec3f subCamAt;
/* 0x023C */ s32 stateFlags;
/* 0x0240 */ s32 startFightSwitchFlag;
- /* 0x0244 */ struct_80034A14_arg1 unk_244; // probably related to animating torso and head towards the player
+ /* 0x0244 */ NpcInteractInfo interactInfo;
/* 0x026C */ Vec3s jointTable[17];
/* 0x02D2 */ Vec3s morphTable[17];
/* 0x0338 */ Vec3s initRot;
diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c
index d04f3b983..fb557df8d 100644
--- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c
+++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c
@@ -474,18 +474,18 @@ void EnDaikuKakariko_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
- this->npcInfo.unk_18.x = player->actor.focus.pos.x;
- this->npcInfo.unk_18.y = player->actor.focus.pos.y;
- this->npcInfo.unk_18.z = player->actor.focus.pos.z;
+ this->interactInfo.trackPos.x = player->actor.focus.pos.x;
+ this->interactInfo.trackPos.y = player->actor.focus.pos.y;
+ this->interactInfo.trackPos.z = player->actor.focus.pos.z;
if (this->flags & 0x100) {
this->neckAngleTarget.x = 5900;
this->flags |= 0x1000;
- func_80034A14(&this->actor, &this->npcInfo, 0, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_HEAD_AND_TORSO);
} else if (this->flags & 0x200) {
this->neckAngleTarget.x = 5900;
this->flags |= 0x1000;
- func_80034A14(&this->actor, &this->npcInfo, 0, 4);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_FULL_BODY);
}
Math_SmoothStepToS(&this->neckAngle.x, this->neckAngleTarget.x, 1, 1820, 0);
@@ -497,13 +497,13 @@ s32 EnDaikuKakariko_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList
switch (limbIndex) {
case 8:
- angle = this->npcInfo.unk_0E;
+ angle = this->interactInfo.torsoRot;
Matrix_RotateX(-BINANG_TO_RAD(angle.y), MTXMODE_APPLY);
Matrix_RotateZ(-BINANG_TO_RAD(angle.x), MTXMODE_APPLY);
break;
case 15:
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- angle = this->npcInfo.unk_08;
+ angle = this->interactInfo.headRot;
if (this->flags & 0x1000) {
osSyncPrintf("<%d>\n", this->neckAngle.x);
diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h
index ad87945ca..5d3596d58 100644
--- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h
+++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h
@@ -22,7 +22,7 @@ typedef struct EnDaikuKakariko {
/* 0x01FC */ s32 run; // If true the carpenter will run
/* 0x0200 */ u16 flags;
/* 0x0202 */ u16 runFlag;
- /* 0x0204 */ struct_80034A14_arg1 npcInfo; // Info related to NPCs and turning their head towards the player
+ /* 0x0204 */ NpcInteractInfo interactInfo;
/* 0x022C */ Vec3s jointTable[17];
/* 0x0292 */ Vec3s morphTable[17];
/* 0x02F8 */ s32 timer;
diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
index 049ff5fc9..8b55fabd9 100644
--- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
+++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
@@ -520,11 +520,11 @@ void EnDivingGame_Update(Actor* thisx, PlayState* play2) {
}
this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 80.0f);
- this->unk_324.unk_18 = player->actor.world.pos;
- this->unk_324.unk_18.y = player->actor.world.pos.y;
- func_80034A14(&this->actor, &this->unk_324, 2, 4);
- this->vec_284 = this->unk_324.unk_08;
- this->vec_28A = this->unk_324.unk_0E;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.trackPos.y = player->actor.world.pos.y;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
+ this->vec_284 = this->interactInfo.headRot;
+ this->vec_28A = this->interactInfo.torsoRot;
if ((play->gameplayFrames % 16) == 0) {
pos = this->actor.world.pos;
pos.y += 20.0f;
diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h
index dbc1ede7a..d88217b5f 100644
--- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h
+++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h
@@ -45,7 +45,7 @@ typedef struct EnDivingGame {
/* 0x031E */ u8 allRupeesThrown; // flag
/* 0x031F */ u8 unk_31F; // flag
/* 0x0320 */ char unk_320[0x4]; // unused
- /* 0x0324 */ struct_80034A14_arg1 unk_324;
+ /* 0x0324 */ NpcInteractInfo interactInfo;
/* 0x034C */ ColliderCylinder collider;
} EnDivingGame; // size = 0x0398
diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c
index 1dcbcb350..e54d962ad 100644
--- a/src/overlays/actors/ovl_En_Du/z_en_du.c
+++ b/src/overlays/actors/ovl_En_Du/z_en_du.c
@@ -130,19 +130,19 @@ s16 func_809FDCDC(PlayState* play, Actor* actor) {
break;
case 0x301C:
case 0x301F:
- return 2;
+ return NPC_TALK_STATE_ACTION;
case 0x3020:
SET_EVENTCHKINF(EVENTCHKINF_22);
break;
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_DONE_FADING:
case TEXT_STATE_CHOICE:
case TEXT_STATE_EVENT:
break;
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
- return 3;
+ return NPC_TALK_STATE_ITEM_GIVEN;
}
break;
case TEXT_STATE_SONG_DEMO_DONE:
@@ -150,7 +150,7 @@ s16 func_809FDCDC(PlayState* play, Actor* actor) {
case TEXT_STATE_9:
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
s32 func_809FDDB4(EnDu* this, PlayState* play) {
@@ -164,17 +164,17 @@ s32 func_809FDDB4(EnDu* this, PlayState* play) {
void func_809FDE24(EnDu* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 phi_a3 = 0;
+ s16 trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
- if (this->unk_1F4.unk_00 == 0) {
- phi_a3 = 1;
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
+ trackingMode = NPC_TRACKING_NONE;
}
if (this->actionFunc == func_809FE890) {
- phi_a3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- this->unk_1F4.unk_18 = player->actor.world.pos;
- this->unk_1F4.unk_14 = 10.0f;
- func_80034A14(&this->actor, &this->unk_1F4, 3, phi_a3);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = 10.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 3, trackingMode);
}
void func_809FDE9C(EnDu* this) {
@@ -292,7 +292,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_0);
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 1;
- this->unk_1F4.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
if (gSaveContext.cutsceneIndex >= 0xFFF0) {
play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs);
@@ -327,9 +327,9 @@ void func_809FE3C0(EnDu* this, PlayState* play) {
EnDu_SetupAction(this, func_809FE4A4);
return;
}
- if (this->unk_1F4.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
func_8002DF54(play, &this->actor, 7);
- this->unk_1F4.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
if (this->actor.xzDistToPlayer < 116.0f + this->collider.dim.radius) {
player->stateFlags2 |= PLAYER_STATE2_23;
@@ -377,13 +377,13 @@ void func_809FE6CC(EnDu* this, PlayState* play) {
if (DECR(this->unk_1E2) == 0) {
this->actor.textId = 0x3039;
Message_StartTextbox(play, this->actor.textId, NULL);
- this->unk_1F4.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
EnDu_SetupAction(this, func_809FE740);
}
}
void func_809FE740(EnDu* this, PlayState* play) {
- if (this->unk_1F4.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
func_8005B1A4(GET_ACTIVE_CAM(play));
this->unk_1E2 = 0x5A;
EnDu_SetupAction(this, func_809FE798);
@@ -504,11 +504,11 @@ void func_809FEB08(EnDu* this, PlayState* play) {
}
Message_StartTextbox(play, this->actor.textId, NULL);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_14);
- this->unk_1F4.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
}
void func_809FEC14(EnDu* this, PlayState* play) {
- if (this->unk_1F4.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
func_8002DF54(play, &this->actor, 7);
EnDu_SetupAction(this, func_809FEC70);
func_809FEC70(this, play);
@@ -527,8 +527,8 @@ void func_809FEC70(EnDu* this, PlayState* play) {
}
void func_809FECE4(EnDu* this, PlayState* play) {
- if (this->unk_1F4.unk_00 == 3) {
- this->unk_1F4.unk_00 = 0;
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
EnDu_SetupAction(this, func_809FE3C0);
}
}
@@ -560,8 +560,8 @@ void EnDu_Update(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
if (this->actionFunc != func_809FE4A4) {
- func_800343CC(play, &this->actor, &this->unk_1F4.unk_00, this->collider.dim.radius + 116.0f, func_809FDC38,
- func_809FDCDC);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 116.0f,
+ func_809FDC38, func_809FDCDC);
}
this->actionFunc(this, play);
}
@@ -572,13 +572,13 @@ s32 EnDu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == 16) {
Matrix_Translate(2400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp1C = this->unk_1F4.unk_08;
+ sp1C = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY);
Matrix_Translate(-2400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
- sp1C = this->unk_1F4.unk_0E;
+ sp1C = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.h b/src/overlays/actors/ovl_En_Du/z_en_du.h
index c7a3ec69c..541b4368e 100644
--- a/src/overlays/actors/ovl_En_Du/z_en_du.h
+++ b/src/overlays/actors/ovl_En_Du/z_en_du.h
@@ -26,7 +26,7 @@ typedef struct EnDu {
/* 0x01F0 */ u8 mouthTexIndex;
/* 0x01F1 */ u8 noseTexIndex;
/* 0x01F2 */ s16 blinkTimer;
- /* 0x01F4 */ struct_80034A14_arg1 unk_1F4;
+ /* 0x01F4 */ NpcInteractInfo interactInfo;
} EnDu; // size = 0x021C
#endif
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c
index 7859bc31b..cbf3aa5c4 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -195,8 +195,8 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) {
}
}
-s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
- s16 unkState = 1;
+s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) {
+ s16 unkState = NPC_TALK_STATE_TALKING;
f32 xzRange;
f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f;
@@ -207,51 +207,51 @@ s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
switch (thisx->textId) {
case 0x3008:
SET_INFTABLE(INFTABLE_E0);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x300B:
SET_INFTABLE(INFTABLE_EB);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3014:
SET_INFTABLE(INFTABLE_F0);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3016:
SET_INFTABLE(INFTABLE_F4);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3018:
SET_INFTABLE(INFTABLE_F8);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3036:
func_8002F434(thisx, play, GI_TUNIC_GORON, xzRange, yRange);
SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
break;
case 0x3037:
SET_INFTABLE(INFTABLE_10E);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3041:
SET_INFTABLE(INFTABLE_10F);
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
case 0x3059:
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
break;
case 0x3052:
case 0x3054:
case 0x3055:
case 0x305A:
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
break;
case 0x305E:
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
break;
default:
- unkState = 0;
+ unkState = NPC_TALK_STATE_IDLE;
break;
}
break;
@@ -269,7 +269,7 @@ s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
thisx->textId = 0x300D;
}
Message_ContinueTextbox(play, thisx->textId);
- unkState = 1;
+ unkState = NPC_TALK_STATE_TALKING;
break;
case 0x3034:
if (play->msgCtx.choiceIndex == 0) {
@@ -284,16 +284,16 @@ s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
thisx->textId = 0x3033;
}
Message_ContinueTextbox(play, thisx->textId);
- unkState = 1;
+ unkState = NPC_TALK_STATE_TALKING;
break;
case 0x3054:
case 0x3055:
if (play->msgCtx.choiceIndex == 0) {
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
} else {
thisx->textId = 0x3056;
Message_ContinueTextbox(play, thisx->textId);
- unkState = 1;
+ unkState = NPC_TALK_STATE_TALKING;
}
SET_INFTABLE(INFTABLE_B4);
break;
@@ -310,17 +310,17 @@ s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
case 0x3033:
thisx->textId = 0x3034;
Message_ContinueTextbox(play, thisx->textId);
- unkState = 1;
+ unkState = NPC_TALK_STATE_TALKING;
break;
default:
- unkState = 2;
+ unkState = NPC_TALK_STATE_ACTION;
break;
}
}
break;
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
- unkState = 3;
+ unkState = NPC_TALK_STATE_ITEM_GIVEN;
}
break;
case TEXT_STATE_NONE:
@@ -333,13 +333,13 @@ s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
return unkState;
}
-s32 func_80A3ED24(PlayState* play, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3,
- u16 (*getTextId)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)) {
- if (arg2->unk_00) {
- arg2->unk_00 = unkFunc2(play, &this->actor);
+s32 func_80A3ED24(PlayState* play, EnGo* this, NpcInteractInfo* interactInfo, f32 arg3, NpcGetTextIdFunc getTextId,
+ NpcUpdateTalkStateFunc updateTalkState) {
+ if (interactInfo->talkState != NPC_TALK_STATE_IDLE) {
+ interactInfo->talkState = updateTalkState(play, &this->actor);
return false;
} else if (Actor_ProcessTalkRequest(&this->actor, play)) {
- arg2->unk_00 = 1;
+ interactInfo->talkState = NPC_TALK_STATE_TALKING;
return true;
} else if (!func_8002F2CC(&this->actor, play, arg3)) {
return false;
@@ -396,16 +396,16 @@ f32 EnGo_GetGoronSize(EnGo* this) {
void func_80A3F060(EnGo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 unkVal;
+ s16 npcTrackingMode;
if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc &&
this->actionFunc != func_80A40B1C) {
- unkVal = 1;
+ npcTrackingMode = NPC_TRACKING_NONE;
}
- this->unk_1E0.unk_18 = player->actor.world.pos;
- this->unk_1E0.unk_14 = EnGo_GetGoronSize(this);
- func_80034A14(&this->actor, &this->unk_1E0, 4, unkVal);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = EnGo_GetGoronSize(this);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 4, npcTrackingMode);
}
void func_80A3F0E4(EnGo* this) {
@@ -544,7 +544,7 @@ s32 EnGo_SpawnDust(EnGo* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 nu
s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) {
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) {
return false;
- } else if (this->unk_1E0.unk_00 != 0) {
+ } else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
return true;
} else if (DECR(this->unk_21C)) {
if (this->unk_21C & 1) {
@@ -586,10 +586,11 @@ void func_80A3F908(EnGo* this, PlayState* play) {
}
if ((this->actor.params & 0xF0) == 0x90) {
- isUnkCondition = func_80A3ED24(play, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates);
+ isUnkCondition =
+ func_80A3ED24(play, this, &this->interactInfo, float1, EnGo_GetTextID, EnGo_UpdateTalkState);
} else {
- isUnkCondition = func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID,
- EnGo_SetFlagsGetStates);
+ isUnkCondition = Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, float1,
+ EnGo_GetTextID, EnGo_UpdateTalkState);
}
if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) {
@@ -642,7 +643,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) {
EnGo_ChangeAnim(this, ENGO_ANIM_0);
this->actor.targetMode = 6;
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actor.gravity = -1.0f;
switch (this->actor.params & 0xF0) {
@@ -855,26 +856,26 @@ void func_80A405CC(EnGo* this, PlayState* play) {
}
void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
- if (((this->actor.params & 0xF0) == 0x90) && (this->unk_1E0.unk_00 == 2)) {
+ if (((this->actor.params & 0xF0) == 0x90) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
if (gSaveContext.bgsFlag) {
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
} else {
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) {
EnGo_ChangeAnim(this, ENGO_ANIM_2);
this->unk_21E = 100;
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
EnGo_SetupAction(this, EnGo_Eyedrops);
play->msgCtx.msgMode = MSGMODE_PAUSED;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN);
} else {
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
EnGo_SetupAction(this, EnGo_GetItem);
Message_CloseTextbox(play);
EnGo_GetItem(this, play);
}
}
- } else if (((this->actor.params & 0xF0) == 0) && (this->unk_1E0.unk_00 == 2)) {
+ } else if (((this->actor.params & 0xF0) == 0) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) {
EnGo_SetupAction(this, EnGo_GetItem);
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
@@ -947,7 +948,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) {
s32 getItemId;
if (Actor_HasParent(&this->actor, play)) {
- this->unk_1E0.unk_00 = 2;
+ this->interactInfo.talkState = NPC_TALK_STATE_ACTION;
this->actor.parent = NULL;
EnGo_SetupAction(this, func_80A40C78);
} else {
@@ -976,21 +977,21 @@ void EnGo_GetItem(EnGo* this, PlayState* play) {
}
void func_80A40C78(EnGo* this, PlayState* play) {
- if (this->unk_1E0.unk_00 == 3) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
EnGo_SetupAction(this, EnGo_BiggoronActionFunc);
if ((this->actor.params & 0xF0) != 0x90) {
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
} else if (this->unk_20C) {
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
gSaveContext.bgsFlag = true;
} else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) {
this->actor.textId = 0x3058;
Message_ContinueTextbox(play, this->actor.textId);
- this->unk_1E0.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
} else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) {
this->actor.textId = 0x305C;
Message_ContinueTextbox(play, this->actor.textId);
- this->unk_1E0.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
Environment_ClearBgsDayCount();
}
}
@@ -1000,13 +1001,13 @@ void EnGo_Eyedrops(EnGo* this, PlayState* play) {
if (DECR(this->unk_21E) == 0) {
this->actor.textId = 0x305A;
Message_ContinueTextbox(play, this->actor.textId);
- this->unk_1E0.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
EnGo_SetupAction(this, func_80A40DCC);
}
}
void func_80A40DCC(EnGo* this, PlayState* play) {
- if (this->unk_1E0.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
EnGo_ChangeAnim(this, ENGO_ANIM_1);
this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930);
Message_CloseTextbox(play);
@@ -1030,7 +1031,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) {
EnGo_UpdateShadow(this);
- if (this->unk_1E0.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
Actor_MoveForward(&this->actor);
}
@@ -1085,7 +1086,7 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve
if (limb == 17) {
Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- vec1 = this->unk_1E0.unk_08;
+ vec1 = this->interactInfo.headRot;
float1 = BINANG_TO_RAD_ALT(vec1.y);
Matrix_RotateX(float1, MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
@@ -1094,7 +1095,7 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve
}
if (limb == 10) {
- vec1 = this->unk_1E0.unk_0E;
+ vec1 = this->interactInfo.torsoRot;
float1 = BINANG_TO_RAD_ALT(vec1.y);
Matrix_RotateY(float1, MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h
index 43c098f9a..e18efcf81 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.h
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.h
@@ -43,7 +43,7 @@ typedef struct EnGo {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnGoActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ char unk_208[0x4];
/* 0x020C */ s16 unk_20C;
/* 0x020E */ s16 unk_20E;
diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
index 3770dea4d..be1b30c92 100644
--- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c
+++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
@@ -41,7 +41,7 @@ EnGo2
(this->actor.params & 0xFC00) >> 0xA - Gorons in Fire Temple
this->actor.params & 0x1F
-Gorons only move when this->unk_194.unk_00 == 0
+Gorons only move when this->interactInfo.talkState == NPC_TALK_STATE_IDLE
*/
void EnGo2_Init(Actor* thisx, PlayState* play);
@@ -329,12 +329,12 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityRollingBig(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityRollingBig(PlayState* play, EnGo2* this) {
s32 bombBagUpgrade;
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING:
- return 2;
+ return NPC_TALK_STATE_ACTION;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
if (this->actor.textId == 0x3012) {
@@ -343,14 +343,14 @@ s16 EnGo2_GetStateGoronCityRollingBig(PlayState* play, EnGo2* this) {
EnGo2_GetItem(this, play, bombBagUpgrade);
Message_CloseTextbox(play);
SET_INFTABLE(INFTABLE_11E);
- return 2;
+ return NPC_TALK_STATE_ACTION;
} else {
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
}
FALLTHROUGH;
default:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -359,14 +359,14 @@ u16 EnGo2_GetTextIdGoronDmtBombFlower(PlayState* play, EnGo2* this) {
}
// DMT Goron by Bomb Flower Choice
-s16 EnGo2_GetStateGoronDmtBombFlower(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronDmtBombFlower(PlayState* play, EnGo2* this) {
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING:
if ((this->actor.textId == 0x300B) && !GET_INFTABLE(INFTABLE_EB)) {
SET_INFTABLE(INFTABLE_EB);
- return 2;
+ return NPC_TALK_STATE_ACTION;
} else {
- return 0;
+ return NPC_TALK_STATE_IDLE;
}
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
@@ -379,11 +379,11 @@ s16 EnGo2_GetStateGoronDmtBombFlower(PlayState* play, EnGo2* this) {
}
Message_ContinueTextbox(play, this->actor.textId);
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
FALLTHROUGH;
default:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -395,11 +395,11 @@ u16 EnGo2_GetTextIdGoronDmtRollingSmall(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronDmtRollingSmall(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronDmtRollingSmall(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -413,14 +413,14 @@ u16 EnGo2_GetTextIdGoronDmtDcEntrance(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronDmtDcEntrance(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronDmtDcEntrance(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3008) {
SET_INFTABLE(INFTABLE_E0);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -434,14 +434,14 @@ u16 EnGo2_GetTextIdGoronCityEntrance(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityEntrance(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityEntrance(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3014) {
SET_INFTABLE(INFTABLE_F0);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -455,14 +455,14 @@ u16 EnGo2_GetTextIdGoronCityIsland(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityIsland(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityIsland(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3016) {
SET_INFTABLE(INFTABLE_F4);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -479,14 +479,14 @@ u16 EnGo2_GetTextIdGoronCityLowestFloor(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityLowestFloor(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityLowestFloor(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3018) {
SET_INFTABLE(INFTABLE_F8);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -504,19 +504,19 @@ u16 EnGo2_GetTextIdGoronCityLink(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityLink(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityLink(PlayState* play, EnGo2* this) {
switch (EnGo2_GetDialogState(this, play)) {
case TEXT_STATE_CLOSING:
switch (this->actor.textId) {
case 0x3036:
EnGo2_GetItem(this, play, GI_TUNIC_GORON);
this->actionFunc = EnGo2_SetupGetItem;
- return 2;
+ return NPC_TALK_STATE_ACTION;
case 0x3037:
SET_INFTABLE(INFTABLE_10E);
FALLTHROUGH;
default:
- return 0;
+ return NPC_TALK_STATE_IDLE;
}
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
@@ -538,7 +538,7 @@ s16 EnGo2_GetStateGoronCityLink(PlayState* play, EnGo2* this) {
} else {
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
switch (this->actor.textId) {
@@ -549,14 +549,14 @@ s16 EnGo2_GetStateGoronCityLink(PlayState* play, EnGo2* this) {
case 0x3033:
this->actor.textId = 0x3034;
Message_ContinueTextbox(play, this->actor.textId);
- return 1;
+ return NPC_TALK_STATE_TALKING;
default:
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
}
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
u16 EnGo2_GetTextIdGoronDmtBiggoron(PlayState* play, EnGo2* this) {
@@ -577,7 +577,7 @@ u16 EnGo2_GetTextIdGoronDmtBiggoron(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) {
s32 unusedPad;
u8 dialogState = this->dialogState;
@@ -587,12 +587,12 @@ s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) {
if (!gSaveContext.bgsFlag) {
EnGo2_GetItem(this, play, GI_SWORD_BIGGORON);
this->actionFunc = EnGo2_SetupGetItem;
- return 2;
+ return NPC_TALK_STATE_ACTION;
} else {
- return 0;
+ return NPC_TALK_STATE_IDLE;
}
} else {
- return 0;
+ return NPC_TALK_STATE_IDLE;
}
case TEXT_STATE_DONE_FADING:
switch (this->actor.textId) {
@@ -613,19 +613,19 @@ s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) {
}
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
if ((this->actor.textId == 0x3054) || (this->actor.textId == 0x3055)) {
if (play->msgCtx.choiceIndex == 0) {
EnGo2_GetItem(this, play, GI_PRESCRIPTION);
this->actionFunc = EnGo2_SetupGetItem;
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
this->actor.textId = 0x3056;
Message_ContinueTextbox(play, this->actor.textId);
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
break;
case TEXT_STATE_EVENT:
@@ -634,11 +634,11 @@ s16 EnGo2_GetStateGoronDmtBiggoron(PlayState* play, EnGo2* this) {
play->msgCtx.msgMode = MSGMODE_PAUSED;
this->actionFunc = EnGo2_BiggoronEyedrops;
}
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) {
@@ -649,21 +649,21 @@ u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronFireGeneric(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronFireGeneric(PlayState* play, EnGo2* this) {
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING:
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
if (this->actor.textId == 0x3071) {
this->actor.textId = EnGo2_GoronFireGenericGetTextId(this);
Message_ContinueTextbox(play, this->actor.textId);
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
FALLTHROUGH;
default:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -671,14 +671,14 @@ u16 EnGo2_GetTextIdGoronCityStairwell(PlayState* play, EnGo2* this) {
return !LINK_IS_ADULT ? GET_INFTABLE(INFTABLE_E3) ? 0x3022 : 0x300E : 0x3043;
}
-s16 EnGo2_GetStateGoronCityStairwell(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityStairwell(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x300E) {
SET_INFTABLE(INFTABLE_E3);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -687,11 +687,11 @@ u16 EnGo2_GetTextIdGoronMarketBazaar(PlayState* play, EnGo2* this) {
return 0x7122;
}
-s16 EnGo2_GetStateGoronMarketBazaar(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronMarketBazaar(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -707,14 +707,14 @@ u16 EnGo2_GetTextIdGoronCityLostWoods(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronCityLostWoods(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronCityLostWoods(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3024) {
SET_INFTABLE(INFTABLE_E6);
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -727,11 +727,11 @@ u16 EnGo2_GetTextIdGoronDmtFairyHint(PlayState* play, EnGo2* this) {
}
}
-s16 EnGo2_GetStateGoronDmtFairyHint(PlayState* play, EnGo2* this) {
+s16 EnGo2_UpdateTalkStateGoronDmtFairyHint(PlayState* play, EnGo2* this) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
- return 0;
+ return NPC_TALK_STATE_IDLE;
} else {
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -778,37 +778,37 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) {
#endif
}
-s16 EnGo2_GetState(PlayState* play, Actor* thisx) {
+s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) {
EnGo2* this = (EnGo2*)thisx;
switch (this->actor.params & 0x1F) {
case GORON_CITY_ROLLING_BIG:
- return EnGo2_GetStateGoronCityRollingBig(play, this);
+ return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this);
case GORON_CITY_LINK:
- return EnGo2_GetStateGoronCityLink(play, this);
+ return EnGo2_UpdateTalkStateGoronCityLink(play, this);
case GORON_DMT_BIGGORON:
- return EnGo2_GetStateGoronDmtBiggoron(play, this);
+ return EnGo2_UpdateTalkStateGoronDmtBiggoron(play, this);
case GORON_FIRE_GENERIC:
- return EnGo2_GetStateGoronFireGeneric(play, this);
+ return EnGo2_UpdateTalkStateGoronFireGeneric(play, this);
case GORON_DMT_BOMB_FLOWER:
- return EnGo2_GetStateGoronDmtBombFlower(play, this);
+ return EnGo2_UpdateTalkStateGoronDmtBombFlower(play, this);
case GORON_DMT_ROLLING_SMALL:
- return EnGo2_GetStateGoronDmtRollingSmall(play, this);
+ return EnGo2_UpdateTalkStateGoronDmtRollingSmall(play, this);
case GORON_DMT_DC_ENTRANCE:
- return EnGo2_GetStateGoronDmtDcEntrance(play, this);
+ return EnGo2_UpdateTalkStateGoronDmtDcEntrance(play, this);
case GORON_CITY_ENTRANCE:
- return EnGo2_GetStateGoronCityEntrance(play, this);
+ return EnGo2_UpdateTalkStateGoronCityEntrance(play, this);
case GORON_CITY_ISLAND:
- return EnGo2_GetStateGoronCityIsland(play, this);
+ return EnGo2_UpdateTalkStateGoronCityIsland(play, this);
case GORON_CITY_LOWEST_FLOOR:
- return EnGo2_GetStateGoronCityLowestFloor(play, this);
+ return EnGo2_UpdateTalkStateGoronCityLowestFloor(play, this);
case GORON_CITY_STAIRWELL:
- return EnGo2_GetStateGoronCityStairwell(play, this);
+ return EnGo2_UpdateTalkStateGoronCityStairwell(play, this);
case GORON_CITY_LOST_WOODS:
- return EnGo2_GetStateGoronCityLostWoods(play, this);
+ return EnGo2_UpdateTalkStateGoronCityLostWoods(play, this);
case GORON_DMT_FAIRY_HINT:
- return EnGo2_GetStateGoronDmtFairyHint(play, this);
+ return EnGo2_UpdateTalkStateGoronDmtFairyHint(play, this);
case GORON_MARKET_BAZAAR:
- return EnGo2_GetStateGoronMarketBazaar(play, this);
+ return EnGo2_UpdateTalkStateGoronMarketBazaar(play, this);
}
#ifdef AVOID_UB
// The v0 register isn't set in this function, the last value in v0 is the return value of Actor_ProcessTalkRequest
@@ -819,16 +819,17 @@ s16 EnGo2_GetState(PlayState* play, Actor* thisx) {
s32 func_80A44790(EnGo2* this, PlayState* play) {
if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) {
- return func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, EnGo2_GetState);
+ return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unk_218, EnGo2_GetTextId,
+ EnGo2_UpdateTalkState);
} else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) &&
!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
return false;
} else {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- this->unk_194.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
return true;
- } else if (this->unk_194.unk_00 != 0) {
- this->unk_194.unk_00 = EnGo2_GetState(play, &this->actor);
+ } else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ this->interactInfo.talkState = EnGo2_UpdateTalkState(play, &this->actor);
return false;
} else if (func_8002F2CC(&this->actor, play, this->unk_218)) {
this->actor.textId = EnGo2_GetTextId(play, &this->actor);
@@ -1089,9 +1090,9 @@ void func_80A45288(EnGo2* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->actionFunc != EnGo2_GoronFireGenericAction) {
- this->unk_194.unk_18 = player->actor.world.pos;
- this->unk_194.unk_14 = D_80A482D8[this->actor.params & 0x1F][((void)0, gSaveContext.linkAge)];
- func_80034A14(&this->actor, &this->unk_194, 4, this->unk_26E);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = D_80A482D8[this->actor.params & 0x1F][((void)0, gSaveContext.linkAge)];
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode);
}
if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) {
if (func_80A44790(this, play)) {
@@ -1111,7 +1112,7 @@ void func_80A45360(EnGo2* this, f32* alpha) {
void EnGo2_RollForward(EnGo2* this) {
f32 speedXZ = this->actor.speedXZ;
- if (this->unk_194.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->actor.speedXZ = 0.0f;
}
@@ -1182,13 +1183,13 @@ s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) {
void EnGo2_DefaultWakingUp(EnGo2* this) {
if (EnGo2_IsWakingUp(this)) {
- this->unk_26E = 2;
+ this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
}
- if (this->unk_194.unk_00 != 0) {
- this->unk_26E = 4;
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ this->trackingMode = NPC_TRACKING_FULL_BODY;
}
this->isAwake = true;
@@ -1199,20 +1200,20 @@ void EnGo2_WakingUp(EnGo2* this) {
s32 isTrue = true;
xyzDist = SQ(xyzDist);
- this->unk_26E = 1;
- if ((this->actor.xyzDistToPlayerSq <= xyzDist) || (this->unk_194.unk_00 != 0)) {
- this->unk_26E = 4;
+ this->trackingMode = NPC_TRACKING_NONE;
+ if ((this->actor.xyzDistToPlayerSq <= xyzDist) || (this->interactInfo.talkState != NPC_TALK_STATE_IDLE)) {
+ this->trackingMode = NPC_TRACKING_FULL_BODY;
}
this->isAwake = isTrue;
}
void EnGo2_BiggoronWakingUp(EnGo2* this) {
- if (EnGo2_IsWakingUp(this) || this->unk_194.unk_00 != 0) {
- this->unk_26E = 2;
+ if (EnGo2_IsWakingUp(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
this->isAwake = true;
} else {
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->isAwake = false;
}
}
@@ -1221,7 +1222,7 @@ void EnGo2_SelectGoronWakingUp(EnGo2* this) {
switch (this->actor.params & 0x1F) {
case GORON_DMT_BOMB_FLOWER:
this->isAwake = true;
- this->unk_26E = EnGo2_IsWakingUp(this) ? 2 : 1;
+ this->trackingMode = EnGo2_IsWakingUp(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
break;
case GORON_FIRE_GENERIC:
EnGo2_WakingUp(this);
@@ -1308,7 +1309,7 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) {
this->skelAnime.playSpeed = -1.0f;
}
EnGo2_SwapInitialFrameAnimFrameCount(this);
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->unk_211 = false;
this->isAwake = false;
this->actionFunc = EnGo2_CurledUp;
@@ -1393,30 +1394,31 @@ s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) {
}
s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) {
- if ((this->actor.params & 0x1F) != GORON_DMT_BOMB_FLOWER || this->unk_194.unk_00 != 2) {
+ if ((this->actor.params & 0x1F) != GORON_DMT_BOMB_FLOWER || this->interactInfo.talkState != NPC_TALK_STATE_ACTION) {
return false;
}
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_3);
- this->unk_194.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->isAwake = false;
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->actionFunc = EnGo2_GoronDmtBombFlowerAnimation;
return true;
}
s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) {
- if ((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG || (this->unk_194.unk_00 != 2)) {
+ if ((this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG ||
+ (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) {
return false;
}
- this->unk_194.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
EnGo2_RollingAnimation(this, play);
this->actionFunc = EnGo2_GoronRollingBigContinueRolling;
return true;
}
s32 EnGo2_IsGoronFireGeneric(EnGo2* this) {
- if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC || this->unk_194.unk_00 == 0) {
+ if ((this->actor.params & 0x1F) != GORON_FIRE_GENERIC || this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
return false;
}
this->actionFunc = EnGo2_GoronFireGenericAction;
@@ -1432,7 +1434,7 @@ s32 EnGo2_IsGoronLinkReversing(EnGo2* this) {
}
s32 EnGo2_IsRolling(EnGo2* this) {
- if (this->unk_194.unk_00 == 0 || this->actor.speedXZ < 1.0f) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || this->actor.speedXZ < 1.0f) {
return false;
}
if (EnGo2_IsRollingOnGround(this, 2, 20.0 / 3.0f, 0)) {
@@ -1500,7 +1502,7 @@ void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) {
void EnGo2_BiggoronAnimation(EnGo2* this) {
if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS &&
- (this->actor.params & 0x1F) == GORON_DMT_BIGGORON && this->unk_194.unk_00 == 0) {
+ (this->actor.params & 0x1F) == GORON_DMT_BIGGORON && this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (DECR(this->animTimer) == 0) {
this->animTimer = Rand_S16Offset(30, 30);
func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_EYE_BIG, 60);
@@ -1546,7 +1548,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) {
this->goronState = 0;
this->waypoint = 0;
this->unk_216 = this->actor.shape.rot.z;
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->path = Path_GetByIndex(play, (this->actor.params & 0x3E0) >> 5, 0x1F);
switch (this->actor.params & 0x1F) {
case GORON_CITY_ENTRANCE:
@@ -1796,7 +1798,7 @@ void EnGo2_SetupGetItem(EnGo2* this, PlayState* play) {
void EnGo2_SetGetItem(EnGo2* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
- this->unk_194.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
switch (this->getItemId) {
case GI_CLAIM_CHECK:
Environment_ClearBgsDayCount();
@@ -1825,7 +1827,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5);
this->actor.flags &= ~ACTOR_FLAG_0;
this->actor.shape.rot.y += 0x5B0;
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->animTimer = this->skelAnime.endFrame + 60.0f + 60.0f; // eyeDrops animation timer
this->eyeMouthTexState = 2;
this->unk_20C = 0;
@@ -1855,7 +1857,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1);
this->actor.flags |= ACTOR_FLAG_0;
- this->unk_26E = 2;
+ this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
this->skelAnime.playSpeed = 0.0f;
this->skelAnime.curFrame = this->skelAnime.endFrame;
EnGo2_GetItem(this, play, GI_CLAIM_CHECK);
@@ -1888,7 +1890,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) {
player->actor.freezeTimer = 10;
} else {
SET_INFTABLE(INFTABLE_10C);
- this->unk_26E = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->unk_211 = false;
this->isAwake = false;
this->actionFunc = EnGo2_CurledUp;
@@ -1912,8 +1914,8 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) {
this->animTimer = 60;
this->actor.gravity = 0.0f;
this->actor.speedXZ = 2.0f;
- this->unk_194.unk_08 = D_80A4854C;
- this->unk_194.unk_0E = D_80A4854C;
+ this->interactInfo.headRot = D_80A4854C;
+ this->interactInfo.torsoRot = D_80A4854C;
this->goronState++;
this->goronState++;
player->actor.world.rot.y = this->actor.world.rot.y;
@@ -1976,7 +1978,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) {
EnGo2_RollForward(this);
Actor_UpdateBgCheckInfo(play, &this->actor, (f32)this->collider.dim.height * 0.5f,
(f32)this->collider.dim.radius * 0.6f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
- if (this->unk_194.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
func_80A44AB0(this, play);
}
this->actionFunc(this, play);
@@ -2026,7 +2028,7 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V
if (limb == 17) {
Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- vec1 = this->unk_194.unk_08;
+ vec1 = this->interactInfo.headRot;
float1 = BINANG_TO_RAD_ALT(vec1.y);
Matrix_RotateX(float1, MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
@@ -2034,7 +2036,7 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V
Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limb == 10) {
- vec1 = this->unk_194.unk_0E;
+ vec1 = this->interactInfo.torsoRot;
float1 = BINANG_TO_RAD_ALT(vec1.y);
Matrix_RotateY(float1, MTXMODE_APPLY);
float1 = BINANG_TO_RAD_ALT(vec1.x);
diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h
index e6580cd26..d7fb9b6d0 100644
--- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h
+++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h
@@ -71,7 +71,7 @@ typedef struct EnGo2 {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnGo2ActionFunc actionFunc;
- /* 0x0194 */ struct_80034A14_arg1 unk_194;
+ /* 0x0194 */ NpcInteractInfo interactInfo;
/* 0x01BC */ ColliderCylinder collider;
/* 0x0208 */ Path* path;
/* 0x020C */ u8 unk_20C; // counter for GORON_CITY_LINK animation
@@ -94,7 +94,7 @@ typedef struct EnGo2 {
/* 0x0224 */ s16 blinkTimer;
/* 0x0226 */ s16 unk_226[18]; // Remains unknown
/* 0x024A */ s16 unk_24A[18]; // Remains unknown
- /* 0x026E */ u16 unk_26E; // Remains unknown = 1, 2, or 4: used in func_80034A14
+ /* 0x026E */ u16 trackingMode;
/* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT];
/* 0x04A0 */ Vec3f subCamEye;
/* 0x04AC */ Vec3f subCamAt;
diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c
index 54a9570d5..9a66656f1 100644
--- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c
+++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c
@@ -150,13 +150,13 @@ void func_80A505CC(Actor* thisx, PlayState* play) {
func_80A5046C(this);
this->actionFunc(this, play);
- this->unk_2A0.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (LINK_IS_ADULT) {
- this->unk_2A0.unk_14 = 10.0f;
+ this->interactInfo.yOffset = 10.0f;
} else {
- this->unk_2A0.unk_14 = 20.0f;
+ this->interactInfo.yOffset = 20.0f;
}
- func_80034A14(&this->actor, &this->unk_2A0, 6, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 6, NPC_TRACKING_HEAD_AND_TORSO);
func_80034F54(play, this->unk_2CC, this->unk_2EC, 16);
@@ -188,14 +188,14 @@ s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (limbIndex == 15) {
*dList = object_boj_DL_0059B0;
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp3C = this->unk_2A0.unk_08;
+ sp3C = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp3C.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
- sp3C = this->unk_2A0.unk_0E;
+ sp3C = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp3C.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp3C.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/src/overlays/actors/ovl_En_Guest/z_en_guest.h
index d99514686..2835a6d8c 100644
--- a/src/overlays/actors/ovl_En_Guest/z_en_guest.h
+++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.h
@@ -15,7 +15,7 @@ typedef struct EnGuest {
/* 0x01F0 */ Vec3s morphTable[16];
/* 0x0250 */ EnGuestActionFunc actionFunc;
/* 0x0254 */ ColliderCylinder collider;
- /* 0x02A0 */ struct_80034A14_arg1 unk_2A0;
+ /* 0x02A0 */ NpcInteractInfo interactInfo;
/* 0x02C8 */ s16 unk_2C8;
/* 0x02CA */ s16 unk_2CA;
/* 0x02CC */ s16 unk_2CC[16];
diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c
index 9d4b978f1..e18627d09 100644
--- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c
+++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c
@@ -93,7 +93,7 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_80A56544;
break;
}
- this->unk_27C = ((thisx->params >> 8) & 0xFF);
+ this->unk_27C = (thisx->params >> 8) & 0xFF;
osSyncPrintf("\n\n");
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 兵士2セット完了! ☆☆☆☆☆ %d\n" VT_RST, thisx->params);
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 識別完了!\t ☆☆☆☆☆ %d\n" VT_RST, this->type);
@@ -293,7 +293,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) {
s16 reactionOffset;
SkelAnime_Update(&this->skelAnime);
- reactionOffset = (this->type - 4);
+ reactionOffset = this->type - 4;
if (reactionOffset < 0) {
reactionOffset = 0;
}
@@ -347,13 +347,13 @@ void EnHeishi4_Update(Actor* thisx, PlayState* play) {
thisx->world.pos.z = this->pos.z;
Actor_SetFocus(thisx, this->height);
if (this->type != HEISHI4_AT_MARKET_DYING) {
- this->unk_28C.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (!LINK_IS_ADULT) {
- this->unk_28C.unk_18.y = (player->actor.world.pos.y - 10.0f);
+ this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
}
- func_80034A14(thisx, &this->unk_28C, 2, 4);
- this->unk_260 = this->unk_28C.unk_08;
- this->unk_266 = this->unk_28C.unk_0E;
+ Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
+ this->unk_260 = this->interactInfo.headRot;
+ this->unk_266 = this->interactInfo.torsoRot;
}
this->unk_27E += 1;
this->actionFunc(this, play);
diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h
index 0d254f432..44889af87 100644
--- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h
+++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h
@@ -31,7 +31,7 @@ typedef struct EnHeishi4 {
/* 0x0282 */ s16 unk_282;
/* 0x0284 */ s16 unk_284;
/* 0x0288 */ f32 unk_288;
- /* 0x028C */ struct_80034A14_arg1 unk_28C;
+ /* 0x028C */ NpcInteractInfo interactInfo;
/* 0x02B4 */ u8 unk_2B4;
/* 0x02B6 */ char unk_2B6[7];
/* 0x02BC */ ColliderCylinder collider;
diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c
index e14cfb821..4fc3dcb86 100644
--- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c
+++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c
@@ -565,7 +565,7 @@ s16 func_80A70058(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8:
case TEXT_STATE_9:
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_DONE_FADING:
switch (this->actor.textId) {
case 0x709E:
@@ -587,7 +587,7 @@ s16 func_80A70058(PlayState* play, Actor* thisx) {
}
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CLOSING:
switch (this->actor.textId) {
case 0x70F0:
@@ -663,16 +663,16 @@ s16 func_80A70058(PlayState* play, Actor* thisx) {
this->actionFunc = func_80A714C4;
break;
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_EVENT:
if (!Message_ShouldAdvance(play)) {
- return 1;
+ return NPC_TALK_STATE_TALKING;
} else {
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
void EnHy_UpdateEyes(EnHy* this) {
@@ -762,42 +762,46 @@ void func_80A70834(EnHy* this, PlayState* play) {
void func_80A70978(EnHy* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 phi_a3;
+ s16 trackingMode;
switch (this->actor.params & 0x7F) {
case ENHY_TYPE_BOJ_3:
case ENHY_TYPE_BJI_7:
case ENHY_TYPE_BOJ_9:
case ENHY_TYPE_BOJ_10:
- phi_a3 = (this->unk_1E8.unk_00 == 0) ? 1 : 2;
+ trackingMode =
+ (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) ? NPC_TRACKING_NONE : NPC_TRACKING_HEAD_AND_TORSO;
break;
case ENHY_TYPE_BOJ_12:
- phi_a3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
break;
case ENHY_TYPE_AHG_2:
case ENHY_TYPE_AHG_17:
- phi_a3 = 4;
+ trackingMode = NPC_TRACKING_FULL_BODY;
break;
case ENHY_TYPE_AOB:
case ENHY_TYPE_BOB_18:
- phi_a3 = (this->unk_1E8.unk_00 == 0) ? 2 : 4;
+ trackingMode = (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) ? NPC_TRACKING_HEAD_AND_TORSO
+ : NPC_TRACKING_FULL_BODY;
break;
default:
- phi_a3 = 2;
+ trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
break;
}
- this->unk_1E8.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (LINK_IS_ADULT) {
- this->unk_1E8.unk_14 = sInit1Info[this->actor.params & 0x7F].unkValueAdult;
+ this->interactInfo.yOffset = sInit1Info[this->actor.params & 0x7F].unkValueAdult;
} else {
- this->unk_1E8.unk_14 = sInit1Info[this->actor.params & 0x7F].unkValueChild;
+ this->interactInfo.yOffset = sInit1Info[this->actor.params & 0x7F].unkValueChild;
}
- func_80034A14(&this->actor, &this->unk_1E8, sInit1Info[this->actor.params & 0x7F].unkPresetIndex, phi_a3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, sInit1Info[this->actor.params & 0x7F].unkPresetIndex,
+ trackingMode);
- if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->unkRange, func_80A6F810, func_80A70058)) {
+ if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unkRange, func_80A6F810,
+ func_80A70058)) {
func_80A70834(this, play);
}
}
@@ -966,7 +970,7 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) {
}
void func_80A710F8(EnHy* this, PlayState* play) {
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (this->skelAnime.animation != &gObjOsAnim_0BFC) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_26);
}
@@ -1016,11 +1020,11 @@ void func_80A7134C(EnHy* this, PlayState* play) {
s16 yaw;
f32 distSq;
- if ((this->skelAnime.animation == &gObjOsAnim_2160) && (this->unk_1E8.unk_00 != 0)) {
+ if ((this->skelAnime.animation == &gObjOsAnim_2160) && (this->interactInfo.talkState != NPC_TALK_STATE_IDLE)) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_8);
}
- if ((this->skelAnime.animation == &gObjOsAnim_265C) && (this->unk_1E8.unk_00 == 0)) {
+ if ((this->skelAnime.animation == &gObjOsAnim_265C) && (this->interactInfo.talkState == NPC_TALK_STATE_IDLE)) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7);
}
@@ -1082,7 +1086,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
EnHy_UpdateEyes(this);
- if (this->unk_1E8.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
Actor_MoveForward(&this->actor);
}
@@ -1121,14 +1125,14 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == 15) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp48 = this->unk_1E8.unk_08;
+ sp48 = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp48.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
- sp48 = this->unk_1E8.unk_0E;
+ sp48 = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp48.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp48.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h
index 53d86a416..41f1ea8f3 100644
--- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h
+++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h
@@ -44,7 +44,7 @@ typedef struct EnHy {
/* 0x0198 */ s8 objBankIndexSkel1; // sets the object used when drawing the skeleton for limb <= 7 (lower part?)
/* 0x0199 */ s8 objBankIndexOsAnime;
/* 0x019C */ ColliderCylinder collider;
- /* 0x01E8 */ struct_80034A14_arg1 unk_1E8;
+ /* 0x01E8 */ NpcInteractInfo interactInfo;
/* 0x0210 */ Path* path;
/* 0x0214 */ s8 waypoint;
/* 0x0215 */ s8 unk_215;
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index 3916fd0c8..d03823207 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -191,14 +191,14 @@ u16 func_80A79168(PlayState* play, Actor* thisx) {
}
s16 func_80A791CC(PlayState* play, Actor* thisx) {
- s32 ret = 0;
+ s32 ret = NPC_TALK_STATE_IDLE;
switch (thisx->textId) {
case 0x2045:
SET_INFTABLE(INFTABLE_97);
break;
case 0x203E:
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
break;
case 0x203F:
SET_EVENTCHKINF(EVENTCHKINF_11);
@@ -210,7 +210,7 @@ s16 func_80A791CC(PlayState* play, Actor* thisx) {
s16 func_80A7924C(PlayState* play, Actor* thisx) {
EnIn* this = (EnIn*)thisx;
- s32 sp18 = 1;
+ s32 sp18 = NPC_TALK_STATE_TALKING;
switch (this->actor.textId) {
case 0x2030:
@@ -237,7 +237,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
case 0x2036:
case 0x2037:
if (play->msgCtx.choiceIndex == 1) {
- sp18 = 2;
+ sp18 = NPC_TALK_STATE_ACTION;
} else {
this->actor.textId = 0x201F;
Message_ContinueTextbox(play, this->actor.textId);
@@ -245,7 +245,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
break;
case 0x2038:
if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) {
- sp18 = 2;
+ sp18 = NPC_TALK_STATE_ACTION;
} else {
this->actor.textId = 0x2039;
Message_ContinueTextbox(play, this->actor.textId);
@@ -254,7 +254,7 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
break;
case 0x205B:
if (play->msgCtx.choiceIndex == 0 && gSaveContext.rupees >= 50) {
- sp18 = 2;
+ sp18 = NPC_TALK_STATE_ACTION;
} else {
Message_ContinueTextbox(play, this->actor.textId = 0x2039);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
@@ -270,20 +270,20 @@ s16 func_80A7924C(PlayState* play, Actor* thisx) {
}
s16 func_80A7949C(PlayState* play, Actor* thisx) {
- s32 phi_v1 = 1;
+ s32 phi_v1 = NPC_TALK_STATE_TALKING;
if (thisx->textId == 0x2035) {
Rupees_ChangeBy(-10);
thisx->textId = 0x205C;
Message_ContinueTextbox(play, thisx->textId);
} else {
- phi_v1 = 2;
+ phi_v1 = NPC_TALK_STATE_ACTION;
}
return phi_v1;
}
s16 func_80A79500(PlayState* play, Actor* thisx) {
- s16 sp1E = 1;
+ s16 sp1E = NPC_TALK_STATE_TALKING;
osSyncPrintf("message_check->(%d[%x])\n", Message_GetState(&play->msgCtx), thisx->textId);
switch (Message_GetState(&play->msgCtx)) {
@@ -316,25 +316,25 @@ s16 func_80A79500(PlayState* play, Actor* thisx) {
void func_80A795C8(EnIn* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 arg3;
+ s16 npcTrackingMode;
if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 ||
this->skelAnime.animation == &object_in_Anim_013D60) {
- arg3 = 1;
+ npcTrackingMode = NPC_TRACKING_NONE;
} else {
- arg3 = 0;
+ npcTrackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
}
if (this->actionFunc == func_80A7A568) {
- arg3 = 4;
+ npcTrackingMode = NPC_TRACKING_FULL_BODY;
}
if (this->actionFunc == func_80A7B024) {
- this->unk_308.unk_18 = play->view.eye;
- this->unk_308.unk_14 = 60.0f;
+ this->interactInfo.trackPos = play->view.eye;
+ this->interactInfo.yOffset = 60.0f;
} else {
- this->unk_308.unk_18 = player->actor.world.pos;
- this->unk_308.unk_14 = 16.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = 16.0f;
}
- func_80034A14(&this->actor, &this->unk_308, 1, arg3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 1, npcTrackingMode);
}
void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) {
@@ -457,10 +457,10 @@ void func_80A79C78(EnIn* this, PlayState* play) {
subCamEye.z = subCamAt.z + 40.0f;
Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye);
this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &subCamEye);
- this->unk_308.unk_08 = zeroVec;
- this->unk_308.unk_0E = zeroVec;
+ this->interactInfo.headRot = zeroVec;
+ this->interactInfo.torsoRot = zeroVec;
Message_StartTextbox(play, 0x2025, NULL);
- this->unk_308.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
player->actor.world.pos = this->actor.world.pos;
player->actor.world.pos.x += 100.0f * Math_SinS(this->actor.shape.rot.y);
player->actor.world.pos.z += 100.0f * Math_CosS(this->actor.shape.rot.y);
@@ -519,7 +519,7 @@ void func_80A79FB0(EnIn* this, PlayState* play) {
}
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = func_80A7A4BC;
switch (func_80A79830(this, play)) {
@@ -637,7 +637,7 @@ void func_80A7A4BC(EnIn* this, PlayState* play) {
}
void func_80A7A4C8(EnIn* this, PlayState* play) {
- if (this->unk_308.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
func_80A79BAC(this, play, 1, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST));
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_1);
SET_EVENTINF_HORSES_0F(1);
@@ -645,7 +645,7 @@ void func_80A7A4C8(EnIn* this, PlayState* play) {
Environment_ForcePlaySequence(NA_BGM_HORSE);
play->msgCtx.stateTimer = 0;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
}
@@ -663,12 +663,12 @@ void func_80A7A568(EnIn* this, PlayState* play) {
func_80A79C78(this, play);
this->actionFunc = func_80A7B024;
gSaveContext.timerState = TIMER_STATE_OFF;
- } else if (this->unk_308.unk_00 == 2) {
+ } else if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if (play->msgCtx.choiceIndex == 0) {
if (gSaveContext.rupees < 50) {
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
return;
}
SET_EVENTINF_HORSES_HORSETYPE(((EnHorse*)GET_PLAYER(play)->rideActor)->type);
@@ -692,20 +692,20 @@ void func_80A7A568(EnIn* this, PlayState* play) {
play->msgCtx.stateTimer = 0;
SET_EVENTINF_HORSES_0F(1);
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
}
void func_80A7A770(EnIn* this, PlayState* play) {
- if (this->unk_308.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
this->actor.flags |= ACTOR_FLAG_16;
- } else if (this->unk_308.unk_00 == 2) {
+ } else if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
Rupees_ChangeBy(-50);
this->actor.flags &= ~ACTOR_FLAG_16;
EnIn_ChangeAnim(this, ENIN_ANIM_3);
this->actionFunc = func_80A7A848;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_7);
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] =
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_05_MASK;
if (!GET_EVENTINF(EVENTINF_HORSES_06)) {
@@ -716,7 +716,7 @@ void func_80A7A770(EnIn* this, PlayState* play) {
}
void func_80A7A848(EnIn* this, PlayState* play) {
- if (this->unk_308.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if ((play->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || play->msgCtx.choiceIndex == 1) {
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
this->actionFunc = func_80A7A4C8;
@@ -727,14 +727,14 @@ void func_80A7A848(EnIn* this, PlayState* play) {
play->msgCtx.stateTimer = 0;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
}
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
CLEAR_EVENTINF(EVENTINF_HORSES_05);
CLEAR_EVENTINF(EVENTINF_HORSES_06);
}
}
void func_80A7A940(EnIn* this, PlayState* play) {
- if (this->unk_308.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
this->actor.flags |= ACTOR_FLAG_16;
return;
}
@@ -744,14 +744,14 @@ void func_80A7A940(EnIn* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_IN_LOST);
}
}
- if (this->unk_308.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
this->actor.flags &= ~ACTOR_FLAG_16;
func_80A79BAC(this, play, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST));
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2);
SET_EVENTINF_HORSES_0F(1);
play->msgCtx.stateTimer = 0;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] =
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_06_MASK;
}
@@ -788,7 +788,7 @@ void func_80A7AA40(EnIn* this, PlayState* play) {
Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye);
this->actor.textId = 0x203B;
Message_StartTextbox(play, this->actor.textId, NULL);
- this->unk_308.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
this->unk_1FC = 0;
play->csCtx.frames = 0;
Letterbox_SetSizeTarget(32);
@@ -813,16 +813,16 @@ void func_80A7ABD4(EnIn* this, PlayState* play) {
}
}
}
- if (this->unk_308.unk_00 != 0) {
- if (this->unk_308.unk_00 == 2) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if (this->actor.textId == 0x203B) {
this->actor.textId = 0x203C;
Message_StartTextbox(play, this->actor.textId, NULL);
- this->unk_308.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
EnIn_ChangeAnim(this, ENIN_ANIM_3);
} else {
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
}
} else {
@@ -874,10 +874,10 @@ void func_80A7AEF0(EnIn* this, PlayState* play) {
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
this->actionFunc = func_80A7B018;
- } else if (this->unk_308.unk_00 == 2) {
+ } else if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
}
@@ -891,7 +891,7 @@ void func_80A7B024(EnIn* this, PlayState* play) {
player->rideActor->freezeTimer = 10;
}
player->actor.freezeTimer = 10;
- if (this->unk_308.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if (1) {}
if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && GET_INFTABLE(INFTABLE_AB)) {
SET_EVENTCHKINF(EVENTCHKINF_1B);
@@ -902,7 +902,7 @@ void func_80A7B024(EnIn* this, PlayState* play) {
SET_EVENTINF_HORSES_0F(1);
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- this->unk_308.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
}
@@ -930,13 +930,13 @@ void EnIn_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc != func_80A7A304) {
func_80A79AB4(this, play);
if ((gSaveContext.subTimerSeconds < 6) && (gSaveContext.subTimerState != SUBTIMER_STATE_OFF) &&
- (this->unk_308.unk_00 == 0)) {
+ this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {}
} else {
- func_800343CC(play, &this->actor, &this->unk_308.unk_00,
- ((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius, func_80A79168,
- func_80A79500);
- if (this->unk_308.unk_00 != 0) {
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState,
+ ((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius,
+ func_80A79168, func_80A79500);
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->unk_1FA = this->unk_1F8;
this->unk_1F8 = Message_GetState(&play->msgCtx);
}
@@ -956,13 +956,13 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if (limbIndex == INGO_HEAD_LIMB) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp2C = this->unk_308.unk_08;
+ sp2C = this->interactInfo.headRot;
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.y), MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == INGO_CHEST_LIMB) {
- sp2C = this->unk_308.unk_0E;
+ sp2C = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp2C.x), MTXMODE_APPLY);
Matrix_RotateY(BINANG_TO_RAD_ALT(sp2C.y), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h
index 70725f56f..2cf2668a4 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.h
+++ b/src/overlays/actors/ovl_En_In/z_en_in.h
@@ -54,7 +54,7 @@ typedef struct EnIn {
/* 0x0276 */ Vec3s morphTable[INGO_LIMB_MAX];
/* 0x02F0 */ Vec3f subCamAtOffset;
/* 0x02FC */ Vec3f subCamEyeOffset;
- /* 0x0308 */ struct_80034A14_arg1 unk_308;
+ /* 0x0308 */ NpcInteractInfo interactInfo;
/* 0x0330 */ Vec3s unk_330[INGO_LIMB_MAX];
} EnIn; // size = 0x03A8
diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c
index b62d9182a..1c957b655 100644
--- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c
+++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c
@@ -553,9 +553,9 @@ s16 func_80A97738(PlayState* play, Actor* thisx) {
SET_INFTABLE(INFTABLE_B7);
break;
case 0x10BA:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_DONE_FADING:
switch (this->actor.textId) {
case 0x10B7:
@@ -566,7 +566,7 @@ s16 func_80A97738(PlayState* play, Actor* thisx) {
this->unk_210 = 1;
}
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
switch (this->actor.textId) {
@@ -589,17 +589,17 @@ s16 func_80A97738(PlayState* play, Actor* thisx) {
FALLTHROUGH;
case 0x10B8:
this->actor.textId = (play->msgCtx.choiceIndex == 0) ? 0x10BA : 0x10B9;
- return (play->msgCtx.choiceIndex == 0) ? 2 : 1;
+ return (play->msgCtx.choiceIndex == 0) ? NPC_TALK_STATE_ACTION : NPC_TALK_STATE_TALKING;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
break;
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
- return 3;
+ return NPC_TALK_STATE_ITEM_GIVEN;
}
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
s32 EnKo_GetForestQuestState(EnKo* this) {
@@ -684,108 +684,108 @@ s32 EnKo_IsWithinTalkAngle(EnKo* this) {
}
s32 func_80A97D68(EnKo* this, PlayState* play) {
- s16 arg3;
+ s16 trackingMode;
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if ((this->skelAnime.animation == &gKokiriWipingForeheadAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_WIPING_FOREHEAD);
}
- arg3 = 2;
+ trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
if ((this->skelAnime.animation == &gKokiriLiftingRockAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_LIFTING_ROCK);
}
- arg3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- func_80034A14(&this->actor, &this->unk_1E8, 2, arg3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
return EnKo_IsWithinTalkAngle(this);
}
s32 func_80A97E18(EnKo* this, PlayState* play) {
- s16 arg3;
+ s16 trackingMode;
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
if (EnKo_IsWithinTalkAngle(this) == true) {
- arg3 = 2;
+ trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
- arg3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- if (this->unk_1E8.unk_00 != 0) {
- arg3 = 4;
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ trackingMode = NPC_TRACKING_FULL_BODY;
} else if (this->lookDist < this->actor.xzDistToPlayer) {
- arg3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- func_80034A14(&this->actor, &this->unk_1E8, 2, arg3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
return 1;
}
s32 func_80A97EB0(EnKo* this, PlayState* play) {
- s16 arg3;
+ s16 trackingMode;
s32 result;
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
result = EnKo_IsWithinTalkAngle(this);
- arg3 = (result == true) ? 2 : 1;
- func_80034A14(&this->actor, &this->unk_1E8, 2, arg3);
+ trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
return result;
}
s32 func_80A97F20(EnKo* this, PlayState* play) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
- func_80034A14(&this->actor, &this->unk_1E8, 2, 4);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
return 1;
}
s32 func_80A97F70(EnKo* this, PlayState* play) {
- s16 arg3;
+ s16 trackingMode;
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC);
}
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
- arg3 = 2;
+ trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
if ((this->skelAnime.animation == &gKokiriCuttingGrassAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_CUTTING_GRASS);
}
- arg3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- func_80034A14(&this->actor, &this->unk_1E8, 5, arg3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 5, trackingMode);
return EnKo_IsWithinTalkAngle(this);
}
s32 func_80A98034(EnKo* this, PlayState* play) {
- s16 arg3;
+ s16 trackingMode;
s32 result;
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC);
}
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
result = EnKo_IsWithinTalkAngle(this);
- arg3 = (result == true) ? 2 : 1;
+ trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
} else {
if ((this->skelAnime.animation == &gKokiriPunchingAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_PUNCHING);
}
- arg3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
result = EnKo_IsWithinTalkAngle(this);
}
- func_80034A14(&this->actor, &this->unk_1E8, 5, arg3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 5, trackingMode);
return result;
}
// Same as func_80A97F20
s32 func_80A98124(EnKo* this, PlayState* play) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
- func_80034A14(&this->actor, &this->unk_1E8, 2, 4);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
return 1;
}
s32 func_80A98174(EnKo* this, PlayState* play) {
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (Animation_OnFrame(&this->skelAnime, 18.0f)) {
this->skelAnime.playSpeed = 0.0f;
}
@@ -795,7 +795,8 @@ s32 func_80A98174(EnKo* this, PlayState* play) {
if (this->skelAnime.playSpeed == 0.0f) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
}
- func_80034A14(&this->actor, &this->unk_1E8, 2, (this->skelAnime.playSpeed == 0.0f) ? 2 : 1);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2,
+ (this->skelAnime.playSpeed == 0.0f) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE);
return EnKo_IsWithinTalkAngle(this);
}
@@ -957,19 +958,20 @@ void func_80A9877C(EnKo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if ((play->csCtx.state != 0) || (gDbgCamEnabled != 0)) {
- this->unk_1E8.unk_18 = play->view.eye;
- this->unk_1E8.unk_14 = 40.0f;
+ this->interactInfo.trackPos = play->view.eye;
+ this->interactInfo.yOffset = 40.0f;
if (ENKO_TYPE != ENKO_TYPE_CHILD_0) {
- func_80034A14(&this->actor, &this->unk_1E8, 2, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_HEAD_AND_TORSO);
}
} else {
- this->unk_1E8.unk_18 = player->actor.world.pos;
- this->unk_1E8.unk_14 = func_80A97BC0(this);
- if ((func_80A98ECC(this, play) == 0) && (this->unk_1E8.unk_00 == 0)) {
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = func_80A97BC0(this);
+ if ((func_80A98ECC(this, play) == 0) && (this->interactInfo.talkState == NPC_TALK_STATE_IDLE)) {
return;
}
}
- if (func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, this->lookDist, func_80A97610, func_80A97738) &&
+ if (Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->lookDist, func_80A97610,
+ func_80A97738) &&
ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_SPOT10) {
this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF;
@@ -1194,10 +1196,11 @@ void func_80A99048(EnKo* this, PlayState* play) {
}
void func_80A99384(EnKo* this, PlayState* play) {
- if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 != 0 && this->actor.textId == 0x10B9) {
+ if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->interactInfo.talkState != NPC_TALK_STATE_IDLE &&
+ this->actor.textId == 0x10B9) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_LAUGHING);
this->actionFunc = func_80A99438;
- } else if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) {
+ } else if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
this->actionFunc = func_80A99504;
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
@@ -1205,12 +1208,12 @@ void func_80A99384(EnKo* this, PlayState* play) {
}
void func_80A99438(EnKo* this, PlayState* play) {
- if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) {
+ if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_IDLE);
this->actionFunc = func_80A99504;
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
- } else if (this->unk_1E8.unk_00 == 0 || this->actor.textId != 0x10B9) {
+ } else if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || this->actor.textId != 0x10B9) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_IDLE);
this->actionFunc = func_80A99384;
}
@@ -1226,10 +1229,10 @@ void func_80A99504(EnKo* this, PlayState* play) {
}
void func_80A99560(EnKo* this, PlayState* play) {
- if (this->unk_1E8.unk_00 == 3) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
this->actor.textId = 0x10B9;
Message_ContinueTextbox(play, this->actor.textId);
- this->unk_1E8.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
SET_ITEMGETINF(ITEMGETINF_31);
this->actionFunc = func_80A99384;
}
@@ -1247,7 +1250,7 @@ void func_80A995CC(EnKo* this, PlayState* play) {
this->actor.world.pos.z += 80.0f * Math_CosS(homeYawToPlayer);
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer;
- if (this->unk_1E8.unk_00 == 0 || !this->actor.isTargeted) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || !this->actor.isTargeted) {
temp_f2 = fabsf((f32)this->actor.yawTowardsPlayer - homeYawToPlayer) * 0.001f * 3.0f;
if (temp_f2 < 1.0f) {
this->skelAnime.playSpeed = 1.0f;
@@ -1275,7 +1278,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) {
func_80A98DB4(this, play);
}
}
- if (this->unk_1E8.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
Actor_MoveForward(&this->actor);
}
if (func_80A97C7C(this)) {
@@ -1311,13 +1314,13 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment);
}
if (limbIndex == 8) {
- sp40 = this->unk_1E8.unk_0E;
+ sp40 = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-sp40.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY);
}
if (limbIndex == 15) {
Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp40 = this->unk_1E8.unk_08;
+ sp40 = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp40.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp40.x), MTXMODE_APPLY);
Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h
index efce571d0..2828b067b 100644
--- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h
+++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h
@@ -18,7 +18,7 @@ typedef struct EnKo {
/* 0x0197 */ s8 osAnimeBankIndex;
/* 0x0198 */ ColliderCylinder collider;
/* 0x01E4 */ Path* path;
- /* 0x01E8 */ struct_80034A14_arg1 unk_1E8;
+ /* 0x01E8 */ NpcInteractInfo interactInfo;
/* 0x0210 */ u8 unk_210; // block trade quest sfx
/* 0x0212 */ s16 forestQuestState;
/* 0x0214 */ s16 blinkTimer;
diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c
index 8f0bfef8d..71ef568c5 100644
--- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c
+++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c
@@ -117,18 +117,18 @@ u16 EnKz_GetText(PlayState* play, Actor* thisx) {
s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
EnKz* this = (EnKz*)thisx;
- s16 ret = 1;
+ s16 ret = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_DONE:
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
switch (this->actor.textId) {
case 0x4012:
SET_INFTABLE(INFTABLE_139);
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
break;
case 0x401B:
- ret = !Message_ShouldAdvance(play) ? 1 : 2;
+ ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
break;
case 0x401F:
SET_INFTABLE(INFTABLE_139);
@@ -155,7 +155,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
if (this->actor.textId == 0x4014) {
if (play->msgCtx.choiceIndex == 0) {
EnKz_SetupGetItem(this, play);
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
} else {
this->actor.textId = 0x4016;
Message_ContinueTextbox(play, this->actor.textId);
@@ -164,7 +164,7 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
break;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
}
break;
case TEXT_STATE_NONE:
@@ -188,8 +188,8 @@ void EnKz_UpdateEyes(EnKz* this) {
}
}
-s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1,
- callback2_800343CC callback2) {
+s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetTextIdFunc getTextId,
+ NpcUpdateTalkStateFunc updateTalkState) {
Player* player = GET_PLAYER(play);
s16 sp32;
s16 sp30;
@@ -197,12 +197,12 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_80
f32 yaw;
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- *arg2 = 1;
+ *talkState = NPC_TALK_STATE_TALKING;
return 1;
}
- if (*arg2 != 0) {
- *arg2 = callback2(play, &this->actor);
+ if (*talkState != NPC_TALK_STATE_IDLE) {
+ *talkState = updateTalkState(play, &this->actor);
return 0;
}
@@ -227,7 +227,7 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_80
return 0;
}
this->actor.xzDistToPlayer = xzDistToPlayer;
- this->actor.textId = callback1(play, &this->actor);
+ this->actor.textId = getTextId(play, &this->actor);
return 0;
}
@@ -235,7 +235,7 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* arg2, f32 unkf, callback1_80
void func_80A9CB18(EnKz* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (func_80A9C95C(play, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) {
+ if (func_80A9C95C(play, this, &this->interactInfo.talkState, 340.0f, EnKz_GetText, func_80A9C6C0)) {
if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_33)) {
if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) {
this->actor.textId = 0x401B;
@@ -327,7 +327,7 @@ void EnKz_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
Actor_SetScale(&this->actor, 0.01);
this->actor.targetMode = 3;
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_0);
if (GET_EVENTCHKINF(EVENTCHKINF_33)) {
@@ -352,9 +352,9 @@ void EnKz_Destroy(Actor* thisx, PlayState* play) {
}
void EnKz_PreMweepWait(EnKz* this, PlayState* play) {
- if (this->unk_1E0.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_2);
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = EnKz_SetupMweep;
} else {
func_80034F54(play, this->unk_2A6, this->unk_2BE, 12);
@@ -413,7 +413,7 @@ void EnKz_StopMweep(EnKz* this, PlayState* play) {
}
void EnKz_Wait(EnKz* this, PlayState* play) {
- if (this->unk_1E0.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
this->actionFunc = EnKz_SetupGetItem;
EnKz_SetupGetItem(this, play);
} else {
@@ -428,7 +428,7 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
- this->unk_1E0.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
this->actionFunc = EnKz_StartTimer;
} else {
getItemId = this->isTrading == true ? GI_EYEBALL_FROG : GI_TUNIC_ZORA;
@@ -444,7 +444,7 @@ void EnKz_StartTimer(EnKz* this, PlayState* play) {
Interface_SetSubTimer(180);
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
}
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = EnKz_Wait;
}
}
diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/src/overlays/actors/ovl_En_Kz/z_en_kz.h
index bd773b479..588dea177 100644
--- a/src/overlays/actors/ovl_En_Kz/z_en_kz.h
+++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.h
@@ -13,7 +13,7 @@ typedef struct EnKz {
/* 0x014C */ SkelAnime skelanime;
/* 0x0190 */ EnKzActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 sfxPlayed;
/* 0x0209 */ u8 isTrading;
/* 0x020A */ s16 waypoint;
diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
index 57fef2eba..e8ad61e3c 100644
--- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
+++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
@@ -124,7 +124,7 @@ u16 EnMa1_GetText(PlayState* play, Actor* thisx) {
}
s16 func_80AA0778(PlayState* play, Actor* thisx) {
- s16 ret = 1;
+ s16 ret = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CLOSING:
@@ -132,40 +132,40 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) {
case 0x2041:
SET_INFTABLE(INFTABLE_84);
SET_EVENTCHKINF(EVENTCHKINF_10);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x2043:
- ret = 1;
+ ret = NPC_TALK_STATE_TALKING;
break;
case 0x2047:
SET_EVENTCHKINF(EVENTCHKINF_15);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x2048:
SET_INFTABLE(INFTABLE_85);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x2049:
SET_EVENTCHKINF(EVENTCHKINF_16);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x2061:
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
break;
default:
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
}
break;
case TEXT_STATE_CHOICE:
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
- ret = 2;
+ ret = NPC_TALK_STATE_ACTION;
}
break;
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
- ret = 3;
+ ret = NPC_TALK_STATE_ITEM_GIVEN;
}
break;
case TEXT_STATE_NONE:
@@ -174,7 +174,7 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8:
case TEXT_STATE_9:
- ret = 1;
+ ret = NPC_TALK_STATE_TALKING;
break;
}
return ret;
@@ -230,23 +230,23 @@ void EnMa1_ChangeAnim(EnMa1* this, s32 index) {
void func_80AA0AF4(EnMa1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 phi_a3;
+ s16 trackingMode;
- if ((this->unk_1E8.unk_00 == 0) && (this->skelAnime.animation == &gMalonChildSingAnim)) {
- phi_a3 = 1;
+ if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->skelAnime.animation == &gMalonChildSingAnim)) {
+ trackingMode = NPC_TRACKING_NONE;
} else {
- phi_a3 = 0;
+ trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
}
- this->unk_1E8.unk_18 = player->actor.world.pos;
- this->unk_1E8.unk_18.y -= -10.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.trackPos.y -= -10.0f;
- func_80034A14(&this->actor, &this->unk_1E8, 0, phi_a3);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode);
}
void func_80AA0B74(EnMa1* this) {
if (this->skelAnime.animation == &gMalonChildSingAnim) {
- if (this->unk_1E8.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (this->isNotSinging) {
// Turn on singing
this->isNotSinging = false;
@@ -280,7 +280,7 @@ void EnMa1_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_1E8.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
this->actionFunc = func_80AA0D88;
@@ -299,7 +299,7 @@ void EnMa1_Destroy(Actor* thisx, PlayState* play) {
}
void func_80AA0D88(EnMa1* this, PlayState* play) {
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
}
@@ -312,7 +312,7 @@ void func_80AA0D88(EnMa1* this, PlayState* play) {
if ((play->sceneId == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
} else if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
- if (this->unk_1E8.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
this->actionFunc = func_80AA0EA0;
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
@@ -330,8 +330,8 @@ void func_80AA0EA0(EnMa1* this, PlayState* play) {
}
void func_80AA0EFC(EnMa1* this, PlayState* play) {
- if (this->unk_1E8.unk_00 == 3) {
- this->unk_1E8.unk_00 = 0;
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = func_80AA0D88;
SET_EVENTCHKINF(EVENTCHKINF_12);
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
@@ -341,7 +341,7 @@ void func_80AA0EFC(EnMa1* this, PlayState* play) {
void func_80AA0F44(EnMa1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (this->unk_1E8.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
}
@@ -357,7 +357,7 @@ void func_80AA0F44(EnMa1* this, PlayState* play) {
player->unk_6A8 = &this->actor;
this->actor.textId = 0x2061;
Message_StartTextbox(play, this->actor.textId, NULL);
- this->unk_1E8.unk_00 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
this->actor.flags |= ACTOR_FLAG_16;
this->actionFunc = func_80AA106C;
} else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) {
@@ -368,7 +368,7 @@ void func_80AA0F44(EnMa1* this, PlayState* play) {
void func_80AA106C(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
- if (this->unk_1E8.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON);
func_8010BD58(play, OCARINA_ACTION_TEACH_EPONA);
this->actor.flags &= ~ACTOR_FLAG_16;
@@ -408,8 +408,8 @@ void EnMa1_Update(Actor* thisx, PlayState* play) {
EnMa1_UpdateEyes(this);
this->actionFunc(this, play);
if (this->actionFunc != EnMa1_DoNothing) {
- func_800343CC(play, &this->actor, &this->unk_1E8.unk_00, (f32)this->collider.dim.radius + 30.0f, EnMa1_GetText,
- func_80AA0778);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f,
+ EnMa1_GetText, func_80AA0778);
}
func_80AA0B74(this);
func_80AA0AF4(this, play);
@@ -424,13 +424,13 @@ s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
}
if (limbIndex == 15) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- vec = this->unk_1E8.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 == 8) {
- vec = this->unk_1E8.unk_0E;
+ vec = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(-vec.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h
index ec3593f83..f77d40eea 100644
--- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h
+++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h
@@ -17,7 +17,7 @@ typedef struct EnMa1 {
/* 0x01E2 */ s16 blinkTimer;
/* 0x01E4 */ s16 eyeIndex;
/* 0x01E6 */ s16 mouthIndex;
- /* 0x01E8 */ struct_80034A14_arg1 unk_1E8;
+ /* 0x01E8 */ NpcInteractInfo interactInfo;
} EnMa1; // size = 0x0210
#endif
diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
index 0b1a24b0b..3cc8e286a 100644
--- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
+++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
@@ -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);
}
diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h
index e6985e054..b207e8e7c 100644
--- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h
+++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h
@@ -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;
diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
index 663e218a0..790c55926 100644
--- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
+++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
@@ -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);
}
diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h
index 1debd32f5..3edf65f09 100644
--- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h
+++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h
@@ -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;
diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c
index c3de91e08..9224a8c30 100644
--- a/src/overlays/actors/ovl_En_Md/z_en_md.c
+++ b/src/overlays/actors/ovl_En_Md/z_en_md.c
@@ -319,7 +319,7 @@ void func_80AAA93C(EnMd* this) {
}
void func_80AAAA24(EnMd* this) {
- if (this->unk_1E0.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
switch (this->actor.textId) {
case 0x102F:
if ((this->unk_208 == 0) && (this->unk_20B != 1)) {
@@ -473,7 +473,7 @@ s16 func_80AAAF04(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8:
case TEXT_STATE_9:
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CLOSING:
switch (this->actor.textId) {
case 0x1028:
@@ -491,16 +491,16 @@ s16 func_80AAAF04(PlayState* play, Actor* thisx) {
break;
case 0x1033:
case 0x1067:
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play)) {
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
FALLTHROUGH;
default:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -539,7 +539,7 @@ void EnMd_UpdateEyes(EnMd* this) {
void func_80AAB158(EnMd* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 absYawDiff;
- s16 temp;
+ s16 trackingMode;
s16 temp2;
s16 yawDiff;
@@ -547,40 +547,41 @@ void func_80AAB158(EnMd* this, PlayState* play) {
yawDiff = (f32)this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
absYawDiff = ABS(yawDiff);
- temp = (absYawDiff <= func_800347E8(2)) ? 2 : 1;
+ trackingMode =
+ absYawDiff <= Npc_GetTrackingPresetMaxPlayerYaw(2) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
temp2 = 1;
} else {
- temp = 1;
+ trackingMode = NPC_TRACKING_NONE;
temp2 = 0;
}
- if (this->unk_1E0.unk_00 != 0) {
- temp = 4;
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ trackingMode = NPC_TRACKING_FULL_BODY;
}
if (this->actionFunc == func_80AABD0C) {
- temp = 1;
+ trackingMode = NPC_TRACKING_NONE;
temp2 = 0;
}
if (this->actionFunc == func_80AAB8F8) {
- temp = 4;
+ trackingMode = NPC_TRACKING_FULL_BODY;
temp2 = 1;
}
if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) {
- this->unk_1E0.unk_18 = play->view.eye;
- this->unk_1E0.unk_14 = 40.0f;
- temp = 2;
+ this->interactInfo.trackPos = play->view.eye;
+ this->interactInfo.yOffset = 40.0f;
+ trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
- this->unk_1E0.unk_18 = player->actor.world.pos;
- this->unk_1E0.unk_14 = (gSaveContext.linkAge > 0) ? 0.0f : -18.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = (gSaveContext.linkAge > 0) ? 0.0f : -18.0f;
}
- func_80034A14(&this->actor, &this->unk_1E0, 2, temp);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
if (this->actionFunc != func_80AABC10) {
if (temp2) {
- func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, EnMd_GetText,
- func_80AAAF04);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f,
+ EnMd_GetText, func_80AAAF04);
}
}
}
@@ -695,7 +696,7 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) {
void func_80AAB874(EnMd* this, PlayState* play) {
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
- } else if ((this->unk_1E0.unk_00 == 0) && (this->unk_20B != 7)) {
+ } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->unk_20B != 7)) {
func_80AAA92C(this, 7);
}
@@ -717,7 +718,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
func_80AAAA24(this);
- if (this->unk_1E0.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
@@ -733,7 +734,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
this->skelAnime.playSpeed = CLAMP(temp, 1.0f, 3.0f);
}
- if (this->unk_1E0.unk_00 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) &&
(play->sceneId == SCENE_SPOT04)) {
play->msgCtx.msgMode = MSGMODE_PAUSED;
@@ -749,7 +750,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
func_80AAA92C(this, 3);
func_80AAA93C(this);
this->waypoint = 1;
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = func_80AABD0C;
this->actor.speedXZ = 1.5f;
return;
@@ -759,7 +760,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
}
- if ((this->unk_1E0.unk_00 == 0) && (play->sceneId == SCENE_SPOT10)) {
+ if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_SPOT10)) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
player->stateFlags2 |= PLAYER_STATE2_25;
player->unk_6A8 = &this->actor;
@@ -838,13 +839,13 @@ s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == ENMD_LIMB_HEAD) {
Matrix_Translate(1200.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(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == ENMD_LIMB_TORSO) {
- vec = this->unk_1E0.unk_0E;
+ vec = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY);
Matrix_RotateY(BINANG_TO_RAD_ALT(vec.y), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.h b/src/overlays/actors/ovl_En_Md/z_en_md.h
index 371426a45..d3075a821 100644
--- a/src/overlays/actors/ovl_En_Md/z_en_md.h
+++ b/src/overlays/actors/ovl_En_Md/z_en_md.h
@@ -34,7 +34,7 @@ typedef struct EnMd {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnMdActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 unk_208;
/* 0x0209 */ u8 unk_209;
/* 0x020A */ u8 unk_20A;
diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c
index 8949a33a9..c06d3db27 100644
--- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c
+++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c
@@ -15,7 +15,7 @@ void EnMu_Update(Actor* thisx, PlayState* play);
void EnMu_Draw(Actor* thisx, PlayState* play);
void EnMu_Pose(EnMu* this, PlayState* play);
-s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx);
+s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx);
static ColliderCylinderInit D_80AB0BD0 = {
{
@@ -108,7 +108,7 @@ u16 EnMu_GetFaceReaction(PlayState* play, Actor* thisx) {
return this->defFaceReaction;
}
-s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx) {
+s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx) {
EnMu* this = (EnMu*)thisx;
switch (Message_GetState(&play->msgCtx)) {
@@ -121,12 +121,12 @@ s16 EnMu_CheckDialogState(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8:
case TEXT_STATE_9:
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CLOSING:
EnMu_Interact(this, play);
- return 0;
+ return NPC_TALK_STATE_IDLE;
default:
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
}
@@ -172,7 +172,8 @@ void EnMu_Update(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
this->actionFunc(this, play);
talkDist = this->collider.dim.radius + 30.0f;
- func_800343CC(play, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, EnMu_CheckDialogState);
+ Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetFaceReaction,
+ EnMu_UpdateTalkState);
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 60.0f;
diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h
index 1f2bf0f32..c798e4fb8 100644
--- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h
+++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h
@@ -13,7 +13,7 @@ typedef struct EnMu {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnMuActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 npcInfo;
+ /* 0x01E0 */ NpcInteractInfo npcInfo;
/* 0x0208 */ u16 defFaceReaction;
/* 0x020A */ s16 unk_20A[16];
/* 0x022A */ s16 unk_22A[17];
diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
index dc28a2ee4..c39864388 100644
--- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c
+++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
@@ -152,17 +152,17 @@ void EnNb_Destroy(Actor* thisx, PlayState* play) {
void func_80AB0FBC(EnNb* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_300.unk_18 = player->actor.world.pos;
- this->unk_300.unk_14 = kREG(16) + 9.0f;
- func_80034A14(&this->actor, &this->unk_300, kREG(17) + 0xC, 2);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) + 9.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_HEAD_AND_TORSO);
}
void func_80AB1040(EnNb* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_300.unk_18 = player->actor.world.pos;
- this->unk_300.unk_14 = kREG(16) + 9.0f;
- func_80034A14(&this->actor, &this->unk_300, kREG(17) + 0xC, 4);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) + 9.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_FULL_BODY);
}
void func_80AB10C4(EnNb* this) {
@@ -170,10 +170,10 @@ void func_80AB10C4(EnNb* this) {
Vec3s* tempPtr;
Vec3s* tempPtr2;
- tempPtr = &this->unk_300.unk_08;
+ tempPtr = &this->interactInfo.headRot;
Math_SmoothStepToS(&tempPtr->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&tempPtr->y, 0, 20, 6200, 100);
- tempPtr2 = &this->unk_300.unk_0E;
+ tempPtr2 = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&tempPtr2->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&tempPtr2->y, 0, 20, 6200, 100);
}
@@ -1452,17 +1452,17 @@ void EnNb_Init(Actor* thisx, PlayState* play) {
s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnNb* this = (EnNb*)thisx;
- struct_80034A14_arg1* unk_300 = &this->unk_300;
+ NpcInteractInfo* interactInfo = &this->interactInfo;
s32 ret = false;
if (this->headTurnFlag != 0) {
if (limbIndex == NB_LIMB_TORSO) {
- rot->x += unk_300->unk_0E.y;
- rot->y -= unk_300->unk_0E.x;
+ rot->x += interactInfo->torsoRot.y;
+ rot->y -= interactInfo->torsoRot.x;
ret = false;
} else if (limbIndex == NB_LIMB_HEAD) {
- rot->x += unk_300->unk_08.y;
- rot->z += unk_300->unk_08.x;
+ rot->x += interactInfo->headRot.y;
+ rot->z += interactInfo->headRot.x;
ret = false;
}
}
diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.h b/src/overlays/actors/ovl_En_Nb/z_en_nb.h
index 89f49fc76..c1bc3a01b 100644
--- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h
+++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h
@@ -52,7 +52,7 @@ typedef struct EnNb {
/* 0x02F0 */ Vec3f finalPos;
/* 0x02FC */ s16 pathYaw;
/* 0x02FE */ u16 movementTimer;
- /* 0x0300 */ struct_80034A14_arg1 unk_300;
+ /* 0x0300 */ NpcInteractInfo interactInfo;
} EnNb; // size = 0x0328
typedef enum {
diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c
index d60f1504c..904c1f2ef 100644
--- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c
+++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c
@@ -202,13 +202,13 @@ void EnNiwGirl_Update(Actor* thisx, PlayState* play) {
this->unk_280 = 30.0f;
Actor_SetFocus(&this->actor, 30.0f);
if (tempActionFunc == this->actionFunc) {
- this->unk_2D4.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (!LINK_IS_ADULT) {
- this->unk_2D4.unk_18.y = player->actor.world.pos.y - 10.0f;
+ this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
}
- func_80034A14(&this->actor, &this->unk_2D4, 2, 4);
- this->unk_260 = this->unk_2D4.unk_08;
- this->unk_266 = this->unk_2D4.unk_0E;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
+ this->unk_260 = this->interactInfo.headRot;
+ this->unk_266 = this->interactInfo.torsoRot;
} else {
Math_SmoothStepToS(&this->unk_266.y, 0, 5, 3000, 0);
Math_SmoothStepToS(&this->unk_260.y, 0, 5, 3000, 0);
diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h
index e9ef3b081..308da0d26 100644
--- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h
+++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h
@@ -29,7 +29,7 @@ typedef struct EnNiwGirl {
/* 0x0280 */ f32 unk_280;
/* 0x0284 */ EnNiw* chasedEnNiw;
/* 0x0288 */ ColliderCylinder collider;
- /* 0x02D4 */ struct_80034A14_arg1 unk_2D4;
+ /* 0x02D4 */ NpcInteractInfo interactInfo;
} EnNiwGirl; // size = 0x02FC
#endif
diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
index 9ca00f8e8..91191c8c3 100644
--- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
+++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
@@ -496,13 +496,13 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) {
Player* player = GET_PLAYER(play);
Actor_SetFocus(thisx, 60.0f);
- this->unk_288.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (!LINK_IS_ADULT) {
- this->unk_288.unk_18.y = player->actor.world.pos.y - 10.0f;
+ this->interactInfo.trackPos.y = player->actor.world.pos.y - 10.0f;
}
- func_80034A14(thisx, &this->unk_288, 2, 4);
- this->unk_254 = this->unk_288.unk_08;
- this->unk_25A = this->unk_288.unk_0E;
+ Npc_TrackPoint(thisx, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
+ this->unk_254 = this->interactInfo.headRot;
+ this->unk_25A = this->interactInfo.torsoRot;
if (this->unk_276 == 0) {
Math_SmoothStepToS(&this->unk_254.y, 0, 5, 3000, 0);
}
diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h
index e408028ef..078903498 100644
--- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h
+++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h
@@ -38,7 +38,7 @@ typedef struct EnNiwLady {
/* 0x0280 */ s8 objectAneIndex;
/* 0x0281 */ s8 objectOsAnimeIndex;
/* 0x0284 */ s32 getItemId;
- /* 0x0288 */ struct_80034A14_arg1 unk_288;
+ /* 0x0288 */ NpcInteractInfo interactInfo;
/* 0x02B0 */ ColliderCylinder collider;
} EnNiwLady; // size = 0x02FC
diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
index 0f322b700..2ec803cba 100644
--- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
+++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
@@ -1274,10 +1274,10 @@ void func_80AED83C(EnRu1* this) {
Vec3s* tempPtr;
Vec3s* tempPtr2;
- tempPtr = &this->unk_374.unk_08;
+ tempPtr = &this->interactInfo.headRot;
Math_SmoothStepToS(&tempPtr->x, 0, 0x14, 0x1838, 0x64);
Math_SmoothStepToS(&tempPtr->y, 0, 0x14, 0x1838, 0x64);
- tempPtr2 = &this->unk_374.unk_0E;
+ tempPtr2 = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&tempPtr2->x, 0, 0x14, 0x1838, 0x64);
Math_SmoothStepToS(&tempPtr2->y, 0, 0x14, 0x1838, 0x64);
}
@@ -1285,7 +1285,7 @@ void func_80AED83C(EnRu1* this) {
void func_80AED8DC(EnRu1* this) {
s32 temp_hi;
s16* unk_2AC = &this->unk_2AC;
- s16* someY = &this->unk_374.unk_08.y;
+ s16* someY = &this->interactInfo.headRot.y;
s16* unk_29E = &this->unk_29E;
s32 pad[2];
@@ -1787,20 +1787,20 @@ void func_80AEEF68(EnRu1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 something;
- this->unk_374.unk_18 = player->actor.world.pos;
- this->unk_374.unk_14 = kREG(16) - 3.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) - 3.0f;
something = kREG(17) + 0xC;
- func_80034A14(&this->actor, &this->unk_374, something, 2);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_HEAD_AND_TORSO);
}
void func_80AEEFEC(EnRu1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 something;
- this->unk_374.unk_18 = player->actor.world.pos;
- this->unk_374.unk_14 = kREG(16) - 3.0f;
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) - 3.0f;
something = kREG(17) + 0xC;
- func_80034A14(&this->actor, &this->unk_374, something, 4);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, something, NPC_TRACKING_FULL_BODY);
this->actor.world.rot.y = this->actor.shape.rot.y;
}
@@ -2260,8 +2260,8 @@ void EnRu1_Init(Actor* thisx, PlayState* play) {
}
void func_80AF0278(EnRu1* this, PlayState* play, s32 limbIndex, Vec3s* rot) {
- Vec3s* vec1 = &this->unk_374.unk_0E;
- Vec3s* vec2 = &this->unk_374.unk_08;
+ Vec3s* vec1 = &this->interactInfo.torsoRot;
+ Vec3s* vec2 = &this->interactInfo.headRot;
switch (limbIndex) {
case RUTO_CHILD_LEFT_UPPER_ARM:
diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
index d5ed7b3a6..89aa10606 100644
--- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
+++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
@@ -54,7 +54,7 @@ typedef struct EnRu1 {
/* 0x0360 */ f32 unk_360;
/* 0x0364 */ Vec3f unk_364;
/* 0x0370 */ f32 unk_370;
- /* 0x0374 */ struct_80034A14_arg1 unk_374;
+ /* 0x0374 */ NpcInteractInfo interactInfo;
} EnRu1; // size = 0x039C
typedef enum {
diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c
index 05803aa3f..15ac11a5d 100644
--- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c
+++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c
@@ -179,7 +179,7 @@ u16 func_80AF55E0(PlayState* play, Actor* thisx) {
}
s16 func_80AF56F4(PlayState* play, Actor* thisx) {
- s16 ret = 1;
+ s16 ret = NPC_TALK_STATE_TALKING;
EnSa* this = (EnSa*)thisx;
switch (func_80AF5560(this, play)) {
@@ -187,19 +187,19 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) {
switch (this->actor.textId) {
case 0x1002:
SET_INFTABLE(INFTABLE_01);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x1031:
SET_EVENTCHKINF(EVENTCHKINF_03);
SET_INFTABLE(INFTABLE_03);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case 0x1047:
SET_INFTABLE(INFTABLE_05);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
default:
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
}
break;
@@ -218,9 +218,9 @@ s16 func_80AF56F4(PlayState* play, Actor* thisx) {
void func_80AF57D8(EnSa* this, PlayState* play) {
if (play->sceneId != SCENE_SPOT05 || ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 ||
- this->unk_1E0.unk_00 != 0) {
- func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0,
- func_80AF56F4);
+ this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f,
+ func_80AF55E0, func_80AF56F4);
}
}
@@ -406,25 +406,25 @@ s32 func_80AF5DFC(EnSa* this, PlayState* play) {
void func_80AF5F34(EnSa* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s16 phi_a3 = 0;
+ s16 trackingMode = NPC_TRACKING_PLAYER_AUTO_TURN;
if (play->sceneId == SCENE_SPOT04) {
- phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4;
+ trackingMode = (this->actionFunc == func_80AF68E4) ? NPC_TRACKING_NONE : NPC_TRACKING_FULL_BODY;
}
if (play->sceneId == SCENE_SPOT05) {
- phi_a3 = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? 1 : 3;
+ trackingMode = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? NPC_TRACKING_NONE : NPC_TRACKING_HEAD;
}
if (play->sceneId == SCENE_SPOT05 && this->actionFunc == func_80AF6448 &&
this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) {
- phi_a3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
if (play->sceneId == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 &&
this->skelAnime.animation == &gSariaOcarinaToMouthAnim) {
- phi_a3 = 1;
+ trackingMode = NPC_TRACKING_NONE;
}
- this->unk_1E0.unk_18 = player->actor.world.pos;
- this->unk_1E0.unk_14 = 4.0f;
- func_80034A14(&this->actor, &this->unk_1E0, 2, phi_a3);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = 4.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
}
s32 func_80AF603C(EnSa* this) {
@@ -432,7 +432,7 @@ s32 func_80AF603C(EnSa* this) {
this->skelAnime.animation != &gSariaOcarinaToMouthAnim) {
return 0;
}
- if (this->unk_1E0.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
return 0;
}
this->unk_20E = 0;
@@ -523,7 +523,7 @@ void EnSa_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
- this->unk_1E0.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->alpha = 255;
this->unk_21A = this->actor.shape.rot;
@@ -539,7 +539,7 @@ void EnSa_Destroy(Actor* thisx, PlayState* play) {
void func_80AF6448(EnSa* this, PlayState* play) {
if (play->sceneId == SCENE_SPOT04) {
- if (this->unk_1E0.unk_00 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
switch (this->actor.textId) {
case 0x1002:
if (this->unk_208 == 0 && this->unk_20B != 1) {
@@ -607,14 +607,14 @@ void func_80AF6448(EnSa* this, PlayState* play) {
EnSa_ChangeAnim(this, ENSA_ANIM1_6);
}
}
- if (this->unk_1E0.unk_00 != 0 && play->sceneId == SCENE_SPOT05) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE && play->sceneId == SCENE_SPOT05) {
Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f);
this->actionFunc = func_80AF67D0;
}
}
void func_80AF67D0(EnSa* this, PlayState* play) {
- if (this->unk_1E0.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f);
this->actionFunc = func_80AF6448;
}
@@ -765,14 +765,14 @@ s32 EnSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == 16) {
Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- sp18 = this->unk_1E0.unk_08;
+ sp18 = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY);
Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 9) {
- sp18 = this->unk_1E0.unk_0E;
+ sp18 = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp18.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp18.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.h b/src/overlays/actors/ovl_En_Sa/z_en_sa.h
index 3fc8e3d6d..27c2c740f 100644
--- a/src/overlays/actors/ovl_En_Sa/z_en_sa.h
+++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.h
@@ -13,7 +13,7 @@ typedef struct EnSa {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnSaActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 unk_208;
/* 0x0209 */ u8 unk_209;
/* 0x020A */ u8 unk_20A;
diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c
index e28cc70a8..b9d447d96 100644
--- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c
+++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c
@@ -78,7 +78,7 @@ u16 EnTg_GetTextId(PlayState* play, Actor* thisx) {
}
}
-s16 EnTg_OnTextComplete(PlayState* play, Actor* thisx) {
+s16 EnTg_UpdateTalkState(PlayState* play, Actor* thisx) {
EnTg* this = (EnTg*)thisx;
switch (Message_GetState(&play->msgCtx)) {
@@ -132,7 +132,7 @@ void EnTg_Destroy(Actor* thisx, PlayState* play) {
}
void EnTg_SpinIfNotTalking(EnTg* this, PlayState* play) {
- if (!this->isTalking) {
+ if (!this->interactInfo.talkState) {
this->actor.shape.rot.y += 0x800;
}
}
@@ -152,7 +152,7 @@ void EnTg_Update(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
this->actionFunc(this, play);
temp = this->collider.dim.radius + 30.0f;
- func_800343CC(play, &this->actor, &this->isTalking, temp, EnTg_GetTextId, EnTg_OnTextComplete);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, temp, EnTg_GetTextId, EnTg_UpdateTalkState);
}
s32 EnTg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h
index 4ba4e5034..4571638d7 100644
--- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h
+++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h
@@ -13,8 +13,7 @@ typedef struct EnTg {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnTgActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ s16 isTalking;
- /* 0x01E2 */ char unk_1E2[0x26];
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 nextDialogue;
} EnTg; // size = 0x020C
diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
index d3626f3f7..43b35a740 100644
--- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c
+++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
@@ -348,7 +348,7 @@ u16 func_80B1C54C(PlayState* play, Actor* thisx) {
}
s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
- s32 ret = 1;
+ s32 ret = NPC_TALK_STATE_TALKING;
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_NONE:
@@ -359,7 +359,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
if (thisx->textId == 0x5028) {
SET_INFTABLE(INFTABLE_D8);
}
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
break;
case TEXT_STATE_DONE_FADING:
break;
@@ -375,7 +375,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
play->msgCtx.msgMode = MSGMODE_PAUSED;
Rupees_ChangeBy(-10);
SET_INFTABLE(INFTABLE_D9);
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
Message_ContinueTextbox(play, thisx->textId);
SET_INFTABLE(INFTABLE_D9);
@@ -384,7 +384,7 @@ s16 func_80B1C5A0(PlayState* play, Actor* thisx) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(play) && (thisx->textId == 0x0084 || thisx->textId == 0x0085)) {
Message_CloseTextbox(play);
- ret = 0;
+ ret = NPC_TALK_STATE_IDLE;
}
break;
case TEXT_STATE_DONE:
@@ -516,35 +516,35 @@ void EnTk_Rest(EnTk* this, PlayState* play) {
s16 v1;
s16 a1_;
- if (this->h_1E0 != 0) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
v1 = this->actor.shape.rot.y;
v1 -= this->h_21E;
v1 = this->actor.yawTowardsPlayer - v1;
- if (this->h_1E0 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
EnTk_DigAnim(this, play);
- this->h_1E0 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = EnTk_Dig;
return;
}
- func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C,
- func_80B1C5A0);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f,
+ func_80B1C54C, func_80B1C5A0);
} else if (EnTk_CheckFacingPlayer(this)) {
v1 = this->actor.shape.rot.y;
v1 -= this->h_21E;
v1 = this->actor.yawTowardsPlayer - v1;
this->actionCountdown = 0;
- func_800343CC(play, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.0f, func_80B1C54C,
- func_80B1C5A0);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f,
+ func_80B1C54C, func_80B1C5A0);
} else if (Actor_ProcessTalkRequest(&this->actor, play)) {
v1 = this->actor.shape.rot.y;
v1 -= this->h_21E;
v1 = this->actor.yawTowardsPlayer - v1;
this->actionCountdown = 0;
- this->h_1E0 = 1;
+ this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
} else if (DECR(this->actionCountdown) == 0) {
EnTk_WalkAnim(this, play);
this->actionFunc = EnTk_Walk;
@@ -559,9 +559,9 @@ void EnTk_Rest(EnTk* this, PlayState* play) {
}
void EnTk_Walk(EnTk* this, PlayState* play) {
- if (this->h_1E0 == 2) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
EnTk_DigAnim(this, play);
- this->h_1E0 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = EnTk_Dig;
} else {
this->actor.speedXZ = EnTk_Step(this, play);
diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h
index b9e38cab5..208b4e81d 100644
--- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h
+++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h
@@ -3,6 +3,7 @@
#include "ultra64.h"
#include "global.h"
+#include "z64.h"
/* Dirt particle effect */
struct EnTkEff;
@@ -28,8 +29,7 @@ typedef struct EnTk {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnTkActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ s16 h_1E0;
- /* 0x01E2 */ char unk_1E2[0x26];
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 validDigHere;
/* 0x0209 */ u8 rewardCount[4];
/* 0x0210 */ Actor* currentSpot;
diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c
index 93425a0bc..00f724459 100644
--- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c
+++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c
@@ -357,20 +357,20 @@ void EnToryo_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->stateFlags & 8) {
- this->unk_1EC.unk_18.x = player->actor.focus.pos.x;
- this->unk_1EC.unk_18.y = player->actor.focus.pos.y;
- this->unk_1EC.unk_18.z = player->actor.focus.pos.z;
+ this->interactInfo.trackPos.x = player->actor.focus.pos.x;
+ this->interactInfo.trackPos.y = player->actor.focus.pos.y;
+ this->interactInfo.trackPos.z = player->actor.focus.pos.z;
if (this->stateFlags & 0x10) {
- func_80034A14(thisx, &this->unk_1EC, 0, 4);
+ Npc_TrackPoint(thisx, &this->interactInfo, 0, NPC_TRACKING_FULL_BODY);
return;
}
rot = thisx->yawTowardsPlayer - thisx->shape.rot.y;
if ((rot < 14563.0f) && (rot > -14563.0f)) {
- func_80034A14(thisx, &this->unk_1EC, 0, 2);
+ Npc_TrackPoint(thisx, &this->interactInfo, 0, NPC_TRACKING_HEAD_AND_TORSO);
} else {
- func_80034A14(thisx, &this->unk_1EC, 0, 1);
+ Npc_TrackPoint(thisx, &this->interactInfo, 0, NPC_TRACKING_NONE);
}
}
}
@@ -389,12 +389,12 @@ s32 EnToryo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (this->stateFlags & 8) {
switch (limbIndex) {
case 8:
- rot->x += this->unk_1EC.unk_0E.y;
- rot->y -= this->unk_1EC.unk_0E.x;
+ rot->x += this->interactInfo.torsoRot.y;
+ rot->y -= this->interactInfo.torsoRot.x;
break;
case 15:
- rot->x += this->unk_1EC.unk_08.y;
- rot->z += this->unk_1EC.unk_08.x;
+ rot->x += this->interactInfo.headRot.y;
+ rot->z += this->interactInfo.headRot.x;
break;
}
}
diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h
index c82f7aec2..2f703d830 100644
--- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h
+++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h
@@ -17,7 +17,7 @@ typedef struct EnToryo {
/* 0x01E4 */ s32 unk_1E4;
/* 0x01E8 */ u16 stateFlags;
/* 0x01EA */ s16 unk_1EA;
- /* 0x01EC */ struct_80034A14_arg1 unk_1EC;
+ /* 0x01EC */ NpcInteractInfo interactInfo;
/* 0x0214 */ Vec3s jointTable[17];
/* 0x027A */ Vec3s morphTable[17];
} EnToryo; // size = 0x02E0
diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c
index 1be73bdae..5d959655e 100644
--- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c
+++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c
@@ -78,9 +78,9 @@ void EnXc_Destroy(Actor* thisx, PlayState* play) {
void EnXc_CalculateHeadTurn(EnXc* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->npcInfo.unk_18 = player->actor.world.pos;
- this->npcInfo.unk_14 = kREG(16) - 3.0f;
- func_80034A14(&this->actor, &this->npcInfo, kREG(17) + 0xC, 2);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) - 3.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_HEAD_AND_TORSO);
}
void EnXc_SetEyePattern(EnXc* this) {
@@ -2345,11 +2345,11 @@ s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (this->unk_30C != 0) {
if (limbIndex == 9) {
- rot->x += this->npcInfo.unk_0E.y;
- rot->y -= this->npcInfo.unk_0E.x;
+ rot->x += this->interactInfo.torsoRot.y;
+ rot->y -= this->interactInfo.torsoRot.x;
} else if (limbIndex == 16) {
- rot->x += this->npcInfo.unk_08.y;
- rot->z += this->npcInfo.unk_08.x;
+ rot->x += this->interactInfo.headRot.y;
+ rot->z += this->interactInfo.headRot.x;
}
}
return 0;
diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.h b/src/overlays/actors/ovl_En_Xc/z_en_xc.h
index 8a8dc4850..beac1a859 100644
--- a/src/overlays/actors/ovl_En_Xc/z_en_xc.h
+++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.h
@@ -139,7 +139,7 @@ typedef struct EnXc {
/* 0x02C0 */ ColliderCylinder collider;
/* 0x030C */ s32 unk_30C;
/* 0x0310 */ Actor* flameActor;
- /* 0x0314 */ struct_80034A14_arg1 npcInfo;
+ /* 0x0314 */ NpcInteractInfo interactInfo;
} EnXc; // size = 0x033C
#endif
diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c
index 8e6ae1b72..c2d64fecf 100644
--- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c
+++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c
@@ -136,8 +136,8 @@ void func_80B536B4(EnZl3* this) {
void func_80B536C4(EnZl3* this) {
s32 pad[2];
- Vec3s* vec1 = &this->unk_3F8.unk_08;
- Vec3s* vec2 = &this->unk_3F8.unk_0E;
+ Vec3s* vec1 = &this->interactInfo.headRot;
+ Vec3s* vec2 = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100);
@@ -148,9 +148,9 @@ void func_80B536C4(EnZl3* this) {
void func_80B53764(EnZl3* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_3F8.unk_18 = player->actor.world.pos;
- this->unk_3F8.unk_14 = kREG(16) - 16.0f;
- func_80034A14(&this->actor, &this->unk_3F8, kREG(17) + 0xC, 2);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ this->interactInfo.yOffset = kREG(16) - 16.0f;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_HEAD_AND_TORSO);
}
s32 func_80B537E8(EnZl3* this) {
@@ -588,8 +588,8 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
Mtx* sp78;
MtxF sp38;
Vec3s sp30;
- Vec3s* unk_3F8_unk_08 = &this->unk_3F8.unk_08;
- Vec3s* unk_3F8_unk_0E = &this->unk_3F8.unk_0E;
+ Vec3s* unk_3F8_unk_08 = &this->interactInfo.headRot;
+ Vec3s* unk_3F8_unk_0E = &this->interactInfo.torsoRot;
if (limbIndex == 14) {
sp78 = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7);
@@ -1960,18 +1960,18 @@ void func_80B57D60(EnZl3* this, PlayState* play) {
s32 func_80B57D80(EnZl3* this, PlayState* play) {
s32 pad;
s16* sp32 = &this->actor.shape.rot.y;
- struct_80034A14_arg1* unk_3F8 = &this->unk_3F8;
+ NpcInteractInfo* interactInfo = &this->interactInfo;
Player* player = GET_PLAYER(play);
s32 unk_314 = this->unk_314;
s16 temp_v0 = func_80B57104(this, unk_314);
s32 pad2;
s16 phi_v1;
- unk_3F8->unk_18.y = player->actor.world.pos.y;
- unk_3F8->unk_18.x = (Math_SinS(temp_v0) * this->actor.xzDistToPlayer) + this->actor.world.pos.x;
- unk_3F8->unk_18.z = (Math_CosS(temp_v0) * this->actor.xzDistToPlayer) + this->actor.world.pos.z;
- unk_3F8->unk_14 = kREG(16) - 16.0f;
- func_80034A14(&this->actor, unk_3F8, kREG(17) + 0xC, 4);
+ interactInfo->trackPos.y = player->actor.world.pos.y;
+ interactInfo->trackPos.x = (Math_SinS(temp_v0) * this->actor.xzDistToPlayer) + this->actor.world.pos.x;
+ interactInfo->trackPos.z = (Math_CosS(temp_v0) * this->actor.xzDistToPlayer) + this->actor.world.pos.z;
+ interactInfo->yOffset = kREG(16) - 16.0f;
+ Npc_TrackPoint(&this->actor, interactInfo, kREG(17) + 0xC, NPC_TRACKING_FULL_BODY);
phi_v1 = ABS(temp_v0 - *sp32);
if (phi_v1 <= 0x320) {
@@ -2439,7 +2439,7 @@ s32 func_80B5944C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
if (limbIndex == 14) {
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx) * 7);
EnZl3* this = (EnZl3*)thisx;
- Vec3s* vec = &this->unk_3F8.unk_08;
+ Vec3s* vec = &this->interactInfo.headRot;
gSPSegment(gfx[0]++, 0x0C, mtx);
diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h
index 13b9a86dd..e7634ec6f 100644
--- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h
+++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.h
@@ -65,7 +65,7 @@ typedef struct EnZl3 {
/* 0x03EC */ f32 unk_3EC;
/* 0x03F0 */ f32 unk_3F0;
/* 0x03F4 */ f32 unk_3F4;
- /* 0x03F8 */ struct_80034A14_arg1 unk_3F8;
+ /* 0x03F8 */ NpcInteractInfo interactInfo;
} EnZl3; // size = 0x0420
#endif
diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c
index 39a55c826..0698d5f1c 100644
--- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c
+++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c
@@ -228,9 +228,9 @@ u16 EnZl4_GetText(PlayState* play, Actor* thisx) {
s16 func_80B5B9B0(PlayState* play, Actor* thisx) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
- return false;
+ return NPC_TALK_STATE_IDLE;
}
- return true;
+ return NPC_TALK_STATE_TALKING;
}
void EnZl4_UpdateFace(EnZl4* this) {
@@ -305,8 +305,8 @@ void EnZl4_SetMove(EnZl4* this, PlayState* play) {
void func_80B5BB78(EnZl4* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_1E0.unk_18 = player->actor.world.pos;
- func_80034A14(&this->actor, &this->unk_1E0, 2, 2);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_HEAD_AND_TORSO);
}
void EnZl4_GetActionStartPos(CsCmdActorAction* action, Vec3f* vec) {
@@ -1200,16 +1200,17 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) {
}
break;
}
- this->unk_1E0.unk_18 = player->actor.world.pos;
- func_80034A14(&this->actor, &this->unk_1E0, 2, (this->csState == ZL4_CS_WINDOW) ? 2 : 1);
+ this->interactInfo.trackPos = player->actor.world.pos;
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 2,
+ (this->csState == ZL4_CS_WINDOW) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE);
if (EnZl4_InMovingAnim(this)) {
EnZl4_SetMove(this, play);
}
}
void EnZl4_Idle(EnZl4* this, PlayState* play) {
- func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText,
- func_80B5B9B0);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 60.0f,
+ EnZl4_GetText, func_80B5B9B0);
func_80B5BB78(this, play);
}
@@ -1268,14 +1269,14 @@ s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
Vec3s sp1C;
if (limbIndex == 17) {
- sp1C = this->unk_1E0.unk_08;
+ sp1C = this->interactInfo.headRot;
Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY);
Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 10) {
- sp1C = this->unk_1E0.unk_0E;
+ sp1C = this->interactInfo.torsoRot;
Matrix_RotateY(BINANG_TO_RAD_ALT(sp1C.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT(sp1C.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h
index 05d6a2655..4caa9bb9a 100644
--- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h
+++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h
@@ -14,7 +14,7 @@ typedef struct EnZl4 {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnZl4ActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
- /* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
+ /* 0x01E0 */ NpcInteractInfo interactInfo;
/* 0x0208 */ u8 talkState;
/* 0x0209 */ u8 csState;
/* 0x020A */ u8 leftEyeState;
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
index 11d09b02e..ad93a79f6 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
@@ -449,13 +449,13 @@ s16 func_80B61298(PlayState* play, Actor* thisx) {
case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8:
case TEXT_STATE_9:
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_CLOSING:
switch (thisx->textId) {
case 0x4020:
case 0x4021:
- return 0;
+ return NPC_TALK_STATE_IDLE;
case 0x4008:
SET_INFTABLE(INFTABLE_124);
break;
@@ -464,12 +464,12 @@ s16 func_80B61298(PlayState* play, Actor* thisx) {
break;
}
SET_EVENTCHKINF(EVENTCHKINF_30);
- return 0;
+ return NPC_TALK_STATE_IDLE;
case TEXT_STATE_CHOICE:
switch (Message_ShouldAdvance(play)) {
case 0:
- return 1;
+ return NPC_TALK_STATE_TALKING;
default:
if (thisx->textId == 0x400C) {
thisx->textId = (play->msgCtx.choiceIndex == 0) ? 0x400D : 0x400E;
@@ -477,18 +477,19 @@ s16 func_80B61298(PlayState* play, Actor* thisx) {
}
break;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
case TEXT_STATE_EVENT:
switch (Message_ShouldAdvance(play)) {
case 0:
- return 1;
+ return NPC_TALK_STATE_TALKING;
default:
- return 2;
+ return NPC_TALK_STATE_ACTION;
}
+ return NPC_TALK_STATE_TALKING;
}
- return 1;
+ return NPC_TALK_STATE_TALKING;
}
void EnZo_Blink(EnZo* this) {
@@ -504,16 +505,17 @@ void EnZo_Blink(EnZo* this) {
void EnZo_Dialog(EnZo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- this->unk_194.unk_18 = player->actor.world.pos;
+ this->interactInfo.trackPos = player->actor.world.pos;
if (this->actionFunc == EnZo_Standing) {
// Look down at link if child, look up if adult
- this->unk_194.unk_14 = !LINK_IS_ADULT ? 10.0f : -10.0f;
+ this->interactInfo.yOffset = !LINK_IS_ADULT ? 10.0f : -10.0f;
} else {
- this->unk_194.unk_18.y = this->actor.world.pos.y;
+ this->interactInfo.trackPos.y = this->actor.world.pos.y;
}
- func_80034A14(&this->actor, &this->unk_194, 11, this->unk_64C);
+ Npc_TrackPoint(&this->actor, &this->interactInfo, 11, this->trackingMode);
if (this->canSpeak == true) {
- func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->dialogRadius, func_80B61024, func_80B61298);
+ Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, func_80B61024,
+ func_80B61298);
}
}
@@ -541,7 +543,7 @@ void EnZo_SetAnimation(EnZo* this) {
if (this->skelAnime.animation == &gZoraHandsOnHipsTappingFootAnim ||
this->skelAnime.animation == &gZoraOpenArmsAnim) {
- if (this->unk_194.unk_00 == 0) {
+ if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (this->actionFunc == EnZo_Standing) {
animId = ENZO_ANIM_0;
} else {
@@ -550,12 +552,13 @@ void EnZo_SetAnimation(EnZo* this) {
}
}
- if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4006 &&
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE && this->actor.textId == 0x4006 &&
this->skelAnime.animation != &gZoraHandsOnHipsTappingFootAnim) {
animId = ENZO_ANIM_6;
}
- if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4007 && this->skelAnime.animation != &gZoraOpenArmsAnim) {
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE && this->actor.textId == 0x4007 &&
+ this->skelAnime.animation != &gZoraOpenArmsAnim) {
animId = ENZO_ANIM_7;
}
@@ -586,9 +589,9 @@ void EnZo_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->dialogRadius = this->collider.dim.radius + 30.0f;
- this->unk_64C = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->canSpeak = false;
- this->unk_194.unk_00 = 0;
+ this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius, 0.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
@@ -613,20 +616,20 @@ void EnZo_Standing(EnZo* this, PlayState* play) {
func_80034F54(play, this->unk_656, this->unk_67E, 20);
EnZo_SetAnimation(this);
- if (this->unk_194.unk_00 != 0) {
- this->unk_64C = 4;
+ if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
+ this->trackingMode = NPC_TRACKING_FULL_BODY;
return;
}
angle = ABS((s16)((f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y));
if (angle < 0x4718) {
if (EnZo_PlayerInProximity(this, play)) {
- this->unk_64C = 2;
+ this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
- this->unk_64C = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
}
} else {
- this->unk_64C = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
}
}
@@ -656,7 +659,7 @@ void EnZo_TreadWater(EnZo* this, PlayState* play) {
func_80034F54(play, this->unk_656, this->unk_67E, 20);
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->canSpeak = true;
- this->unk_64C = 4;
+ this->trackingMode = NPC_TRACKING_FULL_BODY;
this->skelAnime.playSpeed = 0.0f;
}
EnZo_SetAnimation(this);
@@ -678,7 +681,7 @@ void EnZo_TreadWater(EnZo* this, PlayState* play) {
f32 startFrame;
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_4);
this->canSpeak = false;
- this->unk_64C = 1;
+ this->trackingMode = NPC_TRACKING_NONE;
this->actionFunc = EnZo_Dive;
startFrame = this->skelAnime.startFrame;
this->skelAnime.startFrame = this->skelAnime.endFrame;
@@ -756,14 +759,14 @@ s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (limbIndex == 15) {
Matrix_Translate(1800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- vec = this->unk_194.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(-1800.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
- vec = this->unk_194.unk_0E;
+ vec = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-vec.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(vec.x), MTXMODE_APPLY);
}
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
index afb739aa6..28eebdf46 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
@@ -25,7 +25,7 @@ typedef struct EnZo {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnZoActionFunc actionFunc;
- /* 0x0194 */ struct_80034A14_arg1 unk_194;
+ /* 0x0194 */ NpcInteractInfo interactInfo;
/* 0x01BC */ ColliderCylinder collider;
/* 0x0208 */ u8 canSpeak;
/* 0x020A */ Vec3s jointTable[20];
@@ -33,7 +33,7 @@ typedef struct EnZo {
/* 0x02FC */ EnZoEffect effects[EN_ZO_EFFECT_COUNT];
/* 0x0644 */ f32 dialogRadius;
/* 0x0648 */ f32 alpha;
- /* 0x064C */ s16 unk_64C;
+ /* 0x064C */ s16 trackingMode;
/* 0x064E */ s16 rippleTimer;
/* 0x0650 */ s16 timeToDive;
/* 0x0652 */ s16 blinkTimer;