1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Player doc: some rotation logic/data (#1443)

* Docs: some player rotation logic/data

* Improve misleading comment

* rename temps

* unk_6AE_rotFlags

* format

* disasm metadata
This commit is contained in:
Dragorn421 2024-10-10 02:22:52 +02:00 committed by GitHub
parent 621b8f38c5
commit ba9c60552b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 169 additions and 140 deletions

View file

@ -748,6 +748,16 @@ typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*);
typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*); typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*);
typedef void (*AfterPutAwayFunc)(struct PlayState*, struct Player*); typedef void (*AfterPutAwayFunc)(struct PlayState*, struct Player*);
#define UNK6AE_ROT_FOCUS_X (1 << 0)
#define UNK6AE_ROT_FOCUS_Y (1 << 1)
#define UNK6AE_ROT_FOCUS_Z (1 << 2)
#define UNK6AE_ROT_HEAD_X (1 << 3)
#define UNK6AE_ROT_HEAD_Y (1 << 4)
#define UNK6AE_ROT_HEAD_Z (1 << 5)
#define UNK6AE_ROT_UPPER_X (1 << 6)
#define UNK6AE_ROT_UPPER_Y (1 << 7)
#define UNK6AE_ROT_UPPER_Z (1 << 8)
typedef struct Player { typedef struct Player {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic` /* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic`
@ -838,15 +848,11 @@ typedef struct Player {
/* 0x06A8 */ Actor* unk_6A8; /* 0x06A8 */ Actor* unk_6A8;
/* 0x06AC */ s8 idleType; /* 0x06AC */ s8 idleType;
/* 0x06AD */ u8 unk_6AD; /* 0x06AD */ u8 unk_6AD;
/* 0x06AE */ u16 unk_6AE; /* 0x06AE */ u16 unk_6AE_rotFlags; // See `UNK6AE_ROT_` macros. If its flag isn't set, a rot steps to 0.
/* 0x06B0 */ s16 unk_6B0; /* 0x06B0 */ s16 upperLimbYawSecondary;
/* 0x06B2 */ char unk_6B4[0x004]; /* 0x06B2 */ char unk_6B4[0x004];
/* 0x06B6 */ s16 unk_6B6; /* 0x06B6 */ Vec3s headLimbRot;
/* 0x06B8 */ s16 unk_6B8; /* 0x06BC */ Vec3s upperLimbRot;
/* 0x06BA */ s16 unk_6BA;
/* 0x06BC */ s16 unk_6BC;
/* 0x06BE */ s16 unk_6BE;
/* 0x06C0 */ s16 unk_6C0;
/* 0x06C2 */ s16 unk_6C2; /* 0x06C2 */ s16 unk_6C2;
/* 0x06C4 */ f32 unk_6C4; /* 0x06C4 */ f32 unk_6C4;
/* 0x06C8 */ SkelAnime upperSkelAnime; /* 0x06C8 */ SkelAnime upperSkelAnime;

View file

@ -1098,7 +1098,7 @@ int func_8002DD6C(Player* player) {
} }
int func_8002DD78(Player* player) { int func_8002DD78(Player* player) {
return func_8002DD6C(player) && player->unk_834; return func_8002DD6C(player) && (player->unk_834 != 0);
} }
int func_8002DDA8(PlayState* play) { int func_8002DDA8(PlayState* play) {

View file

@ -1295,22 +1295,22 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
} }
if (limbIndex == PLAYER_LIMB_HEAD) { if (limbIndex == PLAYER_LIMB_HEAD) {
rot->x += this->unk_6BA; rot->x += this->headLimbRot.z;
rot->y -= this->unk_6B8; rot->y -= this->headLimbRot.y;
rot->z += this->unk_6B6; rot->z += this->headLimbRot.x;
} else if (limbIndex == PLAYER_LIMB_UPPER) { } else if (limbIndex == PLAYER_LIMB_UPPER) {
if (this->unk_6B0 != 0) { if (this->upperLimbYawSecondary != 0) {
Matrix_RotateZ(BINANG_TO_RAD(0x44C), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(0x44C), MTXMODE_APPLY);
Matrix_RotateY(BINANG_TO_RAD(this->unk_6B0), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->upperLimbYawSecondary), MTXMODE_APPLY);
} }
if (this->unk_6BE != 0) { if (this->upperLimbRot.y != 0) {
Matrix_RotateY(BINANG_TO_RAD(this->unk_6BE), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->upperLimbRot.y), MTXMODE_APPLY);
} }
if (this->unk_6BC != 0) { if (this->upperLimbRot.x != 0) {
Matrix_RotateX(BINANG_TO_RAD(this->unk_6BC), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD(this->upperLimbRot.x), MTXMODE_APPLY);
} }
if (this->unk_6C0 != 0) { if (this->upperLimbRot.z != 0) {
Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(this->upperLimbRot.z), MTXMODE_APPLY);
} }
} else if (limbIndex == PLAYER_LIMB_L_THIGH) { } else if (limbIndex == PLAYER_LIMB_L_THIGH) {
s32 pad; s32 pad;
@ -1788,7 +1788,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0); Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0);
heldActor->shape.rot = heldActor->world.rot; heldActor->shape.rot = heldActor->world.rot;
if (func_8002DD78(this) != 0) { if (func_8002DD78(this)) {
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
Player_DrawHookshotReticle(play, this, Player_DrawHookshotReticle(play, this,
(this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f); (this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f);

View file

@ -724,7 +724,7 @@ void EnHorse_ResetRace(EnHorse* this, PlayState* play) {
s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
if ((player->stateFlags1 & PLAYER_STATE1_0) || func_8002DD78(GET_PLAYER(play)) == 1 || if ((player->stateFlags1 & PLAYER_STATE1_0) || func_8002DD78(GET_PLAYER(play)) == true ||
(player->stateFlags1 & PLAYER_STATE1_20) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) || (player->stateFlags1 & PLAYER_STATE1_20) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) ||
this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_TALK || this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_TALK ||
play->csCtx.state != CS_STATE_IDLE) { play->csCtx.state != CS_STATE_IDLE) {

View file

@ -3141,8 +3141,8 @@ s32 func_808351D4(Player* this, PlayState* play) {
sp2C = 1; sp2C = 1;
} }
Math_ScaledStepToS(&this->unk_6C0, 1200, 400); Math_ScaledStepToS(&this->upperLimbRot.z, 1200, 400);
this->unk_6AE |= 0x100; this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Z;
if ((this->unk_836 == 0) && (Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) && if ((this->unk_836 == 0) && (Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) &&
(this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) {
@ -3675,7 +3675,7 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
this->hoverBootsTimer = 0; this->hoverBootsTimer = 0;
this->unk_6AE |= 0x43; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_FOCUS_Y | UNK6AE_ROT_UPPER_X;
Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH); Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH);
return true; return true;
} }
@ -3763,48 +3763,68 @@ void Player_UpdateShapeYaw(Player* this, PlayState* play) {
this->unk_87C = this->actor.shape.rot.y - previousYaw; this->unk_87C = this->actor.shape.rot.y - previousYaw;
} }
s32 func_808369C8(s16* pValue, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5) { /**
s16 temp1; * Step a value by `step` to a `target` value.
s16 temp2; * Constrains the value to be no further than `constraintRange` from `constraintMid` (accounting for wrapping).
s16 temp3; * Constrains the value to be no further than `overflowRange` from 0.
* If this second constraint is enforced, return how much the value was past by the range, or return 0.
*
* @return The amount by which the value overflowed the absolute range defined by `overflowRange`
*/
s32 Player_ScaledStepBinangClamped(s16* pValue, s16 target, s16 step, s16 overflowRange, s16 constraintMid,
s16 constraintRange) {
s16 diff;
s16 clampedDiff;
s16 valueBeforeOverflowClamp;
temp1 = temp2 = arg4 - *pValue; // Clamp value to [constraintMid - constraintRange , constraintMid + constraintRange]
temp2 = CLAMP(temp2, -arg5, arg5); // This is more involved than a simple `CLAMP`, to account for binang wrapping
*pValue += (s16)(temp1 - temp2); diff = clampedDiff = constraintMid - *pValue;
clampedDiff = CLAMP(clampedDiff, -constraintRange, constraintRange);
*pValue += (s16)(diff - clampedDiff);
Math_ScaledStepToS(pValue, arg1, arg2); Math_ScaledStepToS(pValue, target, step);
temp3 = *pValue; valueBeforeOverflowClamp = *pValue;
if (*pValue < -arg3) { if (*pValue < -overflowRange) {
*pValue = -arg3; *pValue = -overflowRange;
} else if (*pValue > arg3) { } else if (*pValue > overflowRange) {
*pValue = arg3; *pValue = overflowRange;
} }
return temp3 - *pValue; return valueBeforeOverflowClamp - *pValue;
} }
s32 func_80836AB8(Player* this, s32 arg1) { s32 func_80836AB8(Player* this, s32 arg1) {
s16 sp36; s16 targetUpperBodyYaw;
s16 var; s16 yaw;
var = this->actor.shape.rot.y; yaw = this->actor.shape.rot.y;
if (arg1 != 0) { if (arg1) {
var = this->actor.focus.rot.y; yaw = this->actor.focus.rot.y;
this->unk_6BC = this->actor.focus.rot.x; this->upperLimbRot.x = this->actor.focus.rot.x;
this->unk_6AE |= 0x41; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X;
} else { } else {
func_808369C8(&this->unk_6BC, // Step the head pitch to the focus pitch.
func_808369C8(&this->unk_6B6, this->actor.focus.rot.x, 600, 10000, this->actor.focus.rot.x, 0), // If the head cannot be pitched enough, pitch the upper body.
200, 4000, this->unk_6B6, 10000); Player_ScaledStepBinangClamped(&this->upperLimbRot.x,
sp36 = this->actor.focus.rot.y - var; Player_ScaledStepBinangClamped(&this->headLimbRot.x, this->actor.focus.rot.x,
func_808369C8(&sp36, 0, 200, 24000, this->unk_6BE, 8000); 600, 10000, this->actor.focus.rot.x, 0),
var = this->actor.focus.rot.y - sp36; 200, 4000, this->headLimbRot.x, 10000);
func_808369C8(&this->unk_6B8, sp36 - this->unk_6BE, 200, 8000, sp36, 8000);
func_808369C8(&this->unk_6BE, sp36, 200, 8000, this->unk_6B8, 8000); // Step the upper body and head yaw to the focus yaw.
this->unk_6AE |= 0xD9; // Eventually prefers turning the upper body rather than the head.
targetUpperBodyYaw = this->actor.focus.rot.y - yaw;
Player_ScaledStepBinangClamped(&targetUpperBodyYaw, 0, 200, 24000, this->upperLimbRot.y, 8000);
yaw = this->actor.focus.rot.y - targetUpperBodyYaw;
Player_ScaledStepBinangClamped(&this->headLimbRot.y, targetUpperBodyYaw - this->upperLimbRot.y, 200, 8000,
targetUpperBodyYaw, 8000);
Player_ScaledStepBinangClamped(&this->upperLimbRot.y, targetUpperBodyYaw, 200, 8000, this->headLimbRot.y, 8000);
this->unk_6AE_rotFlags |=
UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_HEAD_X | UNK6AE_ROT_HEAD_Y | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y;
} }
return var; return yaw;
} }
/** /**
@ -4241,7 +4261,7 @@ s32 Player_TryActionHandlerList(PlayState* play, Player* this, s8* actionHandler
} }
if (func_8008F128(this)) { if (func_8008F128(this)) {
this->unk_6AE |= 0x41; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X;
return true; return true;
} }
@ -5925,8 +5945,8 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
} }
void func_8083B010(Player* this) { void func_8083B010(Player* this) {
this->actor.focus.rot.x = this->actor.focus.rot.z = this->unk_6B6 = this->unk_6B8 = this->unk_6BA = this->unk_6BC = this->actor.focus.rot.x = this->actor.focus.rot.z = this->headLimbRot.x = this->headLimbRot.y =
this->unk_6BE = this->unk_6C0 = 0; this->headLimbRot.z = this->upperLimbRot.x = this->upperLimbRot.y = this->upperLimbRot.z = 0;
this->actor.focus.rot.y = this->actor.shape.rot.y; this->actor.focus.rot.y = this->actor.shape.rot.y;
} }
@ -6472,7 +6492,7 @@ s32 Player_ActionHandler_11(Player* this, PlayState* play) {
this->unk_86C = 0.0f; this->unk_86C = 0.0f;
func_80833C3C(this); func_80833C3C(this);
} }
this->unk_6BC = this->unk_6BE = this->unk_6C0 = 0; this->upperLimbRot.x = this->upperLimbRot.y = this->upperLimbRot.z = 0;
} }
frame = Animation_GetLastFrame(anim); frame = Animation_GetLastFrame(anim);
@ -7019,18 +7039,21 @@ void func_8083D6EC(PlayState* play, Player* this) {
s32 func_8083DB98(Player* this, s32 arg1) { s32 func_8083DB98(Player* this, s32 arg1) {
Actor* focusActor = this->focusActor; Actor* focusActor = this->focusActor;
Vec3f sp30; Vec3f playerHeadPos;
s16 sp2E; s16 targetFocusRotX;
s16 sp2C; s16 targetFocusRotY;
sp30.x = this->actor.world.pos.x; playerHeadPos.x = this->actor.world.pos.x;
sp30.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; playerHeadPos.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f;
sp30.z = this->actor.world.pos.z; playerHeadPos.z = this->actor.world.pos.z;
sp2E = Math_Vec3f_Pitch(&sp30, &focusActor->focus.pos);
sp2C = Math_Vec3f_Yaw(&sp30, &focusActor->focus.pos); targetFocusRotX = Math_Vec3f_Pitch(&playerHeadPos, &focusActor->focus.pos);
Math_SmoothStepToS(&this->actor.focus.rot.y, sp2C, 4, 10000, 0); targetFocusRotY = Math_Vec3f_Yaw(&playerHeadPos, &focusActor->focus.pos);
Math_SmoothStepToS(&this->actor.focus.rot.x, sp2E, 4, 10000, 0);
this->unk_6AE |= 2; Math_SmoothStepToS(&this->actor.focus.rot.y, targetFocusRotY, 4, 10000, 0);
Math_SmoothStepToS(&this->actor.focus.rot.x, targetFocusRotX, 4, 10000, 0);
this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_Y;
return func_80836AB8(this, arg1); return func_80836AB8(this, arg1);
} }
@ -7045,9 +7068,9 @@ void func_8083DC54(Player* this, PlayState* play) {
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
if (func_8002DD78(this) || func_808334B4(this)) { if (func_8002DD78(this) || func_808334B4(this)) {
func_8083DB98(this, 1); func_8083DB98(this, true);
} else { } else {
func_8083DB98(this, 0); func_8083DB98(this, false);
} }
return; return;
} }
@ -7070,22 +7093,22 @@ void func_8083DC54(Player* this, PlayState* play) {
void func_8083DDC8(Player* this, PlayState* play) { void func_8083DDC8(Player* this, PlayState* play) {
if (!func_8002DD78(this) && !func_808334B4(this) && (this->speedXZ > 5.0f)) { if (!func_8002DD78(this) && !func_808334B4(this) && (this->speedXZ > 5.0f)) {
s16 temp1; s16 targetPitch;
s16 temp2; s16 targetRoll;
temp1 = this->speedXZ * 200.0f; targetPitch = this->speedXZ * 200.0f;
temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f; targetRoll = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f;
temp1 = CLAMP(temp1, -4000, 4000); targetPitch = CLAMP(targetPitch, -4000, 4000);
temp2 = CLAMP(-temp2, -4000, 4000); targetRoll = CLAMP(-targetRoll, -4000, 4000);
Math_ScaledStepToS(&this->unk_6BC, temp1, 900); Math_ScaledStepToS(&this->upperLimbRot.x, targetPitch, 900);
this->unk_6B6 = -(f32)this->unk_6BC * 0.5f; this->headLimbRot.x = -(f32)this->upperLimbRot.x * 0.5f;
Math_ScaledStepToS(&this->unk_6BA, temp2, 300); Math_ScaledStepToS(&this->headLimbRot.z, targetRoll, 300);
Math_ScaledStepToS(&this->unk_6C0, temp2, 200); Math_ScaledStepToS(&this->upperLimbRot.z, targetRoll, 200);
this->unk_6AE |= 0x168; this->unk_6AE_rotFlags |= UNK6AE_ROT_HEAD_X | UNK6AE_ROT_HEAD_Z | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Z;
} else { } else {
func_8083DC54(this, play); func_8083DC54(this, play);
} }
@ -7854,10 +7877,10 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) {
} }
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
func_8083DB98(this, 1); func_8083DB98(this, true);
} else { } else {
Math_SmoothStepToS(&this->actor.focus.rot.x, sControlInput->rel.stick_y * 240.0f, 14, 4000, 30); Math_SmoothStepToS(&this->actor.focus.rot.x, sControlInput->rel.stick_y * 240.0f, 14, 4000, 30);
func_80836AB8(this, 1); func_80836AB8(this, true);
} }
} else { } else {
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
@ -8868,7 +8891,7 @@ s32 func_808428D8(Player* this, PlayState* play) {
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru);
this->av1.actionVar1 = 1; this->av1.actionVar1 = 1;
this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H;
this->yaw = this->actor.shape.rot.y + this->unk_6BE; this->yaw = this->actor.shape.rot.y + this->upperLimbRot.y;
return 1; return 1;
} }
@ -9104,14 +9127,14 @@ void Player_Action_80843188(Player* this, PlayState* play) {
sp48 = 100; sp48 = 100;
} }
sp46 = ABS(sp4A - this->unk_6BE) * 0.25f; sp46 = ABS(sp4A - this->upperLimbRot.y) * 0.25f;
if (sp46 < 50) { if (sp46 < 50) {
sp46 = 50; sp46 = 50;
} }
Math_ScaledStepToS(&this->actor.focus.rot.x, sp4C, sp48); Math_ScaledStepToS(&this->actor.focus.rot.x, sp4C, sp48);
this->unk_6BC = this->actor.focus.rot.x; this->upperLimbRot.x = this->actor.focus.rot.x;
Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); Math_ScaledStepToS(&this->upperLimbRot.y, sp4A, sp46);
if (this->av1.actionVar1 != 0) { if (this->av1.actionVar1 != 0) {
if (!func_80842DF4(play, this)) { if (!func_80842DF4(play, this)) {
@ -9153,7 +9176,7 @@ void Player_Action_80843188(Player* this, PlayState* play) {
this->stateFlags1 |= PLAYER_STATE1_22; this->stateFlags1 |= PLAYER_STATE1_22;
Player_SetModelsForHoldingShield(this); Player_SetModelsForHoldingShield(this);
this->unk_6AE |= 0xC1; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y;
} }
void Player_Action_808435C4(Player* this, PlayState* play) { void Player_Action_808435C4(Player* this, PlayState* play) {
@ -10701,60 +10724,60 @@ void Player_Init(Actor* thisx, PlayState* play2) {
MREG(64) = 0; MREG(64) = 0;
} }
void func_808471F4(s16* pValue) { void Player_ApproachZeroBinang(s16* pValue) {
s16 step; s16 step;
step = (ABS(*pValue) * 100.0f) / 1000.0f; step = ABS(*pValue) * 100.0f / 1000.0f;
step = CLAMP(step, 400, 4000); step = CLAMP(step, 400, 4000);
Math_ScaledStepToS(pValue, 0, step); Math_ScaledStepToS(pValue, 0, step);
} }
void func_80847298(Player* this) { void func_80847298(Player* this) {
if (!(this->unk_6AE & 2)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Y)) {
s16 sp26 = this->actor.focus.rot.y - this->actor.shape.rot.y; s16 diff = this->actor.focus.rot.y - this->actor.shape.rot.y;
func_808471F4(&sp26); Player_ApproachZeroBinang(&diff);
this->actor.focus.rot.y = this->actor.shape.rot.y + sp26; this->actor.focus.rot.y = this->actor.shape.rot.y + diff;
} }
if (!(this->unk_6AE & 1)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_X)) {
func_808471F4(&this->actor.focus.rot.x); Player_ApproachZeroBinang(&this->actor.focus.rot.x);
} }
if (!(this->unk_6AE & 8)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_X)) {
func_808471F4(&this->unk_6B6); Player_ApproachZeroBinang(&this->headLimbRot.x);
} }
if (!(this->unk_6AE & 0x40)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_X)) {
func_808471F4(&this->unk_6BC); Player_ApproachZeroBinang(&this->upperLimbRot.x);
} }
if (!(this->unk_6AE & 4)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Z)) {
func_808471F4(&this->actor.focus.rot.z); Player_ApproachZeroBinang(&this->actor.focus.rot.z);
} }
if (!(this->unk_6AE & 0x10)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Y)) {
func_808471F4(&this->unk_6B8); Player_ApproachZeroBinang(&this->headLimbRot.y);
} }
if (!(this->unk_6AE & 0x20)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Z)) {
func_808471F4(&this->unk_6BA); Player_ApproachZeroBinang(&this->headLimbRot.z);
} }
if (!(this->unk_6AE & 0x80)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Y)) {
if (this->unk_6B0 != 0) { if (this->upperLimbYawSecondary != 0) {
func_808471F4(&this->unk_6B0); Player_ApproachZeroBinang(&this->upperLimbYawSecondary);
} else { } else {
func_808471F4(&this->unk_6BE); Player_ApproachZeroBinang(&this->upperLimbRot.y);
} }
} }
if (!(this->unk_6AE & 0x100)) { if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Z)) {
func_808471F4(&this->unk_6C0); Player_ApproachZeroBinang(&this->upperLimbRot.z);
} }
this->unk_6AE = 0; this->unk_6AE_rotFlags = 0;
} }
static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f }; static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f };
@ -12234,7 +12257,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
s16 temp2; s16 temp2;
s16 temp3; s16 temp3;
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) { if (!func_8002DD78(this) && !func_808334B4(this) && !arg2) {
temp2 = sControlInput->rel.stick_y * 240.0f; temp2 = sControlInput->rel.stick_y * 240.0f;
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30); Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
@ -12256,7 +12279,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
} }
this->unk_6AE |= 2; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_Y;
return func_80836AB8(this, (play->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - arg3; return func_80836AB8(this, (play->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - arg3;
} }
@ -12377,9 +12400,9 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) {
Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_UP); Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_UP);
} else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_6AD != 2)) { } else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_6AD != 2)) {
if (func_8008F128(this)) { if (func_8008F128(this)) {
this->unk_6AE |= 0x43; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_FOCUS_Y | UNK6AE_ROT_UPPER_X;
} else { } else {
this->actor.shape.rot.y = func_8084ABD8(play, this, 0, 0); this->actor.shape.rot.y = func_8084ABD8(play, this, false, 0);
} }
} }
@ -12471,7 +12494,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) {
} }
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); this->yaw = this->actor.shape.rot.y = func_8083DB98(this, false);
} }
} }
@ -13232,9 +13255,9 @@ void Player_Action_8084CC98(Player* this, PlayState* play) {
this->unk_6AD = 0; this->unk_6AD = 0;
this->stateFlags1 &= ~PLAYER_STATE1_20; this->stateFlags1 &= ~PLAYER_STATE1_20;
} else { } else {
this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->upperLimbRot.y = func_8084ABD8(play, this, true, -5000) - this->actor.shape.rot.y;
this->unk_6BE += 5000; this->upperLimbRot.y += 5000;
this->unk_6B0 = -5000; this->upperLimbYawSecondary = -5000;
} }
return; return;
} }
@ -13242,20 +13265,20 @@ void Player_Action_8084CC98(Player* this, PlayState* play) {
if ((this->csAction != PLAYER_CSACTION_NONE) || if ((this->csAction != PLAYER_CSACTION_NONE) ||
(!func_8084C9BC(this, play) && !Player_ActionHandler_13(this, play))) { (!func_8084C9BC(this, play) && !Player_ActionHandler_13(this, play))) {
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
if (func_8002DD78(this) != 0) { if (func_8002DD78(this)) {
this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; this->upperLimbRot.y = func_8083DB98(this, true) - this->actor.shape.rot.y;
this->unk_6BE = CLAMP(this->unk_6BE, -0x4AAA, 0x4AAA); this->upperLimbRot.y = CLAMP(this->upperLimbRot.y, -0x4AAA, 0x4AAA);
this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_6BE; this->actor.focus.rot.y = this->actor.shape.rot.y + this->upperLimbRot.y;
this->unk_6BE += 5000; this->upperLimbRot.y += 5000;
this->unk_6AE |= 0x80; this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y;
} else { } else {
func_8083DB98(this, 0); func_8083DB98(this, false);
} }
} else { } else {
if (func_8002DD78(this) != 0) { if (func_8002DD78(this)) {
this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; this->upperLimbRot.y = func_8084ABD8(play, this, true, -5000) - this->actor.shape.rot.y;
this->unk_6BE += 5000; this->upperLimbRot.y += 5000;
this->unk_6B0 = -5000; this->upperLimbYawSecondary = -5000;
} }
} }
} }
@ -14078,7 +14101,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) {
} }
if ((this->av1.actionVar1 == 0) && (this->focusActor != NULL)) { if ((this->av1.actionVar1 == 0) && (this->focusActor != NULL)) {
this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); this->yaw = this->actor.shape.rot.y = func_8083DB98(this, false);
} }
} }
@ -14258,8 +14281,8 @@ void Player_Action_8084FA54(Player* this, PlayState* play) {
LinkAnimation_Update(play, &this->skelAnime); LinkAnimation_Update(play, &this->skelAnime);
Player_UpdateUpperBody(this, play); Player_UpdateUpperBody(this, play);
this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; this->upperLimbRot.y = func_8084ABD8(play, this, true, 0) - this->actor.shape.rot.y;
this->unk_6AE |= 0x80; this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y;
if (play->shootingGalleryStatus < 0) { if (play->shootingGalleryStatus < 0) {
play->shootingGalleryStatus++; play->shootingGalleryStatus++;
@ -14536,7 +14559,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) {
sp2C = this->actor.world.pos.y - shockwavePos.y; sp2C = this->actor.world.pos.y - shockwavePos.y;
Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800); Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800);
func_80836AB8(this, 1); func_80836AB8(this, true);
if ((((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) && if ((((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) &&
LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) || LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) ||
@ -15154,7 +15177,7 @@ void func_80851314(Player* this) {
this->focusActor = this->csActor; this->focusActor = this->csActor;
if (this->focusActor != NULL) { if (this->focusActor != NULL) {
this->actor.shape.rot.y = func_8083DB98(this, 0); this->actor.shape.rot.y = func_8083DB98(this, false);
} }
} }