1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 01:34:18 +00:00

Merge branch 'main' into doc_pause_menu

This commit is contained in:
Dragorn421 2024-10-10 10:42:52 +02:00
commit 1c12ec2d16
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
7 changed files with 233 additions and 178 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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);

View file

@ -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) {

View file

@ -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)) {
@ -3453,23 +3453,41 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun
return 1;
}
void func_80835DAC(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 temp;
/**
* Calls `Player_SetupAction` to setup a new action, but takes extra measures to
* preserve AnimMovement while doing so.
*/
void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 savedMovementFlags;
temp = this->skelAnime.movementFlags;
savedMovementFlags = this->skelAnime.movementFlags;
// Setting `skelAnime.movementFlags` to 0 will prevent `Player_FinishAnimMovement` from ending
// AnimMovement when `Player_SetupAction` is called.
this->skelAnime.movementFlags = 0;
Player_SetupAction(play, this, actionFunc, flags);
this->skelAnime.movementFlags = temp;
this->skelAnime.movementFlags = savedMovementFlags;
}
void func_80835DE4(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 temp;
/**
* Calls `Player_SetupAction` to setup a new action, but takes extra measures to
* preserve the current itemAction while doing so.
*
* Note that `itemAction` must be PLAYER_IA_NONE or higher for the action change to take place.
*/
void Player_SetupActionPreserveItemAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) {
s32 savedItemAction;
if (this->itemAction >= 0) {
temp = this->itemAction;
if (this->itemAction >= PLAYER_IA_NONE) {
savedItemAction = this->itemAction;
// Setting `itemAction` to `heldItemAction` will prevent `func_8008EC70` from running when
// `Player_SetupAction` is called.
this->itemAction = this->heldItemAction;
Player_SetupAction(play, this, actionFunc, flags);
this->itemAction = temp;
this->itemAction = savedItemAction;
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction));
}
}
@ -3675,7 +3693,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 +3781,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 +4279,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;
}
@ -5597,7 +5635,7 @@ void func_8083A0F4(PlayState* play, Player* this) {
}
void func_8083A2F8(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084B530, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084B530, 0);
this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29;
@ -5608,7 +5646,7 @@ void func_8083A2F8(PlayState* play, Player* this) {
}
void func_8083A360(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084CC98, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084CC98, 0);
}
void func_8083A388(PlayState* play, Player* this) {
@ -5619,7 +5657,7 @@ void func_8083A3B0(PlayState* play, Player* this) {
s32 sp1C = this->av2.actionVar2;
s32 sp18 = this->av1.actionVar1;
func_80835DAC(play, this, Player_Action_8084BF1C, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084BF1C, 0);
this->actor.velocity.y = 0.0f;
this->av2.actionVar2 = sp1C;
@ -5627,11 +5665,11 @@ void func_8083A3B0(PlayState* play, Player* this) {
}
void func_8083A40C(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084C760, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C760, 0);
}
void func_8083A434(PlayState* play, Player* this) {
func_80835DAC(play, this, Player_Action_8084E6D4, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084E6D4, 0);
this->stateFlags1 |= PLAYER_STATE1_10 | PLAYER_STATE1_29;
@ -5902,7 +5940,7 @@ void func_8083AE40(Player* this, s16 objectId) {
}
void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
func_80835DE4(play, this, Player_Action_808507F4, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_808507F4, 0);
this->av1.actionVar1 = magicSpell - 3;
@ -5925,8 +5963,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;
}
@ -6005,7 +6043,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
(this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) {
if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) {
func_80835DE4(play, this, Player_Action_8084F104, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084F104, 0);
if (sp2C >= 0) {
giEntry = &sGetItemTable[D_80854528[sp2C] - 1];
@ -6032,7 +6070,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
(this->itemAction == PLAYER_IA_MAGIC_BEAN))) {
if (this->exchangeItemId == EXCH_ITEM_MAGIC_BEAN) {
Inventory_ChangeAmmo(ITEM_MAGIC_BEAN, -1);
func_80835DE4(play, this, Player_Action_8084279C, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084279C, 0);
this->stateFlags1 |= PLAYER_STATE1_29;
this->av2.actionVar2 = 0x50;
this->av1.actionVar1 = -1;
@ -6067,20 +6105,20 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
sp2C = Player_ActionToBottle(this, this->itemAction);
if (sp2C >= 0) {
if (sp2C == 0xC) {
func_80835DE4(play, this, Player_Action_8084EED8, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EED8, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out);
func_80835EA4(play, 3);
} else if ((sp2C > 0) && (sp2C < 4)) {
func_80835DE4(play, this, Player_Action_8084EFC0, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EFC0, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out);
func_80835EA4(play, (sp2C == 1) ? 1 : 5);
} else {
func_80835DE4(play, this, Player_Action_8084EAC0, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EAC0, 0);
Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start);
func_80835EA4(play, 2);
}
} else {
func_80835DE4(play, this, Player_Action_8084E3C4, 0);
Player_SetupActionPreserveItemAction(play, this, Player_Action_8084E3C4, 0);
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start);
this->stateFlags2 |= PLAYER_STATE2_27;
func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A);
@ -6472,7 +6510,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 +7057,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 +7086,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 +7111,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);
}
@ -7517,7 +7558,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
}
void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) {
func_80835DAC(play, this, Player_Action_8084C5F8, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C5F8, 0);
LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f));
}
@ -7854,10 +7895,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) {
@ -8080,7 +8121,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) {
}
if (!Player_FriendlyLockOnOrParallel(this)) {
func_80835DAC(play, this, Player_Action_80840BC8, 1);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_80840BC8, 1);
this->yaw = this->actor.shape.rot.y;
return;
}
@ -8868,7 +8909,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 +9145,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 +9194,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 +10742,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 +12275,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 +12297,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 +12418,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 +12512,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);
}
}
@ -13007,7 +13048,7 @@ s32 func_8084C9BC(Player* this, PlayState* play) {
if (EN_HORSE_CHECK_1(rideActor) ||
(EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) {
rideActor->actor.child = NULL;
func_80835DAC(play, this, Player_Action_8084D3E4, 0);
Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084D3E4, 0);
this->unk_878 = sp34 - rideActor->actor.world.pos.y;
Player_AnimPlayOnce(play, this,
(this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down
@ -13232,9 +13273,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 +13283,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 +14119,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 +14299,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 +14577,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 +15195,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);
}
}

View file

@ -781,23 +781,31 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
// Quad PAGE_BG_QUADS + WORLD_MAP_QUAD_28
pauseCtx->mapPageVtx[43 * 4 + 0].v.ob[0] = pauseCtx->mapPageVtx[43 * 4 + 2].v.ob[0] =
areaBoxPosX[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 0].v.ob[0] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 2].v.ob[0] =
areaBoxPosX[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[43 * 4 + 1].v.ob[0] = pauseCtx->mapPageVtx[43 * 4 + 3].v.ob[0] =
pauseCtx->mapPageVtx[43 * 4 + 0].v.ob[0] + areaBoxWidths[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 1].v.ob[0] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 3].v.ob[0] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 0].v.ob[0] +
areaBoxWidths[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[43 * 4 + 0].v.ob[1] = pauseCtx->mapPageVtx[43 * 4 + 1].v.ob[1] =
areaBoxPosY[((void)0, gSaveContext.worldMapArea)] + pauseCtx->pagesYOrigin1;
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 0].v.ob[1] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 1].v.ob[1] =
areaBoxPosY[((void)0, gSaveContext.worldMapArea)] + pauseCtx->pagesYOrigin1;
pauseCtx->mapPageVtx[43 * 4 + 2].v.ob[1] = pauseCtx->mapPageVtx[43 * 4 + 3].v.ob[1] =
pauseCtx->mapPageVtx[43 * 4 + 0].v.ob[1] - areaBoxHeights[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 2].v.ob[1] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 3].v.ob[1] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 0].v.ob[1] -
areaBoxHeights[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[43 * 4 + 1].v.tc[0] = pauseCtx->mapPageVtx[43 * 4 + 3].v.tc[0] =
areaBoxWidths[((void)0, gSaveContext.worldMapArea)] << 5;
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 1].v.tc[0] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 3].v.tc[0] =
areaBoxWidths[((void)0, gSaveContext.worldMapArea)] << 5;
pauseCtx->mapPageVtx[43 * 4 + 2].v.tc[1] = pauseCtx->mapPageVtx[43 * 4 + 3].v.tc[1] =
areaBoxHeights[((void)0, gSaveContext.worldMapArea)] << 5;
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 2].v.tc[1] =
pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4 + 3].v.tc[1] =
areaBoxHeights[((void)0, gSaveContext.worldMapArea)] << 5;
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[(PAGE_BG_QUADS + WORLD_MAP_QUAD_28) * 4], 4, 0);

View file

@ -2634,7 +2634,7 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num
}
if (vtxPage == VTX_PAGE_MAP_WORLD) {
// For world map page, initialize vtx beyond VTX_PAGE_MAP_WORLD_QUADS
// WORLD_MAP_QUAD_TRADE_QUEST_MARKER
bufI -= ((VTX_PAGE_MAP_WORLD_QUADS - WORLD_MAP_QUAD_TRADE_QUEST_MARKER) * 4);
@ -2650,7 +2650,7 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num
vtx[bufI + 2].v.ob[1] = vtx[bufI + 3].v.ob[1] = vtx[bufI + 0].v.ob[1] - sVtxMapWorldAreaHeight[j];
bufI += (3 * 4);
bufI += ((VTX_PAGE_MAP_WORLD_QUADS - WORLD_MAP_QUAD_TRADE_QUEST_MARKER) * 4);
if (pauseCtx->tradeQuestMarker != TRADE_QUEST_MARKER_NONE) {
if (sTradeQuestMarkerBobTimer == 0) {