1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +00:00

Partially document idle animations (#2092)

* Idle animation sfx entries

* Function & array

* Cleanup

* I always forget format

* Remove entry from names

* Move comment

* Replace animation "indices" with comment

* Apply suggestion
This commit is contained in:
Pepe20129 2024-09-22 21:08:38 +02:00 committed by GitHub
parent fcd5745d40
commit ebd2b8dd50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1117,7 +1117,7 @@ static LinkAnimationHeader* D_80853D4C[][3] = {
&gPlayerAnim_link_fighter_Rside_jump_endR },
};
static LinkAnimationHeader* D_80853D7C[][2] = {
static LinkAnimationHeader* sIdleAnimations[][2] = {
{ &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_typeB_20f, &gPlayerAnim_link_normal_waitF_typeB_20f },
@ -1134,23 +1134,23 @@ static LinkAnimationHeader* D_80853D7C[][2] = {
{ &gPlayerAnim_link_wait_itemD2_20f, &gPlayerAnim_link_wait_itemD2_20f }
};
static AnimSfxEntry D_80853DEC[] = {
static AnimSfxEntry sIdleSneezeSfx[] = {
{ NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 8) },
};
static AnimSfxEntry D_80853DF0[] = {
static AnimSfxEntry sIdleSweatSfx[] = {
{ NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 18) },
};
static AnimSfxEntry D_80853DF4[] = {
static AnimSfxEntry sIdleHeat1Sfx[] = {
{ NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 13) },
};
static AnimSfxEntry D_80853DF8[] = {
static AnimSfxEntry sIdleHeat2Sfx[] = {
{ NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) },
};
static AnimSfxEntry D_80853DFC[] = {
static AnimSfxEntry sIdleBeltSfx[] = {
{ 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, 52) },
@ -1158,41 +1158,80 @@ static AnimSfxEntry D_80853DFC[] = {
{ NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) },
};
static AnimSfxEntry D_80853E10[] = {
static AnimSfxEntry sIdleFootTappingSfx[] = {
{ 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, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 56) },
};
static AnimSfxEntry D_80853E28[] = {
static AnimSfxEntry sIdleShieldPostureSfx[] = {
{ 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, 70) },
};
static AnimSfxEntry D_80853E34[] = {
static AnimSfxEntry sIdleUnknownSfx[] = {
{ 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_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 22) },
{ NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 22) },
};
static AnimSfxEntry D_80853E44[] = {
static AnimSfxEntry sIdleSwordThrustSfx[] = {
{ NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 39) },
{ NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 39) },
};
static AnimSfxEntry D_80853E4C[] = {
static AnimSfxEntry sIdleRelaxSfx[] = {
{ NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) },
};
static AnimSfxEntry* D_80853E50[] = {
D_80853DEC, D_80853DF0, D_80853DF4, D_80853DF8, D_80853DFC, D_80853E10,
D_80853E28, D_80853E34, D_80853E44, D_80853E4C, NULL,
typedef enum {
/* 0x0 */ IDLE_ANIMATION_SFX_NONE,
/* 0x1 */ IDLE_ANIMATION_SFX_SNEEZE,
/* 0x2 */ IDLE_ANIMATION_SFX_SWEAT,
/* 0x3 */ IDLE_ANIMATION_SFX_HEAT_1,
/* 0x4 */ IDLE_ANIMATION_SFX_HEAT_2,
/* 0x5 */ IDLE_ANIMATION_SFX_BELT,
/* 0x6 */ IDLE_ANIMATION_SFX_FOOT_TAPPING,
/* 0x7 */ IDLE_ANIMATION_SFX_SHIELD_POSTURE,
/* 0x8 */ IDLE_ANIMATION_SFX_UNKNOWN,
/* 0x9 */ IDLE_ANIMATION_SFX_SWORD_THRUST,
/* 0xA */ IDLE_ANIMATION_SFX_RELAX,
/* 0xB */ IDLE_ANIMATION_SFX_MAX
} IdleAnimationSfxIndex;
static AnimSfxEntry* sIdleSfxEntries[] = {
sIdleSneezeSfx, // IDLE_ANIMATION_SFX_SNEEZE
sIdleSweatSfx, // IDLE_ANIMATION_SFX_SWEAT
sIdleHeat1Sfx, // IDLE_ANIMATION_SFX_HEAT_1
sIdleHeat2Sfx, // IDLE_ANIMATION_SFX_HEAT_2
sIdleBeltSfx, // IDLE_ANIMATION_SFX_BELT
sIdleFootTappingSfx, // IDLE_ANIMATION_SFX_FOOT_TAPPING
sIdleShieldPostureSfx, // IDLE_ANIMATION_SFX_SHIELD_POSTURE
sIdleUnknownSfx, // IDLE_ANIMATION_SFX_UNKNOWN
sIdleSwordThrustSfx, // IDLE_ANIMATION_SFX_SWORD_THRUST
sIdleRelaxSfx, // IDLE_ANIMATION_SFX_RELAX
NULL, // IDLE_ANIMATION_SFX_MAX
};
static u8 D_80853E7C[] = {
0, 0, 1, 1, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 3, 3, 4, 4, 8, 8, 5, 5, 6, 6, 7, 7, 9, 9, 0,
/**
* The indices in this array correspond 1 to 1 with the entries of sIdleAnimations.
* There is also an extra IDLE_ANIMATION_SFX_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[] = {
IDLE_ANIMATION_SFX_NONE, IDLE_ANIMATION_SFX_NONE, IDLE_ANIMATION_SFX_SNEEZE,
IDLE_ANIMATION_SFX_SNEEZE, IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_SWEAT,
IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_SWEAT, IDLE_ANIMATION_SFX_RELAX,
IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX,
IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_RELAX, IDLE_ANIMATION_SFX_HEAT_1,
IDLE_ANIMATION_SFX_HEAT_1, IDLE_ANIMATION_SFX_HEAT_2, IDLE_ANIMATION_SFX_HEAT_2,
IDLE_ANIMATION_SFX_UNKNOWN, IDLE_ANIMATION_SFX_UNKNOWN, IDLE_ANIMATION_SFX_BELT,
IDLE_ANIMATION_SFX_BELT, IDLE_ANIMATION_SFX_FOOT_TAPPING, IDLE_ANIMATION_SFX_FOOT_TAPPING,
IDLE_ANIMATION_SFX_SHIELD_POSTURE, IDLE_ANIMATION_SFX_SHIELD_POSTURE, IDLE_ANIMATION_SFX_SWORD_THRUST,
IDLE_ANIMATION_SFX_SWORD_THRUST, IDLE_ANIMATION_SFX_NONE,
};
// Used to map item IDs to item actions
@ -2078,16 +2117,16 @@ void func_808332F4(Player* this, PlayState* play) {
this->unk_862 = ABS(giEntry->gi);
}
LinkAnimationHeader* func_80833338(Player* this) {
LinkAnimationHeader* Player_GetIdleAnimationForCurrentModelAnimType(Player* this) {
return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType);
}
s32 func_80833350(Player* this) {
if (func_80833338(this) != this->skelAnime.animation) {
if (Player_GetIdleAnimationForCurrentModelAnimType(this) != this->skelAnime.animation) {
LinkAnimationHeader** entry;
s32 i;
for (i = 0, entry = &D_80853D7C[0][0]; i < 28; i++, entry++) {
for (i = 0, entry = &sIdleAnimations[0][0]; i < 28; i++, entry++) {
if (this->skelAnime.animation == *entry) {
return i + 1;
}
@ -2098,9 +2137,9 @@ s32 func_80833350(Player* this) {
return -1;
}
void func_808333FC(Player* this, s32 arg1) {
if (D_80853E7C[arg1] != 0) {
Player_ProcessAnimSfxList(this, D_80853E50[D_80853E7C[arg1] - 1]);
void Player_ProcessIdleAnimSfxList(Player* this, s32 arg1) {
if (sIdleSfxEntryIndices[arg1] != IDLE_ANIMATION_SFX_NONE) {
Player_ProcessAnimSfxList(this, sIdleSfxEntries[sIdleSfxEntryIndices[arg1] - 1]);
}
}
@ -2751,7 +2790,7 @@ s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) {
if (func_80833350(this) != 0) {
Player_WaitToFinishItemChange(play, this);
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
this->unk_6AC = 0;
} else {
Player_WaitToFinishItemChange(play, this);
@ -4776,7 +4815,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.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z;
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
}
void func_80838F18(PlayState* play, Player* this) {
@ -5096,7 +5135,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) {
if (this->doorTimer != 0) {
this->av2.actionVar2 = 0;
Player_AnimChangeOnceMorph(play, this, func_80833338(this));
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
this->skelAnime.endFrame = 0.0f;
} else {
this->speedXZ = 0.1f;
@ -5238,7 +5277,7 @@ void func_80839E88(Player* this, PlayState* play) {
void func_80839F30(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_808407CC, 1);
Player_AnimChangeOnceMorph(play, this, func_80833338(this));
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
this->yaw = this->actor.shape.rot.y;
}
@ -5713,7 +5752,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) {
} else {
Player_SetupAction(play, this, Player_Action_8085063C, 1);
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
func_80835EA4(play, 4);
}
@ -6091,7 +6130,7 @@ void func_8083C0B8(Player* this, PlayState* play) {
void func_8083C0E8(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_80840BC8, 1);
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
this->yaw = this->actor.shape.rot.y;
}
@ -7736,7 +7775,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
func_80832DBC(this);
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
}
func_8083721C(this);
@ -7801,11 +7840,11 @@ void func_808409CC(PlayState* play, Player* this) {
if ((this->focusActor != NULL) ||
(!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) {
this->stateFlags2 &= ~PLAYER_STATE2_28;
anim = func_80833338(this);
anim = Player_GetIdleAnimationForCurrentModelAnimType(this);
} else {
this->stateFlags2 |= PLAYER_STATE2_28;
if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) {
anim = func_80833338(this);
anim = Player_GetIdleAnimationForCurrentModelAnimType(this);
} else {
sp38 = play->roomCtx.curRoom.behaviorType2;
if (heathIsCritical) {
@ -7827,9 +7866,9 @@ void func_808409CC(PlayState* play, Player* this) {
}
}
}
animPtr = &D_80853D7C[sp38][0];
animPtr = &sIdleAnimations[sp38][0];
if (this->modelAnimType != PLAYER_ANIMTYPE_1) {
animPtr = &D_80853D7C[sp38][1];
animPtr = &sIdleAnimations[sp38][1];
}
anim = *animPtr;
}
@ -7840,17 +7879,14 @@ void func_808409CC(PlayState* play, Player* this) {
}
void Player_Action_80840BC8(Player* this, PlayState* play) {
s32 sp44;
s32 sp40;
s32 idleAnimationToChangeToPlusOne = func_80833350(this);
s32 sp40 = LinkAnimation_Update(play, &this->skelAnime);
f32 speedTarget;
s16 yawTarget;
s16 temp;
sp44 = func_80833350(this);
sp40 = LinkAnimation_Update(play, &this->skelAnime);
if (sp44 > 0) {
func_808333FC(this, sp44 - 1);
if (idleAnimationToChangeToPlusOne > 0) {
Player_ProcessIdleAnimSfxList(this, idleAnimationToChangeToPlusOne - 1);
}
if (sp40 != 0) {
@ -7895,7 +7931,7 @@ void Player_Action_80840BC8(Player* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200);
this->yaw = this->actor.shape.rot.y;
if (func_80833338(this) == this->skelAnime.animation) {
if (Player_GetIdleAnimationForCurrentModelAnimType(this) == this->skelAnime.animation) {
func_8083DC54(this, play);
}
}
@ -8214,8 +8250,8 @@ void Player_Action_80841BA8(Player* this, PlayState* play) {
LinkAnimation_Update(play, &this->skelAnime);
if (Player_HoldsTwoHandedWeapon(this)) {
AnimTaskQueue_AddLoadPlayerFrame(play, func_80833338(this), 0, this->skelAnime.limbCount,
this->skelAnime.morphTable);
AnimTaskQueue_AddLoadPlayerFrame(play, Player_GetIdleAnimationForCurrentModelAnimType(this), 0,
this->skelAnime.limbCount, this->skelAnime.morphTable);
AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable,
this->skelAnime.morphTable, sUpperBodyLimbCopyMap);
}
@ -10146,8 +10182,8 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe
SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType),
9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX);
this->skelAnime.baseTransl = sSkeletonBaseTransl;
SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, func_80833338(this), 9, this->upperJointTable,
this->upperMorphTable, PLAYER_LIMB_MAX);
SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, Player_GetIdleAnimationForCurrentModelAnimType(this), 9,
this->upperJointTable, this->upperMorphTable, PLAYER_LIMB_MAX);
this->upperSkelAnime.baseTransl = sSkeletonBaseTransl;
Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C);
@ -11997,7 +12033,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) {
}
this->stateFlags1 |= PLAYER_STATE1_20;
Player_AnimPlayOnce(play, this, func_80833338(this));
Player_AnimPlayOnce(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
Player_ZeroSpeedXZ(this);
func_8083B010(this);
return 1;
@ -12064,7 +12100,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) {
if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) {
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free);
} else {
Player_AnimPlayLoop(play, this, func_80833338(this));
Player_AnimPlayLoop(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
}
} else {
Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_talk_free_wait);
@ -15525,7 +15561,7 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction) {
void func_80853080(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_80840BC8, 1);
Player_AnimChangeOnceMorph(play, this, func_80833338(this));
Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
this->yaw = this->actor.shape.rot.y;
}
@ -15583,7 +15619,7 @@ void func_80853148(PlayState* play, Actor* actor) {
if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) {
Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace);
} else {
Player_AnimPlayLoop(play, this, func_80833338(this));
Player_AnimPlayLoop(play, this, Player_GetIdleAnimationForCurrentModelAnimType(this));
}
}
} else {