mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-14 13:30:47 +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:
parent
621b8f38c5
commit
ba9c60552b
5 changed files with 169 additions and 140 deletions
|
@ -748,6 +748,16 @@ typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*);
|
|||
typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*);
|
||||
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 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic`
|
||||
|
@ -838,15 +848,11 @@ typedef struct Player {
|
|||
/* 0x06A8 */ Actor* unk_6A8;
|
||||
/* 0x06AC */ s8 idleType;
|
||||
/* 0x06AD */ u8 unk_6AD;
|
||||
/* 0x06AE */ u16 unk_6AE;
|
||||
/* 0x06B0 */ s16 unk_6B0;
|
||||
/* 0x06AE */ u16 unk_6AE_rotFlags; // See `UNK6AE_ROT_` macros. If its flag isn't set, a rot steps to 0.
|
||||
/* 0x06B0 */ s16 upperLimbYawSecondary;
|
||||
/* 0x06B2 */ char unk_6B4[0x004];
|
||||
/* 0x06B6 */ s16 unk_6B6;
|
||||
/* 0x06B8 */ s16 unk_6B8;
|
||||
/* 0x06BA */ s16 unk_6BA;
|
||||
/* 0x06BC */ s16 unk_6BC;
|
||||
/* 0x06BE */ s16 unk_6BE;
|
||||
/* 0x06C0 */ s16 unk_6C0;
|
||||
/* 0x06B6 */ Vec3s headLimbRot;
|
||||
/* 0x06BC */ Vec3s upperLimbRot;
|
||||
/* 0x06C2 */ s16 unk_6C2;
|
||||
/* 0x06C4 */ f32 unk_6C4;
|
||||
/* 0x06C8 */ SkelAnime upperSkelAnime;
|
||||
|
|
|
@ -1098,7 +1098,7 @@ int func_8002DD6C(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) {
|
||||
|
|
|
@ -1295,22 +1295,22 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
|
|||
}
|
||||
|
||||
if (limbIndex == PLAYER_LIMB_HEAD) {
|
||||
rot->x += this->unk_6BA;
|
||||
rot->y -= this->unk_6B8;
|
||||
rot->z += this->unk_6B6;
|
||||
rot->x += this->headLimbRot.z;
|
||||
rot->y -= this->headLimbRot.y;
|
||||
rot->z += this->headLimbRot.x;
|
||||
} else if (limbIndex == PLAYER_LIMB_UPPER) {
|
||||
if (this->unk_6B0 != 0) {
|
||||
if (this->upperLimbYawSecondary != 0) {
|
||||
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) {
|
||||
Matrix_RotateY(BINANG_TO_RAD(this->unk_6BE), MTXMODE_APPLY);
|
||||
if (this->upperLimbRot.y != 0) {
|
||||
Matrix_RotateY(BINANG_TO_RAD(this->upperLimbRot.y), MTXMODE_APPLY);
|
||||
}
|
||||
if (this->unk_6BC != 0) {
|
||||
Matrix_RotateX(BINANG_TO_RAD(this->unk_6BC), MTXMODE_APPLY);
|
||||
if (this->upperLimbRot.x != 0) {
|
||||
Matrix_RotateX(BINANG_TO_RAD(this->upperLimbRot.x), MTXMODE_APPLY);
|
||||
}
|
||||
if (this->unk_6C0 != 0) {
|
||||
Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY);
|
||||
if (this->upperLimbRot.z != 0) {
|
||||
Matrix_RotateZ(BINANG_TO_RAD(this->upperLimbRot.z), MTXMODE_APPLY);
|
||||
}
|
||||
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
|
||||
s32 pad;
|
||||
|
@ -1788,7 +1788,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0);
|
||||
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);
|
||||
Player_DrawHookshotReticle(play, this,
|
||||
(this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f);
|
||||
|
|
|
@ -724,7 +724,7 @@ void EnHorse_ResetRace(EnHorse* this, PlayState* play) {
|
|||
s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* 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) ||
|
||||
this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_TALK ||
|
||||
play->csCtx.state != CS_STATE_IDLE) {
|
||||
|
|
|
@ -3141,8 +3141,8 @@ s32 func_808351D4(Player* this, PlayState* play) {
|
|||
sp2C = 1;
|
||||
}
|
||||
|
||||
Math_ScaledStepToS(&this->unk_6C0, 1200, 400);
|
||||
this->unk_6AE |= 0x100;
|
||||
Math_ScaledStepToS(&this->upperLimbRot.z, 1200, 400);
|
||||
this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Z;
|
||||
|
||||
if ((this->unk_836 == 0) && (Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) &&
|
||||
(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->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
@ -3763,48 +3763,68 @@ void Player_UpdateShapeYaw(Player* this, PlayState* play) {
|
|||
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;
|
||||
s16 temp2;
|
||||
s16 temp3;
|
||||
/**
|
||||
* Step a value by `step` to a `target` value.
|
||||
* Constrains the value to be no further than `constraintRange` from `constraintMid` (accounting for wrapping).
|
||||
* 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;
|
||||
temp2 = CLAMP(temp2, -arg5, arg5);
|
||||
*pValue += (s16)(temp1 - temp2);
|
||||
// Clamp value to [constraintMid - constraintRange , constraintMid + constraintRange]
|
||||
// This is more involved than a simple `CLAMP`, to account for binang wrapping
|
||||
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;
|
||||
if (*pValue < -arg3) {
|
||||
*pValue = -arg3;
|
||||
} else if (*pValue > arg3) {
|
||||
*pValue = arg3;
|
||||
valueBeforeOverflowClamp = *pValue;
|
||||
if (*pValue < -overflowRange) {
|
||||
*pValue = -overflowRange;
|
||||
} else if (*pValue > overflowRange) {
|
||||
*pValue = overflowRange;
|
||||
}
|
||||
return temp3 - *pValue;
|
||||
return valueBeforeOverflowClamp - *pValue;
|
||||
}
|
||||
|
||||
s32 func_80836AB8(Player* this, s32 arg1) {
|
||||
s16 sp36;
|
||||
s16 var;
|
||||
s16 targetUpperBodyYaw;
|
||||
s16 yaw;
|
||||
|
||||
var = this->actor.shape.rot.y;
|
||||
if (arg1 != 0) {
|
||||
var = this->actor.focus.rot.y;
|
||||
this->unk_6BC = this->actor.focus.rot.x;
|
||||
this->unk_6AE |= 0x41;
|
||||
yaw = this->actor.shape.rot.y;
|
||||
if (arg1) {
|
||||
yaw = this->actor.focus.rot.y;
|
||||
this->upperLimbRot.x = this->actor.focus.rot.x;
|
||||
this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X;
|
||||
} else {
|
||||
func_808369C8(&this->unk_6BC,
|
||||
func_808369C8(&this->unk_6B6, this->actor.focus.rot.x, 600, 10000, this->actor.focus.rot.x, 0),
|
||||
200, 4000, this->unk_6B6, 10000);
|
||||
sp36 = this->actor.focus.rot.y - var;
|
||||
func_808369C8(&sp36, 0, 200, 24000, this->unk_6BE, 8000);
|
||||
var = this->actor.focus.rot.y - sp36;
|
||||
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);
|
||||
this->unk_6AE |= 0xD9;
|
||||
// Step the head pitch to the focus pitch.
|
||||
// If the head cannot be pitched enough, pitch the upper body.
|
||||
Player_ScaledStepBinangClamped(&this->upperLimbRot.x,
|
||||
Player_ScaledStepBinangClamped(&this->headLimbRot.x, this->actor.focus.rot.x,
|
||||
600, 10000, this->actor.focus.rot.x, 0),
|
||||
200, 4000, this->headLimbRot.x, 10000);
|
||||
|
||||
// Step the upper body and head yaw to the focus yaw.
|
||||
// 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)) {
|
||||
this->unk_6AE |= 0x41;
|
||||
this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5925,8 +5945,8 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
|
|||
}
|
||||
|
||||
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->unk_6BE = this->unk_6C0 = 0;
|
||||
this->actor.focus.rot.x = this->actor.focus.rot.z = this->headLimbRot.x = this->headLimbRot.y =
|
||||
this->headLimbRot.z = this->upperLimbRot.x = this->upperLimbRot.y = this->upperLimbRot.z = 0;
|
||||
|
||||
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;
|
||||
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);
|
||||
|
@ -7019,18 +7039,21 @@ void func_8083D6EC(PlayState* play, Player* this) {
|
|||
|
||||
s32 func_8083DB98(Player* this, s32 arg1) {
|
||||
Actor* focusActor = this->focusActor;
|
||||
Vec3f sp30;
|
||||
s16 sp2E;
|
||||
s16 sp2C;
|
||||
Vec3f playerHeadPos;
|
||||
s16 targetFocusRotX;
|
||||
s16 targetFocusRotY;
|
||||
|
||||
sp30.x = this->actor.world.pos.x;
|
||||
sp30.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f;
|
||||
sp30.z = this->actor.world.pos.z;
|
||||
sp2E = Math_Vec3f_Pitch(&sp30, &focusActor->focus.pos);
|
||||
sp2C = Math_Vec3f_Yaw(&sp30, &focusActor->focus.pos);
|
||||
Math_SmoothStepToS(&this->actor.focus.rot.y, sp2C, 4, 10000, 0);
|
||||
Math_SmoothStepToS(&this->actor.focus.rot.x, sp2E, 4, 10000, 0);
|
||||
this->unk_6AE |= 2;
|
||||
playerHeadPos.x = this->actor.world.pos.x;
|
||||
playerHeadPos.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f;
|
||||
playerHeadPos.z = this->actor.world.pos.z;
|
||||
|
||||
targetFocusRotX = Math_Vec3f_Pitch(&playerHeadPos, &focusActor->focus.pos);
|
||||
targetFocusRotY = Math_Vec3f_Yaw(&playerHeadPos, &focusActor->focus.pos);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -7045,9 +7068,9 @@ void func_8083DC54(Player* this, PlayState* play) {
|
|||
|
||||
if (this->focusActor != NULL) {
|
||||
if (func_8002DD78(this) || func_808334B4(this)) {
|
||||
func_8083DB98(this, 1);
|
||||
func_8083DB98(this, true);
|
||||
} else {
|
||||
func_8083DB98(this, 0);
|
||||
func_8083DB98(this, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -7070,22 +7093,22 @@ void func_8083DC54(Player* this, PlayState* play) {
|
|||
|
||||
void func_8083DDC8(Player* this, PlayState* play) {
|
||||
if (!func_8002DD78(this) && !func_808334B4(this) && (this->speedXZ > 5.0f)) {
|
||||
s16 temp1;
|
||||
s16 temp2;
|
||||
s16 targetPitch;
|
||||
s16 targetRoll;
|
||||
|
||||
temp1 = this->speedXZ * 200.0f;
|
||||
temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f;
|
||||
targetPitch = this->speedXZ * 200.0f;
|
||||
targetRoll = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f;
|
||||
|
||||
temp1 = CLAMP(temp1, -4000, 4000);
|
||||
temp2 = CLAMP(-temp2, -4000, 4000);
|
||||
targetPitch = CLAMP(targetPitch, -4000, 4000);
|
||||
targetRoll = CLAMP(-targetRoll, -4000, 4000);
|
||||
|
||||
Math_ScaledStepToS(&this->unk_6BC, temp1, 900);
|
||||
this->unk_6B6 = -(f32)this->unk_6BC * 0.5f;
|
||||
Math_ScaledStepToS(&this->upperLimbRot.x, targetPitch, 900);
|
||||
this->headLimbRot.x = -(f32)this->upperLimbRot.x * 0.5f;
|
||||
|
||||
Math_ScaledStepToS(&this->unk_6BA, temp2, 300);
|
||||
Math_ScaledStepToS(&this->unk_6C0, temp2, 200);
|
||||
Math_ScaledStepToS(&this->headLimbRot.z, targetRoll, 300);
|
||||
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 {
|
||||
func_8083DC54(this, play);
|
||||
}
|
||||
|
@ -7854,10 +7877,10 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) {
|
|||
}
|
||||
|
||||
if (this->focusActor != NULL) {
|
||||
func_8083DB98(this, 1);
|
||||
func_8083DB98(this, true);
|
||||
} else {
|
||||
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 {
|
||||
if (this->focusActor != NULL) {
|
||||
|
@ -8868,7 +8891,7 @@ s32 func_808428D8(Player* this, PlayState* play) {
|
|||
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru);
|
||||
this->av1.actionVar1 = 1;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -9104,14 +9127,14 @@ void Player_Action_80843188(Player* this, PlayState* play) {
|
|||
sp48 = 100;
|
||||
}
|
||||
|
||||
sp46 = ABS(sp4A - this->unk_6BE) * 0.25f;
|
||||
sp46 = ABS(sp4A - this->upperLimbRot.y) * 0.25f;
|
||||
if (sp46 < 50) {
|
||||
sp46 = 50;
|
||||
}
|
||||
|
||||
Math_ScaledStepToS(&this->actor.focus.rot.x, sp4C, sp48);
|
||||
this->unk_6BC = this->actor.focus.rot.x;
|
||||
Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46);
|
||||
this->upperLimbRot.x = this->actor.focus.rot.x;
|
||||
Math_ScaledStepToS(&this->upperLimbRot.y, sp4A, sp46);
|
||||
|
||||
if (this->av1.actionVar1 != 0) {
|
||||
if (!func_80842DF4(play, this)) {
|
||||
|
@ -9153,7 +9176,7 @@ void Player_Action_80843188(Player* this, PlayState* play) {
|
|||
this->stateFlags1 |= PLAYER_STATE1_22;
|
||||
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) {
|
||||
|
@ -10701,60 +10724,60 @@ void Player_Init(Actor* thisx, PlayState* play2) {
|
|||
MREG(64) = 0;
|
||||
}
|
||||
|
||||
void func_808471F4(s16* pValue) {
|
||||
void Player_ApproachZeroBinang(s16* pValue) {
|
||||
s16 step;
|
||||
|
||||
step = (ABS(*pValue) * 100.0f) / 1000.0f;
|
||||
step = ABS(*pValue) * 100.0f / 1000.0f;
|
||||
step = CLAMP(step, 400, 4000);
|
||||
|
||||
Math_ScaledStepToS(pValue, 0, step);
|
||||
}
|
||||
|
||||
void func_80847298(Player* this) {
|
||||
if (!(this->unk_6AE & 2)) {
|
||||
s16 sp26 = this->actor.focus.rot.y - this->actor.shape.rot.y;
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Y)) {
|
||||
s16 diff = this->actor.focus.rot.y - this->actor.shape.rot.y;
|
||||
|
||||
func_808471F4(&sp26);
|
||||
this->actor.focus.rot.y = this->actor.shape.rot.y + sp26;
|
||||
Player_ApproachZeroBinang(&diff);
|
||||
this->actor.focus.rot.y = this->actor.shape.rot.y + diff;
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 1)) {
|
||||
func_808471F4(&this->actor.focus.rot.x);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_X)) {
|
||||
Player_ApproachZeroBinang(&this->actor.focus.rot.x);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 8)) {
|
||||
func_808471F4(&this->unk_6B6);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_X)) {
|
||||
Player_ApproachZeroBinang(&this->headLimbRot.x);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 0x40)) {
|
||||
func_808471F4(&this->unk_6BC);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_X)) {
|
||||
Player_ApproachZeroBinang(&this->upperLimbRot.x);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 4)) {
|
||||
func_808471F4(&this->actor.focus.rot.z);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Z)) {
|
||||
Player_ApproachZeroBinang(&this->actor.focus.rot.z);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 0x10)) {
|
||||
func_808471F4(&this->unk_6B8);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Y)) {
|
||||
Player_ApproachZeroBinang(&this->headLimbRot.y);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 0x20)) {
|
||||
func_808471F4(&this->unk_6BA);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Z)) {
|
||||
Player_ApproachZeroBinang(&this->headLimbRot.z);
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 0x80)) {
|
||||
if (this->unk_6B0 != 0) {
|
||||
func_808471F4(&this->unk_6B0);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Y)) {
|
||||
if (this->upperLimbYawSecondary != 0) {
|
||||
Player_ApproachZeroBinang(&this->upperLimbYawSecondary);
|
||||
} else {
|
||||
func_808471F4(&this->unk_6BE);
|
||||
Player_ApproachZeroBinang(&this->upperLimbRot.y);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->unk_6AE & 0x100)) {
|
||||
func_808471F4(&this->unk_6C0);
|
||||
if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Z)) {
|
||||
Player_ApproachZeroBinang(&this->upperLimbRot.z);
|
||||
}
|
||||
|
||||
this->unk_6AE = 0;
|
||||
this->unk_6AE_rotFlags = 0;
|
||||
}
|
||||
|
||||
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 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;
|
||||
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->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;
|
||||
}
|
||||
|
||||
|
@ -12377,9 +12400,9 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) {
|
|||
Sfx_PlaySfxCentered(NA_SE_SY_CAMERA_ZOOM_UP);
|
||||
} else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_6AD != 2)) {
|
||||
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 {
|
||||
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) {
|
||||
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->stateFlags1 &= ~PLAYER_STATE1_20;
|
||||
} else {
|
||||
this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y;
|
||||
this->unk_6BE += 5000;
|
||||
this->unk_6B0 = -5000;
|
||||
this->upperLimbRot.y = func_8084ABD8(play, this, true, -5000) - this->actor.shape.rot.y;
|
||||
this->upperLimbRot.y += 5000;
|
||||
this->upperLimbYawSecondary = -5000;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -13242,20 +13265,20 @@ void Player_Action_8084CC98(Player* this, PlayState* play) {
|
|||
if ((this->csAction != PLAYER_CSACTION_NONE) ||
|
||||
(!func_8084C9BC(this, play) && !Player_ActionHandler_13(this, play))) {
|
||||
if (this->focusActor != NULL) {
|
||||
if (func_8002DD78(this) != 0) {
|
||||
this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y;
|
||||
this->unk_6BE = CLAMP(this->unk_6BE, -0x4AAA, 0x4AAA);
|
||||
this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_6BE;
|
||||
this->unk_6BE += 5000;
|
||||
this->unk_6AE |= 0x80;
|
||||
if (func_8002DD78(this)) {
|
||||
this->upperLimbRot.y = func_8083DB98(this, true) - this->actor.shape.rot.y;
|
||||
this->upperLimbRot.y = CLAMP(this->upperLimbRot.y, -0x4AAA, 0x4AAA);
|
||||
this->actor.focus.rot.y = this->actor.shape.rot.y + this->upperLimbRot.y;
|
||||
this->upperLimbRot.y += 5000;
|
||||
this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y;
|
||||
} else {
|
||||
func_8083DB98(this, 0);
|
||||
func_8083DB98(this, false);
|
||||
}
|
||||
} else {
|
||||
if (func_8002DD78(this) != 0) {
|
||||
this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y;
|
||||
this->unk_6BE += 5000;
|
||||
this->unk_6B0 = -5000;
|
||||
if (func_8002DD78(this)) {
|
||||
this->upperLimbRot.y = func_8084ABD8(play, this, true, -5000) - this->actor.shape.rot.y;
|
||||
this->upperLimbRot.y += 5000;
|
||||
this->upperLimbYawSecondary = -5000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14078,7 +14101,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) {
|
|||
}
|
||||
|
||||
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);
|
||||
Player_UpdateUpperBody(this, play);
|
||||
|
||||
this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y;
|
||||
this->unk_6AE |= 0x80;
|
||||
this->upperLimbRot.y = func_8084ABD8(play, this, true, 0) - this->actor.shape.rot.y;
|
||||
this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y;
|
||||
|
||||
if (play->shootingGalleryStatus < 0) {
|
||||
play->shootingGalleryStatus++;
|
||||
|
@ -14536,7 +14559,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) {
|
|||
sp2C = this->actor.world.pos.y - shockwavePos.y;
|
||||
|
||||
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) &&
|
||||
LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) ||
|
||||
|
@ -15154,7 +15177,7 @@ void func_80851314(Player* this) {
|
|||
this->focusActor = this->csActor;
|
||||
|
||||
if (this->focusActor != NULL) {
|
||||
this->actor.shape.rot.y = func_8083DB98(this, 0);
|
||||
this->actor.shape.rot.y = func_8083DB98(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue