summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2024-09-24 05:00:38 -0400
committerGitHub <noreply@github.com>2024-09-24 05:00:38 -0400
commit3cea46a6c120a7a96123ca6445c4c149acd1d2e6 (patch)
treeacfc54468e57065640847895bc8b52308827ef26 /src/code
parent52a1c2f9694a45f42397121ab52d62662b82a045 (diff)
Z-Targeting Loose Ends (#2217)
* Z-Targeting loose ends * format * add stateflag comment * typo * unname PLAYER_STATE1_19 for now * tweak parallel comment * one more tweak
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_actor.c4
-rw-r--r--src/code/z_player_lib.c13
2 files changed, 11 insertions, 6 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 7e99d066f..39c1ecdea 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -2461,7 +2461,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
if ((actor != NULL) && (actor->update == NULL)) {
actor = NULL;
- func_8008EDF0(player);
+ Player_ReleaseLockOn(player);
}
if ((actor == NULL) || (player->zTargetActiveTimer < 5)) {
@@ -3207,7 +3207,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
ACTOR_DEBUG_PRINTF(T("アクタークラス削除 [%s]\n", "Actor class deleted [%s]\n"), name);
if ((player != NULL) && (actor == player->focusActor)) {
- func_8008EDF0(player);
+ Player_ReleaseLockOn(player);
Camera_RequestMode(Play_GetCamera(play, Play_GetActiveCamId(play)), CAM_MODE_NORMAL);
}
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index 2e1a44ae1..ca4952c57 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -723,12 +723,17 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAc
this->itemAction = itemAction;
}
-void func_8008EDF0(Player* this) {
+void Player_ReleaseLockOn(Player* this) {
this->focusActor = NULL;
this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH;
}
-void func_8008EE08(Player* this) {
+/**
+ * This function aims to clear Z-Target related state when it isn't in use.
+ * It also handles setting a specific free fall related state that is interntwined with Z-Targeting.
+ * TODO: Learn more about this and give a name to PLAYER_STATE1_19
+ */
+void Player_ClearZTargeting(Player* this) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
(this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
(!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) &&
@@ -739,7 +744,7 @@ void func_8008EE08(Player* this) {
this->stateFlags1 |= PLAYER_STATE1_19;
}
- func_8008EDF0(this);
+ Player_ReleaseLockOn(this);
}
/**
@@ -759,7 +764,7 @@ void func_8008EE08(Player* this) {
void Player_SetAutoLockOnActor(PlayState* play, Actor* actor) {
Player* this = GET_PLAYER(play);
- func_8008EE08(this);
+ Player_ClearZTargeting(this);
this->focusActor = actor;
this->autoLockOnActor = actor;
this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS;