diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index 918c0eb5f2..07e0e3d233 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -20,22 +20,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -65,15 +65,15 @@ - - - - - - - - - + + + + + + + + + @@ -120,18 +120,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/include/z64save.h b/include/z64save.h index 85a2a62e32..01739975d3 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -875,7 +875,7 @@ typedef enum { // Mountain village is unfrozen #define WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE PACK_WEEKEVENTREG_FLAG(33, 0x80) -// Spoken to MINIFROG_YELLOW +// Spoken to FROG_YELLOW #define WEEKEVENTREG_34_01 PACK_WEEKEVENTREG_FLAG(34, 0x01) #define WEEKEVENTREG_34_02 PACK_WEEKEVENTREG_FLAG(34, 0x02) diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 59e3a09e94..ff4c545594 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -312,7 +312,7 @@ static InitChainEntry sInitChain[] = { }; void EnBigslime_Init(Actor* thisx, PlayState* play2) { - static s32 isFrogReturnedFlags[] = { + static s32 sIsFrogReturnedFlags[] = { WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, @@ -341,7 +341,7 @@ void EnBigslime_Init(Actor* thisx, PlayState* play2) { if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - if (!CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->actor.params - 1])) { + if (!CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->actor.params); } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 39cbee8dc0..8468c3e545 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -115,6 +115,9 @@ void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, PlayState* play) { this->actor.home.pos.y - (finalDayRelativeHeight * 6700.0f * (this->scale * 6.25f)); } break; + + default: + break; } } @@ -354,6 +357,9 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { case 9: play->csCtx.curFrame--; break; + + default: + break; } } } @@ -392,6 +398,9 @@ void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* case 4: this->actor.draw = EnFall_OpenMouthMoon_Draw; break; + + default: + break; } } } @@ -406,6 +415,9 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 4: this->actor.draw = NULL; break; + + default: + break; } } @@ -424,6 +436,9 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 1303: Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; + + default: + break; } if (play->csCtx.curFrame >= 1145) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); @@ -443,11 +458,17 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 737: Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; + + default: + break; } if (play->csCtx.curFrame >= 650) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; + + default: + break; } } } @@ -540,20 +561,20 @@ void EnFall_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } +static u8 sAlphaTableIndices[] = { + 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 0, 1, 1, 1, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 0, 1, 1, 1, 4, 4, 1, + 1, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 4, 0, 4, 4, 0, 4, 4, 1, 1, 1, 1, + 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 4, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, + 1, 4, 4, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, + 2, 0, 0, 1, 0, 2, 0, 0, 2, 1, 2, 0, 1, 0, 1, 0, 0, 1, 2, 2, 0, 0, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, + 0, 0, 2, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, +}; + /** * Updates the alpha for every vertex in the fire ball so that some parts of * the sphere are more transparent or opaque than others. */ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { - static u8 sAlphaTableIndex[] = { - 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 0, 1, 1, 1, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 0, 1, 1, 1, 4, 4, 1, - 1, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 4, 0, 4, 4, 0, 4, 4, 1, 1, 1, 1, - 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 4, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, - 1, 4, 4, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, - 2, 0, 0, 1, 0, 2, 0, 0, 2, 1, 2, 0, 1, 0, 1, 0, 0, 1, 2, 2, 0, 0, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, - 0, 0, 2, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, - }; - s32 pad; u8 perVertexAlphaTable[5]; Vtx* vertices = Lib_SegmentedToVirtual(gMoonFireballVtx); @@ -568,8 +589,8 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { perVertexAlphaTable[3] = (s8)(104.0f * fireballAlpha); perVertexAlphaTable[4] = (s8)(54.0f * fireballAlpha); - for (i = 0; i < ARRAY_COUNT(sAlphaTableIndex); i++, vertices++) { - vertices->v.cn[3] = perVertexAlphaTable[sAlphaTableIndex[i]]; + for (i = 0; i < ARRAY_COUNT(sAlphaTableIndices); i++, vertices++) { + vertices->v.cn[3] = perVertexAlphaTable[sAlphaTableIndices[i]]; } } diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index 7ff59c5726..8ba7c66bcc 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -15,11 +15,8 @@ void EnFall2_Destroy(Actor* thisx, PlayState* play); void EnFall2_Update(Actor* thisx, PlayState* play); void EnFall2_Draw(Actor* thisx, PlayState* play); -void func_80C1B724(f32 arg0); void EnFall2_DoNothing(EnFall2* this, PlayState* play); -void func_80C1B9D4(EnFall2* this, PlayState* play); -void func_80C1B8F0(EnFall2* this); -void func_80C1B9D4(EnFall2* this, PlayState* play); +void EnFall2_HandleCutscene(EnFall2* this, PlayState* play); ActorInit En_Fall2_InitVars = { ACTOR_EN_FALL2, @@ -43,7 +40,7 @@ void EnFall2_Init(Actor* thisx, PlayState* play) { func_801835EC(&this->skeletonInfo, object_fall2_Blob_005EF4); this->unk2DC = Lib_SegmentedToVirtual(object_fall2_Matanimheader_008840); Actor_SetScale(&this->actor, 0.02f); - this->actionFunc = func_80C1B9D4; + this->actionFunc = EnFall2_HandleCutscene; this->cueType = CS_CMD_ACTOR_CUE_561; this->alphaLevel = 0.0f; } @@ -54,7 +51,7 @@ void EnFall2_Destroy(Actor* thisx, PlayState* play) { func_8018349C(&this->skeletonInfo); } -u8 sAlphaTableIndices[] = { +static u8 sAlphaTableIndices[] = { 0, 2, 0, 0, 4, 0, 4, 4, 2, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 2, 0, 4, 2, 2, 0, 4, 4, 4, 4, 0, 2, 2, 4, 0, 2, 0, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 4, 4, 4, 2, 2, 0, 4, 4, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 4, 4, 4, 4, 4, 2, 2, 0, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 0, 2, 2, 4, 4, 4, 4, 4, 4, @@ -106,6 +103,7 @@ void func_80C1B8F0(EnFall2* this) { this->alphaLevel = 1.0f; } break; + case 2: if (this->alphaLevel > 0.0f) { this->alphaLevel -= 0.1f; @@ -120,10 +118,13 @@ void func_80C1B8F0(EnFall2* this) { } this->actor.scale.z = this->actor.scale.x; } + + default: + break; } } -void func_80C1B9D4(EnFall2* this, PlayState* play) { +void EnFall2_HandleCutscene(EnFall2* this, PlayState* play) { func_80183DE0(&this->skeletonInfo); if (Cutscene_IsCueInChannel(play, this->cueType)) { Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 2fe21ebc74..d7933db62b 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -18,9 +18,6 @@ void EnFamos_Destroy(Actor* thisx, PlayState* play); void EnFamos_Update(Actor* thisx, PlayState* play); void EnFamos_Draw(Actor* thisx, PlayState* play); -void EnFamos_SetupAttackDebris(EnFamos* this); -void EnFamos_SetupDeathDebris(EnFamos* this); -s32 EnFamos_IsPlayerSeen(EnFamos* this, PlayState* play); void EnFamos_SetupStillIdle(EnFamos* this); void EnFamos_StillIdle(EnFamos* this, PlayState* play); void EnFamos_SetupPathingIdle(EnFamos* this); @@ -49,7 +46,6 @@ void EnFamos_SetupDeathExplosion(EnFamos* this); void EnFamos_DeathExplosion(EnFamos* this, PlayState* play); void EnFamos_SetupDeathFade(EnFamos* this); void EnFamos_DeathFade(EnFamos* this, PlayState* play); -void EnFamos_DrawDebris(EnFamos* this, PlayState* play); ActorInit En_Famos_InitVars = { ACTOR_EN_FAMOS, @@ -501,7 +497,7 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { Math_StepToF(&this->actor.speed, 6.0f, 0.5f); surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough + if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && ((surfaceType != FLOOR_PROPERTY_12) && (surfaceType != FLOOR_PROPERTY_13))) { EnFamos_SetupAttackAim(this); diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 491d3c4991..3fecf18617 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -5,7 +5,6 @@ */ #include "z_en_fg.h" -#include "objects/object_fr/object_fr.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_200 | ACTOR_FLAG_4000) @@ -20,9 +19,18 @@ void EnFg_Draw(Actor* thisx, PlayState* play); void EnFg_Jump(EnFg* this, PlayState* play); void EnFg_DoNothing(EnFg* this, PlayState* play); void EnFg_Knockback(EnFg* this, PlayState* play); -void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos); -void EnFg_UpdateDust(EnFgEffectDust* dustEffect); -void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect); +void EnFg_AddDust(BetaFrogEffectDust* dustEffect, Vec3f* pos); +void EnFg_UpdateDust(BetaFrogEffectDust* dustEffect); +void EnFg_DrawDust(PlayState* play, BetaFrogEffectDust* dustEffect); + +typedef enum { + /* 0 */ BETAFROG_DMGEFFECT_NONE, + /* 1 */ BETAFROG_DMGEFFECT_EXPLOSION, // Bomb or bombchu, not powderkeg + /* 2 */ BETAFROG_DMGEFFECT_DEKUSTICK, + /* 3 */ BETAFROG_DMGEFFECT_HOOKSHOT, + /* 4 */ BETAFROG_DMGEFFECT_ARROW, + /* 5 */ BETAFROG_DMGEFFECT_ICEARROW +} BetaFrogDamageEffect; ActorInit En_Fg_InitVars = { ACTOR_EN_FG, @@ -95,29 +103,37 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfoS sAnimationInfo[] = { - { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_fr_Anim_0011C0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_fr_Anim_0007BC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, +typedef enum { + /* -1 */ BETAFROG_ANIM_NONE = -1, + /* 0 */ BETAFROG_ANIM_0, + /* 1 */ BETAFROG_ANIM_1, + /* 2 */ BETAFROG_ANIM_2, + /* 3 */ BETAFROG_ANIM_3, + /* 4 */ BETAFROG_ANIM_MAX +} BetaFrogAnimation; + +static AnimationInfoS sAnimationInfo[BETAFROG_ANIM_MAX] = { + { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // BETAFROG_ANIM_0 + { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // BETAFROG_ANIM_1 + { &object_fr_Anim_0011C0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // BETAFROG_ANIM_2 + { &object_fr_Anim_0007BC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // BETAFROG_ANIM_3 }; s32 EnFg_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { - s16 frameCount; - s32 ret; + s16 endFrame; + s32 didAnimChange = false; - ret = false; - if ((animIndex >= 0) && (animIndex < 4)) { - ret = true; - frameCount = sAnimationInfo[animIndex].frameCount; - if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + if ((animIndex > BETAFROG_ANIM_NONE) && (animIndex < BETAFROG_ANIM_MAX)) { + didAnimChange = true; + endFrame = sAnimationInfo[animIndex].frameCount; + if (endFrame < 0) { + endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, - sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].startFrame, endFrame, sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); } - return ret; + return didAnimChange; } void func_80A2D348(EnFg* this, PlayState* play) { @@ -130,7 +146,7 @@ void func_80A2D348(EnFg* this, PlayState* play) { } } -void func_80A2D3D4(EnFg* this, PlayState* play) { +void EnFg_UpdateSkelAnime(EnFg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } @@ -144,28 +160,28 @@ u8 EnFg_UpdateHealth(EnFg* this) { } s32 EnFg_GetDamageEffect(EnFg* this) { - s32 ret = 0; + s32 ret = BETAFROG_DMGEFFECT_NONE; if (this->collider.base.acFlags & AC_HIT) { switch (this->actor.colChkInfo.damageEffect) { case 1: - ret = FG_DMGEFFECT_DEKUSTICK; + ret = BETAFROG_DMGEFFECT_DEKUSTICK; break; case 15: - ret = FG_DMGEFFECT_HOOKSHOT; + ret = BETAFROG_DMGEFFECT_HOOKSHOT; break; case 14: - ret = FG_DMGEFFECT_ARROW; + ret = BETAFROG_DMGEFFECT_ARROW; break; case 3: - ret = FG_DMGEFFECT_ICEARROW; + ret = BETAFROG_DMGEFFECT_ICEARROW; break; default: - ret = FG_DMGEFFECT_EXPLOSION; + ret = BETAFROG_DMGEFFECT_EXPLOSION; break; } this->collider.base.acFlags &= ~AC_HIT; @@ -180,7 +196,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { s16 rotX; switch (EnFg_GetDamageEffect(this)) { - case FG_DMGEFFECT_DEKUSTICK: + case BETAFROG_DMGEFFECT_DEKUSTICK: this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_1); this->skelAnime.playSpeed = 0.0f; @@ -192,10 +208,10 @@ void EnFg_Idle(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_HOOKSHOT: + case BETAFROG_DMGEFFECT_HOOKSHOT: break; - case FG_DMGEFFECT_ARROW: + case BETAFROG_DMGEFFECT_ARROW: this->actor.flags &= ~ACTOR_FLAG_1; this->skelAnime.playSpeed = 0.0f; rotY = this->collider.base.ac->world.rot.y; @@ -209,10 +225,10 @@ void EnFg_Idle(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_EXPLOSION: + case BETAFROG_DMGEFFECT_EXPLOSION: this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); - this->actor.params = FG_BLACK; + this->actor.params = BETAFROG_BLACK; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); @@ -228,7 +244,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { default: if (DECR(this->timer) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); - EnFg_ChangeAnim(&this->skelAnime, 3); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_3); this->actor.velocity.y = 10.0f; this->timer = Rand_S16Offset(30, 30); this->actionFunc = EnFg_Jump; @@ -244,7 +260,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { s16 rotX; switch (EnFg_GetDamageEffect(this)) { - case FG_DMGEFFECT_ARROW: + case BETAFROG_DMGEFFECT_ARROW: this->actor.flags &= ~ACTOR_FLAG_1; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; @@ -259,14 +275,14 @@ void EnFg_Jump(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_HOOKSHOT: + case BETAFROG_DMGEFFECT_HOOKSHOT: break; - case FG_DMGEFFECT_EXPLOSION: + case BETAFROG_DMGEFFECT_EXPLOSION: this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); - EnFg_ChangeAnim(&this->skelAnime, 0); - this->actor.params = FG_BLACK; + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_0); + this->actor.params = BETAFROG_BLACK; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); @@ -286,7 +302,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { } if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - EnFg_ChangeAnim(&this->skelAnime, 0); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_0); this->actionFunc = EnFg_Idle; this->actor.velocity.y = 0.0f; } else { @@ -325,8 +341,9 @@ void EnFg_Init(Actor* thisx, PlayState* play) { EnFg* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, NULL, this->jointTable, this->morphTable, 24); - EnFg_ChangeAnim(&this->skelAnime, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, NULL, this->jointTable, this->morphTable, + OBJECT_FR_LIMB_MAX); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_0); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); @@ -360,7 +377,7 @@ void EnFg_Update(Actor* thisx, PlayState* play) { } } - func_80A2D3D4(this, play); + EnFg_UpdateSkelAnime(this, play); EnFg_UpdateDust(&this->dustEffect[0]); func_80A2D348(this, play); } @@ -368,12 +385,12 @@ void EnFg_Update(Actor* thisx, PlayState* play) { s32 EnFg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == OBJECT_FR_LIMB_07) || (limbIndex == OBJECT_FR_LIMB_08)) { *dList = NULL; } if (this->actor.colChkInfo.health == 0) { - if ((limbIndex == 5) || (limbIndex == 9)) { + if ((limbIndex == OBJECT_FR_LIMB_05) || (limbIndex == OBJECT_FR_LIMB_09)) { *dList = NULL; } } @@ -383,9 +400,9 @@ s32 EnFg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; s16 pad; - Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == OBJECT_FR_LIMB_07) || (limbIndex == OBJECT_FR_LIMB_08)) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -397,8 +414,8 @@ void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 4) { - Matrix_MultVec3f(&vec1, &this->actor.focus.pos); + if (limbIndex == OBJECT_FR_LIMB_04) { + Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); } } @@ -406,8 +423,12 @@ void EnFg_Draw(Actor* thisx, PlayState* play) { EnFg* this = THIS; s32 pad; Color_RGBA8 envColor[] = { - { 200, 170, 0, 255 }, { 0, 170, 200, 255 }, { 210, 120, 100, 255 }, - { 120, 130, 230, 255 }, { 190, 190, 190, 255 }, { 0, 0, 0, 255 }, + { 200, 170, 0, 255 }, // BETAFROG_YELLOW + { 0, 170, 200, 255 }, // BETAFROG_CYAN + { 210, 120, 100, 255 }, // BETAFROG_PINK + { 120, 130, 230, 255 }, // BETAFROG_BLUE + { 190, 190, 190, 255 }, // BETAFROG_WHITE + { 0, 0, 0, 255 }, // BETAFROG_BLACK }; Matrix_Push(); @@ -428,8 +449,8 @@ void EnFg_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { - Vec3f vel = { 0.0f, 3.0f, 0.0f }; +void EnFg_AddDust(BetaFrogEffectDust* dustEffect, Vec3f* pos) { + Vec3f velocity = { 0.0f, 3.0f, 0.0f }; Vec3f unk_20 = { 0.0f, 0.0f, 0.0f }; s32 i; @@ -437,8 +458,8 @@ void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { if (!dustEffect->type) { dustEffect->type = true; dustEffect->timer = 16; - dustEffect->pos = *worldPos; - dustEffect->velocity = vel; + dustEffect->pos = *pos; + dustEffect->velocity = velocity; dustEffect->unk_20 = unk_20; dustEffect->xyScale = 0.4f; break; @@ -446,7 +467,7 @@ void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { } } -void EnFg_UpdateDust(EnFgEffectDust* dustEffect) { +void EnFg_UpdateDust(BetaFrogEffectDust* dustEffect) { s32 i; for (i = 0; i < 10; i++, dustEffect++) { @@ -463,7 +484,7 @@ static TexturePtr sDustTextures[] = { gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; -void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { +void EnFg_DrawDust(PlayState* play, BetaFrogEffectDust* dustEffect) { s16 i; s16 alpha; s16 index; diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.h b/src/overlays/actors/ovl_En_Fg/z_en_fg.h index a1917b9bcb..4f4f84fe0a 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.h +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.h @@ -2,6 +2,7 @@ #define Z_EN_FG_H #include "global.h" +#include "objects/object_fr/object_fr.h" struct EnFg; @@ -9,22 +10,13 @@ typedef void (*EnFgActionFunc)(struct EnFg*, PlayState*); // Based on the envColor data. Related to params but mostly unused. typedef enum { - /* 0 */ FG_YELLOW, - /* 1 */ FG_CYAN, - /* 2 */ FG_PINK, - /* 3 */ FG_BLUE, - /* 4 */ FG_WHITE, - /* 5 */ FG_BLACK // All frogs are blackened when hit by an explosion -} FrogType; - -typedef enum { - /* 0 */ FG_DMGEFFECT_NONE, - /* 1 */ FG_DMGEFFECT_EXPLOSION, // Bomb or bombchu, not powderkeg - /* 2 */ FG_DMGEFFECT_DEKUSTICK, - /* 3 */ FG_DMGEFFECT_HOOKSHOT, - /* 4 */ FG_DMGEFFECT_ARROW, - /* 5 */ FG_DMGEFFECT_ICEARROW -} FrogDamageEffect; + /* 0 */ BETAFROG_YELLOW, + /* 1 */ BETAFROG_CYAN, + /* 2 */ BETAFROG_PINK, + /* 3 */ BETAFROG_BLUE, + /* 4 */ BETAFROG_WHITE, + /* 5 */ BETAFROG_BLACK // All frogs are blackened when hit by an explosion +} BetaFrogType; typedef struct { /* 0x00 */ u8 type; @@ -35,18 +27,18 @@ typedef struct { /* 0x20 */ Vec3f unk_20; // Likely acceleration, set to 0 but unused /* 0x2C */ Vec3f velocity; /* 0x38 */ UNK_TYPE1 unk_38[0x4]; -} EnFgEffectDust; // size = 0x3C +} BetaFrogEffectDust; // size = 0x3C typedef struct EnFg { /* 0x000 */ Actor actor; /* 0x144 */ EnFgActionFunc actionFunc; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ Vec3s jointTable[24]; - /* 0x268 */ Vec3s morphTable[24]; + /* 0x1D8 */ Vec3s jointTable[OBJECT_FR_LIMB_MAX]; + /* 0x268 */ Vec3s morphTable[OBJECT_FR_LIMB_MAX]; /* 0x2F8 */ s16 timer; /* 0x2FA */ s16 bounceCounter; - /* 0x2FC */ EnFgEffectDust dustEffect[10]; + /* 0x2FC */ BetaFrogEffectDust dustEffect[10]; } EnFg; // size = 0x554 #endif // Z_EN_FG_H diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 90801ef444..1e8425412e 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -29,9 +29,12 @@ ActorInit En_Fire_Rock_InitVars = { void EnFireRock_Init(Actor* thisx, PlayState* play) { } + void EnFireRock_Destroy(Actor* thisx, PlayState* play) { } + void EnFireRock_Update(Actor* thisx, PlayState* play) { } + void EnFireRock_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 0331ec3470..0a7e892a70 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -5,7 +5,6 @@ */ #include "z_en_fish.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0x00000000 @@ -206,7 +205,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { } SkelAnime_InitFlex(play, &this->skelAnime, &gameplay_keep_Skel_02F028, &gameplay_keep_Anim_02F0EC, this->jointTable, - this->morphTable, 7); + this->morphTable, FISH_LIMB_MAX); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = this->unk_25C * 30.0f; diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 4261a4f83e..e0837779d0 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -2,6 +2,7 @@ #define Z_EN_FISH_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" struct EnFish; @@ -21,8 +22,8 @@ typedef struct EnFish { /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colliderElements[1]; /* 0x1A4 */ SkelAnime skelAnime; - /* 0x1E8 */ Vec3s jointTable[7]; - /* 0x212 */ Vec3s morphTable[7]; + /* 0x1E8 */ Vec3s jointTable[FISH_LIMB_MAX]; + /* 0x212 */ Vec3s morphTable[FISH_LIMB_MAX]; /* 0x23C */ EnFishUnkFunc unkFunc; /* 0x240 */ s16 unk_240; /* 0x242 */ s16 unk_242; diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 6202072cbb..b047e65ee9 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -8,7 +8,6 @@ #include "overlays/actors/ovl_En_Mushi2/z_en_mushi2.h" #include "z_en_fish2.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_fb/object_fb.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -44,7 +43,7 @@ void func_80B2B180(EnFish2* this, PlayState* play); static s32 D_80B2B2E0 = 0; static s32 D_80B2B2E4 = 0; -static s32 D_80B2B2E8 = 0; +static s32 D_80B2B2E8 = false; static s32 D_80B2B2EC = 0; static s32 D_80B2B2F0 = 0; static Actor* D_80B2B2F4 = NULL; @@ -102,29 +101,51 @@ static ColliderJntSphInit sJntSphInit = { static f32 D_80B2B370[] = { 0.01f, 0.012f, 0.014f, 0.017f }; static f32 D_80B2B380[] = { 0.019f, 0.033f }; -void func_80B28370(EnFish2* this, s32 arg0) { - static AnimationHeader* D_80B2B388[] = { - &object_fb_Anim_0013AC, &object_fb_Anim_0007D4, &object_fb_Anim_0006D8, - &object_fb_Anim_0006D8, &object_fb_Anim_001174, &object_fb_Anim_000ACC, - }; - static u8 D_80B2B3A0[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, - }; - f32 sp34; +typedef enum { + /* 0 */ FISH2_ANIM_0, + /* 1 */ FISH2_ANIM_1, + /* 2 */ FISH2_ANIM_2, + /* 3 */ FISH2_ANIM_3, + /* 4 */ FISH2_ANIM_4, + /* 5 */ FISH2_ANIM_5, + /* 6 */ FISH2_ANIM_MAX +} Fish2Animation; - this->unk_2AC = arg0; - this->unk_2CC = Animation_GetLastFrame(&D_80B2B388[arg0]->common); - sp34 = 0.0f; - if (this->unk_2AC == 3) { - sp34 = Animation_GetLastFrame(&D_80B2B388[this->unk_2AC]->common) - 21.0f; +static AnimationHeader* sAnimations[FISH2_ANIM_MAX] = { + &object_fb_Anim_0013AC, // FISH2_ANIM_0 + &object_fb_Anim_0007D4, // FISH2_ANIM_1 + &object_fb_Anim_0006D8, // FISH2_ANIM_2 + &object_fb_Anim_0006D8, // FISH2_ANIM_3 + &object_fb_Anim_001174, // FISH2_ANIM_4 + &object_fb_Anim_000ACC, // FISH2_ANIM_5 +}; + +static u8 sAnimationModes[FISH2_ANIM_MAX] = { + ANIMMODE_LOOP, // FISH2_ANIM_0 + ANIMMODE_LOOP, // FISH2_ANIM_1 + ANIMMODE_ONCE, // FISH2_ANIM_2 + ANIMMODE_ONCE, // FISH2_ANIM_3 + ANIMMODE_ONCE, // FISH2_ANIM_4 + ANIMMODE_ONCE, // FISH2_ANIM_5 +}; + +void EnFish2_ChangeAnim(EnFish2* this, s32 animIndex) { + f32 startFrame; + + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(&sAnimations[animIndex]->common); + + startFrame = 0.0f; + if (this->animIndex == FISH2_ANIM_3) { + startFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common) - 21.0f; } - if (this->unk_2AC == 2) { - this->unk_2CC = Animation_GetLastFrame(&D_80B2B388[this->unk_2AC]->common) - 21.0f; + if (this->animIndex == FISH2_ANIM_2) { + this->animEndFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common) - 21.0f; } - Animation_Change(&this->skelAnime, D_80B2B388[this->unk_2AC], 1.0f, sp34, this->unk_2CC, D_80B2B3A0[this->unk_2AC], - -10.0f); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->animEndFrame, + sAnimationModes[this->animIndex], -10.0f); } s32 func_80B28478(EnFish2* this) { @@ -160,7 +181,7 @@ void EnFish2_Init(Actor* thisx, PlayState* play) { if (this->actor.params == 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_fb_Skel_006190, &object_fb_Anim_0013AC, this->jointTable, - this->morphTable, 24); + this->morphTable, OBJECT_FB_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_344 == 0) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_10)) { @@ -309,7 +330,7 @@ void func_80B289DC(EnFish2* this, PlayState* play) { } void func_80B28B5C(EnFish2* this) { - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->unk_2B4 = 0; this->unk_348 = 0; this->unk_2C4 = 0; @@ -387,7 +408,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f); } - if ((D_80B2B2E8 == 0) && (D_80B2B2E0 != 2)) { + if (!D_80B2B2E8 && (D_80B2B2E0 != 2)) { while (itemAction != NULL) { if ((itemAction->id != ACTOR_EN_FISH) && (itemAction->id != ACTOR_EN_MUSHI2)) { itemAction = itemAction->next; @@ -457,7 +478,7 @@ void func_80B29194(EnFish2* this) { this->unk_34A = 0; this->unk_340 = (s32)Rand_ZeroOne() & 1; - func_80B28370(this, 1); + EnFish2_ChangeAnim(this, FISH2_ANIM_1); this->actionFunc = func_80B29250; } @@ -482,15 +503,15 @@ void func_80B29250(EnFish2* this, PlayState* play) { } void func_80B2938C(EnFish2* this) { - func_80B28370(this, 5); + EnFish2_ChangeAnim(this, FISH2_ANIM_5); this->unk_348 = 0; this->actionFunc = func_80B293C4; } void func_80B293C4(EnFish2* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; - if (func_80B28478(this) == 0) { + if (!func_80B28478(this)) { func_80B287F4(this, 1); Math_ApproachF(&this->actor.speed, (*D_80B2B380 - this->unk_330) * 1000.0f, 0.3f, 0.3f); @@ -500,8 +521,8 @@ void func_80B293C4(EnFish2* this, PlayState* play) { this->actor.speed = 1.0f; } - if (this->unk_2CC <= currentFrame) { - func_80B28370(this, 1); + if (curFrame >= this->animEndFrame) { + EnFish2_ChangeAnim(this, FISH2_ANIM_1); if (this->unk_2B0 == 0) { this->actionFunc = func_80B29250; } else { @@ -536,7 +557,7 @@ void func_80B2951C(EnFish2* this) { void func_80B295A4(EnFish2* this, PlayState* play) { s32 i; - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad; Vec3f sp60; @@ -551,9 +572,9 @@ void func_80B295A4(EnFish2* this, PlayState* play) { for (i = 0; i < 2; i++) { EffectSsBubble_Spawn(play, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); } - } else if (this->unk_2CC <= currentFrame) { - if (this->unk_2AC != 5) { - func_80B28370(this, 5); + } else if (curFrame >= this->animEndFrame) { + if (this->animIndex != FISH2_ANIM_5) { + EnFish2_ChangeAnim(this, FISH2_ANIM_5); } else if (this->unk_2C8 == 0) { func_80B29778(this); } else { @@ -566,7 +587,7 @@ void func_80B295A4(EnFish2* this, PlayState* play) { } void func_80B29778(EnFish2* this) { - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->unk_2B4 = 0; this->unk_2C4 = 0; this->unk_2B6 = this->unk_2B4; @@ -645,12 +666,12 @@ void func_80B297FC(EnFish2* this, PlayState* play) { case 2: phi_f0 = 0.1f; - + // fallthrough case 4: if (phi_f0 == 0) { phi_f0 = 0.3f; } - + // fallthrough case 6: if (phi_f0 == 0) { phi_f0 = 0.5f; @@ -676,12 +697,12 @@ void func_80B297FC(EnFish2* this, PlayState* play) { case 3: phi_f0 = 1.3f; - + // fallthrough case 5: if (phi_f0 == 0) { phi_f0 = 1.5f; } - + // fallthrough case 7: if (phi_f0 == 0) { phi_f0 = 1.7f; @@ -754,7 +775,7 @@ void func_80B29E5C(EnFish2* this, PlayState* play) { if (&this->actor != prop) { this->unk_350 = prop; this->unk_2B0 = D_80B2B2E8 = 1; - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->actionFunc = func_80B29EE4; break; } @@ -868,7 +889,7 @@ void func_80B2A23C(EnFish2* this, PlayState* play) { } void func_80B2A448(EnFish2* this) { - func_80B28370(this, 4); + EnFish2_ChangeAnim(this, FISH2_ANIM_4); this->unk_2B4 = 0; this->unk_2C4 = 0; this->unk_2B6 = this->unk_2B4; @@ -877,10 +898,10 @@ void func_80B2A448(EnFish2* this) { } void func_80B2A498(EnFish2* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f sp80; - if ((this->unk_2AC == 4) && Animation_OnFrame(&this->skelAnime, 13.0f)) { + if ((this->animIndex == FISH2_ANIM_4) && Animation_OnFrame(&this->skelAnime, 13.0f)) { Actor* temp_v0; Math_Vec3f_Copy(&sp80, &this->unk_318); @@ -899,7 +920,7 @@ void func_80B2A498(EnFish2* this, PlayState* play) { } } - if ((this->unk_2AC == 4) && + if ((this->animIndex == FISH2_ANIM_4) && (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 31.0f))) { WaterBox* sp78; @@ -920,12 +941,12 @@ void func_80B2A498(EnFish2* this, PlayState* play) { } } - if ((this->unk_2CC <= currentFrame) && (this->unk_2AC == 4)) { + if ((curFrame >= this->animEndFrame) && (this->animIndex == FISH2_ANIM_4)) { D_80B2B2E0 = 0; D_80B2B2E4 = 3; this->actor.world.pos.x = this->unk_324.x; this->actor.world.pos.z = this->unk_324.z; - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); } } @@ -1004,7 +1025,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { } } - if ((D_80B2B2E8 == 0) && (this->actionFunc == func_80B28C14)) { + if (!D_80B2B2E8 && (this->actionFunc == func_80B28C14)) { s32 temp_s0_2 = this->unk_344 * 2; f32 phi_f2 = 0.0f; f32 phi_f20 = 0; @@ -1029,7 +1050,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { } } - if (D_80B2B2E8 == 0) { + if (!D_80B2B2E8) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1039,7 +1060,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { s32 EnFish2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFish2* this = THIS; - if ((limbIndex == 20) || (limbIndex == 21)) { + if ((limbIndex == OBJECT_FB_LIMB_14) || (limbIndex == OBJECT_FB_LIMB_15)) { *dList = NULL; } @@ -1050,7 +1071,7 @@ void EnFish2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EnFish2* this = THIS; s32 pad; - if ((limbIndex == 20) || (limbIndex == 21)) { + if ((limbIndex == OBJECT_FB_LIMB_14) || (limbIndex == OBJECT_FB_LIMB_15)) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -1064,11 +1085,11 @@ void EnFish2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 14) { + if (limbIndex == OBJECT_FB_LIMB_0E) { Matrix_MultVec3f(&gZeroVec3f, &this->unk_318); } - if (limbIndex == 17) { + if (limbIndex == OBJECT_FB_LIMB_11) { Matrix_MultVec3f(&gZeroVec3f, &this->unk_300); } diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h index 20b1ff21b0..a324e0bab8 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -2,6 +2,7 @@ #define Z_EN_FISH2_H #include "global.h" +#include "objects/object_fb/object_fb.h" struct EnFish2; @@ -18,46 +19,46 @@ typedef struct { } EnFish2UnkStruct; // size = 0x24 typedef struct EnFish2 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ SkelAnime skelAnime; - /* 0x0188 */ Vec3s jointTable[24]; - /* 0x0218 */ Vec3s morphTable[24]; - /* 0x02A8 */ EnFish2ActionFunc actionFunc; - /* 0x02AC */ s32 unk_2AC; - /* 0x02B0 */ s32 unk_2B0; - /* 0x02B4 */ s16 unk_2B4; - /* 0x02B6 */ s16 unk_2B6; - /* 0x02B8 */ s16 unk_2B8; - /* 0x02BA */ s16 csIdList[3]; - /* 0x02C0 */ s32 unk_2C0; - /* 0x02C4 */ s32 unk_2C4; - /* 0x02C8 */ u8 unk_2C8; - /* 0x02CA */ s16 subCamId; - /* 0x02CC */ f32 unk_2CC; - /* 0x02D0 */ UNK_TYPE1 unk_2D0[0x4]; - /* 0x02D4 */ f32 unk_2D4; - /* 0x02D8 */ f32 unk_2D8; - /* 0x02DC */ Vec3f subCamEye; - /* 0x02E8 */ Vec3f subCamAt; - /* 0x02F4 */ Vec3f unk_2F4; - /* 0x0300 */ Vec3f unk_300; - /* 0x030C */ Vec3f unk_30C; - /* 0x0318 */ Vec3f unk_318; - /* 0x0324 */ Vec3f unk_324; - /* 0x0330 */ f32 unk_330; - /* 0x0334 */ f32 unk_334; - /* 0x0338 */ f32 unk_338; - /* 0x033C */ f32 unk_33C; - /* 0x0340 */ s32 unk_340; - /* 0x0344 */ s32 unk_344; - /* 0x0348 */ s16 unk_348; - /* 0x034A */ s16 unk_34A; - /* 0x034C */ s16 unk_34C; - /* 0x0350 */ Actor* unk_350; - /* 0x0354 */ struct EnFish2* unk_354; - /* 0x0358 */ ColliderJntSph collider; - /* 0x0378 */ ColliderJntSphElement colliderElements[2]; - /* 0x03F8 */ EnFish2UnkStruct unk_3F8[200]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[OBJECT_FB_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[OBJECT_FB_LIMB_MAX]; + /* 0x2A8 */ EnFish2ActionFunc actionFunc; + /* 0x2AC */ s32 animIndex; + /* 0x2B0 */ s32 unk_2B0; + /* 0x2B4 */ s16 unk_2B4; + /* 0x2B6 */ s16 unk_2B6; + /* 0x2B8 */ s16 unk_2B8; + /* 0x2BA */ s16 csIdList[3]; + /* 0x2C0 */ s32 unk_2C0; + /* 0x2C4 */ s32 unk_2C4; + /* 0x2C8 */ u8 unk_2C8; + /* 0x2CA */ s16 subCamId; + /* 0x2CC */ f32 animEndFrame; + /* 0x2D0 */ UNK_TYPE1 unk_2D0[0x4]; + /* 0x2D4 */ f32 unk_2D4; + /* 0x2D8 */ f32 unk_2D8; + /* 0x2DC */ Vec3f subCamEye; + /* 0x2E8 */ Vec3f subCamAt; + /* 0x2F4 */ Vec3f unk_2F4; + /* 0x300 */ Vec3f unk_300; + /* 0x30C */ Vec3f unk_30C; + /* 0x318 */ Vec3f unk_318; + /* 0x324 */ Vec3f unk_324; + /* 0x330 */ f32 unk_330; + /* 0x334 */ f32 unk_334; + /* 0x338 */ f32 unk_338; + /* 0x33C */ f32 unk_33C; + /* 0x340 */ s32 unk_340; + /* 0x344 */ s32 unk_344; + /* 0x348 */ s16 unk_348; + /* 0x34A */ s16 unk_34A; + /* 0x34C */ s16 unk_34C; + /* 0x350 */ Actor* unk_350; + /* 0x354 */ struct EnFish2* unk_354; + /* 0x358 */ ColliderJntSph collider; + /* 0x378 */ ColliderJntSphElement colliderElements[2]; + /* 0x3F8 */ EnFish2UnkStruct unk_3F8[200]; } EnFish2; // size = 0x2018 #endif // Z_EN_FISH2_H diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index dcf2db26db..f481c346c7 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -2611,6 +2611,9 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sReelLinePos[LINE_SEG_COUNT - 1].z = sLurePos.z; D_809101C4 = 2.0f; break; + + default: + break; } } @@ -3892,6 +3895,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } break; + case 1: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { @@ -3909,6 +3913,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } break; + + default: + break; } } @@ -4172,19 +4179,19 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { s32 EnFishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 13) { + if (limbIndex == FISHING_FISH_LIMB_0D) { rot->z -= this->unk_168 - 11000; - } else if ((limbIndex == 2) || (limbIndex == 3)) { + } else if ((limbIndex == FISHING_FISH_LIMB_02) || (limbIndex == FISHING_FISH_LIMB_03)) { rot->y += this->unk_164; - } else if (limbIndex == 4) { + } else if (limbIndex == FISHING_FISH_LIMB_04) { rot->y += this->unk_16E; - } else if (limbIndex == 0xE) { + } else if (limbIndex == FISHING_FISH_LIMB_0E) { rot->y -= this->unk_16A; - } else if (limbIndex == 0xF) { + } else if (limbIndex == FISHING_FISH_LIMB_0F) { rot->y += this->unk_16A; - } else if (limbIndex == 8) { + } else if (limbIndex == FISHING_FISH_LIMB_08) { rot->y += this->unk_16C; - } else if (limbIndex == 9) { + } else if (limbIndex == FISHING_FISH_LIMB_09) { rot->y -= this->unk_16C; } @@ -4194,7 +4201,7 @@ s32 EnFishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, void EnFishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 13) { + if (limbIndex == FISHING_FISH_LIMB_0D) { Matrix_MultVec3f(&sFishMouthOffset, &this->fishMouthPos); } } @@ -4202,11 +4209,11 @@ void EnFishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec s32 EnFishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 3) { + if (limbIndex == FISHING_LOACH_LIMB_03) { rot->y += this->unk_1C4[0]; - } else if (limbIndex == 4) { + } else if (limbIndex == FISHING_LOACH_LIMB_04) { rot->y += this->unk_1C4[1]; - } else if (limbIndex == 5) { + } else if (limbIndex == FISHING_LOACH_LIMB_05) { rot->y += this->unk_1C4[2]; } @@ -4217,7 +4224,7 @@ void EnFishing_LoachPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve static Vec3f sLoachMouthOffset = { 500.0f, 500.0f, 0.0f }; EnFishing* this = THIS; - if (limbIndex == 11) { + if (limbIndex == FISHING_LOACH_LIMB_0B) { Matrix_MultVec3f(&sLoachMouthOffset, &this->fishMouthPos); } } @@ -4735,10 +4742,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { this->unk_154 = 3; } break; + case 1: Message_ContinueTextbox(play, 0x2D); this->unk_154 = 3; break; + + default: + break; } } break; @@ -4771,9 +4782,13 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { Message_ContinueTextbox(play, 0x4080); this->unk_154 = 5; break; + case 1: Message_ContinueTextbox(play, 0x407F); break; + + default: + break; } } break; @@ -4806,9 +4821,13 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { D_8090CD0C = 0; this->unk_154 = 20; break; + case 1: this->unk_154 = 0; break; + + default: + break; } } } else { @@ -4839,6 +4858,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } Message_ContinueTextbox(play, this->actor.textId); break; + case 1: if (D_8090CD00 > 36000) { D_8090CD00 = 30000; @@ -4870,6 +4890,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 0; break; + case 2: if (D_809171D8 == 0) { Message_ContinueTextbox(play, 0x4085); @@ -4878,6 +4899,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 22; break; + + default: + break; } } } @@ -4975,6 +4999,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 0: this->unk_154 = 0; break; + case 1: if (D_809171D8 == 0) { Message_ContinueTextbox(play, 0x4085); @@ -4983,6 +5008,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 22; break; + + default: + break; } } break; @@ -5019,6 +5047,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } } break; + + default: + break; } } @@ -5582,7 +5613,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { s32 EnFishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 8) { // Head + if (limbIndex == FISHING_OWNER_LIMB_HEAD) { rot->x -= this->unk_15C; } @@ -5590,7 +5621,7 @@ s32 EnFishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, } void EnFishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - if (limbIndex == 8) { // Head + if (limbIndex == FISHING_OWNER_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 6ecc9f2aaa..57466a2518 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -135,20 +135,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -static Vec3f D_808D3900[PLAYER_FORM_MAX] = { - { 25.0f, 45.0f, -7.0f }, // PLAYER_FORM_FIERCE_DEITY - { 25.0f, 40.0f, -12.0f }, // PLAYER_FORM_GORON - { 25.0f, 35.0f, -2.0f }, // PLAYER_FORM_ZORA - { 10.0f, 20.0f, -4.0f }, // PLAYER_FORM_DEKU - { 15.0f, 25.0f, -2.0f }, // PLAYER_FORM_HUMAN -}; - -static s8 D_808D393C[] = { - -1, -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, -1, 3, -1, 4, -1, -1, 5, -1, -1, -1, 6, 7, -1, 8, -}; - -static Color_RGBA8 D_808D3958 = { 0, 255, 0, 0 }; - void EnFloormas_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnFloormas* this = THIS; @@ -393,7 +379,7 @@ void func_808D108C(EnFloormas* this) { } void func_808D11BC(EnFloormas* this, PlayState* play) { - f32 frame; + f32 curFrame; f32 sp30; f32 sp2C; @@ -410,8 +396,8 @@ void func_808D11BC(EnFloormas* this, PlayState* play) { } } - frame = this->skelAnime.curFrame; - if ((frame >= 7.0f) && (frame < 22.0f)) { + curFrame = this->skelAnime.curFrame; + if ((curFrame >= 7.0f) && (curFrame < 22.0f)) { sp30 = Math_SinS(this->actor.shape.rot.y + 0x4268); sp2C = Math_CosS(this->actor.shape.rot.y + 0x4268); this->actor.shape.rot.y += this->unk_190; @@ -715,6 +701,14 @@ void func_808D2040(EnFloormas* this, PlayState* play) { } } +static Vec3f D_808D3900[PLAYER_FORM_MAX] = { + { 25.0f, 45.0f, -7.0f }, // PLAYER_FORM_FIERCE_DEITY + { 25.0f, 40.0f, -12.0f }, // PLAYER_FORM_GORON + { 25.0f, 35.0f, -2.0f }, // PLAYER_FORM_ZORA + { 10.0f, 20.0f, -4.0f }, // PLAYER_FORM_DEKU + { 15.0f, 25.0f, -2.0f }, // PLAYER_FORM_HUMAN +}; + void func_808D217C(EnFloormas* this, Player* player) { Vec3f* ptr; @@ -1163,6 +1157,34 @@ s32 EnFloormas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec return false; } +static s8 D_808D393C[WALLMASTER_LIMB_MAX] = { + -1, // WALLMASTER_LIMB_NONE + -1, // WALLMASTER_LIMB_ROOT + -1, // WALLMASTER_LIMB_HAND + -1, // WALLMASTER_LIMB_INDEX_FINGER_ROOT + 0, // WALLMASTER_LIMB_INDEX_FINGER_PROXIMAL + -1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL_ROOT + -1, // WALLMASTER_LIMB_INDEX_FINGER_MIDDLE + 1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL + -1, // WALLMASTER_LIMB_RING_FINGER_ROOT + 2, // WALLMASTER_LIMB_RING_FINGER_PROXIMAL + -1, // WALLMASTER_LIMB_RING_FINGER_DISTAL_ROOT + -1, // WALLMASTER_LIMB_RING_FINGER_MIDDLE + 3, // WALLMASTER_LIMB_RING_FINGER_DISTAL + -1, // WALLMASTER_LIMB_MIDDLE_FINGER_ROOT + 4, // WALLMASTER_LIMB_MIDDLE_FINGER_PROXIMAL + -1, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL_ROOT + -1, // WALLMASTER_LIMB_MIDDLE_FINGER_MIDDLE + 5, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL + -1, // WALLMASTER_LIMB_WRIST_ROOT + -1, // WALLMASTER_LIMB_WRIST + -1, // WALLMASTER_LIMB_THUMB_ROOT + 6, // WALLMASTER_LIMB_THUMB_PROXIMAL + 7, // WALLMASTER_LIMB_THUMB_DISTAL_ROOT + -1, // WALLMASTER_LIMB_THUMB_MIDDLE + 8, // WALLMASTER_LIMB_THUMB_DISTAL +}; + void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnFloormas* this = THIS; @@ -1187,6 +1209,8 @@ void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } } +static Color_RGBA8 D_808D3958 = { 0, 255, 0, 0 }; + void EnFloormas_Draw(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 088b504c68..268ea96268 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -52,6 +52,18 @@ typedef enum { /* 2 */ ENFSN_CUTSCENESTATE_PLAYING } EnFsnCutsceneState; +ActorInit En_Fsn_InitVars = { + ACTOR_EN_FSN, + ACTORCAT_NPC, + FLAGS, + OBJECT_FSN, + sizeof(EnFsn), + (ActorFunc)EnFsn_Init, + (ActorFunc)EnFsn_Destroy, + (ActorFunc)EnFsn_Update, + (ActorFunc)EnFsn_Draw, +}; + typedef enum { /* 0 */ FSN_ANIM_IDLE, /* 1 */ FSN_ANIM_SCRATCH_BACK, @@ -69,32 +81,20 @@ typedef enum { /* 13 */ FSN_ANIM_MAX } FsnAnimation; -ActorInit En_Fsn_InitVars = { - ACTOR_EN_FSN, - ACTORCAT_NPC, - FLAGS, - OBJECT_FSN, - sizeof(EnFsn), - (ActorFunc)EnFsn_Init, - (ActorFunc)EnFsn_Destroy, - (ActorFunc)EnFsn_Update, - (ActorFunc)EnFsn_Draw, -}; - -static AnimationInfoS sAnimationInfo[] = { - { &gFsnIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnScratchBackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnTurnAroundAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandsOnCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandsOnCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnHandOnFaceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandOnFaceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnLeanForwardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnLeanForwardLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnSlamCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnSlamCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnMakeOfferAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, +static AnimationInfoS sAnimationInfo[FSN_ANIM_MAX] = { + { &gFsnIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_IDLE + { &gFsnScratchBackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_SCRATCH_BACK + { &gFsnTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_TURN_AROUND_FORWARD + { &gFsnTurnAroundAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_TURN_AROUND_REVERSE + { &gFsnHandsOnCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_HANDS_ON_COUNTER_START + { &gFsnHandsOnCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_HANDS_ON_COUNTER_LOOP + { &gFsnHandOnFaceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_HAND_ON_FACE_START + { &gFsnHandOnFaceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_HAND_ON_FACE_LOOP + { &gFsnLeanForwardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_LEAN_FORWARD_START + { &gFsnLeanForwardLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_LEAN_FORWARD_LOOP + { &gFsnSlamCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_SLAM_COUNTER_START + { &gFsnSlamCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_SLAM_COUNTER_LOOP + { &gFsnMakeOfferAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_MAKE_OFFER }; static ColliderCylinderInit sCylinderInit = { @@ -745,8 +745,9 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { if (this->animIndex == FSN_ANIM_HANDS_ON_COUNTER_START) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (curFrame == frameCount) { + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + + if (curFrame == endFrame) { this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -781,7 +782,7 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { void EnFsn_Haggle(EnFsn* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->flags & ENFSN_ANGRY) { this->flags &= ~ENFSN_ANGRY; @@ -801,7 +802,7 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { if (this->animIndex == FSN_ANIM_MAKE_OFFER) { - if (curFrame == frameCount) { + if (curFrame == endFrame) { this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index c0f3e1cc50..4881e38a7f 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -9,7 +9,6 @@ #include "overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h" #include "overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#include "objects/object_mu/object_mu.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) @@ -73,13 +72,31 @@ static Vec3f D_80964B0C = { 0.0f, 60.0f, -8.0f }; static Vec3f D_80964B18 = { 0.0f, 55.0f, 12.0f }; static Vec3f D_80964B24 = { 0.0f, 60.0f, 0.0f }; -static AnimationInfo sAnimationInfo[] = { +typedef enum { + /* 0 */ HONEY_DARLING_ANIM_IDLE, + /* 1 */ HONEY_DARLING_ANIM_CUP_CHEEKS, + /* 2 */ HONEY_DARLING_ANIM_HUG, + /* 3 */ HONEY_DARLING_ANIM_GAME_DANCE, + /* 4 */ HONEY_DARLING_ANIM_HOLD_HANDS_MORPH, + /* 5 */ HONEY_DARLING_ANIM_HOLD_HANDS, + /* 6 */ HONEY_DARLING_ANIM_SURPRISE, + /* 7 */ HONEY_DARLING_ANIM_MAX +} HoneyAndDarlingAnimation; + +static AnimationInfo sAnimationInfo[HONEY_DARLING_ANIM_MAX] = { + // HONEY_DARLING_ANIM_IDLE { &gHoneyAndDarlingIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_CUP_CHEEKS { &gHoneyAndDarlingCupCheeksLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_HUG { &gHoneyAndDarlingHugLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_GAME_DANCE { &gHoneyAndDarlingGameDanceLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + // HONEY_DARLING_ANIM_HOLD_HANDS_MORPH { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + // HONEY_DARLING_ANIM_HOLD_HANDS { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + // HONEY_DARLING_ANIM_SURPRISE { &gHoneyAndDarlingSurpiseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, }; @@ -371,7 +388,7 @@ void func_8096209C(EnFu* this, PlayState* play) { } void func_809622FC(EnFu* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_CUP_CHEEKS); this->actionFunc = func_80962340; } @@ -538,7 +555,7 @@ void func_80962660(EnFu* this, PlayState* play) { Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; this->unk_53C = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_GAME_DANCE); Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { @@ -617,6 +634,9 @@ void func_809628D0(EnFu* this, PlayState* play) { } } break; + + default: + break; } if (talkState != TEXT_STATE_3) { @@ -760,6 +780,9 @@ void func_80962F4C(EnFu* this, PlayState* play) { case 2: play->unk_1887D = 30; break; + + default: + break; } if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) { @@ -931,6 +954,9 @@ void func_80963630(EnFu* this, PlayState* play) { case 3: SET_WEEKEVENTREG(WEEKEVENTREG_22_40); break; + + default: + break; } } player->stateFlags1 &= ~PLAYER_STATE1_20; @@ -1112,6 +1138,9 @@ void func_809639D0(EnFu* this, PlayState* play) { this->unk_552 = 0x286D; } break; + + default: + break; } } @@ -1136,6 +1165,9 @@ void func_80963DE4(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x287B, &this->actor); this->unk_552 = 0x287B; break; + + default: + break; } } @@ -1215,7 +1247,7 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x2842: case 0x2844: case 0x2848: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_CUP_CHEEKS); break; case 0x2840: @@ -1241,21 +1273,24 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x286B: case 0x286D: case 0x2871: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HOLD_HANDS_MORPH); break; case 0x2860: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HOLD_HANDS); break; case 0x285F: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_SURPRISE); break; case 0x287E: case 0x2880: case 0x2883: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HUG); + break; + + default: break; } } @@ -1348,13 +1383,13 @@ void EnFu_Update(Actor* thisx, PlayState* play) { s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFu* this = THIS; - if (limbIndex == 9) { + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { Matrix_Translate(1600.0f, 300.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->unk_524[1], MTXMODE_APPLY); Matrix_RotateZS(this->unk_524[0], MTXMODE_APPLY); Matrix_RotateYS(this->unk_524[2], MTXMODE_APPLY); Matrix_Translate(-1600.0f, -300.0f, 0.0f, MTXMODE_APPLY); - } else if (limbIndex == 20) { + } else if (limbIndex == HONEY_AND_DARLING_LIMB_WOMAN_HEAD) { Matrix_Translate(1800.0f, 200.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->unk_52A[1], MTXMODE_APPLY); Matrix_RotateZS(this->unk_52A[0], MTXMODE_APPLY); @@ -1369,9 +1404,9 @@ void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, static Vec3f D_80964C34 = { -3500.0f, 0.0f, 0.0f }; EnFu* this = THIS; - if (limbIndex == 9) { + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { Matrix_MultVec3f(&D_80964C28, &this->unk_508); - } else if (limbIndex == 20) { + } else if (limbIndex == HONEY_AND_DARLING_LIMB_WOMAN_HEAD) { Matrix_MultVec3f(&D_80964C34, &this->unk_514); } } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index 44f769a8c4..ecd4878c21 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -2,6 +2,7 @@ #define Z_EN_FU_H #include "global.h" +#include "objects/object_mu/object_mu.h" #include "overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h" struct EnFu; @@ -27,8 +28,8 @@ typedef struct EnFu { /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnFuActionFunc actionFunc; - /* 0x1D8 */ Vec3s jointTable[21]; - /* 0x256 */ Vec3s morphTable[21]; + /* 0x1D8 */ Vec3s jointTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x256 */ Vec3s morphTable[HONEY_AND_DARLING_LIMB_MAX]; /* 0x2D4 */ BgFuMizu* unk_2D4; /* 0x2D8 */ EnFuUnkStruct unk_2D8[10]; /* 0x508 */ Vec3f unk_508; diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c index 576e307b2c..8aa3909f74 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c @@ -138,9 +138,9 @@ s32 func_80ACF8B8(EnFuKago* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); return true; - } else { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); return false; } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 3ffaa16350..e6a80e00bb 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -5,7 +5,6 @@ */ #include "z_en_minifrog.h" -#include "objects/object_fr/object_fr.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -66,11 +65,15 @@ static TexturePtr D_808A4D74[] = { object_fr_Tex_005BA0, }; -static u16 isFrogReturnedFlags[] = { - 0, WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, WEEKEVENTREG_33_02, +static u16 sIsFrogReturnedFlags[] = { + 0, // FROG_YELLOW + WEEKEVENTREG_32_40, // FROG_CYAN + WEEKEVENTREG_32_80, // FROG_PINK + WEEKEVENTREG_33_01, // FROG_BLUE + WEEKEVENTREG_33_02, // FROG_WHITE }; -static s32 isInitialized = false; +static s32 sIsInitialized = false; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -800, ICHAIN_STOP), @@ -83,32 +86,32 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, &object_fr_Anim_001534, this->jointTable, - this->morphTable, 24); + this->morphTable, OBJECT_FR_LIMB_MAX); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (!isInitialized) { + if (!sIsInitialized) { for (i = 0; i < ARRAY_COUNT(D_808A4D74); i++) { D_808A4D74[i] = Lib_SegmentedToVirtual(D_808A4D74[i]); } - isInitialized = true; + sIsInitialized = true; } this->frogIndex = (this->actor.params & 0xF); if (this->frogIndex >= 5) { - this->frogIndex = MINIFROG_YELLOW; + this->frogIndex = FROG_YELLOW; } this->actor.speed = 0.0f; this->actionFunc = EnMinifrog_Idle; - this->jumpState = MINIFROG_STATE_GROUND; + this->jumpState = FROG_STATE_GROUND; this->flags = 0; this->timer = 0; if (1) {} - if (!EN_MINIFROG_IS_RETURNED(&this->actor)) { - if ((this->frogIndex == MINIFROG_YELLOW) || CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { + if (!EN_FROG_IS_RETURNED(&this->actor)) { + if ((this->frogIndex == FROG_YELLOW) || CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { Actor_Kill(&this->actor); return; } @@ -118,7 +121,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->actor.textId = 0xD81; this->actor.colChkInfo.mass = 30; } else { // Frogs in mountain village - if (this->frogIndex == MINIFROG_YELLOW) { + if (this->frogIndex == FROG_YELLOW) { this->actor.textId = 0; this->actionFunc = EnMinifrog_SetupYellowFrogDialog; @@ -133,7 +136,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; // Frog has been returned - if (CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { + if (CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { this->actionFunc = EnMinifrog_SetupNextFrogInit; } else { this->actor.draw = NULL; @@ -167,8 +170,8 @@ EnMinifrog* EnMinifrog_GetFrog(PlayState* play) { } void EnMinifrog_SetJumpState(EnMinifrog* this) { - if (this->jumpState == MINIFROG_STATE_GROUND) { - this->jumpState = MINIFROG_STATE_JUMP; + if (this->jumpState == FROG_STATE_GROUND) { + this->jumpState = FROG_STATE_JUMP; Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, 7.0f, ANIMMODE_ONCE, -5.0f); } } @@ -185,21 +188,25 @@ void EnMinifrog_JumpTimer(EnMinifrog* this) { void EnMinifrog_Jump(EnMinifrog* this) { SkelAnime_Update(&this->skelAnime); switch (this->jumpState) { - case MINIFROG_STATE_JUMP: + case FROG_STATE_JUMP: if (Animation_OnFrame(&this->skelAnime, 4.0f)) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 6.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); - this->jumpState = MINIFROG_STATE_AIR; + this->jumpState = FROG_STATE_AIR; } break; - case MINIFROG_STATE_AIR: + + case FROG_STATE_AIR: if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->jumpState = MINIFROG_STATE_GROUND; + this->jumpState = FROG_STATE_GROUND; Animation_MorphToLoop(&this->skelAnime, &object_fr_Anim_001534, -2.5f); SkelAnime_Update(&this->skelAnime); } break; + + default: + break; } } @@ -219,7 +226,7 @@ static Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { Vec3f pos; Vec3f vec5; - Vec3f vel; + Vec3f velocity; Vec3f accel; s16 yaw; s16 pitch; @@ -233,16 +240,16 @@ void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { vec5.z = this->actor.world.pos.z - (5.0f * Math_CosS(yaw) * Math_CosS(pitch)); for (i = 0; i < 5; i++) { - vel.x = Rand_CenteredFloat(4.0f); - vel.y = Rand_CenteredFloat(4.0f); - vel.z = Rand_CenteredFloat(4.0f); - accel.x = -vel.x * 0.1f; - accel.y = -vel.y * 0.1f; - accel.z = -vel.z * 0.1f; - pos.x = vec5.x + vel.x; - pos.y = vec5.y + vel.y; - pos.z = vec5.z + vel.z; - func_800B0F80(play, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); + velocity.x = Rand_CenteredFloat(4.0f); + velocity.y = Rand_CenteredFloat(4.0f); + velocity.z = Rand_CenteredFloat(4.0f); + accel.x = -velocity.x * 0.1f; + accel.y = -velocity.y * 0.1f; + accel.z = -velocity.z * 0.1f; + pos.x = vec5.x + velocity.x; + pos.y = vec5.y + velocity.y; + pos.z = vec5.z + velocity.z; + func_800B0F80(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); } } @@ -269,7 +276,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { Message_ContinueTextbox(play, 0xD86); } - SET_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex]); + SET_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex]); break; case 0xD85: @@ -366,20 +373,25 @@ void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, PlayState* play) { void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { EnMinifrog_CheckChoirSuccess(this, play); - return; // necessary to match - } else if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + return; + } + + if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { CutsceneManager_Start(CS_ID_GLOBAL_TALK, NULL); EnMinifrog_CheckChoirSuccess(this, play); - return; // necessary to match - } else if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->actor.csId)) { + return; + } + + if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->actor.csId)) { CutsceneManager_Stop(this->actor.csId); CutsceneManager_Queue(CS_ID_GLOBAL_TALK); - return; // necessary to match - } else { - CutsceneManager_Queue(CS_ID_GLOBAL_TALK); + return; } + + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } void EnMinifrog_NextFrogMissing(EnMinifrog* this, PlayState* play) { @@ -398,8 +410,8 @@ void EnMinifrog_NextFrogReturned(EnMinifrog* this, PlayState* play) { this->timer--; } else { this->actionFunc = EnMinifrog_ContinueChoirCutscene; - this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | - 0x2 << MINIFROG_WHITE); + this->flags &= ~((0x2 << FROG_YELLOW) | (0x2 << FROG_CYAN) | (0x2 << FROG_PINK) | (0x2 << FROG_BLUE) | + (0x2 << FROG_WHITE)); play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } } @@ -409,11 +421,11 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); frogIndex = func_801A39F8(); - if (frogIndex != MINIFROG_INVALID) { - if (frogIndex == MINIFROG_YELLOW) { + if (frogIndex != FROG_NONE) { + if (frogIndex == FROG_YELLOW) { EnMinifrog_SetJumpState(this); } else { - this->actor.home.rot.z = frogIndex; // This is strange to store the frog index in home z rotation + this->actor.home.rot.z = frogIndex; } if (!(this->flags & (0x2 << frogIndex))) { @@ -429,8 +441,8 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { this->actor.home.rot.y = Actor_WorldYawTowardActor(&this->actor, &this->frog->actor); func_801A1F88(); this->flags &= ~0x100; - this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | - 0x2 << MINIFROG_WHITE); + this->flags &= + ~(0x2 << FROG_YELLOW | 0x2 << FROG_CYAN | 0x2 << FROG_PINK | 0x2 << FROG_BLUE | 0x2 << FROG_WHITE); play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } else if (this->timer <= 0) { this->actionFunc = EnMinifrog_NextFrogReturned; @@ -493,10 +505,14 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { this->actionFunc = EnMinifrog_BeginChoirCutscene; play->msgCtx.msgLength = 0; break; + case 1: // No Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0xD7E); break; + + default: + break; } } break; @@ -510,16 +526,19 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; SET_WEEKEVENTREG(WEEKEVENTREG_34_01); break; + case 0xD78: case 0xD79: case 0xD7A: case 0xD7F: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0xD77: this->actionFunc = EnMinifrog_BeginChoirCutscene; play->msgCtx.msgLength = 0; break; + case 0xD7C: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_35_80)) { // Obtained Heart Piece Message_ContinueTextbox(play, 0xD7E); @@ -528,11 +547,13 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_35_80); } break; + case 0xD7D: Message_CloseTextbox(play); this->actionFunc = EnMinifrog_GetFrogHP; EnMinifrog_GetFrogHP(this, play); break; + case 0xD7B: case 0xD7E: default: @@ -543,6 +564,9 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { } } break; + + default: + break; } } @@ -592,11 +616,11 @@ void EnMinifrog_UpdateMissingFrog(Actor* thisx, PlayState* play) { } s32 EnMinifrog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 1) { + if (limbIndex == OBJECT_FR_LIMB_01) { pos->z -= 500.0f; } - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == OBJECT_FR_LIMB_07) || (limbIndex == OBJECT_FR_LIMB_08)) { *dList = NULL; } @@ -606,7 +630,7 @@ s32 EnMinifrog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMinifrog* this = THIS; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == OBJECT_FR_LIMB_07) || (limbIndex == OBJECT_FR_LIMB_08)) { OPEN_DISPS(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); @@ -616,13 +640,17 @@ void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 4) { + if (limbIndex == OBJECT_FR_LIMB_04) { Matrix_MultZero(&this->actor.focus.pos); } } -static Color_RGBA8 sEnMinifrogColor[] = { - { 200, 170, 0, 255 }, { 0, 170, 200, 255 }, { 210, 120, 100, 255 }, { 120, 130, 230, 255 }, { 190, 190, 190, 255 }, +static Color_RGBA8 sFrogEnvColors[] = { + { 200, 170, 0, 255 }, // FROG_YELLOW + { 0, 170, 200, 255 }, // FROG_CYAN + { 210, 120, 100, 255 }, // FROG_PINK + { 120, 130, 230, 255 }, // FROG_BLUE + { 190, 190, 190, 255 }, // FROG_WHITE }; void EnMinifrog_Draw(Actor* thisx, PlayState* play) { @@ -632,7 +660,7 @@ void EnMinifrog_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - envColor = &sEnMinifrogColor[this->frogIndex]; + envColor = &sFrogEnvColors[this->frogIndex]; gSPSegment(POLY_OPA_DISP++, 0x08, D_808A4D74[0]); gSPSegment(POLY_OPA_DISP++, 0x09, D_808A4D74[0]); gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, envColor->a); diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h index 3e321cc563..5f1fd80b53 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h @@ -2,33 +2,34 @@ #define Z_EN_MINIFROG_H #include "global.h" +#include "objects/object_fr/object_fr.h" struct EnMinifrog; typedef void (*EnMinifrogActionFunc)(struct EnMinifrog*, PlayState*); -#define EN_MINIFROG_IS_RETURNED(thisx) ((((thisx)->params) & 0xF0) >> 4) +#define EN_FROG_IS_RETURNED(thisx) ((((thisx)->params) & 0xF0) >> 4) typedef enum { - /* 0x00 */ MINIFROG_YELLOW, // Mountain Village - /* 0x01 */ MINIFROG_CYAN, // Woodfall Temple - /* 0x02 */ MINIFROG_PINK, // Great Bay Temple - /* 0x03 */ MINIFROG_BLUE, // Southern Swamp - /* 0x04 */ MINIFROG_WHITE, // Laundry Pool - /* 0xFF */ MINIFROG_INVALID = 0xFF // -1 -} MinifrogType; + /* 0x00 */ FROG_YELLOW, // Mountain Village + /* 0x01 */ FROG_CYAN, // Woodfall Temple + /* 0x02 */ FROG_PINK, // Great Bay Temple + /* 0x03 */ FROG_BLUE, // Southern Swamp + /* 0x04 */ FROG_WHITE, // Laundry Pool + /* 0xFF */ FROG_NONE = 0xFF // -1 +} FrogType; typedef enum { - /* 0 */ MINIFROG_STATE_JUMP, - /* 1 */ MINIFROG_STATE_AIR, - /* 2 */ MINIFROG_STATE_GROUND -} MinifrogJumpState; + /* 0 */ FROG_STATE_JUMP, + /* 1 */ FROG_STATE_AIR, + /* 2 */ FROG_STATE_GROUND +} FrogJumpState; typedef struct EnMinifrog { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[24]; - /* 0x218 */ Vec3s morphTable[24]; + /* 0x188 */ Vec3s jointTable[OBJECT_FR_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[OBJECT_FR_LIMB_MAX]; /* 0x2A8 */ EnMinifrogActionFunc actionFunc; /* 0x2AC */ struct EnMinifrog* frog; /* 0x2B0 */ s16 frogIndex; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index adee7503c0..7ebe763670 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -172,7 +172,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 10, ICHAIN_STOP), }; -static s32 isFrogReturnedFlags[] = { +static s32 sIsFrogReturnedFlags[] = { WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, @@ -192,7 +192,7 @@ void EnPametfrog_Init(Actor* thisx, PlayState* play) { this->params = CLAMP(this->actor.params, 1, 4); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - if (!CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->actor.params - 1])) { + if (!CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 4adec0d218..4a9dd7ae1b 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -10092,7 +10092,7 @@ 0x80A2D0FC:("ElfMsg3_Update",), 0x80A2D280:("EnFg_ChangeAnim",), 0x80A2D348:("func_80A2D348",), - 0x80A2D3D4:("func_80A2D3D4",), + 0x80A2D3D4:("EnFg_UpdateSkelAnime",), 0x80A2D400:("func_80A2D400",), 0x80A2D42C:("func_80A2D42C",), 0x80A2D4B8:("func_80A2D4B8",), @@ -13338,7 +13338,7 @@ 0x80B2815C:("func_80B2815C",), 0x80B2816C:("BgBotihasira_Update",), 0x80B28240:("BgBotihasira_Draw",), - 0x80B28370:("func_80B28370",), + 0x80B28370:("EnFish2_ChangeAnim",), 0x80B28478:("func_80B28478",), 0x80B28538:("EnFish2_Init",), 0x80B287B8:("EnFish2_Destroy",), @@ -16927,7 +16927,7 @@ 0x80C1B8A4:("func_80C1B8A4",), 0x80C1B8B4:("func_80C1B8B4",), 0x80C1B8F0:("func_80C1B8F0",), - 0x80C1B9D4:("func_80C1B9D4",), + 0x80C1B9D4:("EnFall2_HandleCutscene",), 0x80C1BAC8:("EnFall2_Update",), 0x80C1BAEC:("EnFall2_Draw",), 0x80C1BD90:("DmAl_ChangeAnim",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 7183aec295..6a991f1de3 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -13899,8 +13899,8 @@ 0x80B2B360:("D_80B2B360","UNK_TYPE1","",0x1), 0x80B2B370:("D_80B2B370","f32","",0x4), 0x80B2B380:("D_80B2B380","f32","",0x4), - 0x80B2B388:("D_80B2B388","UNK_TYPE1","",0x1), - 0x80B2B3A0:("D_80B2B3A0","UNK_TYPE1","",0x1), + 0x80B2B388:("sAnimations","UNK_TYPE1","",0x1), + 0x80B2B3A0:("sAnimationModes","UNK_TYPE1","",0x1), 0x80B2B3A8:("D_80B2B3A8","UNK_TYPE1","",0x1), 0x80B2B3C0:("D_80B2B3C0","f32","",0x4), 0x80B2B3C4:("D_80B2B3C4","f32","",0x4),