1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-08 08:55:17 +00:00

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
This commit is contained in:
fig02 2024-09-24 05:00:38 -04:00 committed by GitHub
parent 52a1c2f969
commit 3cea46a6c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 16 deletions

View file

@ -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);
}

View file

@ -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;