From dbb6410ba3a1b756a0ee073d3e1445db494b9f85 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 18 Nov 2023 00:49:23 +1100 Subject: [PATCH] Animation Cleanup: En_M* (#1496) * brackets * more M cleanup * small cleanup * PR Review --- src/code/z_player_lib.c | 10 ++-- src/overlays/actors/ovl_En_Bal/z_en_bal.c | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 3 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 2 +- .../actors/ovl_En_Dragon/z_en_dragon.c | 2 +- .../actors/ovl_En_Elfbub/z_en_elfbub.c | 1 + src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 4 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 13 +++-- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 3 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 8 +-- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 38 +++++++++---- src/overlays/actors/ovl_En_Mk/z_en_mk.h | 2 +- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 6 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 2 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 3 + src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 56 +++++++++++++------ src/overlays/actors/ovl_En_Mm3/z_en_mm3.h | 5 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 15 +++-- src/overlays/actors/ovl_En_Ms/z_en_ms.h | 5 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 36 ++++++------ .../actors/ovl_En_Mushi2/z_en_mushi2.c | 3 +- .../actors/ovl_En_Mushi2/z_en_mushi2.h | 5 +- src/overlays/actors/ovl_En_Muto/z_en_muto.c | 42 +++++++++----- src/overlays/actors/ovl_En_Muto/z_en_muto.h | 7 ++- src/overlays/actors/ovl_En_Pp/z_en_pp.c | 6 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 2 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 4 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 2 +- .../ovl_Obj_Fireshield/z_obj_fireshield.c | 2 +- .../actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c | 2 +- .../actors/ovl_player_actor/z_player.c | 9 +-- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 2 +- tools/disasm/functions.txt | 2 +- tools/disasm/variables.txt | 4 +- 35 files changed, 181 insertions(+), 129 deletions(-) diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 24b9907cef..1e4ee16726 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -358,9 +358,9 @@ s32 Player_GetCurMaskItemId(PlayState* play) { void func_80122F28(Player* player) { if ((player->actor.category == ACTORCAT_PLAYER) && - (!(player->stateFlags1 & (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_200000 | PLAYER_STATE1_800000 | - PLAYER_STATE1_20000000))) && - (!(player->stateFlags2 & PLAYER_STATE2_1))) { + !(player->stateFlags1 & (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_200000 | PLAYER_STATE1_800000 | + PLAYER_STATE1_20000000)) && + !(player->stateFlags2 & PLAYER_STATE2_1)) { if (player->doorType <= PLAYER_DOORTYPE_TALKING) { CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } else { @@ -2272,7 +2272,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** } } } else if ((player->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (player->actor.speed > 2.0f) && - (!(player->stateFlags1 & PLAYER_STATE1_8000000))) { + !(player->stateFlags1 & PLAYER_STATE1_8000000)) { rightHandDLists = &gPlayerRightHandClosedDLs[D_801F59E0]; sPlayerRightHandType = PLAYER_MODELTYPE_RH_CLOSED; } else { @@ -2562,7 +2562,7 @@ void func_8012669C(PlayState* play, Player* player, Vec3f* arg2, Vec3f* arg3) { if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (func_80126440(play, NULL, &player->meleeWeaponInfo[0], &sp3C, &sp30) && - (player->transformation != PLAYER_FORM_GORON) && (!(player->stateFlags1 & PLAYER_STATE1_400000))) { + (player->transformation != PLAYER_FORM_GORON) && !(player->stateFlags1 & PLAYER_STATE1_400000)) { EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip, &player->meleeWeaponInfo[0].base); } diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.c b/src/overlays/actors/ovl_En_Bal/z_en_bal.c index 7678a3ccdb..09eaa353a6 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.c +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.c @@ -573,7 +573,7 @@ void EnBal_GroundIdle(EnBal* this, PlayState* play) { } else { this->idleAnimStage++; } - } else if ((this->idleAnimStage == TINGLE_IDLESTAGE_WAIT) && (Animation_OnFrame(&this->skelAnime, 20.0f))) { + } else if ((this->idleAnimStage == TINGLE_IDLESTAGE_WAIT) && Animation_OnFrame(&this->skelAnime, 20.0f)) { this->forceEyesShut = true; } } diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 453dadccdb..219665701a 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -333,7 +333,8 @@ void EnBubble_Init(Actor* thisx, PlayState* play) { Collider_InitJntSph(play, &this->colliderSphere); Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit); - this->actor.hintId = 0x16; + //! @bug: hint Id not correctly migrated from OoT `NAVI_ENEMY_SHABOM` + this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA; this->bounceDirection.x = Rand_ZeroOne(); this->bounceDirection.y = Rand_ZeroOne(); this->bounceDirection.z = Rand_ZeroOne(); diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index bb603211a1..adf3639a77 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1085,7 +1085,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { if ((i != ARRAY_COUNT(this->colliderElements)) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || - (!(sphElement->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { + !(sphElement->info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { EnDekubaba_SpawnIceEffects(this, play); newHealth = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index 5ec892f13f..5bfcc29784 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -619,7 +619,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { } if (((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) || - (!(player->stateFlags2 & PLAYER_STATE2_80)) || ((this->collider.elements[0].info.bumperFlags & BUMP_HIT)) || + !(player->stateFlags2 & PLAYER_STATE2_80) || (this->collider.elements[0].info.bumperFlags & BUMP_HIT) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT) || (this->collider.elements[2].info.bumperFlags & BUMP_HIT)) { player->actor.parent = NULL; diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index 97b95435a1..1cc1f4bcfb 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -62,6 +62,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f); + //! @bug: hint Id not correctly migrated from OoT `NAVI_ENEMY_SHABOM` this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA; Actor_SetScale(&this->actor, 1.25f); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index c40b18e68f..4de7cf85bd 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -775,7 +775,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->colliderCylinder.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != DMG_EFF_IMMUNE) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || - (!(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { + !(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 12); this->invincibilityFrames = 12; EnIk_Thaw(this, play); diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 5b1da726b1..6fcc4a1aa4 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -86,7 +86,7 @@ static ColliderCylinderInit sCylinderInit = { { 18, 46, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit2 D_80AC00DC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static TexturePtr sEyeTextures[] = { gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, @@ -213,7 +213,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &D_80AC00DC); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index f048aec74f..447b704fac 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -423,6 +423,9 @@ void EnMag_Update(Actor* thisx, PlayState* play) { this->state = MAG_STATE_POST_DISPLAY; } break; + + default: + break; } // Appear fully immediately if called during fade-in states. @@ -676,7 +679,7 @@ void EnMag_DrawCharTexture(Gfx** gfxp, TexturePtr texture, s32 rectLeft, s32 rec * POLY_OPA_DISP, but is used by OVERLAY_DISP. */ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { - static u8 pressStartFontIndices[] = { + static u8 sPressStartFontIndices[] = { 0x19, 0x1B, 0x0E, 0x1C, 0x1C, 0x1C, 0x1D, 0x0A, 0x1B, 0x1D, }; // Indices into this->font.fontBuf static TexturePtr sAppearEffectMaskTextures[] = { @@ -910,8 +913,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, sTextAlpha); rectLeft = PRESS_START_LEFT + 1; - for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { - EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, + for (i = 0; i < ARRAY_COUNT(sPressStartFontIndices); i++) { + EnMag_DrawCharTexture(&gfx, font->fontBuf + sPressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, PRESS_START_TOP + 1); rectLeft += PRESS_START_CHAR_SPACING; @@ -925,8 +928,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { gDPSetPrimColor(gfx++, 0, 0, 255, 30, 30, sTextAlpha); rectLeft = PRESS_START_LEFT; - for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { - EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, + for (i = 0; i < ARRAY_COUNT(sPressStartFontIndices); i++) { + EnMag_DrawCharTexture(&gfx, font->fontBuf + sPressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, PRESS_START_TOP); rectLeft += PRESS_START_CHAR_SPACING; if (i == 4) { 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 9ea492dbb8..1197b33dd2 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -80,7 +80,7 @@ static InitChainEntry sInitChain[] = { void EnMinifrog_Init(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; - int i; + s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); @@ -107,6 +107,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->flags = 0; this->timer = 0; + //! FAKE: if (1) {} if (!EN_FROG_IS_RETURNED(&this->actor)) { diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 7684e85c8e..9cf7b0a4cd 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -429,12 +429,10 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { if (this->idleTimer == 0) { if (this->actor.xzDistToPlayer < 300.0f) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } else { - if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - } else { - this->actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x13); - } + this->actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x13); } this->idleTimer = 20; } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index d24396dc89..35e25e0e2a 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -55,22 +55,35 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -s32 func_809592E0(EnMk* this, s16 index) { - AnimationHeader* sAnimations[] = { - &gMarineResearcherIdleAnim, &gMarineResearcherHeadWaggleAnim, &gMarineResearcherYellAnim, - &gMarineResearcherShakeInFearAnim, &gMarineResearcherStrokeChinAnim, +typedef enum MarineResearcherAnimation { + /* -1 */ MARINE_RESEARCHER_ANIM_NONE = -1, + /* 0 */ MARINE_RESEARCHER_ANIM_IDLE, + /* 1 */ MARINE_RESEARCHER_ANIM_HEAD_WAGGLE, + /* 2 */ MARINE_RESEARCHER_ANIM_YELL, + /* 3 */ MARINE_RESEARCHER_ANIM_SHAKE_IN_FEAR, + /* 4 */ MARINE_RESEARCHER_ANIM_STROKE_CHIN, + /* 5 */ MARINE_RESEARCHER_ANIM_MAX +} MarineResearcherAnimation; + +s32 EnMk_ChangeAnim(EnMk* this, s16 animIndex) { + AnimationHeader* sAnimations[MARINE_RESEARCHER_ANIM_MAX] = { + &gMarineResearcherIdleAnim, // MARINE_RESEARCHER_ANIM_IDLE + &gMarineResearcherHeadWaggleAnim, // MARINE_RESEARCHER_ANIM_HEAD_WAGGLE + &gMarineResearcherYellAnim, // MARINE_RESEARCHER_ANIM_YELL + &gMarineResearcherShakeInFearAnim, // MARINE_RESEARCHER_ANIM_SHAKE_IN_FEAR + &gMarineResearcherStrokeChinAnim, // MARINE_RESEARCHER_ANIM_STROKE_CHIN }; - if (index == this->unk_27C) { + if (animIndex == this->animIndex) { return false; } - if ((index < 0) || (index >= 5)) { + if ((animIndex <= MARINE_RESEARCHER_ANIM_NONE) || (animIndex >= MARINE_RESEARCHER_ANIM_MAX)) { return false; } - Animation_PlayLoop(&this->skelAnime, sAnimations[index]); - this->unk_27C = index; + Animation_PlayLoop(&this->skelAnime, sAnimations[animIndex]); + this->animIndex = animIndex; return true; } @@ -85,8 +98,8 @@ void EnMk_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gMarineResearcherSkel, &gMarineResearcherIdleAnim, this->jointTable, this->morphTable, MARINE_RESEARCHER_LIMB_MAX); - this->unk_27C = -1; - func_809592E0(this, 0); + this->animIndex = MARINE_RESEARCHER_ANIM_NONE; + EnMk_ChangeAnim(this, MARINE_RESEARCHER_ANIM_IDLE); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -133,14 +146,15 @@ void func_8095954C(EnMk* this, PlayState* play) { case 3: case 4: case 5: - func_809592E0(this, play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1); + EnMk_ChangeAnim(this, + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1); break; default: break; } } else { - func_809592E0(this, 0); + EnMk_ChangeAnim(this, MARINE_RESEARCHER_ANIM_IDLE); } } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h index 9d32e93747..d41ad811ad 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h @@ -17,7 +17,7 @@ typedef struct EnMk { /* 0x270 */ Vec3s unk_270; /* 0x276 */ s16 csIdList[2]; /* 0x27A */ u16 unk_27A; - /* 0x27C */ s16 unk_27C; + /* 0x27C */ s16 animIndex; /* 0x280 */ EnMkActionFunc actionFunc; } EnMk; // size = 0x284 diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index d4cea0be1e..b7833218b7 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -168,9 +168,9 @@ void EnMkk_Init(Actor* thisx, PlayState* play) { this->actor.params &= 1; if (this->actor.params == 1) { - this->actor.hintId = 0x3C; + this->actor.hintId = TATL_HINT_ID_WHITE_BOE; } else { - this->actor.hintId = 0x2C; + this->actor.hintId = TATL_HINT_ID_BLACK_BOE; } if ((paramsFF00 == 0) || (paramsFF00 == 255)) { @@ -279,7 +279,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { if (sp20) { this->unk_14B &= ~2; func_80A4E190(this); - } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & PLAYER_STATE3_100)) && + } else if ((this->unk_149 == 0) && !(player->stateFlags3 & PLAYER_STATE3_100) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && Actor_IsFacingPlayer(&this->actor, 0x1800) && (this->actor.xzDistToPlayer < 120.0f) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index e7d98d77ae..b4987c6635 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -87,7 +87,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) { func_80965BBC(this); return; } - if (this->actor.csId >= 0) { + if (this->actor.csId > CS_ID_NONE) { action = func_80965D3C; } else { action = func_80965DB4; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index bb8da5efef..0985ca8189 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -57,6 +57,9 @@ void EnMm2_Reading(EnMm2* this, PlayState* play) { case TEXT_STATE_CLOSING: this->actionFunc = EnMm2_WaitForRead; break; + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 42790116e0..e2ba87f786 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -5,7 +5,6 @@ */ #include "z_en_mm3.h" -#include "objects/object_mm/object_mm.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) @@ -63,15 +62,27 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfo sAnimationInfo[] = { - { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, - { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, - { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, - { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, - { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, - { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, - { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, - { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f }, +typedef enum EnMm3Animation { + /* 0 */ ENMM3_ANIM_0, + /* 1 */ ENMM3_ANIM_1, + /* 2 */ ENMM3_ANIM_2, + /* 3 */ ENMM3_ANIM_3, + /* 4 */ ENMM3_ANIM_4, + /* 5 */ ENMM3_ANIM_5, + /* 6 */ ENMM3_ANIM_6, + /* 7 */ ENMM3_ANIM_7, + /* 8 */ ENMM3_ANIM_MAX +} EnMm3Animation; + +static AnimationInfo sAnimationInfo[ENMM3_ANIM_MAX] = { + { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_0 + { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, // ENMM3_ANIM_1 + { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_2 + { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, // ENMM3_ANIM_3 + { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_4 + { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, // ENMM3_ANIM_5 + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, // ENMM3_ANIM_6 + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f }, // ENMM3_ANIM_7 }; #include "overlays/ovl_En_Mm3/ovl_En_Mm3.c" @@ -86,7 +97,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, - this->morphTable, 16); + this->morphTable, OBJECT_MM_LIMB_MAX); Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0), 0.0f, ANIMMODE_ONCE, 0.0f); Collider_InitCylinder(play, &this->collider); @@ -123,7 +134,7 @@ s32 func_80A6F22C(EnMm3* this) { void func_80A6F270(EnMm3* this) { this->unk_1DC = 1; this->unk_2B0 &= ~1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_5); this->actionFunc = func_80A6F2C8; } @@ -192,6 +203,9 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); } break; + + default: + break; } } } @@ -215,7 +229,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { } this->unk_1DC = 0; this->unk_2B0 |= 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_7); break; case 0x278B: @@ -298,6 +312,9 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { Message_StartTextbox(play, 0x279A, &this->actor); this->unk_2B4 = 0x279A; break; + + default: + break; } } else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) { this->unk_2AC--; @@ -357,10 +374,13 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { } } break; + + default: + break; } - if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + if ((this->skelAnime.mode == ANIMMODE_ONCE) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_2); } if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && @@ -541,10 +561,10 @@ void EnMm3_Update(Actor* thisx, PlayState* play) { s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMm3* this = THIS; - if (limbIndex == 8) { + if (limbIndex == OBJECT_MM_LIMB_08) { rot->x += this->unk_2A6.y; rot->y -= this->unk_2A6.x; - } else if (limbIndex == 15) { + } else if (limbIndex == OBJECT_MM_LIMB_0F) { rot->x += this->unk_2A0.y; rot->z += this->unk_2A0.x; if ((this->unk_2B0 & 2) && ((play->gameplayFrames % 3) == 0)) { @@ -557,7 +577,7 @@ s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnMm3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMm3* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_MM_LIMB_0F) { Matrix_MultVec3f(&D_80A704F0, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h index e6b512723a..42528fdf4d 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h @@ -2,6 +2,7 @@ #define Z_EN_MM3_H #include "global.h" +#include "objects/object_mm/object_mm.h" struct EnMm3; @@ -19,8 +20,8 @@ typedef struct EnMm3 { /* 0x1D4 */ EnMm3ActionFunc actionFunc; /* 0x1D8 */ UNK_TYPE1 unk1D8[4]; /* 0x1DC */ s32 unk_1DC; - /* 0x1E0 */ Vec3s jointTable[16]; - /* 0x240 */ Vec3s morphTable[16]; + /* 0x1E0 */ Vec3s jointTable[OBJECT_MM_LIMB_MAX]; + /* 0x240 */ Vec3s morphTable[OBJECT_MM_LIMB_MAX]; /* 0x2A0 */ Vec3s unk_2A0; /* 0x2A6 */ Vec3s unk_2A6; /* 0x2AC */ s16 unk_2AC; diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 6afcfc5b52..7f270b348e 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -5,7 +5,6 @@ */ #include "z_en_ms.h" -#include "objects/object_ms/object_ms.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) @@ -62,7 +61,7 @@ void EnMs_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, - this->morphTable, 9); + this->morphTable, BEAN_SALESMAN_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); @@ -84,9 +83,9 @@ void EnMs_Wait(EnMs* this, PlayState* play) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (gSaveContext.save.saveInfo.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { - this->actor.textId = 0x92E; // "[...] You're the first customer [...]" + this->actor.textId = 0x92E; } else { - this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" + this->actor.textId = 0x932; } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -120,10 +119,10 @@ void EnMs_Talk(EnMs* this, PlayState* play) { Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 10) { Audio_PlaySfx(NA_SE_SY_ERROR); - Message_ContinueTextbox(play, 0x935); // "[...] You don't have enough Rupees." + Message_ContinueTextbox(play, 0x935); } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { Audio_PlaySfx(NA_SE_SY_ERROR); - Message_ContinueTextbox(play, 0x937); // "[...] You can't carry anymore." + Message_ContinueTextbox(play, 0x937); } else { Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); @@ -135,7 +134,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { case 1: // no default: Audio_PlaySfx_MessageCancel(); - Message_ContinueTextbox(play, 0x934); // "[...] Well, if your mood changes [...]" + Message_ContinueTextbox(play, 0x934); break; } } @@ -159,7 +158,7 @@ void EnMs_Sell(EnMs* this, PlayState* play) { void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - Message_ContinueTextbox(play, 0x936); // "You can plant 'em whenever you want [...]" + Message_ContinueTextbox(play, 0x936); this->actionFunc = EnMs_Talk; } else { Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index aa46b820d3..7081ea4f66 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -2,6 +2,7 @@ #define Z_EN_MS_H #include "global.h" +#include "objects/object_ms/object_ms.h" struct EnMs; @@ -10,8 +11,8 @@ typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*); typedef struct EnMs { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[9]; - /* 0x1BE */ Vec3s morphTable[9]; + /* 0x188 */ Vec3s jointTable[BEAN_SALESMAN_LIMB_MAX]; + /* 0x1BE */ Vec3s morphTable[BEAN_SALESMAN_LIMB_MAX]; /* 0x1F4 */ EnMsActionFunc actionFunc; /* 0x1F8 */ ColliderCylinder collider; } EnMs; // size = 0x244 diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index db34633459..fa8b21cc29 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -154,11 +154,11 @@ s32 EnMttag_GetCurrentCheckpoint(Actor* actor, PlayState* play, s32* upcomingChe // Iterates through all possible checkpoints that are associated with this sceneExitIndex. do { - if ((Math3D_PointDistToLine2D( + if (Math3D_PointDistToLine2D( actor->world.pos.x, actor->world.pos.z, (&sCheckpointPositions[checkpointIterator])[-1].x, (&sCheckpointPositions[checkpointIterator])[-1].z, (&sCheckpointPositions[checkpointIterator])[1].x, (&sCheckpointPositions[checkpointIterator])[1].z, &perpendicularPointX, &perpendicularPointZ, - &lineLenSq)) && + &lineLenSq) && (!hasSetCurrentCheckpointOnce || ((curentCheckpoint + 1) == checkpointIterator) || (lineLenSq < minLineLengthSq))) { minLineLengthSq = lineLenSq; @@ -313,23 +313,19 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { EnMttag_ShowFalseStartMessage(this, play); SET_EVENTINF(EVENTINF_13); - } else { - if (DECR(this->timer) == 60) { - Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; - SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); - play->envCtx.timeSeqState = TIMESEQ_REQUEST; - player->stateFlags1 &= ~PLAYER_STATE1_20; - } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { - this->timer = 0; - SET_EVENTINF(EVENTINF_10); - this->actionFunc = EnMttag_Race; - } - } - } else { - if (EnMttag_AreFourRaceGoronsPresent(this, play)) { - this->raceInitialized = true; + } else if (DECR(this->timer) == 60) { + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); + play->envCtx.timeSeqState = TIMESEQ_REQUEST; + player->stateFlags1 &= ~PLAYER_STATE1_20; + } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { + this->timer = 0; + SET_EVENTINF(EVENTINF_10); + this->actionFunc = EnMttag_Race; } + } else if (EnMttag_AreFourRaceGoronsPresent(this, play)) { + this->raceInitialized = true; } } @@ -341,7 +337,7 @@ s32 EnMttag_IsAnyRaceGoronOverFinishLine(EnMttag* this) { s32 i; for (i = 0; i < ARRAY_COUNT(this->raceGorons); i++) { - if ((EnMttag_IsInFinishLine(&this->raceGorons[i]->actor.world.pos)) && + if (EnMttag_IsInFinishLine(&this->raceGorons[i]->actor.world.pos) && (this->raceGorons[i]->actor.update != NULL)) { isAnyRaceGoronOverFinishLine = true; break; @@ -417,7 +413,7 @@ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) { void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (((talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) || talkState == TEXT_STATE_CLOSING)) { + if (((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) || (talkState == TEXT_STATE_CLOSING)) { if (this->shouldRestartRace) { play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index a394093939..d62113c85f 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -6,7 +6,6 @@ #include "overlays/actors/ovl_Obj_Bean/z_obj_bean.h" #include "z_en_mushi2.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -755,7 +754,7 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80A68F24(this); SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable, - this->morphTable, 24); + this->morphTable, BUG_LIMB_MAX); Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h index e0c381133c..48cb62155a 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h @@ -2,6 +2,7 @@ #define Z_EN_MUSHI2_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" struct EnMushi2; @@ -25,8 +26,8 @@ typedef struct { typedef struct EnMushi2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[24]; - /* 0x218 */ Vec3s morphTable[24]; + /* 0x188 */ Vec3s jointTable[BUG_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[BUG_LIMB_MAX]; /* 0x2A8 */ ColliderJntSph collider; /* 0x2C8 */ ColliderJntSphElement colliderElements[1]; /* 0x308 */ EnMushi2ActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 37b3b7f51d..18f71e8b91 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -5,7 +5,6 @@ */ #include "z_en_muto.h" -#include "objects/object_toryo/object_toryo.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) @@ -16,13 +15,10 @@ void EnMuto_Destroy(Actor* thisx, PlayState* play); void EnMuto_Update(Actor* thisx, PlayState* play2); void EnMuto_Draw(Actor* thisx, PlayState* play); -void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex); -void EnMuto_SetHeadRotation(EnMuto* this); void EnMuto_SetupIdle(EnMuto* this); void EnMuto_Idle(EnMuto* this, PlayState* play); void EnMuto_SetupDialogue(EnMuto* this, PlayState* play); void EnMuto_InDialogue(EnMuto* this, PlayState* play); -s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); ActorInit En_Muto_InitVars = { /**/ ACTOR_EN_MUTO, @@ -64,7 +60,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable, - this->morphTable, 17); + this->morphTable, OBJECT_TORYO_LIMB_MAX); this->isInMayorsRoom = this->actor.params; if (!this->isInMayorsRoom) { @@ -99,13 +95,28 @@ void EnMuto_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) { - static AnimationHeader* sAnimations[] = { &object_toryo_Anim_000E50, &object_toryo_Anim_000E50 }; - static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_ONCE }; +typedef enum EnMutoAnimation { + /* -1 */ ENMUTO_ANIM_NONE = -1, + /* 0 */ ENMUTO_ANIM_0, + /* 1 */ ENMUTO_ANIM_1, + /* 2 */ ENMUTO_ANIM_MAX +} EnMutoAnimation; +static AnimationHeader* sAnimations[ENMUTO_ANIM_MAX] = { + &object_toryo_Anim_000E50, // ENMUTO_ANIM_0 + &object_toryo_Anim_000E50, // ENMUTO_ANIM_1 +}; + +static u8 sAnimationModes[ENMUTO_ANIM_MAX] = { + ANIMMODE_LOOP, // ENMUTO_ANIM_0 + ANIMMODE_ONCE, // ENMUTO_ANIM_1 +}; + +void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) { this->animIndex = animIndex; - this->frameIndex = Animation_GetLastFrame(&sAnimations[animIndex]->common); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameIndex, + this->animEndFrame = Animation_GetLastFrame(&sAnimations[animIndex]->common); + + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -4.0f); } @@ -144,7 +155,8 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) { } } - if (1) {} // Needed to match + //! FAKE: + if (1) {} if (!this->isInMayorsRoom && (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK)) { this->actor.textId = 0x2363; @@ -221,10 +233,10 @@ void EnMuto_InDialogue(EnMuto* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; } } else { - f32 frameIndex = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; this->yawTowardsTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->targetActor->world.pos); - if (this->frameIndex <= frameIndex) { + if (curFrame >= this->animEndFrame) { this->skelAnime.playSpeed = 0.0f; } } @@ -285,11 +297,11 @@ void EnMuto_Update(Actor* thisx, PlayState* play2) { s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMuto* this = THIS; - if (limbIndex == 1) { + if (limbIndex == OBJECT_TORYO_LIMB_01) { rot->x += this->waistRot.y; } - if (limbIndex == 15) { + if (limbIndex == OBJECT_TORYO_LIMB_0F) { rot->x += this->headRot.y; rot->z += this->headRot.x; } diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.h b/src/overlays/actors/ovl_En_Muto/z_en_muto.h index 6ac984c8db..ac6573bb65 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.h +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.h @@ -2,6 +2,7 @@ #define Z_EN_MUTO_H #include "global.h" +#include "objects/object_toryo/object_toryo.h" struct EnMuto; @@ -10,15 +11,15 @@ typedef void (*EnMutoActionFunc)(struct EnMuto*, PlayState*); typedef struct EnMuto { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[OBJECT_TORYO_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[OBJECT_TORYO_LIMB_MAX]; /* 0x254 */ EnMutoActionFunc actionFunc; /* 0x258 */ Vec3s headRot; /* 0x25E */ Vec3s headRotTarget; /* 0x262 */ Vec3s waistRot; /* 0x26A */ Vec3s waistRotTarget; /* 0x270 */ s16 unusedCounter; - /* 0x274 */ f32 frameIndex; + /* 0x274 */ f32 animEndFrame; /* 0x278 */ s16 isInDialogue; /* 0x27A */ s16 textIdIndex; /* 0x27C */ s16 yawTowardsTarget; diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index 95389ccc59..7f991b86f3 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -272,7 +272,7 @@ void EnPp_Init(Actor* thisx, PlayState* play) { this->bodyCollider.elements[0].dim.scale = 1.0f; if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { - this->actor.hintId = 0x25; + this->actor.hintId = TATL_HINT_ID_HIPLOOP; this->maskColliderElements[0].info.toucherFlags &= ~TOUCH_ON; this->maskColliderElements[0].info.bumperFlags &= ~BUMP_ON; this->maskColliderElements[0].info.ocElemFlags &= ~OCELEM_ON; @@ -286,7 +286,7 @@ void EnPp_Init(Actor* thisx, PlayState* play) { this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; } else { - this->actor.hintId = 0x26; + this->actor.hintId = TATL_HINT_ID_MASKED_HIPLOOP; this->maskCollider.elements[0].dim.modelSphere.radius = 10; this->maskCollider.elements[0].dim.scale = 1.0f; this->maskCollider.elements[0].dim.modelSphere.center.x = 1000; @@ -647,7 +647,7 @@ void EnPp_Charge(EnPp* this, PlayState* play) { return; } - if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && (!(this->bodyCollider.base.atFlags & AT_BOUNCED))) { + if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && !(this->bodyCollider.base.atFlags & AT_BOUNCED)) { if ((this->maskCollider.base.atFlags & AT_HIT) || (this->bodyCollider.base.atFlags & AT_HIT)) { EnPp_SetupAttack(this); return; diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 6cd481a6e9..85a76a7e55 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -618,7 +618,7 @@ void EnSnowman_Melt(EnSnowman* this, PlayState* play) { Vec3f smokePos; this->work.timer--; - if ((this->work.timer >= 38) && (!(this->work.timer & 1))) { + if ((this->work.timer >= 38) && !(this->work.timer & 1)) { smokeVelocity.y = (this->work.timer - 38) * (1.0f / 12.0f); smokeVelocity.x = Rand_CenteredFloat(1.5f) * smokeVelocity.y; smokeVelocity.z = Rand_CenteredFloat(1.5f) * smokeVelocity.y; diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index fa9d864f06..fee13a23f2 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -102,8 +102,8 @@ void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play) { this->actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!(WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, - &waterbox)) || + if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterbox) || (ySurface <= this->actor.floorHeight)) { Actor_Kill(&this->actor); } else { diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 2a2fe2e62f..25b25e778d 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -528,7 +528,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) { if (this->unk_1B5 == 1) { if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); - if (this->actor.csId >= 0) { + if (this->actor.csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); } diff --git a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c index 99deb29178..3df716985a 100644 --- a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c +++ b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c @@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = { }; void func_80A4CA90(ObjFireshield* this) { - if (this->actor.csId >= 0) { + if (this->actor.csId > CS_ID_NONE) { this->actionFunc = func_80A4CABC; } else { this->actionFunc = func_80A4CC54; diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index f74956e46b..70797a67d3 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -113,7 +113,7 @@ void func_80C06CD8(ObjMuPict* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80C06B5C(this); - if (this->actor.csId >= 0) { + if (this->actor.csId > CS_ID_NONE) { CutsceneManager_Stop(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 3729cff36b..1b5ae4b03e 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -13924,7 +13924,7 @@ void Player_Action_5(Player* this, PlayState* play) { s32 var_v1; f32 var_fv1; - this->skelAnime.mode = 0; + this->skelAnime.mode = ANIMMODE_LOOP; PlayerAnimation_SetUpdateFunction(&this->skelAnime); this->skelAnime.animation = func_8082EFE4(this); @@ -16848,9 +16848,10 @@ void func_808525C4(PlayState* play, Player* this) { } void Player_Action_63(Player* this, PlayState* play) { - if ((this->unk_AA5 != PLAYER_UNKAA5_4) && ((PlayerAnimation_Update(play, &this->skelAnime) && - (this->skelAnime.animation == D_8085D17C[this->transformation])) || - ((this->skelAnime.mode == 0) && (this->av2.actionVar2 == 0)))) { + if ((this->unk_AA5 != PLAYER_UNKAA5_4) && + ((PlayerAnimation_Update(play, &this->skelAnime) && + (this->skelAnime.animation == D_8085D17C[this->transformation])) || + ((this->skelAnime.mode == ANIMMODE_LOOP) && (this->av2.actionVar2 == 0)))) { func_808525C4(play, this); if (!(this->actor.flags & ACTOR_FLAG_20000000) || (this->unk_A90->id == ACTOR_EN_ZOT)) { Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY); diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index cf019c6cf1..dd0c9e2638 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -130,7 +130,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { s16 rand; if ((this->actor != NULL) && (this->actor->update != NULL)) { - if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) { + if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && !(this->actor->colorFilterParams & 0xC000)) { Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos); this->life++; } else if (this->life == 9) { diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 0c64b8fdfd..8829bc6a0e 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -7688,7 +7688,7 @@ 0x80958CA8:("EnAttackNiw_Update",), 0x80958F6C:("EnAttackNiw_OverrideLimbDraw",), 0x8095909C:("EnAttackNiw_Draw",), - 0x809592E0:("func_809592E0",), + 0x809592E0:("EnMk_ChangeAnim",), 0x80959390:("EnMk_Init",), 0x809594F8:("EnMk_Destroy",), 0x80959524:("func_80959524",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index c24d84e72a..30490c0d6c 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -8643,7 +8643,7 @@ 0x8096E958:("sAppearEffectPrimGreenTargets","s16","[2]",0x4), 0x8096E95C:("sAppearEffectEnvRedTargets","s16","[2]",0x4), 0x8096E960:("sAppearEffectEnvBlueTargets","s16","[2]",0x4), - 0x8096E964:("pressStartFontIndices","u8","[10]",0x1), + 0x8096E964:("sPressStartFontIndices","u8","[10]",0x1), 0x8096E970:("sAppearEffectMaskTextures","TexturePtr","[6]",0x18), 0x8096E988:("sDisplayEffectMaskTextures","TexturePtr","[6]",0x18), 0x8096E9A0:("sEffectTextures","TexturePtr","[6]",0x18), @@ -12634,7 +12634,7 @@ 0x80ABDC50:("Bg_Hakugin_Elvpole_InitVars","UNK_TYPE1","",0x1), 0x80AC0090:("En_Ma4_InitVars","UNK_TYPE1","",0x1), 0x80AC00B0:("D_80AC00B0","UNK_TYPE1","",0x1), - 0x80AC00DC:("D_80AC00DC","UNK_TYPE1","",0x1), + 0x80AC00DC:("sColChkInfoInit","UNK_TYPE1","",0x1), 0x80AC00E8:("D_80AC00E8","UNK_TYPE1","",0x1), 0x80AC00FC:("D_80AC00FC","UNK_TYPE1","",0x1), 0x80AC010C:("D_80AC010C","UNK_TYPE1","",0x1),