From 11917bf640d85250e2336389cec3e79bb5584816 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Jan 2022 03:10:43 +0100 Subject: [PATCH] Cleanup around some generic animation info structs (#1059) * Name generic anim info structs and cleanup usage * Make `EnDaiku` use generic struct * Add `/* decimalid */` comments to all added enums * small fixes * Two more generic animinfo structs * Cleanup usage of newly generic structs * Cleanup x2 usage of newly generic structs * `transitionRate` -> `morphFrames` * Properly name generic anim structs (attempt to at least) * `anim` -> `animation` * fixes * run formatter * Use consistent prototypes for each actor's ChangeAnim helper * run formatter * minor cleanup * Run formatter * `Animation_ChangeInfo` -> `Animation_ChangeByInfo` --- include/functions.h | 2 +- include/z64.h | 25 ++++-- src/code/z_actor.c | 14 +-- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 59 +++++++------ src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 56 ++++++------ .../z_en_daiku_kakariko.c | 57 ++++++------ src/overlays/actors/ovl_En_Dns/z_en_dns.c | 30 +++---- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 31 ++++--- src/overlays/actors/ovl_En_Du/z_en_du.c | 47 +++++++--- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 24 ++++-- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 14 ++- src/overlays/actors/ovl_En_Go/z_en_go.c | 32 +++---- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 54 ++++++++---- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 20 ++--- src/overlays/actors/ovl_En_In/z_en_in.c | 45 ++++++---- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 85 ++++++++++++------ src/overlays/actors/ovl_En_Kz/z_en_kz.c | 14 ++- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 29 ++++--- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 26 ++++-- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 23 +++-- src/overlays/actors/ovl_En_Md/z_en_md.c | 69 +++++++++------ src/overlays/actors/ovl_En_Mm/z_en_mm.c | 59 ++++++------- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 45 ++++------ src/overlays/actors/ovl_En_Sa/z_en_sa.c | 86 ++++++++++++------- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 18 ++-- src/overlays/actors/ovl_En_St/z_en_st.c | 35 +++++--- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 11 ++- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 15 +--- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 74 ++++++++-------- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 39 ++++++--- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 4 +- 31 files changed, 675 insertions(+), 467 deletions(-) diff --git a/include/functions.h b/include/functions.h index ce71b04947..8fab501986 100644 --- a/include/functions.h +++ b/include/functions.h @@ -509,7 +509,7 @@ void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbD void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3); -void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* animations, s32 index); +void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index); void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3); void Actor_Noop(Actor* actor, GlobalContext* globalCtx); void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist); diff --git a/include/z64.h b/include/z64.h index 3f417ab13c..386d733db4 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1297,23 +1297,34 @@ typedef enum { DPM_UNK3 = 3 } DynaPolyMoveFlag; -// Some animation related structure typedef struct { /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playbackSpeed; + /* 0x04 */ f32 playSpeed; /* 0x08 */ f32 startFrame; /* 0x0C */ f32 frameCount; /* 0x10 */ u8 mode; - /* 0x14 */ f32 transitionRate; -} struct_80034EC0_Entry; // size = 0x18 + /* 0x14 */ f32 morphFrames; +} AnimationInfo; // size = 0x18 -// Another animation related structure typedef struct { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 frameCount; /* 0x08 */ u8 mode; - /* 0x0C */ f32 transitionRate; -} struct_D_80AA1678; // size = 0x10 + /* 0x0C */ f32 morphFrames; +} AnimationFrameCountInfo; // size = 0x10 + +typedef struct { + /* 0x00 */ AnimationHeader* animation; + /* 0x04 */ f32 playSpeed; + /* 0x08 */ u8 mode; + /* 0x0C */ f32 morphFrames; +} AnimationSpeedInfo; // size = 0x10 + +typedef struct { + /* 0x00 */ AnimationHeader* animation; + /* 0x04 */ u8 mode; + /* 0x08 */ f32 morphFrames; +} AnimationMinimalInfo; // size = 0xC typedef struct { /* 0x00 */ s16 unk_00; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a46fdb52f1..0fbba750b2 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3857,19 +3857,19 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { return arg2; } -void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* animations, s32 index) { +void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index) { f32 frameCount; - animations += index; + animationInfo += index; - if (animations->frameCount > 0.0f) { - frameCount = animations->frameCount; + if (animationInfo->frameCount > 0.0f) { + frameCount = animationInfo->frameCount; } else { - frameCount = Animation_GetLastFrame(animations->animation); + frameCount = Animation_GetLastFrame(animationInfo->animation); } - Animation_Change(skelAnime, animations->animation, animations->playbackSpeed, animations->startFrame, frameCount, - animations->mode, animations->transitionRate); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + frameCount, animationInfo->mode, animationInfo->morphFrames); } void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 2851dcafa4..88d70bdd20 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -84,33 +84,40 @@ static DamageTable sDamageTable[] = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static struct_D_80AA1678 sAnimations[] = { +typedef enum { + /* 0 */ ENCS_ANIM_0, + /* 1 */ ENCS_ANIM_1, + /* 2 */ ENCS_ANIM_2, + /* 3 */ ENCS_ANIM_3 +} EnCsAnimation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &gGraveyardKidWalkAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gGraveyardKidSwingStickUpAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gGraveyardKidGrabStickTwoHandsAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gGraveyardKidIdleAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, }; -void EnCs_SetAnimFromIndex(EnCs* this, s32 animIndex, s32* currentAnimIndex) { +void EnCs_ChangeAnim(EnCs* this, s32 index, s32* currentIndex) { f32 morphFrames; - if ((*currentAnimIndex < 0) || (animIndex == *currentAnimIndex)) { + if ((*currentIndex < 0) || (index == *currentIndex)) { morphFrames = 0.0f; } else { - morphFrames = sAnimations[animIndex].transitionRate; + morphFrames = sAnimationInfo[index].morphFrames; } - if (sAnimations[animIndex].frameCount >= 0.0f) { - Animation_Change(&this->skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].frameCount, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex].animation), sAnimations[animIndex].mode, + if (sAnimationInfo[index].frameCount >= 0.0f) { + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].frameCount, 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, morphFrames); } else { - Animation_Change(&this->skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].frameCount, - Animation_GetLastFrame(sAnimations[animIndex].animation), 0.0f, sAnimations[animIndex].mode, + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].frameCount, + Animation_GetLastFrame(sAnimationInfo[index].animation), 0.0f, sAnimationInfo[index].mode, morphFrames); } - *currentAnimIndex = animIndex; + *currentIndex = index; } void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -132,9 +139,9 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, sDamageTable, &sColChkInfoInit2); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - Animation_Change(&this->skelAnime, sAnimations[0].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[0].animation), sAnimations[0].mode, - sAnimations[0].transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[ENCS_ANIM_0].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[ENCS_ANIM_0].animation), sAnimationInfo[ENCS_ANIM_0].mode, + sAnimationInfo[ENCS_ANIM_0].morphFrames); this->actor.targetMode = 6; this->path = this->actor.params & 0xFF; @@ -143,7 +150,7 @@ void EnCs_Init(Actor* thisx, GlobalContext* globalCtx) { this->currentAnimIndex = -1; this->actor.gravity = -1.0f; - EnCs_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_0, &this->currentAnimIndex); this->actionFunc = EnCs_Walk; this->walkSpeed = 1.0f; @@ -165,11 +172,11 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { this->actor.textId = 0x2026; - EnCs_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); talkState = 2; } else { this->actor.textId = 0x2024; - EnCs_SetAnimFromIndex(this, 1, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_1, &this->currentAnimIndex); talkState = 2; } } @@ -230,11 +237,11 @@ void EnCs_HandleTalking(EnCs* this, GlobalContext* globalCtx) { this->talkState = EnCs_GetTalkState(this, globalCtx); } else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { if ((this->actor.textId == 0x2022) || ((this->actor.textId != 0x2022) && (this->actor.textId != 0x2028))) { - EnCs_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_3, &this->currentAnimIndex); } if ((this->actor.textId == 0x2023) || (this->actor.textId == 0x2028)) { - EnCs_SetAnimFromIndex(this, 1, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_1, &this->currentAnimIndex); } if (this->actor.textId == 0x2023) { @@ -335,18 +342,18 @@ void EnCs_Walk(EnCs* this, GlobalContext* globalCtx) { if (rnd == 0) { if (gSaveContext.itemGetInf[3] & 0x400) { animIndex = 2.0f * Rand_ZeroOne(); - animIndex = (animIndex == 0) ? 2 : 1; + animIndex = (animIndex == 0) ? ENCS_ANIM_2 : ENCS_ANIM_1; } else { - animIndex = 2; + animIndex = ENCS_ANIM_2; } this->actionFunc = EnCs_Wait; } else { - animIndex = 0; + animIndex = ENCS_ANIM_0; } } - EnCs_SetAnimFromIndex(this, animIndex, &this->currentAnimIndex); + EnCs_ChangeAnim(this, animIndex, &this->currentAnimIndex); } if (this->talkState == 0) { @@ -379,12 +386,12 @@ void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { this->animLoopCount--; animIndex = this->currentAnimIndex; } else { - animIndex = 0; + animIndex = ENCS_ANIM_0; this->actionFunc = EnCs_Walk; } } - EnCs_SetAnimFromIndex(this, animIndex, &this->currentAnimIndex); + EnCs_ChangeAnim(this, animIndex, &this->currentAnimIndex); } } @@ -392,7 +399,7 @@ void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (SkelAnime_Update(&this->skelAnime) != 0) { - EnCs_SetAnimFromIndex(this, this->currentAnimIndex, &this->currentAnimIndex); + EnCs_ChangeAnim(this, this->currentAnimIndex, &this->currentAnimIndex); } this->flag |= 1; @@ -402,7 +409,7 @@ void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { func_80034A14(&this->actor, &this->npcInfo, 0, 4); if (this->talkState == 0) { - EnCs_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnCs_ChangeAnim(this, ENCS_ANIM_0, &this->currentAnimIndex); this->actionFunc = EnCs_Walk; this->flag &= ~1; } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 510d43766d..02a158984e 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -4,21 +4,6 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -typedef struct { - AnimationHeader* anim; - f32 unk_4; - u8 mode; - f32 transitionRate; -} EnDaikuAnimation; - -typedef enum { - /* 0 */ ENDAIKU_ANIM_SHOUT, - /* 1 */ ENDAIKU_ANIM_STAND, - /* 2 */ ENDAIKU_ANIM_CELEBRATE, - /* 3 */ ENDAIKU_ANIM_RUN, - /* 4 */ ENDAIKU_ANIM_SIT -} EnDaikuAnimationIdx; - typedef struct { Vec3f eyePosDeltaLocal; s32 maxFramesActive; @@ -125,7 +110,15 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static EnDaikuAnimation sAnimations[] = { +typedef enum { + /* 0 */ ENDAIKU_ANIM_SHOUT, + /* 1 */ ENDAIKU_ANIM_STAND, + /* 2 */ ENDAIKU_ANIM_CELEBRATE, + /* 3 */ ENDAIKU_ANIM_RUN, + /* 4 */ ENDAIKU_ANIM_SIT +} EnDaikuAnimation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &object_daiku_Anim_001AB0, 1.0f, 0, 0 }, { &object_daiku_Anim_007DE0, 1.0f, 0, 0 }, { &object_daiku_Anim_00885C, 1.0f, 0, 0 }, { &object_daiku_Anim_000C44, 1.0f, 0, 0 }, { &object_daiku_Anim_008164, 1.0f, 0, 0 }, @@ -138,19 +131,19 @@ static EnDaikuEscapeSubCamParam sEscapeSubCamParams[] = { { { -40, 60, 60 }, 120 }, }; -void EnDaiku_Change(EnDaiku* this, s32 animIndex, s32* currentAnimIndex) { - f32 transitionRate; +void EnDaiku_ChangeAnim(EnDaiku* this, s32 index, s32* currentIndex) { + f32 morphFrames; - if (*currentAnimIndex < 0 || *currentAnimIndex == animIndex) { - transitionRate = 0.0f; + if (*currentIndex < 0 || *currentIndex == index) { + morphFrames = 0.0f; } else { - transitionRate = sAnimations[animIndex].transitionRate; + morphFrames = sAnimationInfo[index].morphFrames; } - Animation_Change(&this->skelAnime, sAnimations[animIndex].anim, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex].anim), sAnimations[animIndex].mode, transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, morphFrames); - *currentAnimIndex = animIndex; + *currentIndex = index; } void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -191,8 +184,9 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - Animation_Change(&this->skelAnime, sAnimations[0].anim, 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[0].anim), - sAnimations[0].mode, sAnimations[0].transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[ENDAIKU_ANIM_SHOUT].animation), + sAnimationInfo[ENDAIKU_ANIM_SHOUT].mode, sAnimationInfo[ENDAIKU_ANIM_SHOUT].morphFrames); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); @@ -203,15 +197,15 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->initPos = this->actor.world.pos; if (globalCtx->sceneNum == SCENE_GERUDOWAY) { - EnDaiku_Change(this, ENDAIKU_ANIM_STAND, &this->currentAnimIndex); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_STAND, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; this->actionFunc = EnDaiku_Jailed; } else { if ((this->actor.params & 3) == 1 || (this->actor.params & 3) == 3) { - EnDaiku_Change(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1; } else { - EnDaiku_Change(this, ENDAIKU_ANIM_SHOUT, &this->currentAnimIndex); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SHOUT, &this->currentAnimIndex); this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; } @@ -369,7 +363,7 @@ void EnDaiku_Jailed(EnDaiku* this, GlobalContext* globalCtx) { if (gerudo == NULL) { this->stateFlags |= ENDAIKU_STATEFLAG_GERUDODEFEATED; this->stateFlags &= ~ENDAIKU_STATEFLAG_GERUDOFIGHTING; - EnDaiku_Change(this, ENDAIKU_ANIM_CELEBRATE, &this->currentAnimIndex); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_CELEBRATE, &this->currentAnimIndex); this->actionFunc = EnDaiku_WaitFreedom; } else if (!(this->stateFlags & ENDAIKU_STATEFLAG_GERUDOFIGHTING) && !gerudo->invisible) { this->stateFlags |= ENDAIKU_STATEFLAG_GERUDOFIGHTING; @@ -402,7 +396,7 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) { s32 exitLoop; Audio_PlayFanfare(NA_BGM_APPEAR); - EnDaiku_Change(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex); this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2); gSaveContext.eventChkInf[9] |= 1 << (this->actor.params & 3); diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 976af344f0..4bc42d3900 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -93,26 +93,34 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static struct_D_80AA1678 sAnimations[] = { +typedef enum { + /* 0 */ ENDAIKUKAKARIKO_ANIM_0, + /* 1 */ ENDAIKUKAKARIKO_ANIM_1, + /* 2 */ ENDAIKUKAKARIKO_ANIM_2, + /* 3 */ ENDAIKUKAKARIKO_ANIM_3, + /* 4 */ ENDAIKUKAKARIKO_ANIM_4, + /* 5 */ ENDAIKUKAKARIKO_ANIM_5 +} EnDaikuKakarikoAnimation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &object_daiku_Anim_001AB0, 1.0f, 2, -7.0f }, { &object_daiku_Anim_007DE0, 1.0f, 0, -7.0f }, { &object_daiku_Anim_00885C, 1.0f, 0, -7.0f }, { &object_daiku_Anim_000C44, 1.0f, 0, -7.0f }, { &object_daiku_Anim_000600, 1.0f, 0, -7.0f }, { &object_daiku_Anim_008164, 1.0f, 0, -7.0f }, }; -void EnDaikuKakariko_SetAnimFromIndex(EnDaikuKakariko* this, s32 animIndex, s32* currentAnimIndex) { +void EnDaikuKakariko_ChangeAnim(EnDaikuKakariko* this, s32 index, s32* currentIndex) { f32 morphFrames; - if ((*currentAnimIndex < 0) || (animIndex == *currentAnimIndex)) { + if ((*currentIndex < 0) || (index == *currentIndex)) { morphFrames = 0.0f; } else { - morphFrames = sAnimations[animIndex].transitionRate; + morphFrames = sAnimationInfo[index].morphFrames; } - Animation_Change(&this->skelAnime, sAnimations[animIndex].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex].animation), sAnimations[animIndex].mode, - morphFrames); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, morphFrames); - *currentAnimIndex = animIndex; + *currentIndex = index; } void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -156,8 +164,9 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); - Animation_Change(&this->skelAnime, sAnimations->animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations->animation), sAnimations->mode, sAnimations->transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].animation), + sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].mode, sAnimationInfo[ENDAIKUKAKARIKO_ANIM_0].morphFrames); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); @@ -172,20 +181,20 @@ void EnDaikuKakariko_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->flags & 0x10) { - EnDaikuKakariko_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_Run; } else { if (this->flags & 8) { if (((this->actor.params & 3) == CARPENTER_SABOORO) || ((this->actor.params & 3) == CARPENTER_SHIRO)) { - EnDaikuKakariko_SetAnimFromIndex(this, 5, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_5, &this->currentAnimIndex); this->flags |= 0x800; } else { - EnDaikuKakariko_SetAnimFromIndex(this, 1, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_1, &this->currentAnimIndex); } this->skelAnime.curFrame = (s32)(Rand_ZeroOne() * this->skelAnime.endFrame); } else { - EnDaikuKakariko_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); this->skelAnime.curFrame = (s32)(Rand_ZeroOne() * this->skelAnime.endFrame); } @@ -271,21 +280,21 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, GlobalContext* globalC void EnDaikuKakariko_Talk(EnDaikuKakariko* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { - EnDaikuKakariko_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); } EnDaikuKakariko_HandleTalking(this, globalCtx); if (this->talkState == 0) { if (this->flags & 0x10) { - EnDaikuKakariko_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); this->flags &= ~0x0300; this->actionFunc = EnDaikuKakariko_Run; return; } if (!(this->flags & 8)) { - EnDaikuKakariko_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); } if ((this->flags & 0x800) == 0) { @@ -301,12 +310,12 @@ void EnDaikuKakariko_Wait(EnDaikuKakariko* this, GlobalContext* globalCtx) { EnDaikuKakariko_HandleTalking(this, globalCtx); if (SkelAnime_Update(&this->skelAnime)) { - EnDaikuKakariko_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); } if (this->talkState != 0) { if (!(this->flags & 8)) { - EnDaikuKakariko_SetAnimFromIndex(this, 4, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_4, &this->currentAnimIndex); } if (!(this->flags & 0x800)) { @@ -323,7 +332,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx this->timer--; if (this->timer <= 0) { - EnDaikuKakariko_SetAnimFromIndex(this, 3, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_3, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_Run; } else { this->skelAnime.curFrame = this->skelAnime.startFrame; @@ -334,7 +343,7 @@ void EnDaikuKakariko_StopRunning(EnDaikuKakariko* this, GlobalContext* globalCtx if (this->talkState != 0) { this->flags |= 0x200; - EnDaikuKakariko_SetAnimFromIndex(this, 4, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_4, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_Talk; } } @@ -372,7 +381,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { if (this->flags & 0x400) { this->timer = 2; - EnDaikuKakariko_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_StopRunning; return; } @@ -393,7 +402,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { if (this->flags & 0x400) { this->timer = 2; - EnDaikuKakariko_SetAnimFromIndex(this, 0, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_0, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_StopRunning; return; } @@ -437,7 +446,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { if (this->talkState != 0) { this->flags |= 0x200; - EnDaikuKakariko_SetAnimFromIndex(this, 4, &this->currentAnimIndex); + EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_4, &this->currentAnimIndex); this->actionFunc = EnDaikuKakariko_Talk; } } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 22c28edd67..55a81009bd 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -120,13 +120,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -typedef struct { - /* 0x00 */ AnimationHeader* anim; - /* 0x04 */ u8 mode; - /* 0x08 */ f32 transitionRate; -} DnsAnimInfo; // size = 0xC +typedef enum { + /* 0 */ ENDNS_ANIM_0, + /* 1 */ ENDNS_ANIM_1, + /* 2 */ ENDNS_ANIM_2 +} EnDnsAnimation; -static DnsAnimInfo sAnimInfo[] = { +static AnimationMinimalInfo sAnimationInfo[] = { { &gBusinessScrubNervousIdleAnim, ANIMMODE_LOOP, 0.0f }, { &gBusinessScrubAnim_4404, ANIMMODE_ONCE, 0.0f }, { &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f }, @@ -173,13 +173,13 @@ void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx) { Collider_DestroyCylinder(globalCtx, &this->collider); } -void EnDns_Change(EnDns* this, u8 arg1) { +void EnDns_ChangeAnim(EnDns* this, u8 index) { s16 frameCount; - frameCount = Animation_GetLastFrame(sAnimInfo[arg1].anim); - this->unk_2BA = arg1; // Not used anywhere else? - Animation_Change(&this->skelAnime, sAnimInfo[arg1].anim, 1.0f, 0.0f, (f32)frameCount, sAnimInfo[arg1].mode, - sAnimInfo[arg1].transitionRate); + frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); + this->unk_2BA = index; // Not used anywhere else? + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, (f32)frameCount, + sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } /* Item give checking functions */ @@ -315,7 +315,7 @@ void func_809EFB40(EnDns* this) { void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = EnDns_Wait; - EnDns_Change(this, 0); + EnDns_ChangeAnim(this, ENDNS_ANIM_0); } } @@ -411,7 +411,7 @@ void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { this->dropCollectible = 1; this->maintainCollider = 0; this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_Change(this, 1); + EnDns_ChangeAnim(this, ENDNS_ANIM_1); this->actionFunc = EnDns_SetupBurrow; } } else { @@ -419,7 +419,7 @@ void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { this->dropCollectible = 1; this->maintainCollider = 0; this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_Change(this, 1); + EnDns_ChangeAnim(this, ENDNS_ANIM_1); this->actionFunc = EnDns_SetupBurrow; } } @@ -428,7 +428,7 @@ void func_809F008C(EnDns* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { this->maintainCollider = 0; this->actor.flags &= ~ACTOR_FLAG_0; - EnDns_Change(this, 1); + EnDns_ChangeAnim(this, ENDNS_ANIM_1); this->actionFunc = EnDns_SetupBurrow; } } diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 1bf0364132..7447956832 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -55,7 +55,18 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, 50 }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENDOG_ANIM_0, + /* 1 */ ENDOG_ANIM_1, + /* 2 */ ENDOG_ANIM_2, + /* 3 */ ENDOG_ANIM_3, + /* 4 */ ENDOG_ANIM_4, + /* 5 */ ENDOG_ANIM_5, + /* 6 */ ENDOG_ANIM_6, + /* 7 */ ENDOG_ANIM_7 +} EnDogAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gDogWalkAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gDogWalkAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, { &gDogRunAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, @@ -120,34 +131,34 @@ s32 EnDog_PlayAnimAndSFX(EnDog* this) { this->behavior = this->nextBehavior; switch (this->behavior) { case DOG_WALK: - animation = 1; + animation = ENDOG_ANIM_1; break; case DOG_RUN: - animation = 2; + animation = ENDOG_ANIM_2; break; case DOG_BARK: - animation = 3; + animation = ENDOG_ANIM_3; break; case DOG_SIT: - animation = 4; + animation = ENDOG_ANIM_4; break; case DOG_BOW: - animation = 6; + animation = ENDOG_ANIM_6; break; } - func_80034EC0(&this->skelAnime, sAnimations, animation); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animation); } switch (this->behavior) { case DOG_SIT: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_5); this->behavior = this->nextBehavior = DOG_SIT_2; } break; case DOG_BOW: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_7); this->behavior = this->nextBehavior = DOG_BOW_2; } break; @@ -235,7 +246,7 @@ void EnDog_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, 13); - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDOG_ANIM_0); if ((this->actor.params & 0x8000) == 0) { this->actor.params = (this->actor.params & 0xF0FF) | ((((this->actor.params & 0x0F00) >> 8) + 1) << 8); diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 9cfb2028ab..2ca7b37b33 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -58,7 +58,25 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENDU_ANIM_0, + /* 1 */ ENDU_ANIM_1, + /* 2 */ ENDU_ANIM_2, + /* 3 */ ENDU_ANIM_3, + /* 4 */ ENDU_ANIM_4, + /* 5 */ ENDU_ANIM_5, + /* 6 */ ENDU_ANIM_6, + /* 7 */ ENDU_ANIM_7, + /* 8 */ ENDU_ANIM_8, + /* 9 */ ENDU_ANIM_9, + /* 10 */ ENDU_ANIM_10, + /* 11 */ ENDU_ANIM_11, + /* 12 */ ENDU_ANIM_12, + /* 13 */ ENDU_ANIM_13, + /* 14 */ ENDU_ANIM_14 +} EnDuAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gDaruniaIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gDaruniaIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, { &gDaruniaItemGiveAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, @@ -227,25 +245,32 @@ void func_809FE000(CsCmdActorAction* csAction, Vec3f* dst) { } void func_809FE040(EnDu* this) { - s32 animationIndices[] = { 8, 8, 8, 8, 9, 10, 10, 13 }; + s32 animationIndices[] = { + ENDU_ANIM_8, ENDU_ANIM_8, ENDU_ANIM_8, ENDU_ANIM_8, ENDU_ANIM_9, ENDU_ANIM_10, ENDU_ANIM_10, ENDU_ANIM_13, + }; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_1E6++; if (this->unk_1E6 >= 8) { this->unk_1E6 = 0; } - func_80034EC0(&this->skelAnime, sAnimations, animationIndices[this->unk_1E6]); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animationIndices[this->unk_1E6]); } } void func_809FE104(EnDu* this) { - s32 animationIndices[] = { 8, 8, 11, 12 }; + s32 animationIndices[] = { + ENDU_ANIM_8, + ENDU_ANIM_8, + ENDU_ANIM_11, + ENDU_ANIM_12, + }; if (this->unk_1E6 < 4) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_1E6++; if (this->unk_1E6 < 4) { - func_80034EC0(&this->skelAnime, sAnimations, animationIndices[this->unk_1E6]); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animationIndices[this->unk_1E6]); } } } @@ -264,7 +289,7 @@ void EnDu_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_0); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 1; this->unk_1F4.unk_00 = 0; @@ -428,11 +453,11 @@ void func_809FE890(EnDu* this, GlobalContext* globalCtx) { } if (this->unk_1EA != csAction->action) { if (csAction->action == 1) { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); } if (csAction->action == 7 || csAction->action == 8) { this->unk_1E6 = 0; - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_7); } this->unk_1EA = csAction->action; if (this->unk_1EA == 7) { @@ -481,7 +506,7 @@ void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { if (this->unk_1E8 == 1) { func_8002DF54(globalCtx, &this->actor, 7); - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); EnDu_SetupAction(this, func_809FE3C0); return; } @@ -493,7 +518,7 @@ void func_809FEB08(EnDu* this, GlobalContext* globalCtx) { EnDu_SetupAction(this, func_809FE3C0); } Message_StartTextbox(globalCtx, this->actor.textId, NULL); - func_80034EC0(&this->skelAnime, sAnimations, 14); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_14); this->unk_1F4.unk_00 = 1; } @@ -531,7 +556,7 @@ void EnDu_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gDaruniaDancingEndAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENDU_ANIM_1); } SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 2f85b482da..897160fdf5 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -192,7 +192,15 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 sColChkInit = { 24, 2, 25, 25, MASS_IMMOVABLE }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENFD_ANIM_0, + /* 1 */ ENFD_ANIM_1, + /* 2 */ ENFD_ANIM_2, + /* 3 */ ENFD_ANIM_3, + /* 4 */ ENFD_ANIM_4 +} EnFdAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gFlareDancerCastingFireAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, 0.0f }, { &gFlareDancerBackflipAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, { &gFlareDancerGettingUpAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, @@ -471,7 +479,7 @@ void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) { this->coreActive = false; this->actor.scale.y = 0.0f; this->fadeAlpha = 255.0f; - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_0); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_LAUGH); this->actionFunc = EnFd_SpinAndGrow; } @@ -483,7 +491,7 @@ void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { this->actor.world.rot.y ^= 0x8000; this->actor.flags |= ACTOR_FLAG_0; this->actor.speedXZ = 8.0f; - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_1); this->actionFunc = EnFd_JumpToGround; } else { this->actor.scale.y = this->skelAnime.curFrame * (0.01f / this->skelAnime.animLength); @@ -497,7 +505,7 @@ void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_2); this->actionFunc = EnFd_Land; } } @@ -511,7 +519,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) { this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir); this->actor.world.rot.y = Math_FAtan2F(adjPos.x, adjPos.z) * (0x8000 / M_PI); - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_4); this->actionFunc = EnFd_SpinAndSpawnFire; } } @@ -559,7 +567,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { this->curYawToInitPos = this->runDir < 0 ? 0xFFFF : 0; this->circlesToComplete = (globalCtx->state.frames & 7) + 2; this->spinTimer = Rand_S16Offset(30, 120); - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_3); this->actionFunc = EnFd_Run; } } @@ -567,7 +575,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) { /** * Run around in a circle with the center being the initial position, and - * the radius being the distance from the initial postion to the nearest + * the radius being the distance from the initial position to the nearest * threat (bomb or player). */ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { @@ -581,7 +589,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) { this->actor.world.rot.y ^= 0x8000; this->actor.velocity.y = 6.0f; this->actor.speedXZ = 0.0f; - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_1); this->actionFunc = EnFd_JumpToGround; return; } diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 645555096f..22100e2269 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -65,7 +65,13 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 D_80A1FB94 = { 8, 2, 25, 25, MASS_IMMOVABLE }; -static struct_80034EC0_Entry D_80A1FBA0[] = { +typedef enum { + /* 0 */ ENFW_ANIM_0, + /* 1 */ ENFW_ANIM_1, + /* 2 */ ENFW_ANIM_2 +} EnFwAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gFlareDancerCoreInitRunCycleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, 0.0f }, { &gFlareDancerCoreRunCycleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, { &gFlareDancerCoreEndRunCycleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, @@ -186,7 +192,7 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, 11); - func_80034EC0(&this->skelAnime, D_80A1FBA0, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitJntSph(globalCtx, &this->collider); Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); @@ -220,7 +226,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gFlareDancerCoreInitRunCycleAnim) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 0) { this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.parent->world.pos); - func_80034EC0(&this->skelAnime, D_80A1FBA0, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_2); } return; } @@ -336,7 +342,7 @@ void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { this->actor.velocity.y = 14.0f; this->actor.home.pos = this->actor.world.pos; Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); - func_80034EC0(&this->skelAnime, D_80A1FBA0, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_1); this->actionFunc = EnFw_JumpToParentInitPos; } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 6b744868a5..568cb67fcf 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -69,14 +69,14 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -typedef struct { - AnimationHeader* animation; - f32 playSpeed; - u8 mode; - f32 morphRate; +typedef enum { + /* 0 */ ENGO_ANIM_0, + /* 1 */ ENGO_ANIM_1, + /* 2 */ ENGO_ANIM_2, + /* 3 */ ENGO_ANIM_3 } EnGoAnimation; -static EnGoAnimation sAnimationEntries[] = { +static AnimationSpeedInfo sAnimationInfo[] = { { &gGoronAnim_004930, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f }, { &gGoronAnim_004930, 0.0f, ANIMMODE_LOOP_INTERP, -10.0f }, { &gGoronAnim_0029A8, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, @@ -347,11 +347,11 @@ s32 func_80A3ED24(GlobalContext* globalCtx, EnGo* this, struct_80034A14_arg1* ar } } -void EnGo_ChangeAnimation(EnGo* this, s32 animIndex) { - Animation_Change(&this->skelAnime, sAnimationEntries[animIndex].animation, - sAnimationEntries[animIndex].playSpeed * ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f), 0.0f, - Animation_GetLastFrame(sAnimationEntries[animIndex].animation), sAnimationEntries[animIndex].mode, - sAnimationEntries[animIndex].morphRate); +void EnGo_ChangeAnim(EnGo* this, s32 index) { + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, + sAnimationInfo[index].playSpeed * ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f), 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + sAnimationInfo[index].morphFrames); } s32 EnGo_IsActorSpawned(EnGo* this, GlobalContext* globalCtx) { @@ -639,7 +639,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_5; } - EnGo_ChangeAnimation(this, 0); + EnGo_ChangeAnim(this, ENGO_ANIM_0); this->actor.targetMode = 6; this->unk_1E0.unk_00 = 0; this->actor.gravity = -1.0f; @@ -859,7 +859,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { this->unk_1E0.unk_00 = 0; } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYEDROPS) { - EnGo_ChangeAnimation(this, 2); + EnGo_ChangeAnim(this, ENGO_ANIM_2); this->unk_21E = 100; this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_Eyedrops); @@ -924,7 +924,7 @@ void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { this->actor.speedXZ = Math_SinS((s16)float2); if (EnGo_FollowPath(this, globalCtx) && this->unk_218 == 0) { - EnGo_ChangeAnimation(this, 1); + EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); this->actor.speedXZ = 0.0f; EnGo_SetupAction(this, EnGo_BiggoronActionFunc); @@ -933,7 +933,7 @@ void func_80A40A54(EnGo* this, GlobalContext* globalCtx) { void func_80A40B1C(EnGo* this, GlobalContext* globalCtx) { if (gSaveContext.infTable[14] & 0x800) { - EnGo_ChangeAnimation(this, 3); + EnGo_ChangeAnim(this, ENGO_ANIM_3); EnGo_SetupAction(this, func_80A40A54); } else { EnGo_BiggoronActionFunc(this, globalCtx); @@ -1006,7 +1006,7 @@ void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx) { void func_80A40DCC(EnGo* this, GlobalContext* globalCtx) { if (this->unk_1E0.unk_00 == 2) { - EnGo_ChangeAnimation(this, 1); + EnGo_ChangeAnim(this, ENGO_ANIM_1); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); Message_CloseTextbox(globalCtx); EnGo_SetupAction(this, EnGo_GetItem); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 533e53b769..6fd1308794 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -125,7 +125,23 @@ static f32 D_80A482D8[14][2] = { { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENGO2_ANIM_0, + /* 1 */ ENGO2_ANIM_1, + /* 2 */ ENGO2_ANIM_2, + /* 3 */ ENGO2_ANIM_3, + /* 4 */ ENGO2_ANIM_4, + /* 5 */ ENGO2_ANIM_5, + /* 6 */ ENGO2_ANIM_6, + /* 7 */ ENGO2_ANIM_7, + /* 8 */ ENGO2_ANIM_8, + /* 9 */ ENGO2_ANIM_9, + /* 10 */ ENGO2_ANIM_10, + /* 11 */ ENGO2_ANIM_11, + /* 12 */ ENGO2_ANIM_12 +} EnGo2Animation; + +static AnimationInfo sAnimationInfo[] = { { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0029A8, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_010590, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_003768, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0038E4, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, @@ -1097,11 +1113,11 @@ void func_80A454CC(EnGo2* this) { case GORON_CITY_ENTRANCE: case GORON_CITY_STAIRWELL: case GORON_DMT_FAIRY_HINT: - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_9); break; case GORON_DMT_BIGGORON: if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_SWORD_BROKEN && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYEDROPS) { - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_4); break; } default: @@ -1265,10 +1281,10 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_0; - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = -0.5f; } else { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->skelAnime.playSpeed = -1.0f; } EnGo2_SwapInitialFrameAnimFrameCount(this); @@ -1288,17 +1304,17 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; } else { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->skelAnime.playSpeed = 1.0f; } this->actionFunc = func_80A46B40; } void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->unk_211 = true; this->actionFunc = func_80A46B40; this->skelAnime.playSpeed = 0.0f; @@ -1361,7 +1377,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return false; } - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_3); this->unk_194.unk_00 = 0; this->isAwake = false; this->unk_26E = 1; @@ -1409,13 +1425,13 @@ s32 EnGo2_IsRolling(EnGo2* this) { } void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { - s32 animation = 13; + s32 animation = ARRAY_COUNT(sAnimationInfo); if ((this->actor.params & 0x1F) == GORON_CITY_LINK) { if ((this->actor.textId == 0x3035 && this->unk_20C == 0) || (this->actor.textId == 0x3036 && this->unk_20C == 0)) { if (this->skelAnime.animation != &gGoronAnim_000D5C) { - animation = 12; + animation = ENGO2_ANIM_12; this->eyeMouthTexState = 0; } } @@ -1423,7 +1439,7 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { if ((this->actor.textId == 0x3032 && this->unk_20C == 12) || (this->actor.textId == 0x3033) || (this->actor.textId == 0x3035 && this->unk_20C == 6)) { if (this->skelAnime.animation != &gGoronAnim_000750) { - animation = 11; + animation = ENGO2_ANIM_11; this->eyeMouthTexState = 1; } } @@ -1434,8 +1450,8 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { } } - if (animation != 13) { - func_80034EC0(&this->skelAnime, sAnimations, animation); + if (animation != ARRAY_COUNT(sAnimationInfo)) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animation); } } } @@ -1501,7 +1517,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) { EnGo2_SetColliderDim(this); EnGo2_SetShape(this); - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_0); this->actor.gravity = -1.0f; this->alpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; @@ -1783,7 +1799,7 @@ void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) { void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { switch (this->goronState) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5); this->actor.flags &= ~ACTOR_FLAG_0; this->actor.shape.rot.y += 0x5B0; this->unk_26E = 1; @@ -1802,7 +1818,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { } } else { func_800F4524(&D_801333D4, NA_SE_EN_GOLON_GOOD_BIG, 60); - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_6); Message_ContinueTextbox(globalCtx, 0x305A); this->eyeMouthTexState = 3; this->goronState++; @@ -1814,7 +1830,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { this->eyeMouthTexState = 0; } if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->actor.flags |= ACTOR_FLAG_0; this->unk_26E = 2; this->skelAnime.playSpeed = 0.0f; @@ -1865,7 +1881,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { EnGo2_GoronFireCamera(this, globalCtx); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_2); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; func_80A44D84(this); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 65e5ebd2fe..389f538efa 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -175,7 +175,7 @@ typedef enum { /* 26 */ ENHY_ANIM_26 } EnHyAnimationIndex; -static struct_80034EC0_Entry sAnimationInfo[] = { +static AnimationInfo sAnimationInfo[] = { /* ENHY_ANIM_0 */ { &gObjOsAnim_092C, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, /* ENHY_ANIM_1 */ { &gObjOsAnim_0228, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, /* ENHY_ANIM_2 */ { &gObjOsAnim_4CF4, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, @@ -581,7 +581,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { case 0x70F2: case 0x70F3: if (this->skelAnime.animation != &gObjOsAnim_33B4) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_23); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_23); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); } break; @@ -594,7 +594,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { case 0x70F2: case 0x70F3: Rupees_ChangeBy(beggarRewards[this->actor.textId - 0x70F0]); - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_17); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_17); Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x7016: @@ -904,7 +904,7 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - func_80034EC0(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sModelInfo[this->actor.params & 0x7F].animInfoIndex); if ((globalCtx->sceneNum == SCENE_MARKET_ALLEY) || (globalCtx->sceneNum == SCENE_MARKET_DAY)) { this->actor.flags &= ~ACTOR_FLAG_4; @@ -967,14 +967,14 @@ void EnHy_InitImpl(EnHy* this, GlobalContext* globalCtx) { void func_80A710F8(EnHy* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gObjOsAnim_0BFC) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_26); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_26); } } else if (gSaveContext.eventInf[3] & 1) { if (this->skelAnime.animation != &gObjOsAnim_0FE4) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_25); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_25); } } else if (this->skelAnime.animation != &gObjOsAnim_12E8) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_24); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_24); } } @@ -1003,7 +1003,7 @@ void EnHy_DoNothing(EnHy* this, GlobalContext* globalCtx) { void func_80A712C0(EnHy* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer <= 100.0f) && (this->path != NULL)) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); this->actor.speedXZ = 0.4f; this->actionFunc = func_80A7134C; } @@ -1016,11 +1016,11 @@ void func_80A7134C(EnHy* this, GlobalContext* globalCtx) { f32 distSq; if ((this->skelAnime.animation == &gObjOsAnim_2160) && (this->unk_1E8.unk_00 != 0)) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_8); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_8); } if ((this->skelAnime.animation == &gObjOsAnim_265C) && (this->unk_1E8.unk_00 == 0)) { - func_80034EC0(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_7); } this->actor.speedXZ = 0.4f; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 9ae28ad3ce..484b809a05 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -60,7 +60,20 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -static struct_D_80AA1678 sAnimationInfo[] = { +typedef enum { + /* 0 */ ENIN_ANIM_0, + /* 1 */ ENIN_ANIM_1, + /* 2 */ ENIN_ANIM_2, + /* 3 */ ENIN_ANIM_3, + /* 4 */ ENIN_ANIM_4, + /* 5 */ ENIN_ANIM_5, + /* 6 */ ENIN_ANIM_6, + /* 7 */ ENIN_ANIM_7, + /* 8 */ ENIN_ANIM_8, + /* 9 */ ENIN_ANIM_9 +} EnInAnimation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &object_in_Anim_001CC0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_in_Anim_001CC0, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_in_Anim_013C6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_in_Anim_013C6C, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_in_Anim_000CB0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_in_Anim_0003B4, 1.0f, ANIMMODE_LOOP, -10.0f }, @@ -331,10 +344,10 @@ void func_80A79690(SkelAnime* skelAnime, EnIn* this, GlobalContext* globalCtx) { } } -void func_80A796EC(EnIn* this, s32 arg1) { - Animation_Change(&this->skelAnime, sAnimationInfo[arg1].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[arg1].animation), sAnimationInfo[arg1].mode, - sAnimationInfo[arg1].transitionRate); +void EnIn_ChangeAnim(EnIn* this, s32 index) { + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + sAnimationInfo[index].morphFrames); } s32 func_80A7975C(EnIn* this, GlobalContext* globalCtx) { @@ -511,18 +524,18 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { switch (func_80A79830(this, globalCtx)) { case 1: - func_80A796EC(this, 9); + EnIn_ChangeAnim(this, ENIN_ANIM_9); this->actionFunc = func_80A7A4BC; break; case 3: - func_80A796EC(this, 7); + EnIn_ChangeAnim(this, ENIN_ANIM_7); this->actionFunc = func_80A7A4BC; if (!(gSaveContext.eventChkInf[1] & 0x100)) { this->actor.params = 5; } break; case 4: - func_80A796EC(this, 8); + EnIn_ChangeAnim(this, ENIN_ANIM_8); this->eyeIndex = 3; this->actionFunc = func_80A7A4BC; break; @@ -559,34 +572,34 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) { switch (gSaveContext.eventInf[0] & 0xF) { case 0: case 2: - func_80A796EC(this, 2); + EnIn_ChangeAnim(this, ENIN_ANIM_2); this->actionFunc = func_80A7A4C8; gSaveContext.eventInf[0] = 0; break; case 1: this->actor.targetMode = 3; - func_80A796EC(this, 2); + EnIn_ChangeAnim(this, ENIN_ANIM_2); this->actionFunc = func_80A7A568; func_80088B34(0x3C); break; case 3: - func_80A796EC(this, 4); + EnIn_ChangeAnim(this, ENIN_ANIM_4); this->actionFunc = func_80A7A770; break; case 4: - func_80A796EC(this, 6); + EnIn_ChangeAnim(this, ENIN_ANIM_6); this->unk_1EC = 8; this->actionFunc = func_80A7A940; break; case 5: case 6: this->actor.targetMode = 3; - func_80A796EC(this, 6); + EnIn_ChangeAnim(this, ENIN_ANIM_6); this->unk_1EC = 8; this->actionFunc = func_80A7AA40; break; case 7: - func_80A796EC(this, 2); + EnIn_ChangeAnim(this, ENIN_ANIM_2); this->actionFunc = func_80A7A848; break; } @@ -687,7 +700,7 @@ void func_80A7A770(EnIn* this, GlobalContext* globalCtx) { } else if (this->unk_308.unk_00 == 2) { Rupees_ChangeBy(-50); this->actor.flags &= ~ACTOR_FLAG_16; - func_80A796EC(this, 3); + EnIn_ChangeAnim(this, ENIN_ANIM_3); this->actionFunc = func_80A7A848; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x0F) | 7; this->unk_308.unk_00 = 0; @@ -802,7 +815,7 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { this->actor.textId = 0x203C; Message_StartTextbox(globalCtx, this->actor.textId, NULL); this->unk_308.unk_00 = 1; - func_80A796EC(this, 3); + EnIn_ChangeAnim(this, ENIN_ANIM_3); } else { globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; this->unk_308.unk_00 = 0; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 36feb2d797..b97362ea03 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -88,7 +88,44 @@ static EnKoSkeleton sSkeleton[2] = { { OBJECT_KW1, /* gKw1Skel */ 0x060000F0 }, }; -static struct_80034EC0_Entry sOsAnimeTable[] = { +typedef enum { + /* 0 */ ENKO_ANIM_0, + /* 1 */ ENKO_ANIM_1, + /* 2 */ ENKO_ANIM_2, + /* 3 */ ENKO_ANIM_3, + /* 4 */ ENKO_ANIM_4, + /* 5 */ ENKO_ANIM_5, + /* 6 */ ENKO_ANIM_6, + /* 7 */ ENKO_ANIM_7, + /* 8 */ ENKO_ANIM_8, + /* 9 */ ENKO_ANIM_9, + /* 10 */ ENKO_ANIM_10, + /* 11 */ ENKO_ANIM_11, + /* 12 */ ENKO_ANIM_12, + /* 13 */ ENKO_ANIM_13, + /* 14 */ ENKO_ANIM_14, + /* 15 */ ENKO_ANIM_15, + /* 16 */ ENKO_ANIM_16, + /* 17 */ ENKO_ANIM_17, + /* 18 */ ENKO_ANIM_18, + /* 19 */ ENKO_ANIM_19, + /* 20 */ ENKO_ANIM_20, + /* 21 */ ENKO_ANIM_21, + /* 22 */ ENKO_ANIM_22, + /* 23 */ ENKO_ANIM_23, + /* 24 */ ENKO_ANIM_24, + /* 25 */ ENKO_ANIM_25, + /* 26 */ ENKO_ANIM_26, + /* 27 */ ENKO_ANIM_27, + /* 28 */ ENKO_ANIM_28, + /* 29 */ ENKO_ANIM_29, + /* 30 */ ENKO_ANIM_30, + /* 31 */ ENKO_ANIM_31, + /* 32 */ ENKO_ANIM_32, + /* 33 */ ENKO_ANIM_33 +} EnKoAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gObjOsAnim_8F6C, 1.0f, 2.0f, 14.0f, ANIMMODE_LOOP_PARTIAL, 0.0f }, { &gObjOsAnim_8F6C, 0.0f, 1.0f, 1.0f, ANIMMODE_LOOP_PARTIAL, 0.0f }, { &gObjOsAnim_9B64, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, @@ -126,19 +163,19 @@ static struct_80034EC0_Entry sOsAnimeTable[] = { }; static u8 sOsAnimeLookup[13][5] = { - /* ENKO_TYPE_CHILD_0 */ { 0x08, 0x09, 0x09, 0x0E, 0x0B }, - /* ENKO_TYPE_CHILD_1 */ { 0x02, 0x0C, 0x02, 0x0D, 0x0D }, - /* ENKO_TYPE_CHILD_2 */ { 0x0B, 0x0B, 0x0B, 0x0F, 0x09 }, - /* ENKO_TYPE_CHILD_3 */ { 0x00, 0x10, 0x10, 0x11, 0x12 }, - /* ENKO_TYPE_CHILD_4 */ { 0x13, 0x13, 0x14, 0x0A, 0x09 }, - /* ENKO_TYPE_CHILD_5 */ { 0x03, 0x03, 0x03, 0x03, 0x03 }, - /* ENKO_TYPE_CHILD_6 */ { 0x04, 0x16, 0x16, 0x04, 0x17 }, - /* ENKO_TYPE_CHILD_7 */ { 0x18, 0x10, 0x10, 0x19, 0x10 }, - /* ENKO_TYPE_CHILD_8 */ { 0x1A, 0x0F, 0x0F, 0x1A, 0x0F }, - /* ENKO_TYPE_CHILD_9 */ { 0x03, 0x03, 0x03, 0x1B, 0x1B }, - /* ENKO_TYPE_CHILD_10 */ { 0x02, 0x02, 0x02, 0x02, 0x16 }, - /* ENKO_TYPE_CHILD_11 */ { 0x0E, 0x0E, 0x0E, 0x0E, 0x0E }, - /* ENKO_TYPE_CHILD_FADO */ { 0x05, 0x05, 0x05, 0x05, 0x05 }, + /* ENKO_TYPE_CHILD_0 */ { ENKO_ANIM_8, ENKO_ANIM_9, ENKO_ANIM_9, ENKO_ANIM_14, ENKO_ANIM_11 }, + /* ENKO_TYPE_CHILD_1 */ { ENKO_ANIM_2, ENKO_ANIM_12, ENKO_ANIM_2, ENKO_ANIM_13, ENKO_ANIM_13 }, + /* ENKO_TYPE_CHILD_2 */ { ENKO_ANIM_11, ENKO_ANIM_11, ENKO_ANIM_11, ENKO_ANIM_15, ENKO_ANIM_9 }, + /* ENKO_TYPE_CHILD_3 */ { ENKO_ANIM_0, ENKO_ANIM_16, ENKO_ANIM_16, ENKO_ANIM_17, ENKO_ANIM_18 }, + /* ENKO_TYPE_CHILD_4 */ { ENKO_ANIM_19, ENKO_ANIM_19, ENKO_ANIM_20, ENKO_ANIM_10, ENKO_ANIM_9 }, + /* ENKO_TYPE_CHILD_5 */ { ENKO_ANIM_3, ENKO_ANIM_3, ENKO_ANIM_3, ENKO_ANIM_3, ENKO_ANIM_3 }, + /* ENKO_TYPE_CHILD_6 */ { ENKO_ANIM_4, ENKO_ANIM_22, ENKO_ANIM_22, ENKO_ANIM_4, ENKO_ANIM_23 }, + /* ENKO_TYPE_CHILD_7 */ { ENKO_ANIM_24, ENKO_ANIM_16, ENKO_ANIM_16, ENKO_ANIM_25, ENKO_ANIM_16 }, + /* ENKO_TYPE_CHILD_8 */ { ENKO_ANIM_26, ENKO_ANIM_15, ENKO_ANIM_15, ENKO_ANIM_26, ENKO_ANIM_15 }, + /* ENKO_TYPE_CHILD_9 */ { ENKO_ANIM_3, ENKO_ANIM_3, ENKO_ANIM_3, ENKO_ANIM_27, ENKO_ANIM_27 }, + /* ENKO_TYPE_CHILD_10 */ { ENKO_ANIM_2, ENKO_ANIM_2, ENKO_ANIM_2, ENKO_ANIM_2, ENKO_ANIM_22 }, + /* ENKO_TYPE_CHILD_11 */ { ENKO_ANIM_14, ENKO_ANIM_14, ENKO_ANIM_14, ENKO_ANIM_14, ENKO_ANIM_14 }, + /* ENKO_TYPE_CHILD_FADO */ { ENKO_ANIM_5, ENKO_ANIM_5, ENKO_ANIM_5, ENKO_ANIM_5, ENKO_ANIM_5 }, }; typedef struct { @@ -627,12 +664,12 @@ s32 func_80A97D68(EnKo* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if ((this->skelAnime.animation == &gObjOsAnim_6A60) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x20); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_32); } arg3 = 2; } else { if ((this->skelAnime.animation == &gObjOsAnim_7830) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x21); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_33); } arg3 = 1; } @@ -680,13 +717,13 @@ s32 func_80A97F70(EnKo* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x1D); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); arg3 = 2; } else { if ((this->skelAnime.animation == &gObjOsAnim_7D94) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x1E); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_30); } arg3 = 1; } @@ -700,14 +737,14 @@ s32 func_80A98034(EnKo* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if ((this->skelAnime.animation == &gObjOsAnim_8F6C) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x1D); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_29); } func_80034F54(globalCtx, this->unk_2E4, this->unk_304, 16); result = EnKo_IsWithinTalkAngle(this); arg3 = (result == true) ? 2 : 1; } else { if ((this->skelAnime.animation == &gObjOsAnim_879C) == false) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 0x1F); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_31); } arg3 = 1; result = EnKo_IsWithinTalkAngle(this); @@ -1113,7 +1150,7 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { this->collider.base.ocFlags1 |= 0x40; } this->forestQuestState = EnKo_GetForestQuestState2(this); - func_80034EC0(&this->skelAnime, sOsAnimeTable, sOsAnimeLookup[ENKO_TYPE][this->forestQuestState]); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, sOsAnimeLookup[ENKO_TYPE][this->forestQuestState]); Actor_SetScale(&this->actor, 0.01f); func_80A98CD8(this); this->modelAlpha = 0.0f; @@ -1134,7 +1171,7 @@ void func_80A99048(EnKo* this, GlobalContext* globalCtx) { void func_80A99384(EnKo* this, GlobalContext* globalCtx) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 != 0 && this->actor.textId == 0x10B9) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_7); this->actionFunc = func_80A99438; } else if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80A99504; @@ -1145,12 +1182,12 @@ void func_80A99384(EnKo* this, GlobalContext* globalCtx) { void func_80A99438(EnKo* this, GlobalContext* globalCtx) { if (ENKO_TYPE == ENKO_TYPE_CHILD_FADO && this->unk_1E8.unk_00 == 2) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99504; globalCtx->msgCtx.stateTimer = 4; globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else if (this->unk_1E8.unk_00 == 0 || this->actor.textId != 0x10B9) { - func_80034EC0(&this->skelAnime, sOsAnimeTable, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_6); this->actionFunc = func_80A99384; } } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index bb42047193..a63d6c52b5 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -56,7 +56,13 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENKZ_ANIM_0, + /* 1 */ ENKZ_ANIM_1, + /* 2 */ ENKZ_ANIM_2 +} EnKzAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gKzIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gKzIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, { &gKzMweepAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, @@ -321,7 +327,7 @@ void EnKz_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01); this->actor.targetMode = 3; this->unk_1E0.unk_00 = 0; - func_80034EC0(&this->skelanime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_0); if (gSaveContext.eventChkInf[3] & 8) { EnKz_SetMovedPos(this, globalCtx); @@ -347,7 +353,7 @@ void EnKz_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) { if (this->unk_1E0.unk_00 == 2) { - func_80034EC0(&this->skelanime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_2); this->unk_1E0.unk_00 = 0; this->actionFunc = EnKz_SetupMweep; } else { @@ -387,7 +393,7 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { initPos.z += 260.0f; Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &pos, &initPos); if ((EnKz_FollowPath(this, globalCtx) == 1) && (this->waypoint == 0)) { - func_80034EC0(&this->skelanime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1); Inventory_ReplaceItem(globalCtx, ITEM_LETTER_RUTO, ITEM_BOTTLE); EnKz_SetMovedPos(this, globalCtx); gSaveContext.eventChkInf[3] |= 8; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index a7c8788e4c..19eafdc9e9 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -60,7 +60,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static struct_D_80AA1678 sAnimationInfo[] = { +typedef enum { + /* 0 */ ENMA1_ANIM_0, + /* 1 */ ENMA1_ANIM_1, + /* 2 */ ENMA1_ANIM_2, + /* 3 */ ENMA1_ANIM_3 +} EnMa1Animation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonChildIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonChildIdleAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, { &gMalonChildSingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, @@ -214,11 +221,11 @@ void EnMa1_UpdateEyes(EnMa1* this) { } } -void EnMa1_ChangeAnimation(EnMa1* this, UNK_TYPE idx) { - f32 frameCount = Animation_GetLastFrame(sAnimationInfo[idx].animation); +void EnMa1_ChangeAnim(EnMa1* this, s32 index) { + f32 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); - Animation_Change(&this->skelAnime, sAnimationInfo[idx].animation, 1.0f, 0.0f, frameCount, sAnimationInfo[idx].mode, - sAnimationInfo[idx].transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount, + sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } void func_80AA0AF4(EnMa1* this, GlobalContext* globalCtx) { @@ -275,10 +282,10 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) { if (!(gSaveContext.eventChkInf[1] & 0x10) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { this->actionFunc = func_80AA0D88; - EnMa1_ChangeAnimation(this, 2); + EnMa1_ChangeAnim(this, ENMA1_ANIM_2); } else { this->actionFunc = func_80AA0F44; - EnMa1_ChangeAnimation(this, 2); + EnMa1_ChangeAnim(this, ENMA1_ANIM_2); } } @@ -292,11 +299,11 @@ void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { - EnMa1_ChangeAnimation(this, 1); + EnMa1_ChangeAnim(this, ENMA1_ANIM_1); } } else { if (this->skelAnime.animation != &gMalonChildSingAnim) { - EnMa1_ChangeAnimation(this, 3); + EnMa1_ChangeAnim(this, ENMA1_ANIM_3); } } @@ -334,11 +341,11 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { - EnMa1_ChangeAnimation(this, 1); + EnMa1_ChangeAnim(this, ENMA1_ANIM_1); } } else { if (this->skelAnime.animation != &gMalonChildSingAnim) { - EnMa1_ChangeAnimation(this, 3); + EnMa1_ChangeAnim(this, ENMA1_ANIM_3); } } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index ac00cde524..8c28ac4ecc 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -54,7 +54,15 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static struct_D_80AA1678 sAnimationInfo[] = { +typedef enum { + /* 0 */ ENMA2_ANIM_0, + /* 1 */ ENMA2_ANIM_1, + /* 2 */ ENMA2_ANIM_2, + /* 3 */ ENMA2_ANIM_3, + /* 4 */ ENMA2_ANIM_4 +} EnMa2Animation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultIdleAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, { &gMalonAdultStandStillAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, @@ -178,11 +186,11 @@ void EnMa2_UpdateEyes(EnMa2* this) { } } -void EnMa2_ChangeAnim(EnMa2* this, s32 idx) { - f32 frameCount = Animation_GetLastFrame(sAnimationInfo[idx].animation); +void EnMa2_ChangeAnim(EnMa2* this, s32 index) { + f32 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); - Animation_Change(&this->skelAnime, sAnimationInfo[idx].animation, 1.0f, 0.0f, frameCount, sAnimationInfo[idx].mode, - sAnimationInfo[idx].transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount, + sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } void func_80AA1DB4(EnMa2* this, GlobalContext* globalCtx) { @@ -213,18 +221,18 @@ void EnMa2_Init(Actor* thisx, GlobalContext* globalCtx) { switch (func_80AA1B58(this, globalCtx)) { case 1: - EnMa2_ChangeAnim(this, 2); + EnMa2_ChangeAnim(this, ENMA2_ANIM_2); this->actionFunc = func_80AA2018; break; case 2: - EnMa2_ChangeAnim(this, 3); + EnMa2_ChangeAnim(this, ENMA2_ANIM_3); this->actionFunc = func_80AA204C; break; case 3: if (gSaveContext.infTable[8] & 0x2000) { - EnMa2_ChangeAnim(this, 0); + EnMa2_ChangeAnim(this, ENMA2_ANIM_0); } else { - EnMa2_ChangeAnim(this, 3); + EnMa2_ChangeAnim(this, ENMA2_ANIM_3); } this->actionFunc = func_80AA2018; break; diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 0b84b24ca5..2973f31d24 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -21,7 +21,6 @@ void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx); s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx); s32 func_80AA2F28(EnMa3* this); void EnMa3_UpdateEyes(EnMa3* this); -void EnMa3_ChangeAnim(EnMa3* this, s32 arg1); void func_80AA3200(EnMa3* this, GlobalContext* globalCtx); const ActorInit En_Ma3_InitVars = { @@ -58,7 +57,15 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static struct_D_80AA1678 sAnimationInfo[] = { +typedef enum { + /* 0 */ ENMA3_ANIM_0, + /* 1 */ ENMA3_ANIM_1, + /* 2 */ ENMA3_ANIM_2, + /* 3 */ ENMA3_ANIM_3, + /* 4 */ ENMA3_ANIM_4 +} EnMa3Animation; + +static AnimationFrameCountInfo sAnimationInfo[] = { { &gMalonAdultIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultIdleAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, { &gMalonAdultStandStillAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, @@ -224,11 +231,11 @@ void EnMa3_UpdateEyes(EnMa3* this) { } } -void EnMa3_ChangeAnim(EnMa3* this, s32 idx) { - f32 frameCount = Animation_GetLastFrame(sAnimationInfo[idx].animation); +void EnMa3_ChangeAnim(EnMa3* this, s32 index) { + f32 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); - Animation_Change(&this->skelAnime, sAnimationInfo[idx].animation, 1.0f, 0.0f, frameCount, sAnimationInfo[idx].mode, - sAnimationInfo[idx].transitionRate); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount, + sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -243,11 +250,11 @@ void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) { switch (func_80AA2EC8(this, globalCtx)) { case 0: - EnMa3_ChangeAnim(this, 0); + EnMa3_ChangeAnim(this, ENMA3_ANIM_0); this->actionFunc = func_80AA3200; break; case 1: - EnMa3_ChangeAnim(this, 0); + EnMa3_ChangeAnim(this, ENMA3_ANIM_0); this->actionFunc = func_80AA3200; break; case 2: diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 837b697692..5ec129cd56 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -55,7 +55,24 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENMD_ANIM_0, + /* 1 */ ENMD_ANIM_1, + /* 2 */ ENMD_ANIM_2, + /* 3 */ ENMD_ANIM_3, + /* 4 */ ENMD_ANIM_4, + /* 5 */ ENMD_ANIM_5, + /* 6 */ ENMD_ANIM_6, + /* 7 */ ENMD_ANIM_7, + /* 8 */ ENMD_ANIM_8, + /* 9 */ ENMD_ANIM_9, + /* 10 */ ENMD_ANIM_10, + /* 11 */ ENMD_ANIM_11, + /* 12 */ ENMD_ANIM_12, + /* 13 */ ENMD_ANIM_13, +} EnMdAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gMidoHandsOnHipsIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gMidoHandsOnHipsIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, { &gMidoRaiseHand1Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, @@ -85,11 +102,11 @@ void func_80AAA250(EnMd* this) { void func_80AAA274(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_3); this->unk_20A++; } } @@ -98,11 +115,11 @@ void func_80AAA274(EnMd* this) { void func_80AAA308(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_4); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_5); this->unk_20A++; } } @@ -111,19 +128,19 @@ void func_80AAA308(EnMd* this) { void func_80AAA39C(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); func_80AAA250(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); this->unk_20A++; } else { break; } case 2: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 8); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_8); this->unk_20A++; } } @@ -132,11 +149,11 @@ void func_80AAA39C(EnMd* this) { void func_80AAA474(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); this->unk_20A++; } } @@ -145,12 +162,12 @@ void func_80AAA474(EnMd* this) { void func_80AAA508(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); func_80AAA250(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); this->unk_20A++; } } @@ -159,11 +176,11 @@ void func_80AAA508(EnMd* this) { void func_80AAA5A4(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_9); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); this->unk_20A++; } } @@ -172,12 +189,12 @@ void func_80AAA5A4(EnMd* this) { void func_80AAA638(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_9); func_80AAA250(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); this->unk_20A++; } } @@ -186,11 +203,11 @@ void func_80AAA638(EnMd* this) { void func_80AAA6D4(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 11); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_11); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); this->unk_20A++; } } @@ -199,11 +216,11 @@ void func_80AAA6D4(EnMd* this) { void func_80AAA768(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 12); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_12); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_3); this->unk_20A++; } } @@ -212,11 +229,11 @@ void func_80AAA768(EnMd* this) { void func_80AAA7FC(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 13); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_13); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); this->unk_20A++; } } @@ -225,12 +242,12 @@ void func_80AAA7FC(EnMd* this) { void func_80AAA890(EnMd* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); func_80AAA250(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); this->unk_20A++; } } @@ -323,7 +340,7 @@ void func_80AAAA24(EnMd* this) { break; } } else if (this->skelAnime.animation != &gMidoHandsOnHipsIdleAnim) { - func_80034EC0(&this->skelAnime, sAnimations, 10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); func_80AAA92C(this, 0); } @@ -622,7 +639,7 @@ void EnMd_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_0); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->alpha = 255; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index d6e1b170fd..93773f51af 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -108,14 +108,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -typedef struct { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ u8 mode; - /* 0x0C */ f32 morphFrames; -} EnMmAnimEntry; // size = 0x10 - -static EnMmAnimEntry sAnimationEntries[] = { +static AnimationSpeedInfo sAnimationInfo[] = { { &gRunningManRunAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManSitStandAnim, -1.0f, ANIMMODE_ONCE, -7.0f }, { &gRunningManSitWaitAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManSitStandAnim, 1.0f, ANIMMODE_ONCE, -7.0f }, { &gRunningManSprintAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManExcitedAnim, 1.0f, ANIMMODE_LOOP, -12.0f }, @@ -140,28 +133,26 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void EnMm_ChangeAnimation(EnMm* this, s32 newAnimIndex, s32* curAnimIndex) { +void EnMm_ChangeAnim(EnMm* this, s32 index, s32* currentIndex) { f32 morphFrames; - if ((*curAnimIndex < 0) || (newAnimIndex == *curAnimIndex)) { + if ((*currentIndex < 0) || (index == *currentIndex)) { morphFrames = 0.0f; } else { - morphFrames = sAnimationEntries[newAnimIndex].morphFrames; + morphFrames = sAnimationInfo[index].morphFrames; } - if (sAnimationEntries[newAnimIndex].playSpeed >= 0.0f) { - Animation_Change(&this->skelAnime, sAnimationEntries[newAnimIndex].animation, - sAnimationEntries[newAnimIndex].playSpeed, 0.0f, - Animation_GetLastFrame(sAnimationEntries[newAnimIndex].animation), - sAnimationEntries[newAnimIndex].mode, morphFrames); + if (sAnimationInfo[index].playSpeed >= 0.0f) { + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].playSpeed, 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + morphFrames); } else { - Animation_Change(&this->skelAnime, sAnimationEntries[newAnimIndex].animation, - sAnimationEntries[newAnimIndex].playSpeed, - Animation_GetLastFrame(sAnimationEntries[newAnimIndex].animation), 0.0f, - sAnimationEntries[newAnimIndex].mode, morphFrames); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].playSpeed, + Animation_GetLastFrame(sAnimationInfo[index].animation), 0.0f, sAnimationInfo[index].mode, + morphFrames); } - *curAnimIndex = newAnimIndex; + *currentIndex = index; } void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -178,9 +169,9 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - Animation_Change(&this->skelAnime, sAnimationEntries[RM_ANIM_RUN].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationEntries[RM_ANIM_RUN].animation), - sAnimationEntries[RM_ANIM_RUN].mode, sAnimationEntries[RM_ANIM_RUN].morphFrames); + Animation_Change(&this->skelAnime, sAnimationInfo[RM_ANIM_RUN].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[RM_ANIM_RUN].animation), sAnimationInfo[RM_ANIM_RUN].mode, + sAnimationInfo[RM_ANIM_RUN].morphFrames); this->path = this->actor.params & 0xFF; this->unk_1F0 = 2; @@ -192,11 +183,11 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { if (func_80AADA70() == 1) { this->mouthTexIndex = RM_MOUTH_OPEN; - EnMm_ChangeAnimation(this, RM_ANIM_RUN, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_RUN, &this->curAnimIndex); this->actionFunc = func_80AAE598; } else { this->mouthTexIndex = RM_MOUTH_CLOSED; - EnMm_ChangeAnimation(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); this->actionFunc = func_80AAE294; } } @@ -234,7 +225,7 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { if (globalCtx->msgCtx.choiceIndex == 0) { player->actor.textId = 0x202D; this->unk_254 &= ~1; - EnMm_ChangeAnimation(this, RM_ANIM_HAPPY, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_HAPPY, &this->curAnimIndex); } else { player->actor.textId = 0x202C; gSaveContext.infTable[23] |= 0x1000; @@ -256,7 +247,7 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { if ((player->actor.textId == 0x202E) || (player->actor.textId == 0x202C)) { this->unk_254 |= 1; - EnMm_ChangeAnimation(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); } sp1C = 0; } @@ -302,7 +293,7 @@ void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { if (this->curAnimIndex != 5) { if ((this->actor.textId == 0x202A) || (this->actor.textId == 0x202B)) { - EnMm_ChangeAnimation(this, RM_ANIM_EXCITED, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_EXCITED, &this->curAnimIndex); func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } } @@ -411,7 +402,7 @@ void func_80AAE224(EnMm* this, GlobalContext* globalCtx) { this->unk_254 |= 1; this->unk_1E0 = 0; this->actor.speedXZ = 0.0f; - EnMm_ChangeAnimation(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_SIT_WAIT, &this->curAnimIndex); } } @@ -452,7 +443,7 @@ void func_80AAE294(EnMm* this, GlobalContext* globalCtx) { if ((floorYNorm > 0.9848f) || (floorYNorm < -0.9848f)) { if (this->sitTimer > 30) { - EnMm_ChangeAnimation(this, RM_ANIM_SIT, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_SIT, &this->curAnimIndex); this->actionFunc = func_80AAE224; } else { this->sitTimer++; @@ -485,10 +476,10 @@ void func_80AAE50C(EnMm* this, GlobalContext* globalCtx) { this->actionFunc = func_80AAE294; if (gSaveContext.itemGetInf[3] & 0x800) { - EnMm_ChangeAnimation(this, RM_ANIM_SPRINT, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_SPRINT, &this->curAnimIndex); this->mouthTexIndex = RM_MOUTH_CLOSED; } else { - EnMm_ChangeAnimation(this, RM_ANIM_RUN, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_RUN, &this->curAnimIndex); this->mouthTexIndex = RM_MOUTH_OPEN; } @@ -504,7 +495,7 @@ void func_80AAE598(EnMm* this, GlobalContext* globalCtx) { this->unk_1E0 = 3; this->actionFunc = func_80AAE50C; this->unk_254 &= ~1; - EnMm_ChangeAnimation(this, RM_ANIM_STAND, &this->curAnimIndex); + EnMm_ChangeAnim(this, RM_ANIM_STAND, &this->curAnimIndex); } } diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 1e85d73304..2f0a9fde0b 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -67,14 +67,7 @@ static ColliderCylinderInit sCylinderInit = { { 18, 63, 0, { 0, 0, 0 } }, }; -typedef struct { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ u8 mode; - /* 0x0C */ f32 morphFrames; -} EnMm2AnimEntry; // size = 0x10 - -static EnMm2AnimEntry sAnimationEntries[] = { +static AnimationSpeedInfo sAnimationInfo[] = { { &gRunningManRunAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManSitStandAnim, -1.0f, ANIMMODE_ONCE, -7.0f }, { &gRunningManSitWaitAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManSitStandAnim, 1.0f, ANIMMODE_ONCE, -7.0f }, { &gRunningManSprintAnim, 1.0f, ANIMMODE_LOOP, -7.0f }, { &gRunningManExcitedAnim, 1.0f, ANIMMODE_LOOP, -12.0f }, @@ -85,27 +78,25 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void EnMm2_ChangeAnimation(EnMm2* this, s32 animationIndex, s32* previousAnimation) { +void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) { f32 phi_f0; - if ((*previousAnimation < 0) || (animationIndex == *previousAnimation)) { + if ((*currentIndex < 0) || (index == *currentIndex)) { phi_f0 = 0.0f; } else { - phi_f0 = sAnimationEntries[animationIndex].morphFrames; + phi_f0 = sAnimationInfo[index].morphFrames; } - if (sAnimationEntries[animationIndex].playSpeed >= 0.0f) { - Animation_Change(&this->skelAnime, sAnimationEntries[animationIndex].animation, - sAnimationEntries[animationIndex].playSpeed, 0.0f, - (f32)Animation_GetLastFrame(sAnimationEntries[animationIndex].animation), - sAnimationEntries[animationIndex].mode, phi_f0); + if (sAnimationInfo[index].playSpeed >= 0.0f) { + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].playSpeed, 0.0f, + (f32)Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + phi_f0); } else { - Animation_Change(&this->skelAnime, sAnimationEntries[animationIndex].animation, - sAnimationEntries[animationIndex].playSpeed, - (f32)Animation_GetLastFrame(sAnimationEntries[animationIndex].animation), 0.0f, - sAnimationEntries[animationIndex].mode, phi_f0); + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, sAnimationInfo[index].playSpeed, + (f32)Animation_GetLastFrame(sAnimationInfo[index].animation), 0.0f, sAnimationInfo[index].mode, + phi_f0); } - *previousAnimation = animationIndex; + *currentIndex = index; } void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { @@ -137,9 +128,9 @@ void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRunningManSkel, NULL, this->jointTable, this->morphTable, 16); - Animation_Change(&this->skelAnime, sAnimationEntries[RM2_ANIM_SIT_WAIT].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationEntries[RM2_ANIM_SIT_WAIT].animation), - sAnimationEntries[RM2_ANIM_SIT_WAIT].mode, sAnimationEntries[RM2_ANIM_SIT_WAIT].morphFrames); + Animation_Change(&this->skelAnime, sAnimationInfo[RM2_ANIM_SIT_WAIT].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[RM2_ANIM_SIT_WAIT].animation), + sAnimationInfo[RM2_ANIM_SIT_WAIT].mode, sAnimationInfo[RM2_ANIM_SIT_WAIT].morphFrames); this->previousAnimation = RM2_ANIM_SIT_WAIT; Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); @@ -197,7 +188,7 @@ void func_80AAF2BC(EnMm2* this, GlobalContext* globalCtx) { void func_80AAF330(EnMm2* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = func_80AAF2BC; - EnMm2_ChangeAnimation(this, 0, &this->previousAnimation); + EnMm2_ChangeAnim(this, RM2_ANIM_RUN, &this->previousAnimation); this->mouthTexIndex = RM2_MOUTH_OPEN; if (!(this->unk_1F4 & 2)) { Message_CloseTextbox(globalCtx); @@ -266,7 +257,7 @@ void func_80AAF5EC(EnMm2* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { this->unk_1F4 &= ~1; - EnMm2_ChangeAnimation(this, 3, &this->previousAnimation); + EnMm2_ChangeAnim(this, RM2_ANIM_STAND, &this->previousAnimation); this->actionFunc = func_80AAF330; } } @@ -290,7 +281,7 @@ void func_80AAF668(EnMm2* this, GlobalContext* globalCtx) { if (!(gSaveContext.eventInf[1] & 1)) { this->unk_1F4 |= 2; this->unk_1F4 &= ~1; - EnMm2_ChangeAnimation(this, 3, &this->previousAnimation); + EnMm2_ChangeAnim(this, RM2_ANIM_STAND, &this->previousAnimation); this->actionFunc = func_80AAF330; } } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 3bf76ec8ba..80db14c63f 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -69,7 +69,22 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -static struct_D_80AA1678 sAnimationInfo[] = { +typedef enum { + /* 0 */ ENSA_ANIM1_0, + /* 1 */ ENSA_ANIM1_1, + /* 2 */ ENSA_ANIM1_2, + /* 3 */ ENSA_ANIM1_3, + /* 4 */ ENSA_ANIM1_4, + /* 5 */ ENSA_ANIM1_5, + /* 6 */ ENSA_ANIM1_6, + /* 7 */ ENSA_ANIM1_7, + /* 8 */ ENSA_ANIM1_8, + /* 9 */ ENSA_ANIM1_9, + /* 10 */ ENSA_ANIM1_10, + /* 11 */ ENSA_ANIM1_11 +} EnSaAnimation1; + +static AnimationFrameCountInfo sAnimationInfo1[] = { { &gSariaWaitArmsToSideAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gSariaLookUpArmExtendedAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gSariaWaveAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, @@ -84,7 +99,20 @@ static struct_D_80AA1678 sAnimationInfo[] = { { &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENSA_ANIM2_0, + /* 1 */ ENSA_ANIM2_1, + /* 2 */ ENSA_ANIM2_2, + /* 3 */ ENSA_ANIM2_3, + /* 4 */ ENSA_ANIM2_4, + /* 5 */ ENSA_ANIM2_5, + /* 6 */ ENSA_ANIM2_6, + /* 7 */ ENSA_ANIM2_7, + /* 8 */ ENSA_ANIM2_8, + /* 9 */ ENSA_ANIM2_9 +} EnSaAnimation2; + +static AnimationInfo sAnimationInfo2[] = { { &gSariaTransitionHandsSideToChestToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gSariaTransitionHandsSideToBackAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -4.0f }, { &gSariaRightArmExtendedWaitAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, @@ -210,11 +238,11 @@ f32 func_80AF5894(EnSa* this) { void func_80AF58B8(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_3); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_2); this->unk_20A++; } break; @@ -224,11 +252,11 @@ void func_80AF58B8(EnSa* this) { void func_80AF594C(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 8); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_8); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_9); this->unk_20A++; } break; @@ -238,11 +266,11 @@ void func_80AF594C(EnSa* this) { void func_80AF59E0(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_1); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_7); this->unk_20A++; } break; @@ -252,12 +280,12 @@ void func_80AF59E0(EnSa* this) { void func_80AF5A74(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_1); func_80AF5894(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_9); this->unk_20A++; } break; @@ -267,11 +295,11 @@ void func_80AF5A74(EnSa* this) { void func_80AF5B10(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_6); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_4); this->unk_20A++; } break; @@ -281,12 +309,12 @@ void func_80AF5B10(EnSa* this) { void func_80AF5BA4(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_6); func_80AF5894(this); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_9); this->unk_20A++; } break; @@ -296,11 +324,11 @@ void func_80AF5BA4(EnSa* this) { void func_80AF5C40(EnSa* this) { switch (this->unk_20A) { case 0: - func_80034EC0(&this->skelAnime, sAnimations, 5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_5); this->unk_20A++; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo2, ENSA_ANIM2_0); this->unk_20A++; } break; @@ -338,10 +366,10 @@ void func_80AF5CE4(EnSa* this) { } } -void EnSa_ChangeAnim(EnSa* this, s32 action) { - Animation_Change(&this->skelAnime, sAnimationInfo[action].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[action].animation), sAnimationInfo[action].mode, - sAnimationInfo[action].transitionRate); +void EnSa_ChangeAnim(EnSa* this, s32 index) { + Animation_Change(&this->skelAnime, sAnimationInfo1[index].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo1[index].animation), sAnimationInfo1[index].mode, + sAnimationInfo1[index].morphFrames); } s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { @@ -454,16 +482,16 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { switch (func_80AF5DFC(this, globalCtx)) { case 2: - EnSa_ChangeAnim(this, 0xB); + EnSa_ChangeAnim(this, ENSA_ANIM1_11); this->actionFunc = func_80AF6448; break; case 5: - EnSa_ChangeAnim(this, 0xB); + EnSa_ChangeAnim(this, ENSA_ANIM1_11); this->actionFunc = func_80AF683C; break; case 1: this->actor.gravity = -1.0f; - EnSa_ChangeAnim(this, 0); + EnSa_ChangeAnim(this, ENSA_ANIM1_0); this->actionFunc = func_80AF6448; break; case 4: @@ -471,13 +499,13 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSpot04Cs_10E20); gSaveContext.cutsceneTrigger = 1; - EnSa_ChangeAnim(this, 4); + EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actionFunc = func_80AF68E4; break; case 3: this->unk_210 = 0; this->actor.gravity = -1.0f; - EnSa_ChangeAnim(this, 0); + EnSa_ChangeAnim(this, ENSA_ANIM1_0); this->actionFunc = func_80AF68E4; break; case 0: @@ -569,7 +597,7 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) { this->skelAnime.playSpeed = -1.0f; if ((s32)this->skelAnime.curFrame == 0) { - EnSa_ChangeAnim(this, 6); + EnSa_ChangeAnim(this, ENSA_ANIM1_6); } } if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) { @@ -670,11 +698,11 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { if (globalCtx->sceneNum == SCENE_SPOT05) { Item_Give(globalCtx, ITEM_SONG_SARIA); - EnSa_ChangeAnim(this, 6); + EnSa_ChangeAnim(this, ENSA_ANIM1_6); } if (globalCtx->sceneNum == SCENE_SPOT04) { - EnSa_ChangeAnim(this, 4); + EnSa_ChangeAnim(this, ENSA_ANIM1_4); this->actor.world.pos = this->actor.home.pos; this->actor.world.rot = this->unk_21A; this->mouthIndex = 0; @@ -694,7 +722,7 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->skelAnime.animation == &gSariaOcarinaToMouthAnim && this->skelAnime.curFrame >= Animation_GetLastFrame(&gSariaOcarinaToMouthAnim)) { - EnSa_ChangeAnim(this, 6); + EnSa_ChangeAnim(this, ENSA_ANIM1_6); } if (this->actionFunc != func_80AF68E4) { diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index b718a023c1..3255195f0f 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -233,13 +233,7 @@ static s32 sOcarinaGameRewards[] = { GI_RUPEE_RED, }; -typedef struct { - AnimationHeader* animation; - u8 mode; - f32 morphFrames; -} SkullkidAnimationEntry; - -static SkullkidAnimationEntry sSkullKidAnimations[] = { +static AnimationMinimalInfo sAnimationInfo[] = { { &gSkullKidBackflipAnim, ANIMMODE_ONCE, 0.0f }, { &gSkullKidShootNeedleAnim, ANIMMODE_ONCE, 0.0f }, { &gSkullKidPlayFluteAnim, ANIMMODE_LOOP, 0.0f }, @@ -291,12 +285,12 @@ static InitChainEntry sInitChain[] = { static s32 D_80B01EA0; // gets set if ACTOR_FLAG_8 is set -void EnSkj_ChangeAnim(EnSkj* this, u8 animIndex) { - f32 endFrame = Animation_GetLastFrame(sSkullKidAnimations[animIndex].animation); +void EnSkj_ChangeAnim(EnSkj* this, u8 index) { + f32 endFrame = Animation_GetLastFrame(sAnimationInfo[index].animation); - this->animIndex = animIndex; - Animation_Change(&this->skelAnime, sSkullKidAnimations[animIndex].animation, 1.0f, 0.0f, endFrame, - sSkullKidAnimations[animIndex].mode, sSkullKidAnimations[animIndex].morphFrames); + this->animIndex = index; + Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, endFrame, + sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } void EnSkj_SetupAction(EnSkj* this, u8 action) { diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index ad18aa205a..37dd2c66d1 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -104,7 +104,18 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENST_ANIM_0, + /* 1 */ ENST_ANIM_1, + /* 2 */ ENST_ANIM_2, + /* 3 */ ENST_ANIM_3, + /* 4 */ ENST_ANIM_4, + /* 5 */ ENST_ANIM_5, + /* 6 */ ENST_ANIM_6, + /* 7 */ ENST_ANIM_7 +} EnStAnimation; + +static AnimationInfo sAnimationInfo[] = { { &object_st_Anim_000304, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, 0.0f }, { &object_st_Anim_005B98, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, { &object_st_Anim_000304, 4.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, @@ -234,24 +245,24 @@ void EnSt_AddBlurSpace(EnSt* this) { } void EnSt_SetWaitingAnimation(EnSt* this) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); } void EnSt_SetReturnToCeilingAnimation(EnSt* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_UP); - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_2); } void EnSt_SetLandAnimation(EnSt* this) { this->actor.world.pos.y = this->actor.floorHeight + this->floorHeightOffset; - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_4); this->sfxTimer = 0; this->animFrames = this->skelAnime.animLength; } void EnSt_SetDropAnimAndVel(EnSt* this) { if (this->takeDamageSpinTimer == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_4); this->animFrames = this->skelAnime.animLength; } this->sfxTimer = 0; @@ -440,7 +451,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) { this->swayTimer = this->stunTimer = 0; this->gaveDamageSpinTimer = 1; - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); this->takeDamageSpinTimer = this->skelAnime.animLength; Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->takeDamageSpinTimer); if (Actor_ApplyDamage(&this->actor)) { @@ -769,7 +780,7 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); - func_80034EC0(&this->skelAnime, sAnimations, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_0); this->blureIdx = EnSt_CreateBlureEffect(globalCtx); EnSt_InitColliders(this, globalCtx); if (thisx->params == 2) { @@ -817,14 +828,14 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); } } if (this->animFrames != 0) { this->animFrames--; if (this->animFrames == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); } } @@ -849,14 +860,14 @@ void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) { if (this->animFrames != 0) { this->animFrames--; if (this->animFrames == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); } } if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3); } } @@ -879,7 +890,7 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) { if (this->takeDamageSpinTimer != 0) { this->takeDamageSpinTimer--; if (this->takeDamageSpinTimer == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_5); } } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 538558fdf2..1fd1c5836a 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -47,7 +47,14 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 D_80B0F074 = { 1, 2, 25, 25, MASS_IMMOVABLE }; -static struct_80034EC0_Entry D_80B0F080[] = { +typedef enum { + /* 0 */ ENSW_ANIM_0, + /* 1 */ ENSW_ANIM_1, + /* 2 */ ENSW_ANIM_2, + /* 3 */ ENSW_ANIM_3 +} EnSwAnimation; + +static AnimationInfo sAnimationInfo[] = { { &object_st_Anim_000304, 1.0f, 0.0f, -1.0f, 0x01, 0.0f }, { &object_st_Anim_000304, 1.0f, 0.0f, -1.0f, 0x01, -8.0f }, { &object_st_Anim_0055A8, 1.0f, 0.0f, -1.0f, 0x01, -8.0f }, @@ -229,7 +236,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { } SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); - func_80034EC0(&this->skelAnime, D_80B0F080, 0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENSW_ANIM_0); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Collider_InitJntSph(globalCtx, &this->collider); Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs); diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 440b3240c1..e1d1981324 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -87,14 +87,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -typedef struct { - AnimationHeader* anim; - f32 unk_4; - u8 mode; - f32 transitionRate; -} EnToryoAnimation; - -static EnToryoAnimation sEnToryoAnimation = { &object_toryo_Anim_000E50, 1.0f, 0, 0 }; +static AnimationSpeedInfo sEnToryoAnimation = { &object_toryo_Anim_000E50, 1.0f, 0, 0 }; static Vec3f sMultVec = { 800.0f, 1000.0f, 0.0f }; @@ -131,9 +124,9 @@ void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - Animation_Change(&this->skelAnime, sEnToryoAnimation.anim, 1.0f, 0.0f, - Animation_GetLastFrame(sEnToryoAnimation.anim), sEnToryoAnimation.mode, - sEnToryoAnimation.transitionRate); + Animation_Change(&this->skelAnime, sEnToryoAnimation.animation, 1.0f, 0.0f, + Animation_GetLastFrame(sEnToryoAnimation.animation), sEnToryoAnimation.mode, + sEnToryoAnimation.morphFrames); this->stateFlags |= 8; this->actor.targetMode = 6; this->actionFunc = func_80B20914; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 8312009e34..22a57fdbcd 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -129,7 +129,7 @@ typedef enum { /* 33 */ ZL4_ANIM_33 } EnZl4Animation; -static struct_80034EC0_Entry sAnimationEntries[] = { +static AnimationInfo sAnimationInfo[] = { /* 0 */ /* standing idle */ { &gChildZeldaAnim_000654, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, /* 1 */ /* moves to introduce herself */ { &gChildZeldaAnim_00E5C8, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, /* 2 */ /* introducing herself */ { &gChildZeldaAnim_00EBC4, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, @@ -362,7 +362,7 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gChildZeldaSkel, NULL, this->jointTable, this->morphTable, 18); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_21); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_21); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -372,19 +372,19 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeExpression = this->mouthExpression = ZL4_MOUTH_NEUTRAL; if (gSaveContext.sceneSetupIndex >= 4) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->actionFunc = EnZl4_TheEnd; } else if (gSaveContext.eventChkInf[4] & 1) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->actionFunc = EnZl4_Idle; } else { if (gSaveContext.entranceIndex != 0x5F0) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_21); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_21); this->csState = ZL4_CS_WAIT; this->talkState = 0; } else { EnZl4_SetupFromLegendCs(this, globalCtx); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->csState = ZL4_CS_LEGEND; this->talkState = 0; } @@ -403,7 +403,7 @@ s32 EnZl4_SetNextAnim(EnZl4* this, s32 nextAnim) { if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { return false; } - func_80034EC0(&this->skelAnime, sAnimationEntries, nextAnim); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, nextAnim); return true; } @@ -498,7 +498,7 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { case 6: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraAngle(globalCtx, 2); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_22); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_22); this->mouthExpression = ZL4_MOUTH_NEUTRAL; this->talkTimer2 = 0; this->talkState++; @@ -534,7 +534,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { EnZl4_SetCsCameraAngle(globalCtx, 4); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_28); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; @@ -542,7 +542,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState = 7; } else { EnZl4_SetCsCameraAngle(globalCtx, 2); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; Message_StartTextbox(globalCtx, 0x7031, NULL); this->talkState++; @@ -558,7 +558,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { case 5: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; EnZl4_ReverseAnimation(this); this->talkState = 6; @@ -579,7 +579,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { EnZl4_SetCsCameraAngle(globalCtx, 4); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_28); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; @@ -587,7 +587,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { this->talkState = 7; } else { EnZl4_SetCsCameraAngle(globalCtx, 2); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; Message_StartTextbox(globalCtx, 0x7031, NULL); this->talkState = 4; @@ -603,7 +603,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { case 8: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraMove(globalCtx, 2); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_NEUTRAL; @@ -620,7 +620,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; case 10: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->eyeExpression = ZL4_EYES_OPEN; this->mouthExpression = ZL4_MOUTH_SURPRISED; Message_StartTextbox(globalCtx, 0x70FE, NULL); @@ -641,7 +641,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { case 1: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraAngle(globalCtx, 6); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_1); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_NEUTRAL; @@ -656,7 +656,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { } case 3: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_16); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_16); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; @@ -672,7 +672,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { case 5: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraMove(globalCtx, 3); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 6; @@ -687,7 +687,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { break; case 7: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->mouthExpression = ZL4_MOUTH_HAPPY; Message_StartTextbox(globalCtx, 0x2075, NULL); this->talkState++; @@ -707,7 +707,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { EnZl4_SetCsCameraMove(globalCtx, 4); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_33); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; @@ -723,7 +723,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { break; case 11: if (DECR(this->talkTimer1) == 0) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_11); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_11); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_RIGHT; this->mouthExpression = ZL4_MOUTH_WORRIED; @@ -740,7 +740,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { } case 13: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_6); this->blinkTimer = 3; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_HAPPY; @@ -822,7 +822,7 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x7005, NULL); this->talkState = 9; } else { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_5); this->mouthExpression = ZL4_MOUTH_SURPRISED; Message_StartTextbox(globalCtx, 0x7038, NULL); this->talkState++; @@ -835,7 +835,7 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { } case 6: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_33); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; Message_StartTextbox(globalCtx, 0x7037, NULL); this->talkState++; @@ -855,7 +855,7 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { break; case 9: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_26); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_26); Message_StartTextbox(globalCtx, 0x2078, NULL); this->talkState++; } @@ -913,7 +913,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { } else { func_800AA000(0.0f, 0xA0, 0xA, 0x28); func_8002DF54(globalCtx, &this->actor, 1); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_30); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); EnZl4_SetCsCameraAngle(globalCtx, 11); Message_StartTextbox(globalCtx, 0x7039, NULL); this->talkState++; @@ -970,7 +970,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { case 4: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraAngle(globalCtx, 12); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_23); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_23); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; @@ -994,14 +994,14 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_31); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_31); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; this->mouthExpression = ZL4_MOUTH_HAPPY; Message_StartTextbox(globalCtx, 0x703B, NULL); this->talkState = 11; } else { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_13); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_13); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_LOOK_LEFT; this->mouthExpression = ZL4_MOUTH_WORRIED; @@ -1020,7 +1020,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { break; case 9: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_14); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_14); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } @@ -1048,7 +1048,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { switch (this->talkState) { case 0: - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_18); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_18); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_WORRIED; @@ -1065,7 +1065,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { case 2: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { EnZl4_SetCsCameraAngle(globalCtx, 13); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_19); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_19); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; @@ -1080,7 +1080,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { case 4: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { Message_StartTextbox(globalCtx, 0x207D, NULL); - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_7); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_7); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_NEUTRAL; @@ -1107,7 +1107,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { break; case 7: if (Actor_HasParent(&this->actor, globalCtx)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->talkState++; } else { func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, @@ -1129,7 +1129,7 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { } break; case ZL4_CS_START: - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_3); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; @@ -1205,7 +1205,7 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { Vec3f pos; if (SkelAnime_Update(&this->skelAnime) && (this->skelAnime.animation == &gChildZeldaAnim_010DF8)) { - func_80034EC0(&this->skelAnime, sAnimationEntries, ZL4_ANIM_4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_4); } if (EnZl4_InMovingAnim(this)) { EnZl4_SetMove(this, globalCtx); @@ -1225,7 +1225,7 @@ void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) { this->actor.world.pos = this->actor.home.pos = pos; } if (this->lastAction != npcAction->action) { - func_80034EC0(&this->skelAnime, sAnimationEntries, animIndex[npcAction->action]); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animIndex[npcAction->action]); this->lastAction = npcAction->action; } this->actor.velocity.x = 0.0f; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index d1bfb3509c..2fab40e8b0 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -309,7 +309,18 @@ const ActorInit En_Zo_InitVars = { (ActorFunc)EnZo_Draw, }; -static struct_80034EC0_Entry sAnimations[] = { +typedef enum { + /* 0 */ ENZO_ANIM_0, + /* 1 */ ENZO_ANIM_1, + /* 2 */ ENZO_ANIM_2, + /* 3 */ ENZO_ANIM_3, + /* 4 */ ENZO_ANIM_4, + /* 5 */ ENZO_ANIM_5, + /* 6 */ ENZO_ANIM_6, + /* 7 */ ENZO_ANIM_7 +} EnZoAnimation; + +static AnimationInfo sAnimationInfo[] = { { &gZoraIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &gZoraIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gZoraSurfaceAnim, 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f }, @@ -526,31 +537,31 @@ s32 EnZo_PlayerInProximity(EnZo* this, GlobalContext* globalCtx) { } void EnZo_SetAnimation(EnZo* this) { - s32 animId = 8; + s32 animId = ARRAY_COUNT(sAnimationInfo); if (this->skelAnime.animation == &gZoraHandsOnHipsTappingFootAnim || this->skelAnime.animation == &gZoraOpenArmsAnim) { if (this->unk_194.unk_00 == 0) { if (this->actionFunc == EnZo_Standing) { - animId = 0; + animId = ENZO_ANIM_0; } else { - animId = 3; + animId = ENZO_ANIM_3; } } } if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4006 && this->skelAnime.animation != &gZoraHandsOnHipsTappingFootAnim) { - animId = 6; + animId = ENZO_ANIM_6; } if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4007 && this->skelAnime.animation != &gZoraOpenArmsAnim) { - animId = 7; + animId = ENZO_ANIM_7; } - if (animId != 8) { - func_80034EC0(&this->skelAnime, sAnimations, animId); - if (animId == 3) { + if (animId != ARRAY_COUNT(sAnimationInfo)) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animId); + if (animId == ENZO_ANIM_3) { this->skelAnime.curFrame = this->skelAnime.endFrame; this->skelAnime.playSpeed = 0.0f; } @@ -571,7 +582,7 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_2); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->dialogRadius = this->collider.dim.radius + 30.0f; @@ -584,7 +595,7 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.yDistToWater < 54.0f || (this->actor.params & 0x3F) == 8) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.shape.shadowScale = 24.0f; - func_80034EC0(&this->skelAnime, sAnimations, 1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_1); this->canSpeak = true; this->alpha = 255.0f; this->actionFunc = EnZo_Standing; @@ -630,7 +641,7 @@ void EnZo_Surface(EnZo* this, GlobalContext* globalCtx) { if (this->actor.yDistToWater < 54.0f) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_OUT_OF_WATER); EnZo_SpawnSplashes(this); - func_80034EC0(&this->skelAnime, sAnimations, 3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_3); this->actor.flags |= ACTOR_FLAG_0; this->actionFunc = EnZo_TreadWater; this->actor.velocity.y = 0.0f; @@ -665,7 +676,7 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { this->timeToDive = Rand_S16Offset(40, 40); } else if (DECR(this->timeToDive) == 0) { f32 startFrame; - func_80034EC0(&this->skelAnime, sAnimations, 4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_4); this->canSpeak = false; this->unk_64C = 1; this->actionFunc = EnZo_Dive; @@ -696,7 +707,7 @@ void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { } if ((s16)this->alpha == 0) { - func_80034EC0(&this->skelAnime, sAnimations, 2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENZO_ANIM_2); this->actor.world.pos = this->actor.home.pos; this->alpha = 0.0f; this->actionFunc = EnZo_Submerged; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 3c57312fda..7683469feb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -27,8 +27,8 @@ typedef struct { u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { StickDrawInfo drawInfo[] = { - { OBJECT_LINK_BOY, gLinkAdultBrokenGiantsKnifeBladeDL }, // adult, broken sword - { OBJECT_LINK_CHILD, gLinkChildLinkDekuStickDL }, // child, broken stick + { OBJECT_LINK_BOY, gLinkAdultBrokenGiantsKnifeBladeDL }, // adult, broken sword + { OBJECT_LINK_CHILD, gLinkChildLinkDekuStickDL }, // child, broken stick }; StickDrawInfo* ageInfoEntry = gSaveContext.linkAge + drawInfo; EffectSsStickInitParams* initParams = (EffectSsStickInitParams*)initParamsx;