NPC Tracking (#1184)

* npc tracking

* fix func declaration

* more cleanup

* rm named var

* more cleanup
This commit is contained in:
engineer124
2023-03-07 23:33:16 -03:00
committed by GitHub
parent e50ab59cf7
commit e8f906100b
14 changed files with 338 additions and 206 deletions
+2 -2
View File
@@ -752,8 +752,8 @@ void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u1
Hilite* func_800BCBF4(Vec3f* arg0, PlayState* play);
Hilite* func_800BCC68(Vec3f* arg0, PlayState* play);
void Actor_GetClosestPosOnPath(Vec3s* points, s32 numPoints, Vec3f* srcPos, Vec3f* dstPos, s32 isPathLoop);
s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*textIdCallback)(PlayState*, Actor*), s16 (*arg5)(PlayState*, Actor*));
void func_800BD888(Actor* actor, struct_800BD888_arg1* arg1, s16 arg2, s16 arg3);
s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, NpcUpdateTalkStateFunc updateTalkState);
void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex, s16 trackingMode);
void func_800BD9E0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha);
void func_800BDAA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha);
void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 animIndex);
-1
View File
@@ -417,7 +417,6 @@ extern Color_RGBA8 actorDefaultHitColor;
// extern UNK_TYPE4 D_801AEDD4;
// extern UNK_TYPE4 D_801AEE28;
// extern UNK_TYPE4 D_801AEE30;
// extern UNK_TYPE4 D_801AEE38;
// extern UNK_TYPE2 D_801AEE4C;
extern Gfx D_801AEF88[];
extern Gfx D_801AEFA0[];
-13
View File
@@ -839,19 +839,6 @@ typedef struct {
/* 0x10 */ Color_RGBA8_u32 envColor;
} Struct_80140E80; // size = 0x14
// From OoT's struct_80034A14_arg1
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; // Usually setted to Player's position or Player's focus
/* 0x24 */ s16 unk_24;
} struct_800BD888_arg1; // size = 0x28
typedef struct {
/* 0x0 */ u32 type;
/* 0x4 */ u32 setScissor;
+29
View File
@@ -22,6 +22,8 @@ struct EnBox;
struct EnTorch2;
typedef void(*ActorFunc)(struct Actor* this, struct PlayState* play);
typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*);
typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*);
typedef struct {
/* 0x00 */ Vec3f pos;
@@ -639,4 +641,31 @@ typedef enum {
/* 0xFF */ TATL_HINT_ID_NONE = 0xFF
} TatlHintId;
typedef enum NpcTalkState {
/* 0 */ NPC_TALK_STATE_IDLE, // NPC not currently talking to player
/* 1 */ NPC_TALK_STATE_TALKING, // NPC is currently talking to player
/* 2 */ NPC_TALK_STATE_ACTION, // An NPC-defined action triggered in the conversation
/* 3 */ NPC_TALK_STATE_ITEM_GIVEN // NPC finished giving an item and text box is done
} NpcTalkState;
typedef enum NpcTrackingMode {
/* 0 */ NPC_TRACKING_PLAYER_AUTO_TURN, // Determine tracking mode based on player position, see Npc_UpdateAutoTurn
/* 1 */ NPC_TRACKING_NONE, // Don't track the target (usually the player)
/* 2 */ NPC_TRACKING_HEAD_AND_TORSO, // Track target by turning the head and the torso
/* 3 */ NPC_TRACKING_HEAD, // Track target by turning the head
/* 4 */ NPC_TRACKING_FULL_BODY // Track target by turning the body, torso and head
} NpcTrackingMode;
typedef struct NpcInteractInfo {
/* 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 */ UNK_TYPE1 unk_24[0x4];
} NpcInteractInfo; // size = 0x28
#endif