1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 11:03:46 +00:00

Target -> Attention (System Rename) (#2149)

* TargetContext -> Attention

* targetCtx -> attention

* Target_ -> Attention_

* FindTargetableActor -> FindActor

* targetableActorP -> attentionActorP

* data vars (and 1 function I missed)

* targetMode -> attentionRangeType

* attention range enum comments

* ATTENTION_RANGE_

* attention range data

* TargetColor -> AttentionColor

* missed one

* fixup color variables

* targetArrowOffset -> lockOnArrowOffset

* focus pos comment

* targetPriority -> attentionPriority

* assets

* loose-ends

* Attention System Description

* format

* skj range type

* enemy bgm
This commit is contained in:
fig02 2024-09-07 09:23:04 -04:00 committed by GitHub
parent a30f130eb9
commit 88c4475967
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
156 changed files with 497 additions and 470 deletions

View file

@ -647,7 +647,7 @@
<DList Name="gGameplayKeepDL_C8B0" Offset="0xC8B0"/>
<DList Name="gZTargetArrowDL" Offset="0xCC10"/>
<DList Name="gLockOnArrowDL" Offset="0xCC10"/>
<Texture Name="gHilite3Tex" OutName="hilite_3" Format="i8" Width="8" Height="8" Offset="0xCD20"/>
<DList Name="gEffFragments2DL" Offset="0xCE20"/>
@ -968,7 +968,7 @@
<DList Name="gKokiriDustMoteMaterialDL" Offset="0x52690"/>
<DList Name="gKokiriDustMoteModelDL" Offset="0x526D8"/>
<DList Name="gSunDL" Offset="0x526F0"/>
<DList Name="gZTargetLockOnTriangleDL" Offset="0x52980"/>
<DList Name="gLockOnReticleTriangleDL" Offset="0x52980"/>
<DList Name="gEffFire1DL" Offset="0x52A10"/>
<DList Name="gEffFire2DL" Offset="0x52AD0"/>
<Texture Name="gDecorativeFlameMaskTex" OutName="eff_fire_mask" Format="i4" Width="32" Height="128" Offset="0x52B90"/>

View file

@ -644,7 +644,7 @@
<DList Name="gBoomerangDL" Offset="0xC698"/>
<DList Name="gBoomerangRefDL" Offset="0xC808"/>
<DList Name="gCompassArrowDL" Offset="0xC820"/>
<DList Name="gZTargetArrowDL" Offset="0xCB70"/>
<DList Name="gLockOnArrowDL" Offset="0xCB70"/>
<Texture Name="gHilite3Tex" OutName="hilite_3" Format="i8" Width="8" Height="8" Offset="0xCC80"/>
<DList Name="gEffFragments2DL" Offset="0xCD80"/>
<Texture Name="gSelectionCursorTex" OutName="selection_cursor" Format="ia4" Width="16" Height="16" Offset="0xCDC0"/>
@ -934,7 +934,7 @@
<DList Name="gKokiriDustMoteMaterialDL" Offset="0x4D160"/>
<DList Name="gKokiriDustMoteModelDL" Offset="0x4D1A8"/>
<DList Name="gSunDL" Offset="0x4D1C0"/>
<DList Name="gZTargetLockOnTriangleDL" Offset="0x4D450"/>
<DList Name="gLockOnReticleTriangleDL" Offset="0x4D450"/>
<DList Name="gEffFire1DL" Offset="0x4D4E0"/>
<DList Name="gEffFire2DL" Offset="0x4D5A0"/>
<Texture Name="gDecorativeFlameMaskTex" OutName="eff_fire_mask" Format="i4" Width="32" Height="128" Offset="0x4D660"/>

View file

@ -309,7 +309,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 Target_Draw(TargetContext* targetCtx, PlayState* play);
void Attention_Draw(Attention* attention, PlayState* play);
s32 Flags_GetSwitch(PlayState* play, s32 flag);
void Flags_SetSwitch(PlayState* play, s32 flag);
void Flags_UnsetSwitch(PlayState* play, s32 flag);
@ -382,7 +382,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 Target_ShouldReleaseLockOn(Actor* actor, Player* player, s32 ignoreLeash);
s32 Attention_ShouldReleaseLockOn(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);
@ -430,7 +430,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* Target_FindTargetableActor(PlayState* play, ActorContext* actorCtx, Actor** targetableActorP, Player* player);
Actor* Attention_FindActor(PlayState* play, ActorContext* actorCtx, Actor** attentionActorP, Player* player);
Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory);
void Enemy_StartFinishingBlow(PlayState* play, Actor* actor);
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play);

View file

