1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

Player Docs - Parallel (#2167)

* name func and flag

* rest of the docs

* format and comment change

* comment
This commit is contained in:
fig02 2024-09-08 08:57:28 -04:00 committed by GitHub
parent 1332356e5c
commit 0168b09628
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 26 deletions

View file

@ -665,7 +665,7 @@ typedef struct WeaponInfo {
#define PLAYER_STATE1_14 (1 << 14)
#define PLAYER_STATE1_15 (1 << 15)
#define PLAYER_STATE1_16 (1 << 16)
#define PLAYER_STATE1_17 (1 << 17)
#define PLAYER_STATE1_PARALLEL (1 << 17) // "Parallel" mode, Z-Target without an actor lock-on
#define PLAYER_STATE1_18 (1 << 18)
#define PLAYER_STATE1_19 (1 << 19)
#define PLAYER_STATE1_20 (1 << 20)
@ -838,7 +838,7 @@ typedef struct Player {
/* 0x0837 */ u8 unk_837;
/* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context.
/* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context.
/* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode
/* 0x083E */ s16 parallelYaw; // yaw in "parallel" mode, Z-Target without an actor lock-on
/* 0x0840 */ u16 underwaterTimer;
/* 0x0842 */ s8 meleeWeaponAnimation;
/* 0x0843 */ s8 meleeWeaponState;

View file

@ -611,7 +611,7 @@ void func_8008EE08(Player* this) {
(this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
(!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) &&
((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) {
this->stateFlags1 &= ~(PLAYER_STATE1_15 | PLAYER_STATE1_16 | PLAYER_STATE1_17 | PLAYER_STATE1_18 |
this->stateFlags1 &= ~(PLAYER_STATE1_15 | PLAYER_STATE1_16 | PLAYER_STATE1_PARALLEL | PLAYER_STATE1_18 |
PLAYER_STATE1_19 | PLAYER_STATE1_30);
} else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_21))) {
this->stateFlags1 |= PLAYER_STATE1_19;

View file

@ -367,7 +367,7 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) {
player->actor.world.pos.z = sRoomCenter.z;
player->speedXZ = 0.0f;
player->actor.shape.rot.y = -0x8000;
player->zTargetYaw = -0x8000;
player->parallelYaw = -0x8000;
player->yaw = -0x8000;
player->actor.velocity.y = 0.0f;
player->fallStartHeight = 0;
@ -427,7 +427,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
player->actor.world.pos.z = sRoomCenter.z;
player->speedXZ = 0;
player->actor.shape.rot.y = -0x8000;
player->zTargetYaw = -0x8000;
player->parallelYaw = -0x8000;
player->yaw = -0x8000;
}

View file

@ -2314,7 +2314,7 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) {
}
s32 func_80833B2C(Player* this) {
if (this->stateFlags1 & (PLAYER_STATE1_16 | PLAYER_STATE1_17 | PLAYER_STATE1_30)) {
if (this->stateFlags1 & (PLAYER_STATE1_16 | PLAYER_STATE1_PARALLEL | PLAYER_STATE1_30)) {
return 1;
} else {
return 0;
@ -2983,15 +2983,16 @@ s32 func_80835588(Player* this, PlayState* play) {
return true;
}
void func_808355DC(Player* this) {
this->stateFlags1 |= PLAYER_STATE1_17;
void Player_SetParallel(Player* this) {
this->stateFlags1 |= PLAYER_STATE1_PARALLEL;
if (!(this->skelAnime.moveFlags & ANIM_FLAG_OVERRIDE_MOVEMENT) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (sShapeYawToTouchedWall < 0x2000)) {
// snap to the wall
this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000;
}
this->zTargetYaw = this->actor.shape.rot.y;
this->parallelYaw = this->actor.shape.rot.y;
}
s32 func_80835644(PlayState* play, Player* this, Actor* arg2) {
@ -3108,7 +3109,7 @@ s32 func_808359FC(Player* this, PlayState* play) {
boomerang->returnTimer = 20;
this->stateFlags1 |= PLAYER_STATE1_25;
if (!func_8008E9C4(this)) {
func_808355DC(this);
Player_SetParallel(this);
}
this->unk_A73 = 4;
Player_PlaySfx(this, NA_SE_IT_BOOMERANG_THROW);
@ -3470,8 +3471,8 @@ s32 Player_SetupWaitForPutAway(PlayState* play, Player* this, AfterPutAwayFunc a
* This does not affect the direction Player will move in.
*
* There are 3 modes shape yaw can be updated with, based on player state:
* - Lock on: Rotates Player to face the lock on target.
* - Parallel: Rotates Player to face the Parallel angle, set by `func_808355DC` when Z is pressed.
* - Lock on: Rotates Player to face the current lock on target.
* - Parallel: Rotates Player to face the current Parallel angle, set when Z-Targeting without an actor lock-on
* - Normal: Rotates Player to face `this->yaw`, the direction he is currently moving
*/
void Player_UpdateShapeYaw(Player* this, PlayState* play) {
@ -3484,9 +3485,9 @@ void Player_UpdateShapeYaw(Player* this, PlayState* play) {
((play->actorCtx.attention.reticleSpinCounter != 0) || (this->actor.category != ACTORCAT_PLAYER))) {
Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &focusActor->focus.pos),
4000);
} else if ((this->stateFlags1 & PLAYER_STATE1_17) &&
} else if ((this->stateFlags1 & PLAYER_STATE1_PARALLEL) &&
!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000);
Math_ScaledStepToS(&this->actor.shape.rot.y, this->parallelYaw, 4000);
}
} else if (!(this->stateFlags2 & PLAYER_STATE2_6)) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 2000);
@ -3561,7 +3562,7 @@ void func_80836BEC(Player* this, PlayState* play) {
} else {
this->unk_66C--;
}
} else if (this->stateFlags1 & PLAYER_STATE1_17) {
} else if (this->stateFlags1 & PLAYER_STATE1_PARALLEL) {
this->unk_66C = 0;
} else if (this->unk_66C != 0) {
this->unk_66C--;
@ -3607,8 +3608,8 @@ void func_80836BEC(Player* this, PlayState* play) {
this->stateFlags1 &= ~PLAYER_STATE1_30;
} else {
if (!(this->stateFlags1 & (PLAYER_STATE1_17 | PLAYER_STATE1_30))) {
func_808355DC(this);
if (!(this->stateFlags1 & (PLAYER_STATE1_PARALLEL | PLAYER_STATE1_30))) {
Player_SetParallel(this);
}
}
}
@ -3627,13 +3628,13 @@ void func_80836BEC(Player* this, PlayState* play) {
}
if (this->focusActor != NULL) {
this->stateFlags1 &= ~(PLAYER_STATE1_16 | PLAYER_STATE1_17);
this->stateFlags1 &= ~(PLAYER_STATE1_16 | PLAYER_STATE1_PARALLEL);
if ((this->stateFlags1 & PLAYER_STATE1_11) ||
!CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) {
this->stateFlags1 |= PLAYER_STATE1_16;
}
} else {
if (this->stateFlags1 & PLAYER_STATE1_17) {
if (this->stateFlags1 & PLAYER_STATE1_PARALLEL) {
this->stateFlags2 &= ~PLAYER_STATE2_13;
} else {
func_8008EE08(this);
@ -3755,7 +3756,7 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw
return false;
}
} else if (func_80833B2C(this)) {
*outYawTarget = this->zTargetYaw;
*outYawTarget = this->parallelYaw;
}
return false;
@ -5377,7 +5378,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
this->av1.actionVar1 = sp50;
} else {
this->stateFlags1 |= PLAYER_STATE1_13;
this->stateFlags1 &= ~PLAYER_STATE1_17;
this->stateFlags1 &= ~PLAYER_STATE1_PARALLEL;
}
Player_PlaySfx(this, NA_SE_PL_SLIPDOWN);
@ -7411,7 +7412,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) {
}
s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) {
s16 sp2E = *arg2 - this->zTargetYaw;
s16 sp2E = *arg2 - this->parallelYaw;
u16 sp2C = ABS(sp2E);
if ((func_8002DD78(this) || func_808334B4(this)) && (this->focusActor == NULL)) {
@ -9294,8 +9295,8 @@ void Player_Action_80844E68(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
func_80832DBC(this);
func_808355DC(this);
this->stateFlags1 &= ~PLAYER_STATE1_17;
Player_SetParallel(this);
this->stateFlags1 &= ~PLAYER_STATE1_PARALLEL;
Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]);
this->av2.actionVar2 = -1;
}
@ -10772,7 +10773,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
} else {
camMode = CAM_MODE_LEDGE_HANG;
}
} else if (this->stateFlags1 & (PLAYER_STATE1_17 | PLAYER_STATE1_30)) {
} else if (this->stateFlags1 & (PLAYER_STATE1_PARALLEL | PLAYER_STATE1_30)) {
if (func_8002DD78(this) || func_808334B4(this)) {
camMode = CAM_MODE_Z_AIM;
} else if (this->stateFlags1 & PLAYER_STATE1_21) {

View file

@ -3365,7 +3365,7 @@ func_808350A4 = 0x80833120; // type:func
func_808351D4 = 0x80833254; // type:func
func_808353D8 = 0x80833460; // type:func
func_80835588 = 0x80833610; // type:func
func_808355DC = 0x8083366C; // type:func
Player_SetParallel = 0x8083366C; // type:func
func_80835644 = 0x808336D8; // type:func
func_80835688 = 0x80833720; // type:func
Player_UpperAction_CarryActor = 0x80833780; // type:func