diff options
| author | fig02 <fig02srl@gmail.com> | 2024-09-13 14:49:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-13 14:49:55 -0400 |
| commit | e658bed27e104df46d201c81232d4dcb9d01a00f (patch) | |
| tree | 93a295b5b3710fa60ae5049fb4da7796f34d3447 /src/code | |
| parent | e6e067428e227204ddb2d459064439bfd89d7362 (diff) | |
Hostile Lock-On (#2193)
* document flag and functions
* format
* adjust comment
* make the comment more public-facing-friendly
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 4 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e36110e79..b7b9e31b0 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3793,7 +3793,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsLockedOn(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isLockedOn) { + if ((player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) && actor->isLockedOn) { return true; } else { return false; @@ -3806,7 +3806,7 @@ s32 Actor_IsLockedOn(PlayState* play, Actor* actor) { s32 Actor_OtherIsLockedOn(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isLockedOn) { + if ((player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) && !actor->isLockedOn) { return true; } else { return false; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 608423b42..f52068507 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -502,8 +502,15 @@ int Player_InCsMode(PlayState* play) { return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4); } -s32 func_8008E9C4(Player* this) { - return (this->stateFlags1 & PLAYER_STATE1_4); +/** + * Checks if Player is currently locked onto a hostile actor. + * `PLAYER_STATE1_HOSTILE_LOCK_ON` controls Player's "battle" response to hostile actors. + * + * Note that within Player, `Player_UpdateHostileLockOn` exists, which updates the flag and also returns the check. + * Player can use this function instead if the flag should be checked, but not updated. + */ +s32 Player_CheckHostileLockOn(Player* this) { + return (this->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON); } int Player_IsChildWithHylianShield(Player* this) { |
