Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation pass for the Target system #1558

Closed
wants to merge 15 commits into from
6 changes: 3 additions & 3 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play);
void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex,
Vec3f* rightFootPos);
void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest);
void func_8002C124(TargetContext* targetCtx, PlayState* play);
void Target_Draw(TargetContext* targetCtx, PlayState* play);
s32 Flags_GetSwitch(PlayState* play, s32 flag);
void Flags_SetSwitch(PlayState* play, s32 flag);
void Flags_UnsetSwitch(PlayState* play, s32 flag);
Expand Down Expand Up @@ -394,7 +394,7 @@ void func_8002ED80(Actor* actor, PlayState* play, s32 flag);
PosRot Actor_GetFocus(Actor* actor);
PosRot Actor_GetWorld(Actor* actor);
PosRot Actor_GetWorldPosShapeRot(Actor* actor);
s32 func_8002F0C8(Actor* actor, Player* player, s32 flag);
s32 Target_OutsideLeashRange(Actor* actor, Player* player, s32 ignoreLeash);
s32 Actor_TalkOfferAccepted(Actor* actor, PlayState* play);
s32 Actor_OfferTalkExchange(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, u32 exchangeItemId);
s32 Actor_OfferTalkExchangeEquiCylinder(Actor* actor, PlayState* play, f32 radius, u32 exchangeItemId);
Expand Down Expand Up @@ -442,7 +442,7 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play
void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx);
Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play);
Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play);
Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player);
Actor* Target_GetTargetActor(PlayState* play, ActorContext* actorCtx, Actor** targetableP, Player* player);
Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory);
void Enemy_StartFinishingBlow(PlayState* play, Actor* actor);
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3);
Expand Down
26 changes: 0 additions & 26 deletions include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,6 @@ typedef struct {
/* 0x04 */ s32 timer;
} FrameAdvanceContext; // size = 0x8

typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unk_0C; // radius?
/* 0x10 */ Color_RGB8 color;
} TargetContextEntry; // size = 0x14

typedef struct {
/* 0x00 */ Vec3f naviRefPos; // possibly wrong
/* 0x0C */ Vec3f targetCenterPos;
/* 0x18 */ Color_RGBAf naviInner;
/* 0x28 */ Color_RGBAf naviOuter;
/* 0x38 */ Actor* arrowPointedActor;
/* 0x3C */ Actor* targetedActor;
/* 0x40 */ f32 unk_40;
/* 0x44 */ f32 unk_44;
/* 0x48 */ s16 unk_48;
/* 0x4A */ u8 activeCategory;
/* 0x4B */ u8 unk_4B;
/* 0x4C */ s8 unk_4C;
/* 0x4D */ char unk_4D[0x03];
/* 0x50 */ TargetContextEntry arr_50[3];
/* 0x8C */ Actor* unk_8C;
/* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY
/* 0x94 */ Actor* unk_94;
} TargetContext; // size = 0x98

typedef struct {
/* 0x00 */ void* texture;
/* 0x04 */ s16 x;
Expand Down
42 changes: 41 additions & 1 deletion include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ typedef struct Actor {
/* 0x0F8 */ f32 uncullZoneScale; // Amount to increase the uncull zone scale by (in projected space)
/* 0x0FC */ f32 uncullZoneDownward; // Amount to increase uncull zone downward by (in projected space)
/* 0x100 */ Vec3f prevPos; // World position from the previous update cycle
/* 0x10C */ u8 isTargeted; // Set to true if the actor is currently being targeted by the player
/* 0x10C */ u8 isLockedOn; // Set to true if the actor is currently being targeted by the player
/* 0x10D */ u8 targetPriority; // Lower values have higher priority. Resets to 0 when player stops targeting
/* 0x10E */ u16 textId; // Text ID to pass to player/display when interacting with the actor
/* 0x110 */ u16 freezeTimer; // Actor does not update when set. Timer decrements automatically
Expand Down Expand Up @@ -515,6 +515,46 @@ typedef enum {
/* 0xFF */ NAVI_ENEMY_NONE = 0xFF
} NaviEnemy;

// A set of 4 triangles which appear as a ring around an actor when the player Z-Targets it
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 radius; // distance towards the center of the locked on actor
/* 0x10 */ Color_RGB8 color;
} LockOnReticle; // size = 0x14

typedef struct {
/* 0x00 */ Vec3f naviPos; // Used by Navi to indicate a targetable actor or general hint
/* 0x0C */ Vec3f lockOnPos;
/* 0x18 */ Color_RGBAf naviInnerColor;
/* 0x28 */ Color_RGBAf naviOuterColor;
/* 0x38 */ Actor* naviHoverActor; // The actor that Navi hovers over
/* 0x3C */ Actor* lockOnActor;
/* 0x40 */ f32 naviMoveProgressFactor; // Controls Navi so she can smootly transition to the target actor
/* 0x44 */ f32 reticleRadius; // Control the reticle coming in from offscreen when you first target
/* 0x48 */ s16 reticleFadeAlphaControl; // Set and fade the reticle alpha. Also controls the reticle drawing with non-zero values.
/* 0x4A */ u8 naviHoverActorCategory; // category of the actor Navi is currently hovering over
/* 0x4B */ u8 reticleSpinCounter; // counts up when a reticle is active, used for z rotation of reticle
/* 0x4C */ s8 lockOnIndex;
/* 0x50 */ LockOnReticle lockOnReticles[3];
/* 0x8C */ Actor* forcedTargetActor; // Not used, always set to NULL
/* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY
/* 0x94 */ Actor* arrowHoverActor; // actor a target arrow is currently hovering over
} TargetContext; // size = 0x98

typedef enum {
/* 0 */ TARGET_MODE_0,
/* 1 */ TARGET_MODE_1,
/* 2 */ TARGET_MODE_2,
/* 3 */ TARGET_MODE_3,
/* 4 */ TARGET_MODE_4,
/* 5 */ TARGET_MODE_5,
/* 6 */ TARGET_MODE_6,
/* 7 */ TARGET_MODE_7,
/* 8 */ TARGET_MODE_8,
/* 9 */ TARGET_MODE_9,
/* 10 */ TARGET_MODE_MAX
} TargetMode;

#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
#define GET_TRANSITION_ACTOR_INDEX(actor) ((u16)(actor)->params >> TRANSITION_ACTOR_PARAMS_INDEX_SHIFT)

Expand Down
Loading