From 29d366f66da5eadd640d874444a9e8943afa1d81 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 10:31:13 +1100 Subject: [PATCH 01/13] Begin Target Docs --- include/functions.h | 6 +- include/z64.h | 26 - include/z64actor.h | 42 +- include/z64player.h | 2 +- src/code/z_actor.c | 611 ++++++++++-------- src/code/z_en_a_keep.c | 2 +- src/code/z_parameter.c | 2 +- src/code/z_player_lib.c | 4 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../z_bg_jya_bombchuiwa.c | 6 +- .../ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 2 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 6 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 2 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 2 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 2 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 2 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 2 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 2 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 2 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 8 +- .../actors/ovl_En_Anubice/z_en_anubice.c | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 2 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 2 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 2 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 2 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 2 +- .../z_en_daiku_kakariko.c | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 4 +- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 2 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 33 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 2 +- src/overlays/actors/ovl_En_Gb/z_en_gb.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 10 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 13 +- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 2 +- src/overlays/actors/ovl_En_Goma/z_en_goma.c | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 2 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 2 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 2 +- .../actors/ovl_En_Heishi3/z_en_heishi3.c | 2 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 2 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.c | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 42 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.c | 6 +- src/overlays/actors/ovl_En_In/z_en_in.c | 8 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 8 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 2 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 2 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 2 +- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 26 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 2 +- .../actors/ovl_En_Lightbox/z_en_lightbox.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 2 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 2 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 2 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 2 +- src/overlays/actors/ovl_En_Mu/z_en_mu.c | 2 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 2 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 2 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 2 +- src/overlays/actors/ovl_En_Ny/z_en_ny.c | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 2 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 4 +- .../actors/ovl_En_Pu_box/z_en_pu_box.c | 2 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 6 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 10 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 4 +- .../actors/ovl_En_Skjneedle/z_en_skjneedle.c | 2 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 4 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.c | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 2 +- .../ovl_En_Takara_Man/z_en_takara_man.c | 4 +- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 2 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 2 +- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 2 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 2 +- src/overlays/actors/ovl_En_Trap/z_en_trap.c | 2 +- .../ovl_En_Wonder_Item/z_en_wonder_item.c | 2 +- .../ovl_En_Wonder_Talk/z_en_wonder_talk.c | 4 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 7 +- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 14 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 4 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 2 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 4 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- .../actors/ovl_player_actor/z_player.c | 104 +-- 127 files changed, 668 insertions(+), 564 deletions(-) diff --git a/include/functions.h b/include/functions.h index 479281d033d..b8b3563e017 100644 --- a/include/functions.h +++ b/include/functions.h @@ -332,7 +332,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); @@ -404,7 +404,7 @@ void func_8002ED80(Actor* actor, PlayState* play, s32 flag); PosRot* Actor_GetFocus(PosRot* dest, Actor* actor); PosRot* Actor_GetWorld(PosRot* dest, Actor* actor); PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor); -s32 func_8002F0C8(Actor* actor, Player* player, s32 flag); +s32 Target_OutsideLeashRange(Actor* actor, Player* player, s32 ignoreLeash); u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play); s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId); s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 exchangeItemId); @@ -452,7 +452,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); diff --git a/include/z64.h b/include/z64.h index e962e4f33fe..0da9c95d12c 100644 --- a/include/z64.h +++ b/include/z64.h @@ -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; diff --git a/include/z64actor.h b/include/z64actor.h index 8fdbbf1dbc1..225ee983c1d 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -166,7 +166,8 @@ typedef struct { #define ACTOR_FLAG_24 (1 << 24) #define ACTOR_FLAG_25 (1 << 25) #define ACTOR_FLAG_26 (1 << 26) -#define ACTOR_FLAG_27 (1 << 27) +// Prevents locking on with Z targeting an actor even if Navi is floating over it +#define ACTOR_FLAG_CANT_LOCK_ON (1 << 27) #define ACTOR_FLAG_28 (1 << 28) #define COLORFILTER_GET_COLORINTENSITY(colorFilterParams) (((colorFilterParams) & 0x1F00) >> 5) @@ -512,6 +513,45 @@ typedef enum { /* 0xFF */ NAVI_ENEMY_NONE = 0xFF } NaviEnemy; +typedef struct { + /* 0x00 */ Vec3f pos; + /* 0x0C */ f32 radius; + /* 0x10 */ Color_RGB8 color; +} LockOnTriangleSet; // size = 0x14 + +typedef struct { + /* 0x00 */ Vec3f naviRefPos; // possibly wrong + /* 0x0C */ Vec3f lockOnPos; + /* 0x18 */ Color_RGBAf naviInner; + /* 0x28 */ Color_RGBAf naviOuter; + /* 0x38 */ Actor* fairyActor; + /* 0x3C */ Actor* lockOnActor; + /* 0x40 */ f32 fairyMoveProgressFactor; // Controls Navi so she can smootly transition to the target actor + /* 0x44 */ f32 lockOnRadius; // Control the circle lock-on triangles coming in from offscreen when you first target + /* 0x48 */ s16 lockOnAlpha; + /* 0x4A */ u8 fairyActorCategory; + /* 0x4B */ u8 rotZTick; + /* 0x4C */ s8 lockOnIndex; + /* 0x50 */ LockOnTriangleSet lockOnTriangleSets[3]; + /* 0x8C */ Actor* forcedTargetActor; + /* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY + /* 0x94 */ Actor* arrowPointedActor; +} TargetContext; // size = 0x98 + +typedef enum TargetMode { + /* 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) diff --git a/include/z64player.h b/include/z64player.h index ae497a395ae..9e3e3c55b37 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -655,7 +655,7 @@ typedef struct Player { /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; /* 0x05E4 */ ColliderQuad shieldQuad; - /* 0x0664 */ Actor* unk_664; + /* 0x0664 */ Actor* lockOnActor; /* 0x0668 */ char unk_668[0x004]; /* 0x066C */ s32 unk_66C; /* 0x0670 */ s32 meleeWeaponEffectIndex; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 3edfbaeee74..0517c1ecdb0 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -221,18 +221,25 @@ void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedIn } typedef struct { - /* 0x00 */ Color_RGBA8 inner; - /* 0x04 */ Color_RGBA8 outer; + /* 0x0 */ Color_RGBA8 inner; + /* 0x4 */ Color_RGBA8 outer; } NaviColor; // size = 0x8 -NaviColor sNaviColorList[] = { - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 255, 255, 255, 255 }, { 0, 0, 255, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 150, 150, 255, 255 }, { 150, 150, 255, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, +// Has an unnecessary extra entry +NaviColor sNaviColorList[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 + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_EXPLOSIVE + { { 150, 150, 255, 255 }, { 150, 150, 255, 0 } }, // ACTORCAT_NPC + { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, // ACTORCAT_ENEMY + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_PROP + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_ITEMACTION + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_MISC + { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, // ACTORCAT_BOSS + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_DOOR + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_CHEST + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // }; // unused @@ -240,143 +247,147 @@ Gfx D_80115FF0[] = { gsSPEndDisplayList(), }; -void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 arg4) { - targetCtx->arr_50[index].pos.x = arg2; - targetCtx->arr_50[index].pos.y = arg3; - targetCtx->arr_50[index].pos.z = arg4; - targetCtx->arr_50[index].unk_0C = targetCtx->unk_44; +void Target_SetLockOnPos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { + targetCtx->lockOnTriangleSets[index].pos.x = x; + targetCtx->lockOnTriangleSets[index].pos.y = y; + targetCtx->lockOnTriangleSets[index].pos.z = z; + targetCtx->lockOnTriangleSets[index].radius = targetCtx->lockOnRadius; } -void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { - TargetContextEntry* entry; - NaviColor* naviColor; +void Target_InitLockOn(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { + LockOnTriangleSet* triangleSet; + NaviColor* naviColorEntry; s32 i; - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &play->view.eye); - targetCtx->unk_44 = 500.0f; - targetCtx->unk_48 = 0x100; + Math_Vec3f_Copy(&targetCtx->lockOnPos, &play->view.eye); + targetCtx->lockOnRadius = 500.0f; + targetCtx->lockOnAlpha = 0x100; - naviColor = &sNaviColorList[actorCategory]; + naviColorEntry = &sNaviColorList[actorCategory]; - entry = &targetCtx->arr_50[0]; - for (i = 0; i < ARRAY_COUNT(targetCtx->arr_50); i++) { - func_8002BE64(targetCtx, i, 0.0f, 0.0f, 0.0f); - entry->color.r = naviColor->inner.r; - entry->color.g = naviColor->inner.g; - entry->color.b = naviColor->inner.b; - entry++; + triangleSet = &targetCtx->lockOnTriangleSets[0]; + for (i = 0; i < ARRAY_COUNT(targetCtx->lockOnTriangleSets); i++, triangleSet++) { + Target_SetLockOnPos(targetCtx, i, 0.0f, 0.0f, 0.0f); + + triangleSet->color.r = naviColorEntry->inner.r; + triangleSet->color.g = naviColorEntry->inner.g; + triangleSet->color.b = naviColorEntry->inner.b; } } -void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { - NaviColor* naviColor = &sNaviColorList[actorCategory]; +void Target_SetFairyState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { targetCtx->naviRefPos.x = actor->focus.pos.x; targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); targetCtx->naviRefPos.z = actor->focus.pos.z; - targetCtx->naviInner.r = naviColor->inner.r; - targetCtx->naviInner.g = naviColor->inner.g; - targetCtx->naviInner.b = naviColor->inner.b; - targetCtx->naviInner.a = naviColor->inner.a; - targetCtx->naviOuter.r = naviColor->outer.r; - targetCtx->naviOuter.g = naviColor->outer.g; - targetCtx->naviOuter.b = naviColor->outer.b; - targetCtx->naviOuter.a = naviColor->outer.a; -} - -void func_8002C0C0(TargetContext* targetCtx, Actor* actor, PlayState* play) { - targetCtx->arrowPointedActor = NULL; - targetCtx->targetedActor = NULL; - targetCtx->unk_40 = 0.0f; - targetCtx->unk_8C = NULL; + + targetCtx->naviInner.r = sNaviColorList[actorCategory].inner.r; + targetCtx->naviInner.g = sNaviColorList[actorCategory].inner.g; + targetCtx->naviInner.b = sNaviColorList[actorCategory].inner.b; + targetCtx->naviInner.a = sNaviColorList[actorCategory].inner.a; + targetCtx->naviOuter.r = sNaviColorList[actorCategory].outer.r; + targetCtx->naviOuter.g = sNaviColorList[actorCategory].outer.g; + targetCtx->naviOuter.b = sNaviColorList[actorCategory].outer.b; + targetCtx->naviOuter.a = sNaviColorList[actorCategory].outer.a; +} + +void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { + targetCtx->fairyActor = NULL; + targetCtx->lockOnActor = NULL; + targetCtx->fairyMoveProgressFactor = 0.0f; + targetCtx->forcedTargetActor = NULL; targetCtx->bgmEnemy = NULL; - targetCtx->unk_4B = 0; - targetCtx->unk_4C = 0; - Actor_SetNaviToActor(targetCtx, actor, actor->category, play); - func_8002BE98(targetCtx, actor->category, play); + targetCtx->rotZTick = 0; + targetCtx->lockOnIndex = 0; + Target_SetFairyState(targetCtx, actor, actor->category, play); + Target_InitLockOn(targetCtx, actor->category, play); } -void func_8002C124(TargetContext* targetCtx, PlayState* play) { - Actor* actor = targetCtx->targetedActor; +void Target_Draw(TargetContext* targetCtx, PlayState* play) { + Actor* actor = targetCtx->lockOnActor; OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029); - if (targetCtx->unk_48 != 0) { - TargetContextEntry* entry; + if (targetCtx->lockOnAlpha != 0) { + LockOnTriangleSet* entry; Player* player; - s16 spCE; + s16 alpha; f32 temp1; - Vec3f projTargetCenter; - s32 spB8; - f32 projTargetCappedInvW; - s32 spB0; - s32 spAC; - f32 var1; - f32 var2; + Vec3f projectedPos; + s32 totalEntries; + f32 invW; s32 i; + s32 index; + f32 projectdPosScale; + f32 lockOnScaleX; + s32 triangleIndex; player = GET_PLAYER(play); - spCE = 0xFF; - var1 = 1.0f; + alpha = 255; + projectdPosScale = 1.0f; - if (targetCtx->unk_4B != 0) { - spB8 = 1; + if (targetCtx->rotZTick != 0) { + totalEntries = 1; } else { - spB8 = 3; + // Use multiple triangle sets for the movement effect when the triangles are + // getting closer to the actor from the margin of the screen + totalEntries = ARRAY_COUNT(targetCtx->lockOnTriangleSets); } if (actor != NULL) { - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->focus.pos); - var1 = (500.0f - targetCtx->unk_44) / 420.0f; + Math_Vec3f_Copy(&targetCtx->lockOnPos, &actor->focus.pos); + projectdPosScale = (500.0f - targetCtx->lockOnRadius) / 420.0f; } else { - targetCtx->unk_48 -= 120; - if (targetCtx->unk_48 < 0) { - targetCtx->unk_48 = 0; + targetCtx->lockOnAlpha -= 120; + if (targetCtx->lockOnAlpha < 0) { + targetCtx->lockOnAlpha = 0; } - spCE = targetCtx->unk_48; + alpha = targetCtx->lockOnAlpha; } - Actor_ProjectPos(play, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW); + Actor_ProjectPos(play, &targetCtx->lockOnPos, &projectedPos, &invW); - projTargetCenter.x = (160 * (projTargetCenter.x * projTargetCappedInvW)) * var1; - projTargetCenter.x = CLAMP(projTargetCenter.x, -320.0f, 320.0f); + projectedPos.x = ((SCREEN_WIDTH / 2) * (projectedPos.x * invW)) * projectdPosScale; + projectedPos.x = CLAMP(projectedPos.x, -SCREEN_WIDTH, SCREEN_WIDTH); - projTargetCenter.y = (120 * (projTargetCenter.y * projTargetCappedInvW)) * var1; - projTargetCenter.y = CLAMP(projTargetCenter.y, -240.0f, 240.0f); + projectedPos.y = ((SCREEN_HEIGHT / 2) * (projectedPos.y * invW)) * projectdPosScale; + projectedPos.y = CLAMP(projectedPos.y, -SCREEN_HEIGHT, SCREEN_HEIGHT); - projTargetCenter.z = projTargetCenter.z * var1; + projectedPos.z *= projectdPosScale; - targetCtx->unk_4C--; - if (targetCtx->unk_4C < 0) { - targetCtx->unk_4C = 2; + targetCtx->lockOnIndex--; + if (targetCtx->lockOnIndex < 0) { + targetCtx->lockOnIndex = ARRAY_COUNT(targetCtx->lockOnTriangleSets) - 1; } - func_8002BE64(targetCtx, targetCtx->unk_4C, projTargetCenter.x, projTargetCenter.y, projTargetCenter.z); + Target_SetLockOnPos(targetCtx, targetCtx->lockOnIndex, projectedPos.x, projectedPos.y, projectedPos.z); - if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->unk_664)) { + if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->lockOnActor)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57); - for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { - entry = &targetCtx->arr_50[spAC]; + for (i = 0, index = targetCtx->lockOnIndex; i < totalEntries; + i++, index = (index + 1) % ARRAY_COUNT(targetCtx->lockOnTriangleSets)) { + entry = &targetCtx->lockOnTriangleSets[index]; - if (entry->unk_0C < 500.0f) { - if (entry->unk_0C <= 120.0f) { - var2 = 0.15f; + if (entry->radius < 500.0f) { + if (entry->radius <= 120.0f) { + lockOnScaleX = 0.15f; } else { - var2 = ((entry->unk_0C - 120.0f) * 0.001f) + 0.15f; + lockOnScaleX = ((entry->radius - 120.0f) * 0.001f) + 0.15f; } Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW); - Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY); + Matrix_Scale(lockOnScaleX, 0.15f, 1.0f, MTXMODE_APPLY); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, entry->color.r, entry->color.g, entry->color.b, (u8)spCE); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, entry->color.r, entry->color.g, entry->color.b, (u8)alpha); - Matrix_RotateZ((targetCtx->unk_4B & 0x7F) * (M_PI / 64), MTXMODE_APPLY); + Matrix_RotateZ((targetCtx->rotZTick & 0x7F) * (M_PI / 64), MTXMODE_APPLY); - for (i = 0; i < 4; i++) { + // Draw the 4 lock-on triangles + for (triangleIndex = 0; triangleIndex < 4; triangleIndex++) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); - Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); + Matrix_Translate(entry->radius, entry->radius, 0.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL); @@ -384,17 +395,17 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) { } } - spCE -= 0xFF / 3; - if (spCE < 0) { - spCE = 0; + alpha -= 255 / ARRAY_COUNT(targetCtx->lockOnTriangleSets); + if (alpha < 0) { + alpha = 0; } } } } - actor = targetCtx->unk_94; - if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) { - NaviColor* naviColor = &sNaviColorList[actor->category]; + actor = targetCtx->arrowPointedActor; + if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + NaviColor* color = &sNaviColorList[actor->category]; POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_7); @@ -403,7 +414,7 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) { 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, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, color->inner.r, color->inner.g, color->inner.b, 255); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL); @@ -412,103 +423,112 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2158); } -void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, PlayState* play) { +void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, PlayState* play) { s32 pad; - Actor* unkActor; + Actor* actor; s32 actorCategory; Vec3f projectedFocusPos; - f32 cappedInvWDest; - f32 temp1; - f32 temp2; - f32 temp3; - f32 temp4; - f32 temp5; + f32 invW; + f32 fairyMoveScale; + f32 velocityX; + f32 velocityY; + f32 velocityZ; + f32 lockOnStep; f32 temp6; s32 lockOnSfxId; - unkActor = NULL; + actor = NULL; - if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { - targetCtx->unk_94 = NULL; + // If currently not locked on to an actor and not pressing down on the analog stick then try to find a targetable + // actor + if ((player->lockOnActor != NULL) && (player->unk_84B[player->unk_846] == 2)) { + targetCtx->arrowPointedActor = NULL; } else { - func_80032AF0(play, &play->actorCtx, &unkActor, player); - targetCtx->unk_94 = unkActor; + Target_GetTargetActor(play, &play->actorCtx, &actor, player); + targetCtx->arrowPointedActor = actor; } - if (targetCtx->unk_8C != NULL) { - unkActor = targetCtx->unk_8C; - targetCtx->unk_8C = NULL; - } else if (actorArg != NULL) { - unkActor = actorArg; + if (targetCtx->forcedTargetActor != NULL) { + actor = targetCtx->forcedTargetActor; + targetCtx->forcedTargetActor = NULL; + } else if (lockOnActor != NULL) { + actor = lockOnActor; } - if (unkActor != NULL) { - actorCategory = unkActor->category; + if (actor != NULL) { + actorCategory = actor->category; } else { actorCategory = player->actor.category; } - if ((unkActor != targetCtx->arrowPointedActor) || (actorCategory != targetCtx->activeCategory)) { - targetCtx->arrowPointedActor = unkActor; - targetCtx->activeCategory = actorCategory; - targetCtx->unk_40 = 1.0f; + if ((actor != targetCtx->fairyActor) || (actorCategory != targetCtx->fairyActorCategory)) { + targetCtx->fairyActor = actor; + targetCtx->fairyActorCategory = actorCategory; + targetCtx->fairyMoveProgressFactor = 1.0f; } - if (unkActor == NULL) { - unkActor = &player->actor; + if (actor == NULL) { + actor = &player->actor; } - if (Math_StepToF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) { - temp1 = 0.25f / targetCtx->unk_40; - temp2 = unkActor->world.pos.x - targetCtx->naviRefPos.x; - temp3 = (unkActor->world.pos.y + (unkActor->targetArrowOffset * unkActor->scale.y)) - targetCtx->naviRefPos.y; - temp4 = unkActor->world.pos.z - targetCtx->naviRefPos.z; - targetCtx->naviRefPos.x += temp2 * temp1; - targetCtx->naviRefPos.y += temp3 * temp1; - targetCtx->naviRefPos.z += temp4 * temp1; + if (!Math_StepToF(&targetCtx->fairyMoveProgressFactor, 0.0f, 0.25f)) { + fairyMoveScale = 0.25f / targetCtx->fairyMoveProgressFactor; + + velocityX = actor->world.pos.x - targetCtx->naviRefPos.x; + velocityY = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->naviRefPos.y; + velocityZ = actor->world.pos.z - targetCtx->naviRefPos.z; + + targetCtx->naviRefPos.x += velocityX * fairyMoveScale; + targetCtx->naviRefPos.y += velocityY * fairyMoveScale; + targetCtx->naviRefPos.z += velocityZ * fairyMoveScale; } else { - Actor_SetNaviToActor(targetCtx, unkActor, actorCategory, play); + Target_SetFairyState(targetCtx, actor, actorCategory, play); } - if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) { - Actor_ProjectPos(play, &actorArg->focus.pos, &projectedFocusPos, &cappedInvWDest); - if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * cappedInvWDest))) || - (1.0f <= fabsf(projectedFocusPos.y * cappedInvWDest))) { - actorArg = NULL; + if ((lockOnActor != NULL) && (targetCtx->rotZTick == 0)) { + Actor_ProjectPos(play, &lockOnActor->focus.pos, &projectedFocusPos, &invW); + if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * invW))) || + (fabsf(projectedFocusPos.y * invW) >= 1.0f)) { + lockOnActor = NULL; } } - if (actorArg != NULL) { - if (actorArg != targetCtx->targetedActor) { - func_8002BE98(targetCtx, actorArg->category, play); - targetCtx->targetedActor = actorArg; + if (lockOnActor != NULL) { + if (lockOnActor != targetCtx->lockOnActor) { + // Lock On entries need to be re-initialized when changing the targeted actor + Target_InitLockOn(targetCtx, lockOnActor->category, play); + targetCtx->lockOnActor = lockOnActor; - if (actorArg->id == ACTOR_EN_BOOM) { - targetCtx->unk_48 = 0; + if (lockOnActor->id == ACTOR_EN_BOOM) { + // Avoid drawing the lock on triangles on the boomerang + targetCtx->lockOnAlpha = 0; } - lockOnSfxId = CHECK_FLAG_ALL(actorArg->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON - : NA_SE_SY_LOCK_ON_HUMAN; + lockOnSfxId = CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON + : NA_SE_SY_LOCK_ON_HUMAN; Sfx_PlaySfxCentered(lockOnSfxId); } - targetCtx->targetCenterPos.x = actorArg->world.pos.x; - targetCtx->targetCenterPos.y = actorArg->world.pos.y - (actorArg->shape.yOffset * actorArg->scale.y); - targetCtx->targetCenterPos.z = actorArg->world.pos.z; + targetCtx->lockOnPos.x = lockOnActor->world.pos.x; + targetCtx->lockOnPos.y = lockOnActor->world.pos.y - (lockOnActor->shape.yOffset * lockOnActor->scale.y); + targetCtx->lockOnPos.z = lockOnActor->world.pos.z; + + if (targetCtx->rotZTick == 0) { + lockOnStep = (500.0f - targetCtx->lockOnRadius) * 3.0f; + lockOnStep = CLAMP(lockOnStep, 30.0f, 100.0f); - if (targetCtx->unk_4B == 0) { - temp5 = (500.0f - targetCtx->unk_44) * 3.0f; - temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5); - if (Math_StepToF(&targetCtx->unk_44, 80.0f, temp6) != 0) { - targetCtx->unk_4B++; + if (Math_StepToF(&targetCtx->lockOnRadius, 80.0f, lockOnStep)) { + targetCtx->rotZTick++; } } else { - targetCtx->unk_4B = (targetCtx->unk_4B + 3) | 0x80; - targetCtx->unk_44 = 120.0f; + // 0x80 is or'd to avoid getting this value be set to zero + // This rotation value gets multiplied by 0x200, which multiplied by 0x80 gives a full turn (0x10000) + targetCtx->rotZTick = (targetCtx->rotZTick + 3) | 0x80; + targetCtx->lockOnRadius = 120.0f; } } else { - targetCtx->targetedActor = NULL; - Math_StepToF(&targetCtx->unk_44, 500.0f, 80.0f); + targetCtx->lockOnActor = NULL; + Math_StepToF(&targetCtx->lockOnRadius, 500.0f, 80.0f); } } @@ -808,7 +828,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 = 3; + actor->targetMode = TARGET_MODE_3; actor->minVelocityY = -20.0f; actor->xyzDistToPlayerSq = FLT_MAX; actor->naviEnemyId = NAVI_ENEMY_NONE; @@ -1462,22 +1482,32 @@ PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor) { return arg0; } -f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { - s16 yawTemp = (s16)(actor->yawTowardsPlayer - 0x8000) - arg2; - s16 yawTempAbs = ABS(yawTemp); +/** + * Returns the squared xyz distance from the actor to Player. + * + * This distance will be adjusted smaller if Player is already targeting an actor. The more Player is facing the actor, + * the smaller the distance is adjusted. + */ +f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) { + f32 adjDistSq; + s16 yawDiff; - if (player->unk_664 != NULL) { - if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) { - return FLT_MAX; - } else { - f32 ret = - actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawTempAbs) * (1.0f / 0x8000)); + // The yaw, with player as the origin, from where player is facing to where the actor is positioned + yawDiff = ABS((s16)((s16)(actor->yawTowardsPlayer - 0x8000) - playerShapeYaw)); - return ret; + if (player->lockOnActor != NULL) { + if ((yawDiff > 0x4000) || (actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + return FLT_MAX; } + + // Linear scaling, yaw being 90 degree means it will return the original distance, 0 degree will adjust to 60% + // of the distance + adjDistSq = actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawDiff) * (1.0f / 0x8000)); + + return adjDistSq; } - if (yawTempAbs > 0x2AAA) { + if (yawDiff > 0x2AAA) { return FLT_MAX; } @@ -1492,33 +1522,50 @@ typedef struct { #define TARGET_RANGE(range, leash) \ { SQ(range), (f32)range / leash } -TargetRangeParams D_80115FF8[] = { - TARGET_RANGE(70, 140), TARGET_RANGE(170, 255), TARGET_RANGE(280, 5600), TARGET_RANGE(350, 525), - TARGET_RANGE(700, 1050), TARGET_RANGE(1000, 1500), TARGET_RANGE(100, 105.36842), TARGET_RANGE(140, 163.33333), - TARGET_RANGE(240, 576), TARGET_RANGE(280, 280000), +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 }; -u32 func_8002F090(Actor* actor, f32 arg1) { - return arg1 < D_80115FF8[actor->targetMode].rangeSq; +/** + * Checks if an actor at distance `distSq` is inside the range specified by its targetMode + */ +s32 Target_IsActorInRange(Actor* actor, f32 distSq) { + return distSq < sTargetRanges[actor->targetMode].rangeSq; } -s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { +/** + * Returns true if the actor is outside the leash distance to player. + * + * Passing true to ignoreLeash avoids the distance and yaw checks, and considers the actor inside the leash distance. + */ +s32 Target_OutsideLeashRange(Actor* actor, Player* player, s32 ignoreLeash) { if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) { return true; } - if (!flag) { - s16 var = (s16)(actor->yawTowardsPlayer - 0x8000) - player->actor.shape.rot.y; - s16 abs_var = ABS(var); - f32 dist; + if (!ignoreLeash) { + s16 yawDiff; + f32 distSq; - if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { - dist = FLT_MAX; + // The yaw, with player as the origin, from where player is facing to where the actor is positioned + yawDiff = ABS((s16)((s16)(actor->yawTowardsPlayer - 0x8000) - player->actor.shape.rot.y)); + + if ((player->lockOnActor == NULL) && (yawDiff > 0x2AAA)) { + distSq = FLT_MAX; } else { - dist = actor->xyzDistToPlayerSq; + distSq = actor->xyzDistToPlayerSq; } - return !func_8002F090(actor, D_80115FF8[actor->targetMode].leashScale * dist); + return !Target_IsActorInRange(actor, sTargetRanges[actor->targetMode].leashScale * distSq); } return false; @@ -2050,7 +2097,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play actorCtx->absoluteSpace = NULL; Actor_SpawnEntry(actorCtx, playerEntry, play); - func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play); + Target_Init(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play); func_8002FA60(play); } @@ -2175,13 +2222,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->flags &= ~ACTOR_FLAG_24; if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) { - if (actor == player->unk_664) { + if (actor == player->lockOnActor) { actor->isTargeted = true; } else { actor->isTargeted = false; } - if ((actor->targetPriority != 0) && (player->unk_664 == NULL)) { + if ((actor->targetPriority != 0) && (player->lockOnActor == NULL)) { actor->targetPriority = 0; } @@ -2204,7 +2251,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } } - actor = player->unk_664; + actor = player->lockOnActor; if ((actor != NULL) && (actor->update == NULL)) { actor = NULL; @@ -2213,13 +2260,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if ((actor == NULL) || (player->unk_66C < 5)) { actor = NULL; - if (actorCtx->targetCtx.unk_4B != 0) { - actorCtx->targetCtx.unk_4B = 0; + if (actorCtx->targetCtx.rotZTick != 0) { + actorCtx->targetCtx.rotZTick = 0; Sfx_PlaySfxCentered(NA_SE_SY_LOCK_OFF); } } - func_8002C7BC(&actorCtx->targetCtx, player, actor, play); + Target_Update(&actorCtx->targetCtx, player, actor, play); TitleCard_Update(play, &actorCtx->titleCtx); DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna); } @@ -2958,17 +3005,17 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { osSyncPrintf("アクタークラス削除 [%s]\n", name); // "Actor class deleted [%s]" } - if ((player != NULL) && (actor == player->unk_664)) { + if ((player != NULL) && (actor == player->lockOnActor)) { func_8008EDF0(player); Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } - if (actor == actorCtx->targetCtx.arrowPointedActor) { - actorCtx->targetCtx.arrowPointedActor = NULL; + if (actor == actorCtx->targetCtx.fairyActor) { + actorCtx->targetCtx.fairyActor = NULL; } - if (actor == actorCtx->targetCtx.unk_8C) { - actorCtx->targetCtx.unk_8C = NULL; + if (actor == actorCtx->targetCtx.forcedTargetActor) { + actorCtx->targetCtx.forcedTargetActor = NULL; } if (actor == actorCtx->targetCtx.bgmEnemy) { @@ -2996,106 +3043,150 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { return newHead; } -s32 func_80032880(PlayState* play, Actor* actor) { - s16 sp1E; - s16 sp1C; +s32 Target_InTargetableScreenRegion(PlayState* play, Actor* actor) { + s16 x; + s16 y; - Actor_GetScreenPos(play, actor, &sp1E, &sp1C); + Actor_GetScreenPos(play, actor, &x, &y); - return (sp1E > -20) && (sp1E < 340) && (sp1C > -160) && (sp1C < 400); + return (x > -20) && (x < SCREEN_WIDTH + 20) && (y > -160) && (y < SCREEN_HEIGHT + 160); } -Actor* D_8015BBE8; -Actor* D_8015BBEC; -f32 D_8015BBF0; -f32 sbgmEnemyDistSq; -s32 D_8015BBF8; -s16 D_8015BBFC; +Actor* sTargetableNearestActor; +Actor* sTargetablePrioritizedActor; +f32 sTargetableNearestActorDistSq; +f32 sBgmEnemyDistSq; +s32 sTargetablePrioritizedPriority; +s16 sTargetPlayerRotY; -void func_800328D4(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) { - f32 var; +/** + * Search for targetable actors of the `actorCategory` category. + * + * Looks for the actor of said category with higher targetPriority and the one that is nearest to player. This actor + * must be within the range (relative to player) speicified by its targetMode. + * + * The actor must be on-screen + * + * The highest priority actor is stored in `sTargetablePrioritizedActor`, while the nearest actor is stored in + * `sTargetableNearestActor`. The higher priority / smaller distance of those actors are stored in + * `sTargetablePrioritizedPriority` and `sTargetableNearestActorDistSq`. + * + * For an actor to be taken in consideration by this function it needs: + * - Non-NULL update function + * - Not be Player itself. + * - It must be targetable. + * - Not be the already targeted actor. + * - Be withing the range specified by its targetMode. + * - It must be on-screen (within a margin) + * - Must not be blocked by a surface + * + * This function also checks for the nearest enemy actor, which allows determining if enemy background music should be + * played. This actor is stored in `targetContext.bgmEnemy` and its distance is stored in `sBgmEnemyDistSq` + * + * 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 on this one. + */ +void Target_FindTargetableActorForCategory(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) { + f32 distSq; Actor* actor; - Actor* sp84; + Actor* lockOnActor; CollisionPoly* sp80; s32 sp7C; Vec3f sp70; actor = actorCtx->actorLists[actorCategory].head; - sp84 = player->unk_664; + lockOnActor = player->lockOnActor; - while (actor != NULL) { - if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) { + for (; actor != NULL; actor = actor->next) { + if ((actor->update == NULL) || ((Player*)actor == player)) { + continue; + } - // This block below is for determining the closest actor to player in determining the volume - // used while playing enemy background music - if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) && - (actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sbgmEnemyDistSq)) { + if (!CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) { + continue; + } + + // Determine the closest enemy actor to player within a range. Used for playing enemy background music. + if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + if ((actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sBgmEnemyDistSq)) { actorCtx->targetCtx.bgmEnemy = actor; - sbgmEnemyDistSq = actor->xyzDistToPlayerSq; - } - - if (actor != sp84) { - var = func_8002EFC0(actor, player, D_8015BBFC); - if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(play, actor) && - (!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, &sp80, - 1, 1, 1, 1, &sp7C) || - SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C))) { - if (actor->targetPriority != 0) { - if (actor->targetPriority < D_8015BBF8) { - D_8015BBEC = actor; - D_8015BBF8 = actor->targetPriority; - } - } else { - D_8015BBE8 = actor; - D_8015BBF0 = var; - } - } + sBgmEnemyDistSq = actor->xyzDistToPlayerSq; } } - actor = actor->next; + if (actor == lockOnActor) { + continue; + } + + distSq = Target_GetAdjustedDistSq(actor, player, sTargetPlayerRotY); + + if ((distSq < sTargetableNearestActorDistSq) && Target_IsActorInRange(actor, distSq) && + Target_InTargetableScreenRegion(play, actor) && + (!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, &sp80, 1, 1, 1, + 1, &sp7C) || + SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C))) { + if (actor->targetPriority != 0) { + if (actor->targetPriority < sTargetablePrioritizedPriority) { + sTargetablePrioritizedActor = actor; + sTargetablePrioritizedPriority = actor->targetPriority; + } + } else { + sTargetableNearestActor = actor; + sTargetableNearestActorDistSq = distSq; + } + } } } -u8 D_801160A0[] = { +u8 sTargetableActorCategories[] = { ACTORCAT_BOSS, ACTORCAT_ENEMY, ACTORCAT_BG, ACTORCAT_EXPLOSIVE, ACTORCAT_NPC, ACTORCAT_ITEMACTION, ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH, }; -Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player) { +/** + * Search for the nearest targetable actor. + * + * The specific criteria is specified in Target_FindTargetableActorForCategory. + * + * The actor found is stored in the targetableP parameter. It may be NULL if no actor that fulfills the criteria is + * found. + */ +Actor* Target_GetTargetActor(PlayState* play, ActorContext* actorCtx, Actor** targetableP, Player* player) { s32 i; - u8* entry; + u8* actorCategories; - D_8015BBE8 = D_8015BBEC = NULL; - D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX; - D_8015BBF8 = 0x7FFFFFFF; + sTargetableNearestActor = sTargetablePrioritizedActor = NULL; + sTargetableNearestActorDistSq = sBgmEnemyDistSq = FLT_MAX; + sTargetablePrioritizedPriority = INT32_MAX; if (!Player_InCsMode(play)) { - entry = &D_801160A0[0]; + actorCategories = sTargetableActorCategories; actorCtx->targetCtx.bgmEnemy = NULL; - D_8015BBFC = player->actor.shape.rot.y; + sTargetPlayerRotY = player->actor.shape.rot.y; + // Try to search for a targetable actor that's a Boss, Enemy or Bg first for (i = 0; i < 3; i++) { - func_800328D4(play, actorCtx, player, *entry); - entry++; + Target_FindTargetableActorForCategory(play, actorCtx, player, *actorCategories); + actorCategories++; } - if (D_8015BBE8 == NULL) { - for (; i < ARRAY_COUNT(D_801160A0); i++) { - func_800328D4(play, actorCtx, player, *entry); - entry++; + // If no actor in the above categories was found then try to search for one in every other category + if (sTargetableNearestActor == NULL) { + for (; i < ARRAY_COUNT(sTargetableActorCategories); i++) { + Target_FindTargetableActorForCategory(play, actorCtx, player, *actorCategories); + actorCategories++; } } } - if (D_8015BBE8 == NULL) { - *actorPtr = D_8015BBEC; + if (sTargetableNearestActor == NULL) { + *targetableP = sTargetablePrioritizedActor; } else { - *actorPtr = D_8015BBE8; + *targetableP = sTargetableNearestActor; } - return *actorPtr; + return *targetableP; } /** diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 572479dc718..d283ff11d7e 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -152,7 +152,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; - thisx->targetMode = 0; + thisx->targetMode = TARGET_MODE_0; break; case A_OBJ_BOULDER_FRAGMENT: thisx->gravity = -1.5f; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 42644bbdaeb..c6af0bb9225 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3257,7 +3257,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)) { - func_8002C124(&play->actorCtx.targetCtx, play); // Draw Z-Target + Target_Draw(&play->actorCtx.targetCtx, play); // Draw Z-Target } Gfx_SetupDL_39Overlay(play->state.gfxCtx); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index a14934d2c5b..c484f817fdb 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -600,7 +600,7 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAc } void func_8008EDF0(Player* this) { - this->unk_664 = NULL; + this->lockOnActor = NULL; this->stateFlags2 &= ~PLAYER_STATE2_13; } @@ -622,7 +622,7 @@ void func_8008EEAC(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); func_8008EE08(this); - this->unk_664 = actor; + this->lockOnActor = actor; this->unk_684 = actor; this->stateFlags1 |= PLAYER_STATE1_16; Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 2c4588726af..eef6dff6dd3 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -161,7 +161,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 = 4; + this->dyna.actor.targetMode = TARGET_MODE_4; break; } diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 9dcf1f52c7c..0fa4e84cb7b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -122,7 +122,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 0, 80, 130, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_4, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index dba8eb937a7..d0cfa40e93e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -54,10 +54,8 @@ static ColliderJntSphInit sJntSphInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), + 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_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index cc6d15db242..4ce04fd79b5 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -65,7 +65,7 @@ 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, 3, 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), }; diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index f5699cae583..59cdf82f615 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -42,10 +42,8 @@ ActorInit Bg_Treemouth_InitVars = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), - ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), + 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_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 6ad24aa7d1b..f7ca7e839a3 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -48,7 +48,7 @@ ActorInit Boss_Dodongo_InitVars = { #include "z_boss_dodongo_data.inc.c" static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_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), diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index bbc6c678da2..1c7328ba72d 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -59,7 +59,7 @@ ActorInit Boss_Fd_InitVars = { #include "z_boss_fd_colchk.inc.c" static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_VOLVAGIA, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 6839fb7a2af..e073dc5a7b9 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -67,7 +67,7 @@ static Vec3f sHoleLocations[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_VOLVAGIA, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 1254786bd6f..ba6a59799ea 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -326,7 +326,7 @@ void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId } static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GANONDORF, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 054a90c2f15..6d16dc9d512 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -199,7 +199,7 @@ static void* sLimbTex_rgba16_16x32[] = { gPhantomGanonLimbTex_00AA80, gPhantomGa static void* sMouthTex_ci8_16x16[] = { gPhantomGanonMouthTex, gPhantomGanonSmileTex }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_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), diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 760a4370122..b7f3defeb98 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -333,7 +333,7 @@ void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) { } static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_GOHMA, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 0262a6ad56d..15950948748 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -292,7 +292,7 @@ static s16 sAttackRot[41] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_MORPHA, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 53012fe9e81..8594d304d21 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -259,7 +259,7 @@ static AnimationHeader* sHandHangPoses[] = { &gBongoLeftHandHangPoseAnim, &gBong static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BONGO_BONGO, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index bec9deb5ef9..6e11b3ac7f9 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -201,7 +201,7 @@ static Vec3f sTwinrovaPillarPos[] = { static u8 sTwInitialized = false; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, 0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 65a892b1a32..a560a764d70 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -581,7 +581,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { s16 warpId; Actor_SetScale(&this->actor, 0.1f); - this->actor.targetMode = 5; + this->actor.targetMode = TARGET_MODE_5; this->actor.colChkInfo.mass = MASS_IMMOVABLE; switch (this->actor.params) { diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index e8db4e91179..125c80fdf0d 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -79,7 +79,7 @@ void DoorAna_Init(Actor* thisx, PlayState* play) { } else { DoorAna_SetupAction(this, DoorAna_WaitOpen); } - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_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.targetMode != TARGET_MODE_0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & PLAYER_STATE1_31) && (player->actionVar1 == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 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 = 1; + this->actor.targetMode = TARGET_MODE_1; } else { - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; } } } diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index fde25a0f38f..744b4beaeb1 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -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 = 3; + this->actor.targetMode = TARGET_MODE_3; this->actionFunc = EnAnubice_FindFlameCircles; } diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 78df59cff2f..b0ab0665001 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -32,7 +32,7 @@ ActorInit En_Attack_Niw_InitVars = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 1, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index dd52141fd21..af1e679906c 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -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 = 4; + this->actor.targetMode = TARGET_MODE_4; this->upperParams = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 81b4fa26389..dac0a47d427 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -145,7 +145,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(gravity, -1, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIGOCTO, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 33, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index d808adbbb8a..388d4eb9ffc 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -4,7 +4,7 @@ #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" #include "assets/objects/object_bg/object_bg.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_CANT_LOCK_ON) typedef enum { /* 0 */ CHU_GIRL_EYES_ASLEEP, @@ -78,7 +78,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { } this->prizeSelect = (s16)Rand_ZeroFloat(4.99f); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actionFunc = EnBomBowMan_SetupWaitAsleep; } diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 07fd4e75b5f..1ec62df50b1 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -55,7 +55,7 @@ static ColliderJntSphInit sJntSphInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000 * BOMBCHU_SCALE, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 01b54345807..7958d9f5c99 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -109,7 +109,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) { thisx->colChkInfo.cylRadius = 10.0f; thisx->colChkInfo.cylHeight = 10; - thisx->targetMode = 0; + thisx->targetMode = TARGET_MODE_0; if (thisx->params == BOMBFLOWER_BODY) { this->timer = 140; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 4f406212eaa..eb2fcf64f87 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -49,7 +49,7 @@ static ColliderQuadInit sQuadInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_S8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_S8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 5db893a295f..5ac66a8e209 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -66,7 +66,7 @@ static AnimationHeader* sAnimations[4] = { &gTreasureChestAnim_00024C, &gTreasur &gTreasureChestAnim_00043C, &gTreasureChestAnim_00043C }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_STOP), }; static UNK_TYPE sUnused; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index b6636d63d05..c6112ee3ed0 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -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 = 5; + this->actor.targetMode = TARGET_MODE_5; Collider_SetCylinder(play, &this->collider, &this->actor, &sArwingCylinderInit); this->actor.colChkInfo.health = 3; diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 0f42827ed0c..64f5467a923 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; R_EPONAS_SONG_PLAYED = false; break; diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 1268c944678..57879060d88 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; this->path = this->actor.params & 0xFF; this->unk_1EC = 0; // This variable is unused anywhere else this->talkState = 0; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 510a64851ba..3c36a2c5fef 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; this->currentAnimIndex = -1; this->runSpeed = 5.0f; this->initRot = this->actor.world.rot; diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 1f21ece1011..65a9b513117 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; this->currentAnimIndex = -1; if (this->flags & 0x40) { diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 8759a244c31..1c19e8e1ef3 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -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 = 2; + this->actor.targetMode = TARGET_MODE_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 = 1; + this->actor.targetMode = TARGET_MODE_1; } EnDekubaba_SetupWait(this); diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 99e2cfd78d6..2392f239a19 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -93,7 +93,7 @@ void EnDivingGame_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } else { D_809EF0B0 = true; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = func_809EDCB0; } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 67727d95fe6..b5721da9106 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -113,7 +113,7 @@ static DnsItemEntry* sItemEntries[] = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index bbe10cbbcab..ea69fdcebb1 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -84,7 +84,7 @@ void EnDntJiji_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ デグナッツお面品評会長老 ☆☆☆☆☆ %x\n" VT_RST, this->stage); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.colChkInfo.mass = 0xFF; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actionFunc = EnDntJiji_SetFlower; this->actor.gravity = -2.0f; } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 7c6a0674415..a00c26dd753 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -308,7 +308,7 @@ void EnDodongo_Init(Actor* thisx, PlayState* play) { EnDodongo* this = (EnDodongo*)thisx; EffectBlureInit1 blureInit; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; Actor_ProcessInitChain(&this->actor, sInitChain); this->bombSmokePrimColor.r = this->bombSmokePrimColor.g = this->bombSmokeEnvColor.r = 255; this->bombSmokePrimColor.a = this->bombSmokeEnvColor.a = 200; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index c3216cdc80d..4048aeb7db8 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -73,7 +73,7 @@ static EnDoorInfo sDoorInfo[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; @@ -205,7 +205,7 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { doorType = DOOR_SCENEEXIT; } else { this->actionFunc = EnDoor_WaitForCheck; - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON; } } // Replace the door type it was loaded with by the new type diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 49a359cd401..f19e1eff821 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -41,7 +41,7 @@ void EnDs_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.013f); this->actionFunc = EnDs_Wait; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->unk_1E8 = 0; this->actor.flags &= ~ACTOR_FLAG_0; this->unk_1E4 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 6d299388604..80cd4a9c3a8 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -291,7 +291,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) { } Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_0); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index ed26d64bf91..654de2f05d0 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -838,7 +838,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; Player* player = GET_PLAYER(play); - Actor* arrowPointedActor; + Actor* fairyActor; f32 xScale; f32 distFromPlayerHat; @@ -937,9 +937,9 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A029A8(this, 1); nextPos = play->actorCtx.targetCtx.naviRefPos; nextPos.y += (1500.0f * this->actor.scale.y); - arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; + fairyActor = play->actorCtx.targetCtx.fairyActor; - if (arrowPointedActor != NULL) { + if (fairyActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speed >= 5.0f) { @@ -1000,12 +1000,12 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu } void func_80A04414(EnElf* this, PlayState* play) { - Actor* arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; + Actor* fairyActor = play->actorCtx.targetCtx.fairyActor; Player* player = GET_PLAYER(play); f32 transitionRate; u16 sfxId; - if (play->actorCtx.targetCtx.unk_40 != 0.0f) { + if (play->actorCtx.targetCtx.fairyMoveProgressFactor != 0.0f) { this->unk_2C6 = 0; this->unk_29C = 1.0f; @@ -1015,7 +1015,7 @@ void func_80A04414(EnElf* this, PlayState* play) { } else { if (this->unk_2C6 == 0) { - if ((arrowPointedActor == NULL) || + if ((fairyActor == NULL) || (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviRefPos) < 50.0f)) { this->unk_2C6 = 1; } @@ -1034,15 +1034,15 @@ void func_80A04414(EnElf* this, PlayState* play) { } if (this->fairyFlags & 1) { - if ((arrowPointedActor == NULL) || (player->unk_664 == NULL)) { + if ((fairyActor == NULL) || (player->lockOnActor == NULL)) { this->fairyFlags ^= 1; } } else { - if ((arrowPointedActor != NULL) && (player->unk_664 != NULL)) { - if (arrowPointedActor->category == ACTORCAT_NPC) { + if ((fairyActor != NULL) && (player->lockOnActor != NULL)) { + if (fairyActor->category == ACTORCAT_NPC) { sfxId = NA_SE_VO_NAVY_HELLO; } else { - sfxId = (arrowPointedActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; + sfxId = (fairyActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; } if (this->unk_2C7 == 0) { @@ -1056,7 +1056,7 @@ void func_80A04414(EnElf* this, PlayState* play) { void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; - Actor* arrowPointedActor; + Actor* fairyActor; Player* player = GET_PLAYER(play); if (play->csCtx.state != CS_STATE_IDLE) { @@ -1081,7 +1081,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } } else { - arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; + fairyActor = play->actorCtx.targetCtx.fairyActor; // `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 @@ -1092,8 +1092,8 @@ void func_80A0461C(EnElf* this, PlayState* play) { ((R_SCENE_CAM_TYPE & 0x10) && Play_CheckViewpoint(play, VIEWPOINT_PIVOT))) { temp = 12; this->unk_2C0 = 100; - } else if (arrowPointedActor == NULL || arrowPointedActor->category == ACTORCAT_NPC) { - if (arrowPointedActor != NULL) { + } else if (fairyActor == NULL || fairyActor->category == ACTORCAT_NPC) { + if (fairyActor != NULL) { this->unk_2C0 = 100; player->stateFlags2 |= PLAYER_STATE2_20; temp = 0; @@ -1224,7 +1224,8 @@ void func_80A04DE4(EnElf* this, PlayState* play) { if (this->fairyFlags & 0x10) { naviRefPos = play->actorCtx.targetCtx.naviRefPos; - if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) { + if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || + (&this->actor == player->lockOnActor)) { naviRefPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); naviRefPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; @@ -1378,7 +1379,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; if (player->naviTextId == 0) { - if (player->unk_664 == NULL) { + if (player->lockOnActor == NULL) { if (((gSaveContext.save.info.playerData.naviTimer >= 600) && (gSaveContext.save.info.playerData.naviTimer <= 3000)) || (nREG(89) != 0)) { diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 05f22fca8e2..f6c9ca63331 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -2,7 +2,7 @@ #include "terminal.h" #include "overlays/actors/ovl_En_Tite/z_en_tite.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) void EnEncount1_Init(Actor* thisx, PlayState* play); void EnEncount1_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 8b7ea195cf9..98408e75c46 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -112,7 +112,7 @@ 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, 2, ICHAIN_CONTINUE), + ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 4000, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index d7e4830e40a..3445554611e 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -168,7 +168,7 @@ static s16 sTimerFrogSong[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index d781e699203..a3f85d38462 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -92,7 +92,7 @@ void EnFu_Init(Actor* thisx, PlayState* play) { this->skelanime.playSpeed = 2.0f; } this->behaviorFlags = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; } void EnFu_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 957f2df07c2..6c21c789c0c 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -151,7 +151,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_FREEZARD, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 934ed70d287..b58de333172 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -121,7 +121,7 @@ static ColliderCylinderInitType1 sBottlesCylindersInit[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 2200, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 97ad57936be..424d480f210 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_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 = 3; + this->actor.targetMode = TARGET_MODE_3; this->hairstyle = GE1_HAIR_BOB; // "Horseback archery Gerudo EVENT_INF(0) =" osSyncPrintf(VT_FGCOL(CYAN) "やぶさめ ゲルド EVENT_INF(0) = %x\n" VT_RST, gSaveContext.eventInf[0]); diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index f0da9687570..5cb7cb02721 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; } break; case GE2_TYPE_STATIONARY: EnGe2_ChangeAction(this, GE2_ACTION_STAND); if (EnGe2_CheckCarpentersFreed()) { this->actor.update = EnGe2_UpdateFriendly; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_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 = 6; + this->actor.targetMode = TARGET_MODE_6; break; default: ASSERT(0, "0", "../z_en_ge2.c", 418); @@ -594,7 +594,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) { this->actor.update = EnGe2_UpdateFriendly; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; } } @@ -619,7 +619,7 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { if (EnGe2_CheckCarpentersFreed()) { this->actor.update = EnGe2_UpdateFriendly; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.colorFilterTimer = 0; } else if (this->actor.colorFilterTimer == 0) { this->actor.update = EnGe2_Update; diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 3713dd0f01f..f5d42d7dbce 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -80,7 +80,7 @@ void EnGe3_Init(Actor* thisx, PlayState* play2) { EnGe3_ChangeAction(this, 0); this->actionFunc = EnGe3_ForceTalk; this->unk_30C = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 9a22b0c509e..4c13e859607 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -58,7 +58,7 @@ static ColliderCylinderInitType1 sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index a58b58e02d2..c273bcb2edf 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -642,7 +642,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { } EnGo_ChangeAnim(this, ENGO_ANIM_0); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actor.gravity = -1.0f; @@ -676,7 +676,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { EnGo_SetupAction(this, func_80A3FEB4); break; case 0x90: - this->actor.targetMode = 5; + this->actor.targetMode = TARGET_MODE_5; Actor_SetScale(&this->actor, 0.16f); EnGo_SetupAction(this, EnGo_CurledUp); break; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 2a9a5fc4b3c..f045baf0c49 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -115,10 +115,13 @@ static EnGo2DataStruct1 D_80A4816C[14] = { }; static EnGo2DataStruct2 D_80A481F8[14] = { - { 30.0f, 0.026f, 6, 60.0f }, { 24.0f, 0.008f, 6, 30.0f }, { 28.0f, 0.16f, 5, 380.0f }, { 28.0f, 0.01f, 7, 40.0f }, - { 30.0f, 0.015f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, - { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, - { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, + { 30.0f, 0.026f, TARGET_MODE_6, 60.0f }, { 24.0f, 0.008f, TARGET_MODE_6, 30.0f }, + { 28.0f, 0.16f, TARGET_MODE_5, 380.0f }, { 28.0f, 0.01f, TARGET_MODE_7, 40.0f }, + { 30.0f, 0.015f, TARGET_MODE_6, 30.0f }, { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, + { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, + { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, + { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, + { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, { 28.0f, 0.01f, TARGET_MODE_6, 30.0f }, }; static f32 sPlayerTrackingYOffsets[14][2] = { @@ -851,7 +854,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.targetMode = D_80A481F8[index].targetMode; this->interactRange = D_80A481F8[index].interactRange; this->interactRange += this->collider.dim.radius; } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index e1528413664..1ba6d770869 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -52,7 +52,7 @@ typedef struct { typedef struct { f32 shape_unk_10; f32 scale; - s8 actor_unk_1F; + s8 targetMode; f32 interactRange; } EnGo2DataStruct2; // size = 0x10 diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 5fdff0eac82..9d811f5cd2c 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -98,7 +98,7 @@ static u8 sSpawnNum = 0; static Vec3f sDeadEffectVel = { 0.0f, 0.0f, 0.0f }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_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), diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 26c221408a2..3d85694c8e7 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -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 = 6; + thisx->targetMode = TARGET_MODE_6; this->unk_1D8 = thisx->world.pos; this->actionFunc = func_80A4F734; this->unk_1B4[0].x = 1.0f; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index e624d6720d3..871330a222f 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -45,7 +45,7 @@ static ColliderCylinderInitType1 sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 4a21b285155..3b3f15a88c2 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; switch (this->type) { diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 167f976e8cc..608075e57ca 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); // "Castle Gate Soldier - Power Up" diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 463f7604cc6..12dc88633dd 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -62,7 +62,7 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) { this->type = thisx->params & 0xFF; thisx->colChkInfo.mass = MASS_IMMOVABLE; this->pos = thisx->world.pos; - thisx->targetMode = 6; + thisx->targetMode = TARGET_MODE_6; if (this->type == HEISHI4_AT_MARKET_DYING) { this->height = 30.0f; ActorShape_Init(&thisx->shape, 0.0f, NULL, 30.0f); diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index afafe3ef322..7e0ad8afe6f 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -89,7 +89,7 @@ void EnHs_Init(Actor* thisx, PlayState* play) { } this->unk_2A8 = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; } void EnHs_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 5722c8ac7f5..ef8e1838c25 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -63,7 +63,7 @@ void EnHs2_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(子人の時) \n" VT_RST); this->actionFunc = func_80A6F1A4; this->unk_2A8 = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; } void EnHs2_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index aa149275c2a..ea1d2a7b5c0 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -328,27 +328,27 @@ typedef struct { } EnHyInit2Info; // size = 0x1C static EnHyInit2Info sInit2Info[] = { - /* ENHY_TYPE_AOB */ { 36.0f, { 0.0f, 0.0f, 600.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_COB */ { 40.0f, { -100.0f, 0.0f, 400.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_AHG_2 */ { 22.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_3 */ { 20.0f, { -100.0f, 0.0f, 0.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_AHG_4 */ { 22.0f, { 0.0f, 0.0f, 0.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_5 */ { 21.0f, { 0.0f, 0.0f, 0.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BBA */ { 25.0f, { -100.0f, 0.0f, 600.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BJI_7 */ { 28.0f, { -100.0f, 0.0f, 800.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_CNE_8 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_9 */ { 18.0f, { 0.0f, 0.0f, 100.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_10 */ { 18.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_CNE_11 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_12 */ { 21.0f, { 0.0f, 0.0f, -300.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_AHG_13 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_14 */ { 18.0f, { -200.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BJI_15 */ { 27.0f, { -100.0f, 0.0f, 800.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOJ_16 */ { 19.0f, { 400.0f, 0.0f, 0.0f }, 0.01f, 0x04, 30.0f }, - /* ENHY_TYPE_AHG_17 */ { 19.0f, { 400.0f, 0.0f, 0.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BOB_18 */ { 40.0f, { -100.0f, 0.0f, 400.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_BJI_19 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, 0x06, 30.0f }, - /* ENHY_TYPE_AHG_20 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, 0x06, 30.0f }, + /* ENHY_TYPE_AOB */ { 36.0f, { 0.0f, 0.0f, 600.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_COB */ { 40.0f, { -100.0f, 0.0f, 400.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_AHG_2 */ { 22.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_3 */ { 20.0f, { -100.0f, 0.0f, 0.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_AHG_4 */ { 22.0f, { 0.0f, 0.0f, 0.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_5 */ { 21.0f, { 0.0f, 0.0f, 0.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BBA */ { 25.0f, { -100.0f, 0.0f, 600.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BJI_7 */ { 28.0f, { -100.0f, 0.0f, 800.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_CNE_8 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_9 */ { 18.0f, { 0.0f, 0.0f, 100.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_10 */ { 18.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_CNE_11 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_12 */ { 21.0f, { 0.0f, 0.0f, -300.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_AHG_13 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_14 */ { 18.0f, { -200.0f, 0.0f, -200.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BJI_15 */ { 27.0f, { -100.0f, 0.0f, 800.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOJ_16 */ { 19.0f, { 400.0f, 0.0f, 0.0f }, 0.01f, TARGET_MODE_4, 30.0f }, + /* ENHY_TYPE_AHG_17 */ { 19.0f, { 400.0f, 0.0f, 0.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BOB_18 */ { 40.0f, { -100.0f, 0.0f, 400.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_BJI_19 */ { 17.0f, { 0.0f, 0.0f, 700.0f }, 0.01f, TARGET_MODE_6, 30.0f }, + /* ENHY_TYPE_AHG_20 */ { 20.0f, { 0.0f, 0.0f, -200.0f }, 0.01f, TARGET_MODE_6, 30.0f }, }; s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 8a2323df97a..a5736a2027e 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -77,10 +77,8 @@ static ColliderCylinderInit sCylinderInitDroppedFlame = { }; static InitChainEntry sInitChainCapturableFlame[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 60, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE), + 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_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 773f5a7e2c4..57130cda61d 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -520,7 +520,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) { return; } Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actionFunc = func_80A7A4BC; @@ -579,7 +579,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) { gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0; break; case EVENTINF_HORSES_STATE_1: - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; EnIn_ChangeAnim(this, ENIN_ANIM_2); this->actionFunc = func_80A7A568; Interface_SetTimer(60); @@ -595,7 +595,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) { break; case EVENTINF_HORSES_STATE_5: case EVENTINF_HORSES_STATE_6: - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; EnIn_ChangeAnim(this, ENIN_ANIM_6); this->unk_1EC = 8; this->actionFunc = func_80A7AA40; @@ -940,7 +940,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) { if (Actor_ProcessTalkRequest(&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.targetMode == TARGET_MODE_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; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 2f2381818a2..be8b2a67a97 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->rot = this->actor.world.rot; diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 306e64c3f90..72edb1a6c47 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) static ColliderCylinderInit sCylinderInit = { { @@ -69,7 +69,7 @@ void EnKakasi2_Init(Actor* thisx, PlayState* play) { if (this->switchFlag == 0x3F) { this->switchFlag = -1; } - this->actor.targetMode = 4; + this->actor.targetMode = TARGET_MODE_4; this->maxSpawnDistance.x = (spawnRangeY * 40.0f) + 40.0f; this->maxSpawnDistance.y = (spawnRangeXZ * 40.0f) + 40.0f; @@ -124,7 +124,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); OnePointCutscene_Attention(play, &this->actor); - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_CANT_LOCK_ON; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); if (this->switchFlag >= 0) { @@ -151,7 +151,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { OnePointCutscene_Attention(play, &this->actor); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_CANT_LOCK_ON; this->actionFunc = func_80A904D8; } } diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 30e46b5509f..555e8e7f50c 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -71,7 +71,7 @@ void EnKakasi3_Init(Actor* thisx, PlayState* play) { osSyncPrintf("\n\n"); // "Obonur" -- Related to the name of the scarecrow (Bonooru) osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ おーボヌール ☆☆☆☆☆ \n" VT_RST); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 3cdecda1ce8..409848638cf 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -209,7 +209,7 @@ void EnKanban_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->actor.params != ENKANBAN_PIECE) { - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.flags |= ACTOR_FLAG_0; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index a16d5335d88..936a101eb48 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -85,7 +85,7 @@ static CollisionCheckInfoInit sColCheckInfoInit = { 1, 15, 80, MASS_HEAVY }; static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 1, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, NAVI_ENEMY_WITHERED_DEKU_BABA, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index a1be751edc3..e5c40593db8 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -239,19 +239,19 @@ typedef struct { } EnKoInteractInfo; // size = 0xC static EnKoInteractInfo sInteractInfo[] = { - /* ENKO_TYPE_CHILD_0 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_1 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_2 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_3 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_4 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_5 */ { 1, 30.0f, 240.0f }, - /* ENKO_TYPE_CHILD_6 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_7 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_8 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_9 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_10 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_11 */ { 6, 30.0f, 180.0f }, - /* ENKO_TYPE_CHILD_FADO */ { 6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_0 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_1 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_2 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_3 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_4 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_5 */ { TARGET_MODE_1, 30.0f, 240.0f }, + /* ENKO_TYPE_CHILD_6 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_7 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_8 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_9 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_10 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_11 */ { TARGET_MODE_6, 30.0f, 180.0f }, + /* ENKO_TYPE_CHILD_FADO */ { TARGET_MODE_6, 30.0f, 180.0f }, }; s32 EnKo_AreObjectsAvailable(EnKo* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index bf45ee5c8a1..eaee12f457a 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -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 = 3; + this->actor.targetMode = TARGET_MODE_3; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_0); diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index cd35e378729..34aaf8efd94 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -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 = 0; + thisx->targetMode = TARGET_MODE_0; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&object_lightbox_Col_001F10, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index a793a16957f..adb6f0098be 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -277,7 +277,7 @@ void EnMa1_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 8bd61ffafae..3d19b353ac8 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 478d569afb0..bae3443dd93 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_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); diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 314397a9ff3..7bf95a97b0b 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -66,7 +66,7 @@ void EnMk_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnMk_Wait; this->flags = 0; this->swimFlag = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; if (GET_ITEMGETINF(ITEMGETINF_10)) { this->flags |= 4; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 2245d1984e0..ff6f26b26b3 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -176,7 +176,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) { this->path = this->actor.params & 0xFF; this->unk_1F0 = 2; this->unk_1E8 = 0; - this->actor.targetMode = 2; + this->actor.targetMode = TARGET_MODE_2; this->actor.gravity = -1.0f; this->speedXZ = 3.0f; this->unk_204 = this->actor.objectSlot; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index ea7d525d28d..e840f662909 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -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 = 6; + this->actor.targetMode = TARGET_MODE_6; this->unk_1F4 |= 1; this->actor.gravity = -1.0f; if (this->actor.params == 1) { diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index e3c7c6c654d..9837bcca14c 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -53,7 +53,7 @@ static u16 sOfferTextIDs[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 6be01cafd22..c8c6b443db9 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -139,7 +139,7 @@ void EnMu_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AB0BD0); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AB0BFC); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); EnMu_Interact(this, play); EnMu_SetupAction(this, EnMu_Pose); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 8c05a3636d5..53094a6961e 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -114,7 +114,7 @@ static ColliderCylinderInit sCylinderInit2 = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 85b6bd1bc1e..1769ab2ed6a 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -61,7 +61,7 @@ void EnNiwGirl_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gNiwGirlSkel, &gNiwGirlRunAnim, this->jointTable, this->morphTable, 17); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; if (this->actor.params < 0) { this->actor.params = 0; } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index efd92c36d8c..a4bea8197d7 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -165,7 +165,7 @@ void func_80AB9F24(EnNiwLady* this, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_272 = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.draw = EnNiwLady_Draw; switch (this->unk_278) { case 0: diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index b9544ad9fdb..fd6d51e6201 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -99,7 +99,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_SPIKE, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 0464a1346ec..ef774ee2ef2 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -57,7 +57,7 @@ void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { this->ocarinaSong = 0; this->unk_158 = 1; } - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; if (this->actor.world.rot.z > 0) { this->interactRange = this->actor.world.rot.z * 40.0f; } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 4e133aea459..be5f73374f5 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -310,7 +310,7 @@ static EnOssanGetGirlAParamsFunc sShopItemReplaceFunc[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 93d6fb52061..656bc1adc35 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -140,14 +140,14 @@ void EnPoRelay_SetupRace(EnPoRelay* this) { Interface_SetTimer(0); this->hookshotSlotFull = INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE; this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); - this->actor.flags |= ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = EnPoRelay_Race; } void EnPoRelay_SetupEndRace(EnPoRelay* this) { this->actor.world.rot.y = this->actor.home.rot.y + 0xC000; - this->actor.flags &= ~ACTOR_FLAG_27; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actor.speed = 0.0f; this->actionFunc = EnPoRelay_EndRace; } diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index d82814bd590..8508c20477a 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -53,7 +53,7 @@ void EnPubox_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 = 1; + thisx->targetMode = TARGET_MODE_1; thisx->gravity = -2.0f; CollisionHeader_GetVirtual(&gBlockMediumCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index e5e09ce0fa8..eeefec109f2 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -142,7 +142,7 @@ void EnRd_Init(Actor* thisx, PlayState* play) { EnRd* this = (EnRd*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); this->upperBodyYRotation = this->headYRotation = 0; @@ -434,7 +434,7 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) { PLAYER_STATE1_19 | PLAYER_STATE1_21)) && !(player->stateFlags2 & PLAYER_STATE2_7) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; EnRd_SetupWalkToPlayer(this, play); } else if (this->actor.params > REDEAD_TYPE_DOES_NOT_MOURN_IF_WALKING) { if (this->actor.parent != NULL) { @@ -577,7 +577,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { if (!LINK_IS_ADULT) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0, 1.0f, 400.0f, 0.0f); } - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.flags |= ACTOR_FLAG_0; this->playerStunWaitTimer = 0xA; this->grabWaitTimer = 0xF; diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index f1e5c4d263f..b05b207e57a 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -10,7 +10,7 @@ #include "terminal.h" #include "assets/objects/object_reeba/object_reeba.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) void EnReeba_Init(Actor* thisx, PlayState* play); void EnReeba_Destroy(Actor* thisx, PlayState* play); @@ -113,7 +113,7 @@ void EnReeba_Init(Actor* thisx, PlayState* play) { s32 surfaceType; this->actor.naviEnemyId = NAVI_ENEMY_LEEVER; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->actor.gravity = -3.5f; this->actor.focus.pos = this->actor.world.pos; SkelAnime_Init(play, &this->skelanime, &object_reeba_Skel_001EE8, &object_reeba_Anim_0001E4, this->jointTable, @@ -192,7 +192,7 @@ void EnReeba_SetupSurface(EnReeba* this, PlayState* play) { this->waitTimer = 20; } - this->actor.flags &= ~ACTOR_FLAG_27; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actor.world.pos.y = this->actor.floorHeight; if (this->type != LEEVER_TYPE_SMALL) { @@ -341,7 +341,7 @@ void EnReeba_Bumped(EnReeba* this, PlayState* play) { void EnReeba_SetupSink(EnReeba* this, PlayState* play) { this->stunType = LEEVER_STUN_NONE; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actor.flags |= ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actionfunc = EnReeba_Sink; } @@ -393,7 +393,7 @@ void EnReeba_SetupStunned(EnReeba* this, PlayState* play) { this->waitTimer = 14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speed = -8.0f; - this->actor.flags |= ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actionfunc = EnReeba_Stunned; } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index c424d5124d9..0648480bf5a 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -156,7 +156,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_LIKE_LIKE, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 67922972f0e..511c9085263 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -523,7 +523,7 @@ void EnSa_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->alpha = 255; this->unk_21A = this->actor.shape.rot; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index fb61fbf8c90..432399b7b80 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -86,7 +86,7 @@ static DamageTable sDamageTable[] = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_SHELL_BLADE, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 19e3a67cf77..27dfbc317f4 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -278,7 +278,7 @@ static EnSkjActionFunc sActionFuncs[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -417,7 +417,7 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { } if ((type > 0) && (type < 3)) { - this->actor.targetMode = 7; + this->actor.targetMode = TARGET_MODE_7; this->posCopy = this->actor.world.pos; sOcarinaMinigameSkullKids[type - 1].unk_0 = 1; sOcarinaMinigameSkullKids[type - 1].skullkid = this; diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 58cb7ba249c..5ad09bdc098 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -48,7 +48,7 @@ static ColliderCylinderInitType1 sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 3e07652e54d..15b1639667a 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -131,7 +131,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { EnSth_SetupAction(this, EnSth_WaitForObject); this->actor.draw = NULL; this->unk_2B2 = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; } void EnSth_SetupShapeColliderUpdate2AndDraw(EnSth* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 5f9336d9180..3c1d7bcc41b 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -3,7 +3,7 @@ #include "overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h" #include "assets/objects/object_ossan/object_ossan.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) typedef enum { /* 0 */ SYATEKI_RESULT_NONE, @@ -156,7 +156,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { osSyncPrintf("\n\n"); // "Old man appeared!! Muhohohohohohohon" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 親父登場!!むほほほほほほほーん ☆☆☆☆☆ \n" VT_RST); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; Actor_SetScale(&this->actor, 0.01f); SkelAnime_InitFlex(play, &this->skelAnime, &gObjectOssanSkel, &gObjectOssanAnim_000338, this->jointTable, this->morphTable, 9); diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 2393a679ffb..36c9ccfa23a 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -59,7 +59,7 @@ static ColliderCylinderInit sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 1, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index a685942b663..d9a86be6e42 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -150,7 +150,7 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { this->blinkTimer = 20; this->blinkFunc = EnTa_BlinkWaitUntilNext; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.velocity.y = -4.0f; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 080a17f9c3f..1d7c1420b0a 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ts/object_ts.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_CANT_LOCK_ON) void EnTakaraMan_Init(Actor* thisx, PlayState* play); void EnTakaraMan_Destroy(Actor* thisx, PlayState* play); @@ -66,7 +66,7 @@ void EnTakaraMan_Init(Actor* thisx, PlayState* play) { this->originalRoomNum = thisx->room; thisx->room = -1; thisx->world.rot.y = thisx->shape.rot.y = -0x4E20; - thisx->targetMode = 1; + thisx->targetMode = TARGET_MODE_1; this->actionFunc = func_80B176E0; } diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index a492216214e..1595d829000 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -117,7 +117,7 @@ void EnTg_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); this->nextDialogue = play->state.frames % 2; this->actionFunc = EnTg_SpinIfNotTalking; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index b43c735d4ff..9f03f9880e3 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -177,7 +177,7 @@ void EnTite_Init(Actor* thisx, PlayState* play) { EnTite* this = (EnTite*)thisx; Actor_ProcessInitChain(thisx, sInitChain); - thisx->targetMode = 3; + thisx->targetMode = TARGET_MODE_3; Actor_SetScale(thisx, 0.01f); SkelAnime_Init(play, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, this->morphTable, 25); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index a73569f6220..b4f1e39fcd4 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -498,7 +498,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -0.1f; this->currentReward = -1; this->currentSpot = NULL; diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 0606474a8d2..112b3181be9 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -127,7 +127,7 @@ void EnToryo_Init(Actor* thisx, PlayState* play) { Animation_GetLastFrame(sEnToryoAnimation.animation), sEnToryoAnimation.mode, sEnToryoAnimation.morphFrames); this->stateFlags |= 8; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actionFunc = EnToryo_Idle; } diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index f6485bd903c..75c5473c78a 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -136,7 +136,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); this->unk_150 = 0; diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 7074d9b4b1c..24bf5533ddd 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -112,7 +112,7 @@ void EnTrap_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - thisx->targetMode = 3; + thisx->targetMode = TARGET_MODE_3; thisx->colChkInfo.mass = 0xFF; } diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 5ed6318c292..98faa215ef5 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -128,7 +128,7 @@ void EnWonderItem_Init(Actor* thisx, PlayState* play) { if (this->switchFlag == 0x3F) { this->switchFlag = -1; } - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index 4265eba80ad..79450769ac4 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -7,7 +7,7 @@ #include "z_en_wonder_talk.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON) void EnWonderTalk_Init(Actor* thisx, PlayState* play); void EnWonderTalk_Destroy(Actor* thisx, PlayState* play); @@ -45,7 +45,7 @@ void EnWonderTalk_Init(Actor* thisx, PlayState* play) { if (this->switchFlag == 0x3F) { this->switchFlag = -1; } - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; if (this->switchFlag >= 0) { if (Flags_GetSwitch(play, this->switchFlag)) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ You are Shock! ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag); diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index d0366ca20b8..abbfbcc7cbf 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -7,7 +7,7 @@ #include "z_en_wonder_talk2.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON) void EnWonderTalk2_Init(Actor* thisx, PlayState* play); void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play); @@ -31,7 +31,8 @@ ActorInit En_Wonder_Talk2_InitVars = { NULL, }; -static s16 D_80B3A8E0[] = { 6, 0, 1, 2, 3, 4, 5 }; +static s16 D_80B3A8E0[] = { TARGET_MODE_6, TARGET_MODE_0, TARGET_MODE_1, TARGET_MODE_2, + TARGET_MODE_3, TARGET_MODE_4, TARGET_MODE_5 }; void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play) { } @@ -91,7 +92,7 @@ void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { this->talkMode = 4; } if (this->talkMode == 3) { - this->actor.flags &= ~ACTOR_FLAG_27; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actionFunc = EnWonderTalk2_DoNothing; } else { this->actionFunc = func_80B3A10C; diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index e9503806824..d3b539d9a07 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -82,7 +82,7 @@ void EnYabusameMark_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ やぶさめまと ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); this->actor.flags &= ~ACTOR_FLAG_0; this->typeIndex = this->actor.params; - this->actor.targetMode = 5; + this->actor.targetMode = TARGET_MODE_5; osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 種類インデックス \t ☆☆☆☆☆ %d\n" VT_RST, this->typeIndex); switch (this->typeIndex) { case 0: diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 2e5651fbb7c..159c82417af 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -282,7 +282,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { f32 posDiff; Actor_ProcessInitChain(thisx, sInitChain); - thisx->targetMode = 3; + thisx->targetMode = TARGET_MODE_3; this->clearFlag = (thisx->params & 0xFF00) >> 8; /* Strip the top byte of params */ thisx->params &= 0xFF; @@ -532,7 +532,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl // Player not targeting this or another EnZf? s32 EnZf_CanAttack(PlayState* play, EnZf* this) { - Actor* targetedActor; + Actor* lockOnActor; Player* player = GET_PLAYER(play); if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss @@ -546,16 +546,16 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - targetedActor = player->unk_664; - if (targetedActor == NULL) { + lockOnActor = player->lockOnActor; + if (lockOnActor == NULL) { return false; } else { - if (targetedActor->category != ACTORCAT_ENEMY) { + if (lockOnActor->category != ACTORCAT_ENEMY) { return true; } - if (targetedActor->id != ACTOR_EN_ZF) { + if (lockOnActor->id != ACTOR_EN_ZF) { return false; - } else if (targetedActor->colorFilterTimer != 0) { + } else if (lockOnActor->colorFilterTimer != 0) { return true; } } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index a66c5e7b812..49d735b6ef4 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -85,7 +85,7 @@ void EnZl1_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; if (IS_CUTSCENE_LAYER) { frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 5d9e230a907..6ed9b495f02 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -367,7 +367,7 @@ void EnZl4_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.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.textId = -1; this->eyeExpression = this->mouthExpression = ZL4_MOUTH_NEUTRAL; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index dd29c0ad415..8b0b37a9dcc 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -589,7 +589,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_2); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->dialogRadius = this->collider.dim.radius + 30.0f; this->trackingMode = NPC_TRACKING_NONE; this->canSpeak = false; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 808078fde6c..48a800c0269 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -817,7 +817,7 @@ static FishingFishInit sFishInits[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; @@ -989,7 +989,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { if (thisx->params == EN_FISH_AQUARIUM) { this->fishState = 100; Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); - thisx->targetMode = 0; + thisx->targetMode = TARGET_MODE_0; thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } else { diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index d1abf702029..3bf2f76dc14 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -315,7 +315,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { this->dyna.actor.flags |= ACTOR_FLAG_0; - this->dyna.actor.targetMode = 4; + this->dyna.actor.targetMode = TARGET_MODE_4; } this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 5146c4637f4..025d6a7b399 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -7,7 +7,7 @@ #include "z_obj_timeblock.h" #include "assets/objects/object_timeblock/object_timeblock.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) void ObjTimeblock_Init(Actor* thisx, PlayState* play); void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); @@ -51,7 +51,7 @@ static ObjTimeblockSizeOptions sSizeOptions[] = { static f32 sRanges[] = { 60.0, 100.0, 140.0, 180.0, 220.0, 260.0, 300.0, 300.0 }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_STOP), diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index e2e2f48cfaa..c10ba32efad 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -8,7 +8,7 @@ #include "assets/objects/object_timeblock/object_timeblock.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) void ObjWarp2block_Init(Actor* thisx, PlayState* play2); void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index f176441b8ee..2ded0e245c5 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -71,7 +71,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_4; this->actor.flags |= ACTOR_FLAG_25; this->actionFunc = ShotSun_UpdateFairySpawner; - this->actor.flags |= ACTOR_FLAG_27; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; } else { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a7d9c45e6b5..8e000b1f082 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2269,7 +2269,7 @@ s32 func_80833B2C(Player* this) { } s32 func_80833B54(Player* this) { - if ((this->unk_664 != NULL) && CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + if ((this->lockOnActor != NULL) && CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags1 |= PLAYER_STATE1_4; return 1; } @@ -3036,14 +3036,14 @@ s32 func_808359FC(Player* this, PlayState* play) { } else if (LinkAnimation_OnFrame(&this->skelAnimeUpper, 6.0f)) { f32 posX = (Math_SinS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.x; f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; - s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; + s32 yaw = (this->lockOnActor != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, this->actor.focus.rot.x, yaw, 0, 0); this->boomerangActor = &boomerang->actor; if (boomerang != NULL) { - boomerang->moveTo = this->unk_664; + boomerang->moveTo = this->lockOnActor; boomerang->returnTimer = 20; this->stateFlags1 |= PLAYER_STATE1_25; if (!func_8008E9C4(this)) { @@ -3373,10 +3373,10 @@ void func_808368EC(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { - if ((this->unk_664 != NULL) && - ((play->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { + if ((this->lockOnActor != NULL) && + ((play->actorCtx.targetCtx.rotZTick != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); + Math_Vec3f_Yaw(&this->actor.world.pos, &this->lockOnActor->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && !(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); @@ -3433,7 +3433,7 @@ s32 func_80836AB8(Player* this, s32 arg1) { } void func_80836BEC(Player* this, PlayState* play) { - s32 sp1C = 0; + s32 ignoreLeash = false; s32 zTrigPressed = CHECK_BTN_ALL(sControlInput->cur.button, BTN_Z); Actor* actorToTarget; s32 pad; @@ -3460,7 +3460,7 @@ void func_80836BEC(Player* this, PlayState* play) { } if (this->unk_66C >= 6) { - sp1C = 1; + ignoreLeash = true; } cond = func_8083224C(play); @@ -3471,7 +3471,7 @@ void func_80836BEC(Player* this, PlayState* play) { CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; + actorToTarget = play->actorCtx.targetCtx.fairyActor; } else { actorToTarget = &GET_PLAYER(play)->actor; } @@ -3479,16 +3479,16 @@ void func_80836BEC(Player* this, PlayState* play) { holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); this->stateFlags1 |= PLAYER_STATE1_15; - if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { - if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { - actorToTarget = play->actorCtx.targetCtx.unk_94; + if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + if ((actorToTarget == this->lockOnActor) && (this->actor.category == ACTORCAT_PLAYER)) { + actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; } - if (actorToTarget != this->unk_664) { + if (actorToTarget != this->lockOnActor) { if (!holdTarget) { this->stateFlags2 |= PLAYER_STATE2_13; } - this->unk_664 = actorToTarget; + this->lockOnActor = actorToTarget; this->unk_66C = 15; this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); } else { @@ -3505,23 +3505,23 @@ void func_80836BEC(Player* this, PlayState* play) { } } - if (this->unk_664 != NULL) { - if ((this->actor.category == ACTORCAT_PLAYER) && (this->unk_664 != this->unk_684) && - func_8002F0C8(this->unk_664, this, sp1C)) { + if (this->lockOnActor != NULL) { + if ((this->actor.category == ACTORCAT_PLAYER) && (this->lockOnActor != this->unk_684) && + Target_OutsideLeashRange(this->lockOnActor, this, ignoreLeash)) { func_8008EDF0(this); this->stateFlags1 |= PLAYER_STATE1_30; - } else if (this->unk_664 != NULL) { - this->unk_664->targetPriority = 40; + } else if (this->lockOnActor != NULL) { + this->lockOnActor->targetPriority = 40; } } else if (this->unk_684 != NULL) { - this->unk_664 = this->unk_684; + this->lockOnActor = this->unk_684; } } - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { this->stateFlags1 &= ~(PLAYER_STATE1_16 | PLAYER_STATE1_17); if ((this->stateFlags1 & PLAYER_STATE1_11) || - !CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + !CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags1 |= PLAYER_STATE1_16; } } else { @@ -3641,9 +3641,9 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { *outYawTarget = this->actor.shape.rot.y; - if (this->unk_664 != NULL) { - if ((play->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { - *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); + if (this->lockOnActor != NULL) { + if ((play->actorCtx.targetCtx.rotZTick != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { + *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->lockOnActor->focus.pos); return false; } } else if (func_80833B2C(this)) { @@ -5098,7 +5098,7 @@ void func_8083A2F8(PlayState* play, Player* this) { if (this->actor.textId != 0) { Message_StartTextbox(play, this->actor.textId, this->targetActor); - this->unk_664 = this->targetActor; + this->lockOnActor = this->targetActor; } } @@ -5521,7 +5521,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { this->actionVar1 = -1; } targetActor->flags |= ACTOR_FLAG_8; - this->unk_664 = this->targetActor; + this->lockOnActor = this->targetActor; } else if (sp2C == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actionVar1 = 1; this->actor.textId = 0x4005; @@ -5600,7 +5600,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { s32 Player_ActionChange_4(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; - Actor* sp30 = this->unk_664; + Actor* sp30 = this->lockOnActor; Actor* sp2C = NULL; s32 sp28 = 0; s32 sp24; @@ -5689,8 +5689,8 @@ s32 Player_ActionChange_0(Player* this, PlayState* play) { return 1; } - if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18) || - (this->unk_664->naviEnemyId != NAVI_ENEMY_NONE))) { + if ((this->lockOnActor != NULL) && (CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18) || + (this->lockOnActor->naviEnemyId != NAVI_ENEMY_NONE))) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) && @@ -5883,7 +5883,7 @@ s32 Player_ActionChange_11(Player* this, PlayState* play) { if ((play->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R) && - (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { + (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->lockOnActor == NULL)))) { func_80832318(this); Player_DetachHeldActor(play, this); @@ -6434,7 +6434,7 @@ void func_8083D6EC(PlayState* play, Player* this) { } s32 func_8083DB98(Player* this, s32 arg1) { - Actor* unk_664 = this->unk_664; + Actor* lockOnActor = this->lockOnActor; Vec3f sp30; s16 sp2E; s16 sp2C; @@ -6442,8 +6442,8 @@ s32 func_8083DB98(Player* this, s32 arg1) { sp30.x = this->actor.world.pos.x; sp30.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; sp30.z = this->actor.world.pos.z; - sp2E = Math_Vec3f_Pitch(&sp30, &unk_664->focus.pos); - sp2C = Math_Vec3f_Yaw(&sp30, &unk_664->focus.pos); + sp2E = Math_Vec3f_Pitch(&sp30, &lockOnActor->focus.pos); + sp2C = Math_Vec3f_Yaw(&sp30, &lockOnActor->focus.pos); Math_SmoothStepToS(&this->actor.focus.rot.y, sp2C, 4, 10000, 0); Math_SmoothStepToS(&this->actor.focus.rot.x, sp2E, 4, 10000, 0); this->unk_6AE |= 2; @@ -6459,7 +6459,7 @@ void func_8083DC54(Player* this, PlayState* play) { f32 temp1; Vec3f sp34; - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { if (func_8002DD78(this) || func_808334B4(this)) { func_8083DB98(this, 1); } else { @@ -7220,7 +7220,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { f32 sp1C = (s16)(arg2 - this->actor.shape.rot.y); f32 temp; - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { func_8083DB98(this, func_8002DD78(this) || func_808334B4(this)); } @@ -7239,7 +7239,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { s16 sp2E = *arg2 - this->zTargetYaw; u16 sp2C = ABS(sp2E); - if ((func_8002DD78(this) || func_808334B4(this)) && (this->unk_664 == NULL)) { + if ((func_8002DD78(this) || func_808334B4(this)) && (this->lockOnActor == NULL)) { *arg1 *= Math_SinS(sp2C); if (*arg1 != 0.0f) { @@ -7248,14 +7248,14 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { *arg2 = this->actor.shape.rot.y; } - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { func_8083DB98(this, 1); } else { Math_SmoothStepToS(&this->actor.focus.rot.x, sControlInput->rel.stick_y * 240.0f, 14, 4000, 30); func_80836AB8(this, 1); } } else { - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { return func_8083FC68(this, *arg1, *arg2); } else { func_8083DC54(this, play); @@ -7524,7 +7524,7 @@ void func_808409CC(PlayState* play, Player* this) { s32 sp38; s32 sp34; - if ((this->unk_664 != NULL) || + if ((this->lockOnActor != NULL) || (!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { this->stateFlags2 &= ~PLAYER_STATE2_28; anim = func_80833338(this); @@ -10172,7 +10172,7 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemAction >= PLAYER_IA_SWORD_MASTER) || ((this->stateFlags2 & PLAYER_STATE2_20) && - (play->actorCtx.targetCtx.arrowPointedActor == NULL))) { + (play->actorCtx.targetCtx.fairyActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } } @@ -10189,7 +10189,7 @@ void func_808473D4(PlayState* play, Player* this) { Interface_SetDoAction(play, doAction); if (this->stateFlags2 & PLAYER_STATE2_21) { - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { Interface_SetNaviCall(play, 0x1E); } else { Interface_SetNaviCall(play, 0x1D); @@ -10542,7 +10542,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { u8 seqMode; s32 pad; - Actor* unk_664; + Actor* lockOnActor; s32 camMode; if (this->actor.category == ACTORCAT_PLAYER) { @@ -10558,7 +10558,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { camMode = CAM_MODE_PUSH_PULL; - } else if ((unk_664 = this->unk_664) != NULL) { + } else if ((lockOnActor = this->lockOnActor) != NULL) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8)) { camMode = CAM_MODE_TALK; } else if (this->stateFlags1 & PLAYER_STATE1_16) { @@ -10570,7 +10570,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else { camMode = CAM_MODE_Z_TARGET_UNFRIENDLY; } - Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, unk_664); + Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, lockOnActor); } else if (this->stateFlags1 & PLAYER_STATE1_12) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags1 & PLAYER_STATE1_25) { @@ -11077,7 +11077,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8083D6EC(play, this); - if ((this->unk_664 == NULL) && (this->naviTextId == 0)) { + if ((this->lockOnActor == NULL) && (this->naviTextId == 0)) { this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); } @@ -11596,7 +11596,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { } if ((this->csAction != PLAYER_CSACTION_NONE) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || - func_80833B54(this) || (this->unk_664 != NULL) || !func_8083AD4C(play, this) || + func_80833B54(this) || (this->lockOnActor != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && @@ -11699,7 +11699,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } } - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -12454,7 +12454,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; this->unk_6BE = CLAMP(this->unk_6BE, -0x4AAA, 0x4AAA); @@ -13281,7 +13281,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) { func_80832924(this, D_80854A3C); } - if ((this->actionVar1 == 0) && (this->unk_664 != NULL)) { + if ((this->actionVar1 == 0) && (this->lockOnActor != NULL)) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -14324,9 +14324,9 @@ void func_80851314(Player* this) { this->unk_448 = NULL; } - this->unk_664 = this->unk_448; + this->lockOnActor = this->unk_448; - if (this->unk_664 != NULL) { + if (this->lockOnActor != NULL) { this->actor.shape.rot.y = func_8083DB98(this, 0); } } From db98ae9fee6b7e4a62dcbc11cc9f94eb132cfc10 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 10:42:24 +1100 Subject: [PATCH 02/13] more cleanup --- include/z64actor.h | 18 +++---- src/code/z_actor.c | 52 +++++++++---------- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 26 +++++----- .../actors/ovl_En_Encount1/z_en_encount1.c | 2 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.c | 2 +- .../actors/ovl_En_Kakasi2/z_en_kakasi2.c | 6 +-- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 2 +- .../actors/ovl_En_Po_Relay/z_en_po_relay.c | 4 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 2 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 8 +-- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 2 +- .../ovl_En_Takara_Man/z_en_takara_man.c | 2 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 8 +-- .../actors/ovl_En_Torch2/z_en_torch2.c | 8 +-- .../ovl_En_Wonder_Talk/z_en_wonder_talk.c | 2 +- .../ovl_En_Wonder_Talk2/z_en_wonder_talk2.c | 4 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 2 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 2 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- .../actors/ovl_player_actor/z_player.c | 2 +- tools/namefixer.py | 2 +- 27 files changed, 84 insertions(+), 86 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 225ee983c1d..f7b8cb6a12e 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -166,8 +166,7 @@ typedef struct { #define ACTOR_FLAG_24 (1 << 24) #define ACTOR_FLAG_25 (1 << 25) #define ACTOR_FLAG_26 (1 << 26) -// Prevents locking on with Z targeting an actor even if Navi is floating over it -#define ACTOR_FLAG_CANT_LOCK_ON (1 << 27) +#define ACTOR_FLAG_27 (1 << 27) #define ACTOR_FLAG_28 (1 << 28) #define COLORFILTER_GET_COLORINTENSITY(colorFilterParams) (((colorFilterParams) & 0x1F00) >> 5) @@ -231,7 +230,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 @@ -513,17 +512,18 @@ typedef enum { /* 0xFF */ NAVI_ENEMY_NONE = 0xFF } NaviEnemy; +// A set of 4 triangles which appear around an actor when the player Z-Targets it typedef struct { /* 0x00 */ Vec3f pos; - /* 0x0C */ f32 radius; + /* 0x0C */ f32 radius; // distance towards the center of the locked on /* 0x10 */ Color_RGB8 color; } LockOnTriangleSet; // size = 0x14 typedef struct { - /* 0x00 */ Vec3f naviRefPos; // possibly wrong + /* 0x00 */ Vec3f fairyPos; // Used by Navi to indicate a targetable actor or general hint /* 0x0C */ Vec3f lockOnPos; - /* 0x18 */ Color_RGBAf naviInner; - /* 0x28 */ Color_RGBAf naviOuter; + /* 0x18 */ Color_RGBAf fairyInnerColor; + /* 0x28 */ Color_RGBAf fairyOuterColor; /* 0x38 */ Actor* fairyActor; /* 0x3C */ Actor* lockOnActor; /* 0x40 */ f32 fairyMoveProgressFactor; // Controls Navi so she can smootly transition to the target actor @@ -533,12 +533,12 @@ typedef struct { /* 0x4B */ u8 rotZTick; /* 0x4C */ s8 lockOnIndex; /* 0x50 */ LockOnTriangleSet lockOnTriangleSets[3]; - /* 0x8C */ Actor* forcedTargetActor; + /* 0x8C */ Actor* forcedTargetActor; // Never set to non-NULL /* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY /* 0x94 */ Actor* arrowPointedActor; } TargetContext; // size = 0x98 -typedef enum TargetMode { +typedef enum { /* 0 */ TARGET_MODE_0, /* 1 */ TARGET_MODE_1, /* 2 */ TARGET_MODE_2, diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 0517c1ecdb0..733244a2206 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -276,18 +276,18 @@ void Target_InitLockOn(TargetContext* targetCtx, s32 actorCategory, PlayState* p } void Target_SetFairyState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { - targetCtx->naviRefPos.x = actor->focus.pos.x; - targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); - targetCtx->naviRefPos.z = actor->focus.pos.z; + targetCtx->fairyPos.x = actor->focus.pos.x; + targetCtx->fairyPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); + targetCtx->fairyPos.z = actor->focus.pos.z; - targetCtx->naviInner.r = sNaviColorList[actorCategory].inner.r; - targetCtx->naviInner.g = sNaviColorList[actorCategory].inner.g; - targetCtx->naviInner.b = sNaviColorList[actorCategory].inner.b; - targetCtx->naviInner.a = sNaviColorList[actorCategory].inner.a; - targetCtx->naviOuter.r = sNaviColorList[actorCategory].outer.r; - targetCtx->naviOuter.g = sNaviColorList[actorCategory].outer.g; - targetCtx->naviOuter.b = sNaviColorList[actorCategory].outer.b; - targetCtx->naviOuter.a = sNaviColorList[actorCategory].outer.a; + targetCtx->fairyInnerColor.r = sNaviColorList[actorCategory].inner.r; + targetCtx->fairyInnerColor.g = sNaviColorList[actorCategory].inner.g; + targetCtx->fairyInnerColor.b = sNaviColorList[actorCategory].inner.b; + targetCtx->fairyInnerColor.a = sNaviColorList[actorCategory].inner.a; + targetCtx->fairyOuterColor.r = sNaviColorList[actorCategory].outer.r; + targetCtx->fairyOuterColor.g = sNaviColorList[actorCategory].outer.g; + targetCtx->fairyOuterColor.b = sNaviColorList[actorCategory].outer.b; + targetCtx->fairyOuterColor.a = sNaviColorList[actorCategory].outer.a; } void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { @@ -404,7 +404,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { } actor = targetCtx->arrowPointedActor; - if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) { NaviColor* color = &sNaviColorList[actor->category]; POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_7); @@ -474,13 +474,13 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, if (!Math_StepToF(&targetCtx->fairyMoveProgressFactor, 0.0f, 0.25f)) { fairyMoveScale = 0.25f / targetCtx->fairyMoveProgressFactor; - velocityX = actor->world.pos.x - targetCtx->naviRefPos.x; - velocityY = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->naviRefPos.y; - velocityZ = actor->world.pos.z - targetCtx->naviRefPos.z; + velocityX = actor->world.pos.x - targetCtx->fairyPos.x; + velocityY = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->fairyPos.y; + velocityZ = actor->world.pos.z - targetCtx->fairyPos.z; - targetCtx->naviRefPos.x += velocityX * fairyMoveScale; - targetCtx->naviRefPos.y += velocityY * fairyMoveScale; - targetCtx->naviRefPos.z += velocityZ * fairyMoveScale; + targetCtx->fairyPos.x += velocityX * fairyMoveScale; + targetCtx->fairyPos.y += velocityY * fairyMoveScale; + targetCtx->fairyPos.z += velocityZ * fairyMoveScale; } else { Target_SetFairyState(targetCtx, actor, actorCategory, play); } @@ -1496,7 +1496,7 @@ f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) { yawDiff = ABS((s16)((s16)(actor->yawTowardsPlayer - 0x8000) - playerShapeYaw)); if (player->lockOnActor != NULL) { - if ((yawDiff > 0x4000) || (actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + if ((yawDiff > 0x4000) || (actor->flags & ACTOR_FLAG_27)) { return FLT_MAX; } @@ -1584,7 +1584,7 @@ s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchang Player* player = GET_PLAYER(play); if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) || - (!actor->isTargeted && + (!actor->isLockedOn && ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || (arg2 < actor->xzDistToPlayer)))) { return false; @@ -2223,9 +2223,9 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) { if (actor == player->lockOnActor) { - actor->isTargeted = true; + actor->isLockedOn = true; } else { - actor->isTargeted = false; + actor->isLockedOn = false; } if ((actor->targetPriority != 0) && (player->lockOnActor == NULL)) { @@ -3081,7 +3081,7 @@ s16 sTargetPlayerRotY; * - Must not be blocked by a surface * * This function also checks for the nearest enemy actor, which allows determining if enemy background music should be - * played. This actor is stored in `targetContext.bgmEnemy` and its distance is stored in `sBgmEnemyDistSq` + * played. This actor is stored in `targetCtx.bgmEnemy` and its distance is stored in `sBgmEnemyDistSq` * * 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 on this one. @@ -3613,7 +3613,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isLockedOn) { return true; } else { return false; @@ -3626,7 +3626,7 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor) { s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isLockedOn) { return true; } else { return false; @@ -5765,7 +5765,7 @@ s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3) { return false; } - if ((actor->xyzDistToPlayerSq > SQ(160.0f)) && !actor->isTargeted) { + if ((actor->xyzDistToPlayerSq > SQ(160.0f)) && !actor->isLockedOn) { return false; } diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index 59cdf82f615..ff15eef38fa 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -141,7 +141,7 @@ void func_808BC8B8(BgTreemouth* this, PlayState* play) { if (Flags_GetEventChkInf(EVENTCHKINF_0C)) { if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 1658.0f, 0x7530)) { this->dyna.actor.flags |= ACTOR_FLAG_0; - if (this->dyna.actor.isTargeted) { + if (this->dyna.actor.isLockedOn) { this->dyna.actor.flags &= ~ACTOR_FLAG_0; play->csCtx.script = D_808BD2A0; gSaveContext.cutsceneTrigger = 1; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 388d4eb9ffc..25fc9a98034 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -4,7 +4,7 @@ #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" #include "assets/objects/object_bg/object_bg.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) typedef enum { /* 0 */ CHU_GIRL_EYES_ASLEEP, diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index b5721da9106..4b5a0acc89b 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -344,7 +344,7 @@ void EnDns_Idle(EnDns* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, play)) { this->actionFunc = EnDns_Talk; } else { - if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { + if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isLockedOn) { this->actor.flags |= ACTOR_FLAG_16; } else { this->actor.flags &= ~ACTOR_FLAG_16; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 4048aeb7db8..5ba367e4140 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -205,7 +205,7 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { doorType = DOOR_SCENEEXIT; } else { this->actionFunc = EnDoor_WaitForCheck; - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27; } } // Replace the door type it was loaded with by the new type diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 654de2f05d0..231a334139a 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -935,7 +935,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { break; default: func_80A029A8(this, 1); - nextPos = play->actorCtx.targetCtx.naviRefPos; + nextPos = play->actorCtx.targetCtx.fairyPos; nextPos.y += (1500.0f * this->actor.scale.y); fairyActor = play->actorCtx.targetCtx.fairyActor; @@ -1016,18 +1016,18 @@ void func_80A04414(EnElf* this, PlayState* play) { } else { if (this->unk_2C6 == 0) { if ((fairyActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviRefPos) < 50.0f)) { + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.fairyPos) < 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.naviInner; - this->outerColor = play->actorCtx.targetCtx.naviOuter; + this->innerColor = play->actorCtx.targetCtx.fairyInnerColor; + this->outerColor = play->actorCtx.targetCtx.fairyOuterColor; } else { transitionRate = 0.25f / this->unk_29C; - EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.naviInner, &this->innerColor, + EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.fairyInnerColor, &this->innerColor, transitionRate); - EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.naviOuter, &this->outerColor, + EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.fairyOuterColor, &this->outerColor, transitionRate); } } @@ -1219,21 +1219,19 @@ void func_80A04D90(EnElf* this, PlayState* play) { void func_80A04DE4(EnElf* this, PlayState* play) { Vec3f headCopy; Player* player = GET_PLAYER(play); - Vec3f naviRefPos; + Vec3f fairyPos; if (this->fairyFlags & 0x10) { - naviRefPos = play->actorCtx.targetCtx.naviRefPos; + fairyPos = play->actorCtx.targetCtx.fairyPos; if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || (&this->actor == player->lockOnActor)) { - naviRefPos.x = - player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); - naviRefPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; - naviRefPos.z = - player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); + fairyPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); + fairyPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; + fairyPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); } - this->actor.focus.pos = naviRefPos; + this->actor.focus.pos = fairyPos; this->fairyFlags &= ~0x10; } diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index f6c9ca63331..05f22fca8e2 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -2,7 +2,7 @@ #include "terminal.h" #include "overlays/actors/ovl_En_Tite/z_en_tite.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_27) void EnEncount1_Init(Actor* thisx, PlayState* play); void EnEncount1_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index df626bd9044..22a991f44f8 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -323,7 +323,7 @@ void EnHintnuts_BeginFreeze(EnHintnuts* this, PlayState* play) { void EnHintnuts_CheckProximity(EnHintnuts* this, PlayState* play) { if (this->actor.category != ACTORCAT_ENEMY) { - if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) { + if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isLockedOn) { this->actor.flags |= ACTOR_FLAG_16; } else { this->actor.flags &= ~ACTOR_FLAG_16; diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 72edb1a6c47..daf3ed86bf3 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_27) static ColliderCylinderInit sCylinderInit = { { @@ -124,7 +124,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); OnePointCutscene_Attention(play, &this->actor); - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); if (this->switchFlag >= 0) { @@ -151,7 +151,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { OnePointCutscene_Attention(play, &this->actor); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); - this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_27; this->actionFunc = func_80A904D8; } } diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index e5c40593db8..3824e0480ca 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -1250,7 +1250,7 @@ void func_80A995CC(EnKo* this, PlayState* play) { this->actor.world.pos.z += 80.0f * Math_CosS(homeYawToPlayer); this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || !this->actor.isTargeted) { + if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || !this->actor.isLockedOn) { temp_f2 = fabsf((f32)this->actor.yawTowardsPlayer - homeYawToPlayer) * 0.001f * 3.0f; if (temp_f2 < 1.0f) { this->skelAnime.playSpeed = 1.0f; diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 656bc1adc35..93d6fb52061 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -140,14 +140,14 @@ void EnPoRelay_SetupRace(EnPoRelay* this) { Interface_SetTimer(0); this->hookshotSlotFull = INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE; this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec); - this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_27; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = EnPoRelay_Race; } void EnPoRelay_SetupEndRace(EnPoRelay* this) { this->actor.world.rot.y = this->actor.home.rot.y + 0xC000; - this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags &= ~ACTOR_FLAG_27; this->actor.speed = 0.0f; this->actionFunc = EnPoRelay_EndRace; } diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 7f2975ffa59..eb1e3b216cd 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1108,7 +1108,7 @@ void func_80ADBF58(EnPoSisters* this, PlayState* play) { } void func_80ADC034(EnPoSisters* this, PlayState* play) { - if (this->actor.isTargeted && this->unk_22E.a == 255) { + if (this->actor.isLockedOn && this->unk_22E.a == 255) { if (this->unk_197 != 0) { this->unk_197--; } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index d07b2cb3553..dfd0973a482 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -883,7 +883,7 @@ void EnPoh_UpdateVisibility(EnPoh* this) { this->visibilityTimer--; } if (this->lightColor.a == 255) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { this->unk_194++; this->unk_194 = CLAMP_MAX(this->unk_194, 20); } else { diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index b05b207e57a..2ec440f24aa 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -10,7 +10,7 @@ #include "terminal.h" #include "assets/objects/object_reeba/object_reeba.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_27) void EnReeba_Init(Actor* thisx, PlayState* play); void EnReeba_Destroy(Actor* thisx, PlayState* play); @@ -192,7 +192,7 @@ void EnReeba_SetupSurface(EnReeba* this, PlayState* play) { this->waitTimer = 20; } - this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags &= ~ACTOR_FLAG_27; this->actor.world.pos.y = this->actor.floorHeight; if (this->type != LEEVER_TYPE_SMALL) { @@ -341,7 +341,7 @@ void EnReeba_Bumped(EnReeba* this, PlayState* play) { void EnReeba_SetupSink(EnReeba* this, PlayState* play) { this->stunType = LEEVER_STUN_NONE; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_27; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actionfunc = EnReeba_Sink; } @@ -393,7 +393,7 @@ void EnReeba_SetupStunned(EnReeba* this, PlayState* play) { this->waitTimer = 14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speed = -8.0f; - this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_27; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); this->actionfunc = EnReeba_Stunned; } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 3c1d7bcc41b..9ac72bb6610 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -3,7 +3,7 @@ #include "overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h" #include "assets/objects/object_ossan/object_ossan.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_27) typedef enum { /* 0 */ SYATEKI_RESULT_NONE, diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 1d7c1420b0a..39772187c8f 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ts/object_ts.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_27) void EnTakaraMan_Init(Actor* thisx, PlayState* play); void EnTakaraMan_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index 4717547c864..411e375d3f5 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -405,7 +405,7 @@ void EnTest_ChooseAction(EnTest* this, PlayState* play) { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { if (player->stateFlags1 & PLAYER_STATE1_4) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { EnTest_SetupSlashDown(this); } else { func_808627C4(this, play); @@ -664,7 +664,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { return; } } else if (player->heldItemAction != PLAYER_IA_NONE) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { if ((play->gameplayFrames % 2) != 0) { func_808627C4(this, play); return; @@ -690,7 +690,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { if (player->stateFlags1 & PLAYER_STATE1_4) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { EnTest_SetupSlashDown(this); } else { func_808627C4(this, play); @@ -975,7 +975,7 @@ void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); } else if (player->stateFlags1 & PLAYER_STATE1_4) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { EnTest_SetupSlashDown(this); } else if ((play->gameplayFrames % 2) != 0) { func_808627C4(this, play); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 0bee2bad484..56f0d2ff234 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -413,7 +413,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sp50 = 0.0f; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && - (this->actor.isTargeted || !(player->stateFlags1 & PLAYER_STATE1_22))) { + (this->actor.isLockedOn || !(player->stateFlags1 & PLAYER_STATE1_22))) { EnTorch2_SwingSword(play, input, this); } else if (((this->actor.xzDistToPlayer <= 70.0f) || ((this->actor.xzDistToPlayer <= 80.0f + sp50) && @@ -426,7 +426,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } else if (this->actor.xzDistToPlayer <= 50 + sp50) { sStickTilt = 127.0f; sStickAngle = this->actor.yawTowardsPlayer; - if (!this->actor.isTargeted) { + if (!this->actor.isLockedOn) { Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); } } else if (this->actor.xzDistToPlayer > 100.0f + sp50) { @@ -436,7 +436,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { (this->actor.xzDistToPlayer >= 280.0f)) { sStickTilt = 127.0f; sStickAngle = this->actor.yawTowardsPlayer; - if (!this->actor.isTargeted) { + if (!this->actor.isLockedOn) { Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); } } else { @@ -446,7 +446,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { !EnTorch2_SwingSword(play, input, this)) { sStickAngle = this->actor.yawTowardsPlayer; sStickTilt = 127.0f; - if (!this->actor.isTargeted) { + if (!this->actor.isLockedOn) { Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); } } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index 79450769ac4..e1a219a4965 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -7,7 +7,7 @@ #include "z_en_wonder_talk.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) void EnWonderTalk_Init(Actor* thisx, PlayState* play); void EnWonderTalk_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index abbfbcc7cbf..488df3becbf 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -7,7 +7,7 @@ #include "z_en_wonder_talk2.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_27) void EnWonderTalk2_Init(Actor* thisx, PlayState* play); void EnWonderTalk2_Destroy(Actor* thisx, PlayState* play); @@ -92,7 +92,7 @@ void EnWonderTalk2_Init(Actor* thisx, PlayState* play) { this->talkMode = 4; } if (this->talkMode == 3) { - this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags &= ~ACTOR_FLAG_27; this->actionFunc = EnWonderTalk2_DoNothing; } else { this->actionFunc = func_80B3A10C; diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 159c82417af..e61d99ed459 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -1217,7 +1217,7 @@ void EnZf_Slash(EnZf* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B483E4(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { EnZf_SetupSlash(this); } else { func_80B483E4(this, play); diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 025d6a7b399..33ea2db82a8 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -7,7 +7,7 @@ #include "z_obj_timeblock.h" #include "assets/objects/object_timeblock/object_timeblock.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) void ObjTimeblock_Init(Actor* thisx, PlayState* play); void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index c10ba32efad..e2e2f48cfaa 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -8,7 +8,7 @@ #include "assets/objects/object_timeblock/object_timeblock.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27) void ObjWarp2block_Init(Actor* thisx, PlayState* play2); void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 2ded0e245c5..f176441b8ee 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -71,7 +71,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_4; this->actor.flags |= ACTOR_FLAG_25; this->actionFunc = ShotSun_UpdateFairySpawner; - this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags |= ACTOR_FLAG_27; } else { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 8e000b1f082..443ae8d4449 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3479,7 +3479,7 @@ void func_80836BEC(Player* this, PlayState* play) { holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); this->stateFlags1 |= PLAYER_STATE1_15; - if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_CANT_LOCK_ON)) { + if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { if ((actorToTarget == this->lockOnActor) && (this->actor.category == ACTORCAT_PLAYER)) { actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; } diff --git a/tools/namefixer.py b/tools/namefixer.py index 150d094c44e..2d6ba345d10 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -199,7 +199,7 @@ "shape.unk_14":"shape.shadowAlpha", "actor.unk_CC":"actor.shape.feetPos", "actor.pos4":"actor.prevPos", - "actor.unk_10C":"actor.isTargeted", + "actor.unk_10C":"actor.isLockedOn", "actor.unk_10D":"actor.targetPriority", "actor.dmgEffectTimer":"actor.colorFilterTimer", "actor.dmgEffectParams":"actor.colorFilterParams", From b91cc932e31496549e64c08929a293a2ed69a3f6 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 10:46:11 +1100 Subject: [PATCH 03/13] small fix --- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 231a334139a..e5b98940f29 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -838,7 +838,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; Player* player = GET_PLAYER(play); - Actor* fairyActor; + Actor* targetFairyActor; f32 xScale; f32 distFromPlayerHat; @@ -937,9 +937,9 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A029A8(this, 1); nextPos = play->actorCtx.targetCtx.fairyPos; nextPos.y += (1500.0f * this->actor.scale.y); - fairyActor = play->actorCtx.targetCtx.fairyActor; + targetFairyActor = play->actorCtx.targetCtx.fairyActor; - if (fairyActor != NULL) { + if (targetFairyActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speed >= 5.0f) { @@ -1000,7 +1000,7 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu } void func_80A04414(EnElf* this, PlayState* play) { - Actor* fairyActor = play->actorCtx.targetCtx.fairyActor; + Actor* targetFairyActor = play->actorCtx.targetCtx.fairyActor; Player* player = GET_PLAYER(play); f32 transitionRate; u16 sfxId; @@ -1015,7 +1015,7 @@ void func_80A04414(EnElf* this, PlayState* play) { } else { if (this->unk_2C6 == 0) { - if ((fairyActor == NULL) || + if ((targetFairyActor == NULL) || (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.fairyPos) < 50.0f)) { this->unk_2C6 = 1; } @@ -1034,15 +1034,15 @@ void func_80A04414(EnElf* this, PlayState* play) { } if (this->fairyFlags & 1) { - if ((fairyActor == NULL) || (player->lockOnActor == NULL)) { + if ((targetFairyActor == NULL) || (player->lockOnActor == NULL)) { this->fairyFlags ^= 1; } } else { - if ((fairyActor != NULL) && (player->lockOnActor != NULL)) { - if (fairyActor->category == ACTORCAT_NPC) { + if ((targetFairyActor != NULL) && (player->lockOnActor != NULL)) { + if (targetFairyActor->category == ACTORCAT_NPC) { sfxId = NA_SE_VO_NAVY_HELLO; } else { - sfxId = (fairyActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; + sfxId = (targetFairyActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; } if (this->unk_2C7 == 0) { @@ -1056,7 +1056,7 @@ void func_80A04414(EnElf* this, PlayState* play) { void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; - Actor* fairyActor; + Actor* targetFairyActor; Player* player = GET_PLAYER(play); if (play->csCtx.state != CS_STATE_IDLE) { @@ -1081,7 +1081,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } } else { - fairyActor = play->actorCtx.targetCtx.fairyActor; + targetFairyActor = play->actorCtx.targetCtx.fairyActor; // `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 @@ -1092,8 +1092,8 @@ void func_80A0461C(EnElf* this, PlayState* play) { ((R_SCENE_CAM_TYPE & 0x10) && Play_CheckViewpoint(play, VIEWPOINT_PIVOT))) { temp = 12; this->unk_2C0 = 100; - } else if (fairyActor == NULL || fairyActor->category == ACTORCAT_NPC) { - if (fairyActor != NULL) { + } else if ((targetFairyActor == NULL) || (targetFairyActor->category == ACTORCAT_NPC)) { + if (targetFairyActor != NULL) { this->unk_2C0 = 100; player->stateFlags2 |= PLAYER_STATE2_20; temp = 0; From 5e0c9bd479c4ce64c1877c16a899e0c6506d42f6 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 11:57:10 +1100 Subject: [PATCH 04/13] seperate extra navi color --- src/code/z_actor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 733244a2206..f05f50baa5f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -225,8 +225,7 @@ typedef struct { /* 0x4 */ Color_RGBA8 outer; } NaviColor; // size = 0x8 -// Has an unnecessary extra entry -NaviColor sNaviColorList[ACTORCAT_MAX + 1] = { +NaviColor sNaviColorList[ACTORCAT_MAX] = { { { 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 @@ -239,9 +238,10 @@ NaviColor sNaviColorList[ACTORCAT_MAX + 1] = { { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, // ACTORCAT_BOSS { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_DOOR { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_CHEST - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // }; +NaviColor sNaviColorUnused = { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }; + // unused Gfx D_80115FF0[] = { gsSPEndDisplayList(), From 0dc9357ea61c7cf889755ff4b9271cb5d12e5ba5 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 12:05:02 +1100 Subject: [PATCH 05/13] rm comment --- src/code/z_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index c6af0bb9225..b8d37dccb36 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3257,7 +3257,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); // Draw Z-Target + Target_Draw(&play->actorCtx.targetCtx, play); } Gfx_SetupDL_39Overlay(play->state.gfxCtx); From 77138d06f14c9abfdc847c8ea1e5b5705af22e37 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 2 Oct 2023 12:12:39 +1100 Subject: [PATCH 06/13] remove unused var --- src/code/z_actor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f05f50baa5f..a0c7340ee12 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -434,7 +434,6 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, f32 velocityY; f32 velocityZ; f32 lockOnStep; - f32 temp6; s32 lockOnSfxId; actor = NULL; From 28d8885ad14b060b3c703e1be55e325be1cfcc19 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 3 Oct 2023 10:14:45 +1100 Subject: [PATCH 07/13] PR Review --- include/z64actor.h | 16 +-- src/code/z_actor.c | 105 +++++++++--------- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 52 ++++----- .../actors/ovl_player_actor/z_player.c | 4 +- 4 files changed, 89 insertions(+), 88 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index f7b8cb6a12e..27f89cf644e 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -517,22 +517,22 @@ typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ f32 radius; // distance towards the center of the locked on /* 0x10 */ Color_RGB8 color; -} LockOnTriangleSet; // size = 0x14 +} LockOnReticle; // size = 0x14 typedef struct { - /* 0x00 */ Vec3f fairyPos; // Used by Navi to indicate a targetable actor or general hint + /* 0x00 */ Vec3f naviPos; // Used by Navi to indicate a targetable actor or general hint /* 0x0C */ Vec3f lockOnPos; - /* 0x18 */ Color_RGBAf fairyInnerColor; - /* 0x28 */ Color_RGBAf fairyOuterColor; - /* 0x38 */ Actor* fairyActor; + /* 0x18 */ Color_RGBAf naviInnerColor; + /* 0x28 */ Color_RGBAf naviOuterColor; + /* 0x38 */ Actor* naviActor; // The actor that Navi hovers over /* 0x3C */ Actor* lockOnActor; - /* 0x40 */ f32 fairyMoveProgressFactor; // Controls Navi so she can smootly transition to the target actor + /* 0x40 */ f32 naviMoveProgressFactor; // Controls Navi so she can smootly transition to the target actor /* 0x44 */ f32 lockOnRadius; // Control the circle lock-on triangles coming in from offscreen when you first target /* 0x48 */ s16 lockOnAlpha; - /* 0x4A */ u8 fairyActorCategory; + /* 0x4A */ u8 naviActorCategory; /* 0x4B */ u8 rotZTick; /* 0x4C */ s8 lockOnIndex; - /* 0x50 */ LockOnTriangleSet lockOnTriangleSets[3]; + /* 0x50 */ LockOnReticle lockOnReticles[3]; /* 0x8C */ Actor* forcedTargetActor; // Never set to non-NULL /* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY /* 0x94 */ Actor* arrowPointedActor; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a0c7340ee12..bc0f882620a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -248,14 +248,14 @@ Gfx D_80115FF0[] = { }; void Target_SetLockOnPos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { - targetCtx->lockOnTriangleSets[index].pos.x = x; - targetCtx->lockOnTriangleSets[index].pos.y = y; - targetCtx->lockOnTriangleSets[index].pos.z = z; - targetCtx->lockOnTriangleSets[index].radius = targetCtx->lockOnRadius; + targetCtx->lockOnReticles[index].pos.x = x; + targetCtx->lockOnReticles[index].pos.y = y; + targetCtx->lockOnReticles[index].pos.z = z; + targetCtx->lockOnReticles[index].radius = targetCtx->lockOnRadius; } void Target_InitLockOn(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { - LockOnTriangleSet* triangleSet; + LockOnReticle* reticle; NaviColor* naviColorEntry; s32 i; @@ -265,40 +265,40 @@ void Target_InitLockOn(TargetContext* targetCtx, s32 actorCategory, PlayState* p naviColorEntry = &sNaviColorList[actorCategory]; - triangleSet = &targetCtx->lockOnTriangleSets[0]; - for (i = 0; i < ARRAY_COUNT(targetCtx->lockOnTriangleSets); i++, triangleSet++) { + reticle = &targetCtx->lockOnReticles[0]; + for (i = 0; i < ARRAY_COUNT(targetCtx->lockOnReticles); i++, reticle++) { Target_SetLockOnPos(targetCtx, i, 0.0f, 0.0f, 0.0f); - triangleSet->color.r = naviColorEntry->inner.r; - triangleSet->color.g = naviColorEntry->inner.g; - triangleSet->color.b = naviColorEntry->inner.b; + reticle->color.r = naviColorEntry->inner.r; + reticle->color.g = naviColorEntry->inner.g; + reticle->color.b = naviColorEntry->inner.b; } } -void Target_SetFairyState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { - targetCtx->fairyPos.x = actor->focus.pos.x; - targetCtx->fairyPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); - targetCtx->fairyPos.z = actor->focus.pos.z; +void Target_SetNaviState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { + targetCtx->naviPos.x = actor->focus.pos.x; + targetCtx->naviPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); + targetCtx->naviPos.z = actor->focus.pos.z; - targetCtx->fairyInnerColor.r = sNaviColorList[actorCategory].inner.r; - targetCtx->fairyInnerColor.g = sNaviColorList[actorCategory].inner.g; - targetCtx->fairyInnerColor.b = sNaviColorList[actorCategory].inner.b; - targetCtx->fairyInnerColor.a = sNaviColorList[actorCategory].inner.a; - targetCtx->fairyOuterColor.r = sNaviColorList[actorCategory].outer.r; - targetCtx->fairyOuterColor.g = sNaviColorList[actorCategory].outer.g; - targetCtx->fairyOuterColor.b = sNaviColorList[actorCategory].outer.b; - targetCtx->fairyOuterColor.a = sNaviColorList[actorCategory].outer.a; + targetCtx->naviInnerColor.r = sNaviColorList[actorCategory].inner.r; + targetCtx->naviInnerColor.g = sNaviColorList[actorCategory].inner.g; + targetCtx->naviInnerColor.b = sNaviColorList[actorCategory].inner.b; + targetCtx->naviInnerColor.a = sNaviColorList[actorCategory].inner.a; + targetCtx->naviOuterColor.r = sNaviColorList[actorCategory].outer.r; + targetCtx->naviOuterColor.g = sNaviColorList[actorCategory].outer.g; + targetCtx->naviOuterColor.b = sNaviColorList[actorCategory].outer.b; + targetCtx->naviOuterColor.a = sNaviColorList[actorCategory].outer.a; } void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { - targetCtx->fairyActor = NULL; + targetCtx->naviActor = NULL; targetCtx->lockOnActor = NULL; - targetCtx->fairyMoveProgressFactor = 0.0f; + targetCtx->naviMoveProgressFactor = 0.0f; targetCtx->forcedTargetActor = NULL; targetCtx->bgmEnemy = NULL; targetCtx->rotZTick = 0; targetCtx->lockOnIndex = 0; - Target_SetFairyState(targetCtx, actor, actor->category, play); + Target_SetNaviState(targetCtx, actor, actor->category, play); Target_InitLockOn(targetCtx, actor->category, play); } @@ -308,7 +308,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029); if (targetCtx->lockOnAlpha != 0) { - LockOnTriangleSet* entry; + LockOnReticle* reticle; Player* player; s16 alpha; f32 temp1; @@ -331,7 +331,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { } else { // Use multiple triangle sets for the movement effect when the triangles are // getting closer to the actor from the margin of the screen - totalEntries = ARRAY_COUNT(targetCtx->lockOnTriangleSets); + totalEntries = ARRAY_COUNT(targetCtx->lockOnReticles); } if (actor != NULL) { @@ -357,7 +357,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { targetCtx->lockOnIndex--; if (targetCtx->lockOnIndex < 0) { - targetCtx->lockOnIndex = ARRAY_COUNT(targetCtx->lockOnTriangleSets) - 1; + targetCtx->lockOnIndex = ARRAY_COUNT(targetCtx->lockOnReticles) - 1; } Target_SetLockOnPos(targetCtx, targetCtx->lockOnIndex, projectedPos.x, projectedPos.y, projectedPos.z); @@ -366,20 +366,21 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57); for (i = 0, index = targetCtx->lockOnIndex; i < totalEntries; - i++, index = (index + 1) % ARRAY_COUNT(targetCtx->lockOnTriangleSets)) { - entry = &targetCtx->lockOnTriangleSets[index]; + i++, index = (index + 1) % ARRAY_COUNT(targetCtx->lockOnReticles)) { + reticle = &targetCtx->lockOnReticles[index]; - if (entry->radius < 500.0f) { - if (entry->radius <= 120.0f) { + if (reticle->radius < 500.0f) { + if (reticle->radius <= 120.0f) { lockOnScaleX = 0.15f; } else { - lockOnScaleX = ((entry->radius - 120.0f) * 0.001f) + 0.15f; + lockOnScaleX = ((reticle->radius - 120.0f) * 0.001f) + 0.15f; } - Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW); + Matrix_Translate(reticle->pos.x, reticle->pos.y, 0.0f, MTXMODE_NEW); Matrix_Scale(lockOnScaleX, 0.15f, 1.0f, MTXMODE_APPLY); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, entry->color.r, entry->color.g, entry->color.b, (u8)alpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, reticle->color.r, reticle->color.g, reticle->color.b, + (u8)alpha); Matrix_RotateZ((targetCtx->rotZTick & 0x7F) * (M_PI / 64), MTXMODE_APPLY); @@ -387,7 +388,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { for (triangleIndex = 0; triangleIndex < 4; triangleIndex++) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); - Matrix_Translate(entry->radius, entry->radius, 0.0f, MTXMODE_APPLY); + Matrix_Translate(reticle->radius, reticle->radius, 0.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL); @@ -395,7 +396,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { } } - alpha -= 255 / ARRAY_COUNT(targetCtx->lockOnTriangleSets); + alpha -= 255 / ARRAY_COUNT(targetCtx->lockOnReticles); if (alpha < 0) { alpha = 0; } @@ -460,28 +461,28 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, actorCategory = player->actor.category; } - if ((actor != targetCtx->fairyActor) || (actorCategory != targetCtx->fairyActorCategory)) { - targetCtx->fairyActor = actor; - targetCtx->fairyActorCategory = actorCategory; - targetCtx->fairyMoveProgressFactor = 1.0f; + if ((actor != targetCtx->naviActor) || (actorCategory != targetCtx->naviActorCategory)) { + targetCtx->naviActor = actor; + targetCtx->naviActorCategory = actorCategory; + targetCtx->naviMoveProgressFactor = 1.0f; } if (actor == NULL) { actor = &player->actor; } - if (!Math_StepToF(&targetCtx->fairyMoveProgressFactor, 0.0f, 0.25f)) { - fairyMoveScale = 0.25f / targetCtx->fairyMoveProgressFactor; + if (!Math_StepToF(&targetCtx->naviMoveProgressFactor, 0.0f, 0.25f)) { + fairyMoveScale = 0.25f / targetCtx->naviMoveProgressFactor; - velocityX = actor->world.pos.x - targetCtx->fairyPos.x; - velocityY = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->fairyPos.y; - velocityZ = actor->world.pos.z - targetCtx->fairyPos.z; + velocityX = actor->world.pos.x - targetCtx->naviPos.x; + velocityY = (actor->world.pos.y + (actor->targetArrowOffset * actor->scale.y)) - targetCtx->naviPos.y; + velocityZ = actor->world.pos.z - targetCtx->naviPos.z; - targetCtx->fairyPos.x += velocityX * fairyMoveScale; - targetCtx->fairyPos.y += velocityY * fairyMoveScale; - targetCtx->fairyPos.z += velocityZ * fairyMoveScale; + targetCtx->naviPos.x += velocityX * fairyMoveScale; + targetCtx->naviPos.y += velocityY * fairyMoveScale; + targetCtx->naviPos.z += velocityZ * fairyMoveScale; } else { - Target_SetFairyState(targetCtx, actor, actorCategory, play); + Target_SetNaviState(targetCtx, actor, actorCategory, play); } if ((lockOnActor != NULL) && (targetCtx->rotZTick == 0)) { @@ -3009,8 +3010,8 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } - if (actor == actorCtx->targetCtx.fairyActor) { - actorCtx->targetCtx.fairyActor = NULL; + if (actor == actorCtx->targetCtx.naviActor) { + actorCtx->targetCtx.naviActor = NULL; } if (actor == actorCtx->targetCtx.forcedTargetActor) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index e5b98940f29..4e29ec47db7 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -838,7 +838,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; Player* player = GET_PLAYER(play); - Actor* targetFairyActor; + Actor* targetNaviActor; f32 xScale; f32 distFromPlayerHat; @@ -935,11 +935,11 @@ void func_80A03CF8(EnElf* this, PlayState* play) { break; default: func_80A029A8(this, 1); - nextPos = play->actorCtx.targetCtx.fairyPos; + nextPos = play->actorCtx.targetCtx.naviPos; nextPos.y += (1500.0f * this->actor.scale.y); - targetFairyActor = play->actorCtx.targetCtx.fairyActor; + targetNaviActor = play->actorCtx.targetCtx.naviActor; - if (targetFairyActor != NULL) { + if (targetNaviActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speed >= 5.0f) { @@ -1000,12 +1000,12 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu } void func_80A04414(EnElf* this, PlayState* play) { - Actor* targetFairyActor = play->actorCtx.targetCtx.fairyActor; + Actor* targetNaviActor = play->actorCtx.targetCtx.naviActor; Player* player = GET_PLAYER(play); f32 transitionRate; u16 sfxId; - if (play->actorCtx.targetCtx.fairyMoveProgressFactor != 0.0f) { + if (play->actorCtx.targetCtx.naviMoveProgressFactor != 0.0f) { this->unk_2C6 = 0; this->unk_29C = 1.0f; @@ -1015,34 +1015,34 @@ void func_80A04414(EnElf* this, PlayState* play) { } else { if (this->unk_2C6 == 0) { - if ((targetFairyActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.fairyPos) < 50.0f)) { + if ((targetNaviActor == NULL) || + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviPos) < 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.fairyInnerColor; - this->outerColor = play->actorCtx.targetCtx.fairyOuterColor; + this->innerColor = play->actorCtx.targetCtx.naviInnerColor; + this->outerColor = play->actorCtx.targetCtx.naviOuterColor; } else { transitionRate = 0.25f / this->unk_29C; - EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.fairyInnerColor, &this->innerColor, + EnElf_ChangeColor(&this->innerColor, &play->actorCtx.targetCtx.naviInnerColor, &this->innerColor, transitionRate); - EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.fairyOuterColor, &this->outerColor, + EnElf_ChangeColor(&this->outerColor, &play->actorCtx.targetCtx.naviOuterColor, &this->outerColor, transitionRate); } } } if (this->fairyFlags & 1) { - if ((targetFairyActor == NULL) || (player->lockOnActor == NULL)) { + if ((targetNaviActor == NULL) || (player->lockOnActor == NULL)) { this->fairyFlags ^= 1; } } else { - if ((targetFairyActor != NULL) && (player->lockOnActor != NULL)) { - if (targetFairyActor->category == ACTORCAT_NPC) { + if ((targetNaviActor != NULL) && (player->lockOnActor != NULL)) { + if (targetNaviActor->category == ACTORCAT_NPC) { sfxId = NA_SE_VO_NAVY_HELLO; } else { - sfxId = (targetFairyActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; + sfxId = (targetNaviActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; } if (this->unk_2C7 == 0) { @@ -1056,7 +1056,7 @@ void func_80A04414(EnElf* this, PlayState* play) { void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; - Actor* targetFairyActor; + Actor* targetNaviActor; Player* player = GET_PLAYER(play); if (play->csCtx.state != CS_STATE_IDLE) { @@ -1081,7 +1081,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } } else { - targetFairyActor = play->actorCtx.targetCtx.fairyActor; + targetNaviActor = play->actorCtx.targetCtx.naviActor; // `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 @@ -1092,8 +1092,8 @@ void func_80A0461C(EnElf* this, PlayState* play) { ((R_SCENE_CAM_TYPE & 0x10) && Play_CheckViewpoint(play, VIEWPOINT_PIVOT))) { temp = 12; this->unk_2C0 = 100; - } else if ((targetFairyActor == NULL) || (targetFairyActor->category == ACTORCAT_NPC)) { - if (targetFairyActor != NULL) { + } else if ((targetNaviActor == NULL) || (targetNaviActor->category == ACTORCAT_NPC)) { + if (targetNaviActor != NULL) { this->unk_2C0 = 100; player->stateFlags2 |= PLAYER_STATE2_20; temp = 0; @@ -1219,19 +1219,19 @@ void func_80A04D90(EnElf* this, PlayState* play) { void func_80A04DE4(EnElf* this, PlayState* play) { Vec3f headCopy; Player* player = GET_PLAYER(play); - Vec3f fairyPos; + Vec3f naviPos; if (this->fairyFlags & 0x10) { - fairyPos = play->actorCtx.targetCtx.fairyPos; + naviPos = play->actorCtx.targetCtx.naviPos; if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || (&this->actor == player->lockOnActor)) { - fairyPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); - fairyPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; - fairyPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); + naviPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); + naviPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; + naviPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); } - this->actor.focus.pos = fairyPos; + this->actor.focus.pos = naviPos; this->fairyFlags &= ~0x10; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 443ae8d4449..7cc92e60a29 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3471,7 +3471,7 @@ void func_80836BEC(Player* this, PlayState* play) { CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = play->actorCtx.targetCtx.fairyActor; + actorToTarget = play->actorCtx.targetCtx.naviActor; } else { actorToTarget = &GET_PLAYER(play)->actor; } @@ -10172,7 +10172,7 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemAction >= PLAYER_IA_SWORD_MASTER) || ((this->stateFlags2 & PLAYER_STATE2_20) && - (play->actorCtx.targetCtx.fairyActor == NULL))) { + (play->actorCtx.targetCtx.naviActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } } From eccfb54a5c41e9950a0a15990315058dd44b089b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 3 Oct 2023 10:17:01 +1100 Subject: [PATCH 08/13] fix comment --- include/z64actor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 27f89cf644e..2319a9cdd99 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -512,10 +512,10 @@ typedef enum { /* 0xFF */ NAVI_ENEMY_NONE = 0xFF } NaviEnemy; -// A set of 4 triangles which appear around an actor when the player Z-Targets it +// 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 + /* 0x0C */ f32 radius; // distance towards the center of the locked on actor /* 0x10 */ Color_RGB8 color; } LockOnReticle; // size = 0x14 From 1ac99c4bcfe6e250c9c981035bdd6c487ec9ec1c Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 3 Oct 2023 10:18:31 +1100 Subject: [PATCH 09/13] adjust comment --- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 4e29ec47db7..9e0701b9e8e 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1219,19 +1219,21 @@ void func_80A04D90(EnElf* this, PlayState* play) { void func_80A04DE4(EnElf* this, PlayState* play) { Vec3f headCopy; Player* player = GET_PLAYER(play); - Vec3f naviPos; + Vec3f targetNaviPos; if (this->fairyFlags & 0x10) { - naviPos = play->actorCtx.targetCtx.naviPos; + targetNaviPos = play->actorCtx.targetCtx.naviPos; if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || (&this->actor == player->lockOnActor)) { - naviPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); - naviPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; - naviPos.z = player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); + targetNaviPos.x = + player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); + targetNaviPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; + targetNaviPos.z = + player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); } - this->actor.focus.pos = naviPos; + this->actor.focus.pos = targetNaviPos; this->fairyFlags &= ~0x10; } From 4ddce986d332529a450189fd08e5b42d67e2e2cb Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 3 Oct 2023 12:15:13 +1100 Subject: [PATCH 10/13] revert unk_664 --- include/z64player.h | 2 +- src/code/z_actor.c | 18 ++-- src/code/z_player_lib.c | 4 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 9 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 2 +- .../actors/ovl_player_actor/z_player.c | 88 +++++++++---------- 6 files changed, 61 insertions(+), 62 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 9e3e3c55b37..ae497a395ae 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -655,7 +655,7 @@ typedef struct Player { /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; /* 0x05E4 */ ColliderQuad shieldQuad; - /* 0x0664 */ Actor* lockOnActor; + /* 0x0664 */ Actor* unk_664; /* 0x0668 */ char unk_668[0x004]; /* 0x066C */ s32 unk_66C; /* 0x0670 */ s32 meleeWeaponEffectIndex; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index bc0f882620a..cbf276b73e9 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -362,7 +362,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { Target_SetLockOnPos(targetCtx, targetCtx->lockOnIndex, projectedPos.x, projectedPos.y, projectedPos.z); - if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->lockOnActor)) { + if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->unk_664)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57); for (i = 0, index = targetCtx->lockOnIndex; i < totalEntries; @@ -441,7 +441,7 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, // If currently not locked on to an actor and not pressing down on the analog stick then try to find a targetable // actor - if ((player->lockOnActor != NULL) && (player->unk_84B[player->unk_846] == 2)) { + if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { targetCtx->arrowPointedActor = NULL; } else { Target_GetTargetActor(play, &play->actorCtx, &actor, player); @@ -1495,7 +1495,7 @@ f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) { // The yaw, with player as the origin, from where player is facing to where the actor is positioned yawDiff = ABS((s16)((s16)(actor->yawTowardsPlayer - 0x8000) - playerShapeYaw)); - if (player->lockOnActor != NULL) { + if (player->unk_664 != NULL) { if ((yawDiff > 0x4000) || (actor->flags & ACTOR_FLAG_27)) { return FLT_MAX; } @@ -1559,7 +1559,7 @@ s32 Target_OutsideLeashRange(Actor* actor, Player* player, s32 ignoreLeash) { // The yaw, with player as the origin, from where player is facing to where the actor is positioned yawDiff = ABS((s16)((s16)(actor->yawTowardsPlayer - 0x8000) - player->actor.shape.rot.y)); - if ((player->lockOnActor == NULL) && (yawDiff > 0x2AAA)) { + if ((player->unk_664 == NULL) && (yawDiff > 0x2AAA)) { distSq = FLT_MAX; } else { distSq = actor->xyzDistToPlayerSq; @@ -2222,13 +2222,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->flags &= ~ACTOR_FLAG_24; if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) { - if (actor == player->lockOnActor) { + if (actor == player->unk_664) { actor->isLockedOn = true; } else { actor->isLockedOn = false; } - if ((actor->targetPriority != 0) && (player->lockOnActor == NULL)) { + if ((actor->targetPriority != 0) && (player->unk_664 == NULL)) { actor->targetPriority = 0; } @@ -2251,7 +2251,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } } - actor = player->lockOnActor; + actor = player->unk_664; if ((actor != NULL) && (actor->update == NULL)) { actor = NULL; @@ -3005,7 +3005,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { osSyncPrintf("アクタークラス削除 [%s]\n", name); // "Actor class deleted [%s]" } - if ((player != NULL) && (actor == player->lockOnActor)) { + if ((player != NULL) && (actor == player->unk_664)) { func_8008EDF0(player); Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } @@ -3095,7 +3095,7 @@ void Target_FindTargetableActorForCategory(PlayState* play, ActorContext* actorC Vec3f sp70; actor = actorCtx->actorLists[actorCategory].head; - lockOnActor = player->lockOnActor; + lockOnActor = player->unk_664; for (; actor != NULL; actor = actor->next) { if ((actor->update == NULL) || ((Player*)actor == player)) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index c484f817fdb..a14934d2c5b 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -600,7 +600,7 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAc } void func_8008EDF0(Player* this) { - this->lockOnActor = NULL; + this->unk_664 = NULL; this->stateFlags2 &= ~PLAYER_STATE2_13; } @@ -622,7 +622,7 @@ void func_8008EEAC(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); func_8008EE08(this); - this->lockOnActor = actor; + this->unk_664 = actor; this->unk_684 = actor; this->stateFlags1 |= PLAYER_STATE1_16; Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 9e0701b9e8e..c3162fbd4c3 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1034,11 +1034,11 @@ void func_80A04414(EnElf* this, PlayState* play) { } if (this->fairyFlags & 1) { - if ((targetNaviActor == NULL) || (player->lockOnActor == NULL)) { + if ((targetNaviActor == NULL) || (player->unk_664 == NULL)) { this->fairyFlags ^= 1; } } else { - if ((targetNaviActor != NULL) && (player->lockOnActor != NULL)) { + if ((targetNaviActor != NULL) && (player->unk_664 != NULL)) { if (targetNaviActor->category == ACTORCAT_NPC) { sfxId = NA_SE_VO_NAVY_HELLO; } else { @@ -1224,8 +1224,7 @@ void func_80A04DE4(EnElf* this, PlayState* play) { if (this->fairyFlags & 0x10) { targetNaviPos = play->actorCtx.targetCtx.naviPos; - if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || - (&this->actor == player->lockOnActor)) { + if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) { targetNaviPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); targetNaviPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; @@ -1379,7 +1378,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; if (player->naviTextId == 0) { - if (player->lockOnActor == NULL) { + if (player->unk_664 == NULL) { if (((gSaveContext.save.info.playerData.naviTimer >= 600) && (gSaveContext.save.info.playerData.naviTimer <= 3000)) || (nREG(89) != 0)) { diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index e61d99ed459..bfe257b8981 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -546,7 +546,7 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - lockOnActor = player->lockOnActor; + lockOnActor = player->unk_664; if (lockOnActor == NULL) { return false; } else { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7cc92e60a29..770918d3ce9 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2269,7 +2269,7 @@ s32 func_80833B2C(Player* this) { } s32 func_80833B54(Player* this) { - if ((this->lockOnActor != NULL) && CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + if ((this->unk_664 != NULL) && CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags1 |= PLAYER_STATE1_4; return 1; } @@ -3036,14 +3036,14 @@ s32 func_808359FC(Player* this, PlayState* play) { } else if (LinkAnimation_OnFrame(&this->skelAnimeUpper, 6.0f)) { f32 posX = (Math_SinS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.x; f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; - s32 yaw = (this->lockOnActor != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; + s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, this->actor.focus.rot.x, yaw, 0, 0); this->boomerangActor = &boomerang->actor; if (boomerang != NULL) { - boomerang->moveTo = this->lockOnActor; + boomerang->moveTo = this->unk_664; boomerang->returnTimer = 20; this->stateFlags1 |= PLAYER_STATE1_25; if (!func_8008E9C4(this)) { @@ -3373,10 +3373,10 @@ void func_808368EC(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { - if ((this->lockOnActor != NULL) && + if ((this->unk_664 != NULL) && ((play->actorCtx.targetCtx.rotZTick != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->lockOnActor->focus.pos), 4000); + Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && !(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); @@ -3480,15 +3480,15 @@ void func_80836BEC(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_15; if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { - if ((actorToTarget == this->lockOnActor) && (this->actor.category == ACTORCAT_PLAYER)) { + if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; } - if (actorToTarget != this->lockOnActor) { + if (actorToTarget != this->unk_664) { if (!holdTarget) { this->stateFlags2 |= PLAYER_STATE2_13; } - this->lockOnActor = actorToTarget; + this->unk_664 = actorToTarget; this->unk_66C = 15; this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); } else { @@ -3505,23 +3505,23 @@ void func_80836BEC(Player* this, PlayState* play) { } } - if (this->lockOnActor != NULL) { - if ((this->actor.category == ACTORCAT_PLAYER) && (this->lockOnActor != this->unk_684) && - Target_OutsideLeashRange(this->lockOnActor, this, ignoreLeash)) { + if (this->unk_664 != NULL) { + if ((this->actor.category == ACTORCAT_PLAYER) && (this->unk_664 != this->unk_684) && + Target_OutsideLeashRange(this->unk_664, this, ignoreLeash)) { func_8008EDF0(this); this->stateFlags1 |= PLAYER_STATE1_30; - } else if (this->lockOnActor != NULL) { - this->lockOnActor->targetPriority = 40; + } else if (this->unk_664 != NULL) { + this->unk_664->targetPriority = 40; } } else if (this->unk_684 != NULL) { - this->lockOnActor = this->unk_684; + this->unk_664 = this->unk_684; } } - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { this->stateFlags1 &= ~(PLAYER_STATE1_16 | PLAYER_STATE1_17); if ((this->stateFlags1 & PLAYER_STATE1_11) || - !CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + !CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags1 |= PLAYER_STATE1_16; } } else { @@ -3641,9 +3641,9 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { *outYawTarget = this->actor.shape.rot.y; - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { if ((play->actorCtx.targetCtx.rotZTick != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { - *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->lockOnActor->focus.pos); + *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); return false; } } else if (func_80833B2C(this)) { @@ -5098,7 +5098,7 @@ void func_8083A2F8(PlayState* play, Player* this) { if (this->actor.textId != 0) { Message_StartTextbox(play, this->actor.textId, this->targetActor); - this->lockOnActor = this->targetActor; + this->unk_664 = this->targetActor; } } @@ -5521,7 +5521,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { this->actionVar1 = -1; } targetActor->flags |= ACTOR_FLAG_8; - this->lockOnActor = this->targetActor; + this->unk_664 = this->targetActor; } else if (sp2C == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actionVar1 = 1; this->actor.textId = 0x4005; @@ -5600,7 +5600,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { s32 Player_ActionChange_4(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; - Actor* sp30 = this->lockOnActor; + Actor* sp30 = this->unk_664; Actor* sp2C = NULL; s32 sp28 = 0; s32 sp24; @@ -5689,8 +5689,8 @@ s32 Player_ActionChange_0(Player* this, PlayState* play) { return 1; } - if ((this->lockOnActor != NULL) && (CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18) || - (this->lockOnActor->naviEnemyId != NAVI_ENEMY_NONE))) { + if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18) || + (this->unk_664->naviEnemyId != NAVI_ENEMY_NONE))) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) && @@ -5883,7 +5883,7 @@ s32 Player_ActionChange_11(Player* this, PlayState* play) { if ((play->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R) && - (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->lockOnActor == NULL)))) { + (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { func_80832318(this); Player_DetachHeldActor(play, this); @@ -6434,7 +6434,7 @@ void func_8083D6EC(PlayState* play, Player* this) { } s32 func_8083DB98(Player* this, s32 arg1) { - Actor* lockOnActor = this->lockOnActor; + Actor* unk_664 = this->unk_664; Vec3f sp30; s16 sp2E; s16 sp2C; @@ -6442,8 +6442,8 @@ s32 func_8083DB98(Player* this, s32 arg1) { sp30.x = this->actor.world.pos.x; sp30.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; sp30.z = this->actor.world.pos.z; - sp2E = Math_Vec3f_Pitch(&sp30, &lockOnActor->focus.pos); - sp2C = Math_Vec3f_Yaw(&sp30, &lockOnActor->focus.pos); + sp2E = Math_Vec3f_Pitch(&sp30, &unk_664->focus.pos); + sp2C = Math_Vec3f_Yaw(&sp30, &unk_664->focus.pos); Math_SmoothStepToS(&this->actor.focus.rot.y, sp2C, 4, 10000, 0); Math_SmoothStepToS(&this->actor.focus.rot.x, sp2E, 4, 10000, 0); this->unk_6AE |= 2; @@ -6459,7 +6459,7 @@ void func_8083DC54(Player* this, PlayState* play) { f32 temp1; Vec3f sp34; - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { if (func_8002DD78(this) || func_808334B4(this)) { func_8083DB98(this, 1); } else { @@ -7220,7 +7220,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { f32 sp1C = (s16)(arg2 - this->actor.shape.rot.y); f32 temp; - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { func_8083DB98(this, func_8002DD78(this) || func_808334B4(this)); } @@ -7239,7 +7239,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { s16 sp2E = *arg2 - this->zTargetYaw; u16 sp2C = ABS(sp2E); - if ((func_8002DD78(this) || func_808334B4(this)) && (this->lockOnActor == NULL)) { + if ((func_8002DD78(this) || func_808334B4(this)) && (this->unk_664 == NULL)) { *arg1 *= Math_SinS(sp2C); if (*arg1 != 0.0f) { @@ -7248,14 +7248,14 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { *arg2 = this->actor.shape.rot.y; } - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { func_8083DB98(this, 1); } else { Math_SmoothStepToS(&this->actor.focus.rot.x, sControlInput->rel.stick_y * 240.0f, 14, 4000, 30); func_80836AB8(this, 1); } } else { - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { return func_8083FC68(this, *arg1, *arg2); } else { func_8083DC54(this, play); @@ -7524,7 +7524,7 @@ void func_808409CC(PlayState* play, Player* this) { s32 sp38; s32 sp34; - if ((this->lockOnActor != NULL) || + if ((this->unk_664 != NULL) || (!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { this->stateFlags2 &= ~PLAYER_STATE2_28; anim = func_80833338(this); @@ -10189,7 +10189,7 @@ void func_808473D4(PlayState* play, Player* this) { Interface_SetDoAction(play, doAction); if (this->stateFlags2 & PLAYER_STATE2_21) { - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { Interface_SetNaviCall(play, 0x1E); } else { Interface_SetNaviCall(play, 0x1D); @@ -10542,7 +10542,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { u8 seqMode; s32 pad; - Actor* lockOnActor; + Actor* unk_664; s32 camMode; if (this->actor.category == ACTORCAT_PLAYER) { @@ -10558,7 +10558,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { camMode = CAM_MODE_PUSH_PULL; - } else if ((lockOnActor = this->lockOnActor) != NULL) { + } else if ((unk_664 = this->unk_664) != NULL) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_8)) { camMode = CAM_MODE_TALK; } else if (this->stateFlags1 & PLAYER_STATE1_16) { @@ -10570,7 +10570,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else { camMode = CAM_MODE_Z_TARGET_UNFRIENDLY; } - Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, lockOnActor); + Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, unk_664); } else if (this->stateFlags1 & PLAYER_STATE1_12) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags1 & PLAYER_STATE1_25) { @@ -11077,7 +11077,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8083D6EC(play, this); - if ((this->lockOnActor == NULL) && (this->naviTextId == 0)) { + if ((this->unk_664 == NULL) && (this->naviTextId == 0)) { this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_21); } @@ -11596,7 +11596,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { } if ((this->csAction != PLAYER_CSACTION_NONE) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || - func_80833B54(this) || (this->lockOnActor != NULL) || !func_8083AD4C(play, this) || + func_80833B54(this) || (this->unk_664 != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && @@ -11699,7 +11699,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } } - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -12454,7 +12454,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; this->unk_6BE = CLAMP(this->unk_6BE, -0x4AAA, 0x4AAA); @@ -13281,7 +13281,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) { func_80832924(this, D_80854A3C); } - if ((this->actionVar1 == 0) && (this->lockOnActor != NULL)) { + if ((this->actionVar1 == 0) && (this->unk_664 != NULL)) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -14324,9 +14324,9 @@ void func_80851314(Player* this) { this->unk_448 = NULL; } - this->lockOnActor = this->unk_448; + this->unk_664 = this->unk_448; - if (this->lockOnActor != NULL) { + if (this->unk_664 != NULL) { this->actor.shape.rot.y = func_8083DB98(this, 0); } } From 6fcd74e17e95f894c8f93cd16d2b11d84d663d8a Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 20 Nov 2023 14:24:23 +1100 Subject: [PATCH 11/13] PR Review --- include/z64actor.h | 6 +- src/code/z_actor.c | 93 +++++++++---------- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 26 +++--- .../actors/ovl_player_actor/z_player.c | 4 +- 4 files changed, 64 insertions(+), 65 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index d47e1951b0d..e786f3704d4 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -527,11 +527,11 @@ typedef struct { /* 0x0C */ Vec3f lockOnPos; /* 0x18 */ Color_RGBAf naviInnerColor; /* 0x28 */ Color_RGBAf naviOuterColor; - /* 0x38 */ Actor* naviActor; // The actor that Navi hovers over + /* 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 lockOnRadius; // Control the circle lock-on triangles coming in from offscreen when you first target - /* 0x48 */ s16 lockOnAlpha; + /* 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 drawnig with non-zero values. /* 0x4A */ u8 naviActorCategory; /* 0x4B */ u8 rotZTick; /* 0x4C */ s8 lockOnIndex; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e797376e9ef..94fc747e321 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -223,9 +223,9 @@ void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedIn typedef struct { /* 0x0 */ Color_RGBA8 inner; /* 0x4 */ Color_RGBA8 outer; -} NaviColor; // size = 0x8 +} TargetColor; // size = 0x8 -NaviColor sNaviColorList[ACTORCAT_MAX] = { +TargetColor sTargetColorList[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 @@ -238,60 +238,59 @@ NaviColor sNaviColorList[ACTORCAT_MAX] = { { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, // ACTORCAT_BOSS { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_DOOR { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // ACTORCAT_CHEST + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, // extra entry }; -NaviColor sNaviColorUnused = { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }; - // unused Gfx D_80115FF0[] = { gsSPEndDisplayList(), }; -void Target_SetLockOnPos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { +void Target_SetReticlePos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { targetCtx->lockOnReticles[index].pos.x = x; targetCtx->lockOnReticles[index].pos.y = y; targetCtx->lockOnReticles[index].pos.z = z; - targetCtx->lockOnReticles[index].radius = targetCtx->lockOnRadius; + targetCtx->lockOnReticles[index].radius = targetCtx->reticleRadius; } -void Target_InitLockOn(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { +void Target_InitReticle(TargetContext* targetCtx, s32 actorCategory, PlayState* play) { LockOnReticle* reticle; - NaviColor* naviColorEntry; + TargetColor* reticleColor = &sTargetColorList[actorCategory]; s32 i; Math_Vec3f_Copy(&targetCtx->lockOnPos, &play->view.eye); - targetCtx->lockOnRadius = 500.0f; - targetCtx->lockOnAlpha = 0x100; - - naviColorEntry = &sNaviColorList[actorCategory]; + targetCtx->reticleRadius = 500.0f; + targetCtx->reticleFadeAlphaControl = 256; reticle = &targetCtx->lockOnReticles[0]; for (i = 0; i < ARRAY_COUNT(targetCtx->lockOnReticles); i++, reticle++) { - Target_SetLockOnPos(targetCtx, i, 0.0f, 0.0f, 0.0f); + Target_SetReticlePos(targetCtx, i, 0.0f, 0.0f, 0.0f); - reticle->color.r = naviColorEntry->inner.r; - reticle->color.g = naviColorEntry->inner.g; - reticle->color.b = naviColorEntry->inner.b; + reticle->color.r = reticleColor->inner.r; + reticle->color.g = reticleColor->inner.g; + reticle->color.b = reticleColor->inner.b; } } void Target_SetNaviState(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { + TargetColor* naviColor = &sTargetColorList[actorCategory]; + targetCtx->naviPos.x = actor->focus.pos.x; targetCtx->naviPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); targetCtx->naviPos.z = actor->focus.pos.z; - targetCtx->naviInnerColor.r = sNaviColorList[actorCategory].inner.r; - targetCtx->naviInnerColor.g = sNaviColorList[actorCategory].inner.g; - targetCtx->naviInnerColor.b = sNaviColorList[actorCategory].inner.b; - targetCtx->naviInnerColor.a = sNaviColorList[actorCategory].inner.a; - targetCtx->naviOuterColor.r = sNaviColorList[actorCategory].outer.r; - targetCtx->naviOuterColor.g = sNaviColorList[actorCategory].outer.g; - targetCtx->naviOuterColor.b = sNaviColorList[actorCategory].outer.b; - targetCtx->naviOuterColor.a = sNaviColorList[actorCategory].outer.a; + targetCtx->naviInnerColor.r = naviColor->inner.r; + targetCtx->naviInnerColor.g = naviColor->inner.g; + targetCtx->naviInnerColor.b = naviColor->inner.b; + targetCtx->naviInnerColor.a = naviColor->inner.a; + targetCtx->naviOuterColor.r = naviColor->outer.r; + targetCtx->naviOuterColor.g = naviColor->outer.g; + targetCtx->naviOuterColor.b = naviColor->outer.b; + targetCtx->naviOuterColor.a = naviColor->outer.a; } void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { - targetCtx->naviActor = NULL; + targetCtx->naviHoverActor = NULL; targetCtx->lockOnActor = NULL; targetCtx->naviMoveProgressFactor = 0.0f; targetCtx->forcedTargetActor = NULL; @@ -299,7 +298,7 @@ void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { targetCtx->rotZTick = 0; targetCtx->lockOnIndex = 0; Target_SetNaviState(targetCtx, actor, actor->category, play); - Target_InitLockOn(targetCtx, actor->category, play); + Target_InitReticle(targetCtx, actor->category, play); } void Target_Draw(TargetContext* targetCtx, PlayState* play) { @@ -307,7 +306,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029); - if (targetCtx->lockOnAlpha != 0) { + if (targetCtx->reticleFadeAlphaControl != 0) { LockOnReticle* reticle; Player* player; s16 alpha; @@ -336,13 +335,13 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { if (actor != NULL) { Math_Vec3f_Copy(&targetCtx->lockOnPos, &actor->focus.pos); - projectdPosScale = (500.0f - targetCtx->lockOnRadius) / 420.0f; + projectdPosScale = (500.0f - targetCtx->reticleRadius) / 420.0f; } else { - targetCtx->lockOnAlpha -= 120; - if (targetCtx->lockOnAlpha < 0) { - targetCtx->lockOnAlpha = 0; + targetCtx->reticleFadeAlphaControl -= 120; + if (targetCtx->reticleFadeAlphaControl < 0) { + targetCtx->reticleFadeAlphaControl = 0; } - alpha = targetCtx->lockOnAlpha; + alpha = targetCtx->reticleFadeAlphaControl; } Actor_ProjectPos(play, &targetCtx->lockOnPos, &projectedPos, &invW); @@ -360,7 +359,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { targetCtx->lockOnIndex = ARRAY_COUNT(targetCtx->lockOnReticles) - 1; } - Target_SetLockOnPos(targetCtx, targetCtx->lockOnIndex, projectedPos.x, projectedPos.y, projectedPos.z); + Target_SetReticlePos(targetCtx, targetCtx->lockOnIndex, projectedPos.x, projectedPos.y, projectedPos.z); if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->unk_664)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57); @@ -406,7 +405,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { actor = targetCtx->arrowPointedActor; if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) { - NaviColor* color = &sNaviColorList[actor->category]; + TargetColor* arrowColor = &sTargetColorList[actor->category]; POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_7); @@ -415,7 +414,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { 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, color->inner.r, color->inner.g, color->inner.b, 255); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, arrowColor->inner.r, arrowColor->inner.g, arrowColor->inner.b, 255); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL); @@ -461,8 +460,8 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, actorCategory = player->actor.category; } - if ((actor != targetCtx->naviActor) || (actorCategory != targetCtx->naviActorCategory)) { - targetCtx->naviActor = actor; + if ((targetCtx->naviHoverActor != actor) || (actorCategory != targetCtx->naviActorCategory)) { + targetCtx->naviHoverActor = actor; targetCtx->naviActorCategory = actorCategory; targetCtx->naviMoveProgressFactor = 1.0f; } @@ -496,12 +495,12 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, if (lockOnActor != NULL) { if (lockOnActor != targetCtx->lockOnActor) { // Lock On entries need to be re-initialized when changing the targeted actor - Target_InitLockOn(targetCtx, lockOnActor->category, play); + Target_InitReticle(targetCtx, lockOnActor->category, play); targetCtx->lockOnActor = lockOnActor; if (lockOnActor->id == ACTOR_EN_BOOM) { // Avoid drawing the lock on triangles on the boomerang - targetCtx->lockOnAlpha = 0; + targetCtx->reticleFadeAlphaControl = 0; } lockOnSfxId = CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON @@ -514,21 +513,21 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, targetCtx->lockOnPos.z = lockOnActor->world.pos.z; if (targetCtx->rotZTick == 0) { - lockOnStep = (500.0f - targetCtx->lockOnRadius) * 3.0f; + lockOnStep = (500.0f - targetCtx->reticleRadius) * 3.0f; lockOnStep = CLAMP(lockOnStep, 30.0f, 100.0f); - if (Math_StepToF(&targetCtx->lockOnRadius, 80.0f, lockOnStep)) { + if (Math_StepToF(&targetCtx->reticleRadius, 80.0f, lockOnStep)) { targetCtx->rotZTick++; } } else { // 0x80 is or'd to avoid getting this value be set to zero // This rotation value gets multiplied by 0x200, which multiplied by 0x80 gives a full turn (0x10000) targetCtx->rotZTick = (targetCtx->rotZTick + 3) | 0x80; - targetCtx->lockOnRadius = 120.0f; + targetCtx->reticleRadius = 120.0f; } } else { targetCtx->lockOnActor = NULL; - Math_StepToF(&targetCtx->lockOnRadius, 500.0f, 80.0f); + Math_StepToF(&targetCtx->reticleRadius, 500.0f, 80.0f); } } @@ -3057,15 +3056,15 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { Camera_RequestMode(Play_GetCamera(play, Play_GetActiveCamId(play)), CAM_MODE_NORMAL); } - if (actor == actorCtx->targetCtx.naviActor) { - actorCtx->targetCtx.naviActor = NULL; + if (actorCtx->targetCtx.naviHoverActor == actor) { + actorCtx->targetCtx.naviHoverActor = NULL; } - if (actor == actorCtx->targetCtx.forcedTargetActor) { + if (actorCtx->targetCtx.forcedTargetActor == actor) { actorCtx->targetCtx.forcedTargetActor = NULL; } - if (actor == actorCtx->targetCtx.bgmEnemy) { + if (actorCtx->targetCtx.bgmEnemy == actor) { actorCtx->targetCtx.bgmEnemy = NULL; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 4633b8aa65c..44b089b9e41 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -838,7 +838,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { Vec3f nextPos; Vec3f prevPos; Player* player = GET_PLAYER(play); - Actor* targetNaviActor; + Actor* naviHoverActor; f32 xScale; f32 distFromPlayerHat; @@ -937,9 +937,9 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A029A8(this, 1); nextPos = play->actorCtx.targetCtx.naviPos; nextPos.y += (1500.0f * this->actor.scale.y); - targetNaviActor = play->actorCtx.targetCtx.naviActor; + naviHoverActor = play->actorCtx.targetCtx.naviHoverActor; - if (targetNaviActor != NULL) { + if (naviHoverActor != NULL) { func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); if (this->actor.speed >= 5.0f) { @@ -1000,7 +1000,7 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu } void func_80A04414(EnElf* this, PlayState* play) { - Actor* targetNaviActor = play->actorCtx.targetCtx.naviActor; + Actor* naviHoverActor = play->actorCtx.targetCtx.naviHoverActor; Player* player = GET_PLAYER(play); f32 transitionRate; u16 sfxId; @@ -1015,7 +1015,7 @@ void func_80A04414(EnElf* this, PlayState* play) { } else { if (this->unk_2C6 == 0) { - if ((targetNaviActor == NULL) || + if ((naviHoverActor == NULL) || (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.naviPos) < 50.0f)) { this->unk_2C6 = 1; } @@ -1034,15 +1034,15 @@ void func_80A04414(EnElf* this, PlayState* play) { } if (this->fairyFlags & 1) { - if ((targetNaviActor == NULL) || (player->unk_664 == NULL)) { + if ((naviHoverActor == NULL) || (player->unk_664 == NULL)) { this->fairyFlags ^= 1; } } else { - if ((targetNaviActor != NULL) && (player->unk_664 != NULL)) { - if (targetNaviActor->category == ACTORCAT_NPC) { + if ((naviHoverActor != NULL) && (player->unk_664 != NULL)) { + if (naviHoverActor->category == ACTORCAT_NPC) { sfxId = NA_SE_VO_NAVY_HELLO; } else { - sfxId = (targetNaviActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; + sfxId = (naviHoverActor->category == ACTORCAT_ENEMY) ? NA_SE_VO_NAVY_ENEMY : NA_SE_VO_NAVY_HEAR; } if (this->unk_2C7 == 0) { @@ -1056,7 +1056,7 @@ void func_80A04414(EnElf* this, PlayState* play) { void func_80A0461C(EnElf* this, PlayState* play) { s32 temp; - Actor* targetNaviActor; + Actor* naviHoverActor; Player* player = GET_PLAYER(play); if (play->csCtx.state != CS_STATE_IDLE) { @@ -1081,7 +1081,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } } else { - targetNaviActor = play->actorCtx.targetCtx.naviActor; + naviHoverActor = play->actorCtx.targetCtx.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 @@ -1092,8 +1092,8 @@ void func_80A0461C(EnElf* this, PlayState* play) { ((R_SCENE_CAM_TYPE & 0x10) && Play_CheckViewpoint(play, VIEWPOINT_PIVOT))) { temp = 12; this->unk_2C0 = 100; - } else if ((targetNaviActor == NULL) || (targetNaviActor->category == ACTORCAT_NPC)) { - if (targetNaviActor != NULL) { + } else if ((naviHoverActor == NULL) || (naviHoverActor->category == ACTORCAT_NPC)) { + if (naviHoverActor != NULL) { this->unk_2C0 = 100; player->stateFlags2 |= PLAYER_STATE2_20; temp = 0; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 302c5927930..9843e5e93a5 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3512,7 +3512,7 @@ void func_80836BEC(Player* this, PlayState* play) { CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = play->actorCtx.targetCtx.naviActor; + actorToTarget = play->actorCtx.targetCtx.naviHoverActor; } else { actorToTarget = &GET_PLAYER(play)->actor; } @@ -10223,7 +10223,7 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemAction >= PLAYER_IA_SWORD_MASTER) || ((this->stateFlags2 & PLAYER_STATE2_20) && - (play->actorCtx.targetCtx.naviActor == NULL))) { + (play->actorCtx.targetCtx.naviHoverActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } } From 20472fb086b0a4dd5c62a92cf276ac7b0d3632e7 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 20 Nov 2023 14:27:56 +1100 Subject: [PATCH 12/13] typo --- include/z64actor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/z64actor.h b/include/z64actor.h index e786f3704d4..bfae7b00594 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -531,7 +531,7 @@ typedef struct { /* 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 drawnig with non-zero values. + /* 0x48 */ s16 reticleFadeAlphaControl; // Set and fade the reticle alpha. Also controls the reticle drawing with non-zero values. /* 0x4A */ u8 naviActorCategory; /* 0x4B */ u8 rotZTick; /* 0x4C */ s8 lockOnIndex; From 86a68fb8206c52e96e3f4deacf95c35b4ee0a6d7 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Sat, 25 Nov 2023 17:05:11 +1100 Subject: [PATCH 13/13] partial PR Review --- include/z64actor.h | 8 ++-- src/code/z_actor.c | 45 +++++++++---------- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 12 ++--- .../actors/ovl_player_actor/z_player.c | 6 +-- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index bfae7b00594..40854594b7f 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -532,13 +532,13 @@ typedef struct { /* 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 naviActorCategory; - /* 0x4B */ u8 rotZTick; + /* 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; // Never set to non-NULL + /* 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* arrowPointedActor; + /* 0x94 */ Actor* arrowHoverActor; // actor a target arrow is currently hovering over } TargetContext; // size = 0x98 typedef enum { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 94fc747e321..d4c9e34be54 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -295,7 +295,7 @@ void Target_Init(TargetContext* targetCtx, Actor* actor, PlayState* play) { targetCtx->naviMoveProgressFactor = 0.0f; targetCtx->forcedTargetActor = NULL; targetCtx->bgmEnemy = NULL; - targetCtx->rotZTick = 0; + targetCtx->reticleSpinCounter = 0; targetCtx->lockOnIndex = 0; Target_SetNaviState(targetCtx, actor, actor->category, play); Target_InitReticle(targetCtx, actor->category, play); @@ -325,11 +325,10 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { alpha = 255; projectdPosScale = 1.0f; - if (targetCtx->rotZTick != 0) { + if (targetCtx->reticleSpinCounter != 0) { totalEntries = 1; } else { - // Use multiple triangle sets for the movement effect when the triangles are - // getting closer to the actor from the margin of the screen + // Use multiple reticles for the effect of the reticle quickly zooming in on an actor from off screen totalEntries = ARRAY_COUNT(targetCtx->lockOnReticles); } @@ -381,9 +380,9 @@ 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->rotZTick & 0x7F) * (M_PI / 64), MTXMODE_APPLY); + Matrix_RotateZ((targetCtx->reticleSpinCounter & 0x7F) * (M_PI / 64), MTXMODE_APPLY); - // Draw the 4 lock-on triangles + // Draw 4 triangles that make up the reticle for (triangleIndex = 0; triangleIndex < 4; triangleIndex++) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); @@ -403,7 +402,7 @@ void Target_Draw(TargetContext* targetCtx, PlayState* play) { } } - actor = targetCtx->arrowPointedActor; + actor = targetCtx->arrowHoverActor; if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) { TargetColor* arrowColor = &sTargetColorList[actor->category]; @@ -441,10 +440,10 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, // If currently not locked on to an actor and not pressing down on the analog stick then try to find a targetable // actor if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { - targetCtx->arrowPointedActor = NULL; + targetCtx->arrowHoverActor = NULL; } else { Target_GetTargetActor(play, &play->actorCtx, &actor, player); - targetCtx->arrowPointedActor = actor; + targetCtx->arrowHoverActor = actor; } if (targetCtx->forcedTargetActor != NULL) { @@ -460,9 +459,9 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, actorCategory = player->actor.category; } - if ((targetCtx->naviHoverActor != actor) || (actorCategory != targetCtx->naviActorCategory)) { + if ((targetCtx->naviHoverActor != actor) || (targetCtx->naviHoverActorCategory != actorCategory)) { targetCtx->naviHoverActor = actor; - targetCtx->naviActorCategory = actorCategory; + targetCtx->naviHoverActorCategory = actorCategory; targetCtx->naviMoveProgressFactor = 1.0f; } @@ -484,7 +483,7 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, Target_SetNaviState(targetCtx, actor, actorCategory, play); } - if ((lockOnActor != NULL) && (targetCtx->rotZTick == 0)) { + if ((lockOnActor != NULL) && (targetCtx->reticleSpinCounter == 0)) { Actor_ProjectPos(play, &lockOnActor->focus.pos, &projectedFocusPos, &invW); if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * invW))) || (fabsf(projectedFocusPos.y * invW) >= 1.0f)) { @@ -499,7 +498,7 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, targetCtx->lockOnActor = lockOnActor; if (lockOnActor->id == ACTOR_EN_BOOM) { - // Avoid drawing the lock on triangles on the boomerang + // Don't draw the reticle when locked onto the boomerang targetCtx->reticleFadeAlphaControl = 0; } @@ -512,17 +511,17 @@ void Target_Update(TargetContext* targetCtx, Player* player, Actor* lockOnActor, targetCtx->lockOnPos.y = lockOnActor->world.pos.y - (lockOnActor->shape.yOffset * lockOnActor->scale.y); targetCtx->lockOnPos.z = lockOnActor->world.pos.z; - if (targetCtx->rotZTick == 0) { + if (targetCtx->reticleSpinCounter == 0) { lockOnStep = (500.0f - targetCtx->reticleRadius) * 3.0f; lockOnStep = CLAMP(lockOnStep, 30.0f, 100.0f); if (Math_StepToF(&targetCtx->reticleRadius, 80.0f, lockOnStep)) { - targetCtx->rotZTick++; + targetCtx->reticleSpinCounter++; } } else { - // 0x80 is or'd to avoid getting this value be set to zero + // 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->rotZTick = (targetCtx->rotZTick + 3) | 0x80; + targetCtx->reticleSpinCounter = (targetCtx->reticleSpinCounter + 3) | 0x80; targetCtx->reticleRadius = 120.0f; } } else { @@ -1519,7 +1518,7 @@ f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) { return MAXFLOAT; } - // Linear scaling, yaw being 90 degree means it will return the original distance, 0 degree will adjust to 60% + // Linear scaling, yaw being 90 degrees means it will return the original distance, 0 degree will adjust to 60% // of the distance adjDistSq = actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawDiff) * (1.0f / 0x8000)); @@ -2306,8 +2305,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if ((actor == NULL) || (player->unk_66C < 5)) { actor = NULL; - if (actorCtx->targetCtx.rotZTick != 0) { - actorCtx->targetCtx.rotZTick = 0; + if (actorCtx->targetCtx.reticleSpinCounter != 0) { + actorCtx->targetCtx.reticleSpinCounter = 0; Sfx_PlaySfxCentered(NA_SE_SY_LOCK_OFF); } } @@ -3135,13 +3134,13 @@ s16 sTargetPlayerRotY; void Target_FindTargetableActorForCategory(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) { f32 distSq; Actor* actor; - Actor* lockOnActor; + Actor* unk_664; CollisionPoly* sp80; s32 sp7C; Vec3f sp70; actor = actorCtx->actorLists[actorCategory].head; - lockOnActor = player->unk_664; + unk_664 = player->unk_664; for (; actor != NULL; actor = actor->next) { if ((actor->update == NULL) || ((Player*)actor == player)) { @@ -3160,7 +3159,7 @@ void Target_FindTargetableActorForCategory(PlayState* play, ActorContext* actorC } } - if (actor == lockOnActor) { + if (actor == unk_664) { continue; } diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 21bccdb9b73..93f74a0f12a 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -532,7 +532,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl // Player not targeting this or another EnZf? s32 EnZf_CanAttack(PlayState* play, EnZf* this) { - Actor* lockOnActor; + Actor* unk_664; Player* player = GET_PLAYER(play); if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss @@ -546,16 +546,16 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - lockOnActor = player->unk_664; - if (lockOnActor == NULL) { + unk_664 = player->unk_664; + if (unk_664 == NULL) { return false; } else { - if (lockOnActor->category != ACTORCAT_ENEMY) { + if (unk_664->category != ACTORCAT_ENEMY) { return true; } - if (lockOnActor->id != ACTOR_EN_ZF) { + if (unk_664->id != ACTOR_EN_ZF) { return false; - } else if (lockOnActor->colorFilterTimer != 0) { + } else if (unk_664->colorFilterTimer != 0) { return true; } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 45cad0e1406..be44cdfc70b 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3415,7 +3415,7 @@ void func_808368EC(Player* this, PlayState* play) { if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { if ((this->unk_664 != NULL) && - ((play->actorCtx.targetCtx.rotZTick != 0) || (this->actor.category != ACTORCAT_PLAYER))) { + ((play->actorCtx.targetCtx.reticleSpinCounter != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && @@ -3522,7 +3522,7 @@ void func_80836BEC(Player* this, PlayState* play) { if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_27)) { if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { - actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; + actorToTarget = play->actorCtx.targetCtx.arrowHoverActor; } if (actorToTarget != this->unk_664) { @@ -3683,7 +3683,7 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw *outYawTarget = this->actor.shape.rot.y; if (this->unk_664 != NULL) { - if ((play->actorCtx.targetCtx.rotZTick != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { + if ((play->actorCtx.targetCtx.reticleSpinCounter != 0) && !(this->stateFlags2 & PLAYER_STATE2_6)) { *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); return false; }