From 64b1fafd33bd7092c9cd2e703c3ccc41751c01a4 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:39:25 +1000 Subject: [PATCH] Animation Cleanup: En_H* (#1399) * begin H * more cleanup --- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 2 +- src/overlays/actors/ovl_Boss_04/z_boss_04.h | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.h | 2 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 2 +- .../actors/ovl_En_Hanabi/z_en_hanabi.c | 1 + .../actors/ovl_En_Heishi/z_en_heishi.c | 45 +++--- .../actors/ovl_En_Heishi/z_en_heishi.h | 2 +- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 55 ++++--- src/overlays/actors/ovl_En_Hgo/z_en_hgo.c | 68 +++++---- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 107 ++++++++----- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.h | 9 +- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 113 ++++++++------ .../actors/ovl_En_Hint_Skb/z_en_hint_skb.h | 5 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 140 ++++++++++-------- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 6 +- .../z_en_horse_link_child.c | 92 ++++++------ src/overlays/actors/ovl_En_Hs/z_en_hs.c | 13 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 16 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 2 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.h | 2 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 2 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.h | 2 +- tools/disasm/functions.txt | 2 +- tools/disasm/variables.txt | 4 +- 25 files changed, 406 insertions(+), 290 deletions(-) diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 82495ea1e4..c35e6e9b17 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -173,7 +173,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) { this->unk_6F8 = 1.0f; Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); Collider_InitAndSetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); - SkelAnime_InitFlex(play, &this->skelAnime, &gWartSkel, &gWartIdleAnim, this->jointTable, this->morphtable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWartSkel, &gWartIdleAnim, this->jointTable, this->morphTable, WART_LIMB_MAX); spA8.y = this->actor.world.pos.y + 200.0f; diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.h b/src/overlays/actors/ovl_Boss_04/z_boss_04.h index 6aa1535970..97c296b847 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.h +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.h @@ -12,7 +12,7 @@ typedef struct Boss04 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[WART_LIMB_MAX]; - /* 0x1BE */ Vec3s morphtable[WART_LIMB_MAX]; + /* 0x1BE */ Vec3s morphTable[WART_LIMB_MAX]; /* 0x1F4 */ s16 unk_1F4; /* 0x1F6 */ u8 unk_1F6; /* 0x1F7 */ u8 unk_1F7; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 21d8bf309c..4f4b15545a 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -142,7 +142,7 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -1.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, - this->morphtable, OBJECT_CS_LIMB_MAX); + this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h index 76013781b2..500fff573c 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h @@ -25,7 +25,7 @@ typedef struct EnBombers { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; - /* 0x206 */ Vec3s morphtable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombersActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 30dc3de261..89ee2e5fd6 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -933,7 +933,7 @@ void EnEgol_Slam(EnEgol* this, PlayState* play) { } EnEgol_DestroyBlocks(this, play, this->rightHandPos, this->leftHandPos); } - if (this->animEndFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnEgol_SetupSlamWait(this); } else if ((this->skelAnime.curFrame <= 17.0f) && (this->skelAnime.curFrame >= 10.0f)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 841e6f539a..85000e5cbf 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -194,6 +194,7 @@ void EnHanabi_Init(Actor* thisx, PlayState* play2) { EnHanabi* this = THIS; s32 i; + //! FAKE: if (1) {} Actor_SetScale(thisx, 1.0f); diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index 83973d9e9e..19c2a34a8f 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -20,14 +20,6 @@ void EnHeishi_SetHeadRotation(EnHeishi* this); void EnHeishi_SetupIdle(EnHeishi* this); void EnHeishi_Idle(EnHeishi* this, PlayState* play); -typedef enum { - /* 0 */ HEISHI_ANIM_STAND_HAND_ON_HIP, - /* 1 */ HEISHI_ANIM_CHEER_WITH_SPEAR, - /* 2 */ HEISHI_ANIM_WAVE, - /* 3 */ HEISHI_ANIM_SIT_AND_REACH, - /* 4 */ HEISHI_ANIM_STAND_UP -} EnHeishiAnimation; - ActorInit En_Heishi_InitVars = { ACTOR_EN_HEISHI, ACTORCAT_NPC, @@ -97,19 +89,36 @@ void EnHeishi_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliderCylinder); } +typedef enum EnHeishiAnimation { + /* 0 */ HEISHI_ANIM_STAND_HAND_ON_HIP, + /* 1 */ HEISHI_ANIM_CHEER_WITH_SPEAR, + /* 2 */ HEISHI_ANIM_WAVE, + /* 3 */ HEISHI_ANIM_SIT_AND_REACH, + /* 4 */ HEISHI_ANIM_STAND_UP, + /* 5 */ HEISHI_ANIM_MAX +} EnHeishiAnimation; + +static AnimationHeader* sAnimations[HEISHI_ANIM_MAX] = { + &gSoldierStandHandOnHip, // HEISHI_ANIM_STAND_HAND_ON_HIP + &gSoldierCheerWithSpear, // HEISHI_ANIM_CHEER_WITH_SPEAR + &gSoldierWave, // HEISHI_ANIM_WAVE + &gSoldierSitAndReach, // HEISHI_ANIM_SIT_AND_REACH + &gSoldierStandUp, // HEISHI_ANIM_STAND_UP +}; + +static u8 sAnimationModes[HEISHI_ANIM_MAX] = { + ANIMMODE_LOOP, // HEISHI_ANIM_STAND_HAND_ON_HIP + ANIMMODE_LOOP, // HEISHI_ANIM_CHEER_WITH_SPEAR + ANIMMODE_LOOP, // HEISHI_ANIM_WAVE + ANIMMODE_LOOP, // HEISHI_ANIM_SIT_AND_REACH + ANIMMODE_ONCE, // HEISHI_ANIM_STAND_UP +}; + void EnHeishi_ChangeAnim(EnHeishi* this, s32 animIndex) { - static AnimationHeader* sAnimations[] = { - &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, - }; - static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, - }; this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -10.0f); } diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h index 1758ceae6d..4d886cb3c0 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h @@ -25,7 +25,7 @@ typedef struct EnHeishi { /* 0x26C */ s32 shouldSetHeadRotation; /* 0x270 */ s16 timer; /* 0x272 */ s16 yawTowardsPlayer; - /* 0x274 */ f32 frameCount; + /* 0x274 */ f32 animEndFrame; /* 0x278 */ s16 unk278; // set and not used /* 0x27C */ UNK_TYPE1 unk_27C[0x8]; /* 0x284 */ ColliderCylinder colliderCylinder; diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 2c652f11c4..ded070de41 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -29,17 +29,6 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play); s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); -typedef enum { - /* 0 */ HG_ANIM_IDLE, - /* 1 */ HG_ANIM_LURCH_FORWARD, - /* 2 */ HG_ANIM_RECOIL, - /* 3 */ HG_ANIM_LEAN_FORWARD, - /* 4 */ HG_ANIM_REACH_FORWARD, - /* 5 */ HG_ANIM_CURL_UP, - /* 6 */ HG_ANIM_CROUCHED_PANIC, - /* 7 */ HG_ANIM_PANIC -} HgAnimation; - typedef enum { /* 0 */ HG_CS_FIRST_ENCOUNTER, /* 1 */ HG_CS_GET_MASK, @@ -118,15 +107,27 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, 0x80, }; -static AnimationInfo sAnimationInfo[] = { - { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ HG_ANIM_IDLE, + /* 1 */ HG_ANIM_LURCH_FORWARD, + /* 2 */ HG_ANIM_RECOIL, + /* 3 */ HG_ANIM_LEAN_FORWARD, + /* 4 */ HG_ANIM_REACH_FORWARD, + /* 5 */ HG_ANIM_CURL_UP, + /* 6 */ HG_ANIM_CROUCHED_PANIC, + /* 7 */ HG_ANIM_PANIC, + /* 8 */ HG_ANIM_MAX +} HgAnimation; + +static AnimationInfo sAnimationInfo[HG_ANIM_MAX] = { + { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_IDLE + { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_LURCH_FORWARD + { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_RECOIL + { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_LEAN_FORWARD + { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_REACH_FORWARD + { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_CURL_UP + { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_CROUCHED_PANIC + { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_PANIC }; static u32 sHasSoundPlayed = false; @@ -192,7 +193,7 @@ void EnHg_ChasePlayer(EnHg* this, PlayState* play) { s32 pad; this->actor.speed = 1.6f; - if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { + if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) || ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) { Actor_MoveWithGravity(&this->actor); @@ -233,7 +234,6 @@ void EnHg_ReactToHit(EnHg* this, PlayState* play) { void EnHg_HandleTatlDialog(EnHg* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - // "...Sort of looks different..." Message_StartTextbox(play, 0x24F, &this->actor); } else { Actor_OfferTalk(&this->actor, play, 80.0f); @@ -295,7 +295,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { this->csIdList[3] = play->csCtx.actorCues[cueChannel]->id; switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->animIndex = 0; + this->animIndex = HG_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_IDLE); break; @@ -329,6 +329,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_75_20); Actor_Kill(&this->actor); break; + + default: + break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->animIndex) { @@ -341,6 +344,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { this->animIndex = HG_ANIM_CROUCHED_PANIC; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_CROUCHED_PANIC); break; + + default: + break; } } @@ -360,6 +366,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); } break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index 15bfd598b6..c4d9c03715 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -38,16 +38,6 @@ typedef enum { /* 2 */ HGO_EYE_CLOSED } EyeState; -typedef enum { - /* 0 */ HGO_ANIM_ARMS_FOLDED, - /* 1 */ HGO_ANIM_ASTONISHED, - /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG, - /* 3 */ HGO_ANIM_CONSOLE, - /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP, - /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT, - /* 6 */ HGO_ANIM_TOSS -} HgoAnimation; - ActorInit En_Hgo_InitVars = { ACTOR_EN_HGO, ACTORCAT_NPC, @@ -60,14 +50,25 @@ ActorInit En_Hgo_InitVars = { (ActorFunc)EnHgo_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ HGO_ANIM_ARMS_FOLDED, + /* 1 */ HGO_ANIM_ASTONISHED, + /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG, + /* 3 */ HGO_ANIM_CONSOLE, + /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP, + /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT, + /* 6 */ HGO_ANIM_TOSS, + /* 7 */ HGO_ANIM_MAX +} HgoAnimation; + +static AnimationInfo sAnimationInfo[HGO_ANIM_MAX] = { + { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HGO_ANIM_ARMS_FOLDED + { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_ASTONISHED + { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_KNEEL_DOWN_AND_HUG + { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE + { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE_HEAD_UP + { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_REACH_DOWN_TO_LIFT + { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_TOSS }; static ColliderCylinderInit sCylinderInit = { @@ -109,6 +110,7 @@ void EnHgo_Init(Actor* thisx, PlayState* play) { this->textId = 0; this->talkFlags = TALK_FLAG_NONE; this->isInCutscene = false; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { EnHgo_SetupTalk(this); } else { @@ -143,7 +145,7 @@ void EnHgo_UpdateCollision(EnHgo* this, PlayState* play) { } void EnHgo_SetupTalk(EnHgo* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED); this->actionFunc = EnHgo_Talk; } @@ -206,6 +208,9 @@ void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play) { EnHgo_SetupTalk(this); } break; + + default: + break; } Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x71C, 0xB6); @@ -271,6 +276,9 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) { Message_CloseTextbox(play); EnHgo_SetupTalk(this); break; + + default: + break; } } } @@ -285,33 +293,36 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = HGO_ANIM_ARMS_FOLDED; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED); break; case 2: this->actor.draw = EnHgo_Draw; this->animIndex = HGO_ANIM_ASTONISHED; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ASTONISHED); break; case 3: this->animIndex = HGO_ANIM_KNEEL_DOWN_AND_HUG; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_KNEEL_DOWN_AND_HUG); break; case 4: this->animIndex = HGO_ANIM_CONSOLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE); break; case 5: this->animIndex = HGO_ANIM_CONSOLE_HEAD_UP; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE_HEAD_UP); break; case 6: this->animIndex = HGO_ANIM_REACH_DOWN_TO_LIFT; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_REACH_DOWN_TO_LIFT); + break; + + default: break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -328,12 +339,15 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { case HGO_ANIM_KNEEL_DOWN_AND_HUG: this->animIndex = HGO_ANIM_CONSOLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE); break; case HGO_ANIM_REACH_DOWN_TO_LIFT: this->animIndex = HGO_ANIM_TOSS; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_TOSS); + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index e07dfb8a96..5d1e0ee242 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -6,7 +6,6 @@ #include "z_en_hidden_nuts.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_hintnuts/object_hintnuts.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_2000000) @@ -63,15 +62,41 @@ static ColliderCylinderInit sCylinderInit = { { 30, 20, 0, { 0, 0, 0 } }, }; -static AnimationHeader* D_80BDC0FC[] = { - &object_hintnuts_Anim_000168, &object_hintnuts_Anim_0024CC, &object_hintnuts_Anim_0026C4, - &object_hintnuts_Anim_002894, &object_hintnuts_Anim_002B90, &object_hintnuts_Anim_002F7C, - &object_hintnuts_Anim_003128, &object_hintnuts_Anim_0029BC, &object_hintnuts_Anim_0024CC, +typedef enum EnHiddenNutsAnimation { + /* 0 */ ENHIDDENNUTS_ANIM_0, + /* 1 */ ENHIDDENNUTS_ANIM_1, + /* 2 */ ENHIDDENNUTS_ANIM_2, + /* 3 */ ENHIDDENNUTS_ANIM_3, + /* 4 */ ENHIDDENNUTS_ANIM_4, + /* 5 */ ENHIDDENNUTS_ANIM_5, + /* 6 */ ENHIDDENNUTS_ANIM_6, + /* 7 */ ENHIDDENNUTS_ANIM_7, + /* 8 */ ENHIDDENNUTS_ANIM_8, + /* 9 */ ENHIDDENNUTS_ANIM_MAX +} EnHiddenNutsAnimation; + +static AnimationHeader* sAnimations[ENHIDDENNUTS_ANIM_MAX] = { + &object_hintnuts_Anim_000168, // ENHIDDENNUTS_ANIM_0 + &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_1 + &object_hintnuts_Anim_0026C4, // ENHIDDENNUTS_ANIM_2 + &object_hintnuts_Anim_002894, // ENHIDDENNUTS_ANIM_3 + &object_hintnuts_Anim_002B90, // ENHIDDENNUTS_ANIM_4 + &object_hintnuts_Anim_002F7C, // ENHIDDENNUTS_ANIM_5 + &object_hintnuts_Anim_003128, // ENHIDDENNUTS_ANIM_6 + &object_hintnuts_Anim_0029BC, // ENHIDDENNUTS_ANIM_7 + &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_8 }; -u8 D_80BDC120[] = { - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, +static u8 sAnimationModes[ENHIDDENNUTS_ANIM_MAX] = { + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_0 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_1 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_2 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_3 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_4 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_5 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_6 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_7 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_8 }; void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { @@ -79,7 +104,7 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC, - this->jointTable, this->morphTable, 10); + this->jointTable, this->morphTable, OBJECT_HINTNUTS_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -116,27 +141,29 @@ void EnHiddenNuts_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80BDB1B4(EnHiddenNuts* this, s32 arg1) { - f32 sp34; - f32 sp30; +void EnHiddenNuts_ChangeAnim(EnHiddenNuts* this, s32 animIndex) { + f32 startFrame; + f32 morphFrames; - this->unk_220 = arg1; - sp34 = 0.0f; - sp30 = -4.0f; - this->unk_22C = Animation_GetLastFrame(D_80BDC0FC[arg1]); - if (this->unk_220 == 1) { - sp34 = this->unk_22C; - sp30 = 0.0f; + this->animIndex = animIndex; + startFrame = 0.0f; + morphFrames = -4.0f; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + + if (this->animIndex == ENHIDDENNUTS_ANIM_1) { + startFrame = this->animEndFrame; + morphFrames = 0.0f; } - Animation_Change(&this->skelAnime, D_80BDC0FC[this->unk_220], 1.0f, sp34, this->unk_22C, D_80BDC120[this->unk_220], - sp30); + + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->animEndFrame, + sAnimationModes[this->animIndex], morphFrames); } void func_80BDB268(EnHiddenNuts* this) { this->actor.textId = 0x234; this->unk_228 = 1600.0f; this->actor.shape.yOffset = 1600.0f; - func_80BDB1B4(this, 1); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_1); this->unk_21A = 0; this->actionFunc = func_80BDB2B8; } @@ -148,12 +175,12 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); if (player->stateFlags2 & PLAYER_STATE2_8000000) { - if (this->unk_20A == 0) { + if (!this->unk_20A) { Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); - this->unk_20A = 1; + this->unk_20A = true; } } else { - this->unk_20A = 0; + this->unk_20A = false; } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -263,20 +290,20 @@ void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) { EffectSsHahen_SpawnBurst(play, &sp3C, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); - func_80BDB1B4(this, 7); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_7); this->actionFunc = func_80BDB8F4; } void func_80BDB8F4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { func_80BDB930(this); } } void func_80BDB930(EnHiddenNuts* this) { - func_80BDB1B4(this, 3); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_3); this->unk_21A = 3; this->unk_228 = 500.0f; this->actionFunc = func_80BDB978; @@ -290,7 +317,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUT_FAINT); } - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { this->unk_224++; if (this->unk_224 >= 2) { func_80BDBA28(this, play); @@ -301,7 +328,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) { void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { Vec3f sp44; - func_80BDB1B4(this, 2); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_2); this->unk_228 = 0.0f; Math_Vec3f_Copy(&sp44, &this->actor.world.pos); @@ -326,10 +353,10 @@ void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { s32 pad[3]; - f32 sp58 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; WaterBox* sp54; f32 sp50; - s16 sp4E = 0; + s16 sp4E = false; Vec3f sp40; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && @@ -346,23 +373,23 @@ void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER); - sp4E = 1; + sp4E = true; } } - if ((sp4E != 0) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || - Animation_OnFrame(&this->skelAnime, 10.0f))) { + if (sp4E && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || + Animation_OnFrame(&this->skelAnime, 10.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C), 1, 0x1388, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x3E8, 0); - if (this->unk_220 == 2) { - if (this->unk_22C <= sp58) { + if (this->animIndex == ENHIDDENNUTS_ANIM_2) { + if (curFrame >= this->animEndFrame) { this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; - func_80BDB1B4(this, 6); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_6); } } else { Math_ApproachF(&this->actor.world.pos.x, this->unk_20C.x, 0.5f, @@ -387,7 +414,7 @@ void func_80BDBE70(EnHiddenNuts* this, PlayState* play) { if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); } - func_80BDB1B4(this, 8); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_8); this->unk_21A = 5; this->actionFunc = func_80BDBED4; } @@ -396,7 +423,7 @@ void func_80BDBED4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Vec3f sp38; - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { Math_Vec3f_Copy(&sp38, &this->actor.world.pos); sp38.y = this->actor.floorHeight; diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h index 03a0a52b78..df8275aa44 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h @@ -2,6 +2,7 @@ #define Z_EN_HIDDEN_NUTS_H #include "global.h" +#include "objects/object_hintnuts/object_hintnuts.h" struct EnHiddenNuts; @@ -16,8 +17,8 @@ typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*); typedef struct EnHiddenNuts { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[10]; - /* 0x1C4 */ Vec3s morphTable[10]; + /* 0x188 */ Vec3s jointTable[OBJECT_HINTNUTS_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[OBJECT_HINTNUTS_LIMB_MAX]; /* 0x200 */ EnHiddenNutsActionFunc actionFunc; /* 0x204 */ Path* path; /* 0x208 */ s16 unk_208; @@ -27,11 +28,11 @@ typedef struct EnHiddenNuts { /* 0x21A */ s16 unk_21A; /* 0x21C */ s16 switchFlag; /* 0x21E */ s16 pathIndex; - /* 0x220 */ s32 unk_220; + /* 0x220 */ s32 animIndex; /* 0x224 */ s16 unk_224; /* 0x226 */ s16 csId; /* 0x228 */ f32 unk_228; - /* 0x22C */ f32 unk_22C; + /* 0x22C */ f32 animEndFrame; /* 0x230 */ UNK_TYPE1 unk230[4]; /* 0x234 */ ColliderCylinder collider; } EnHiddenNuts; // size = 0x280 diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index 5ad3e9dcf9..f9e51b55c1 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -6,7 +6,6 @@ #include "z_en_hint_skb.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_skb/object_skb.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) @@ -126,20 +125,37 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -static AnimationInfo sAnimationInfo[] = { - { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, +typedef enum EnHinkSkbAnimation { + /* 0 */ ENHINTSKB_ANIM_0, + /* 1 */ ENHINTSKB_ANIM_1, + /* 2 */ ENHINTSKB_ANIM_2, + /* 3 */ ENHINTSKB_ANIM_3, + /* 4 */ ENHINTSKB_ANIM_4, + /* 5 */ ENHINTSKB_ANIM_5, + /* 6 */ ENHINTSKB_ANIM_6, + /* 7 */ ENHINTSKB_ANIM_7, + /* 8 */ ENHINTSKB_ANIM_8, + /* 9 */ ENHINTSKB_ANIM_9, + /* 10 */ ENHINTSKB_ANIM_10, + /* 11 */ ENHINTSKB_ANIM_11, + /* 12 */ ENHINTSKB_ANIM_12, + /* 13 */ ENHINTSKB_ANIM_MAX +} EnHinkSkbAnimation; + +static AnimationInfo sAnimationInfo[ENHINTSKB_ANIM_MAX] = { + { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_0 + { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // ENHINTSKB_ANIM_1 + { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, // ENHINTSKB_ANIM_2 + { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENHINTSKB_ANIM_3 + { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENHINTSKB_ANIM_4 + { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_5 + { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_6 + { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENHINTSKB_ANIM_7 + { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_8 + { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, // ENHINTSKB_ANIM_9 + { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_10 + { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENHINTSKB_ANIM_11 + { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENHINTSKB_ANIM_12 }; static InitChainEntry sInitChain[] = { @@ -153,7 +169,7 @@ void EnHintSkb_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, - this->morphtable, 20); + this->morphTable, OBJECT_SKB_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElement); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -181,7 +197,7 @@ void func_80C1FE20(EnHintSkb* this, PlayState* play) { } void func_80C1FE30(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_0); this->actor.speed = 1.6f; this->actionFunc = func_80C1FE80; } @@ -200,7 +216,7 @@ void func_80C1FE80(EnHintSkb* this, PlayState* play) { void func_80C1FF30(EnHintSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speed = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_2); this->actionFunc = func_80C1FF88; } @@ -274,12 +290,12 @@ void func_80C2016C(EnHintSkb* this, PlayState* play) { void func_80C20274(EnHintSkb* this) { if (this->skelAnime.animation == &object_skb_Anim_00697C) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_8); this->actor.gravity = -1.0f; this->actor.speed = 1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -4.0f; } @@ -317,7 +333,7 @@ void func_80C20334(EnHintSkb* this, PlayState* play) { } void func_80C20484(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_4); this->unk_3E8 |= 4; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; @@ -349,7 +365,7 @@ void func_80C20590(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -376,7 +392,7 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -405,10 +421,10 @@ void func_80C2077C(EnHintSkb* this, PlayState* play) { this->actor.speed = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_8); } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_11); Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; } @@ -449,6 +465,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { case TEXT_STATE_NONE: case TEXT_STATE_1: case TEXT_STATE_CLOSING: + default: break; } @@ -467,7 +484,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_0); } } @@ -542,7 +559,7 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { case 0x1147: Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_11); break; case 0x1148: @@ -578,6 +595,9 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { func_80C2075C(this); } break; + + default: + break; } } @@ -591,7 +611,7 @@ void func_80C20D64(EnHintSkb* this, PlayState* play) { this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; if (this->actionFunc == func_80C1FE80) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_12); } func_80C2075C(this); } @@ -682,6 +702,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->unk_3E8 |= 1; func_80C20274(this); break; + case 3: if (this->actor.colChkInfo.health != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); @@ -695,6 +716,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); func_80C20540(this); break; + case 4: this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; @@ -702,14 +724,14 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3); func_80C2066C(this); break; case 12: case 14: this->unk_3E8 |= 1; - + // fallthrough case 15: if ((player->meleeWeaponAnimation == PLAYER_MWA_RIGHT_SLASH_1H) || (player->meleeWeaponAnimation == PLAYER_MWA_LEFT_COMBO_2H) || @@ -717,11 +739,11 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)) { this->unk_3E8 |= 1; } - + // fallthrough case 13: Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENHINTSKB_ANIM_3); func_80C20274(this); break; @@ -731,6 +753,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { case 8: case 9: case 10: + default: break; } } @@ -850,7 +873,7 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 EnHintSkb* this = THIS; f32 temp_f10; - if (limbIndex == 11) { + if (limbIndex == OBJECT_SKB_LIMB_0B) { OPEN_DISPS(play->state.gfxCtx); temp_f10 = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f; @@ -859,13 +882,13 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 gDPSetEnvColor(POLY_OPA_DISP++, (s16)temp_f10, (s16)temp_f10, (s16)temp_f10, 255); CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 10) { + } else if (limbIndex == OBJECT_SKB_LIMB_0A) { Matrix_MultZero(&this->actor.focus.pos); - } else if ((limbIndex == 12) && (this->unk_3DE == 1)) { + } else if ((limbIndex == OBJECT_SKB_LIMB_0C) && (this->unk_3DE == 1)) { Matrix_RotateZS(0x71C, MTXMODE_APPLY); } - if (((limbIndex == 11) || (limbIndex == 12)) && (this->unk_3E8 & 2)) { + if (((limbIndex == OBJECT_SKB_LIMB_0B) || (limbIndex == OBJECT_SKB_LIMB_0C)) && (this->unk_3E8 & 2)) { *dList = NULL; } @@ -879,21 +902,25 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if (!(this->unk_3E8 & 8)) { Collider_UpdateSpheres(limbIndex, &this->collider); - if ((limbIndex == 11) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) { + if ((limbIndex == OBJECT_SKB_LIMB_0B) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) { Actor_SpawnBodyParts(&this->actor, play, 1, dList); this->unk_3E8 |= 2; - } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && ((limbIndex != 11) || !(this->unk_3E8 & 1)) && - (limbIndex != 12)) { + } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && + ((limbIndex != OBJECT_SKB_LIMB_0B) || !(this->unk_3E8 & 1)) && (limbIndex != OBJECT_SKB_LIMB_0C)) { Actor_SpawnBodyParts(&this->actor, play, 1, dList); } if (this->drawDmgEffTimer != 0) { - if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || - (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || - (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { + if ((limbIndex == OBJECT_SKB_LIMB_02) || (limbIndex == OBJECT_SKB_LIMB_04) || + (limbIndex == OBJECT_SKB_LIMB_05) || (limbIndex == OBJECT_SKB_LIMB_06) || + (limbIndex == OBJECT_SKB_LIMB_07) || (limbIndex == OBJECT_SKB_LIMB_08) || + (limbIndex == OBJECT_SKB_LIMB_09) || (limbIndex == OBJECT_SKB_LIMB_0D) || + (limbIndex == OBJECT_SKB_LIMB_0E) || (limbIndex == OBJECT_SKB_LIMB_0F) || + (limbIndex == OBJECT_SKB_LIMB_10) || (limbIndex == OBJECT_SKB_LIMB_11) || + (limbIndex == OBJECT_SKB_LIMB_12)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); this->bodyPartsCount++; - } else if ((limbIndex == 11) && !(this->unk_3E8 & 2)) { + } else if ((limbIndex == OBJECT_SKB_LIMB_0B) && !(this->unk_3E8 & 2)) { Matrix_MultVec3f(&D_80C21E70, &this->bodyPartsPos[this->bodyPartsCount]); this->bodyPartsCount++; } diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h index e263b9de06..95576210db 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h @@ -2,6 +2,7 @@ #define Z_EN_HINT_SKB_H #include "global.h" +#include "objects/object_skb/object_skb.h" struct EnHintSkb; @@ -37,8 +38,8 @@ typedef struct EnHintSkb { /* 0x2D4 */ f32 drawDmgEffAlpha; /* 0x2D8 */ f32 drawDmgEffScale; /* 0x2DC */ s32 bodyPartsCount; - /* 0x2E0 */ Vec3s jointTable[20]; - /* 0x358 */ Vec3s morphtable[20]; + /* 0x2E0 */ Vec3s jointTable[OBJECT_SKB_LIMB_MAX]; + /* 0x358 */ Vec3s morphTable[OBJECT_SKB_LIMB_MAX]; /* 0x3D0 */ UNK_TYPE1 unk3D0[0xC]; /* 0x3DC */ s16 unk_3DC; /* 0x3DE */ s16 unk_3DE; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 00a5fd3b18..fe386b2ff9 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -40,10 +40,10 @@ void EnHorse_StartReversing(EnHorse* this); void EnHorse_StartLowJump(EnHorse* this, PlayState* play); void EnHorse_StartHighJump(EnHorse* this, PlayState* play); void EnHorse_InitInactive(EnHorse* this); -void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames); +void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames); void EnHorse_ResetIdleAnimation(EnHorse* this); void EnHorse_StartIdleRidable(EnHorse* this); -void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames); +void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames); void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play); void EnHorse_InitIngoHorse(EnHorse* this); void EnHorse_UpdateIngoHorseAnim(EnHorse* this); @@ -109,33 +109,56 @@ typedef struct { /* 0x4 */ RaceWaypoint* waypoints; } RaceInfo; // size = 0x8 -static AnimationHeader* sEponaAnimations[] = { - &gEponaIdleAnim, - &gEponaWhinnyAnim, - &object_horse_link_child_Anim_005F64, - &object_horse_link_child_Anim_004DE8, - &gEponaWalkAnim, - &gEponaTrotAnim, - &gEponaGallopAnim, - &object_horse_link_child_Anim_0035B0, - &object_horse_link_child_Anim_003D38, +static AnimationHeader* sEponaAnimations[ENHORSE_ANIM_MAX] = { + &gEponaIdleAnim, // ENHORSE_ANIM_IDLE + &gEponaWhinnyAnim, // ENHORSE_ANIM_WHINNY + &object_horse_link_child_Anim_005F64, // ENHORSE_ANIM_STOPPING + &object_horse_link_child_Anim_004DE8, // ENHORSE_ANIM_REARING + &gEponaWalkAnim, // ENHORSE_ANIM_WALK + &gEponaTrotAnim, // ENHORSE_ANIM_TROT + &gEponaGallopAnim, // ENHORSE_ANIM_GALLOP + &object_horse_link_child_Anim_0035B0, // ENHORSE_ANIM_LOW_JUMP + &object_horse_link_child_Anim_003D38, // ENHORSE_ANIM_HIGH_JUMP }; -static AnimationHeader* sHniAnimations[] = { - &gHorseIdleAnim, &gHorseShakeHeadAnim, &gHorseStopAnim, &gHorseWhinnyAnim, &gHorseWalkAnim, - &gHorseTrotAnim, &gHorseGallopAnim, &gHorseJumpLowAnim, &gHorseJumpHighAnim, +static AnimationHeader* sHniAnimations[ENHORSE_ANIM_MAX] = { + &gHorseIdleAnim, // ENHORSE_ANIM_IDLE + &gHorseShakeHeadAnim, // ENHORSE_ANIM_WHINNY + &gHorseStopAnim, // ENHORSE_ANIM_STOPPING + &gHorseWhinnyAnim, // ENHORSE_ANIM_REARING @TODO: Does not line up + &gHorseWalkAnim, // ENHORSE_ANIM_WALK + &gHorseTrotAnim, // ENHORSE_ANIM_TROT + &gHorseGallopAnim, // ENHORSE_ANIM_GALLOP + &gHorseJumpLowAnim, // ENHORSE_ANIM_LOW_JUMP + &gHorseJumpHighAnim, // ENHORSE_ANIM_HIGH_JUMP }; -static AnimationHeader** sAnimationHeaders[] = { - NULL, NULL, sEponaAnimations, sHniAnimations, sHniAnimations, +static AnimationHeader** sAnimationHeaders[HORSE_TYPE_MAX] = { + NULL, // HORSE_TYPE_EPONA + NULL, // HORSE_TYPE_HNI + sEponaAnimations, // HORSE_TYPE_2 + sHniAnimations, // HORSE_TYPE_BANDIT + sHniAnimations, // HORSE_TYPE_DONKEY }; -static f32 sPlaybackSpeeds[] = { - 2.0f / 3.0f, 2.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, +static f32 sPlaybackSpeeds[ENHORSE_ANIM_MAX] = { + 2.0f / 3.0f, // ENHORSE_ANIM_IDLE + 2.0f / 3.0f, // ENHORSE_ANIM_WHINNY + 3.0f / 3.0f, // ENHORSE_ANIM_STOPPING + 3.0f / 3.0f, // ENHORSE_ANIM_REARING + 3.0f / 3.0f, // ENHORSE_ANIM_WALK + 3.0f / 3.0f, // ENHORSE_ANIM_TROT + 3.0f / 3.0f, // ENHORSE_ANIM_GALLOP + 2.0f / 3.0f, // ENHORSE_ANIM_LOW_JUMP + 2.0f / 3.0f, // ENHORSE_ANIM_HIGH_JUMP }; -static SkeletonHeader* sSkeletonHeaders[] = { - NULL, NULL, &gEponaSkel, NULL, NULL, +static SkeletonHeader* sSkeletonHeaders[HORSE_TYPE_MAX] = { + NULL, // HORSE_TYPE_EPONA + NULL, // HORSE_TYPE_HNI + &gEponaSkel, // HORSE_TYPE_2 + NULL, // HORSE_TYPE_BANDIT + NULL, // HORSE_TYPE_DONKEY }; ActorInit En_Horse_InitVars = { @@ -570,7 +593,8 @@ void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { } else { Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } - } else if ((this->animIndex == 3) && (this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) { + } else if ((this->animIndex == ENHORSE_ANIM_REARING) && (this->curFrame > 25.0f) && + !(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; if (this->type == HORSE_TYPE_2) { Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -836,7 +860,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } - this->animIndex = 0; + this->animIndex = ENHORSE_ANIM_IDLE; this->numBoosts = 6; this->boostRegenTime = 0; this->postDrawFunc = NULL; @@ -1900,21 +1924,21 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) { } } -void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { +void EnHorse_PlayIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) { this->action = ENHORSE_ACTION_IDLE; this->actor.speed = 0.0f; - if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNY) && (anim != ENHORSE_ANIM_REARING)) { - anim = ENHORSE_ANIM_IDLE; + if ((animIndex != ENHORSE_ANIM_IDLE) && (animIndex != ENHORSE_ANIM_WHINNY) && (animIndex != ENHORSE_ANIM_REARING)) { + animIndex = ENHORSE_ANIM_IDLE; } - if (sAnimationHeaders[this->type][anim] == NULL) { - anim = ENHORSE_ANIM_IDLE; + if (sAnimationHeaders[this->type][animIndex] == NULL) { + animIndex = ENHORSE_ANIM_IDLE; } - if (anim != this->animIndex) { - this->animIndex = anim; - if (anim == ENHORSE_ANIM_IDLE) { + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + if (animIndex == ENHORSE_ANIM_IDLE) { this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; } else { if (this->animIndex == ENHORSE_ANIM_WHINNY) { @@ -1942,8 +1966,8 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta } } -void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames) { - EnHorse_PlayIdleAnimation(this, anim, morphFrames, this->curFrame); +void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames) { + EnHorse_PlayIdleAnimation(this, animIndex, morphFrames, this->curFrame); } void EnHorse_ResetIdleAnimation(EnHorse* this) { @@ -1999,16 +2023,16 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { } } -void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { +void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) { this->action = ENHORSE_ACTION_FOLLOW_PLAYER; this->stateFlags &= ~ENHORSE_TURNING_TO_PLAYER; - if ((anim != ENHORSE_ANIM_TROT) && (anim != ENHORSE_ANIM_GALLOP) && (anim != ENHORSE_ANIM_WALK)) { - anim = ENHORSE_ANIM_WALK; + if ((animIndex != ENHORSE_ANIM_TROT) && (animIndex != ENHORSE_ANIM_GALLOP) && (animIndex != ENHORSE_ANIM_WALK)) { + animIndex = ENHORSE_ANIM_WALK; } - if (anim != this->animIndex) { - this->animIndex = anim; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, morphFrames); @@ -2019,38 +2043,38 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 } void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { - s32 anim = ENHORSE_ANIM_WALK; + s32 animIndex = ENHORSE_ANIM_WALK; f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else if (!(distToPlayer <= 300.0f) && (distToPlayer <= 400.0f)) { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } if (this->animIndex == ENHORSE_ANIM_GALLOP) { if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } } else if (this->animIndex == ENHORSE_ANIM_TROT) { if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else if (distToPlayer < 300.0f) { - anim = ENHORSE_ANIM_WALK; + animIndex = ENHORSE_ANIM_WALK; } else { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } } else if (this->animIndex == ENHORSE_ANIM_WALK) { if (distToPlayer > 300.0f) { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } else { - anim = ENHORSE_ANIM_WALK; + animIndex = ENHORSE_ANIM_WALK; } } - EnHorse_StartMovingAnimation(this, anim, -3.0f, 0.0f); + EnHorse_StartMovingAnimation(this, animIndex, -3.0f, 0.0f); } void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { @@ -2155,7 +2179,7 @@ void EnHorse_InitIngoHorse(EnHorse* this) { void EnHorse_SetIngoAnimation(s32 animIndex, f32 curFrame, s32 arg2, s16* animIndexOut) { *animIndexOut = sIngoAnimIndices[animIndex]; - if (arg2 == ENIN_ANIM_1) { + if (arg2 == 1) { if (animIndex == ENHORSE_ANIM_TROT) { *animIndexOut = ENIN_ANIM_4; } else if (animIndex == ENHORSE_ANIM_GALLOP) { @@ -2286,7 +2310,7 @@ void func_80881290(EnHorse* this, PlayState* play) { void func_80881398(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - s32 animeUpdated; + s32 isAnimFinished; f32 curFrame; this->stateFlags |= ENHORSE_JUMPING; @@ -2294,7 +2318,7 @@ void func_80881398(EnHorse* this, PlayState* play) { this->actor.speed = 14.0f; } - animeUpdated = SkelAnime_Update(&this->skin.skelAnime); + isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); curFrame = this->skin.skelAnime.curFrame; if (curFrame > 23.0f) { @@ -2313,8 +2337,8 @@ void func_80881398(EnHorse* this, PlayState* play) { this->actor.world.pos.y = this->jumpStartY + (y * 0.01f * this->unk_528 * 0.01f); } - if (animeUpdated || ((curFrame > 17.0f) && - (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { + if (isAnimFinished || ((curFrame > 17.0f) && + (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { @@ -2962,7 +2986,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { f32 playerDistToHome; f32 distToPlayer; s32 nextAnimIndex = this->animIndex; - s32 animFinished; + s32 isAnimFinished; s16 yaw; if (gHorsePlayedEponasSong || (this->type == HORSE_TYPE_HNI)) { @@ -3041,7 +3065,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; } - animFinished = SkelAnime_Update(&this->skin.skelAnime); + isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); if (((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) && ((nextAnimIndex == ENHORSE_ANIM_GALLOP) || (nextAnimIndex == ENHORSE_ANIM_TROT) || @@ -3054,7 +3078,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { } else if (this->animIndex == ENHORSE_ANIM_TROT) { func_8087C178(this); } - } else if (animFinished) { + } else if (isAnimFinished) { if (nextAnimIndex == ENHORSE_ANIM_GALLOP) { func_8087C1C0(this); } else if (nextAnimIndex == ENHORSE_ANIM_TROT) { @@ -3499,7 +3523,7 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, this->actor.world.pos = this->lastPos; this->stateFlags |= ENHORSE_OBSTACLE; if (this->playerControlled == 0) { - if (this->animIndex != 3) {} + if (this->animIndex != ENHORSE_ANIM_REARING) {} } else if (this->action != ENHORSE_ACTION_MOUNTED_REARING) { if (this->stateFlags & ENHORSE_JUMPING) { this->stateFlags &= ~ENHORSE_JUMPING; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 75f0254fcc..f3c868c850 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -93,7 +93,8 @@ typedef enum EnHorseAnimation { /* 5 */ ENHORSE_ANIM_TROT, /* 6 */ ENHORSE_ANIM_GALLOP, /* 7 */ ENHORSE_ANIM_LOW_JUMP, - /* 8 */ ENHORSE_ANIM_HIGH_JUMP + /* 8 */ ENHORSE_ANIM_HIGH_JUMP, + /* 9 */ ENHORSE_ANIM_MAX } EnHorseAnimation; typedef enum HorseType { @@ -101,7 +102,8 @@ typedef enum HorseType { /* 1 */ HORSE_TYPE_HNI, /* 2 */ HORSE_TYPE_2, /* 3 */ HORSE_TYPE_BANDIT, - /* 4 */ HORSE_TYPE_DONKEY // Cremia's donkey + /* 4 */ HORSE_TYPE_DONKEY, // Cremia's donkey + /* 5 */ HORSE_TYPE_MAX } HorseType; #define ENHORSE_PARAM_BANDIT 0x2000 diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index bba55073b9..78d6f86241 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -19,7 +19,7 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play); void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play); void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play); -void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex); +void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex); void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play); void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this); void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play); @@ -51,7 +51,7 @@ typedef enum { /* 5 */ OOT_CHILD_EPONA_ANIM_MAX } OoTEponaAnimation; -AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = { +static AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = { &gEponaIdleAnim, // OOT_CHILD_EPONA_ANIM_IDLE &gEponaWhinnyAnim, // OOT_CHILD_EPONA_ANIM_WHINNY &gEponaWalkAnim, // OOT_CHILD_EPONA_ANIM_WALK @@ -221,7 +221,7 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) { void EnHorseLinkChild_SetupActionFunc0(EnHorseLinkChild* this) { this->action = OOT_CHILD_EPONA_ACTION_0; this->animIndex++; - if (this->animIndex >= ARRAY_COUNT(sAnimPlaySpeeds)) { + if (this->animIndex >= OOT_CHILD_EPONA_ANIM_MAX) { this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animIndex]); @@ -238,16 +238,16 @@ void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play) { } } -void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex) { +void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex) { this->action = OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER; this->actor.speed = 0.0f; - if ((nextAnimIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (nextAnimIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE; + if ((animIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (animIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) { + animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } - if (nextAnimIndex != this->animIndex) { - this->animIndex = nextAnimIndex; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } @@ -258,7 +258,7 @@ void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimInd */ void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) { f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); - s32 nextAnimIndex; + s32 animIndex; if (SkelAnime_Update(&this->skin.skelAnime)) { if ((distToPlayer < 1000.0f) && (distToPlayer > 70.0f)) { @@ -267,13 +267,13 @@ void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) { } if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE; + animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } else { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WHINNY; + animIndex = OOT_CHILD_EPONA_ANIM_WHINNY; } - if (nextAnimIndex != this->animIndex) { - this->animIndex = nextAnimIndex; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { @@ -297,7 +297,7 @@ void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this) { void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) { f32 distToPlayer; s16 yawTowardPlayerDiff; - s32 nextAnimIndex; + s32 animIndex; if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) { @@ -321,13 +321,13 @@ void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) { } if ((distToPlayer < 1000.0f) && (distToPlayer >= 300.0f)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP; + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; } else if ((distToPlayer < 300.0f) && (distToPlayer >= 150.0f)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT; + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else if ((distToPlayer < 150.0f) && (distToPlayer >= 70.0f)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; this->footstepCounter = 0; this->actor.speed = 2.0f; } else { @@ -335,8 +335,8 @@ void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) { return; } - if (nextAnimIndex != this->animIndex) { - this->animIndex = nextAnimIndex; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { @@ -394,16 +394,16 @@ void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) { Player* player; f32 distToPlayer; s32 isAnimFinished; - s32 nextAnimIndex; + s32 animIndex; func_808DF088(this, play); player = GET_PLAYER(play); distToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor); - nextAnimIndex = this->animIndex; + animIndex = this->animIndex; isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); - if ((isAnimFinished) || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) || + if (isAnimFinished || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) || (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE)) { //! @bug: The carry-over of this flag from OoT was not done correctly if (CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_ZORA_HALL)) { @@ -412,55 +412,53 @@ void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) { if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) > 250.0f) { if (distToHome >= 300.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP; + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; } else if ((distToHome < 300.0f) && (distToHome >= 150.0f)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT; + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else if ((distToHome < 150.0f) && (distToHome >= 70.0f)) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; this->footstepCounter = 0; this->actor.speed = 2.0f; } else { this->actor.speed = 0.0f; if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { - nextAnimIndex = - (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - nextAnimIndex = - (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } } else if (distToPlayer < 200.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP; + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; } else if (distToPlayer < 300.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT; + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else if (distToPlayer < 400.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; this->footstepCounter = 0; this->actor.speed = 2.0f; } else { this->actor.speed = 0.0f; if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { - nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } } else { this->actor.speed = 0.0f; if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { - nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } } - if ((nextAnimIndex != this->animIndex) || (isAnimFinished == true)) { - this->animIndex = nextAnimIndex; + if ((this->animIndex != animIndex) || (isAnimFinished == true)) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { @@ -526,7 +524,7 @@ void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this) { void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 distToTargetPos; - s32 nextAnimIndex; + s32 animIndex; this->timer++; if (this->timer > 300) { @@ -551,24 +549,24 @@ void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) { if (!this->isReturningHome) { if (distToTargetPos >= 300.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP; + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; } else if (distToTargetPos >= 150.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT; + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; this->footstepCounter = 0; this->actor.speed = 2.0f; } } else if (distToTargetPos >= 300.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP; + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; } else if (distToTargetPos >= 150.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT; + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else if (distToTargetPos >= 70.0f) { - nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; this->footstepCounter = 0; this->actor.speed = 2.0f; } else { @@ -576,8 +574,8 @@ void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) { return; } - if (nextAnimIndex != this->animIndex) { - this->animIndex = nextAnimIndex; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 5146f4fcd3..b665b5d02f 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -110,7 +110,7 @@ void EnHs_UpdateChickPos(Vec3f* dst, Vec3f src, f32 offset) { Math_Vec3f_Diff(&src, dst, &diff); - distance = SQ(diff.x) + SQ(diff.z); // gets un-squared after we check if we are too close + distance = SQXZ(diff); // gets un-squared after we check if we are too close if (SQ(offset) > distance) { return; @@ -176,20 +176,20 @@ void func_80953098(EnHs* this, PlayState* play) { void func_80953180(EnHs* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x33F4: // text: laughing that they are all roosters (!) - case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood + case 0x33F4: // laughing that they are all roosters (!) + case 0x33F6: // Grog regrets not being able to see his chicks reach adult hood Message_CloseTextbox(play); this->actionFunc = func_8095345C; break; - case 0x33F7: // text: notice his chicks are grown up, happy, wants to give you bunny hood + case 0x33F7: // notice his chicks are grown up, happy, wants to give you bunny hood this->actor.flags &= ~ACTOR_FLAG_10000; Message_CloseTextbox(play); this->actionFunc = func_80953098; func_80953098(this, play); break; - case 0x33F9: // text: laughing that they are all roosters (.) + case 0x33F9: // laughing that they are all roosters (.) this->actor.flags &= ~ACTOR_FLAG_10000; Message_CloseTextbox(play); this->actionFunc = func_8095345C; @@ -341,6 +341,9 @@ s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } break; + + default: + break; } return false; } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 7e30676e2d..9fbd7ff850 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -417,11 +417,11 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { */ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - s16 currentFrame = this->skelAnime.curFrame; + s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->animIndex == EN_JG_ANIM_SURPRISE_START) { - if (currentFrame == lastFrame) { + if (curFrame == lastFrame) { this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -472,11 +472,11 @@ void EnJg_Walk(EnJg* this, PlayState* play) { void EnJg_Talk(EnJg* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - s16 currentFrame = this->skelAnime.curFrame; + s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); u16 temp; - if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (currentFrame == lastFrame)) { + if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (curFrame == lastFrame)) { this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -542,7 +542,7 @@ void EnJg_SetupWalk(EnJg* this, PlayState* play) { } void EnJg_Freeze(EnJg* this, PlayState* play) { - s16 currentFrame = this->skelAnime.curFrame; + s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->action == EN_JG_ACTION_SPAWNING) { @@ -557,7 +557,7 @@ void EnJg_Freeze(EnJg* this, PlayState* play) { this->actionFunc = EnJg_FrozenIdle; } else if (this->animIndex == EN_JG_ANIM_FROZEN_START) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; - if (currentFrame == lastFrame) { + if (curFrame == lastFrame) { this->freezeTimer = 1000; this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, @@ -898,7 +898,7 @@ void EnJg_SpawnBreath(EnJg* this, PlayState* play) { * handing it off to EnJg_Freeze. */ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) { - s16 currentFrame = this->skelAnime.curFrame; + s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -924,7 +924,7 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play } this->freezeTimer--; - if ((this->freezeTimer <= 0) && (currentFrame == lastFrame)) { + if ((this->freezeTimer <= 0) && (curFrame == lastFrame)) { this->animIndex = EN_JG_ANIM_FROZEN_START; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_FREEZE_S); diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 73f1111a57..5ebdcd43f6 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -115,7 +115,7 @@ void EnPr2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, - this->morphtable, 5); + this->morphTable, 5); this->unk_1E0 = ENPR2_GET_F(&this->actor); this->actor.colChkInfo.mass = 10; Math_Vec3f_Copy(&this->unk_228, &this->actor.home.pos); diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h index 94fb7e033d..7d462b6395 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h @@ -17,7 +17,7 @@ typedef struct EnPr2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[5]; - /* 0x1A6 */ Vec3s morphtable[5]; + /* 0x1A6 */ Vec3s morphTable[5]; /* 0x1C4 */ EnPr2ActionFunc actionFunc; /* 0x1C8 */ s16 pathIndex; /* 0x1CC */ Path* path; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 605761711b..c7006f0870 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -636,7 +636,7 @@ void EnSsh_Init(Actor* thisx, PlayState* play) { EnSsh* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphtable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphTable, 30); Animation_Change(&this->skelAnime, &object_ssh_Anim_001494, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f); this->blureIdx = EnSsh_CreateBlureEffect(play); EnSsh_InitColliders(this, play); diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 6f19a5e51a..8c95ea6288 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -31,7 +31,7 @@ typedef struct EnSsh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[30]; - /* 0x23C */ Vec3s morphtable[30]; + /* 0x23C */ Vec3s morphTable[30]; /* 0x2F0 */ EnSshActionFunc actionFunc; /* 0x2F4 */ ColliderCylinder collider1[6]; /* 0x4BC */ ColliderJntSph collider2; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7ecc8c4e3a..9a4244bc27 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -15951,7 +15951,7 @@ 0x80BDAF24:("ObjHsStump_Draw",), 0x80BDB040:("EnHiddenNuts_Init",), 0x80BDB188:("EnHiddenNuts_Destroy",), - 0x80BDB1B4:("func_80BDB1B4",), + 0x80BDB1B4:("EnHiddenNuts_ChangeAnim",), 0x80BDB268:("func_80BDB268",), 0x80BDB2B8:("func_80BDB2B8",), 0x80BDB580:("func_80BDB580",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 01a46d7d11..9320ca10ed 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -15810,8 +15810,8 @@ 0x80BDAFA0:("D_80BDAFA0","f32","",0x4), 0x80BDC0B0:("En_Hidden_Nuts_InitVars","UNK_TYPE1","",0x1), 0x80BDC0D0:("D_80BDC0D0","UNK_TYPE1","",0x1), - 0x80BDC0FC:("D_80BDC0FC","UNK_TYPE1","",0x1), - 0x80BDC120:("D_80BDC120","UNK_TYPE1","",0x1), + 0x80BDC0FC:("sAnimations","UNK_TYPE1","",0x1), + 0x80BDC120:("sAnimationModes","UNK_TYPE1","",0x1), 0x80BDC12C:("D_80BDC12C","UNK_TYPE1","",0x1), 0x80BDC138:("D_80BDC138","UNK_TYPE1","",0x1), 0x80BDC144:("D_80BDC144","UNK_TYPE1","",0x1),