summaryrefslogtreecommitdiff
path: root/src/code/z_player_lib.c
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2024-09-21 14:49:45 -0400
committerGitHub <noreply@github.com>2024-09-21 14:49:45 -0400
commit05b908d0eb881da10a0bca74a8649cf4bfc9b1b2 (patch)
treee0667472349c84ece66afbe8c4944a8d766ff59f /src/code/z_player_lib.c
parent5178011b6452ba23f7120c83fb28a3bb6a5f190f (diff)
Document `autoLockOnActor` (#2212)
* document autoLockOnActor * format.py * backtick * grammar * comment adjustments * word * letter
Diffstat (limited to 'src/code/z_player_lib.c')
-rw-r--r--src/code/z_player_lib.c18
1 files changed, 16 insertions, 2 deletions
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);