@ -224,11 +224,11 @@ typedef struct Actor {
/* 0x008 */ PosRot home; // Initial position/rotation when spawned. Can be used for other purposes
/* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data"
/* 0x01E */ s8 objectSlot; // Object slot (in ObjectContext) corresponding to the actor's object; original name: "bank"
/* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on
/* 0x01F */ s8 attentionRangeType; // Controls the attention actor range and the lock-on leash range. See `AttentionRangeType`.
/* 0x020 */ u16 sfx; // SFX ID to play. Sfx plays when value is set, then is cleared the following update cycle
/* 0x024 */ PosRot world; // Position/rotation in the world
/* 0x038 */ PosRot focus; // Target reticle focuses on this position. For player this represents head pos and rot
/* 0x04C */ f32 targetArrowOffset; // Height offset of the target arrow relative to `focus` position
/* 0x038 */ PosRot focus; // Player + camera focus pos during lock-on, among other uses. For player this represents head pos and rot.
/* 0x04C */ f32 lockOnArrowOffset; // Height offset of the lock-on arrow relative to `focus` position
/* 0x050 */ Vec3f scale; // Scale of the actor in each axis
/* 0x05C */ Vec3f velocity; // Velocity of the actor in each axis
/* 0x068 */ f32 speed; // Context dependent speed value. Can be used for XZ or XYZ depending on which move function is used
@ -255,7 +255,7 @@ typedef struct Actor {
/* 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 isLockedOn; // Set to true if the actor is currently locked-on by Player
/* 0x10D */ u8 targetPriority; // Lower values have higher priority. Resets to 0 when player stops targeting
/* 0x10D */ u8 attentionPriority; // Lower values have higher priority. Resets to 0 when lock-on is released.
/* 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
/* 0x112 */ u16 colorFilterParams; // Set color filter to red, blue, or white. Toggle opa or xlu
@ -538,6 +538,20 @@ typedef enum NaviEnemy {
/* 0xFF */ NAVI_ENEMY_NONE = 0xFF
} NaviEnemy;
/**
* Attention System
*
* The Attention System's responsibility is to bring specific actors to the player's attention.
* This includes:
* - Making Navi fly over to certain actors of interest (can be lock-on actors, but may also not be)
* - Displaying an arrow over an actor that can be locked onto
* - Displaying a reticle over the current lock-on actor
* - Playing enemy background music if a hostile actor is nearby
*
* This system does not handle the actual lock-on implementation.
* That is the responsibility of Player via `player->focusActor` and the camera.
*/
// A set of 4 triangles which appear as a ring around an actor when locked-on
typedef struct LockOnReticle {
/* 0x00 */ Vec3f pos;
@ -545,7 +559,7 @@ typedef struct LockOnReticle {
/* 0x10 */ Color_RGB8 color;
} LockOnReticle; // size = 0x14
typedef struct TargetContext {
typedef struct Attention {
/* 0x00 */ Vec3f naviHoverPos; // Navi's current hover position
/* 0x0C */ Vec3f reticlePos; // Main reticle pos which each `LockOnReticle` instance can reference
/* 0x18 */ Color_RGBAf naviInnerColor; // Navi inner color, based on actor category
@ -562,21 +576,24 @@ typedef struct TargetContext {
/* 0x8C */ Actor* forcedLockOnActor; // Forces lock-on to this actor when set (never used in practice)
/* 0x90 */ Actor* bgmEnemy; // The nearest actor which can trigger enemy background music
/* 0x94 */ Actor* arrowHoverActor; // Actor to draw an arrow over
} TargetContext; // size = 0x98
} Attention; // size = 0x98
typedef enum {
/* 0 */ TARGET_MODE_0,
/* 1 */ TARGET_MODE_1,
/* 2 */ TARGET_MODE_2,
/* 3 */ TARGET_MODE_3, // Used as the default for new actors
/* 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;
// It is difficult to give each type a name because it is numerically based
// and there are so many different combinations.
// Each type has a comment of the form "attention range / lock-on leash range"
typedef enum AttentionRangeType {
/* 0 */ ATTENTION_RANGE_0, // 70 / 140
/* 1 */ ATTENTION_RANGE_1, // 170 / 255
/* 2 */ ATTENTION_RANGE_2, // 280 / 5600
/* 3 */ ATTENTION_RANGE_3, // 350 / 525 (default)
/* 4 */ ATTENTION_RANGE_4, // 700 / 1050
/* 5 */ ATTENTION_RANGE_5, // 1000 / 1500
/* 6 */ ATTENTION_RANGE_6, // 100 / 105.36842
/* 7 */ ATTENTION_RANGE_7, // 140 / 163.33333
/* 8 */ ATTENTION_RANGE_8, // 240 / 576
/* 9 */ ATTENTION_RANGE_9, // 280 / 280000
/* 10 */ ATTENTION_RANGE_MAX
} AttentionRangeType;
typedef struct TitleCardContext {
/* 0x00 */ void* texture;
@ -615,7 +632,7 @@ typedef struct ActorContext {
/* 0x004 */ char unk_04[0x04];
/* 0x008 */ u8 total; // total number of actors loaded
/* 0x00C */ ActorListEntry actorLists[ACTORCAT_MAX];
/* 0x06C */ TargetContext targetCtx;
/* 0x06C */ Attention attention;
/* 0x104 */ ActorContextSceneFlags flags;
/* 0x128 */ TitleCardContext titleCtx;
/* 0x138 */ char unk_138[0x04];

View file

@ -236,12 +236,12 @@ void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedIn
*cappedInvWDest = (*cappedInvWDest < 1.0f) ? 1.0f : (1.0f / *cappedInvWDest);
}
typedef struct TargetColor {
/* 0x00 */ Color_RGBA8 inner;
/* 0x04 */ Color_RGBA8 outer;
} TargetColor; // size = 0x8
typedef struct AttentionColor {
/* 0x00 */ Color_RGBA8 primary; // Used for Navi's inner color, lock-on arrow, and lock-on reticle
/* 0x04 */ Color_RGBA8 secondary; // Used for Navi's outer color
} AttentionColor; // size = 0x8
TargetColor sTargetColorList[ACTORCAT_MAX + 1] = {
AttentionColor sAttentionColors[ACTORCAT_MAX + 1] = {
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_SWITCH
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_BG
{ { 255, 255, 255, 255 }, { 0, 0, 255, 0 } }, // ACTORCAT_PLAYER
@ -262,72 +262,72 @@ Gfx D_80115FF0[] = {
gsSPEndDisplayList(),
};
void Target_SetReticlePos(TargetContext* targetCtx, s32 reticleNum, f32 x, f32 y, f32 z) {
targetCtx->lockOnReticles[reticleNum].pos.x = x;
targetCtx->lockOnReticles[reticleNum].pos.y = y;
targetCtx->lockOnReticles[reticleNum].pos.z = z;
void Attention_SetReticlePos(Attention* attention, s32 reticleNum, f32 x, f32 y, f32 z) {
attention->lockOnReticles[reticleNum].pos.x = x;
attention->lockOnReticles[reticleNum].pos.y = y;
attention->lockOnReticles[reticleNum].pos.z = z;
targetCtx->lockOnReticles[reticleNum].radius = targetCtx->reticleRadius;
attention->lockOnReticles[reticleNum].radius = attention->reticleRadius;
}
void Target_InitReticle(TargetContext* targetCtx, s32 actorCategory, PlayState* play) {
void Attention_InitReticle(Attention* attention, s32 actorCategory, PlayState* play) {
LockOnReticle* reticle;
TargetColor* reticleColor = &sTargetColorList[actorCategory];
AttentionColor* attentionColor = &sAttentionColors[actorCategory];
s32 i;
Math_Vec3f_Copy(&targetCtx->reticlePos, &play->view.eye);
Math_Vec3f_Copy(&attention->reticlePos, &play->view.eye);
targetCtx->reticleRadius = 500.0f; // radius starts wide to zoom in on the actor
targetCtx->reticleFadeAlphaControl = 256;
attention->reticleRadius = 500.0f; // radius starts wide to zoom in on the actor
attention->reticleFadeAlphaControl = 256;
reticle = &targetCtx->lockOnReticles[0];
reticle = &attention->lockOnReticles[0];
for (i = 0; i < ARRAY_COUNT(targetCtx->lockOnReticles); i++, reticle++) {
Target_SetReticlePos(targetCtx, i, 0.0f, 0.0f, 0.0f);
for (i = 0; i < ARRAY_COUNT(attention->lockOnReticles); i++, reticle++) {
Attention_SetReticlePos(attention, i, 0.0f, 0.0f, 0.0f);
reticle->color.r = reticleColor->inner.r;
reticle->color.g = reticleColor->inner.g;
reticle->color.b = reticleColor->inner.b;
reticle->color.r = attentionColor->primary.r;
reticle->color.g = attentionColor->primary.g;
reticle->color.b = attentionColor->primary.b;
}
}
void Target_SetNaviState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) {
TargetColor* targetColor = &sTargetColorList[actorCategory];
void Attention_SetNaviState(Attention* attention, Actor* actor, s32 actorCategory, PlayState* play) {
AttentionColor* attentionColor = &sAttentionColors[actorCategory];
targetCtx->naviHoverPos.x = actor->focus.pos.x;
targetCtx->naviHoverPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y);
targetCtx->naviHoverPos.z = actor->focus.pos.z;
attention->naviHoverPos.x = actor->focus.pos.x;
attention->naviHoverPos.y = actor->focus.pos.y + (actor->lockOnArrowOffset * actor->scale.y);
attention->naviHoverPos.z = actor->focus.pos.z;
targetCtx->naviInnerColor.r = targetColor->inner.r;
targetCtx->naviInnerColor.g = targetColor->inner.g;
targetCtx->naviInnerColor.b = targetColor->inner.b;
targetCtx->naviInnerColor.a = targetColor->inner.a;
attention->naviInnerColor.r = attentionColor->primary.r;
attention->naviInnerColor.g = attentionColor->primary.g;
attention->naviInnerColor.b = attentionColor->primary.b;
attention->naviInnerColor.a = attentionColor->primary.a;
targetCtx->naviOuterColor.r = targetColor->outer.r;
targetCtx->naviOuterColor.g = targetColor->outer.g;
targetCtx->naviOuterColor.b = targetColor->outer.b;
targetCtx->naviOuterColor.a = targetColor->outer.a;
attention->naviOuterColor.r = attentionColor->secondary.r;
attention->naviOuterColor.g = attentionColor->secondary.g;
attention->naviOuterColor.b = attentionColor->secondary.b;
attention->naviOuterColor.a = attentionColor->secondary.a;
}
void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) {
targetCtx->naviHoverActor = targetCtx->reticleActor = targetCtx->forcedLockOnActor = targetCtx->bgmEnemy = NULL;
void Attention_Init(Attention* attention, Actor* actor, PlayState* play) {
attention->naviHoverActor = attention->reticleActor = attention->forcedLockOnActor = attention->bgmEnemy = NULL;
targetCtx->reticleSpinCounter = 0;
targetCtx->curReticle = 0;
targetCtx->naviMoveProgressFactor = 0.0f;
attention->reticleSpinCounter = 0;
attention->curReticle = 0;
attention->naviMoveProgressFactor = 0.0f;
Target_SetNaviState(targetCtx, actor, actor->category, play);
Target_InitReticle(targetCtx, actor->category, play);
Attention_SetNaviState(attention, actor, actor->category, play);
Attention_InitReticle(attention, actor->category, play);
}
void Target_Draw(TargetContext* targetCtx, PlayState* play) {
void Attention_Draw(Attention* attention, PlayState* play) {
Actor* actor; // used for both the reticle actor and arrow hover actor
actor = targetCtx->reticleActor;
actor = attention->reticleActor;
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029);
if (targetCtx->reticleFadeAlphaControl != 0) {
if (attention->reticleFadeAlphaControl != 0) {
LockOnReticle* reticle;
Player* player = GET_PLAYER(play);
s16 alpha;
@ -343,32 +343,32 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) {
alpha = 255;
projectdPosScale = 1.0f;
if (targetCtx->reticleSpinCounter != 0) {
if (attention->reticleSpinCounter != 0) {
// Reticle is spinning so it is active, only need to draw one
numReticles = 1;
} else {
// Use multiple reticles for the motion blur effect from the reticle
// quickly zooming in on an actor from off screen
numReticles = ARRAY_COUNT(targetCtx->lockOnReticles);
numReticles = ARRAY_COUNT(attention->lockOnReticles);
}
if (actor != NULL) {
Math_Vec3f_Copy(&targetCtx->reticlePos, &actor->focus.pos);
projectdPosScale = (500.0f - targetCtx->reticleRadius) / 420.0f;
Math_Vec3f_Copy(&attention->reticlePos, &actor->focus.pos);
projectdPosScale = (500.0f - attention->reticleRadius) / 420.0f;
} else {
// Not locked on, start fading out
targetCtx->reticleFadeAlphaControl -= 120;
attention->reticleFadeAlphaControl -= 120;
if (targetCtx->reticleFadeAlphaControl < 0) {
targetCtx->reticleFadeAlphaControl = 0;
if (attention->reticleFadeAlphaControl < 0) {
attention->reticleFadeAlphaControl = 0;
}
// `reticleFadeAlphaControl` is only used as an alpha when fading out.
// Otherwise it defaults to 255, set above.
alpha = targetCtx->reticleFadeAlphaControl;
alpha = attention->reticleFadeAlphaControl;
}
Actor_ProjectPos(play, &targetCtx->reticlePos, &projectedPos, &invW);
Actor_ProjectPos(play, &attention->reticlePos, &projectedPos, &invW);
projectedPos.x = ((SCREEN_WIDTH / 2) * (projectedPos.x * invW)) * projectdPosScale;
projectedPos.x = CLAMP(projectedPos.x, -SCREEN_WIDTH, SCREEN_WIDTH);
@ -378,20 +378,20 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) {
projectedPos.z *= projectdPosScale;
targetCtx->curReticle--;
attention->curReticle--;
if (targetCtx->curReticle < 0) {
targetCtx->curReticle = ARRAY_COUNT(targetCtx->lockOnReticles) - 1;
if (attention->curReticle < 0) {
attention->curReticle = ARRAY_COUNT(attention->lockOnReticles) - 1;
}
Target_SetReticlePos(targetCtx, targetCtx->curReticle, projectedPos.x, projectedPos.y, projectedPos.z);
Attention_SetReticlePos(attention, attention->curReticle, projectedPos.x, projectedPos.y, projectedPos.z);
if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->focusActor)) {
OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57);
for (i = 0, curReticle = targetCtx->curReticle; i < numReticles;
i++, curReticle = (curReticle + 1) % ARRAY_COUNT(targetCtx->lockOnReticles)) {
reticle = &targetCtx->lockOnReticles[curReticle];
for (i = 0, curReticle = attention->curReticle; i < numReticles;
i++, curReticle = (curReticle + 1) % ARRAY_COUNT(attention->lockOnReticles)) {
reticle = &attention->lockOnReticles[curReticle];
if (reticle->radius < 500.0f) {
if (reticle->radius <= 120.0f) {
@ -406,7 +406,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, reticle->color.r, reticle->color.g, reticle->color.b,
(u8)alpha);
Matrix_RotateZ((targetCtx->reticleSpinCounter & 0x7F) * (M_PI / 64), MTXMODE_APPLY);
Matrix_RotateZ((attention->reticleSpinCounter & 0x7F) * (M_PI / 64), MTXMODE_APPLY);
// Draw the 4 triangles that make up the reticle
for (triangleIndex = 0; triangleIndex < 4; triangleIndex++) {
@ -415,12 +415,12 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) {
Matrix_Translate(reticle->radius, reticle->radius, 0.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 2116),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL);
gSPDisplayList(OVERLAY_DISP++, gLockOnReticleTriangleDL);
Matrix_Pop();
}
}
alpha -= 255 / ARRAY_COUNT(targetCtx->lockOnReticles);
alpha -= 255 / ARRAY_COUNT(attention->lockOnReticles);
if (alpha < 0) {
alpha = 0;
@ -429,27 +429,28 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) {
}
}
actor = targetCtx->arrowHoverActor;
actor = attention->arrowHoverActor;
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) {
TargetColor* arrowColor = &sTargetColorList[actor->category];
AttentionColor* attentionColor = &sAttentionColors[actor->category];
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_7);
Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f,
Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->lockOnArrowOffset * actor->scale.y) + 17.0f,
actor->focus.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD((u16)(play->gameplayFrames * 3000)), MTXMODE_APPLY);
Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, arrowColor->inner.r, arrowColor->inner.g, arrowColor->inner.b, 255);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, attentionColor->primary.r, attentionColor->primary.g,
attentionColor->primary.b, 255);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL);
gSPDisplayList(POLY_XLU_DISP++, gLockOnArrowDL);
}
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2158);
}
void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusActor, PlayState* play) {
void Attention_Update(Attention* attention, Player* player, Actor* playerFocusActor, PlayState* play) {
s32 pad;
Actor* actor; // used for both the Navi hover actor and reticle actor
s32 category;
@ -460,23 +461,24 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusA
if ((player->focusActor != NULL) &&
(player->controlStickDirections[player->controlStickDataIndex] == PLAYER_STICK_DIR_BACKWARD)) {
// Holding backward on the control stick prevents an arrow appearing over the next targetable actor.
// This helps escape a targeting loop when using Switch Targeting, but note that this still works for
// Holding backward on the control stick prevents an arrow appearing over the next lock-on actor.
// This helps escape a lock-on loop when using Switch Targeting, but note that this still works for
// Hold Targeting as well.
targetCtx->arrowHoverActor = NULL;
attention->arrowHoverActor = NULL;
} else {
// Find the next targetable actor and draw an arrow over it
Target_FindTargetableActor(play, &play->actorCtx, &actor, player);
targetCtx->arrowHoverActor = actor;
// Find the next attention actor so Navi and an arrow can hover over it (if applicable)
Attention_FindActor(play, &play->actorCtx, &actor, player);
attention->arrowHoverActor = actor;
}
if (targetCtx->forcedLockOnActor != NULL) {
if (attention->forcedLockOnActor != NULL) {
// This lock-on actor takes precedence over anything else
// (this feature is never used in practice)
actor = targetCtx->forcedLockOnActor;
targetCtx->forcedLockOnActor = NULL;
actor = attention->forcedLockOnActor;
attention->forcedLockOnActor = NULL;
} else if (playerFocusActor != NULL) {
// Stay locked-on to the same actor
// Stay locked-on to the same actor, if there is one.
// This also makes Navi fly over to the current focus actor, if there is one.
actor = playerFocusActor;
}
@ -486,11 +488,11 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusA
category = player->actor.category;
}
if ((actor != targetCtx->naviHoverActor) || (category != targetCtx->naviHoverActorCategory)) {
if ((actor != attention->naviHoverActor) || (category != attention->naviHoverActorCategory)) {
// Set Navi to hover over a new actor
targetCtx->naviHoverActor = actor;
targetCtx->naviHoverActorCategory = category;
targetCtx->naviMoveProgressFactor = 1.0f;
attention->naviHoverActor = actor;
attention->naviHoverActorCategory = category;
attention->naviMoveProgressFactor = 1.0f;
}
if (actor == NULL) {
@ -498,21 +500,21 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusA
actor = &player->actor;
}
if (!Math_StepToF(&targetCtx->naviMoveProgressFactor, 0.0f, 0.25f)) {
f32 moveScale = 0.25f / targetCtx->naviMoveProgressFactor;
f32 x = actor->world.pos.x - targetCtx->naviHoverPos.x;
f32 y = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->naviHoverPos.y;
f32 z = actor->world.pos.z - targetCtx->naviHoverPos.z;
if (!Math_StepToF(&attention->naviMoveProgressFactor, 0.0f, 0.25f)) {
f32 moveScale = 0.25f / attention->naviMoveProgressFactor;
f32 x = actor->world.pos.x - attention->naviHoverPos.x;
f32 y = (actor->world.pos.y + (actor->lockOnArrowOffset * actor->scale.y)) - attention->naviHoverPos.y;
f32 z = actor->world.pos.z - attention->naviHoverPos.z;
targetCtx->naviHoverPos.x += x * moveScale;
targetCtx->naviHoverPos.y += y * moveScale;
targetCtx->naviHoverPos.z += z * moveScale;
attention->naviHoverPos.x += x * moveScale;
attention->naviHoverPos.y += y * moveScale;
attention->naviHoverPos.z += z * moveScale;
} else {
// Set Navi pos and color after reaching destination
Target_SetNaviState(targetCtx, actor, category, play);
Attention_SetNaviState(attention, actor, category, play);
}
if ((playerFocusActor != NULL) && (targetCtx->reticleSpinCounter == 0)) {
if ((playerFocusActor != NULL) && (attention->reticleSpinCounter == 0)) {
Actor_ProjectPos(play, &playerFocusActor->focus.pos, &projectedFocusPos, &cappedInvWDest);
if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * cappedInvWDest))) ||
@ -528,19 +530,19 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusA
}
if (playerFocusActor != NULL) {
if (playerFocusActor != targetCtx->reticleActor) {
if (playerFocusActor != attention->reticleActor) {
s32 lockOnSfxId;
// Set up a new reticle
Target_InitReticle(targetCtx, playerFocusActor->category, play);
targetCtx->reticleActor = playerFocusActor;
Attention_InitReticle(attention, playerFocusActor->category, play);
attention->reticleActor = playerFocusActor;
if (playerFocusActor->id == ACTOR_EN_BOOM) {
// Don't draw the reticle when locked onto the boomerang.
// Note that it isn't possible to lock onto the boomerang, so this code doesn't do anything.
// This implies that the boomerang camera lock may have been implemented with Z-Targeting at one point,
// but was eventually implemented as its own camera mode instead.
targetCtx->reticleFadeAlphaControl = 0;
attention->reticleFadeAlphaControl = 0;
}
lockOnSfxId = CHECK_FLAG_ALL(playerFocusActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON
@ -550,31 +552,31 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* playerFocusA
// Update reticle
targetCtx->reticlePos.x = playerFocusActor->world.pos.x;
targetCtx->reticlePos.y =
attention->reticlePos.x = playerFocusActor->world.pos.x;
attention->reticlePos.y =
playerFocusActor->world.pos.y - (playerFocusActor->shape.yOffset * playerFocusActor->scale.y);
targetCtx->reticlePos.z = playerFocusActor->world.pos.z;
attention->reticlePos.z = playerFocusActor->world.pos.z;
if (targetCtx->reticleSpinCounter == 0) {
f32 step = (500.0f - targetCtx->reticleRadius) * 3.0f;
if (attention->reticleSpinCounter == 0) {
f32 step = (500.0f - attention->reticleRadius) * 3.0f;
f32 reticleZoomStep = CLAMP(step, 30.0f, 100.0f);
if (Math_StepToF(&targetCtx->reticleRadius, 80.0f, reticleZoomStep)) {
if (Math_StepToF(&attention->reticleRadius, 80.0f, reticleZoomStep)) {
// Non-zero counter indicates the reticle is done zooming in
targetCtx->reticleSpinCounter++;
attention->reticleSpinCounter++;
}
} else {
// Finished zooming in, spin the reticle around the lock-on actor
// 0x80 is or'd to avoid a value of zero.
// This rotation value gets multiplied by 0x200, which multiplied by 0x80 gives a full turn (0x10000)
targetCtx->reticleSpinCounter = (targetCtx->reticleSpinCounter + 3) | 0x80;
targetCtx->reticleRadius = 120.0f;
attention->reticleSpinCounter = (attention->reticleSpinCounter + 3) | 0x80;
attention->reticleRadius = 120.0f;
}
} else {
// Expand the radius quickly as the reticle is released
targetCtx->reticleActor = NULL;
Math_StepToF(&targetCtx->reticleRadius, 500.0f, 80.0f);
attention->reticleActor = NULL;
Math_StepToF(&attention->reticleRadius, 500.0f, 80.0f);
}
}
@ -887,7 +889,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
Actor_SetFocus(actor, 0.0f);
Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos);
Actor_SetScale(actor, 0.01f);
actor->targetMode = TARGET_MODE_3;
actor->attentionRangeType = ATTENTION_RANGE_3;
actor->minVelocityY = -20.0f;
actor->xyzDistToPlayerSq = MAXFLOAT;
actor->naviEnemyId = NAVI_ENEMY_NONE;
@ -1580,9 +1582,9 @@ PosRot Actor_GetWorldPosShapeRot(Actor* actor) {
/**
* Returns the squared xyz distance from the actor to Player.
* This distance will be weighted if Player is already targeting another actor.
* This distance will be weighted if Player is already locked onto another actor.
*/
f32 Target_WeightedDistToPlayerSq(Actor* actor, Player* player, s16 playerShapeYaw) {
f32 Attention_WeightedDistToPlayerSq(Actor* actor, Player* player, s16 playerShapeYaw) {
s16 yawTemp = (s16)(actor->yawTowardsPlayer - 0x8000) - playerShapeYaw;
s16 yawTempAbs = ABS(yawTemp);
@ -1602,7 +1604,7 @@ f32 Target_WeightedDistToPlayerSq(Actor* actor, Player* player, s16 playerShapeY
}
}
// An actor will not be considered targetable if Player is facing more than ~60 degrees away
// Player has to be facing less than ~60 degrees away from the actor
if (yawTempAbs > 0x2AAA) {
return MAXFLOAT;
}
@ -1611,37 +1613,37 @@ f32 Target_WeightedDistToPlayerSq(Actor* actor, Player* player, s16 playerShapeY
return actor->xyzDistToPlayerSq;
}
typedef struct TargetRangeParams {
/* 0x0 */ f32 rangeSq;
/* 0x4 */ f32 leashScale;
} TargetRangeParams; // size = 0x8
typedef struct AttentionRangeParams {
/* 0x0 */ f32 attentionRangeSq;
/* 0x4 */ f32 lockOnLeashScale;
} AttentionRangeParams; // size = 0x8
#define TARGET_RANGE(range, leash) \
{ SQ(range), (f32)range / leash }
#define ATTENTION_RANGES(range, lockOnLeashRange) \
{ SQ(range), (f32)range / lockOnLeashRange }
TargetRangeParams sTargetRanges[TARGET_MODE_MAX] = {
TARGET_RANGE(70, 140), // TARGET_MODE_0
TARGET_RANGE(170, 255), // TARGET_MODE_1
TARGET_RANGE(280, 5600), // TARGET_MODE_2
TARGET_RANGE(350, 525), // TARGET_MODE_3
TARGET_RANGE(700, 1050), // TARGET_MODE_4
TARGET_RANGE(1000, 1500), // TARGET_MODE_5
TARGET_RANGE(100, 105.36842), // TARGET_MODE_6
TARGET_RANGE(140, 163.33333), // TARGET_MODE_7
TARGET_RANGE(240, 576), // TARGET_MODE_8
TARGET_RANGE(280, 280000), // TARGET_MODE_9
AttentionRangeParams sAttentionRanges[ATTENTION_RANGE_MAX] = {
ATTENTION_RANGES(70, 140), // ATTENTION_RANGE_0
ATTENTION_RANGES(170, 255), // ATTENTION_RANGE_1
ATTENTION_RANGES(280, 5600), // ATTENTION_RANGE_2
ATTENTION_RANGES(350, 525), // ATTENTION_RANGE_3
ATTENTION_RANGES(700, 1050), // ATTENTION_RANGE_4
ATTENTION_RANGES(1000, 1500), // ATTENTION_RANGE_5
ATTENTION_RANGES(100, 105.36842), // ATTENTION_RANGE_6
ATTENTION_RANGES(140, 163.33333), // ATTENTION_RANGE_7
ATTENTION_RANGES(240, 576), // ATTENTION_RANGE_8
ATTENTION_RANGES(280, 280000), // ATTENTION_RANGE_9
};
/**
* Checks if an actor at `distSq` is inside the range specified by its `targetMode`.
* Checks if an actor at `distSq` is inside the range specified by its `attentionRangeType`.
*
* Note that this gets used for both the target range check and for the lock-on leash range check.
* Despite how the data is presented in `sTargetRanges`, the leash range is stored as a scale factor value.
* Note that this gets used for both the attention range check and for the lock-on leash range check.
* Despite how the data is presented in `sAttentionRanges`, the leash range is stored as a scale factor value.
* When checking the leash range, this scale factor is applied to the input distance and checked against
* the base `rangeSq` value, which was used to initiate the lock-on in the first place.
* the base `attentionRangeSq` value, which was used to initiate the lock-on in the first place.
*/
u32 Target_ActorIsInRange(Actor* actor, f32 distSq) {
return distSq < sTargetRanges[actor->targetMode].rangeSq;
u32 Attention_ActorIsInRange(Actor* actor, f32 distSq) {
return distSq < sAttentionRanges[actor->attentionRangeType].attentionRangeSq;
}
/**
@ -1654,7 +1656,7 @@ u32 Target_ActorIsInRange(Actor* actor, f32 distSq) {
* Note that this check will be ignored if `ignoreLeash` is true.
*
*/
s32 Target_ShouldReleaseLockOn(Actor* actor, Player* player, s32 ignoreLeash) {
s32 Attention_ShouldReleaseLockOn(Actor* actor, Player* player, s32 ignoreLeash) {
if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) {
return true;
}
@ -1672,7 +1674,7 @@ s32 Target_ShouldReleaseLockOn(Actor* actor, Player* player, s32 ignoreLeash) {
distSq = actor->xyzDistToPlayerSq;
}
return !Target_ActorIsInRange(actor, sTargetRanges[actor->targetMode].leashScale * distSq);
return !Attention_ActorIsInRange(actor, sAttentionRanges[actor->attentionRangeType].lockOnLeashScale * distSq);
}
return false;
@ -2234,7 +2236,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play
actorCtx->absoluteSpace = NULL;
Actor_SpawnEntry(actorCtx, playerEntry, play);
Target_Init(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play);
Attention_Init(&actorCtx->attention, actorCtx->actorLists[ACTORCAT_PLAYER].head, play);
func_8002FA60(play);
}
@ -2367,8 +2369,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
actor->isLockedOn = false;
}
if ((actor->targetPriority != 0) && (player->focusActor == NULL)) {
actor->targetPriority = 0;
if ((actor->attentionPriority != 0) && (player->focusActor == NULL)) {
actor->attentionPriority = 0;
}
Actor_SetObjectDependency(play, actor);
@ -2400,13 +2402,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
if ((actor == NULL) || (player->unk_66C < 5)) {
actor = NULL;
if (actorCtx->targetCtx.reticleSpinCounter != 0) {
actorCtx->targetCtx.reticleSpinCounter = 0;
if (actorCtx->attention.reticleSpinCounter != 0) {
actorCtx->attention.reticleSpinCounter = 0;
Sfx_PlaySfxCentered(NA_SE_SY_LOCK_OFF);
}
}
Target_Update(&actorCtx->targetCtx, player, actor, play);
Attention_Update(&actorCtx->attention, player, actor, play);
TitleCard_Update(play, &actorCtx->titleCtx);
DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna);
}
@ -3144,16 +3146,16 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
Camera_RequestMode(Play_GetCamera(play, Play_GetActiveCamId(play)), CAM_MODE_NORMAL);
}
if (actor == actorCtx->targetCtx.naviHoverActor) {
actorCtx->targetCtx.naviHoverActor = NULL;
if (actor == actorCtx->attention.naviHoverActor) {
actorCtx->attention.naviHoverActor = NULL;
}
if (actor == actorCtx->targetCtx.forcedLockOnActor) {
actorCtx->targetCtx.forcedLockOnActor = NULL;
if (actor == actorCtx->attention.forcedLockOnActor) {
actorCtx->attention.forcedLockOnActor = NULL;
}
if (actor == actorCtx->targetCtx.bgmEnemy) {
actorCtx->targetCtx.bgmEnemy = NULL;
if (actor == actorCtx->attention.bgmEnemy) {
actorCtx->attention.bgmEnemy = NULL;
}
Audio_StopSfxByPos(&actor->projectedPos);
@ -3176,12 +3178,12 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
}
/**
* Checks that an actor is on-screen enough to be considered targetable.
* Checks that an actor is on-screen enough to be considered an attention actor.
*
* Note that the screen bounds checks are larger than the actual screen region
* to give room for error.
*/
int Target_InTargetableScreenRegion(PlayState* play, Actor* actor) {
int Attention_ActorOnScreen(PlayState* play, Actor* actor) {
s16 x;
s16 y;
@ -3193,33 +3195,33 @@ int Target_InTargetableScreenRegion(PlayState* play, Actor* actor) {
return (x > 0 - X_LEEWAY) && (x < SCREEN_WIDTH + X_LEEWAY) && (y > 0 - Y_LEEWAY) && (y < SCREEN_HEIGHT + Y_LEEWAY);
}
Actor* sNearestTargetableActor;
Actor* sPrioritizedTargetableActor;
f32 sNearestTargetableActorDistSq;
Actor* sNearestAttentionActor;
Actor* sPrioritizedAttentionActor;
f32 sNearestAttentionActorDistSq;
f32 sBgmEnemyDistSq;
s32 sHighestTargetablePriority;
s16 sTargetPlayerRotY;
s32 sHighestAttentionPriority;
s16 sAttentionPlayerRotY;
/**
* Search for targetable actors within the specified category.
* Search for attention actors within the specified category.
*
* For an actor to be considered targetable it needs to:
* To be considered an attention actor the actor needs to:
* - Have a non-NULL update function (still active)
* - Not be player (this is technically a redundant check because the PLAYER category is never searched)
* - Be targetable (specified by ACTOR_FLAG_0)
* - Not be the already targeted actor
* - Be the closest targetable actor found so far
* - Be within range, specified by targetMode
* - Have `ACTOR_FLAG_0` set
* - Not be the current focus actor
* - Be the closest attention actor found so far
* - Be within range, specified by attentionRangeType
* - Be roughly on-screen
* - Not be blocked by a surface
*
* If an actor has a priority value set and the value is the lowest found so far, it will be set as the prioritized
* targetable actor. Otherwise, it is set as the nearest targetable actor.
* attention actor. Otherwise, it is set as the nearest attention actor.
*
* This function is expected to be called with almost every actor category in each cycle. On a new cycle its global
* variables must be reset by the caller, otherwise the information of the previous cycle will be retained.
*/
void Target_FindTargetableActorInCategory(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) {
void Attention_FindActorInCategory(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) {
f32 distSq;
Actor* actor;
Actor* playerFocusActor;
@ -3232,30 +3234,29 @@ void Target_FindTargetableActorInCategory(PlayState* play, ActorContext* actorCt
while (actor != NULL) {
if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) {
// Enemy background music actor is updated here, despite not being too related to the Target system
if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) &&
(actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sBgmEnemyDistSq)) {
actorCtx->targetCtx.bgmEnemy = actor;
actorCtx->attention.bgmEnemy = actor;
sBgmEnemyDistSq = actor->xyzDistToPlayerSq;
}
if (actor != playerFocusActor) {
distSq = Target_WeightedDistToPlayerSq(actor, player, sTargetPlayerRotY);
distSq = Attention_WeightedDistToPlayerSq(actor, player, sAttentionPlayerRotY);
if ((distSq < sNearestTargetableActorDistSq) && Target_ActorIsInRange(actor, distSq) &&
Target_InTargetableScreenRegion(play, actor) &&
if ((distSq < sNearestAttentionActorDistSq) && Attention_ActorIsInRange(actor, distSq) &&
Attention_ActorOnScreen(play, actor) &&
(!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos,
&lineTestResultPos, &poly, true, true, true, true, &bgId) ||
SurfaceType_IsIgnoredByProjectiles(&play->colCtx, poly, bgId))) {
if (actor->targetPriority != 0) {
if (actor->attentionPriority != 0) {
// Lower values are considered higher priority
if (actor->targetPriority < sHighestTargetablePriority) {
sPrioritizedTargetableActor = actor;
sHighestTargetablePriority = actor->targetPriority;
if (actor->attentionPriority < sHighestAttentionPriority) {
sPrioritizedAttentionActor = actor;
sHighestAttentionPriority = actor->attentionPriority;
}
} else {
sNearestTargetableActor = actor;
sNearestTargetableActorDistSq = distSq;
sNearestAttentionActor = actor;
sNearestAttentionActorDistSq = distSq;
}
}
}
@ -3265,54 +3266,54 @@ void Target_FindTargetableActorInCategory(PlayState* play, ActorContext* actorCt
}
}
u8 sTargetableCategorySearchOrder[] = {
u8 sAttentionCategorySearchOrder[] = {
ACTORCAT_BOSS, ACTORCAT_ENEMY, ACTORCAT_BG, ACTORCAT_EXPLOSIVE, ACTORCAT_NPC, ACTORCAT_ITEMACTION,
ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH,
};
/**
* Search for the nearest targetable actor by iterating through most actor categories.
* See `Target_FindTargetableActorInCategory` for more details on search criteria.
* Search for the nearest attention actor by iterating through most actor categories.
* See `Attention_FindActorInCategory` for more details on search criteria.
*
* The actor found is stored in the `targetableActorP` parameter, which is also returned.
* The actor found is stored in the `attentionActorP` parameter, which is also returned.
* It may be NULL if no actor that fulfills the criteria is found.
*/
Actor* Target_FindTargetableActor(PlayState* play, ActorContext* actorCtx, Actor** targetableActorP, Player* player) {
Actor* Attention_FindActor(PlayState* play, ActorContext* actorCtx, Actor** attentionActorP, Player* player) {
s32 i;
u8* category;
sNearestTargetableActor = sPrioritizedTargetableActor = NULL;
sNearestTargetableActorDistSq = sBgmEnemyDistSq = MAXFLOAT;
sHighestTargetablePriority = INT32_MAX;
sNearestAttentionActor = sPrioritizedAttentionActor = NULL;
sNearestAttentionActorDistSq = sBgmEnemyDistSq = MAXFLOAT;
sHighestAttentionPriority = INT32_MAX;
if (!Player_InCsMode(play)) {
category = &sTargetableCategorySearchOrder[0];
actorCtx->targetCtx.bgmEnemy = NULL;
sTargetPlayerRotY = player->actor.shape.rot.y;
category = &sAttentionCategorySearchOrder[0];
actorCtx->attention.bgmEnemy = NULL;
sAttentionPlayerRotY = player->actor.shape.rot.y;
// Search the first 3 actor categories first for a targetable actor
// Search the first 3 actor categories first for an attention actor
// These are Boss, Enemy, and Bg, in order.
for (i = 0; i < 3; i++) {
Target_FindTargetableActorInCategory(play, actorCtx, player, *category);
Attention_FindActorInCategory(play, actorCtx, player, *category);
category++;
}
// If no actor in the above categories was found, then try searching in the remaining categories
if (sNearestTargetableActor == NULL) {
for (; i < ARRAY_COUNT(sTargetableCategorySearchOrder); i++) {
Target_FindTargetableActorInCategory(play, actorCtx, player, *category);
if (sNearestAttentionActor == NULL) {
for (; i < ARRAY_COUNT(sAttentionCategorySearchOrder); i++) {
Attention_FindActorInCategory(play, actorCtx, player, *category);
category++;
}
}
}
if (sNearestTargetableActor == NULL) {
*targetableActorP = sPrioritizedTargetableActor;
if (sNearestAttentionActor == NULL) {
*attentionActorP = sPrioritizedAttentionActor;
} else {
*targetableActorP = sNearestTargetableActor;
*attentionActorP = sNearestAttentionActor;
}
return *targetableActorP;
return *attentionActorP;
}
/**

View file

@ -145,14 +145,14 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
thisx->textId = (this->textId & 0xFF) | 0x300;
thisx->targetArrowOffset = 500.0f;
thisx->lockOnArrowOffset = 500.0f;
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
this->focusYoffset = 45.0f;
EnAObj_SetupWaitTalk(this, thisx->params);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
thisx->targetMode = TARGET_MODE_0;
thisx->attentionRangeType = ATTENTION_RANGE_0;
break;
case A_OBJ_BOULDER_FRAGMENT:
thisx->gravity = -1.5f;

View file

@ -53,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP),
};
static Color_RGBA8 sEffectPrimColor = { 255, 255, 127, 0 };

View file

@ -3272,7 +3272,7 @@ void Interface_Draw(PlayState* play) {
if ((R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) &&
(R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_READY)) {
Target_Draw(&play->actorCtx.targetCtx, play);
Attention_Draw(&play->actorCtx.attention, play);
}
Gfx_SetupDL_39Overlay(play->state.gfxCtx);

View file

@ -165,7 +165,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
case YELLOW_TALL_2:
BgBdanSwitch_InitCollision(this, play);
this->dyna.actor.flags |= ACTOR_FLAG_0;
this->dyna.actor.targetMode = TARGET_MODE_4;
this->dyna.actor.attentionRangeType = ATTENTION_RANGE_4;
break;
}

View file

@ -122,7 +122,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 0, 80, 130, MASS_IMMOVABLE };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_4, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_4, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};

View file

@ -54,8 +54,10 @@ static ColliderJntSphInit sJntSphInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_3, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_3, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
};

View file

@ -64,9 +64,12 @@ static ColliderJntSphInit sJntSphInit = {
};
static InitChainEntry sInitChainClasp[] = {
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, TARGET_MODE_3, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 40, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_3, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 40, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
};
static InitChainEntry sInitChainLadder[] = {

View file

@ -42,8 +42,10 @@ ActorProfile Bg_Treemouth_Profile = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP),
};

View file

@ -48,10 +48,10 @@ ActorProfile Boss_Dodongo_Profile = {
#include "z_boss_dodongo_data.inc.c"
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_KING_DODONGO, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -3000.0f, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 8200.0f, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 8200.0f, ICHAIN_STOP),
};
void func_808C1190(s16* arg0, u8* arg1, s16 arg2) {

View file

@ -59,10 +59,10 @@ ActorProfile Boss_Fd_Profile = {
#include "z_boss_fd_colchk.inc.c"
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_VOLVAGIA, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
void BossFd_SpawnEmber(BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale) {

View file

@ -67,10 +67,10 @@ static Vec3f sHoleLocations[] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_VOLVAGIA, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
void BossFd2_SpawnDebris(PlayState* play, BossFdEffect* effect, Vec3f* position, Vec3f* velocity, Vec3f* acceleration,

View file

@ -336,10 +336,10 @@ void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId
}
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GANONDORF, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
void BossGanon_Init(Actor* thisx, PlayState* play2) {

View file

@ -199,10 +199,10 @@ static void* sLimbTex_rgba16_16x32[] = { gPhantomGanonLimbTex_00AA80, gPhantomGa
static void* sMouthTex_ci8_16x16[] = { gPhantomGanonMouthTex, gPhantomGanonSmileTex };
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_PHANTOM_GANON_PHASE_1, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
static Vec3f sAudioVec = { 0.0f, 0.0f, 50.0f };

View file

@ -333,7 +333,7 @@ void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) {
}
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GOHMA, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
};

View file

@ -294,10 +294,10 @@ static s16 sAttackRot[41] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_MORPHA, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
static Vec3f sAudioZeroVec = { 0.0f, 0.0f, 0.0f };

View file

@ -261,7 +261,7 @@ static AnimationHeader* sHandHangPoses[] = { &gBongoLeftHandHangPoseAnim, &gBong
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BONGO_BONGO, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP),
};
@ -308,7 +308,7 @@ void BossSst_Init(Actor* thisx, PlayState* play2) {
this->actor.update = BossSst_UpdateHead;
this->actor.draw = BossSst_DrawHead;
this->radius = -650.0f;
this->actor.targetArrowOffset = 4000.0f;
this->actor.lockOnArrowOffset = 4000.0f;
BossSst_HeadSetupLurk(this);
Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS);
}
@ -328,7 +328,7 @@ void BossSst_Init(Actor* thisx, PlayState* play2) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 95.0f);
this->handZPosMod = -3500;
this->actor.targetArrowOffset = 5000.0f;
this->actor.lockOnArrowOffset = 5000.0f;
this->actor.flags &= ~ACTOR_FLAG_0;
BossSst_HandSetupWait(this);
}

View file

@ -201,9 +201,9 @@ static Vec3f sTwinrovaPillarPos[] = {
static u8 sTwInitialized = false;
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
static s8 sEnvType;

View file

@ -581,7 +581,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) {
s16 warpId;
Actor_SetScale(&this->actor, 0.1f);
this->actor.targetMode = TARGET_MODE_5;
this->actor.attentionRangeType = ATTENTION_RANGE_5;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
switch (this->actor.params) {

View file

@ -79,7 +79,7 @@ void DoorAna_Init(Actor* thisx, PlayState* play) {
} else {
DoorAna_SetupAction(this, DoorAna_WaitOpen);
}
this->actor.targetMode = TARGET_MODE_0;
this->actor.attentionRangeType = ATTENTION_RANGE_0;
}
void DoorAna_Destroy(Actor* thisx, PlayState* play) {
@ -128,7 +128,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
player = GET_PLAYER(play);
if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) {
if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
if ((this->actor.attentionRangeType != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(player->stateFlags1 & PLAYER_STATE1_31) && (player->av1.actionVar1 == 0)) {
destinationIdx = PARAMS_GET_U(this->actor.params, 12, 3) - 1;
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF);
@ -145,9 +145,9 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
this->actor.xzDistToPlayer <= 15.0f && -50.0f <= this->actor.yDistToPlayer &&
this->actor.yDistToPlayer <= 15.0f) {
player->stateFlags1 |= PLAYER_STATE1_31;
this->actor.targetMode = TARGET_MODE_1;
this->actor.attentionRangeType = ATTENTION_RANGE_1;
} else {
this->actor.targetMode = TARGET_MODE_0;
this->actor.attentionRangeType = ATTENTION_RANGE_0;
}
}
}

View file

@ -81,7 +81,7 @@ void ElfMsg2_Init(Actor* thisx, PlayState* play) {
PRINTF(VT_FGCOL(CYAN) " Elf_Msg2_Actor_ct %04x\n\n" VT_RST, this->actor.params);
if (!ElfMsg2_KillCheck(this, play)) {
if ((this->actor.world.rot.x > 0) && (this->actor.world.rot.x < 8)) {
this->actor.targetMode = this->actor.world.rot.x - 1;
this->actor.attentionRangeType = this->actor.world.rot.x - 1;
}
Actor_ProcessInitChain(thisx, sInitChain);
if (this->actor.world.rot.y >= 0x41) {

View file

@ -158,7 +158,7 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_ARMOS, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -4000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 5300, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 5300, ICHAIN_STOP),
};
void EnAm_SetupAction(EnAm* this, EnAmActionFunc actionFunc) {

View file

@ -148,7 +148,7 @@ void EnAnubice_Init(Actor* thisx, PlayState* play) {
this->focusHeightOffset = 0.0f;
this->actor.flags &= ~ACTOR_FLAG_0;
this->home = this->actor.world.pos;
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
this->actionFunc = EnAnubice_FindFlameCircles;
}

View file

@ -32,9 +32,9 @@ ActorProfile En_Attack_Niw_Profile = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_1, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
void EnAttackNiw_Init(Actor* thisx, PlayState* play) {

View file

@ -85,7 +85,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_PARASITIC_TENTACLE, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 0, ICHAIN_STOP),
};
void EnBa_Init(Actor* thisx, PlayState* play) {
@ -103,7 +103,7 @@ void EnBa_Init(Actor* thisx, PlayState* play) {
this->unk_158[i].y = this->actor.world.pos.y - (i + 1) * 32.0f;
}
this->actor.targetMode = TARGET_MODE_4;
this->actor.attentionRangeType = ATTENTION_RANGE_4;
this->upperParams = PARAMS_GET_U(thisx->params, 8, 8);
thisx->params &= 0xFF;

View file

@ -235,7 +235,7 @@ static ColliderJntSphInit sJntSphInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP),
};
void EnBb_SetupAction(EnBb* this, EnBbActionFunc actionFunc) {

View file

@ -144,8 +144,8 @@ static DamageTable sDamageTable = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(gravity, -1, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIGOCTO, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 33, ICHAIN_STOP),

View file

@ -108,7 +108,7 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIRI, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP),
};
void EnBili_Init(Actor* thisx, PlayState* play) {

View file

@ -32,7 +32,7 @@ ActorProfile En_Bird_Profile = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 5600, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 5600, ICHAIN_STOP),
};
void EnBird_SetupAction(EnBird* this, EnBirdActionFunc actionFunc) {

View file

@ -79,7 +79,7 @@ static ColliderJntSphInit sJntSphInit = {
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F(scale, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -4000, ICHAIN_STOP),
};

View file

@ -77,7 +77,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) {
}
this->prizeSelect = (s16)Rand_ZeroFloat(4.99f);
this->actor.targetMode = TARGET_MODE_1;
this->actor.attentionRangeType = ATTENTION_RANGE_1;
this->actionFunc = EnBomBowlMan_SetupWaitAsleep;
}

View file

@ -55,7 +55,7 @@ static ColliderJntSphInit sJntSphInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 1000 * BOMBCHU_SCALE, ICHAIN_STOP),
};

View file

@ -109,7 +109,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) {
thisx->colChkInfo.cylRadius = 10.0f;
thisx->colChkInfo.cylHeight = 10;
thisx->targetMode = TARGET_MODE_0;
thisx->attentionRangeType = ATTENTION_RANGE_0;
if (thisx->params == BOMBFLOWER_BODY) {
this->timer = 140;

View file

@ -49,7 +49,7 @@ static ColliderQuadInit sQuadInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_S8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_S8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_VEC3S(shape.rot, 0, ICHAIN_STOP),
};

View file

@ -66,7 +66,7 @@ static AnimationHeader* sAnimations[4] = { &gTreasureChestAnim_00024C, &gTreasur
&gTreasureChestAnim_00043C, &gTreasureChestAnim_00043C };
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_0, ICHAIN_STOP),
};
static UNK_TYPE sUnused;

View file

@ -71,7 +71,7 @@ void EnBx_Init(Actor* thisx, PlayState* play) {
Vec3f sp48 = { 0.015f, 0.015f, 0.015f };
Vec3f sp3C = { 0.0f, 0.0f, 0.0f };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 5300, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 5300, ICHAIN_STOP),
};
s32 i;
s32 pad;

View file

@ -251,7 +251,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_REFLECT_MG);
} else { // Initialize the Arwing.
this->actor.flags |= ACTOR_FLAG_0;
this->actor.targetMode = TARGET_MODE_5;
this->actor.attentionRangeType = ATTENTION_RANGE_5;
Collider_SetCylinder(play, &this->collider, &this->actor, &sArwingCylinderInit);
this->actor.colChkInfo.health = 3;

View file

@ -146,7 +146,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) {
COW_TYPE_TAIL);
this->animationTimer = Rand_ZeroFloat(1000.0f) + 40.0f;
this->breathTimer = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
R_EPONAS_SONG_PLAYED = false;
break;

View file

@ -100,7 +100,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 3000, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GUAY, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -200, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP),
};
static Vec3f sHeadVec = { 2500.0f, 0.0f, 0.0f };
@ -153,7 +153,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) {
this->actor.world.pos.y += 20.0f * scale;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
this->actor.shape.yOffset = 0.0f;
this->actor.targetArrowOffset = 0.0f;
this->actor.lockOnArrowOffset = 0.0f;
Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_DEAD);
if (this->actor.colChkInfo.damageEffect == 3) { // Ice arrows
@ -218,7 +218,7 @@ void EnCrow_SetupRespawn(EnCrow* this) {
this->actor.shape.rot.z = 0;
this->timer = 300;
this->actor.shape.yOffset = 2000;
this->actor.targetArrowOffset = 2000.0f;
this->actor.lockOnArrowOffset = 2000.0f;
this->actor.draw = NULL;
this->actionFunc = EnCrow_Respawn;
}

View file

@ -143,7 +143,7 @@ void EnCs_Init(Actor* thisx, PlayState* play) {
Animation_GetLastFrame(sAnimationInfo[ENCS_ANIM_0].animation), sAnimationInfo[ENCS_ANIM_0].mode,
sAnimationInfo[ENCS_ANIM_0].morphFrames);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->path = PARAMS_GET_U(this->actor.params, 0, 8);
this->unk_1EC = 0; // This variable is unused anywhere else
this->talkState = 0;

View file

@ -189,7 +189,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->currentAnimIndex = -1;
this->runSpeed = 5.0f;
this->initRot = this->actor.world.rot;

View file

@ -172,7 +172,7 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) {
this->actor.gravity = 0.0f;
this->runSpeed = 3.0f;
this->actor.uncullZoneForward = 1200.0f;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->currentAnimIndex = -1;
if (this->flags & 0x40) {

View file

@ -217,7 +217,7 @@ static DamageTable sBigDekuBabaDamageTable = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP),
};
void EnDekubaba_Init(Actor* thisx, PlayState* play) {
@ -249,7 +249,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sBigDekuBabaDamageTable, &sColChkInfoInit);
this->actor.colChkInfo.health = 4;
this->actor.naviEnemyId = NAVI_ENEMY_BIG_DEKU_BABA;
this->actor.targetMode = TARGET_MODE_2;
this->actor.attentionRangeType = ATTENTION_RANGE_2;
} else {
this->size = 1.0f;
@ -263,7 +263,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDekuBabaDamageTable, &sColChkInfoInit);
this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA;
this->actor.targetMode = TARGET_MODE_1;
this->actor.attentionRangeType = ATTENTION_RANGE_1;
}
EnDekubaba_SetupWait(this);

View file

@ -102,7 +102,7 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_MAD_SCRUB, ICHAIN_CONTINUE),
ICHAIN_F32(gravity, -1, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2600, ICHAIN_STOP),
};
void EnDekunuts_Init(Actor* thisx, PlayState* play) {

View file

@ -127,7 +127,7 @@ static DamageTable D_809EC620 = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DEAD_HAND, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP),
};

View file

@ -143,7 +143,7 @@ static ColliderJntSphInit sJntSphInit = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DEAD_HANDS_HAND, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP),
};

View file

@ -93,7 +93,7 @@ void EnDivingGame_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
} else {
D_809EF0B0 = true;
this->actor.targetMode = TARGET_MODE_0;
this->actor.attentionRangeType = ATTENTION_RANGE_0;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actionFunc = func_809EDCB0;
}

View file

@ -115,8 +115,8 @@ static DnsItemEntry* sItemEntries[] = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP),
};
static AnimationMinimalInfo sAnimationInfo[] = {

View file

@ -84,7 +84,7 @@ void EnDntJiji_Init(Actor* thisx, PlayState* play) {
PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ デグナッツお面品評会長老 ☆☆☆☆☆ %x\n" VT_RST, this->stage);
this->actor.flags &= ~ACTOR_FLAG_0;
this->actor.colChkInfo.mass = 0xFF;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->actionFunc = EnDntJiji_SetFlower;
this->actor.gravity = -2.0f;
}

View file

@ -301,14 +301,14 @@ void EnDodongo_SpawnBombSmoke(EnDodongo* this, PlayState* play) {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DODONGO, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2800, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2800, ICHAIN_STOP),
};
void EnDodongo_Init(Actor* thisx, PlayState* play) {
EnDodongo* this = (EnDodongo*)thisx;
EffectBlureInit1 blureInit;
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
Actor_ProcessInitChain(&this->actor, sInitChain);
this->bombSmokePrimColor.r = this->bombSmokePrimColor.g = this->bombSmokeEnvColor.r = 255;
this->bombSmokePrimColor.a = this->bombSmokeEnvColor.a = 200;

View file

@ -73,7 +73,7 @@ static EnDoorInfo sDoorInfo[] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_0, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP),
};

View file

@ -41,7 +41,7 @@ void EnDs_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.013f);
this->actionFunc = EnDs_Wait;
this->actor.targetMode = TARGET_MODE_1;
this->actor.attentionRangeType = ATTENTION_RANGE_1;
this->unk_1E8 = 0;
this->actor.flags &= ~ACTOR_FLAG_0;
this->unk_1E4 = 0.0f;

View file

@ -289,7 +289,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 = TARGET_MODE_1;
this->actor.attentionRangeType = ATTENTION_RANGE_1;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {

View file

@ -107,7 +107,7 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_STINGER, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2500, ICHAIN_STOP),
};
/**

View file

@ -935,9 +935,9 @@ void func_80A03CF8(EnElf* this, PlayState* play) {
break;
default:
func_80A029A8(this, 1);
nextPos = play->actorCtx.targetCtx.naviHoverPos;
nextPos = play->actorCtx.attention.naviHoverPos;
nextPos.y += (1500.0f * this->actor.scale.y);
naviHoverActor = play->actorCtx.targetCtx.naviHoverActor;
naviHoverActor = play->actorCtx.attention.naviHoverActor;
if (naviHoverActor != NULL) {
func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f);
@ -1000,12 +1000,12 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu
}
void func_80A04414(EnElf* this, PlayState* play) {
Actor* naviHoverActor = play->actorCtx.targetCtx.naviHoverActor;
Actor* naviHoverActor = play->actorCtx.attention.naviHoverActor;
Player* player = GET_PLAYER(play);
f32 transitionRate;
u16 sfxId;
if (play->actorCtx.targetCtx.naviMoveProgressFactor != 0.0f) {
if (play->actorCtx.attention.naviMoveProgressFactor != 0.0f) {
this->unk_2C6 = 0;
this->unk_29C = 1.0f;
@ -1016,18 +1016,18 @@ void func_80A04414(EnElf* this, PlayState* play) {
} else {
if (this->unk_2C6 == 0) {
if ((naviHoverActor == NULL) ||
(Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviHoverPos) < 50.0f)) {
(Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.attention.naviHoverPos) < 50.0f)) {
this->unk_2C6 = 1;
}
} else if (this->unk_29C != 0.0f) {
if (Math_StepToF(&this->unk_29C, 0.0f, 0.25f) != 0) {
this->innerColor = play->actorCtx.targetCtx.naviInnerColor;
this->outerColor = play->actorCtx.targetCtx.naviOuterColor;
this->innerColor = play->actorCtx.attention.naviInnerColor;
this->outerColor = play->actorCtx.attention.naviOuterColor;
} else {
transitionRate = 0.25f / this->unk_29C;
EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.naviInnerColor, &this->innerColor,
EnElf_ChangeColor(&this->innerColor, &play->actorCtx.attention.naviInnerColor, &this->innerColor,
transitionRate);
EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.naviOuterColor, &this->outerColor,
EnElf_ChangeColor(&this->outerColor, &play->actorCtx.attention.naviOuterColor, &this->outerColor,
transitionRate);
}
}
@ -1081,7 +1081,7 @@ void func_80A0461C(EnElf* this, PlayState* play) {
}
} else {
naviHoverActor = play->actorCtx.targetCtx.naviHoverActor;
naviHoverActor = play->actorCtx.attention.naviHoverActor;
// `R_SCENE_CAM_TYPE` is not a bit field, but this conditional checks for a specific bit.
// This `& 0x10` check will pass for either `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT`, `SCENE_CAM_TYPE_FIXED`, or
@ -1222,7 +1222,7 @@ void func_80A04DE4(EnElf* this, PlayState* play) {
Vec3f pos;
if (this->fairyFlags & 0x10) {
pos = play->actorCtx.targetCtx.naviHoverPos;
pos = play->actorCtx.attention.naviHoverPos;
if ((player->focusActor == NULL) || (&player->actor == player->focusActor) ||
(&this->actor == player->focusActor)) {

View file

@ -112,8 +112,8 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE),
ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 4000, ICHAIN_STOP),
ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 4000, ICHAIN_STOP),
};
void EnFirefly_Extinguish(EnFirefly* this) {

View file

@ -115,7 +115,7 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_FLOORMASTER, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 5500, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 5500, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP),
};

View file

@ -168,8 +168,8 @@ static s16 sTimerFrogSong[] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP),
};
// Counter to Coordinate Frog jumping out of water one at a time

View file

@ -92,7 +92,7 @@ void EnFu_Init(Actor* thisx, PlayState* play) {
this->skelanime.playSpeed = 2.0f;
}
this->behaviorFlags = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
void EnFu_Destroy(Actor* thisx, PlayState* play) {

View file

@ -151,8 +151,8 @@ static DamageTable sDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_FREEZARD, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP),
};
void EnFz_Init(Actor* thisx, PlayState* play) {

View file

@ -121,8 +121,8 @@ static ColliderCylinderInitType1 sBottlesCylindersInit[] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2200, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_6, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2200, ICHAIN_STOP),
};
// relative positions of poe souls

View file

@ -98,7 +98,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->animation = &gGerudoWhiteIdleAnim;
this->animFunc = EnGe1_CueUpAnimation;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
Actor_SetScale(&this->actor, 0.01f);
this->actor.uncullZoneForward = ((play->sceneId == SCENE_GERUDO_VALLEY) ? 1000.0f : 1200.0f);
@ -146,7 +146,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
return;
}
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
this->hairstyle = GE1_HAIR_BOB;
// "Horseback archery Gerudo EVENT_INF(0) ="
PRINTF(VT_FGCOL(CYAN) "やぶさめ ゲルド EVENT_INF(0) = %x\n" VT_RST, gSaveContext.eventInf[0]);

View file

@ -138,21 +138,21 @@ void EnGe2_Init(Actor* thisx, PlayState* play) {
EnGe2_ChangeAction(this, GE2_ACTION_WALK);
if (EnGe2_CheckCarpentersFreed()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
break;
case GE2_TYPE_STATIONARY:
EnGe2_ChangeAction(this, GE2_ACTION_STAND);
if (EnGe2_CheckCarpentersFreed()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
break;
case GE2_TYPE_GERUDO_CARD_GIVER:
EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER);
this->actor.update = EnGe2_UpdateAfterTalk;
this->actionFunc = EnGe2_ForceTalk;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
break;
default:
ASSERT(0, "0", "../z_en_ge2.c", 418);
@ -595,7 +595,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) {
if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
}
@ -621,7 +621,7 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
if (EnGe2_CheckCarpentersFreed()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->actor.colorFilterTimer = 0;
} else if (this->actor.colorFilterTimer == 0) {
this->actor.update = EnGe2_Update;

View file

@ -81,7 +81,7 @@ void EnGe3_Init(Actor* thisx, PlayState* play2) {
EnGe3_ChangeAction(this, 0);
this->actionFunc = EnGe3_ForceTalk;
this->unk_30C = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->actor.minVelocityY = -4.0f;
this->actor.gravity = -1.0f;
}

View file

@ -204,7 +204,7 @@ static DamageTable sDamageTable = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -3000, ICHAIN_STOP),
};

View file

@ -58,8 +58,8 @@ static ColliderCylinderInitType1 sCylinderInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP),
};
void EnGm_Init(Actor* thisx, PlayState* play) {

View file

@ -644,7 +644,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) {
}
EnGo_ChangeAnim(this, ENGO_ANIM_0);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actor.gravity = -1.0f;
@ -678,7 +678,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) {
EnGo_SetupAction(this, func_80A3FEB4);
break;
case 0x90:
this->actor.targetMode = TARGET_MODE_5;
this->actor.attentionRangeType = ATTENTION_RANGE_5;
Actor_SetScale(&this->actor, 0.16f);
EnGo_SetupAction(this, EnGo_CurledUp);
break;

View file

@ -842,7 +842,7 @@ void EnGo2_SetShape(EnGo2* this) {
this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10;
Actor_SetScale(&this->actor, D_80A481F8[index].scale);
this->actor.targetMode = D_80A481F8[index].actor_unk_1F;
this->actor.attentionRangeType = D_80A481F8[index].actor_unk_1F;
this->interactRange = D_80A481F8[index].interactRange;
this->interactRange += this->collider.dim.radius;
}

View file

@ -98,10 +98,10 @@ static u8 sSpawnNum = 0;
static Vec3f sDeadEffectVel = { 0.0f, 0.0f, 0.0f };
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_3, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_3, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GOHMA_LARVA, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 20, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 20, ICHAIN_STOP),
};
void EnGoma_Init(Actor* thisx, PlayState* play) {

View file

@ -102,7 +102,7 @@ void EnGs_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit);
CollisionCheck_SetInfo2(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit);
thisx->targetMode = TARGET_MODE_6;
thisx->attentionRangeType = ATTENTION_RANGE_6;
this->unk_1D8 = thisx->world.pos;
this->actionFunc = func_80A4F734;
this->unk_1B4[0].x = 1.0f;

View file

@ -45,8 +45,8 @@ static ColliderCylinderInitType1 sCylinderInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_6, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 500, ICHAIN_STOP),
};
void EnGuest_Init(Actor* thisx, PlayState* play) {

View file

@ -126,7 +126,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play) {
this->collider.dim.yShift = 0;
this->collider.dim.radius = 15;
this->collider.dim.height = 70;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
switch (this->type) {

View file

@ -73,7 +73,7 @@ void EnHeishi3_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable, this->morphTable, 17);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
// "Castle Gate Soldier - Power Up"

View file

@ -62,7 +62,7 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) {
this->type = PARAMS_GET_U(thisx->params, 0, 8);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
this->pos = thisx->world.pos;
thisx->targetMode = TARGET_MODE_6;
thisx->attentionRangeType = ATTENTION_RANGE_6;
if (this->type == HEISHI4_AT_MARKET_DYING) {
this->height = 30.0f;
ActorShape_Init(&thisx->shape, 0.0f, NULL, 30.0f);

View file

@ -66,7 +66,7 @@ static s16 sPuzzleCounter = 0;
static InitChainEntry sInitChain[] = {
ICHAIN_F32(gravity, -1, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DEKU_SCRUB, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 2600, ICHAIN_STOP),
};
void EnHintnuts_Init(Actor* thisx, PlayState* play) {

View file

@ -89,7 +89,7 @@ void EnHs_Init(Actor* thisx, PlayState* play) {
}
this->unk_2A8 = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
void EnHs_Destroy(Actor* thisx, PlayState* play) {

View file

@ -63,7 +63,7 @@ void EnHs2_Init(Actor* thisx, PlayState* play) {
PRINTF(VT_FGCOL(CYAN) " ヒヨコの店(子人の時) \n" VT_RST);
this->actionFunc = func_80A6F1A4;
this->unk_2A8 = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
void EnHs2_Destroy(Actor* thisx, PlayState* play) {

View file

@ -323,7 +323,7 @@ typedef struct EnHyInit2Info {
/* 0x00 */ f32 shadowScale;
/* 0x04 */ Vec3f modelOffset;
/* 0x10 */ f32 scale;
/* 0x14 */ s8 targetMode;
/* 0x14 */ s8 attentionRangeType;
/* 0x18 */ f32 interactRange;
} EnHyInit2Info; // size = 0x1C
@ -701,7 +701,7 @@ void EnHy_InitSetProperties(EnHy* this) {
this->actor.shape.shadowScale = sInit2Info[type].shadowScale;
Actor_SetScale(&this->actor, sInit2Info[type].scale);
this->actor.targetMode = sInit2Info[type].targetMode;
this->actor.attentionRangeType = sInit2Info[type].attentionRangeType;
this->modelOffset = sInit2Info[type].modelOffset;
this->interactRange = sInit2Info[type].interactRange;
this->interactRange += this->collider.dim.radius;

View file

@ -77,8 +77,10 @@ static ColliderCylinderInit sCylinderInitDroppedFlame = {
};
static InitChainEntry sInitChainCapturableFlame[] = {
ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 60, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_0, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 60, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
};

View file

@ -518,7 +518,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) {
return;
}
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = func_80A7A4BC;
@ -577,7 +577,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) {
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0;
break;
case EVENTINF_HORSES_STATE_1:
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A568;
Interface_SetTimer(60);
@ -593,7 +593,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) {
break;
case EVENTINF_HORSES_STATE_5:
case EVENTINF_HORSES_STATE_6:
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
EnIn_ChangeAnim(this, ENIN_ANIM_6);
this->unk_1EC = 8;
this->actionFunc = func_80A7AA40;
@ -938,7 +938,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) {
if (Actor_TalkOfferAccepted(&this->actor, play)) {}
} else {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState,
((this->actor.targetMode == 6) ? 80.0f : 320.0f) + this->collider.dim.radius,
((this->actor.attentionRangeType == 6) ? 80.0f : 320.0f) + this->collider.dim.radius,
EnIn_GetTextId, EnIn_UpdateTalkState);
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->unk_1FA = this->unk_1F8;

View file

@ -69,7 +69,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0);
this->rot = this->actor.world.rot;

View file

@ -69,7 +69,7 @@ void EnKakasi2_Init(Actor* thisx, PlayState* play) {
if (this->switchFlag == 0x3F) {
this->switchFlag = -1;
}
this->actor.targetMode = TARGET_MODE_4;
this->actor.attentionRangeType = ATTENTION_RANGE_4;
this->maxSpawnDistance.x = (spawnRangeY * 40.0f) + 40.0f;
this->maxSpawnDistance.y = (spawnRangeXZ * 40.0f) + 40.0f;

View file

@ -71,7 +71,7 @@ void EnKakasi3_Init(Actor* thisx, PlayState* play) {
PRINTF("\n\n");
// "Obonur" -- Related to the name of the scarecrow (Bonooru)
PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ おーボヌール ☆☆☆☆☆ \n" VT_RST);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);

View file

@ -213,7 +213,7 @@ void EnKanban_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
if (this->actor.params != ENKANBAN_PIECE) {
this->actor.targetMode = TARGET_MODE_0;
this->actor.attentionRangeType = ATTENTION_RANGE_0;
this->actor.flags |= ACTOR_FLAG_0;
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);

View file

@ -84,8 +84,8 @@ static ColliderCylinderInit sHeadColliderInit = {
static CollisionCheckInfoInit sColCheckInfoInit = { 1, 15, 80, MASS_HEAVY };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 2500, ICHAIN_CONTINUE),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_1, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_WITHERED_DEKU_BABA, ICHAIN_STOP),
};

View file

@ -233,7 +233,7 @@ static EnKoModelInfo sModelInfo[] = {
};
typedef struct EnKoInteractInfo {
/* 0x0 */ s8 targetMode;
/* 0x0 */ s8 attentionRangeType;
/* 0x4 */ f32 lookDist; // extended by collider radius
/* 0x8 */ f32 appearDist;
} EnKoInteractInfo; // size = 0xC
@ -1073,7 +1073,7 @@ void func_80A98CD8(EnKo* this) {
s32 type = ENKO_TYPE;
EnKoInteractInfo* info = &sInteractInfo[type];
this->actor.targetMode = info->targetMode;
this->actor.attentionRangeType = info->attentionRangeType;
this->lookDist = info->lookDist;
this->lookDist += this->collider.dim.radius;
this->appearDist = info->appearDist;

View file

@ -332,7 +332,7 @@ void EnKz_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
Actor_SetScale(&this->actor, 0.01);
this->actor.targetMode = TARGET_MODE_3;
this->actor.attentionRangeType = ATTENTION_RANGE_3;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_0);

View file

@ -53,7 +53,7 @@ void EnLightbox_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 6.0f);
this->dyna.interactFlags = 0;
this->dyna.transformFlags = 0;
thisx->targetMode = TARGET_MODE_0;
thisx->attentionRangeType = ATTENTION_RANGE_0;
thisx->gravity = -2.0f;
CollisionHeader_GetVirtual(&object_lightbox_Col_001F10, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);

View file

@ -269,7 +269,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 = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {

View file

@ -242,7 +242,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 = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}

View file

@ -248,7 +248,7 @@ static DamageTable sClubMoblinDamageTable = {
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, NAVI_ENEMY_MOBLIN, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 5300, ICHAIN_STOP),
ICHAIN_F32(lockOnArrowOffset, 5300, ICHAIN_STOP),
};
void EnMb_SetupAction(EnMb* this, EnMbActionFunc actionFunc) {

View file

@ -667,7 +667,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_0);
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->alpha = 255;
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI);

View file

@ -66,7 +66,7 @@ void EnMk_Init(Actor* thisx, PlayState* play) {
this->actionFunc = EnMk_Wait;
this->flags = 0;
this->swimFlag = 0;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
if (GET_ITEMGETINF(ITEMGETINF_10)) {
this->flags |= 4;

View file

@ -176,7 +176,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) {
this->path = PARAMS_GET_U(this->actor.params, 0, 8);
this->unk_1F0 = 2;
this->unk_1E8 = 0;
this->actor.targetMode = TARGET_MODE_2;
this->actor.attentionRangeType = ATTENTION_RANGE_2;
this->actor.gravity = -1.0f;
this->speedXZ = 3.0f;
this->unk_204 = this->actor.objectSlot;

View file

@ -136,7 +136,7 @@ void EnMm2_Init(Actor* thisx, PlayState* play2) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->mouthTexIndex = RM2_MOUTH_CLOSED;
this->actor.targetMode = TARGET_MODE_6;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->unk_1F4 |= 1;
this->actor.gravity = -1.0f;
if (this->actor.params == 1) {

View file

@ -53,8 +53,8 @@ static u16 sOfferTextIDs[] = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP),
ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE),
ICHAIN_F32(lockOnArrowOffset, 500, ICHAIN_STOP),
};
void EnMs_SetOfferText(EnMs* this, PlayState* play) {
@ -163,7 +163,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) {
this->activeTimer++;
Actor_SetFocus(&this->actor, 20.0f);
this->actor.targetArrowOffset = 500.0f;
this->actor.lockOnArrowOffset = 500.0f;
Actor_SetScale(&this->actor, 0.015f);
SkelAnime_Update(&this->skelAnime);
this->actionFunc(this, play);

Some files were not shown because too many files have changed in this diff Show more