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

Player: Special Idle Animations (#2259)

* document special idle anims

* review

* format

* remove SPECIAL_IDLE_ANIMSFX_MAX
This commit is contained in:
fig02 2024-10-05 10:26:15 -04:00 committed by GitHub
parent 6b31fdad53
commit 1d0e243806
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1118,7 +1118,7 @@ static LinkAnimationHeader* D_80853D4C[][3] = {
&gPlayerAnim_link_fighter_Rside_jump_endR }, &gPlayerAnim_link_fighter_Rside_jump_endR },
}; };
static LinkAnimationHeader* sIdleAnimations[][2] = { static LinkAnimationHeader* sSpecialIdleAnimations[][2] = {
{ &gPlayerAnim_link_normal_wait_typeA_20f, &gPlayerAnim_link_normal_waitF_typeA_20f }, { &gPlayerAnim_link_normal_wait_typeA_20f, &gPlayerAnim_link_normal_waitF_typeA_20f },
{ &gPlayerAnim_link_normal_wait_typeC_20f, &gPlayerAnim_link_normal_waitF_typeC_20f }, { &gPlayerAnim_link_normal_wait_typeC_20f, &gPlayerAnim_link_normal_waitF_typeC_20f },
{ &gPlayerAnim_link_normal_wait_typeB_20f, &gPlayerAnim_link_normal_waitF_typeB_20f }, { &gPlayerAnim_link_normal_wait_typeB_20f, &gPlayerAnim_link_normal_waitF_typeB_20f },
@ -1135,23 +1135,23 @@ static LinkAnimationHeader* sIdleAnimations[][2] = {
{ &gPlayerAnim_link_wait_itemD2_20f, &gPlayerAnim_link_wait_itemD2_20f } { &gPlayerAnim_link_wait_itemD2_20f, &gPlayerAnim_link_wait_itemD2_20f }
}; };
static AnimSfxEntry sIdleSneezeSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxSneeze[] = {
{ NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 8) }, { NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 8) },
}; };
static AnimSfxEntry sIdleSweatSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxSweat[] = {
{ NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 18) }, { NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 18) },
}; };
static AnimSfxEntry sIdleHeat1Sfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxHeat1[] = {
{ NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 13) }, { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 13) },
}; };
static AnimSfxEntry sIdleHeat2Sfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxHeat2[] = {
{ NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) }, { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) },
}; };
static AnimSfxEntry sIdleBeltSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxBelt[] = {
{ NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 44) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 44) },
{ NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 48) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 48) },
{ NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 52) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 52) },
@ -1159,80 +1159,96 @@ static AnimSfxEntry sIdleBeltSfx[] = {
{ NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) }, { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) },
}; };
static AnimSfxEntry sIdleFootTappingSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxFootTap[] = {
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 25) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 30) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 25) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 30) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 44) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 48) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 44) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 48) },
{ 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 56) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 56) },
}; };
static AnimSfxEntry sIdleShieldPostureSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxShield[] = {
{ NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 16) }, { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 16) },
{ NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) }, { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) },
{ NA_SE_IT_SHIELD_POSTURE, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 70) }, { NA_SE_IT_SHIELD_POSTURE, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 70) },
}; };
static AnimSfxEntry sIdleUnknownSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxSword1[] = {
{ NA_SE_IT_HAMMER_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 10) }, { NA_SE_IT_HAMMER_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 10) },
{ NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) }, { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) },
{ NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 22) }, { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 22) },
{ NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 22) }, { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 22) },
}; };
static AnimSfxEntry sIdleSwordThrustSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxSword2[] = {
{ NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 39) }, { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 39) },
{ NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 39) }, { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 39) },
}; };
static AnimSfxEntry sIdleRelaxSfx[] = { static AnimSfxEntry sSpecialIdleAnimSfxRelax[] = {
{ NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) }, { NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) },
}; };
typedef enum { typedef enum SpecialIdleAnimSfxType {
/* 0x0 */ IDLE_ANIMATION_SFX_NONE, /* 0x0 */ SPECIAL_IDLE_ANIMSFX_NONE,
/* 0x1 */ IDLE_ANIMATION_SFX_SNEEZE, /* 0x1 */ SPECIAL_IDLE_ANIMSFX_SNEEZE,
/* 0x2 */ IDLE_ANIMATION_SFX_SWEAT, /* 0x2 */ SPECIAL_IDLE_ANIMSFX_SWEAT,
/* 0x3 */ IDLE_ANIMATION_SFX_HEAT_1, /* 0x3 */ SPECIAL_IDLE_ANIMSFX_HEAT_1,
/* 0x4 */ IDLE_ANIMATION_SFX_HEAT_2, /* 0x4 */ SPECIAL_IDLE_ANIMSFX_HEAT_2,
/* 0x5 */ IDLE_ANIMATION_SFX_BELT, /* 0x5 */ SPECIAL_IDLE_ANIMSFX_BELT,
/* 0x6 */ IDLE_ANIMATION_SFX_FOOT_TAPPING, /* 0x6 */ SPECIAL_IDLE_ANIMSFX_FOOT_TAP,
/* 0x7 */ IDLE_ANIMATION_SFX_SHIELD_POSTURE, /* 0x7 */ SPECIAL_IDLE_ANIMSFX_SHIELD,
/* 0x8 */ IDLE_ANIMATION_SFX_UNKNOWN, /* 0x8 */ SPECIAL_IDLE_ANIMSFX_SWORD_1,
/* 0x9 */ IDLE_ANIMATION_SFX_SWORD_THRUST, /* 0x9 */ SPECIAL_IDLE_ANIMSFX_SWORD_2,
/* 0xA */ IDLE_ANIMATION_SFX_RELAX, /* 0xA */ SPECIAL_IDLE_ANIMSFX_RELAX,
/* 0xB */ IDLE_ANIMATION_SFX_MAX } SpecialIdleAnimSfxType;
} IdleAnimationSfxIndex;
static AnimSfxEntry* sIdleSfxEntries[] = { static AnimSfxEntry* sSpecialIdleAnimSfxLists[] = {
sIdleSneezeSfx, // IDLE_ANIMATION_SFX_SNEEZE sSpecialIdleAnimSfxSneeze, // SPECIAL_IDLE_ANIMSFX_SNEEZE
sIdleSweatSfx, // IDLE_ANIMATION_SFX_SWEAT sSpecialIdleAnimSfxSweat, // SPECIAL_IDLE_ANIMSFX_SWEAT
sIdleHeat1Sfx, // IDLE_ANIMATION_SFX_HEAT_1 sSpecialIdleAnimSfxHeat1, // SPECIAL_IDLE_ANIMSFX_HEAT_1
sIdleHeat2Sfx, // IDLE_ANIMATION_SFX_HEAT_2 sSpecialIdleAnimSfxHeat2, // SPECIAL_IDLE_ANIMSFX_HEAT_2
sIdleBeltSfx, // IDLE_ANIMATION_SFX_BELT sSpecialIdleAnimSfxBelt, // SPECIAL_IDLE_ANIMSFX_BELT
sIdleFootTappingSfx, // IDLE_ANIMATION_SFX_FOOT_TAPPING sSpecialIdleAnimSfxFootTap, // SPECIAL_IDLE_ANIMSFX_FOOT_TAP
sIdleShieldPostureSfx, // IDLE_ANIMATION_SFX_SHIELD_POSTURE sSpecialIdleAnimSfxShield, // SPECIAL_IDLE_ANIMSFX_SHIELD
sIdleUnknownSfx, // IDLE_ANIMATION_SFX_UNKNOWN sSpecialIdleAnimSfxSword1, // SPECIAL_IDLE_ANIMSFX_SWORD_1
sIdleSwordThrustSfx, // IDLE_ANIMATION_SFX_SWORD_THRUST sSpecialIdleAnimSfxSword2, // SPECIAL_IDLE_ANIMSFX_SWORD_2
sIdleRelaxSfx, // IDLE_ANIMATION_SFX_RELAX sSpecialIdleAnimSfxRelax, // SPECIAL_IDLE_ANIMSFX_RELAX
NULL, // IDLE_ANIMATION_SFX_MAX NULL, // unused entry
}; };
/** /**
* The indices in this array correspond 1 to 1 with the entries of sIdleAnimations. * The indices in this array correspond 1 to 1 with the entries of sSpecialIdleAnimations.
* There is also an extra IDLE_ANIMATION_SFX_NONE at the end that doesn't correspond to any animation. * There is also an extra SPECIAL_IDLE_ANIMSFX_NONE at the end that doesn't correspond to any animation.
*
* @see sIdleAnimations for all the animations that correspond to this array
*/ */
static u8 sIdleSfxEntryIndices[] = { static u8 sSpecialIdleAnimSfxTypes[] = {
IDLE_ANIMATION_SFX_NONE, IDLE_ANIMATION_SFX_NONE, IDLE_ANIMATION_SFX_SNEEZE, SPECIAL_IDLE_ANIMSFX_NONE, // used by gPlayerAnim_link_normal_wait_typeA_20f
IDLE_ANIMATION_SFX_SNEEZE, IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_SWEAT, SPECIAL_IDLE_ANIMSFX_NONE, // used by gPlayerAnim_link_normal_waitF_typeA_20f
IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_RELAX, SPECIAL_IDLE_ANIMSFX_SNEEZE, // used by gPlayerAnim_link_normal_wait_typeC_20f
IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX, SPECIAL_IDLE_ANIMSFX_SNEEZE, // used by gPlayerAnim_link_normal_waitF_typeC_20f
IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_HEAT_1, SPECIAL_IDLE_ANIMSFX_SWEAT, // used by gPlayerAnim_link_normal_wait_typeB_20f
IDLE_ANIMATION_SFX_HEAT_1, IDLE_ANIMATION_SFX_HEAT_2, IDLE_ANIMATION_SFX_HEAT_2, SPECIAL_IDLE_ANIMSFX_SWEAT, // used by gPlayerAnim_link_normal_waitF_typeB_20f
IDLE_ANIMATION_SFX_UNKNOWN, IDLE_ANIMATION_SFX_UNKNOWN, IDLE_ANIMATION_SFX_BELT, SPECIAL_IDLE_ANIMSFX_SWEAT, // used by gPlayerAnim_link_normal_wait_typeB_20f
IDLE_ANIMATION_SFX_BELT, IDLE_ANIMATION_SFX_FOOT_TAPPING, IDLE_ANIMATION_SFX_FOOT_TAPPING, SPECIAL_IDLE_ANIMSFX_SWEAT, // used by gPlayerAnim_link_normal_waitF_typeB_20f
IDLE_ANIMATION_SFX_SHIELD_POSTURE, IDLE_ANIMATION_SFX_SHIELD_POSTURE, IDLE_ANIMATION_SFX_SWORD_THRUST, SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_wait_typeD_20f
IDLE_ANIMATION_SFX_SWORD_THRUST, IDLE_ANIMATION_SFX_NONE, SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_waitF_typeD_20f
SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_wait_typeD_20f
SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_waitF_typeD_20f
SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_wait_typeD_20f
SPECIAL_IDLE_ANIMSFX_RELAX, // used by gPlayerAnim_link_waitF_typeD_20f
SPECIAL_IDLE_ANIMSFX_HEAT_1, // used by gPlayerAnim_link_wait_heat1_20f
SPECIAL_IDLE_ANIMSFX_HEAT_1, // used by gPlayerAnim_link_waitF_heat1_20f
SPECIAL_IDLE_ANIMSFX_HEAT_2, // used by gPlayerAnim_link_wait_heat2_20f
SPECIAL_IDLE_ANIMSFX_HEAT_2, // used by gPlayerAnim_link_waitF_heat2_20f
SPECIAL_IDLE_ANIMSFX_SWORD_1, // used by gPlayerAnim_link_wait_itemD1_20f
SPECIAL_IDLE_ANIMSFX_SWORD_1, // used by gPlayerAnim_link_wait_itemD1_20f
SPECIAL_IDLE_ANIMSFX_BELT, // used by gPlayerAnim_link_wait_itemA_20f
SPECIAL_IDLE_ANIMSFX_BELT, // used by gPlayerAnim_link_waitF_itemA_20f
SPECIAL_IDLE_ANIMSFX_FOOT_TAP, // used by gPlayerAnim_link_wait_itemB_20f
SPECIAL_IDLE_ANIMSFX_FOOT_TAP, // used by gPlayerAnim_link_waitF_itemB_20f
SPECIAL_IDLE_ANIMSFX_SHIELD, // used by gPlayerAnim_link_wait_itemC_20f
SPECIAL_IDLE_ANIMSFX_SHIELD, // used by gPlayerAnim_link_wait_itemC_20f
SPECIAL_IDLE_ANIMSFX_SWORD_2, // used by gPlayerAnim_link_wait_itemD2_20f
SPECIAL_IDLE_ANIMSFX_SWORD_2, // used by gPlayerAnim_link_wait_itemD2_20f
SPECIAL_IDLE_ANIMSFX_NONE, // unused, doesnt correspond to any animation
}; };
// Used to map item IDs to item actions // Used to map item IDs to item actions
@ -2174,29 +2190,43 @@ void func_808332F4(Player* this, PlayState* play) {
this->unk_862 = ABS(giEntry->gi); this->unk_862 = ABS(giEntry->gi);
} }
LinkAnimationHeader* Player_GetIdleAnimationForCurrentModelAnimType(Player* this) { /**
* Get the appropriate Idle animation based on current `modelAnimType`.
* This is used as the "primary" idle animation.
*
* For special idle animations (which for example, change based on environment)
* see `sSpecialIdleAnimations`.
*/
LinkAnimationHeader* Player_GetIdleAnim(Player* this) {
return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType); return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType);
} }
s32 func_80833350(Player* this) { /**
if (Player_GetIdleAnimationForCurrentModelAnimType(this) != this->skelAnime.animation) { * Checks if the current animation is a "special" idle animation.
LinkAnimationHeader** entry; * If it is, the index into `sSpecialIdleAnimations` is returned (plus one).
* If the current animation is a "primary" idle animation, -1 is returned.
* Lastly if the current animation is neither of these, 0 is returned.
*/
s32 Player_CheckSpecialIdleAnim(Player* this) {
if (Player_GetIdleAnim(this) != this->skelAnime.animation) {
LinkAnimationHeader** specialAnim;
s32 i; s32 i;
for (i = 0, entry = &sIdleAnimations[0][0]; i < 28; i++, entry++) { for (i = 0, specialAnim = &sSpecialIdleAnimations[0][0]; i < 28; i++, specialAnim++) {
if (this->skelAnime.animation == *entry) { if (this->skelAnime.animation == *specialAnim) {
return i + 1; return i + 1;
} }
} }
return 0; return 0;
} }
return -1; return -1;
} }
void Player_ProcessIdleAnimSfxList(Player* this, s32 arg1) { void Player_ProcessSpecialIdleAnimSfxList(Player* this, s32 specialIdleAnimIndex) {
if (sIdleSfxEntryIndices[arg1] != IDLE_ANIMATION_SFX_NONE) { if (sSpecialIdleAnimSfxTypes[specialIdleAnimIndex] != SPECIAL_IDLE_ANIMSFX_NONE) {
Player_ProcessAnimSfxList(this, sIdleSfxEntries[sIdleSfxEntryIndices[arg1] - 1]); Player_ProcessAnimSfxList(this, sSpecialIdleAnimSfxLists[sSpecialIdleAnimSfxTypes[specialIdleAnimIndex] - 1]);
} }
} }
@ -2866,9 +2896,9 @@ s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
return this->upperActionFunc(this, play); return this->upperActionFunc(this, play);
} }
if (func_80833350(this) != 0) { if (Player_CheckSpecialIdleAnim(this) != 0) {
Player_WaitToFinishItemChange(play, this); Player_WaitToFinishItemChange(play, this);
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
this->unk_6AC = 0; this->unk_6AC = 0;
} else { } else {
Player_WaitToFinishItemChange(play, this); Player_WaitToFinishItemChange(play, this);
@ -3062,7 +3092,7 @@ s32 func_808351D4(Player* this, PlayState* play) {
Math_ScaledStepToS(&this->unk_6C0, 1200, 400); Math_ScaledStepToS(&this->unk_6C0, 1200, 400);
this->unk_6AE |= 0x100; this->unk_6AE |= 0x100;
if ((this->unk_836 == 0) && (func_80833350(this) == 0) && if ((this->unk_836 == 0) && (Player_CheckSpecialIdleAnim(this) == 0) &&
(this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) {
LinkAnimation_PlayOnce(play, &this->upperSkelAnime, D_808543CC[sp2C]); LinkAnimation_PlayOnce(play, &this->upperSkelAnime, D_808543CC[sp2C]);
this->unk_836 = -1; this->unk_836 = -1;
@ -3612,14 +3642,14 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
if (this->upperAnimInterpWeight != 0.0f) { if (this->upperAnimInterpWeight != 0.0f) {
// The functionality contained within this block of code is never used in practice // The functionality contained within this block of code is never used in practice
// because `upperAnimInterpWeight` is always 0. // because `upperAnimInterpWeight` is always 0.
if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { if ((Player_CheckSpecialIdleAnim(this) == 0) || (this->speedXZ != 0.0f)) {
AnimTaskQueue_AddCopyUsingMapInverted(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable, AnimTaskQueue_AddCopyUsingMapInverted(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable,
this->skelAnime.jointTable, sUpperBodyLimbCopyMap); this->skelAnime.jointTable, sUpperBodyLimbCopyMap);
} }
Math_StepToF(&this->upperAnimInterpWeight, 0.0f, 0.25f); Math_StepToF(&this->upperAnimInterpWeight, 0.0f, 0.25f);
AnimTaskQueue_AddInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, AnimTaskQueue_AddInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->upperSkelAnime.jointTable, 1.0f - this->upperAnimInterpWeight); this->upperSkelAnime.jointTable, 1.0f - this->upperAnimInterpWeight);
} else if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { } else if ((Player_CheckSpecialIdleAnim(this) == 0) || (this->speedXZ != 0.0f)) {
// Only copy the upper body animation to the upper body limbs in the main skeleton. // Only copy the upper body animation to the upper body limbs in the main skeleton.
// Doing so allows the main skeleton to play its own animation for the lower body limbs. // Doing so allows the main skeleton to play its own animation for the lower body limbs.
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable, AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
@ -4967,7 +4997,7 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) {
this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x;
this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z;
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
} }
void func_80838F18(PlayState* play, Player* this) { void func_80838F18(PlayState* play, Player* this) {
@ -5287,7 +5317,7 @@ s32 Player_ActionHandler_1(Player* this, PlayState* play) {
if (this->doorTimer != 0) { if (this->doorTimer != 0) {
this->av2.actionVar2 = 0; this->av2.actionVar2 = 0;
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this));
this->skelAnime.endFrame = 0.0f; this->skelAnime.endFrame = 0.0f;
} else { } else {
this->speedXZ = 0.1f; this->speedXZ = 0.1f;
@ -5429,7 +5459,7 @@ void func_80839E88(Player* this, PlayState* play) {
void func_80839F30(Player* this, PlayState* play) { void func_80839F30(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_808407CC, 1); Player_SetupAction(play, this, Player_Action_808407CC, 1);
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this));
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
} }
@ -5905,7 +5935,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) {
} else { } else {
Player_SetupAction(play, this, Player_Action_8085063C, 1); Player_SetupAction(play, this, Player_Action_8085063C, 1);
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
func_80835EA4(play, 4); func_80835EA4(play, 4);
} }
@ -6315,7 +6345,7 @@ void func_8083C0B8(Player* this, PlayState* play) {
void func_8083C0E8(Player* this, PlayState* play) { void func_8083C0E8(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_SetupAction(play, this, Player_Action_80840BC8, 1);
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
} }
@ -7986,7 +8016,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) { if (LinkAnimation_Update(play, &this->skelAnime)) {
Player_FinishAnimMovement(this); Player_FinishAnimMovement(this);
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
} }
func_8083721C(this); func_8083721C(this);
@ -8051,11 +8081,11 @@ void func_808409CC(PlayState* play, Player* this) {
if ((this->focusActor != NULL) || if ((this->focusActor != NULL) ||
(!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { (!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) {
this->stateFlags2 &= ~PLAYER_STATE2_28; this->stateFlags2 &= ~PLAYER_STATE2_28;
anim = Player_GetIdleAnimationForCurrentModelAnimType(this); anim = Player_GetIdleAnim(this);
} else { } else {
this->stateFlags2 |= PLAYER_STATE2_28; this->stateFlags2 |= PLAYER_STATE2_28;
if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) {
anim = Player_GetIdleAnimationForCurrentModelAnimType(this); anim = Player_GetIdleAnim(this);
} else { } else {
sp38 = play->roomCtx.curRoom.behaviorType2; sp38 = play->roomCtx.curRoom.behaviorType2;
if (heathIsCritical) { if (heathIsCritical) {
@ -8077,9 +8107,9 @@ void func_808409CC(PlayState* play, Player* this) {
} }
} }
} }
animPtr = &sIdleAnimations[sp38][0]; animPtr = &sSpecialIdleAnimations[sp38][0];
if (this->modelAnimType != PLAYER_ANIMTYPE_1) { if (this->modelAnimType != PLAYER_ANIMTYPE_1) {
animPtr = &sIdleAnimations[sp38][1]; animPtr = &sSpecialIdleAnimations[sp38][1];
} }
anim = *animPtr; anim = *animPtr;
} }
@ -8090,14 +8120,14 @@ void func_808409CC(PlayState* play, Player* this) {
} }
void Player_Action_80840BC8(Player* this, PlayState* play) { void Player_Action_80840BC8(Player* this, PlayState* play) {
s32 idleAnimationToChangeToPlusOne = func_80833350(this); s32 specialIdleAnimIndex = Player_CheckSpecialIdleAnim(this);
s32 sp40 = LinkAnimation_Update(play, &this->skelAnime); s32 sp40 = LinkAnimation_Update(play, &this->skelAnime);
f32 speedTarget; f32 speedTarget;
s16 yawTarget; s16 yawTarget;
s16 temp; s16 temp;
if (idleAnimationToChangeToPlusOne > 0) { if (specialIdleAnimIndex > 0) {
Player_ProcessIdleAnimSfxList(this, idleAnimationToChangeToPlusOne - 1); Player_ProcessSpecialIdleAnimSfxList(this, specialIdleAnimIndex - 1);
} }
if (sp40 != 0) { if (sp40 != 0) {
@ -8142,7 +8172,7 @@ void Player_Action_80840BC8(Player* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200); Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200);
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
if (Player_GetIdleAnimationForCurrentModelAnimType(this) == this->skelAnime.animation) { if (Player_GetIdleAnim(this) == this->skelAnime.animation) {
func_8083DC54(this, play); func_8083DC54(this, play);
} }
} }
@ -8461,8 +8491,8 @@ void Player_Action_80841BA8(Player* this, PlayState* play) {
LinkAnimation_Update(play, &this->skelAnime); LinkAnimation_Update(play, &this->skelAnime);
if (Player_HoldsTwoHandedWeapon2(this)) { if (Player_HoldsTwoHandedWeapon2(this)) {
AnimTaskQueue_AddLoadPlayerFrame(play, Player_GetIdleAnimationForCurrentModelAnimType(this), 0, AnimTaskQueue_AddLoadPlayerFrame(play, Player_GetIdleAnim(this), 0, this->skelAnime.limbCount,
this->skelAnime.limbCount, this->skelAnime.morphTable); this->skelAnime.morphTable);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable, AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->skelAnime.morphTable, sUpperBodyLimbCopyMap); this->skelAnime.morphTable, sUpperBodyLimbCopyMap);
} }
@ -10418,8 +10448,8 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe
SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType), SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType),
9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX); 9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX);
this->skelAnime.baseTransl = sSkeletonBaseTransl; this->skelAnime.baseTransl = sSkeletonBaseTransl;
SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, Player_GetIdleAnimationForCurrentModelAnimType(this), 9, SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, Player_GetIdleAnim(this), 9, this->upperJointTable,
this->upperJointTable, this->upperMorphTable, PLAYER_LIMB_MAX); this->upperMorphTable, PLAYER_LIMB_MAX);
this->upperSkelAnime.baseTransl = sSkeletonBaseTransl; this->upperSkelAnime.baseTransl = sSkeletonBaseTransl;
Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C); Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C);
@ -12277,7 +12307,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) {
} }
this->stateFlags1 |= PLAYER_STATE1_20; this->stateFlags1 |= PLAYER_STATE1_20;
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this));
Player_ZeroSpeedXZ(this); Player_ZeroSpeedXZ(this);
func_8083B010(this); func_8083B010(this);
return 1; return 1;
@ -12344,7 +12374,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) {
if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) {
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free);
} else { } else {
Player_AnimPlayLoop(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayLoop(play, this, Player_GetIdleAnim(this));
} }
} else { } else {
Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_talk_free_wait); Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_talk_free_wait);
@ -15832,7 +15862,7 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction) {
void func_80853080(Player* this, PlayState* play) { void func_80853080(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_SetupAction(play, this, Player_Action_80840BC8, 1);
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this));
this->yaw = this->actor.shape.rot.y; this->yaw = this->actor.shape.rot.y;
} }
@ -15890,7 +15920,7 @@ void func_80853148(PlayState* play, Actor* actor) {
if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) {
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace);
} else { } else {
Player_AnimPlayLoop(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this)); Player_AnimPlayLoop(play, this, Player_GetIdleAnim(this));
} }
} }
} else { } else {