From 05b908d0eb881da10a0bca74a8649cf4bfc9b1b2 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 21 Sep 2024 14:49:45 -0400 Subject: Document `autoLockOnActor` (#2212) * document autoLockOnActor * format.py * backtick * grammar * comment adjustments * word * letter --- src/code/z_player_lib.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/code') diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index aefc14db8..f589748f0 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -742,12 +742,26 @@ void func_8008EE08(Player* this) { func_8008EDF0(this); } -void func_8008EEAC(PlayState* play, Actor* actor) { +/** + * Sets the "auto lock-on actor" to lock onto an actor without Player's input. + * This function will first release any existing lock-on or (try to) release parallel. + * + * When using Switch Targeting, it is not possible to carry an auto lock-on actor into a normal + * lock-on when the auto lock-on is finished. + * This is because the `PLAYER_STATE2_LOCK_ON_WITH_SWITCH` flag is never set with an auto lock-on. + * With Hold Targeting it is possible to keep the auto lock-on going by keeping the Z button held down. + * + * The auto lock-on is considered "friendly" even if the actor is actually hostile. If the auto lock-on is hostile, + * Player's battle response will not occur (if he is actionable) and the camera behaves differently. + * When transitioning from auto lock-on to normal lock-on (with Hold Targeting) there will be a noticeable change + * when it switches from "friendly" mode to "hostile" mode. + */ +void Player_SetAutoLockOnActor(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); func_8008EE08(this); this->focusActor = actor; - this->unk_684 = actor; + this->autoLockOnActor = actor; this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS; Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor); Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_TARGET_FRIENDLY); -- cgit v1.2.3