mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-12 01:40:47 +00:00
Document autoLockOnActor
(#2212)
* document autoLockOnActor * format.py * backtick * grammar * comment adjustments * word * letter
This commit is contained in:
parent
5178011b64
commit
05b908d0eb
6 changed files with 43 additions and 13 deletions
|
@ -233,7 +233,7 @@ void EnDh_Wait(EnDh* this, PlayState* play) {
|
|||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0);
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (this->actor.params != ENDH_START_ATTACK_BOMB) {
|
||||
func_8008EEAC(play, &this->actor);
|
||||
Player_SetAutoLockOnActor(play, &this->actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,8 +361,17 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) {
|
|||
if (this->playerStunWaitTimer == 0) {
|
||||
if (!(this->rdFlags & 0x80)) {
|
||||
player->actor.freezeTimer = 40;
|
||||
func_8008EEAC(play, &this->actor);
|
||||
GET_PLAYER(play)->unk_684 = &this->actor;
|
||||
|
||||
// `player->actor.freezeTimer` gets set above which will prevent Player from updating.
|
||||
// Because of this, he cannot update things related to Z-Targeting.
|
||||
// If Player can't update, `player->zTargetActiveTimer` won't update, which means
|
||||
// the Attention system will not be notified of a new actor lock-on occuring.
|
||||
// So, no reticle will appear. But the camera will still focus on the actor.
|
||||
Player_SetAutoLockOnActor(play, &this->actor);
|
||||
|
||||
// This is redundant, `autoLockOnActor` gets set by `Player_SetAutoLockOnActor` above
|
||||
GET_PLAYER(play)->autoLockOnActor = &this->actor;
|
||||
|
||||
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
|
||||
}
|
||||
|
||||
|
@ -606,7 +615,9 @@ void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) {
|
|||
if (!(this->rdFlags & 0x80)) {
|
||||
player->actor.freezeTimer = 60;
|
||||
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
|
||||
func_8008EEAC(play, &this->actor);
|
||||
|
||||
// The same note mentioned with this function call in `EnRd_WalkToPlayer` applies here too
|
||||
Player_SetAutoLockOnActor(play, &this->actor);
|
||||
}
|
||||
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM);
|
||||
|
|
|
@ -3612,7 +3612,8 @@ void func_80836BEC(Player* this, PlayState* play) {
|
|||
(this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT)) {
|
||||
// Don't allow Z-Targeting in various states
|
||||
this->zTargetActiveTimer = 0;
|
||||
} else if (zButtonHeld || (this->stateFlags2 & PLAYER_STATE2_LOCK_ON_WITH_SWITCH) || (this->unk_684 != NULL)) {
|
||||
} else if (zButtonHeld || (this->stateFlags2 & PLAYER_STATE2_LOCK_ON_WITH_SWITCH) ||
|
||||
(this->autoLockOnActor != NULL)) {
|
||||
// While a lock-on is active, decrement the timer and hold it at 5.
|
||||
// Values under 5 indicate a lock-on has ended and will make the reticle release.
|
||||
// See usage toward the end of `Actor_UpdateAll`.
|
||||
|
@ -3698,15 +3699,19 @@ void func_80836BEC(Player* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (this->focusActor != NULL) {
|
||||
if ((this->actor.category == ACTORCAT_PLAYER) && (this->focusActor != this->unk_684) &&
|
||||
if ((this->actor.category == ACTORCAT_PLAYER) && (this->focusActor != this->autoLockOnActor) &&
|
||||
Attention_ShouldReleaseLockOn(this->focusActor, this, ignoreLeash)) {
|
||||
func_8008EDF0(this);
|
||||
this->stateFlags1 |= PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE;
|
||||
} else if (this->focusActor != NULL) {
|
||||
this->focusActor->attentionPriority = 40;
|
||||
}
|
||||
} else if (this->unk_684 != NULL) {
|
||||
this->focusActor = this->unk_684;
|
||||
} else if (this->autoLockOnActor != NULL) {
|
||||
// Becaue of the previous if condition above, `autoLockOnActor` does not take precedence
|
||||
// over `focusActor` if it already exists.
|
||||
// However, `autoLockOnActor` is expected to be set with `Player_SetAutoLockOnActor`
|
||||
// which will release any existing lock-on before setting the new one.
|
||||
this->focusActor = this->autoLockOnActor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11495,7 +11500,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
|
|||
|
||||
this->doorType = PLAYER_DOORTYPE_NONE;
|
||||
this->unk_8A1 = 0;
|
||||
this->unk_684 = NULL;
|
||||
this->autoLockOnActor = NULL;
|
||||
|
||||
phi_f12 =
|
||||
((this->bodyPartsPos[PLAYER_BODYPART_L_FOOT].y + this->bodyPartsPos[PLAYER_BODYPART_R_FOOT].y) * 0.5f) +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue