From affb1eaf0f037858ab020e6b7fd8d105dff262f8 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 15 Aug 2023 00:08:45 +1000 Subject: [PATCH] Body Parts Docs (#1333) * body parts WIP * continue WIP * finish body parts * cleanup * missed one * Missed Enum * PR Review * next PR review * s32 cast * TRUNCF_BINANG * rm unnecessary shadow * PR Review * missed some * oops --- include/functions.h | 4 +- include/z64animation.h | 1 + include/z_en_hy_code.h | 47 ++- src/code/z_actor.c | 98 ++--- src/code/z_camera.c | 2 +- src/code/z_en_hy_code.c | 55 ++- src/code/z_sub_s.c | 2 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 58 ++- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 2 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 2 +- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 2 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 2 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 52 +-- src/overlays/actors/ovl_En_Am/z_en_am.h | 19 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 2 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 14 +- src/overlays/actors/ovl_En_Bat/z_en_bat.h | 9 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 90 ++-- src/overlays/actors/ovl_En_Bb/z_en_bb.h | 13 +- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 12 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 90 ++-- .../actors/ovl_En_Bbfall/z_en_bbfall.h | 5 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 63 +-- .../actors/ovl_En_Bigokuta/z_en_bigokuta.h | 19 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 51 +-- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h | 15 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 56 +-- .../actors/ovl_En_Bigslime/z_en_bigslime.h | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- .../actors/ovl_En_Cne_01/z_en_cne_01.c | 12 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 6 +- src/overlays/actors/ovl_En_Crow/z_en_crow.h | 10 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 14 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 10 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 46 ++- .../actors/ovl_En_Dekunuts/z_en_dekunuts.h | 14 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 75 ++-- .../actors/ovl_En_Dinofos/z_en_dinofos.h | 18 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 89 ++-- .../actors/ovl_En_Dodongo/z_en_dodongo.h | 15 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 10 +- src/overlays/actors/ovl_En_Egol/z_en_egol.h | 20 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 8 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 10 +- .../actors/ovl_En_Firefly/z_en_firefly.h | 9 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 66 +-- .../actors/ovl_En_Floormas/z_en_floormas.h | 17 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 12 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 3 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- .../ovl_En_Grasshopper/z_en_grasshopper.c | 390 ++++++++++-------- .../ovl_En_Grasshopper/z_en_grasshopper.h | 58 ++- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 26 +- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.h | 22 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 135 ++++-- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 32 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 19 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 23 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 39 +- src/overlays/actors/ovl_En_Kame/z_en_kame.h | 16 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 20 +- .../actors/ovl_En_Karebaba/z_en_karebaba.h | 10 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 8 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 2 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c | 41 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h | 10 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 53 ++- .../actors/ovl_En_Pametfrog/z_en_pametfrog.h | 19 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 69 +++- .../actors/ovl_En_Peehat/z_en_peehat.h | 24 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 46 +-- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 18 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 62 ++- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 16 +- src/overlays/actors/ovl_En_Pp/z_en_pp.c | 41 +- src/overlays/actors/ovl_En_Pp/z_en_pp.h | 37 +- src/overlays/actors/ovl_En_Pr/z_en_pr.c | 12 +- src/overlays/actors/ovl_En_Pr/z_en_pr.h | 18 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 26 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.h | 22 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 8 +- .../actors/ovl_En_Railgibud/z_en_railgibud.h | 23 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 10 +- src/overlays/actors/ovl_En_Rd/z_en_rd.h | 23 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 41 +- src/overlays/actors/ovl_En_Rr/z_en_rr.h | 36 +- src/overlays/actors/ovl_En_Ru/z_en_ru.c | 73 +++- src/overlays/actors/ovl_En_Ru/z_en_ru.h | 21 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 4 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.h | 13 +- src/overlays/actors/ovl_En_Shn/z_en_shn.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 26 +- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 22 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 33 +- src/overlays/actors/ovl_En_Slime/z_en_slime.h | 30 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 37 +- .../actors/ovl_En_Snowman/z_en_snowman.h | 15 +- src/overlays/actors/ovl_En_St/z_en_st.c | 80 ++-- src/overlays/actors/ovl_En_St/z_en_st.h | 22 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 63 +-- src/overlays/actors/ovl_En_Sw/z_en_sw.h | 24 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.c | 4 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.h | 10 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 2 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 14 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.h | 23 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 9 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 51 ++- .../actors/ovl_En_Thiefbird/z_en_thiefbird.h | 17 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 126 ++++-- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 17 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 15 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 53 ++- .../actors/ovl_En_Wallmas/z_en_wallmas.h | 17 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 36 +- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 16 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 23 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.h | 20 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 89 +++- src/overlays/actors/ovl_En_Zo/z_en_zo.h | 21 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 4 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 4 +- .../actors/ovl_player_actor/z_player.c | 12 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 4 +- .../z_eff_ss_fire_tail.c | 2 +- tools/disasm/variables.txt | 30 +- 132 files changed, 2563 insertions(+), 1243 deletions(-) diff --git a/include/functions.h b/include/functions.h index 6800039884..4664fee890 100644 --- a/include/functions.h +++ b/include/functions.h @@ -657,8 +657,8 @@ void func_800BE504(Actor* actor, ColliderCylinder* collider); void func_800BE568(Actor* actor, ColliderSphere* collider); void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex); s32 Actor_IsSmallChest(struct EnBox* chest); -void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type); -void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, f32 scale, f32 scaleRange); +void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s16 bodyPartsCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type); +void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s32 bodyPartsCount, s32 effectsPerBodyPart, f32 scale, f32 scaleRange); void ActorOverlayTable_FaultClient(void* arg0, void* arg1); uintptr_t ActorOverlayTable_FaultAddrConv(uintptr_t address, void* param); diff --git a/include/z64animation.h b/include/z64animation.h index 67c9d76414..25cbea1f25 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -12,6 +12,7 @@ struct SkelAnime; struct PlayerAnimationFrame; #define LIMB_DONE 0xFF +#define BODYPART_NONE -1 #define ANIM_FLAG_1 (1 << 0) #define ANIM_FLAG_UPDATE_Y (1 << 1) diff --git a/include/z_en_hy_code.h b/include/z_en_hy_code.h index 58a34151c5..192e9183c8 100644 --- a/include/z_en_hy_code.h +++ b/include/z_en_hy_code.h @@ -6,7 +6,27 @@ struct EnHy; -#define ENHY_LIMB_MAX 16 +//! @note: any actor that uses the EnHy system should +//! have a skeleton that aligns with the enum below. +typedef enum EnHyLimb { + /* 0x00 */ ENHY_LIMB_NONE, + /* 0x01 */ ENHY_LIMB_PELVIS, + /* 0x02 */ ENHY_LIMB_LEFT_THIGH, + /* 0x03 */ ENHY_LIMB_LEFT_SHIN, + /* 0x04 */ ENHY_LIMB_LEFT_FOOT, + /* 0x05 */ ENHY_LIMB_RIGHT_THIGH, + /* 0x06 */ ENHY_LIMB_RIGHT_SHIN, + /* 0x07 */ ENHY_LIMB_RIGHT_FOOT, + /* 0x08 */ ENHY_LIMB_TORSO, + /* 0x09 */ ENHY_LIMB_LEFT_UPPER_ARM, + /* 0x0A */ ENHY_LIMB_LEFT_FOREARM, + /* 0x0B */ ENHY_LIMB_LEFT_HAND, + /* 0x0C */ ENHY_LIMB_RIGHT_UPPER_ARM, + /* 0x0D */ ENHY_LIMB_RIGHT_FOREARM, + /* 0x0E */ ENHY_LIMB_RIGHT_HAND, + /* 0x0F */ ENHY_LIMB_HEAD, + /* 0x10 */ ENHY_LIMB_MAX +} EnHyLimb; //! TODO: Better animaion enum names when animations are documented typedef enum { @@ -36,6 +56,25 @@ typedef enum { typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); +typedef enum EnHyBodyPart { + /* 0 */ ENHY_BODYPART_0, + /* 1 */ ENHY_BODYPART_1, + /* 2 */ ENHY_BODYPART_2, + /* 3 */ ENHY_BODYPART_3, + /* 4 */ ENHY_BODYPART_4, + /* 5 */ ENHY_BODYPART_5, + /* 6 */ ENHY_BODYPART_6, + /* 7 */ ENHY_BODYPART_7, + /* 8 */ ENHY_BODYPART_8, + /* 9 */ ENHY_BODYPART_9, + /* 10 */ ENHY_BODYPART_10, + /* 11 */ ENHY_BODYPART_11, + /* 12 */ ENHY_BODYPART_12, + /* 13 */ ENHY_BODYPART_13, + /* 14 */ ENHY_BODYPART_14, + /* 15 */ ENHY_BODYPART_MAX +} EnHyBodyPart; + typedef struct EnHy { /* 0x000 */ Actor actor; /* 0x144 */ EnHyActionFunc actionFunc; @@ -65,14 +104,14 @@ typedef struct EnHy { /* 0x2E4 */ Vec3s prevTorsoRot; /* 0x2EA */ s16 fidgetTableY[ENHY_LIMB_MAX]; /* 0x30A */ s16 fidgetTableZ[ENHY_LIMB_MAX]; - /* 0x32C */ Vec3f bodyPartsPos[15]; + /* 0x32C */ Vec3f bodyPartsPos[ENHY_BODYPART_MAX]; /* 0x3E0 */ UNK_TYPE1 unk_3E0[0x6]; /* 0x3E6 */ s16 eyeTexIndex; /* 0x3E8 */ s16 blinkTimer; } EnHy; // size = 0x3EC -extern s8 gEnHyBodyParts[]; -extern s8 gEnHyParentBodyParts[]; +extern s8 gEnHyLimbToBodyParts[]; +extern s8 gEnHyParentShadowBodyParts[]; extern u8 gEnHyShadowSizes[]; s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ef1ca4b488..5debc583de 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4706,20 +4706,20 @@ TexturePtr sElectricSparkTextures[] = { }; /** - * Draw common damage effects applied to each limb provided in limbPos + * Draw common damage effects applied to each body part provided in bodyPartsPos */ -void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, +void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s16 bodyPartsCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type) { if (effectAlpha > 0.001f) { s32 twoTexScrollParam; - s16 limbIndex; + s16 bodyPartIndex; MtxF* currentMatrix; f32 alpha; f32 frozenScale; f32 lightOrbsScale; f32 electricSparksScale; f32 steamScale; - Vec3f* limbPosStart = limbPos; + Vec3f* bodyPartsPosStart = bodyPartsPos; u32 gameplayFrames = play->gameplayFrames; f32 effectAlphaScaled; @@ -4747,7 +4747,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 case ACTOR_DRAW_DMGEFF_FROZEN_SFX: frozenScale = ((KREG(19) * 0.01f) + 2.3f) * effectScale; steamScale = ((KREG(28) * 0.0001f) + 0.035f) * frozenSteamScale; - func_800BCC68(limbPos, play); + func_800BCC68(bodyPartsPos, play); // Setup to draw ice over frozen actor @@ -4759,11 +4759,11 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 effectAlphaScaled = effectAlpha * 255.0f; - // Apply and draw ice over each limb of frozen actor - for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { - alpha = limbIndex & 3; + // Apply and draw ice over each body part of frozen actor + for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { + alpha = bodyPartIndex & 3; alpha = effectAlphaScaled - (30.0f * alpha); - if (effectAlphaScaled < (30.0f * (limbIndex & 3))) { + if (effectAlphaScaled < (30.0f * (bodyPartIndex & 3))) { alpha = 0.0f; } if (alpha > 255.0f) { @@ -4772,14 +4772,14 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gDPSetEnvColor(POLY_XLU_DISP++, KREG(20) + 200, KREG(21) + 200, KREG(22) + 255, (u8)alpha); - Matrix_Translate(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW); + Matrix_Translate(bodyPartsPos->x, bodyPartsPos->y, bodyPartsPos->z, MTXMODE_NEW); Matrix_Scale(frozenScale, frozenScale, frozenScale, MTXMODE_APPLY); - if (limbIndex & 1) { + if (bodyPartIndex & 1) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); } - if (limbIndex & 2) { + if (bodyPartIndex & 2) { Matrix_RotateZF(M_PI, MTXMODE_APPLY); } @@ -4789,7 +4789,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); } - limbPos = limbPosStart; // reset limbPos + bodyPartsPos = bodyPartsPosStart; // reset bodyPartsPos // Setup to draw steam over frozen actor @@ -4804,14 +4804,14 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (u8)alpha); - // Apply and draw steam over each limb of frozen actor - for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { - twoTexScrollParam = ((limbIndex * 3) + gameplayFrames); + // Apply and draw steam over each body part of frozen actor + for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { + twoTexScrollParam = ((bodyPartIndex * 3) + gameplayFrames); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, twoTexScrollParam * 3, twoTexScrollParam * -12, 32, 64, 1, 0, 0, 32, 32)); - Matrix_Translate(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW); + Matrix_Translate(bodyPartsPos->x, bodyPartsPos->y, bodyPartsPos->z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(steamScale, steamScale, 1.0f, MTXMODE_APPLY); @@ -4838,11 +4838,11 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 effectAlphaScaled = effectAlpha * 255.0f; - // Apply and draw fire on every limb - for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { - alpha = limbIndex & 3; + // Apply and draw fire on every body part + for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { + alpha = bodyPartIndex & 3; alpha = effectAlphaScaled - 30.0f * alpha; - if (effectAlphaScaled < 30.0f * (limbIndex & 3)) { + if (effectAlphaScaled < 30.0f * (bodyPartIndex & 3)) { alpha = 0.0f; } if (alpha > 255.0f) { @@ -4856,12 +4856,12 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - ((limbIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128)); + ((bodyPartIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128)); Matrix_RotateYF(M_PI, MTXMODE_APPLY); - currentMatrix->mf[3][0] = limbPos->x; - currentMatrix->mf[3][1] = limbPos->y; - currentMatrix->mf[3][2] = limbPos->z; + currentMatrix->mf[3][0] = bodyPartsPos->x; + currentMatrix->mf[3][1] = bodyPartsPos->y; + currentMatrix->mf[3][2] = bodyPartsPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4898,12 +4898,12 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 Matrix_Put(&play->billboardMtxF); Matrix_Scale(lightOrbsScale, lightOrbsScale, 1.0f, MTXMODE_APPLY); - // Apply and draw a light orb over each limb of frozen actor - for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { + // Apply and draw a light orb over each body part of frozen actor + for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { Matrix_RotateZF(Rand_CenteredFloat(2 * M_PI), MTXMODE_APPLY); - currentMatrix->mf[3][0] = limbPos->x; - currentMatrix->mf[3][1] = limbPos->y; - currentMatrix->mf[3][2] = limbPos->z; + currentMatrix->mf[3][0] = bodyPartsPos->x; + currentMatrix->mf[3][1] = bodyPartsPos->y; + currentMatrix->mf[3][2] = bodyPartsPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4936,14 +4936,14 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 Matrix_Put(&play->billboardMtxF); Matrix_Scale(electricSparksScale, electricSparksScale, electricSparksScale, MTXMODE_APPLY); - // Every limb draws two electric sparks at random orientations - for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { + // Every body part draws two electric sparks at random orientations + for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { // first electric spark Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); - currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x; - currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y; - currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z; + currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x; + currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y; + currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4953,9 +4953,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 // second electric spark Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); - currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x; - currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y; - currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z; + currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x; + currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y; + currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4970,11 +4970,11 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 } } -void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, - f32 scale, f32 scaleRange) { - static Color_RGBA8 primColor = { 170, 255, 255, 255 }; - static Color_RGBA8 envColor = { 200, 200, 255, 255 }; - static Vec3f accel = { 0.0f, -1.0f, 0.0f }; +void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s32 bodyPartsCount, + s32 effectsPerBodyPart, f32 scale, f32 scaleRange) { + static Color_RGBA8 sPrimColor = { 170, 255, 255, 255 }; + static Color_RGBA8 sEnvColor = { 200, 200, 255, 255 }; + static Vec3f sAccel = { 0.0f, -1.0f, 0.0f }; s32 i; s32 pad; Vec3f velocity; @@ -4984,10 +4984,10 @@ void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 l SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < limbPosCount; i++) { - yaw = Actor_WorldYawTowardPoint(actor, limbPos); + for (i = 0; i < bodyPartsCount; i++) { + yaw = Actor_WorldYawTowardPoint(actor, bodyPartsPos); - for (j = 0; j < effectsPerLimb; j++) { + for (j = 0; j < effectsPerBodyPart; j++) { randomYaw = ((s32)Rand_Next() >> 0x13) + yaw; velocity.z = Rand_ZeroFloat(5.0f); @@ -4996,10 +4996,10 @@ void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 l velocity.y = Rand_ZeroFloat(4.0f) + 8.0f; velocity.z *= Math_CosS(randomYaw); - EffectSsEnIce_Spawn(play, limbPos, Rand_ZeroFloat(scaleRange) + scale, &velocity, &accel, &primColor, - &envColor, 30); + EffectSsEnIce_Spawn(play, bodyPartsPos, Rand_ZeroFloat(scaleRange) + scale, &velocity, &sAccel, &sPrimColor, + &sEnvColor, 30); } - limbPos++; + bodyPartsPos++; } } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3703eda0f0..95d2e36f92 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -481,7 +481,7 @@ s32 Camera_GetFocalActorPos(Vec3f* dst, Camera* camera) { Actor* focalActor = camera->focalActor; if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { - *dst = ((Player*)focalActor)->bodyPartsPos[0]; + *dst = ((Player*)focalActor)->bodyPartsPos[PLAYER_BODYPART_WAIST]; return dst; } else { Actor_GetWorldPosShapeRot(&focalPosRot, camera->focalActor); diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index b5992dec43..d59d31000e 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -35,11 +35,60 @@ static AnimationInfoS sAnimationInfo[] = { { &object_boj_Anim_005D9C, 1.0f, 0, -1, ANIMMODE_LOOP, -8 }, }; -s8 gEnHyBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2 }; +s8 gEnHyLimbToBodyParts[ENHY_LIMB_MAX] = { + BODYPART_NONE, // ENHY_LIMB_NONE + ENHY_BODYPART_1, // ENHY_LIMB_PELVIS + ENHY_BODYPART_12, // ENHY_LIMB_LEFT_THIGH + ENHY_BODYPART_13, // ENHY_LIMB_LEFT_SHIN + ENHY_BODYPART_14, // ENHY_LIMB_LEFT_FOOT + ENHY_BODYPART_9, // ENHY_LIMB_RIGHT_THIGH + ENHY_BODYPART_10, // ENHY_LIMB_RIGHT_SHIN + ENHY_BODYPART_11, // ENHY_LIMB_RIGHT_FOOT + ENHY_BODYPART_0, // ENHY_LIMB_TORSO + ENHY_BODYPART_6, // ENHY_LIMB_LEFT_UPPER_ARM + ENHY_BODYPART_7, // ENHY_LIMB_LEFT_FOREARM + ENHY_BODYPART_8, // ENHY_LIMB_LEFT_HAND + ENHY_BODYPART_3, // ENHY_LIMB_RIGHT_UPPER_ARM + ENHY_BODYPART_4, // ENHY_LIMB_RIGHT_FOREARM + ENHY_BODYPART_5, // ENHY_LIMB_RIGHT_HAND + ENHY_BODYPART_2, // ENHY_LIMB_HEAD +}; -s8 gEnHyParentBodyParts[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 }; +s8 gEnHyParentShadowBodyParts[ENHY_BODYPART_MAX] = { + ENHY_BODYPART_0, // ENHY_BODYPART_0 + ENHY_BODYPART_0, // ENHY_BODYPART_1 + ENHY_BODYPART_0, // ENHY_BODYPART_2 + ENHY_BODYPART_0, // ENHY_BODYPART_3 + ENHY_BODYPART_3, // ENHY_BODYPART_4 + ENHY_BODYPART_4, // ENHY_BODYPART_5 + ENHY_BODYPART_0, // ENHY_BODYPART_6 + ENHY_BODYPART_6, // ENHY_BODYPART_7 + ENHY_BODYPART_7, // ENHY_BODYPART_8 + ENHY_BODYPART_0, // ENHY_BODYPART_9 + ENHY_BODYPART_9, // ENHY_BODYPART_10 + ENHY_BODYPART_10, // ENHY_BODYPART_11 + ENHY_BODYPART_0, // ENHY_BODYPART_12 + ENHY_BODYPART_12, // ENHY_BODYPART_13 + ENHY_BODYPART_13, // ENHY_BODYPART_14 +}; -u8 gEnHyShadowSizes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +u8 gEnHyShadowSizes[ENHY_BODYPART_MAX] = { + 0, // ENHY_BODYPART_0 + 0, // ENHY_BODYPART_1 + 0, // ENHY_BODYPART_2 + 0, // ENHY_BODYPART_3 + 0, // ENHY_BODYPART_4 + 0, // ENHY_BODYPART_5 + 0, // ENHY_BODYPART_6 + 0, // ENHY_BODYPART_7 + 0, // ENHY_BODYPART_8 + 0, // ENHY_BODYPART_9 + 0, // ENHY_BODYPART_10 + 0, // ENHY_BODYPART_11 + 0, // ENHY_BODYPART_12 + 0, // ENHY_BODYPART_13 + 0, // ENHY_BODYPART_14 +}; s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 4060c3361d..427cc85d0b 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -974,7 +974,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween s32 startRow; for (i = 0; i < bodyPartsNum; i++) { - if (parentBodyParts[i] >= 0) { + if (parentBodyParts[i] > BODYPART_NONE) { parentBodyPart = parentBodyParts[i]; bodyPartPos = &bodyPartsPos[i]; diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index 687dc3c88f..b7540aa3f6 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -227,7 +227,7 @@ void BgCraceMovebg_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); - Math_Vec3f_Copy(&this->prevPlayerPos, &player->bodyPartsPos[0]); + Math_Vec3f_Copy(&this->prevPlayerPos, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); } /** diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 2448ac73c9..10f988f0b1 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -2196,24 +2196,42 @@ s32 Boss03_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* * Since there are two sets of ColliderJntSph, indices < 2 (ARRAY_COUNT(sHeadJntSphElementsInit)) refers to the first * collider and indices >= 2 refers to the second one */ -s8 sGyorgSphElementIndices[] = { - -1, // GYORG_LIMB_NONE, - -1, // GYORG_LIMB_ROOT, - 0, // GYORG_LIMB_HEAD, - -1, // GYORG_LIMB_BODY_ROOT, - 4, // GYORG_LIMB_UPPER_TRUNK, - 5, // GYORG_LIMB_LOWER_TRUNK, - 6, // GYORG_LIMB_TAIL, - -1, // GYORG_LIMB_RIGHT_FIN_ROOT, - 2, // GYORG_LIMB_UPPER_RIGHT_FIN, - -1, // GYORG_LIMB_LOWER_RIGHT_FIN, - -1, // GYORG_LIMB_LEFT_FIN_ROOT, - 3, // GYORG_LIMB_UPPER_LEFT_FIN, - -1, // GYORG_LIMB_LOWER_LEFT_FIN, - -1, // GYORG_LIMB_JAW_ROOT, - 1, // GYORG_LIMB_JAW, - -1, // GYORG_LIMB_MAX - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +static s8 sLimbToSphere[2][GYORG_LIMB_MAX] = { + { + -1, // GYORG_LIMB_NONE + -1, // GYORG_LIMB_ROOT + 0, // GYORG_LIMB_HEAD + -1, // GYORG_LIMB_BODY_ROOT + 4, // GYORG_LIMB_UPPER_TRUNK + 5, // GYORG_LIMB_LOWER_TRUNK + 6, // GYORG_LIMB_TAIL + -1, // GYORG_LIMB_RIGHT_FIN_ROOT + 2, // GYORG_LIMB_UPPER_RIGHT_FIN + -1, // GYORG_LIMB_LOWER_RIGHT_FIN + -1, // GYORG_LIMB_LEFT_FIN_ROOT + 3, // GYORG_LIMB_UPPER_LEFT_FIN + -1, // GYORG_LIMB_LOWER_LEFT_FIN + -1, // GYORG_LIMB_JAW_ROOT + 1, // GYORG_LIMB_JAW + }, + // unused + { + -1, // GYORG_LIMB_NONE + -1, // GYORG_LIMB_ROOT + -1, // GYORG_LIMB_HEAD + -1, // GYORG_LIMB_BODY_ROOT + -1, // GYORG_LIMB_UPPER_TRUNK + -1, // GYORG_LIMB_LOWER_TRUNK + -1, // GYORG_LIMB_TAIL + -1, // GYORG_LIMB_RIGHT_FIN_ROOT + -1, // GYORG_LIMB_UPPER_RIGHT_FIN + -1, // GYORG_LIMB_LOWER_RIGHT_FIN + -1, // GYORG_LIMB_LEFT_FIN_ROOT + -1, // GYORG_LIMB_UPPER_LEFT_FIN + -1, // GYORG_LIMB_LOWER_LEFT_FIN + -1, // GYORG_LIMB_JAW_ROOT + -1, // GYORG_LIMB_JAW + }, }; Vec3f D_809E9148 = { 600.0f, -100.0f, 0.0f }; @@ -2235,8 +2253,8 @@ void Boss03_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot Matrix_MultVec3f(&D_809E9148, &this->actor.focus.pos); } - sphereElementIndex = sGyorgSphElementIndices[limbIndex]; - if (sphereElementIndex >= 0) { + sphereElementIndex = sLimbToSphere[0][limbIndex]; + if (sphereElementIndex > -1) { Matrix_MultVec3f(&D_809E9154[sphereElementIndex], &spherePos); if (sphereElementIndex < 2) { diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index ec2de16adc..f5f88b80ec 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -76,7 +76,7 @@ s32 func_80C1D4D0(DmAh* this, PlayState* play) { this->unk_290 = CLAMP(this->unk_290, -0x1C70, 0x1C70); if (this->unk_280->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_280)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_280)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_280->focus.pos); } diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 9535a0b98c..5e43000844 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -137,7 +137,7 @@ s32 func_80C1C62C(DmAn* this, PlayState* play) { this->unk_2C4 = CLAMP(this->unk_2C4, -0x1C70, 0x1C70); if (this->unk_2B4->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_2B4)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_2B4)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_2B4->focus.pos); } diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 2ebe67e4ce..33df492431 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -137,7 +137,7 @@ s32 func_80C2457C(DmGm* this, PlayState* play) { this->unk_2C4 = CLAMP(this->unk_2C4, -0x1C70, 0x1C70); if (this->unk_2B4->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_2B4)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_2B4)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_2B4->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 71da776acc..1ac67f8893 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -255,7 +255,7 @@ void func_80BD2DC8(EnAh* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_1E4->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_1E4)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_1E4)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_1E4->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index b0b8822f6d..3c36258403 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -540,7 +540,7 @@ void func_80BDED20(EnAl* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_368->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_368)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_368)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_368->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index e7e367c7c4..1aef0a3743 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -146,23 +146,6 @@ static Color_RGBA8 D_808B1120 = { 150, 150, 150, 255 }; static Color_RGBA8 D_808B1124 = { 100, 100, 100, 150 }; -static Vec3f D_808B1128[] = { - { 4700.0f, -500.0f, 1800.0f }, { 4700.0f, -500.0f, -1800.0f }, { 2000.0f, -1500.0f, 0.0f }, - { 2000.0f, 0.0f, -1500.0f }, { 2000.0f, 0.0f, 1500.0f }, -}; - -static Vec3f D_808B1164[] = { - { 0.0f, -3000.0f, 0.0f }, - { 700.0f, -800.0f, 0.0f }, -}; - -static Vec3f D_808B117C[] = { - { 800.0f, 1000.0f, -1000.0f }, - { 800.0f, 1000.0f, 1000.0f }, - { 800.0f, -1000.0f, 1000.0f }, - { 800.0f, -1000.0f, -1000.0f }, -}; - void EnAm_Init(Actor* thisx, PlayState* play) { EnAm* this = THIS; @@ -532,6 +515,26 @@ void EnAm_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffScale > 0.7f) ? 0.7f : this->drawDmgEffScale; } +static Vec3f D_808B1128[] = { + { 4700.0f, -500.0f, 1800.0f }, // ENAM_BODYPART_0 + { 4700.0f, -500.0f, -1800.0f }, // ENAM_BODYPART_1 + { 2000.0f, -1500.0f, 0.0f }, // ENAM_BODYPART_2 + { 2000.0f, 0.0f, -1500.0f }, // ENAM_BODYPART_3 + { 2000.0f, 0.0f, 1500.0f }, // ENAM_BODYPART_4 +}; + +static Vec3f D_808B1164[] = { + { 0.0f, -3000.0f, 0.0f }, // ENAM_BODYPART_5, ENAM_BODYPART_7 + { 700.0f, -800.0f, 0.0f }, // ENAM_BODYPART_6, ENAM_BODYPART_8 +}; + +static Vec3f D_808B117C[] = { + { 800.0f, 1000.0f, -1000.0f }, // ENAM_BODYPART_9 + { 800.0f, 1000.0f, 1000.0f }, // ENAM_BODYPART_10 + { 800.0f, -1000.0f, 1000.0f }, // ENAM_BODYPART_11 + { 800.0f, -1000.0f, -1000.0f }, // ENAM_BODYPART_12 +}; + void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 i; s32 phi_s3; @@ -542,17 +545,18 @@ void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, phi_s2 = 0; phi_s1 = 0; if (limbIndex == OBJECT_AM_LIMB_04) { - phi_s2 = &this->limbPos[0]; + phi_s2 = &this->bodyPartsPos[ENAM_BODYPART_0]; phi_s1 = D_808B1128; - phi_s3 = 5; + phi_s3 = ARRAY_COUNT(D_808B1128); } else if (limbIndex == OBJECT_AM_LIMB_0D) { - phi_s2 = &this->limbPos[9]; + phi_s2 = &this->bodyPartsPos[ENAM_BODYPART_9]; phi_s1 = D_808B117C; - phi_s3 = 4; + phi_s3 = ARRAY_COUNT(D_808B117C); } else if ((limbIndex == OBJECT_AM_LIMB_07) || (limbIndex == OBJECT_AM_LIMB_0A)) { - phi_s2 = (limbIndex == OBJECT_AM_LIMB_07) ? &this->limbPos[5] : &this->limbPos[7]; + phi_s2 = (limbIndex == OBJECT_AM_LIMB_07) ? &this->bodyPartsPos[ENAM_BODYPART_5] + : &this->bodyPartsPos[ENAM_BODYPART_7]; phi_s1 = D_808B1164; - phi_s3 = 2; + phi_s3 = ARRAY_COUNT(D_808B1164); } else { phi_s3 = 0; } @@ -573,7 +577,7 @@ void EnAm_Draw(Actor* thisx, PlayState* play) { POLY_OPA_DISP = &gfx[2]; SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, 0.0f, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENAM_BODYPART_MAX, this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.h b/src/overlays/actors/ovl_En_Am/z_en_am.h index e482e2cba4..4bc52d26ac 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.h +++ b/src/overlays/actors/ovl_En_Am/z_en_am.h @@ -8,6 +8,23 @@ struct EnAm; typedef void (*EnAmActionFunc)(struct EnAm*, PlayState*); +typedef enum EnAmBodyPart { + /* 0 */ ENAM_BODYPART_0, + /* 1 */ ENAM_BODYPART_1, + /* 2 */ ENAM_BODYPART_2, + /* 3 */ ENAM_BODYPART_3, + /* 4 */ ENAM_BODYPART_4, + /* 5 */ ENAM_BODYPART_5, + /* 6 */ ENAM_BODYPART_6, + /* 7 */ ENAM_BODYPART_7, + /* 8 */ ENAM_BODYPART_8, + /* 9 */ ENAM_BODYPART_9, + /* 10 */ ENAM_BODYPART_10, + /* 11 */ ENAM_BODYPART_11, + /* 12 */ ENAM_BODYPART_12, + /* 13 */ ENAM_BODYPART_MAX +} EnAmBodyPart; + typedef struct EnAm { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -22,7 +39,7 @@ typedef struct EnAm { /* 0x240 */ f32 speed; // Hopping speed of Armos /* 0x244 */ f32 drawDmgEffAlpha; /* 0x248 */ f32 drawDmgEffScale; - /* 0x24C */ Vec3f limbPos[13]; + /* 0x24C */ Vec3f bodyPartsPos[ENAM_BODYPART_MAX]; /* 0x2E8 */ ColliderCylinder enemyCollider; // Collider for when Armos is Hostile /* 0x334 */ ColliderCylinder interactCollider; // Collider for when an interactable Armos is docile } EnAm; // size = 0x380 diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 6bede4ab42..156d7f9562 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1450,7 +1450,7 @@ void func_80A97410(EnAz* this, PlayState* play) { Math_SmoothStepToS(&this->unk_3D4, 0, 2, 0x71C, 0); } Math_Vec3f_Copy(&sp38, &player->actor.world.pos); - sp38.y = player->bodyPartsPos[7].y + 3.0f; + sp38.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; temp_v0_7 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp38); if (ABS(temp_v0_7) < 0x800) { Math_SmoothStepToS(&this->unk_3D6, temp_v0_7, 3, 0x71C, 0); diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index fe223cc71b..cef624ca8b 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -363,8 +363,7 @@ void EnBat_Die(EnBat* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartPoss, ARRAY_COUNT(this->bodyPartPoss), 2, 0.2f, - 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, BAD_BAT_BODYPART_MAX, 2, 0.2f, 0.2f); } func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 100, 0, 0); @@ -552,13 +551,12 @@ void EnBat_Draw(Actor* thisx, PlayState* play) { ? (this->animationFrame * (15 * (0x10000 / 360))) - (120 * (0x10000 / 360)) : 0; } - Matrix_MultZero(&this->bodyPartPoss[0]); + Matrix_MultZero(&this->bodyPartsPos[BAD_BAT_BODYPART_0]); Matrix_RotateZS(rollAngle, MTXMODE_APPLY); - Matrix_MultVecX(1700.0f, &this->bodyPartPoss[1]); + Matrix_MultVecX(1700.0f, &this->bodyPartsPos[BAD_BAT_BODYPART_1]); Matrix_RotateZS(-2 * rollAngle, MTXMODE_APPLY); - Matrix_MultVecX(-1700.0f, &this->bodyPartPoss[2]); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartPoss, ARRAY_COUNT(this->bodyPartPoss), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, - this->drawDmgEffType); + Matrix_MultVecX(-1700.0f, &this->bodyPartsPos[BAD_BAT_BODYPART_2]); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, BAD_BAT_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } } diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.h b/src/overlays/actors/ovl_En_Bat/z_en_bat.h index 479cfa24d8..927dfbef8f 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.h +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.h @@ -23,6 +23,13 @@ struct EnBat; typedef void (*EnBatActionFunc)(struct EnBat*, PlayState*); +typedef enum BadBatBodyPart { + /* 0 */ BAD_BAT_BODYPART_0, + /* 1 */ BAD_BAT_BODYPART_1, + /* 2 */ BAD_BAT_BODYPART_2, + /* 3 */ BAD_BAT_BODYPART_MAX +} BadBatBodyPart; + typedef struct EnBat { /* 0x000 */ Actor actor; /* 0x144 */ EnBatActionFunc actionFunc; @@ -36,7 +43,7 @@ typedef struct EnBat { /* 0x154 */ f32 drawDmgEffScale; /* 0x158 */ f32 drawDmgEffFrozenSteamScale; /* 0x15C */ f32 drawDmgEffAlpha; - /* 0x160 */ Vec3f bodyPartPoss[3]; + /* 0x160 */ Vec3f bodyPartsPos[BAD_BAT_BODYPART_MAX]; /* 0x184 */ ColliderSphere collider; } EnBat; // size = 0x1DC diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 937ab37491..6d96d9e289 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -119,37 +119,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP), }; -/** - * This maps a given limb based on its limbIndex to its appropriate index - * in the bodyPartsPos/Velocity arrays. An index of -1 indicates that the - * limb is not part of the bodyParts arrays. - */ -static s8 sLimbToBodyParts[BUBBLE_LIMB_MAX] = { - -1, // BUBBLE_LIMB_NONE - -1, // BUBBLE_LIMB_ROOT - -1, // BUBBLE_LIMB_CRANIUM_ROOT - -1, // BUBBLE_LIMB_JAW_ROOT - 0, // BUBBLE_LIMB_JAW - -1, // BUBBLE_LIMB_LEFT_WING_ROOT - -1, // BUBBLE_LIMB_LEFT_WING_WRAPPER - -1, // BUBBLE_LIMB_LEFT_WING_WEBBING_ROOT - 1, // BUBBLE_LIMB_LEFT_WING_WEBBING - -1, // BUBBLE_LIMB_LEFT_WING_BONE - -1, // BUBBLE_LIMB_RIGHT_WING_ROOT - -1, // BUBBLE_LIMB_RIGHT_WING_WRAPPER - -1, // BUBBLE_LIMB_RIGHT_WING_WEBBING_ROOT - 2, // BUBBLE_LIMB_RIGHT_WING_WEBBING - -1, // BUBBLE_LIMB_RIGHT_WING_BONE - 3, // BUBBLE_LIMB_CRANIUM -}; - -/** - * The last element of the bodyParts arrays is a duplicate of the cranium - * limb, which is then offset by a certain amount. There is no display list - * associated with this, so it is only used for effects. - */ -static Vec3f sDuplicateCraniumBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; - void EnBb_Init(Actor* thisx, PlayState* play) { EnBb* this = THIS; @@ -212,7 +181,7 @@ void EnBb_Thaw(EnBb* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, 0.15f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, BUBBLE_BODYPART_MAX, 2, 0.2f, 0.15f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -388,7 +357,7 @@ void EnBb_SetupDead(EnBb* this, PlayState* play) { this->actor.gravity = -1.5f; bodyPartVelocity = &this->bodyPartsVelocity[0]; - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++, bodyPartVelocity++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++, bodyPartVelocity++) { Math_Vec3f_Diff(&this->bodyPartsPos[i], &this->actor.world.pos, &posDiff); magnitude = Math3D_Vec3fMagnitude(&posDiff); if (magnitude > 1.0f) { @@ -412,14 +381,14 @@ void EnBb_Dead(EnBb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 4, 0x1000, 0x400); if (this->timer == 0) { - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++) { func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } EnBb_SetupWaitForRevive(this); } else { - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++) { Math_Vec3f_Sum(&this->bodyPartsPos[i], &this->bodyPartsVelocity[i], &this->bodyPartsPos[i]); this->bodyPartsVelocity[i].y += this->actor.gravity; } @@ -646,24 +615,54 @@ s32 EnBb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } +/** + * This maps a given limb based on its limbIndex to its appropriate index + * in the bodyPartsPos/Velocity arrays. + */ +static s8 sLimbToBodyParts[BUBBLE_LIMB_MAX] = { + BODYPART_NONE, // BUBBLE_LIMB_NONE + BODYPART_NONE, // BUBBLE_LIMB_ROOT + BODYPART_NONE, // BUBBLE_LIMB_CRANIUM_ROOT + BODYPART_NONE, // BUBBLE_LIMB_JAW_ROOT + BUBBLE_BODYPART_0, // BUBBLE_LIMB_JAW + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_ROOT + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_WRAPPER + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_WEBBING_ROOT + BUBBLE_BODYPART_1, // BUBBLE_LIMB_LEFT_WING_WEBBING + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_BONE + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_ROOT + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_WRAPPER + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_WEBBING_ROOT + BUBBLE_BODYPART_2, // BUBBLE_LIMB_RIGHT_WING_WEBBING + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_BONE + BUBBLE_BODYPART_3, // BUBBLE_LIMB_CRANIUM +}; + +/** + * The last element of the bodyParts arrays is a duplicate of the cranium + * limb, which is then offset by a certain amount. There is no display list + * associated with this, so it is only used for effects. + */ +static Vec3f sEffectsBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; + void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnBb* this = THIS; MtxF* currentMatrixState; if (this->bodyPartDrawStatus == BB_BODY_PART_DRAW_STATUS_ALIVE) { - if (sLimbToBodyParts[limbIndex] != -1) { - if (sLimbToBodyParts[limbIndex] == 0) { - Matrix_MultVecX(1000.0f, &this->bodyPartsPos[0]); - } else if (sLimbToBodyParts[limbIndex] == 3) { - Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[3]); - Matrix_MultVec3f(&sDuplicateCraniumBodyPartOffset, &this->bodyPartsPos[4]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + if (sLimbToBodyParts[limbIndex] == BUBBLE_BODYPART_0) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[BUBBLE_BODYPART_0]); + } else if (sLimbToBodyParts[limbIndex] == BUBBLE_BODYPART_3) { + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[BUBBLE_BODYPART_3]); + Matrix_MultVec3f(&sEffectsBodyPartOffset, &this->bodyPartsPos[BUBBLE_BODYPART_EFFECTS]); } else { Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } } } else if (this->bodyPartDrawStatus > BB_BODY_PART_DRAW_STATUS_ALIVE) { - if (sLimbToBodyParts[limbIndex] != -1) { + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } @@ -671,7 +670,7 @@ void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->bodyPartDrawStatus = BB_BODY_PART_DRAW_STATUS_BROKEN; } } else { - if (sLimbToBodyParts[limbIndex] != -1) { + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { OPEN_DISPS(play->state.gfxCtx); currentMatrixState = Matrix_GetCurrent(); @@ -717,9 +716,8 @@ void EnBb_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, BUBBLE_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/src/overlays/actors/ovl_En_Bb/z_en_bb.h index c852397d46..7c94d4b373 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -10,6 +10,15 @@ struct EnBb; typedef void (*EnBbActionFunc)(struct EnBb*, PlayState*); +typedef enum BubbleBodyPart { + /* 0 */ BUBBLE_BODYPART_0, + /* 1 */ BUBBLE_BODYPART_1, + /* 2 */ BUBBLE_BODYPART_2, + /* 3 */ BUBBLE_BODYPART_3, + /* 4 */ BUBBLE_BODYPART_EFFECTS, + /* 5 */ BUBBLE_BODYPART_MAX +} BubbleBodyPart; + typedef struct EnBb { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -31,8 +40,8 @@ typedef struct EnBb { /* 0x26C */ f32 drawDmgEffAlpha; /* 0x270 */ f32 drawDmgEffScale; /* 0x274 */ f32 drawDmgEffFrozenSteamScale; - /* 0x278 */ Vec3f bodyPartsPos[5]; - /* 0x2B4 */ Vec3f bodyPartsVelocity[5]; + /* 0x278 */ Vec3f bodyPartsPos[BUBBLE_BODYPART_MAX]; + /* 0x2B4 */ Vec3f bodyPartsVelocity[BUBBLE_BODYPART_MAX]; /* 0x2F0 */ Gfx* limbDList; /* 0x2F4 */ ColliderSphere collider; } EnBb; // size = 0x34C diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index ebd4b50001..8226fa138f 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -253,12 +253,12 @@ void EnBba01_Update(Actor* thisx, PlayState* play) { s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBba01* this = THIS; - s8 bodyPart; + s8 bodyPartIndex; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - bodyPart = gEnHyBodyParts[limbIndex]; - if (bodyPart >= 0) { - Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPart]); + bodyPartIndex = gEnHyLimbToBodyParts[limbIndex]; + if (bodyPartIndex > BODYPART_NONE) { + Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPartIndex]); } if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { @@ -338,8 +338,8 @@ void EnBba01_Draw(Actor* thisx, PlayState* play) { *shadowTexIter++ = 0; } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, - ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts); + SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, ENHY_BODYPART_MAX, + gEnHyShadowSizes, gEnHyParentShadowBodyParts); } SubS_DrawShadowTex(&this->enHy.actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 8a9a9142ff..ddf379c5b2 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -148,37 +148,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP), }; -/** - * This maps a given limb based on its limbIndex to its appropriate index - * in the bodyPartsPos/Velocity arrays. An index of -1 indicates that the - * limb is not part of the bodyParts arrays. - */ -static s8 sLimbToBodyParts[BUBBLE_LIMB_MAX] = { - -1, // BUBBLE_LIMB_NONE - -1, // BUBBLE_LIMB_ROOT - -1, // BUBBLE_LIMB_CRANIUM_ROOT - -1, // BUBBLE_LIMB_JAW_ROOT - 0, // BUBBLE_LIMB_JAW - -1, // BUBBLE_LIMB_LEFT_WING_ROOT - -1, // BUBBLE_LIMB_LEFT_WING_WRAPPER - -1, // BUBBLE_LIMB_LEFT_WING_WEBBING_ROOT - 1, // BUBBLE_LIMB_LEFT_WING_WEBBING - -1, // BUBBLE_LIMB_LEFT_WING_BONE - -1, // BUBBLE_LIMB_RIGHT_WING_ROOT - -1, // BUBBLE_LIMB_RIGHT_WING_WRAPPER - -1, // BUBBLE_LIMB_RIGHT_WING_WEBBING_ROOT - 2, // BUBBLE_LIMB_RIGHT_WING_WEBBING - -1, // BUBBLE_LIMB_RIGHT_WING_BONE - 3, // BUBBLE_LIMB_CRANIUM -}; - -/** - * The last element of the bodyParts arrays is a duplicate of the cranium - * limb, which is then offset by a certain amount. There is no display list - * associated with this, so it is only used for effects. - */ -static Vec3f sDuplicateCraniumBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; - void EnBbfall_Init(Actor* thisx, PlayState* play) { EnBbfall* this = THIS; s32 i; @@ -217,7 +186,7 @@ void EnBbfall_Thaw(EnBbfall* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, 0.15f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, BUBBLE_BODYPART_MAX, 2, 0.2f, 0.15f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -455,7 +424,7 @@ void EnBbfall_SetupDead(EnBbfall* this, PlayState* play) { this->actor.gravity = -1.5f; bodyPartVelocity = &this->bodyPartsVelocity[0]; - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++, bodyPartVelocity++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++, bodyPartVelocity++) { Math_Vec3f_Diff(&this->bodyPartsPos[i], &this->actor.world.pos, &posDiff); magnitude = Math3D_Vec3fMagnitude(&posDiff); if (magnitude > 1.0f) { @@ -477,7 +446,7 @@ void EnBbfall_Dead(EnBbfall* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 4, 0x1000, 0x400); if (this->timer == 0) { - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++) { func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } @@ -486,7 +455,7 @@ void EnBbfall_Dead(EnBbfall* this, PlayState* play) { return; } - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = 0; i < BUBBLE_BODYPART_MAX; i++) { Math_Vec3f_Sum(&this->bodyPartsPos[i], &this->bodyPartsVelocity[i], &this->bodyPartsPos[i]); this->bodyPartsVelocity[i].y += this->actor.gravity; } @@ -682,24 +651,54 @@ s32 EnBbfall_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } +/** + * This maps a given limb based on its limbIndex to its appropriate index + * in the bodyPartsPos/Velocity arrays. + */ +static s8 sLimbToBodyParts[BUBBLE_LIMB_MAX] = { + BODYPART_NONE, // BUBBLE_LIMB_NONE + BODYPART_NONE, // BUBBLE_LIMB_ROOT + BODYPART_NONE, // BUBBLE_LIMB_CRANIUM_ROOT + BODYPART_NONE, // BUBBLE_LIMB_JAW_ROOT + BUBBLE_BODYPART_0, // BUBBLE_LIMB_JAW + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_ROOT + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_WRAPPER + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_WEBBING_ROOT + BUBBLE_BODYPART_1, // BUBBLE_LIMB_LEFT_WING_WEBBING + BODYPART_NONE, // BUBBLE_LIMB_LEFT_WING_BONE + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_ROOT + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_WRAPPER + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_WEBBING_ROOT + BUBBLE_BODYPART_2, // BUBBLE_LIMB_RIGHT_WING_WEBBING + BODYPART_NONE, // BUBBLE_LIMB_RIGHT_WING_BONE + BUBBLE_BODYPART_3, // BUBBLE_LIMB_CRANIUM +}; + +/** + * The last element of the bodyParts arrays is a duplicate of the cranium + * limb, which is then offset by a certain amount. There is no display list + * associated with this, so it is only used for effects. + */ +static Vec3f sEffectsBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; + void EnBbfall_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnBbfall* this = THIS; MtxF* currentMatrixState; if (this->bodyPartDrawStatus == BBFALL_BODY_PART_DRAW_STATUS_ALIVE) { - if (sLimbToBodyParts[limbIndex] != -1) { - if (sLimbToBodyParts[limbIndex] == 0) { - Matrix_MultVecX(1000.0f, &this->bodyPartsPos[0]); - } else if (sLimbToBodyParts[limbIndex] == 3) { - Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[3]); - Matrix_MultVec3f(&sDuplicateCraniumBodyPartOffset, &this->bodyPartsPos[4]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + if (sLimbToBodyParts[limbIndex] == BUBBLE_BODYPART_0) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[BUBBLE_BODYPART_0]); + } else if (sLimbToBodyParts[limbIndex] == BUBBLE_BODYPART_3) { + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[BUBBLE_BODYPART_3]); + Matrix_MultVec3f(&sEffectsBodyPartOffset, &this->bodyPartsPos[BUBBLE_BODYPART_EFFECTS]); } else { Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } } } else if (this->bodyPartDrawStatus > BBFALL_BODY_PART_DRAW_STATUS_ALIVE) { - if (sLimbToBodyParts[limbIndex] != -1) { + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } @@ -707,7 +706,7 @@ void EnBbfall_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r this->bodyPartDrawStatus = BBFALL_BODY_PART_DRAW_STATUS_BROKEN; } } else { - if (sLimbToBodyParts[limbIndex] != -1) { + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { OPEN_DISPS(play->state.gfxCtx); currentMatrixState = Matrix_GetCurrent(); @@ -771,9 +770,8 @@ void EnBbfall_Draw(Actor* thisx, PlayState* play2) { } } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, BUBBLE_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h index 19c643ea72..e65b1a8d2b 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h @@ -3,6 +3,7 @@ #include "global.h" #include "objects/object_bb/object_bb.h" +#include "overlays/actors/ovl_En_Bb/z_en_bb.h" struct EnBbfall; @@ -25,8 +26,8 @@ typedef struct EnBbfall { /* 0x260 */ f32 drawDmgEffScale; /* 0x264 */ f32 drawDmgEffFrozenSteamScale; /* 0x268 */ Vec3f flamePos[6]; - /* 0x2B0 */ Vec3f bodyPartsPos[5]; - /* 0x2EC */ Vec3f bodyPartsVelocity[5]; + /* 0x2B0 */ Vec3f bodyPartsPos[BUBBLE_BODYPART_MAX]; + /* 0x2EC */ Vec3f bodyPartsVelocity[BUBBLE_BODYPART_MAX]; /* 0x328 */ Gfx* limbDList; /* 0x32C */ UNK_TYPE1 unk_32C[0x58]; /* 0x384 */ ColliderJntSph collider; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 49aa89d833..fd3818b014 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -372,7 +372,7 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { if (this->timer == 0) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, BIGOKUTA_BODYPART_MAX, 2, 0.5f, 0.35f); EnBigokuta_SetupDeathEffects(this); } } else if (CutsceneManager_IsNext(this->csId)) { @@ -628,31 +628,34 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } static s8 sLimbToBodyParts[BIGOKUTA_LIMB_MAX] = { - -1, // BIGOKUTA_LIMB_NONE - -1, // BIGOKUTA_LIMB_BODY - -1, // BIGOKUTA_LIMB_RIGHT_FRONT_ARM_BASE - 0, // BIGOKUTA_LIMB_RIGHT_FRONT_ARM_END - -1, // BIGOKUTA_LIMB_LEFT_FRONT_ARM_BASE - 1, // BIGOKUTA_LIMB_LEFT_FRONT_ARM_END - -1, // BIGOKUTA_LIMB_RIGHT_BACK_ARM_BASE - 2, // BIGOKUTA_LIMB_RIGHT_BACK_ARM_END - -1, // BIGOKUTA_LIMB_LEFT_BACK_ARM_BASE - 3, // BIGOKUTA_LIMB_LEFT_BACK_ARM_END - 8, // BIGOKUTA_LIMB_HEAD - 4, // BIGOKUTA_LIMB_LEFT_TENTACLE_BASE - -1, // BIGOKUTA_LIMB_LEFT_TENTACLE_TIP - 5, // BIGOKUTA_LIMB_RIGHT_TENTACLE_BASE - -1, // BIGOKUTA_LIMB_RIGHT_TENTACLE_TIP - -1, // BIGOKUTA_LIMB_LEFT_WEAK_POINT - -1, // BIGOKUTA_LIMB_RIGHT_WEAK_POINT - -1, // BIGOKUTA_LIMB_CENTER_SNOUT - 6, // BIGOKUTA_LIMB_RIGHT_SNOUT - 7, // BIGOKUTA_LIMB_LEFT_SNOUT + BODYPART_NONE, // BIGOKUTA_LIMB_NONE + BODYPART_NONE, // BIGOKUTA_LIMB_BODY + BODYPART_NONE, // BIGOKUTA_LIMB_RIGHT_FRONT_ARM_BASE + BIGOKUTA_BODYPART_0, // BIGOKUTA_LIMB_RIGHT_FRONT_ARM_END + BODYPART_NONE, // BIGOKUTA_LIMB_LEFT_FRONT_ARM_BASE + BIGOKUTA_BODYPART_1, // BIGOKUTA_LIMB_LEFT_FRONT_ARM_END + BODYPART_NONE, // BIGOKUTA_LIMB_RIGHT_BACK_ARM_BASE + BIGOKUTA_BODYPART_2, // BIGOKUTA_LIMB_RIGHT_BACK_ARM_END + BODYPART_NONE, // BIGOKUTA_LIMB_LEFT_BACK_ARM_BASE + BIGOKUTA_BODYPART_3, // BIGOKUTA_LIMB_LEFT_BACK_ARM_END + BIGOKUTA_BODYPART_8, // BIGOKUTA_LIMB_HEAD + BIGOKUTA_BODYPART_4, // BIGOKUTA_LIMB_LEFT_TENTACLE_BASE + BODYPART_NONE, // BIGOKUTA_LIMB_LEFT_TENTACLE_TIP + BIGOKUTA_BODYPART_5, // BIGOKUTA_LIMB_RIGHT_TENTACLE_BASE + BODYPART_NONE, // BIGOKUTA_LIMB_RIGHT_TENTACLE_TIP + BODYPART_NONE, // BIGOKUTA_LIMB_LEFT_WEAK_POINT + BODYPART_NONE, // BIGOKUTA_LIMB_RIGHT_WEAK_POINT + BODYPART_NONE, // BIGOKUTA_LIMB_CENTER_SNOUT + BIGOKUTA_BODYPART_6, // BIGOKUTA_LIMB_RIGHT_SNOUT + BIGOKUTA_BODYPART_7, // BIGOKUTA_LIMB_LEFT_SNOUT }; static Vec3f D_80AC45D0[] = { - { 0.0f, 2000.0f, 1000.0f }, { 0.0f, 2000.0f, -2000.0f }, { 1700.0f, 700.0f, -600.0f }, - { -1700.0f, 700.0f, -600.0f }, { 0.0f, 500.0f, -2500.0f }, + { 0.0f, 2000.0f, 1000.0f }, // BIGOKUTA_BODYPART_8 + { 0.0f, 2000.0f, -2000.0f }, // BIGOKUTA_BODYPART_9 + { 1700.0f, 700.0f, -600.0f }, // BIGOKUTA_BODYPART_10 + { -1700.0f, 700.0f, -600.0f }, // BIGOKUTA_BODYPART_11 + { 0.0f, 500.0f, -2500.0f }, // BIGOKUTA_BODYPART_12 }; void EnBigokuta_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { @@ -660,14 +663,14 @@ void EnBigokuta_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* s32 i; s8 bodyPartIndex = sLimbToBodyParts[limbIndex]; - if (bodyPartIndex != -1) { - if (bodyPartIndex < 6) { - Matrix_MultVecX(800.0f, &this->limbPos[bodyPartIndex]); - } else if (bodyPartIndex < 8) { - Matrix_MultZero(&this->limbPos[bodyPartIndex]); + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= BIGOKUTA_BODYPART_5) { + Matrix_MultVecX(800.0f, &this->bodyPartsPos[bodyPartIndex]); + } else if (bodyPartIndex <= BIGOKUTA_BODYPART_7) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); } else { for (i = 0; i < ARRAY_COUNT(D_80AC45D0); i++) { - Matrix_MultVec3f(&D_80AC45D0[i], &this->limbPos[bodyPartIndex + i]); + Matrix_MultVec3f(&D_80AC45D0[i], &this->bodyPartsPos[bodyPartIndex + i]); } } } @@ -698,7 +701,7 @@ void EnBigokuta_Draw(Actor* thisx, PlayState* play) { NULL, EnBigokuta_PostLimbDraw, &this->picto.actor, &gfx[2]); } - Actor_DrawDamageEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->picto.actor, this->bodyPartsPos, BIGOKUTA_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index 41ae325e07..1fdad749b5 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -9,6 +9,23 @@ struct EnBigokuta; typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); +typedef enum BigokutaBodyPart { + /* 0 */ BIGOKUTA_BODYPART_0, + /* 1 */ BIGOKUTA_BODYPART_1, + /* 2 */ BIGOKUTA_BODYPART_2, + /* 3 */ BIGOKUTA_BODYPART_3, + /* 4 */ BIGOKUTA_BODYPART_4, + /* 5 */ BIGOKUTA_BODYPART_5, + /* 6 */ BIGOKUTA_BODYPART_6, + /* 7 */ BIGOKUTA_BODYPART_7, + /* 8 */ BIGOKUTA_BODYPART_8, + /* 9 */ BIGOKUTA_BODYPART_9, + /* 10 */ BIGOKUTA_BODYPART_10, + /* 11 */ BIGOKUTA_BODYPART_11, + /* 12 */ BIGOKUTA_BODYPART_12, + /* 13 */ BIGOKUTA_BODYPART_MAX +} BigokutaBodyPart; + typedef struct EnBigokuta { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; @@ -26,7 +43,7 @@ typedef struct EnBigokuta { /* 0x2A0 */ Vec3f playerHoldPos; /* 0x2AC */ Vec3f subCamAt; /* 0x2B8 */ Vec3f subCamEye; - /* 0x2C4 */ Vec3f limbPos[13]; + /* 0x2C4 */ Vec3f bodyPartsPos[BIGOKUTA_BODYPART_MAX]; /* 0x360 */ ColliderCylinder shellCollider; /* 0x3AC */ ColliderCylinder bodyCollider; } EnBigokuta; // size = 0x3F8 diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index e4fa338ceb..4e9eb89449 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -160,24 +160,24 @@ static InitChainEntry sInitChain[] = { // used in the burning death actionfunc static Vec3f D_80B6506C = { 0.0f, 3.0f, 0.0f }; -static u8 sLimbToBodyParts[BIG_POE_LIMB_MAX] = { - -1, // BIG_POE_LIMB_NONE - 4, // BIG_POE_LIMB_FACE - -1, // BIG_POE_LIMB_LEFT_UPPER_ARM - 0, // BIG_POE_LIMB_LEFT_FOREARM - -1, // BIG_POE_LIMB_RIGHT_UPPER_ARM - 1, // BIG_POE_LIMB_RIGHT_FOREARM - -1, // BIG_POE_LIMB_RIGHT_HAND - 2, // BIG_POE_LIMB_LANTERN - 5, // BIG_POE_LIMB_HAT_AND_CLOAK - 3, // BIG_POE_LIMB_LOWER_ROBE +static s8 sLimbToBodyParts[BIG_POE_LIMB_MAX] = { + BODYPART_NONE, // BIG_POE_LIMB_NONE + BIG_POE_BODYPART_4, // BIG_POE_LIMB_FACE + BODYPART_NONE, // BIG_POE_LIMB_LEFT_UPPER_ARM + BIG_POE_BODYPART_0, // BIG_POE_LIMB_LEFT_FOREARM + BODYPART_NONE, // BIG_POE_LIMB_RIGHT_UPPER_ARM + BIG_POE_BODYPART_1, // BIG_POE_LIMB_RIGHT_FOREARM + BODYPART_NONE, // BIG_POE_LIMB_RIGHT_HAND + BIG_POE_BODYPART_2, // BIG_POE_LIMB_LANTERN + BIG_POE_BODYPART_5, // BIG_POE_LIMB_HAT_AND_CLOAK + BIG_POE_BODYPART_3, // BIG_POE_LIMB_LOWER_ROBE }; // used in limbdraw static Vec3f D_80B65084[] = { - { 2000.0f, 4000.0f, 0.0f }, - { -1000.0f, 1500.0f, -2000.0f }, - { -1000.0f, 1500.0f, 2000.0f }, + { 2000.0f, 4000.0f, 0.0f }, // BIG_POE_BODYPART_6 + { -1000.0f, 1500.0f, -2000.0f }, // BIG_POE_BODYPART_7 + { -1000.0f, 1500.0f, 2000.0f }, // BIG_POE_BODYPART_8 }; void EnBigpo_Init(Actor* thisx, PlayState* play2) { @@ -1267,19 +1267,20 @@ void EnBigpo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro } bodyPartIndex = sLimbToBodyParts[limbIndex]; - if (bodyPartIndex != -1) { - if (bodyPartIndex < 3) { - Matrix_MultZero(&this->limbPos[bodyPartIndex]); - } else if (bodyPartIndex == 3) { - Matrix_MultVecX(3000.0f, &this->limbPos[bodyPartIndex]); - } else if (bodyPartIndex == 4) { - Matrix_MultVecY(-2000.0f, &this->limbPos[bodyPartIndex]); + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= BIG_POE_BODYPART_2) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); + } else if (bodyPartIndex == BIG_POE_BODYPART_3) { + Matrix_MultVecX(3000.0f, &this->bodyPartsPos[bodyPartIndex]); + } else if (bodyPartIndex == BIG_POE_BODYPART_4) { + Matrix_MultVecY(-2000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { - v2ptr = &this->limbPos[bodyPartIndex + 1]; + v2ptr = &this->bodyPartsPos[bodyPartIndex + 1]; v1ptr = D_80B65084; - Matrix_MultVecX(-4000.0f, &this->limbPos[bodyPartIndex]); + // BIG_POE_BODYPART_5 + Matrix_MultVecX(-4000.0f, &this->bodyPartsPos[bodyPartIndex]); - for (i = bodyPartIndex + 1; i < ARRAY_COUNT(this->limbPos); i++) { + for (i = bodyPartIndex + 1; i < BIG_POE_BODYPART_MAX; i++) { Matrix_MultVec3f(v1ptr, v2ptr); v2ptr++; v1ptr++; @@ -1318,7 +1319,7 @@ void EnBigpo_DrawMainBigpo(Actor* thisx, PlayState* play) { } // 71.428566f might be 500/7 context unknown - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, BIG_POE_BODYPART_MAX, this->actor.scale.x * 71.428566f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index d622abc0fb..12b230614c 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -8,6 +8,19 @@ struct EnBigpo; typedef void (*EnBigPoActionFunc)(struct EnBigpo*, PlayState*); +typedef enum BigPoeBodyPart { + /* 0 */ BIG_POE_BODYPART_0, + /* 1 */ BIG_POE_BODYPART_1, + /* 2 */ BIG_POE_BODYPART_2, + /* 3 */ BIG_POE_BODYPART_3, + /* 4 */ BIG_POE_BODYPART_4, + /* 5 */ BIG_POE_BODYPART_5, + /* 6 */ BIG_POE_BODYPART_6, + /* 7 */ BIG_POE_BODYPART_7, + /* 8 */ BIG_POE_BODYPART_8, + /* 9 */ BIG_POE_BODYPART_MAX +} BigPoeBodyPart; + typedef struct EnBigpoFireEffect { /* 0x00 */ Vec3f pos; /* 0x0C */ LightNode* light; @@ -40,7 +53,7 @@ typedef struct EnBigpo { /* 0x218 */ f32 savedHeight; // actual height while flying moves as part of bobbing /* 0x21C */ f32 drawDmgEffAlpha; /* 0x220 */ f32 drawDmgEffScale; - /* 0x224 */ Vec3f limbPos[9]; + /* 0x224 */ Vec3f bodyPartsPos[BIG_POE_BODYPART_MAX]; /* 0x290 */ Color_RGBA8 mainColor; /* 0x294 */ Color_RGBA8 lanternColor; /* 0x298 */ UNK_TYPE1 pad298[0x14]; 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 78c5123cb1..f4d498a140 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -923,7 +923,7 @@ void EnBigslime_GekkoThaw(EnBigslime* this, PlayState* play) { this->gekkoCollider.base.colType = COLTYPE_HIT6; this->gekkoCollider.info.elemType = ELEMTYPE_UNK1; this->gekkoDrawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->gekkoBodyPartsPos, GEKKO_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -3034,30 +3034,30 @@ void EnBigslime_DrawBigslime(Actor* thisx, PlayState* play) { } static s8 sLimbToBodyParts[GEKKO_LIMB_MAX] = { - -1, // GEKKO_LIMB_NONE - -1, // GEKKO_LIMB_ROOT - 0, // GEKKO_LIMB_WAIST - -1, // GEKKO_LIMB_LEFT_THIGH - 1, // GEKKO_LIMB_LEFT_SHIN - -1, // GEKKO_LIMB_LEFT_ANKLE - 2, // GEKKO_LIMB_LEFT_FOOT - -1, // GEKKO_LIMB_RIGHT_THIGH - 3, // GEKKO_LIMB_RIGHT_SHIN - -1, // GEKKO_LIMB_RIGHT_ANKLE - 4, // GEKKO_LIMB_RIGHT_FOOT - -1, // GEKKO_LIMB_TORSO - 5, // GEKKO_LIMB_LEFT_UPPER_ARM - 6, // GEKKO_LIMB_LEFT_FOREARM - -1, // GEKKO_LIMB_LEFT_WRIST - 7, // GEKKO_LIMB_LEFT_HAND - 8, // GEKKO_LIMB_RIGHT_UPPER_ARM - 9, // GEKKO_LIMB_RIGHT_FOREARM - -1, // GEKKO_LIMB_RIGHT_WRIST - 10, // GEKKO_LIMB_RIGHT_HAND - -1, // GEKKO_LIMB_HEAD - 11, // GEKKO_LIMB_JAW - -1, // GEKKO_LIMB_LEFT_EYE - -1, // GEKKO_LIMB_RIGHT_EYE + BODYPART_NONE, // GEKKO_LIMB_NONE + BODYPART_NONE, // GEKKO_LIMB_ROOT + GEKKO_BODYPART_WAIST, // GEKKO_LIMB_WAIST + BODYPART_NONE, // GEKKO_LIMB_LEFT_THIGH + GEKKO_BODYPART_LEFT_SHIN, // GEKKO_LIMB_LEFT_SHIN + BODYPART_NONE, // GEKKO_LIMB_LEFT_ANKLE + GEKKO_BODYPART_LEFT_FOOT, // GEKKO_LIMB_LEFT_FOOT + BODYPART_NONE, // GEKKO_LIMB_RIGHT_THIGH + GEKKO_BODYPART_RIGHT_SHIN, // GEKKO_LIMB_RIGHT_SHIN + BODYPART_NONE, // GEKKO_LIMB_RIGHT_ANKLE + GEKKO_BODYPART_RIGHT_FOOT, // GEKKO_LIMB_RIGHT_FOOT + BODYPART_NONE, // GEKKO_LIMB_TORSO + GEKKO_BODYPART_LEFT_UPPER_ARM, // GEKKO_LIMB_LEFT_UPPER_ARM + GEKKO_BODYPART_LEFT_FOREARM, // GEKKO_LIMB_LEFT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_LEFT_WRIST + GEKKO_BODYPART_LEFT_HAND, // GEKKO_LIMB_LEFT_HAND + GEKKO_BODYPART_RIGHT_UPPER_ARM, // GEKKO_LIMB_RIGHT_UPPER_ARM + GEKKO_BODYPART_RIGHT_FOREARM, // GEKKO_LIMB_RIGHT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_RIGHT_WRIST + GEKKO_BODYPART_RIGHT_HAND, // GEKKO_LIMB_RIGHT_HAND + BODYPART_NONE, // GEKKO_LIMB_HEAD + GEKKO_BODYPART_JAW, // GEKKO_LIMB_JAW + BODYPART_NONE, // GEKKO_LIMB_LEFT_EYE + BODYPART_NONE, // GEKKO_LIMB_RIGHT_EYE }; // Some kind of offset for the position of the Gekkos right foot @@ -3072,8 +3072,8 @@ void EnBigslime_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* this->actor.focus.rot.y = this->gekkoRot.y; } - if (sLimbToBodyParts[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[sLimbToBodyParts[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->gekkoBodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == GEKKO_LIMB_RIGHT_ANKLE) { @@ -3130,7 +3130,7 @@ void EnBigslime_DrawGekko(Actor* thisx, PlayState* play) { EnBigslime_DrawShatteringEffects(this, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->gekkoBodyPartsPos, GEKKO_BODYPART_MAX, this->gekkoScale * (999.99991f / 7.0f) * this->gekkoDrawDmgEffScale, this->gekkoDrawDmgEffFrozenSteamScale, this->gekkoDrawDmgEffAlpha, this->gekkoDrawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 2f7183e45e..4f09998bce 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -106,7 +106,7 @@ typedef struct EnBigslime { Vec3f frozenPos; Vec3f subCamDistToFrog; // Used to zoom into frogs as Gekko despawns/Frog spawns }; - /* 0x02F8 */ Vec3f limbPos[12]; + /* 0x02F8 */ Vec3f gekkoBodyPartsPos[GEKKO_BODYPART_MAX]; /* 0x0388 */ f32 gekkoDrawDmgEffAlpha; /* 0x038C */ f32 gekkoDrawDmgEffScale; /* 0x0390 */ f32 gekkoDrawDmgEffFrozenSteamScale; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 7e173bb564..2a2b8f6e8b 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -423,7 +423,7 @@ void func_80868B74(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.y += 1.25f; } this->unk_1A0++; - if ((this->csId1 != -1) && CutsceneManager_GetCurrentCsId() == this->csId1) { + if ((this->csId1 != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->csId1)) { if (this->unk_1A0 == 2) { func_800B724C(play, &this->dyna.actor, PLAYER_CSMODE_4); } else if (this->unk_1A0 == 22) { diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 6416f3325c..407c6ea668 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -240,12 +240,12 @@ void EnCne01_Update(Actor* thisx, PlayState* play) { s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnCne01* this = THIS; - s8 bodyPart; + s8 bodyPartIndex; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - bodyPart = gEnHyBodyParts[limbIndex]; - if (bodyPart >= 0) { - Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPart]); + bodyPartIndex = gEnHyLimbToBodyParts[limbIndex]; + if (bodyPartIndex > BODYPART_NONE) { + Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPartIndex]); } if (limbIndex == CNE_LIMB_HEAD) { @@ -327,8 +327,8 @@ void EnCne01_Draw(Actor* thisx, PlayState* play) { *shadowTexIter++ = 0; } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, - ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts); + SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, ENHY_BODYPART_MAX, + gEnHyShadowSizes, gEnHyParentShadowBodyParts); } SubS_DrawShadowTex(&this->enHy.actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index eaede93b70..021c55631d 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -290,7 +290,7 @@ void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 4, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, GUAY_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -565,7 +565,7 @@ void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot EnCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_BODY) { - Matrix_MultVecX(2500.0f, this->bodyPartsPos); + Matrix_MultVecX(2500.0f, &this->bodyPartsPos[GUAY_BODYPART_BODY]); } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_TAIL)) { Matrix_MultZero(&this->bodyPartsPos[(limbIndex >> 1) - 1]); @@ -578,7 +578,7 @@ void EnCrow_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, GUAY_BODYPART_MAX, this->actor.scale.x * 100.0f * this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 527f822f6c..d2ebc554a0 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -13,6 +13,14 @@ struct EnCrow; typedef void (*EnCrowActionFunc)(struct EnCrow*, PlayState*); +typedef enum GuayBodyPart { + /* 0 */ GUAY_BODYPART_BODY, + /* 1 */ GUAY_BODYPART_RIGHT_WING_TIP, + /* 2 */ GUAY_BODYPART_LEFT_WING_TIP, + /* 3 */ GUAY_BODYPART_TAIL, + /* 4 */ GUAY_BODYPART_MAX +} GuayBodyPart; + typedef struct EnCrow { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -25,7 +33,7 @@ typedef struct EnCrow { /* 0x1CA */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x200 */ ColliderJntSph collider; /* 0x220 */ ColliderJntSphElement colliderItems[1]; - /* 0x260 */ Vec3f bodyPartsPos[4]; + /* 0x260 */ Vec3f bodyPartsPos[GUAY_BODYPART_MAX]; /* 0x290 */ f32 drawDmgEffAlpha; /* 0x294 */ f32 drawDmgEffFrozenSteamScale; /* 0x298 */ f32 drawDmgEffScale; 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 19664a8315..e9bb777c61 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -301,8 +301,8 @@ void EnDekubaba_SpawnIceEffects(EnDekubaba* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 4, - this->size * 0.3f, this->size * 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DEKUBABA_BODYPART_MAX, 4, this->size * 0.3f, + this->size * 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -1237,7 +1237,7 @@ void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); - for (i = 1; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = DEKUBABA_BODYPART_1; i < DEKUBABA_BODYPART_MAX; i++) { Matrix_MultZero(&this->bodyPartsPos[i]); } @@ -1293,7 +1293,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { } } - Matrix_MultZero(&this->bodyPartsPos[i + 1]); + Matrix_MultZero(&this->bodyPartsPos[DEKUBABA_BODYPART_1 + i]); } CLOSE_DISPS(play->state.gfxCtx); @@ -1309,7 +1309,7 @@ void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, PlayState* play) { Collider_UpdateSpheres(55, &this->collider); Collider_UpdateSpheres(56, &this->collider); - Matrix_MultZero(&this->bodyPartsPos[3]); + Matrix_MultZero(&this->bodyPartsPos[DEKUBABA_BODYPART_3]); CLOSE_DISPS(play->state.gfxCtx); } @@ -1349,7 +1349,7 @@ void EnDekubaba_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - Math_Vec3f_Copy(&this->bodyPartsPos[0], &this->actor.world.pos); + Math_Vec3f_Copy(&this->bodyPartsPos[DEKUBABA_BODYPART_0], &this->actor.world.pos); if (this->actionFunc != EnDekubaba_DeadStickDrop) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, @@ -1382,7 +1382,7 @@ void EnDekubaba_Draw(Actor* thisx, PlayState* play) { } CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DEKUBABA_BODYPART_MAX, this->drawDmgEffScale * this->size, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index b1c7f98bcc..b29dbe8db1 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -13,6 +13,14 @@ typedef enum { /* 1 */ DEKUBABA_BIG } DekuBabaType; +typedef enum DekuBabaBodyPart { + /* 0 */ DEKUBABA_BODYPART_0, + /* 1 */ DEKUBABA_BODYPART_1, + /* 2 */ DEKUBABA_BODYPART_2, + /* 3 */ DEKUBABA_BODYPART_3, + /* 4 */ DEKUBABA_BODYPART_MAX +} DekuBabaBodyPart; + typedef struct EnDekubaba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,7 +35,7 @@ typedef struct EnDekubaba { /* 0x1FC */ f32 drawDmgEffAlpha; /* 0x200 */ f32 drawDmgEffScale; /* 0x204 */ f32 drawDmgEffFrozenSteamScale; - /* 0x208 */ Vec3f bodyPartsPos[4]; + /* 0x208 */ Vec3f bodyPartsPos[DEKUBABA_BODYPART_MAX]; /* 0x238 */ CollisionPoly* boundFloor; /* 0x23C */ ColliderJntSph collider; /* 0x25C */ ColliderJntSphElement colliderElements[7]; diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 6cbc3a49be..1057da6fa8 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -162,7 +162,7 @@ void func_808BD3B4(EnDekunuts* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 8, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENDEKUNUTS_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -700,28 +700,42 @@ s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec return false; } +static s8 sLimbToBodyParts[DEKU_SCRUB_LIMB_MAX] = { + BODYPART_NONE, // DEKU_SCRUB_LIMB_NONE + BODYPART_NONE, // DEKU_SCRUB_LIMB_BODY + BODYPART_NONE, // DEKU_SCRUB_LIMB_HEAD + ENDEKUNUTS_BODYPART_3, // DEKU_SCRUB_LIMB_HEADDRESS + BODYPART_NONE, // DEKU_SCRUB_LIMB_CREST + ENDEKUNUTS_BODYPART_0, // DEKU_SCRUB_LIMB_SNOUT + BODYPART_NONE, // DEKU_SCRUB_LIMB_LEFT_LEG + ENDEKUNUTS_BODYPART_1, // DEKU_SCRUB_LIMB_LEFT_FOOT + BODYPART_NONE, // DEKU_SCRUB_LIMB_RIGHT_LEG + ENDEKUNUTS_BODYPART_2, // DEKU_SCRUB_LIMB_RIGHT_FOOT +}; + +static Vec3f D_808BEFA4[] = { + { -1500.0f, 0.0f, -1700.0f }, // ENDEKUNUTS_BODYPART_4 + { -1500.0f, 0.0f, 1700.0f }, // ENDEKUNUTS_BODYPART_5 + { -2500.0f, -2000.0f, 0.0f }, // ENDEKUNUTS_BODYPART_6 + { -1000.0f, 1000.0f, 0.0f }, // ENDEKUNUTS_BODYPART_7 +}; + void EnDekunuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_808BEF98[] = { - -1, -1, -1, 3, -1, 0, -1, 1, -1, 2, 0, 0, - }; - static Vec3f D_808BEFA4[] = { - { -1500.0f, 0.0f, -1700.0f }, { -1500.0f, 0.0f, 1700.0f }, { -2500.0f, -2000.0f, 0.0f }, - { -1000.0f, 1000.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, - }; EnDekunuts* this = THIS; s32 i; Vec3f* ptr1; Vec3f* ptr2; - s32 value = D_808BEF98[limbIndex]; + s32 bodyPartIndex = sLimbToBodyParts[limbIndex]; - if (value != -1) { - if (value < 3) { - Matrix_MultVecX(1000.0f, &this->limbPos[value]); + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= ENDEKUNUTS_BODYPART_2) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { - Matrix_MultZero(&this->limbPos[value]); + // ENDEKUNUTS_BODYPART_3 + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); ptr1 = &D_808BEFA4[0]; - ptr2 = &this->limbPos[value + 1]; - for (i = value + 1; i < ARRAY_COUNT(this->limbPos); i++) { + ptr2 = &this->bodyPartsPos[bodyPartIndex + 1]; + for (i = bodyPartIndex + 1; i < ENDEKUNUTS_BODYPART_MAX; i++) { Matrix_MultVec3f(ptr1, ptr2); ptr1++, ptr2++; } @@ -745,6 +759,6 @@ void EnDekunuts_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } Gfx_DrawDListOpa(play, gDekuScrubFlowerDL); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENDEKUNUTS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index 248f758ace..9580cb3e6b 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -17,6 +17,18 @@ typedef enum { /* 0xFF */ ENDEKUNUTS_GET_FF00_FF = 0xFF } EnDekunutsParam; +typedef enum DekunutsBodyPart { + /* 0 */ ENDEKUNUTS_BODYPART_0, + /* 1 */ ENDEKUNUTS_BODYPART_1, + /* 2 */ ENDEKUNUTS_BODYPART_2, + /* 3 */ ENDEKUNUTS_BODYPART_3, + /* 4 */ ENDEKUNUTS_BODYPART_4, + /* 5 */ ENDEKUNUTS_BODYPART_5, + /* 6 */ ENDEKUNUTS_BODYPART_6, + /* 7 */ ENDEKUNUTS_BODYPART_7, + /* 8 */ ENDEKUNUTS_BODYPART_MAX +} DekunutsBodyPart; + typedef struct EnDekunuts { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +44,7 @@ typedef struct EnDekunuts { /* 0x210 */ f32 drawDmgEffAlpha; /* 0x214 */ f32 drawDmgEffScale; /* 0x218 */ f32 drawDmgEffFrozenSteamScale; - /* 0x21C */ Vec3f limbPos[8]; + /* 0x21C */ Vec3f bodyPartsPos[ENDEKUNUTS_BODYPART_MAX]; /* 0x27C */ ColliderCylinder collider; } EnDekunuts; // size = 0x2C8 diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index e6602263ab..8779f9e6df 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -390,7 +390,7 @@ void func_8089ACEC(EnDinofos* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderJntSph.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 12, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DINOFOS_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -1048,9 +1048,9 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { worldSphere = &this->colliderJntSph.elements[i].dim.worldSphere; - worldSphere->center.x = this->limbPos[10].x; - worldSphere->center.y = this->limbPos[10].y; - worldSphere->center.z = this->limbPos[10].z; + worldSphere->center.x = this->bodyPartsPos[DINOFOS_BODYPART_JAW].x; + worldSphere->center.y = this->bodyPartsPos[DINOFOS_BODYPART_JAW].y; + worldSphere->center.z = this->bodyPartsPos[DINOFOS_BODYPART_JAW].z; } if (play->sceneId == SCENE_MITURIN) { @@ -1086,7 +1086,8 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { sp7C.y = Rand_CenteredFloat(0.6f) + 1.4f; sp7C.z = 0.9f * temp_f22; Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); - EffectSsDFire_Spawn(play, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, + 3, 8); for (end = 6, i = 3; i > 0; i--) { if (this->unk_290 < (20 + -(i * 2))) { @@ -1099,9 +1100,11 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { dim = &this->colliderJntSph.elements[i].dim; temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; - dim->worldSphere.center.x = (s32)this->limbPos[10].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); - dim->worldSphere.center.y = (s32)this->limbPos[10].y + (s32)dim->modelSphere.center.y; - dim->worldSphere.center.z = (s32)this->limbPos[10].z + (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z); + dim->worldSphere.center.x = + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); + dim->worldSphere.center.y = (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].y + (s32)dim->modelSphere.center.y; + dim->worldSphere.center.z = + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].z + (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z); } if (this->unk_290 != 0) { @@ -1345,7 +1348,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnDinofos* this = THIS; s32 pad; - Vec3f sp30; + Vec3f bodyPartPos; if (this->actionFunc != func_8089C7B8) { func_8089A900(this); @@ -1362,10 +1365,11 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_40); if (this->actionFunc != func_8089C7B8) { if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { - if (!((play->gameplayFrames % 4) & 1)) { - Math_Vec3f_Copy(&sp30, &this->limbPos[1 + (play->gameplayFrames % 4)]); - sp30.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(play, &sp30, 100, 320, 0); + if (((play->gameplayFrames % 4) & 1) == 0) { + Math_Vec3f_Copy(&bodyPartPos, + &this->bodyPartsPos[DINOFOS_BODYPART_LEFT_CLAWS + (play->gameplayFrames % 4)]); + bodyPartPos.y = this->actor.world.pos.y + this->actor.depthInWater; + EffectSsGRipple_Spawn(play, &bodyPartPos, 100, 320, 0); } } if (this->actionFunc != func_8089D018) { @@ -1377,7 +1381,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { Math_ScaledStepToS(&this->unk_28E, 0, 2000); } - Math_Vec3f_Copy(&this->actor.focus.pos, &this->limbPos[4]); + Math_Vec3f_Copy(&this->actor.focus.pos, &this->bodyPartsPos[DINOFOS_BODYPART_UPPER_BODY]); this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_28E; if (this->colliderJntSph.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); @@ -1413,13 +1417,35 @@ s32 func_8089DC4C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s return 0; } +static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; +static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; +static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; + +static s8 sLimbToBodyParts[DINOLFOS_LIMB_MAX] = { + BODYPART_NONE, // DINOLFOS_LIMB_NONE + BODYPART_NONE, // DINOLFOS_LIMB_LOWER_BODY + DINOFOS_BODYPART_LEFT_UPPER_LEG, // DINOLFOS_LIMB_LEFT_UPPER_LEG + BODYPART_NONE, // DINOLFOS_LIMB_LEFT_LOWER_LEG + DINOFOS_BODYPART_LEFT_CLAWS, // DINOLFOS_LIMB_LEFT_CLAWS + DINOFOS_BODYPART_RIGHT_UPPER_LEG, // DINOLFOS_LIMB_RIGHT_UPPER_LEG + BODYPART_NONE, // DINOLFOS_LIMB_RIGHT_LOWER_LEG + DINOFOS_BODYPART_RIGHT_CLAWS, // DINOLFOS_LIMB_RIGHT_CLAWS + DINOFOS_BODYPART_UPPER_BODY, // DINOLFOS_LIMB_UPPER_BODY + BODYPART_NONE, // DINOLFOS_LIMB_LEFT_UPPER_ARM + DINOFOS_BODYPART_LEFT_FOREARM, // DINOLFOS_LIMB_LEFT_FOREARM + DINOFOS_BODYPART_LEFT_HAND, // DINOLFOS_LIMB_LEFT_HAND + BODYPART_NONE, // DINOLFOS_LIMB_RIGHT_UPPER_ARM + DINOFOS_BODYPART_RIGHT_FOREARM, // DINOLFOS_LIMB_RIGHT_FOREARM + DINOFOS_BODYPART_RIGHT_HAND, // DINOLFOS_LIMB_RIGHT_HAND + BODYPART_NONE, // DINOLFOS_LIMB_NECK + DINOFOS_BODYPART_HEAD, // DINOLFOS_LIMB_HEAD + DINOFOS_BODYPART_JAW, // DINOLFOS_LIMB_JAW + BODYPART_NONE, // DINOLFOS_LIMB_UPPER_TAIL + DINOFOS_BODYPART_LOWER_TAIL, // DINOLFOS_LIMB_LOWER_TAIL + BODYPART_NONE, // DINOLFOS_LIMB_KNIFE +}; + void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; - static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; - static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; - static s8 D_8089E3B0[] = { - -1, -1, 0, -1, 1, 2, -1, 3, 4, -1, 5, 6, -1, 7, 8, -1, 9, 10, -1, 11, -1, - }; EnDinofos* this = THIS; Vec3f sp80; Vec3f sp74; @@ -1430,8 +1456,8 @@ void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto MtxF* sp48; Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); - if (D_8089E3B0[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_8089E3B0[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if ((limbIndex == DINOLFOS_LIMB_RIGHT_HAND) && (this->unk_292 != this->unk_290) && @@ -1463,7 +1489,8 @@ void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto sp4C.x -= sp48->mf[3][0]; sp4C.y -= sp48->mf[3][1]; sp4C.z -= sp48->mf[3][2]; - EffectSsDFire_Spawn(play, &this->limbPos[10], &sp4C, &gZeroVec3f, 30, 22, 255 - (sp58 * 20), 20, 3, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp4C, &gZeroVec3f, 30, 22, + 255 - (sp58 * 20), 20, 3, 8); this->unk_292 = this->unk_290; } } @@ -1498,7 +1525,7 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DINOFOS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index 81590268c5..dd39135ae1 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -8,6 +8,22 @@ struct EnDinofos; typedef void (*EnDinofosActionFunc)(struct EnDinofos*, PlayState*); +typedef enum EnDinofosBodyPart { + /* 0 */ DINOFOS_BODYPART_LEFT_UPPER_LEG, + /* 1 */ DINOFOS_BODYPART_LEFT_CLAWS, + /* 2 */ DINOFOS_BODYPART_RIGHT_UPPER_LEG, + /* 3 */ DINOFOS_BODYPART_RIGHT_CLAWS, + /* 4 */ DINOFOS_BODYPART_UPPER_BODY, + /* 5 */ DINOFOS_BODYPART_LEFT_FOREARM, + /* 6 */ DINOFOS_BODYPART_LEFT_HAND, + /* 7 */ DINOFOS_BODYPART_RIGHT_FOREARM, + /* 8 */ DINOFOS_BODYPART_RIGHT_HAND, + /* 9 */ DINOFOS_BODYPART_HEAD, + /* 10 */ DINOFOS_BODYPART_JAW, + /* 11 */ DINOFOS_BODYPART_LOWER_TAIL, + /* 12 */ DINOFOS_BODYPART_MAX +} EnDinofosBodyPart; + typedef struct EnDinofos { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -34,7 +50,7 @@ typedef struct EnDinofos { /* 0x2B8 */ f32 drawDmgEffFrozenSteamScale; /* 0x2BC */ Vec3f unk_2BC; /* 0x2C8 */ Vec3f unk_2C8; - /* 0x2D4 */ Vec3f limbPos[12]; + /* 0x2D4 */ Vec3f bodyPartsPos[DINOFOS_BODYPART_MAX]; /* 0x364 */ ColliderJntSph colliderJntSph; /* 0x384 */ ColliderJntSphElement colliderJntSphElement[9]; /* 0x5C4 */ ColliderQuad colliderQuad; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index ae6d05c079..0f0025a4ab 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -432,7 +432,8 @@ void func_80876D28(EnDodongo* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider1.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 9, 2, this->unk_334 * 0.3f, this->unk_334 * 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DODONGO_BODYPART_MAX, 2, this->unk_334 * 0.3f, + this->unk_334 * 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -448,7 +449,7 @@ void func_80876DC4(EnDodongo* this, PlayState* play) { f32 temp_f22; f32 temp_f20; - Math_Vec3f_Copy(&sp68, &this->limbPos[0]); + Math_Vec3f_Copy(&sp68, &this->bodyPartsPos[DODONGO_BODYPART_0]); sp66 = ((s32)Rand_Next() >> 0x12) + this->actor.shape.rot.y; temp_f20 = Math_CosS(sp66); temp_f22 = Math_SinS(sp66); @@ -496,8 +497,8 @@ void func_80876DC4(EnDodongo* this, PlayState* play) { sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f22 * this->unk_334; func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); - sp68.x = this->limbPos[0].x + (temp_f20 * 6.0f * this->unk_334); - sp68.z = this->limbPos[0].z - (temp_f22 * 6.0f * this->unk_334); + sp68.x = this->bodyPartsPos[DODONGO_BODYPART_0].x + (temp_f20 * 6.0f * this->unk_334); + sp68.z = this->bodyPartsPos[DODONGO_BODYPART_0].z - (temp_f22 * 6.0f * this->unk_334); sp80.x *= -1.0f; sp80.z = sp80.z * -1.0f; sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334; @@ -623,9 +624,9 @@ void func_808777A8(EnDodongo* this) { for (i = 0; i < ARRAY_COUNT(this->collider3Elements); i++) { sph = &this->collider3.elements[i].dim.worldSphere; - sph->center.x = this->limbPos[0].x; - sph->center.y = this->limbPos[0].y; - sph->center.z = this->limbPos[0].z; + sph->center.x = this->bodyPartsPos[DODONGO_BODYPART_0].x; + sph->center.y = this->bodyPartsPos[DODONGO_BODYPART_0].y; + sph->center.z = this->bodyPartsPos[DODONGO_BODYPART_0].z; sph->radius = 0; } @@ -659,10 +660,12 @@ void func_8087784C(EnDodongo* this, PlayState* play) { temp_f12 = Math_CosS(this->actor.shape.rot.y) * this->unk_334; for (i = 0; i < end; i++, element++) { - element->dim.worldSphere.center.x = this->limbPos[0].x + (element->dim.modelSphere.center.z * temp_f2); + element->dim.worldSphere.center.x = + this->bodyPartsPos[DODONGO_BODYPART_0].x + (element->dim.modelSphere.center.z * temp_f2); element->dim.worldSphere.center.y = - this->limbPos[0].y + (element->dim.modelSphere.center.y * this->unk_334); - element->dim.worldSphere.center.z = this->limbPos[0].z + (element->dim.modelSphere.center.z * temp_f12); + this->bodyPartsPos[DODONGO_BODYPART_0].y + (element->dim.modelSphere.center.y * this->unk_334); + element->dim.worldSphere.center.z = + this->bodyPartsPos[DODONGO_BODYPART_0].z + (element->dim.modelSphere.center.z * temp_f12); element->dim.worldSphere.radius = element->dim.modelSphere.radius; } @@ -670,8 +673,8 @@ void func_8087784C(EnDodongo* this, PlayState* play) { D_80879348.x = 2.5f * temp_f2; D_80879348.y = this->unk_334 * 1.4f; D_80879348.z = 2.5f * temp_f12; - EffectSsDFire_Spawn(play, &this->limbPos[0], &D_80879354, &D_80879348, this->unk_334 * 100.0f, - this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DODONGO_BODYPART_0], &D_80879354, &D_80879348, + this->unk_334 * 100.0f, this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8); } else if ((this->skelAnime.curFrame >= 2.0f) && (this->skelAnime.curFrame <= 20.0f)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); } @@ -773,13 +776,13 @@ void func_80877E60(EnDodongo* this, PlayState* play) { } else { sp5E = this->unk_334 * 50.0f; sp5C = this->unk_334 * 5.0f; - Math_Vec3f_Copy(&sp64, &this->limbPos[0]); + Math_Vec3f_Copy(&sp64, &this->bodyPartsPos[DODONGO_BODYPART_0]); func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); sp64.x -= Math_CosS(this->actor.shape.rot.y) * 6.0f * this->unk_334; sp64.z += Math_SinS(this->actor.shape.rot.y) * 6.0f * this->unk_334; func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); - sp64.x = (2.0f * this->limbPos[0].x) - sp64.x; - sp64.z = (2.0f * this->limbPos[0].z) - sp64.z; + sp64.x = (2.0f * this->bodyPartsPos[DODONGO_BODYPART_0].x) - sp64.x; + sp64.z = (2.0f * this->bodyPartsPos[DODONGO_BODYPART_0].z) - sp64.z; func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); } } @@ -1072,32 +1075,64 @@ s32 EnDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } +static Vec3f D_80879370 = { 1800.0f, 1200.0f, 0.0f }; +static Vec3f D_8087937C = { 1500.0f, 300.0f, 0.0f }; + +static s8 sLimbToBodyParts[OBJECT_DODONGO_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_DODONGO_LIMB_NONE + BODYPART_NONE, // OBJECT_DODONGO_LIMB_01 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_02 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_03 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_04 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_05 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_06 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_07 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_08 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_09 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0A + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0B + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0C + DODONGO_BODYPART_2, // OBJECT_DODONGO_LIMB_0D + DODONGO_BODYPART_3, // OBJECT_DODONGO_LIMB_0E + DODONGO_BODYPART_4, // OBJECT_DODONGO_LIMB_0F + BODYPART_NONE, // OBJECT_DODONGO_LIMB_10 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_11 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_12 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_13 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_14 + DODONGO_BODYPART_5, // OBJECT_DODONGO_LIMB_15 + DODONGO_BODYPART_6, // OBJECT_DODONGO_LIMB_16 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_17 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_18 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_19 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1A + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1B + DODONGO_BODYPART_7, // OBJECT_DODONGO_LIMB_1C + DODONGO_BODYPART_8, // OBJECT_DODONGO_LIMB_1D + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1E +}; + void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80879370 = { 1800.0f, 1200.0f, 0.0f }; - static Vec3f D_8087937C = { 1500.0f, 300.0f, 0.0f }; - static s8 D_80879388[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, - -1, -1, -1, -1, -1, 5, 6, -1, -1, -1, -1, -1, 7, 8, -1, 0, - }; EnDodongo* this = THIS; Collider_UpdateSpheres(limbIndex, &this->collider1); Collider_UpdateSpheres(limbIndex, &this->collider2); - if (D_80879388[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80879388[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == 7) { Matrix_MultVec3f(&D_80879370, &this->unk_308); - Matrix_MultVec3f(&D_8087937C, &this->limbPos[0]); + Matrix_MultVec3f(&D_8087937C, &this->bodyPartsPos[DODONGO_BODYPART_0]); Matrix_MultZero(&this->actor.focus.pos); - Matrix_MultVecY(-200.0f, &this->limbPos[1]); + Matrix_MultVecY(-200.0f, &this->bodyPartsPos[DODONGO_BODYPART_1]); } else if (limbIndex == 13) { Matrix_MultVecX(1600.0f, &this->unk_320); } if ((limbIndex == 30) && (this->actionFunc == func_80878424) && (this->timer != this->unk_304)) { - EffectBlure_AddVertex(Effect_GetByIndex(this->unk_338), &this->unk_320, &this->limbPos[4]); + EffectBlure_AddVertex(Effect_GetByIndex(this->unk_338), &this->unk_320, + &this->bodyPartsPos[DODONGO_BODYPART_4]); this->unk_304 = this->timer; } } @@ -1108,7 +1143,7 @@ void EnDodongo_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, EnDodongo_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DODONGO_BODYPART_MAX, this->drawDmgEffScale * this->unk_334, this->drawDmgEffFrozenSteamScale * this->unk_334, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index 3cc80b0d1e..be3095410b 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -7,6 +7,19 @@ struct EnDodongo; typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); +typedef enum DodongoBodyPart { + /* 0 */ DODONGO_BODYPART_0, + /* 1 */ DODONGO_BODYPART_1, + /* 2 */ DODONGO_BODYPART_2, + /* 3 */ DODONGO_BODYPART_3, + /* 4 */ DODONGO_BODYPART_4, + /* 5 */ DODONGO_BODYPART_5, + /* 6 */ DODONGO_BODYPART_6, + /* 7 */ DODONGO_BODYPART_7, + /* 8 */ DODONGO_BODYPART_8, + /* 9 */ DODONGO_BODYPART_MAX +} DodongoBodyPart; + typedef struct EnDodongo { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,7 +40,7 @@ typedef struct EnDodongo { /* 0x33C */ f32 drawDmgEffAlpha; /* 0x340 */ f32 drawDmgEffScale; /* 0x344 */ f32 drawDmgEffFrozenSteamScale; - /* 0x348 */ Vec3f limbPos[9]; + /* 0x348 */ Vec3f bodyPartsPos[DODONGO_BODYPART_MAX]; /* 0x3B4 */ ColliderJntSph collider1; /* 0x3D4 */ ColliderJntSphElement collider1Elements[10]; /* 0x654 */ ColliderJntSph collider2; diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index e349a13a31..d690fd5854 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -1460,10 +1460,10 @@ void EnEgol_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot (limbIndex == EYEGORE_LIMB_RIGHT_HAND) || (limbIndex == EYEGORE_LIMB_UPPER_EYELID) || (limbIndex == EYEGORE_LIMB_LOWER_EYELID) || (limbIndex == EYEGORE_LIMB_HIPS) || (limbIndex == EYEGORE_LIMB_LEFT_SHIN) || (limbIndex == EYEGORE_LIMB_RIGHT_SHIN)) { - Matrix_MultZero(&this->limbPos[this->limbPosIndex]); - this->limbPosIndex++; - if (this->limbPosIndex >= ARRAY_COUNT(this->limbPos)) { - this->limbPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EYEGORE_BODYPART_MAX) { + this->bodyPartIndex = 0; } } Collider_UpdateSpheres(limbIndex, &this->bodyCollider); @@ -1486,7 +1486,7 @@ void EnEgol_Draw(Actor* thisx, PlayState* play2) { if (this->dmgEffectTimer != 0) { f32 drawDmgEffAlpha = 0.05f * this->dmgEffectTimer; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EYEGORE_BODYPART_MAX, 0.8f, 0.8f, drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); } if (this->laserState >= EYEGORE_LASER_FIRE) { diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.h b/src/overlays/actors/ovl_En_Egol/z_en_egol.h index faa156543f..35d232d513 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.h +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.h @@ -29,6 +29,22 @@ typedef struct { /* 0x38 */ f32 scale; } EnEgolEffect; // size = 0x3C +typedef enum EyegoreBodyPart { + /* 0 */ EYEGORE_BODYPART_0, + /* 1 */ EYEGORE_BODYPART_1, + /* 2 */ EYEGORE_BODYPART_2, + /* 3 */ EYEGORE_BODYPART_3, + /* 4 */ EYEGORE_BODYPART_4, + /* 5 */ EYEGORE_BODYPART_5, + /* 6 */ EYEGORE_BODYPART_6, + /* 7 */ EYEGORE_BODYPART_7, + /* 8 */ EYEGORE_BODYPART_8, + /* 9 */ EYEGORE_BODYPART_9, + /* 10 */ EYEGORE_BODYPART_10, + /* 11 */ EYEGORE_BODYPART_11, + /* 12 */ EYEGORE_BODYPART_MAX +} EyegoreBodyPart; + typedef struct EnEgol { /* 0x0000 */ Actor actor; /* 0x0144 */ SkelAnime skelAnime; @@ -43,8 +59,8 @@ typedef struct EnEgol { /* 0x02B4 */ s16 headRot; /* 0x02BA */ s16 switchFlag; /* 0x02BC */ s16 dmgEffectTimer; - /* 0x02C0 */ Vec3f limbPos[12]; - /* 0x0350 */ s16 limbPosIndex; + /* 0x02C0 */ Vec3f bodyPartsPos[EYEGORE_BODYPART_MAX]; + /* 0x0350 */ s16 bodyPartIndex; /* 0x0352 */ s16 pathIndex; /* 0x0354 */ s32 animIndex; /* 0x0358 */ u8 isRetreating; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 2c3d46ffb2..023c73f7cf 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -654,7 +654,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { func_8088CBAC(this, play); if (this->fairyFlags & 0x800) { - this->unk_224.y = player->bodyPartsPos[0].y; + this->unk_224.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y; } func_8088D8D0(this, &this->unk_224); diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 8405691e3d..cadbe60470 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -38,10 +38,10 @@ static s16 sActorIds[] = { }; static s16 sActorParams[] = { - EN_GRASSHOPPER_PARAMS(EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED), // EN_ENCOUNT1_GRASSHOPPER - WALLMASTER_PARAMS(WALLMASTER_TYPE_TIMER_ONLY, 0, false), // EN_ENCOUNT1_WALLMASTER - ENPR2_PARAMS(1, 0), // EN_ENCOUNT1_SKULLFISH - ENPR2_PARAMS(3, 0) // EN_ENCOUNT1_SKULLFISH_2 + DRAGONFLY_PARAMS(DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED), // EN_ENCOUNT1_GRASSHOPPER + WALLMASTER_PARAMS(WALLMASTER_TYPE_TIMER_ONLY, 0, false), // EN_ENCOUNT1_WALLMASTER + ENPR2_PARAMS(1, 0), // EN_ENCOUNT1_SKULLFISH + ENPR2_PARAMS(3, 0) // EN_ENCOUNT1_SKULLFISH_2 }; void EnEncount1_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index c5e4b54345..150fafc608 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -180,7 +180,7 @@ void EnFirefly_SpawnIceEffects(EnFirefly* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 3, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, KEESE_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -807,11 +807,11 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } if (limbIndex == FIRE_KEESE_LIMB_LEFT_WING_END) { - Matrix_MultZero(&this->limbPos[0]); + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_LEFT_WING_END]); } else if (limbIndex == FIRE_KEESE_LIMB_RIGHT_WING_END_ROOT) { - Matrix_MultZero(&this->limbPos[1]); + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_RIGHT_WING_END_ROOT]); } else if (limbIndex == FIRE_KEESE_LIMB_BODY) { - Matrix_MultZero(&this->limbPos[2]); + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_BODY]); } } @@ -844,7 +844,7 @@ void EnFirefly_Draw(Actor* thisx, PlayState* play) { POLY_OPA_DISP = gfx; } - Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, NULL, this->bodyPartsPos, KEESE_BODYPART_MAX, this->drawDmgEffScale * this->actor.scale.y * 200.0f, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); this->lastDrawnFrame = play->gameplayFrames; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index 429cec7c32..6174c2e872 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -18,6 +18,13 @@ typedef enum { #define KEESE_INVISIBLE (1 << 0xF) #define KEESE_GET_MAIN_TYPE(thisx) ((thisx)->params & 0x7FFF) +typedef enum KeeseBodyPart { + /* 0 */ KEESE_BODYPART_LEFT_WING_END, + /* 1 */ KEESE_BODYPART_RIGHT_WING_END_ROOT, + /* 2 */ KEESE_BODYPART_BODY, + /* 3 */ KEESE_BODYPART_MAX +} KeeseBodyPart; + typedef struct EnFirefly { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -35,7 +42,7 @@ typedef struct EnFirefly { /* 0x2E8 */ f32 drawDmgEffScale; /* 0x2E8 */ f32 drawDmgEffFrozenSteamScale; /* 0x2F4 */ u32 lastDrawnFrame; - /* 0x2F8 */ Vec3f limbPos[3]; + /* 0x2F8 */ Vec3f bodyPartsPos[KEESE_BODYPART_MAX]; /* 0x31C */ ColliderSphere collider; } EnFirefly; // size = 0x374 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 57466a2518..ffe28b2b31 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -237,7 +237,7 @@ void func_808D0A48(EnFloormas* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, 2, this->actor.scale.x * 30.000002f, this->actor.scale.x * 20.0f); if (this->actor.scale.x > 0.009f) { this->actor.flags |= ACTOR_FLAG_400; @@ -1157,44 +1157,44 @@ 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 +static s8 sLimbToBodyParts[WALLMASTER_LIMB_MAX] = { + BODYPART_NONE, // WALLMASTER_LIMB_NONE + BODYPART_NONE, // WALLMASTER_LIMB_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_HAND + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_ROOT + ENFLOORMAS_BODYPART_0, // WALLMASTER_LIMB_INDEX_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_MIDDLE + ENFLOORMAS_BODYPART_1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_ROOT + ENFLOORMAS_BODYPART_2, // WALLMASTER_LIMB_RING_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_MIDDLE + ENFLOORMAS_BODYPART_3, // WALLMASTER_LIMB_RING_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_ROOT + ENFLOORMAS_BODYPART_4, // WALLMASTER_LIMB_MIDDLE_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_MIDDLE + ENFLOORMAS_BODYPART_5, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_WRIST_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_WRIST + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_ROOT + ENFLOORMAS_BODYPART_6, // WALLMASTER_LIMB_THUMB_PROXIMAL + ENFLOORMAS_BODYPART_7, // WALLMASTER_LIMB_THUMB_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_MIDDLE + ENFLOORMAS_BODYPART_8, // WALLMASTER_LIMB_THUMB_DISTAL }; void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnFloormas* this = THIS; - if (D_808D393C[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_808D393C[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WALLMASTER_LIMB_WRIST) { - Matrix_MultVecX(1000.0f, &this->limbPos[9]); - Matrix_MultVecX(-1000.0f, &this->limbPos[10]); + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[ENFLOORMAS_BODYPART_9]); + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[ENFLOORMAS_BODYPART_10]); } else if (limbIndex == WALLMASTER_LIMB_HAND) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); @@ -1230,7 +1230,7 @@ void EnFloormas_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, 100.0f * (this->drawDmgEffScale * this->actor.scale.x), 100.0f * (this->drawDmgEffFrozenSteamScale * this->actor.scale.x), this->drawDmgEffAlpha, this->drawDmgEffType); @@ -1255,7 +1255,7 @@ void func_808D3754(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, this->drawDmgEffScale * this->actor.scale.x * 100.0f, this->drawDmgEffFrozenSteamScale * this->actor.scale.x * 100.0f, this->drawDmgEffAlpha, this->drawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h index 628cad4f6b..ac9b1954ea 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h @@ -18,6 +18,21 @@ typedef enum { /* 0x40 */ ENFLOORMAS_GET_7FFF_40 = 0x40 } EnFloormasParam; +typedef enum EnFloormasBodyPart { + /* 0 */ ENFLOORMAS_BODYPART_0, + /* 1 */ ENFLOORMAS_BODYPART_1, + /* 2 */ ENFLOORMAS_BODYPART_2, + /* 3 */ ENFLOORMAS_BODYPART_3, + /* 4 */ ENFLOORMAS_BODYPART_4, + /* 5 */ ENFLOORMAS_BODYPART_5, + /* 6 */ ENFLOORMAS_BODYPART_6, + /* 7 */ ENFLOORMAS_BODYPART_7, + /* 8 */ ENFLOORMAS_BODYPART_8, + /* 9 */ ENFLOORMAS_BODYPART_9, + /* 10 */ ENFLOORMAS_BODYPART_10, + /* 11 */ ENFLOORMAS_BODYPART_MAX +} EnFloormasBodyPart; + typedef struct EnFloormas { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +47,7 @@ typedef struct EnFloormas { /* 0x2C4 */ f32 drawDmgEffAlpha; /* 0x2C8 */ f32 drawDmgEffScale; /* 0x2CC */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D0 */ Vec3f limbPos[11]; + /* 0x2D0 */ Vec3f bodyPartsPos[ENFLOORMAS_BODYPART_MAX]; /* 0x354 */ ColliderCylinder collider; } EnFloormas; // size = 0x3A0 diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 0a78bdab89..d56a8f9bf4 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -863,14 +863,14 @@ void EnFz_Draw(Actor* thisx, PlayState* play) { if (this->drawDmgEffTimer > 0) { s32 pad2[6]; - Vec3f limbPos[2]; + Vec3f bodyPartsPos[2]; s32 pad3; - limbPos[0] = this->actor.world.pos; - limbPos[1] = this->actor.world.pos; - limbPos[0].y += 20.0f; - limbPos[1].y += 40.0f; - Actor_DrawDamageEffects(play, NULL, limbPos, ARRAY_COUNT(limbPos), this->drawDmgEffScale * 4.0f, 0.5f, + bodyPartsPos[0] = this->actor.world.pos; + bodyPartsPos[1] = this->actor.world.pos; + bodyPartsPos[0].y += 20.0f; + bodyPartsPos[1].y += 40.0f; + Actor_DrawDamageEffects(play, NULL, bodyPartsPos, ARRAY_COUNT(bodyPartsPos), this->drawDmgEffScale * 4.0f, 0.5f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index be5d4f58fb..0ed4cac86f 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -185,7 +185,8 @@ s32 EnGe2_LookForPlayer(PlayState* play, Actor* actor, Vec3f* pos, s16 yaw, s16 return false; } - if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[7], &posResult, &outPoly, false)) { + if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly, + false)) { return false; } else { return true; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index f4abc9e914..82b4bfce78 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -821,7 +821,7 @@ void func_8094F0E0(EnGm* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_268->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_268)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_268)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_268->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index cb13f95042..212065a31d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1174,7 +1174,7 @@ s32 EnGo_UpdateRotationToTarget(EnGo* this, PlayState* play) { Math_Vec3f_Copy(&thisPos, &this->actor.focus.pos); if (this->attentionTarget->id == ACTOR_PLAYER) { - targetPos.y = ((Player*)this->attentionTarget)->bodyPartsPos[7].y + 3.0f; + targetPos.y = ((Player*)this->attentionTarget)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&targetPos, &this->attentionTarget->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index d96fcf7fed..949e501420 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -43,99 +43,170 @@ void EnGrasshopper_UpdateEffects(EnGrasshopper* this, PlayState* play); void EnGrasshopper_DrawEffects(EnGrasshopper* this, PlayState* play); typedef enum { - /* 0 */ EN_GRASSHOPPER_ACTION_FLY, - /* 1 */ EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES, - /* 2 */ EN_GRASSHOPPER_ACTION_BANK, - /* 3 */ EN_GRASSHOPPER_ACTION_BOUNCED, - /* 4 */ EN_GRASSHOPPER_ACTION_DECIDE_ACTION, - /* 5 */ EN_GRASSHOPPER_ACTION_APPROACH_PLAYER, - /* 6 */ EN_GRASSHOPPER_ACTION_ATTACK, - /* 7 */ EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK, - /* 8 */ EN_GRASSHOPPER_ACTION_DAMAGED, - /* 9 */ EN_GRASSHOPPER_ACTION_DEAD, - /* 10 */ EN_GRASSHOPPER_ACTION_FALL + /* 0 */ DRAGONFLY_ACTION_FLY, + /* 1 */ DRAGONFLY_ACTION_ROAM_IN_CIRCLES, + /* 2 */ DRAGONFLY_ACTION_BANK, + /* 3 */ DRAGONFLY_ACTION_BOUNCED, + /* 4 */ DRAGONFLY_ACTION_DECIDE_ACTION, + /* 5 */ DRAGONFLY_ACTION_APPROACH_PLAYER, + /* 6 */ DRAGONFLY_ACTION_ATTACK, + /* 7 */ DRAGONFLY_ACTION_WAIT_AFTER_ATTACK, + /* 8 */ DRAGONFLY_ACTION_DAMAGED, + /* 9 */ DRAGONFLY_ACTION_DEAD, + /* 10 */ DRAGONFLY_ACTION_FALL } EnGrasshopperAction; typedef enum { - /* 0 */ EN_GRASSHOPPER_DECISION_ATTACK, - /* 1 */ EN_GRASSHOPPER_DECISION_FLY, - /* 2 */ EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES // Never used in the final game + /* 0 */ DRAGONFLY_DECISION_ATTACK, + /* 1 */ DRAGONFLY_DECISION_FLY, + /* 2 */ DRAGONFLY_DECISION_ROAM_IN_CIRCLES // Never used in the final game } EnGrasshopperNextAction; typedef enum { - /* 0 */ EN_GRASSHOPPER_BANK_STATE_BANKING, - /* 1 */ EN_GRASSHOPPER_BANK_STATE_DONE + /* 0 */ DRAGONFLY_BANK_STATE_BANKING, + /* 1 */ DRAGONFLY_BANK_STATE_DONE } EnGrasshopperBankState; typedef enum { - /* 0 */ EN_GRASSHOPPER_ANIM_RAISE_TAIL, - /* 1 */ EN_GRASSHOPPER_ANIM_LOWER_TAIL, - /* 2 */ EN_GRASSHOPPER_ANIM_FLY, - /* 3 */ EN_GRASSHOPPER_ANIM_ATTACK, - /* 4 */ EN_GRASSHOPPER_ANIM_HOVER, - /* 5 */ EN_GRASSHOPPER_ANIM_DAMAGE, - /* 6 */ EN_GRASSHOPPER_ANIM_DEAD, - /* 7 */ EN_GRASSHOPPER_ANIM_FALL + /* 0 */ DRAGONFLY_ANIM_RAISE_TAIL, + /* 1 */ DRAGONFLY_ANIM_LOWER_TAIL, + /* 2 */ DRAGONFLY_ANIM_FLY, + /* 3 */ DRAGONFLY_ANIM_ATTACK, + /* 4 */ DRAGONFLY_ANIM_HOVER, + /* 5 */ DRAGONFLY_ANIM_DAMAGE, + /* 6 */ DRAGONFLY_ANIM_DEAD, + /* 7 */ DRAGONFLY_ANIM_FALL } EnGrasshopperAnim; static s32 sOccupiedIndices[] = { false, false, false, false, false, }; -static s8 sLimbIndexToShadowBodyPartsIndex[DRAGONFLY_LIMB_MAX] = { - -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, 6, 7, -1, 8, 9, -1, 10, 11, -1, 12, 13, -1, -1, -1, +static s8 sLimbToShadowBodyParts[DRAGONFLY_LIMB_MAX] = { + BODYPART_NONE, // DRAGONFLY_LIMB_NONE + BODYPART_NONE, // DRAGONFLY_LIMB_ROOT + DRAGONFLY_SHADOW_BODYPART_0, // DRAGONFLY_LIMB_TAIL_SEGMENT_1 + DRAGONFLY_SHADOW_BODYPART_1, // DRAGONFLY_LIMB_TAIL_SEGMENT_2 + DRAGONFLY_SHADOW_BODYPART_2, // DRAGONFLY_LIMB_TAIL_SEGMENT_3 + DRAGONFLY_SHADOW_BODYPART_3, // DRAGONFLY_LIMB_TAIL_SEGMENT_4 + DRAGONFLY_SHADOW_BODYPART_4, // DRAGONFLY_LIMB_TAIL_TIP + DRAGONFLY_SHADOW_BODYPART_5, // DRAGONFLY_LIMB_THORAX + BODYPART_NONE, // DRAGONFLY_LIMB_LEFT_WING + BODYPART_NONE, // DRAGONFLY_LIMB_RIGHT_WING + DRAGONFLY_SHADOW_BODYPART_6, // DRAGONFLY_LIMB_BACK_LEFT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_7, // DRAGONFLY_LIMB_BACK_LEFT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_BACK_LEFT_FOOT + DRAGONFLY_SHADOW_BODYPART_8, // DRAGONFLY_LIMB_BACK_RIGHT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_9, // DRAGONFLY_LIMB_BACK_RIGHT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_BACK_RIGHT_FOOT + DRAGONFLY_SHADOW_BODYPART_10, // DRAGONFLY_LIMB_FRONT_LEFT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_11, // DRAGONFLY_LIMB_FRONT_LEFT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_FRONT_LEFT_FOOT + DRAGONFLY_SHADOW_BODYPART_12, // DRAGONFLY_LIMB_FRONT_RIGHT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_13, // DRAGONFLY_LIMB_FRONT_RIGHT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_FRONT_RIGHT_FOOT + BODYPART_NONE, // DRAGONFLY_LIMB_HEAD + BODYPART_NONE, // DRAGONFLY_LIMB_JAW }; -static s8 sParentBodyParts[DRAGONFLY_LIMB_MAX] = { - -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, -1, 12, -1, -1, -1, +// Should be `DRAGONFLY_SHADOW_BODYPART_MAX` +static s8 sParentShadowBodyParts[DRAGONFLY_LIMB_MAX] = { + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_0 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_1 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_2 + DRAGONFLY_SHADOW_BODYPART_0, // DRAGONFLY_SHADOW_BODYPART_3 + DRAGONFLY_SHADOW_BODYPART_1, // DRAGONFLY_SHADOW_BODYPART_4 + DRAGONFLY_SHADOW_BODYPART_2, // DRAGONFLY_SHADOW_BODYPART_5 + DRAGONFLY_SHADOW_BODYPART_3, // DRAGONFLY_SHADOW_BODYPART_6 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_7 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_8 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_9 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_10 + DRAGONFLY_SHADOW_BODYPART_6, // DRAGONFLY_SHADOW_BODYPART_11 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_12 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_13 + DRAGONFLY_SHADOW_BODYPART_8, // + BODYPART_NONE, // + BODYPART_NONE, // + DRAGONFLY_SHADOW_BODYPART_10, // + BODYPART_NONE, // + BODYPART_NONE, // + DRAGONFLY_SHADOW_BODYPART_12, // + BODYPART_NONE, // + BODYPART_NONE, // + BODYPART_NONE, // }; +// Should be `DRAGONFLY_SHADOW_BODYPART_MAX` static u8 sShadowSizes[DRAGONFLY_LIMB_MAX] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, // DRAGONFLY_SHADOW_BODYPART_0 + 0, // DRAGONFLY_SHADOW_BODYPART_1 + 0, // DRAGONFLY_SHADOW_BODYPART_2 + 0, // DRAGONFLY_SHADOW_BODYPART_3 + 0, // DRAGONFLY_SHADOW_BODYPART_4 + 0, // DRAGONFLY_SHADOW_BODYPART_5 + 0, // DRAGONFLY_SHADOW_BODYPART_6 + 0, // DRAGONFLY_SHADOW_BODYPART_7 + 0, // DRAGONFLY_SHADOW_BODYPART_8 + 0, // DRAGONFLY_SHADOW_BODYPART_9 + 0, // DRAGONFLY_SHADOW_BODYPART_10 + 0, // DRAGONFLY_SHADOW_BODYPART_11 + 0, // DRAGONFLY_SHADOW_BODYPART_12 + 0, // DRAGONFLY_SHADOW_BODYPART_13 + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // }; typedef enum { - /* 0x0 */ EN_GRASSHOPPER_DMGEFF_IMMUNE, // Deals no damage - /* 0x2 */ EN_GRASSHOPPER_DMGEFF_FIRE = 0x2, // Damages and sets the Dragonfly on fire - /* 0x3 */ EN_GRASSHOPPER_DMGEFF_FREEZE, // Damages and freezes the Dragonfly in ice - /* 0x4 */ EN_GRASSHOPPER_DMGEFF_LIGHT_ORB, // Damages and surrounds the Dragonfly with light orbs - /* 0xE */ EN_GRASSHOPPER_DMGEFF_HOOK = 0xE, // If hit by the Hookshot, it pulls the Dragonfly towards the player - /* 0xF */ EN_GRASSHOPPER_DMGEFF_NONE // Deals regular damage with no extra effect + /* 0x0 */ DRAGONFLY_DMGEFF_IMMUNE, // Deals no damage + /* 0x2 */ DRAGONFLY_DMGEFF_FIRE = 0x2, // Damages and sets the Dragonfly on fire + /* 0x3 */ DRAGONFLY_DMGEFF_FREEZE, // Damages and freezes the Dragonfly in ice + /* 0x4 */ DRAGONFLY_DMGEFF_LIGHT_ORB, // Damages and surrounds the Dragonfly with light orbs + /* 0xE */ DRAGONFLY_DMGEFF_HOOK = 0xE, // If hit by the Hookshot, it pulls the Dragonfly towards the player + /* 0xF */ DRAGONFLY_DMGEFF_NONE // Deals regular damage with no extra effect } EnDragonflyDamageEffect; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku Stick */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Horse trample */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Explosives */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora boomerang */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Normal arrow */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Hookshot */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_HOOK), - /* Goron punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Sword */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Goron pound */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_NONE), - /* Fire arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FIRE), - /* Ice arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FREEZE), - /* Light arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_LIGHT_ORB), - /* Goron spikes */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku spin */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku bubble */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku launch */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_NONE), - /* UNK_DMG_0x12 */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora barrier */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Normal shield */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Light ray */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Thrown object */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Spin attack */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Sword beam */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Normal Roll */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Unblockable */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Powder Keg */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_HOOK), + /* Deku Nut */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku Stick */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Explosives */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Hookshot */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_HOOK), + /* Goron punch */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora barrier */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Light ray */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Thrown object */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Normal Roll */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Unblockable */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Powder Keg */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_HOOK), }; ActorInit En_Grasshopper_InitVars = { @@ -211,7 +282,7 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 1.0f); this->actor.colChkInfo.damageTable = &sDamageTable; Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.home.pos); - this->action = EN_GRASSHOPPER_ACTION_FLY; + this->action = DRAGONFLY_ACTION_FLY; this->index = -1; for (i = 0; i < ARRAY_COUNT(sOccupiedIndices); i++) { @@ -229,12 +300,12 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gDragonflySkel, &gDragonflyFlyAnim, this->jointTable, this->morphTable, DRAGONFLY_LIMB_MAX); - this->type = EN_GRASSHOPPER_GET_TYPE(&this->actor); - if (this->type < EN_GRASSHOPPER_TYPE_UNUSED_NORMAL) { - this->type = EN_GRASSHOPPER_TYPE_NORMAL; + this->type = DRAGONFLY_GET_TYPE(&this->actor); + if (this->type < DRAGONFLY_TYPE_UNUSED_NORMAL) { + this->type = DRAGONFLY_TYPE_NORMAL; } - if (this->type != EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + if (this->type != DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED) { this->dragonflyScale = 0.01f; } else { this->dragonflyScale = 0.0f; @@ -263,25 +334,25 @@ void EnGrasshopper_Destroy(Actor* thisx, PlayState* play) { } static AnimationHeader* sAnimations[] = { - &gDragonflyRaiseTailAnim, // EN_GRASSHOPPER_ANIM_RAISE_TAIL - &gDragonflyLowerTailAnim, // EN_GRASSHOPPER_ANIM_LOWER_TAIL - &gDragonflyFlyAnim, // EN_GRASSHOPPER_ANIM_FLY - &gDragonflyAttackAnim, // EN_GRASSHOPPER_ANIM_ATTACK - &gDragonflyHoverAnim, // EN_GRASSHOPPER_ANIM_HOVER - &gDragonflyDamageAnim, // EN_GRASSHOPPER_ANIM_DAMAGE - &gDragonflyDeadAnim, // EN_GRASSHOPPER_ANIM_DEAD - &gDragonflyFallAnim, // EN_GRASSHOPPER_ANIM_FALL + &gDragonflyRaiseTailAnim, // DRAGONFLY_ANIM_RAISE_TAIL + &gDragonflyLowerTailAnim, // DRAGONFLY_ANIM_LOWER_TAIL + &gDragonflyFlyAnim, // DRAGONFLY_ANIM_FLY + &gDragonflyAttackAnim, // DRAGONFLY_ANIM_ATTACK + &gDragonflyHoverAnim, // DRAGONFLY_ANIM_HOVER + &gDragonflyDamageAnim, // DRAGONFLY_ANIM_DAMAGE + &gDragonflyDeadAnim, // DRAGONFLY_ANIM_DEAD + &gDragonflyFallAnim, // DRAGONFLY_ANIM_FALL }; static u8 sAnimationModes[] = { - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_RAISE_TAIL - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_LOWER_TAIL - ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_FLY - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_ATTACK - ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_HOVER - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DAMAGE - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DEAD - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_FALL + ANIMMODE_ONCE, // DRAGONFLY_ANIM_RAISE_TAIL + ANIMMODE_ONCE, // DRAGONFLY_ANIM_LOWER_TAIL + ANIMMODE_LOOP, // DRAGONFLY_ANIM_FLY + ANIMMODE_ONCE, // DRAGONFLY_ANIM_ATTACK + ANIMMODE_LOOP, // DRAGONFLY_ANIM_HOVER + ANIMMODE_ONCE, // DRAGONFLY_ANIM_DAMAGE + ANIMMODE_ONCE, // DRAGONFLY_ANIM_DEAD + ANIMMODE_ONCE, // DRAGONFLY_ANIM_FALL }; void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) { @@ -289,8 +360,8 @@ void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) { this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); morphFrames = 0.0f; - if ((animIndex == EN_GRASSHOPPER_ANIM_ATTACK) || (animIndex == EN_GRASSHOPPER_ANIM_HOVER) || - (animIndex == EN_GRASSHOPPER_ANIM_DAMAGE)) { + if ((animIndex == DRAGONFLY_ANIM_ATTACK) || (animIndex == DRAGONFLY_ANIM_HOVER) || + (animIndex == DRAGONFLY_ANIM_DAMAGE)) { morphFrames = -3.0f; } @@ -299,19 +370,19 @@ void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) { } void EnGrasshopper_RaiseTail(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_RAISE_TAIL); - if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { - this->decision = EN_GRASSHOPPER_DECISION_FLY; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_RAISE_TAIL); + if (this->decision != DRAGONFLY_DECISION_ROAM_IN_CIRCLES) { + this->decision = DRAGONFLY_DECISION_FLY; } - this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; + this->action = DRAGONFLY_ACTION_DECIDE_ACTION; this->actionFunc = EnGrasshopper_DecideAction; } void EnGrasshopper_LowerTail(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_LOWER_TAIL); - this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_LOWER_TAIL); + this->action = DRAGONFLY_ACTION_DECIDE_ACTION; + this->decision = DRAGONFLY_DECISION_ATTACK; this->actionFunc = EnGrasshopper_DecideAction; } @@ -319,13 +390,13 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (curFrame >= this->endFrame) { - if (this->decision == EN_GRASSHOPPER_DECISION_ATTACK) { + if (this->decision == DRAGONFLY_DECISION_ATTACK) { EnGrasshopper_SetupAttack(this); } else { Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.world.pos); this->flyingHomePos.y = this->actor.floorHeight + 90.0f; - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); - if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FLY); + if (this->decision != DRAGONFLY_DECISION_ROAM_IN_CIRCLES) { if (Player_GetMask(play) == PLAYER_MASK_STONE) { EnGrasshopper_SetupFly(this); } else { @@ -333,8 +404,8 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { } } else { this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; + this->decision = DRAGONFLY_DECISION_ATTACK; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } @@ -343,9 +414,9 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupFly(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FLY); this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; - this->action = EN_GRASSHOPPER_ACTION_FLY; + this->action = DRAGONFLY_ACTION_FLY; this->actionFunc = EnGrasshopper_Fly; } @@ -358,8 +429,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); diffX = this->flyingHomePos.x - this->actor.world.pos.x; diffZ = this->flyingHomePos.z - this->actor.world.pos.z; - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { this->bobPhase += 0xAF0; this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); @@ -377,8 +447,8 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { this->shouldTurn = false; } - //! @bug Unreachable code. To get here, the type must NOT be EN_GRASSHOPPER_TYPE_WOODFALL - if (this->type == EN_GRASSHOPPER_TYPE_WOODFALL) { + //! @bug Unreachable code. To get here, the type must NOT be DRAGONFLY_TYPE_WOODFALL + if (this->type == DRAGONFLY_TYPE_WOODFALL) { if (sqrtf(SQ(this->actor.world.pos.x) + SQ(this->actor.world.pos.z)) < 600.0f) { this->shouldTurn = true; } @@ -478,8 +548,8 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupBank(EnGrasshopper* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); this->targetBankRot.y = this->actor.world.rot.y + 0x8000; - this->action = EN_GRASSHOPPER_ACTION_BANK; - this->bankState = EN_GRASSHOPPER_BANK_STATE_BANKING; + this->action = DRAGONFLY_ACTION_BANK; + this->bankState = DRAGONFLY_BANK_STATE_BANKING; this->actor.speed = 2.0f; this->actionFunc = EnGrasshopper_Bank; } @@ -491,21 +561,21 @@ void EnGrasshopper_SetupBank(EnGrasshopper* this) { void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); switch (this->bankState) { - case EN_GRASSHOPPER_BANK_STATE_BANKING: + case DRAGONFLY_BANK_STATE_BANKING: Math_SmoothStepToS(&this->actor.world.rot.y, this->targetBankRot.y, 0x64, 0x3E8, 0x3E8); Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 0x64, 0x1F40, 0xBB8); if (fabsf(this->actor.world.rot.y - (f32)this->targetBankRot.y) < 10.0f) { this->postBankTimer = 100; - this->bankState = EN_GRASSHOPPER_BANK_STATE_DONE; + this->bankState = DRAGONFLY_BANK_STATE_DONE; } break; - case EN_GRASSHOPPER_BANK_STATE_DONE: + case DRAGONFLY_BANK_STATE_DONE: Math_SmoothStepToS(&this->actor.world.rot.z, 0, 0x64, 0x1F40, 0xBB8); if (this->postBankTimer == 0) { this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; + this->decision = DRAGONFLY_DECISION_ATTACK; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } @@ -520,7 +590,7 @@ void EnGrasshopper_SetupBounced(EnGrasshopper* this) { this->targetRot.y = -this->actor.yawTowardsPlayer; this->timer = Rand_S16Offset(30, 30); this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; - this->action = EN_GRASSHOPPER_ACTION_BOUNCED; + this->action = DRAGONFLY_ACTION_BOUNCED; this->actionFunc = EnGrasshopper_Bounced; } @@ -540,7 +610,7 @@ void EnGrasshopper_Bounced(EnGrasshopper* this, PlayState* play) { if (this->timer == 0) { this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } @@ -551,7 +621,7 @@ void EnGrasshopper_SetupApproachPlayer(EnGrasshopper* this, PlayState* play) { Player* player = GET_PLAYER(play); this->timer = 50; - this->action = EN_GRASSHOPPER_ACTION_APPROACH_PLAYER; + this->action = DRAGONFLY_ACTION_APPROACH_PLAYER; this->approachSpeed = 0.0f; this->targetApproachPos.x = (Math_SinS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.x; this->targetApproachPos.z = (Math_CosS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.z; @@ -602,7 +672,7 @@ void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupAttack(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_ATTACK); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_ATTACK); this->approachSpeed = 0.0f; Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); this->actor.speed = 3.0f; @@ -610,7 +680,7 @@ void EnGrasshopper_SetupAttack(EnGrasshopper* this) { this->collider.elements[0].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); this->collider.elements[1].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_ATTACK); - this->action = EN_GRASSHOPPER_ACTION_ATTACK; + this->action = DRAGONFLY_ACTION_ATTACK; this->actionFunc = EnGrasshopper_Attack; } @@ -671,11 +741,11 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupWaitAfterAttack(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_HOVER); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_HOVER); this->bobPhase += 0xAF0; this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); - this->action = EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK; + this->action = DRAGONFLY_ACTION_WAIT_AFTER_ATTACK; this->waitTimer = 20; this->actor.speed = 0.0f; this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); @@ -698,7 +768,7 @@ void EnGrasshopper_WaitAfterAttack(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { Vec3f damagedVelocity; - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DAMAGE); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_DAMAGE); this->actor.speed = 0.0f; this->actor.flags |= ACTOR_FLAG_1; this->approachSpeed = 0.0f; @@ -709,13 +779,13 @@ void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->drawDmgEffTimer != 0)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - this->action = EN_GRASSHOPPER_ACTION_DAMAGED; + this->action = DRAGONFLY_ACTION_DAMAGED; this->actionFunc = EnGrasshopper_Damaged; } @@ -727,7 +797,7 @@ void EnGrasshopper_Damaged(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DEAD); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_DEAD); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.speed = 0.0f; this->approachSpeed = 0.0f; @@ -742,7 +812,7 @@ void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_DEAD); - this->action = EN_GRASSHOPPER_ACTION_DEAD; + this->action = DRAGONFLY_ACTION_DEAD; this->actionFunc = EnGrasshopper_Dead; } @@ -756,7 +826,7 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->drawDmgEffTimer < 2)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -768,8 +838,8 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupFall(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FALL); - this->action = EN_GRASSHOPPER_ACTION_FALL; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FALL); + this->action = DRAGONFLY_ACTION_FALL; this->actor.speed = 0.0f; this->approachSpeed = 0.0f; this->actionFunc = EnGrasshopper_Fall; @@ -811,7 +881,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX)) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->drawDmgEffTimer != 0)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -853,15 +923,15 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT)) { this->collider.base.acFlags &= ~AC_HIT; - if ((this->action != EN_GRASSHOPPER_ACTION_DAMAGED) && (this->action != EN_GRASSHOPPER_ACTION_DEAD) && - (this->action != EN_GRASSHOPPER_ACTION_FALL)) { - if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_NONE) { + if ((this->action != DRAGONFLY_ACTION_DAMAGED) && (this->action != DRAGONFLY_ACTION_DEAD) && + (this->action != DRAGONFLY_ACTION_FALL)) { + if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_NONE) { attackDealsDamage = true; - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FIRE) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_FIRE) { this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; attackDealsDamage = true; - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FREEZE) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_FREEZE) { if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_BLUE_FIRE) || (this->drawDmgEffTimer == 0)) { Actor_ApplyDamage(&this->actor); attackDealsDamage = false; @@ -875,7 +945,7 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { EnGrasshopper_SetupDead(this, play); return; } - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_LIGHT_ORB) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_LIGHT_ORB) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, 255, COLORFILTER_BUFFLAG_OPA, 25); this->drawDmgEffTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; @@ -920,14 +990,14 @@ void EnGrasshopper_Update(Actor* thisx, PlayState* play) { Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); Math_ApproachZeroF(&this->damagedVelocity.y, 1.0f, 2.0f); Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); - if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->action != DRAGONFLY_ACTION_FALL) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } this->actor.shape.rot.z = this->actor.world.rot.z; - if (this->type == EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + if (this->type == DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED) { f32 targetScale = this->type * 0.01f; if (targetScale >= 0.018f) { @@ -937,15 +1007,15 @@ void EnGrasshopper_Update(Actor* thisx, PlayState* play) { Math_ApproachF(&this->dragonflyScale, targetScale, 0.1f, 0.01f); } - if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->action != EN_GRASSHOPPER_ACTION_APPROACH_PLAYER)) { + if ((this->action != DRAGONFLY_ACTION_FALL) && (this->action != DRAGONFLY_ACTION_APPROACH_PLAYER)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 5, 0x3E8, 5); } EnGrasshopper_UpdateEffects(this, play); - if ((this->action != EN_GRASSHOPPER_ACTION_DEAD) && (this->action != EN_GRASSHOPPER_ACTION_FALL)) { + if ((this->action != DRAGONFLY_ACTION_DEAD) && (this->action != DRAGONFLY_ACTION_FALL)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if ((this->action == EN_GRASSHOPPER_ACTION_APPROACH_PLAYER) || (this->action == EN_GRASSHOPPER_ACTION_ATTACK)) { + if ((this->action == DRAGONFLY_ACTION_APPROACH_PLAYER) || (this->action == DRAGONFLY_ACTION_ATTACK)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -958,10 +1028,9 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec Matrix_Push(); - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { - if ((s8)(sLimbIndexToShadowBodyPartsIndex[limbIndex] >= 0)) { - Matrix_MultVec3f(&sZeroVec3f, &this->shadowBodyPartsPos[sLimbIndexToShadowBodyPartsIndex[limbIndex]]); + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { + if ((s8)(sLimbToShadowBodyParts[limbIndex] > BODYPART_NONE)) { + Matrix_MultVec3f(&sZeroVec3f, &this->shadowBodyPartsPos[sLimbToShadowBodyParts[limbIndex]]); } } @@ -972,6 +1041,7 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } Collider_UpdateSpheres(limbIndex, &this->collider); + if ((limbIndex == DRAGONFLY_LIMB_ROOT) || (limbIndex == DRAGONFLY_LIMB_TAIL_SEGMENT_2) || (limbIndex == DRAGONFLY_LIMB_TAIL_TIP) || (limbIndex == DRAGONFLY_LIMB_BACK_LEFT_UPPER_LEG) || (limbIndex == DRAGONFLY_LIMB_BACK_RIGHT_UPPER_LEG) || (limbIndex == DRAGONFLY_LIMB_FRONT_LEFT_UPPER_LEG) || @@ -983,25 +1053,20 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec // While checking for DRAGONFLY_LIMB_ROOT twice is not a bug by itself, it causes another bug below. (limbIndex == DRAGONFLY_LIMB_ROOT)) { //! @bug: This code only works properly if all 12 elements of bodyPartsPos are updated every frame, since - //! otherwise bodyPartsPosIndex will be non-zero at the end of a frame. Despite the fact that there are 12 + //! otherwise bodyPartIndex will be non-zero at the end of a frame. Despite the fact that there are 12 //! checks in the above if-statement, only 9 of them are valid and non-duplicate, so only 9 elements of //! bodyPartsPos are updated on each frame. As a result, three elements in bodyPartsPos will either be (0, 0, 0) //! or be a value carried over from the previous frame. - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= DRAGONFLY_BODYPART_MAX) { + this->bodyPartIndex = 0; } } Matrix_Pop(); } -// We need to pass in 14 into SubS_GenShadowTex for the bodyPartsNum, NOT the actual size of the -// parent body parts array. This is both necessary to match and to prevent extra dots from being -// drawn with the shadow. -#define SHADOW_BODY_PARTS_NUM 14 - void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { EnGrasshopper* this = THIS; s32 i; @@ -1011,17 +1076,17 @@ void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnGrasshopper_PostLimbDraw, &this->actor); - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { Matrix_RotateXS(0, MTXMODE_NEW); for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) { - *shadowTexIter++ = 0; + *shadowTexIter = 0; + shadowTexIter++; } for (i = 0; i < 5; i++) { SubS_GenShadowTex(this->shadowBodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, - SHADOW_BODY_PARTS_NUM, sShadowSizes, sParentBodyParts); + DRAGONFLY_SHADOW_BODYPART_MAX, sShadowSizes, sParentShadowBodyParts); //! FAKE: Needed to fix some regs and stack //! https://decomp.me/scratch/4wJBW if ((shadowTex && shadowTex) && shadowTex) {} @@ -1046,9 +1111,8 @@ void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } EnGrasshopper_DrawEffects(this, play); diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h index 049091393a..8677bb9f22 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h @@ -4,20 +4,20 @@ #include "global.h" #include "objects/object_grasshopper/object_grasshopper.h" -#define EN_GRASSHOPPER_GET_TYPE(thisx) ((thisx)->params) +#define DRAGONFLY_GET_TYPE(thisx) ((thisx)->params) -#define EN_GRASSHOPPER_PARAMS(type) (type) +#define DRAGONFLY_PARAMS(type) (type) struct EnGrasshopper; typedef void (*EnGrasshopperActionFunc)(struct EnGrasshopper*, PlayState*); typedef enum EnGrasshopperType { - /* -1 */ EN_GRASSHOPPER_TYPE_UNUSED_NORMAL = -1, // Acts exactly like EN_GRASSHOPPER_TYPE_NORMAL - /* 0 */ EN_GRASSHOPPER_TYPE_NORMAL, - /* 1 */ EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED, // Spawned by EnEncount1 - /* 2 */ EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM, - /* 3 */ EN_GRASSHOPPER_TYPE_WOODFALL + /* -1 */ DRAGONFLY_TYPE_UNUSED_NORMAL = -1, // Acts exactly like DRAGONFLY_TYPE_NORMAL + /* 0 */ DRAGONFLY_TYPE_NORMAL, + /* 1 */ DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED, // Spawned by EnEncount1 + /* 2 */ DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM, + /* 3 */ DRAGONFLY_TYPE_WOODFALL } EnGrasshopperType; typedef struct EnGrasshopperEffect { @@ -30,7 +30,41 @@ typedef struct EnGrasshopperEffect { /* 0x2E */ s16 lightningIndex; } EnGrasshopperEffect; // size = 0x30 -#define EN_GRASSHOPPER_EFFECT_COUNT 100 +#define DRAGONFLY_EFFECT_COUNT 100 + +typedef enum EnGrasshopperBodyPart { + /* 0 */ DRAGONFLY_BODYPART_0, + /* 1 */ DRAGONFLY_BODYPART_1, + /* 2 */ DRAGONFLY_BODYPART_2, + /* 3 */ DRAGONFLY_BODYPART_3, + /* 4 */ DRAGONFLY_BODYPART_4, + /* 5 */ DRAGONFLY_BODYPART_5, + /* 6 */ DRAGONFLY_BODYPART_6, + /* 7 */ DRAGONFLY_BODYPART_7, + /* 8 */ DRAGONFLY_BODYPART_8, + /* 9 */ DRAGONFLY_BODYPART_9, + /* 10 */ DRAGONFLY_BODYPART_10, + /* 11 */ DRAGONFLY_BODYPART_11, + /* 12 */ DRAGONFLY_BODYPART_MAX +} EnGrasshopperBodyPart; + +typedef enum EnGrasshopperShadowBodyPart { + /* 0 */ DRAGONFLY_SHADOW_BODYPART_0, + /* 1 */ DRAGONFLY_SHADOW_BODYPART_1, + /* 2 */ DRAGONFLY_SHADOW_BODYPART_2, + /* 3 */ DRAGONFLY_SHADOW_BODYPART_3, + /* 4 */ DRAGONFLY_SHADOW_BODYPART_4, + /* 5 */ DRAGONFLY_SHADOW_BODYPART_5, + /* 6 */ DRAGONFLY_SHADOW_BODYPART_6, + /* 7 */ DRAGONFLY_SHADOW_BODYPART_7, + /* 8 */ DRAGONFLY_SHADOW_BODYPART_8, + /* 9 */ DRAGONFLY_SHADOW_BODYPART_9, + /* 10 */ DRAGONFLY_SHADOW_BODYPART_10, + /* 11 */ DRAGONFLY_SHADOW_BODYPART_11, + /* 12 */ DRAGONFLY_SHADOW_BODYPART_12, + /* 13 */ DRAGONFLY_SHADOW_BODYPART_13, + /* 14 */ DRAGONFLY_SHADOW_BODYPART_MAX +} EnGrasshopperShadowBodyPart; typedef struct EnGrasshopper { /* 0x0000 */ Actor actor; @@ -48,8 +82,8 @@ typedef struct EnGrasshopper { /* 0x02B8 */ s16 drawDmgEffType; /* 0x02BC */ f32 drawDmgEffScale; /* 0x02C0 */ f32 drawDmgEffFrozenSteamScale; - /* 0x02C4 */ Vec3f bodyPartsPos[12]; - /* 0x0354 */ s16 bodyPartsPosIndex; + /* 0x02C4 */ Vec3f bodyPartsPos[DRAGONFLY_BODYPART_MAX]; + /* 0x0354 */ s16 bodyPartIndex; /* 0x0356 */ s16 splashCount; /* 0x0358 */ s16 action; /* 0x035A */ s16 index; // Has a minor effect on speed for some reason. @@ -68,13 +102,13 @@ typedef struct EnGrasshopper { /* 0x03B4 */ Vec3f targetApproachPos; /* 0x03C0 */ Vec3f tailTipPos; /* 0x03CC */ Vec3f effectBasePos; - /* 0x03D8 */ Vec3f shadowBodyPartsPos[DRAGONFLY_LIMB_MAX]; + /* 0x03D8 */ Vec3f shadowBodyPartsPos[DRAGONFLY_LIMB_MAX]; // Should be `DRAGONFLY_SHADOW_BODYPART_MAX` /* 0x04F8 */ f32 waterSurface; /* 0x04FC */ Vec3f damagedVelocity; /* 0x0508 */ Vec3s targetBankRot; /* 0x0510 */ ColliderJntSph collider; /* 0x0530 */ ColliderJntSphElement colliderElements[2]; - /* 0x0570 */ EnGrasshopperEffect effects[EN_GRASSHOPPER_EFFECT_COUNT]; + /* 0x0570 */ EnGrasshopperEffect effects[DRAGONFLY_EFFECT_COUNT]; } EnGrasshopper; // size = 0x1870 #endif // Z_EN_GRASSHOPPER_H diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index c38d6070d2..cb98123901 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -783,26 +783,26 @@ void func_80C21468(EnHintSkb* this, PlayState* play) { static Color_RGBA8 D_80C21E48 = { 200, 200, 255, 255 }; static Vec3f D_80C21E4C = { 0.0f, -1.0f, 0.0f }; Vec3f sp84; - s32 phi_s4; + s32 bodyPartsCount; s16 temp_s1; s32 i; if (this->unk_3E8 & 2) { - phi_s4 = ARRAY_COUNT(this->limbPos) - 1; + bodyPartsCount = ENHINTSKB_BODYPART_MAX - 1; } else { - phi_s4 = ARRAY_COUNT(this->limbPos); + bodyPartsCount = ENHINTSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < phi_s4; i++) { - temp_s1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + temp_s1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(temp_s1) * 3.0f; sp84.z = Math_CosS(temp_s1) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); } } @@ -891,11 +891,11 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } else if ((limbIndex == 11) && !(this->unk_3E8 & 2)) { - Matrix_MultVec3f(&D_80C21E70, &this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultVec3f(&D_80C21E70, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -904,13 +904,13 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnHintSkb_Draw(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintSkb_OverrideLimbDraw, EnHintSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if (this->unk_3E8 & 4) { diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h index 22f72084d6..e263b9de06 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h @@ -9,16 +9,34 @@ typedef void (*EnHintSkbActionFunc)(struct EnHintSkb*, PlayState*); #define ENHINTSKB_GET_FF(thisx) ((thisx)->params & 0xFF) +typedef enum EnHintSkbBodyPart { + /* 0 */ ENHINTSKB_BODYPART_0, + /* 1 */ ENHINTSKB_BODYPART_1, + /* 2 */ ENHINTSKB_BODYPART_2, + /* 3 */ ENHINTSKB_BODYPART_3, + /* 4 */ ENHINTSKB_BODYPART_4, + /* 5 */ ENHINTSKB_BODYPART_5, + /* 6 */ ENHINTSKB_BODYPART_6, + /* 7 */ ENHINTSKB_BODYPART_7, + /* 8 */ ENHINTSKB_BODYPART_8, + /* 9 */ ENHINTSKB_BODYPART_9, + /* 10 */ ENHINTSKB_BODYPART_10, + /* 11 */ ENHINTSKB_BODYPART_11, + /* 12 */ ENHINTSKB_BODYPART_12, + /* 13 */ ENHINTSKB_BODYPART_13, + /* 14 */ ENHINTSKB_BODYPART_MAX +} EnHintSkbBodyPart; + typedef struct EnHintSkb { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colliderElement[2]; /* 0x1E4 */ SkelAnime skelAnime; /* 0x228 */ EnHintSkbActionFunc actionFunc; - /* 0x22C */ Vec3f limbPos[14]; + /* 0x22C */ Vec3f bodyPartsPos[ENHINTSKB_BODYPART_MAX]; /* 0x2D4 */ f32 drawDmgEffAlpha; /* 0x2D8 */ f32 drawDmgEffScale; - /* 0x2DC */ s32 limbCount; + /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ Vec3s jointTable[20]; /* 0x358 */ Vec3s morphtable[20]; /* 0x3D0 */ UNK_TYPE1 unk3D0[0xC]; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index e7473e7d32..16c19e3ec7 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -286,7 +286,7 @@ void func_80BF14B0(EnIg* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_2A8->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_2A8)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_2A8)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_2A8->focus.pos); } 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 a6565d01b7..636ab6bdfb 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -54,14 +54,14 @@ typedef struct { /* 0x4 */ s16 unk04; } EnIkUnkStruct; // size = 0x8 -EnIkUnkStruct sIronKnuckleArmorMarkings[] = { - { gIronKnuckleHelmetMarkingDL, 0x0000 }, - { gIronKnuckleFrontTorsoArmorMarkingDL, 0x0000 }, - { gIronKnuckleRearTorsoArmorMarkingDL, 0x7FFF }, - { gIronKnuckleRivetsMarking2DL, 0x4000 }, - { gIronKnuckleRivetsMarking1DL, 0xC000 }, - { NULL, 0x4000 }, - { NULL, 0xC000 }, +EnIkUnkStruct sIronKnuckleArmorMarkings[IRON_KNUCKLE_ARMOR_BODYPART_MAX] = { + { gIronKnuckleHelmetMarkingDL, 0x0000 }, // IRON_KNUCKLE_ARMOR_BODYPART_HELMET + { gIronKnuckleFrontTorsoArmorMarkingDL, 0x0000 }, // IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT + { gIronKnuckleRearTorsoArmorMarkingDL, 0x7FFF }, // IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK + { gIronKnuckleRivetsMarking2DL, 0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON + { gIronKnuckleRivetsMarking1DL, -0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON + { NULL, 0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON + { NULL, -0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON }; // sIronKnuckleArmorType[PARAM_VALUE][ARMOR_SECTIONS] @@ -307,7 +307,7 @@ void EnIk_Thaw(EnIk* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, IRON_KNUCKLE_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -356,7 +356,7 @@ s32 EnIk_ChooseAttack(EnIk* this) { void EnIk_CheckActions(EnIk* this, PlayState* play) { if (!EnIk_IsChangingAction(this, play) && !EnIk_ChooseAttack(this)) { - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { EnIk_SetupRun(this); } else { EnIk_SetupWalk(this); @@ -367,7 +367,7 @@ void EnIk_CheckActions(EnIk* this, PlayState* play) { void EnIk_SetupIdle(EnIk* this) { f32 frameCount = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->timer = 10; } else { this->timer = 0; @@ -455,7 +455,7 @@ void EnIk_SetupVerticalAttack(EnIk* this) { f32 playbackSpeed; this->actor.speed = 0.0f; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { playbackSpeed = 1.5f; } else { playbackSpeed = 1.2f; @@ -487,7 +487,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { this->colliderQuad.base.atFlags |= AT_ON; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; } } else { @@ -543,7 +543,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { } if (((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 9.0f)) || ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f))) { - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x5DC); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->skelAnime.curFrame > 12.0f) { @@ -567,7 +567,7 @@ void EnIk_SetupSingleHorizontalAttack(EnIk* this) { f32 playSpeed; this->actor.speed = 0.0f; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->actor.world.rot.z = 0x1000; playSpeed = 1.3f; } else { @@ -795,7 +795,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTableNoArmor; Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); EnIk_SetupCutscene(this); - } else if (this->drawArmorFlags) { + } else if (this->drawArmorFlags != 0) { if (this->actor.colChkInfo.damageEffect == DMG_EFF_ICE) { EnIk_Freeze(this); EnIk_SetupFrozen(this); @@ -928,32 +928,89 @@ void EnIk_Update(Actor* thisx, PlayState* play2) { EnIk_UpdateArmor(this, play); } -s8 D_8092C1A8[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3, 5, 4, 6, 1, 2, -1, -1, 0, 0, +static s8 sLimbToArmorBodyParts[IRON_KNUCKLE_LIMB_MAX] = { + BODYPART_NONE, // IRON_KNUCKLE_LIMB_NONE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_CENTER + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_RIGHT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_LEG + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_LEFT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_LEG + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_BODY_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UNK_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD_ROOT + IRON_KNUCKLE_ARMOR_BODYPART_HELMET, // IRON_KNUCKLE_LIMB_HELMET_ARMOR + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_UPPER_ARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_HAND + IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_LEFT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_RIGHT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT + IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TORSO + BODYPART_NONE, // IRON_KNUCKLE_LIMB_WAIST }; s32 EnIk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnIk* this = THIS; - if (this->drawArmorFlags) { - if (D_8092C1A8[limbIndex] > 0) { + if (this->drawArmorFlags != 0) { + if (sLimbToArmorBodyParts[limbIndex] >= IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT) { *dList = NULL; } } return false; } -void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_8092C1C8 = { 2000.0f, -200.0f, -5200.0f }; - static Vec3f D_8092C1D4 = { 300.0f, -200.0f, 0.0f }; - static s8 limbPosIndex[] = { - -1, -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, -1, 6, -1, -1, 7, - -1, -1, 8, -1, 9, 10, -1, 11, -1, 12, -1, -1, -1, -1, 0, 0, - }; +static Vec3f D_8092C1C8 = { 2000.0f, -200.0f, -5200.0f }; +static Vec3f D_8092C1D4 = { 300.0f, -200.0f, 0.0f }; +static s8 sLimbToBodyParts[IRON_KNUCKLE_LIMB_MAX] = { + BODYPART_NONE, // IRON_KNUCKLE_LIMB_NONE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_CENTER + IRON_KNUCKLE_BODYPART_TASSET_RIGHT, // IRON_KNUCKLE_LIMB_TASSET_RIGHT + IRON_KNUCKLE_BODYPART_RIGHT_LEG, // IRON_KNUCKLE_LIMB_RIGHT_LEG + IRON_KNUCKLE_BODYPART_RIGHT_FOOT, // IRON_KNUCKLE_LIMB_RIGHT_FOOT + IRON_KNUCKLE_BODYPART_TASSET_LEFT, // IRON_KNUCKLE_LIMB_TASSET_LEFT + IRON_KNUCKLE_BODYPART_LEFT_LEG, // IRON_KNUCKLE_LIMB_LEFT_LEG + IRON_KNUCKLE_BODYPART_LEFT_FOOT, // IRON_KNUCKLE_LIMB_LEFT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_BODY_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UNK_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD_ROOT + IRON_KNUCKLE_BODYPART_HELMET_ARMOR, // IRON_KNUCKLE_LIMB_HELMET_ARMOR + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_UPPER_ARM + IRON_KNUCKLE_BODYPART_RIGHT_FOREARM, // IRON_KNUCKLE_LIMB_RIGHT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE + IRON_KNUCKLE_BODYPART_RIGHT_HAND, // IRON_KNUCKLE_LIMB_RIGHT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_UPPER_ARM + IRON_KNUCKLE_BODYPART_LEFT_FOREARM, // IRON_KNUCKLE_LIMB_LEFT_FOREARM + IRON_KNUCKLE_BODYPART_LEFT_HAND, // IRON_KNUCKLE_LIMB_LEFT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON + IRON_KNUCKLE_BODYPART_LOWER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_LEFT_PAULDRON + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON + IRON_KNUCKLE_BODYPART_LOWER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_RIGHT_PAULDRON + BODYPART_NONE, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TORSO + BODYPART_NONE, // IRON_KNUCKLE_LIMB_WAIST +}; + +void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnIk* this = THIS; - s32 index = D_8092C1A8[limbIndex]; + s32 armorBodyPart = sLimbToArmorBodyParts[limbIndex]; Gfx* xlu; IronKnuckleEffect* ikEffect; s16 sp76; @@ -964,15 +1021,16 @@ void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, MtxF* mf; if (this->drawArmorFlags == 0x1) { - if (index > 0) { - ikEffect = &this->effects[index]; + if (armorBodyPart >= IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT) { + ikEffect = &this->effects[armorBodyPart]; mf = Matrix_GetCurrent(); ikEffect->pos.x = mf->mf[3][0]; ikEffect->pos.y = mf->mf[3][1]; ikEffect->pos.z = mf->mf[3][2]; Matrix_MtxFToYXZRot(mf, &ikEffect->rot, false); ikEffect->enabled = true; - sp76 = sIronKnuckleArmorMarkings[index].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); + sp76 = + sIronKnuckleArmorMarkings[armorBodyPart].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); ikEffect->vel.x = Math_SinS(sp76) * 5.0f; ikEffect->vel.y = 6.0f; ikEffect->vel.z = Math_CosS(sp76) * 5.0f; @@ -1004,18 +1062,19 @@ void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->blurEffectSpawnLock = this->timer; } - if (limbPosIndex[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[limbPosIndex[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if ((index == 0) || - ((index != -1) && (this->drawArmorFlags == 0) && (sIronKnuckleArmorMarkings[index].unk00 != 0))) { + if ((armorBodyPart == IRON_KNUCKLE_ARMOR_BODYPART_HELMET) || + ((armorBodyPart != BODYPART_NONE) && (this->drawArmorFlags == 0) && + (sIronKnuckleArmorMarkings[armorBodyPart].unk00 != NULL))) { OPEN_DISPS(play->state.gfxCtx); xlu = POLY_XLU_DISP; gSPMatrix(&xlu[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&xlu[1], sIronKnuckleArmorMarkings[index].unk00); + gSPDisplayList(&xlu[1], sIronKnuckleArmorMarkings[armorBodyPart].unk00); POLY_XLU_DISP = &xlu[2]; CLOSE_DISPS(play->state.gfxCtx); @@ -1095,7 +1154,7 @@ void EnIk_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } func_800BC620(&this->actor.focus.pos, &sScale, 255, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, IRON_KNUCKLE_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 3489329b1d..0d1625144c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -24,6 +24,34 @@ typedef struct { /* 0x24 */ s32 enabled; } IronKnuckleEffect; // size = 0x28 +typedef enum IronKnuckleBodyPart { + /* 0 */ IRON_KNUCKLE_BODYPART_TASSET_RIGHT, + /* 1 */ IRON_KNUCKLE_BODYPART_RIGHT_LEG, + /* 2 */ IRON_KNUCKLE_BODYPART_RIGHT_FOOT, + /* 3 */ IRON_KNUCKLE_BODYPART_TASSET_LEFT, + /* 4 */ IRON_KNUCKLE_BODYPART_LEFT_LEG, + /* 5 */ IRON_KNUCKLE_BODYPART_LEFT_FOOT, + /* 6 */ IRON_KNUCKLE_BODYPART_HELMET_ARMOR, + /* 7 */ IRON_KNUCKLE_BODYPART_RIGHT_FOREARM, + /* 8 */ IRON_KNUCKLE_BODYPART_RIGHT_HAND, + /* 9 */ IRON_KNUCKLE_BODYPART_LEFT_FOREARM, + /* 10 */ IRON_KNUCKLE_BODYPART_LEFT_HAND, + /* 11 */ IRON_KNUCKLE_BODYPART_LOWER_LEFT_PAULDRON, + /* 12 */ IRON_KNUCKLE_BODYPART_LOWER_RIGHT_PAULDRON, + /* 13 */ IRON_KNUCKLE_BODYPART_MAX +} IronKnuckleBodyPart; + +typedef enum IronKnuckleArmorBodyPart { + /* 0 */ IRON_KNUCKLE_ARMOR_BODYPART_HELMET, + /* 1 */ IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT, + /* 2 */ IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK, + /* 3 */ IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON, + /* 4 */ IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON, + /* 5 */ IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON, + /* 6 */ IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON, + /* 7 */ IRON_KNUCKLE_ARMOR_BODYPART_MAX +} IronKnuckleArmorBodyPart; + typedef struct EnIk { /* 0x0000 */ Actor actor; /* 0x0144 */ SkelAnime skelAnime; @@ -40,12 +68,12 @@ typedef struct EnIk { /* 0x0304 */ f32 drawDmgEffAlpha; /* 0x0308 */ f32 drawDmgEffScale; /* 0x030C */ f32 drawDmgEffFrozenSteamScale; - /* 0x0310 */ Vec3f limbPos[13]; + /* 0x0310 */ Vec3f bodyPartsPos[IRON_KNUCKLE_BODYPART_MAX]; /* 0x03AC */ ColliderCylinder colliderCylinder; /* 0x03F8 */ ColliderQuad colliderQuad; /* 0x0478 */ ColliderTris colliderTris; /* 0x0498 */ ColliderTrisElement shieldColliderItems[2]; - /* 0x0550 */ IronKnuckleEffect effects[7]; + /* 0x0550 */ IronKnuckleEffect effects[IRON_KNUCKLE_ARMOR_BODYPART_MAX]; } EnIk; // size = 0x668 #endif // Z_EN_IK_H diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 30e75cca14..e54b7ff267 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -1611,8 +1611,7 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, - 0.7f, 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; @@ -1634,8 +1633,7 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->unk_2B8 != 0)) { - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, - 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; @@ -1714,8 +1712,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { if (this->unk_2B8 == 0) { return; } - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, - 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -2117,11 +2114,11 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* (limbIndex == KAIZOKU_LIMB_0D) || (limbIndex == KAIZOKU_LIMB_0F) || (limbIndex == KAIZOKU_LIMB_11) || (limbIndex == KAIZOKU_LIMB_12) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_14) || (limbIndex == KAIZOKU_LIMB_15) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_17)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + this->bodyPartIndex++; + if (this->bodyPartIndex >= KAIZOKU_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -2167,7 +2164,7 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 6366c4f7fd..e2c53d34b2 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -35,6 +35,25 @@ typedef enum EnKaizokuAnimation { /* 19 */ EN_KAIZOKU_ANIM_MAX } EnKaizokuAnimation; +typedef enum EnKaizokuBodyPart { + /* 0 */ KAIZOKU_BODYPART_0, + /* 1 */ KAIZOKU_BODYPART_1, + /* 2 */ KAIZOKU_BODYPART_2, + /* 3 */ KAIZOKU_BODYPART_3, + /* 4 */ KAIZOKU_BODYPART_4, + /* 5 */ KAIZOKU_BODYPART_5, + /* 6 */ KAIZOKU_BODYPART_6, + /* 7 */ KAIZOKU_BODYPART_7, + /* 8 */ KAIZOKU_BODYPART_8, + /* 9 */ KAIZOKU_BODYPART_9, + /* 10 */ KAIZOKU_BODYPART_10, + /* 11 */ KAIZOKU_BODYPART_11, + /* 12 */ KAIZOKU_BODYPART_12, + /* 13 */ KAIZOKU_BODYPART_13, + /* 14 */ KAIZOKU_BODYPART_14, + /* 15 */ KAIZOKU_BODYPART_MAX +} EnKaizokuBodyPart; + typedef struct EnKaizoku { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; @@ -64,13 +83,13 @@ typedef struct EnKaizoku { /* 0x2DC */ f32 frameCount; /* 0x2E0 */ f32 unk_2E0; /* 0x2E4 */ EnKaizokuAnimation animIndex; - /* 0x2E8 */ s32 bodyPartsPosIndex; + /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 unk_2EC; /* 0x2F0 */ f32 unk_2F0; /* 0x2F4 */ s16 unk_2F4; /* 0x2F8 */ Vec3f unk_2F8; /* 0x304 */ Vec3f unk_304; - /* 0x310 */ Vec3f bodyPartsPos[15]; + /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; /* 0x3C4 */ Vec3f unk_3C4; /* 0x3D0 */ s32 blureIndex; /* 0x3D4 */ ColliderCylinder bodyCollider; diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index 49b3e44520..91c4ac9d4a 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -177,7 +177,7 @@ void func_80AD7018(EnKame* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, SNAPPER_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -764,16 +764,35 @@ s32 func_80AD8A48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s return false; } +static Vec3f D_80AD8E68[] = { + { 1500.0f, 0.0f, -2000.0f }, // SNAPPER_BODYPART_5 + { 1500.0f, 0.0f, 2000.0f }, // SNAPPER_BODYPART_6 + { 1500.0f, 2000.0f, 0.0f }, // SNAPPER_BODYPART_7 + { 1500.0f, -2000.0f, 0.0f }, // SNAPPER_BODYPART_8 + { 2500.0f, 0.0f, 0.0f }, // SNAPPER_BODYPART_9 +}; + +static s8 sLimbToBodyParts[SNAPPER_LIMB_MAX] = { + BODYPART_NONE, // SNAPPER_LIMB_NONE + BODYPART_NONE, // SNAPPER_LIMB_BODY + BODYPART_NONE, // SNAPPER_LIMB_HEAD + SNAPPER_BODYPART_JAW, // SNAPPER_LIMB_JAW + BODYPART_NONE, // SNAPPER_LIMB_EYES + BODYPART_NONE, // SNAPPER_LIMB_FRONT_LEFT_LEG + SNAPPER_BODYPART_FRONT_LEFT_FOOT, // SNAPPER_LIMB_FRONT_LEFT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_FRONT_RIGHT_LEG + SNAPPER_BODYPART_FRONT_RIGHT_FOOT, // SNAPPER_LIMB_FRONT_RIGHT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_BACK_LEFT_LEG + SNAPPER_BODYPART_BACK_LEFT_FOOT, // SNAPPER_LIMB_BACK_LEFT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_BACK_RIGHT_LEG + SNAPPER_BODYPART_BACK_RIGHT_FOOT, // SNAPPER_LIMB_BACK_RIGHT_FOOT +}; + void func_80AD8AF8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80AD8E68[] = { - { 1500.0f, 0.0f, -2000.0f }, { 1500.0f, 0.0f, 2000.0f }, { 1500.0f, 2000.0f, 0.0f }, - { 1500.0f, -2000.0f, 0.0f }, { 2500.0f, 0.0f, 0.0f }, - }; - static s8 D_80AD8EA4[] = { -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, 3, -1, 4 }; EnKame* this = THIS; - if (D_80AD8EA4[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80AD8EA4[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == SNAPPER_LIMB_BODY) { @@ -786,7 +805,7 @@ void func_80AD8AF8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto } ptr2 = D_80AD8E68; - ptr = &this->limbPos[5]; + ptr = &this->bodyPartsPos[SNAPPER_BODYPART_5]; for (i = 0; i < ARRAY_COUNT(D_80AD8E68); i++) { Matrix_MultVec3f(ptr2, ptr); ptr2++; @@ -811,7 +830,7 @@ void EnKame_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->snapperSkelAnime.skeleton, this->snapperSkelAnime.jointTable, this->snapperSkelAnime.dListCount, func_80AD8A48, func_80AD8AF8, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, SNAPPER_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); if (this->actor.shape.shadowDraw == NULL) { diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.h b/src/overlays/actors/ovl_En_Kame/z_en_kame.h index f721e3ed83..31095bf224 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.h +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.h @@ -8,6 +8,20 @@ struct EnKame; typedef void (*EnKameActionFunc)(struct EnKame*, PlayState*); +typedef enum SnapperBodyPart { + /* 0 */ SNAPPER_BODYPART_JAW, + /* 1 */ SNAPPER_BODYPART_FRONT_LEFT_FOOT, + /* 2 */ SNAPPER_BODYPART_FRONT_RIGHT_FOOT, + /* 3 */ SNAPPER_BODYPART_BACK_LEFT_FOOT, + /* 4 */ SNAPPER_BODYPART_BACK_RIGHT_FOOT, + /* 5 */ SNAPPER_BODYPART_5, + /* 6 */ SNAPPER_BODYPART_6, + /* 7 */ SNAPPER_BODYPART_7, + /* 8 */ SNAPPER_BODYPART_8, + /* 9 */ SNAPPER_BODYPART_9, + /* 10 */ SNAPPER_BODYPART_MAX +} SnapperBodyPart; + typedef struct EnKame { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime snapperSkelAnime; @@ -30,7 +44,7 @@ typedef struct EnKame { /* 0x2B4 */ f32 drawDmgEffScale; /* 0x2B8 */ f32 drawDmgEffFrozenSteamScale; /* 0x2BC */ Vec3f unk_2BC; - /* 0x2C8 */ Vec3f limbPos[10]; + /* 0x2C8 */ Vec3f bodyPartsPos[SNAPPER_BODYPART_MAX]; /* 0x340 */ ColliderCylinder collider; } EnKame; // size = 0x38C diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 00c3291d76..8c234e1ae8 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -177,18 +177,18 @@ void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { } void EnKarebaba_SpawnIceEffects(EnKarebaba* this, PlayState* play) { - s32 limbPosCount; + s32 bodyPartsCount; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; if (this->actor.params == KAREBABA_MINI) { - limbPosCount = 1; + bodyPartsCount = 1; } else { - limbPosCount = 4; + bodyPartsCount = KAREBABA_BODYPART_MAX; } - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, limbPosCount, 4, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, bodyPartsCount, 4, 0.3f, 0.2f); } } @@ -654,7 +654,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; s32 i; s32 stemSections; - s16 limbCount; + s16 bodyPartsCount; f32 scale = 0.01f; OPEN_DISPS(play->state.gfxCtx); @@ -694,7 +694,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sStemDLists[i]); - Matrix_MultZero(&this->bodyPartsPos[1 + i]); + Matrix_MultZero(&this->bodyPartsPos[KAREBABA_BODYPART_1 + i]); if ((i == 0) && (this->actionFunc == EnKarebaba_Dying)) { Matrix_MultZero(&this->actor.focus.pos); } @@ -720,18 +720,18 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); - Matrix_MultZero(&this->bodyPartsPos[3]); + Matrix_MultZero(&this->bodyPartsPos[KAREBABA_BODYPART_3]); } func_800AE5A0(play); if (this->actor.params == KAREBABA_MINI) { - limbCount = 1; + bodyPartsCount = 1; } else { - limbCount = ARRAY_COUNT(this->bodyPartsPos); + bodyPartsCount = KAREBABA_BODYPART_MAX; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, limbCount, this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, bodyPartsCount, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); if (this->boundFloor != 0) { diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index 045bef42a0..f0edcdd0b0 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -14,6 +14,14 @@ typedef enum { /* 2 */ KAREBABA_MINI } KarebabaType; +typedef enum KarebabaBodyPart { + /* 0 */ KAREBABA_BODYPART_0, + /* 1 */ KAREBABA_BODYPART_1, + /* 2 */ KAREBABA_BODYPART_2, + /* 3 */ KAREBABA_BODYPART_3, + /* 4 */ KAREBABA_BODYPART_MAX +} KarebabaBodyPart; + typedef struct EnKarebaba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -25,7 +33,7 @@ typedef struct EnKarebaba { /* 0x1F0 */ f32 drawDmgEffAlpha; /* 0x1F4 */ f32 drawDmgEffScale; /* 0x1F8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x1FC */ Vec3f bodyPartsPos[4]; + /* 0x1FC */ Vec3f bodyPartsPos[KAREBABA_BODYPART_MAX]; /* 0x22C */ CollisionPoly* boundFloor; /* 0x230 */ ColliderCylinder attackCollider; /* 0x27C */ ColliderCylinder hurtCollider; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 3bc31cd74d..d6f34a256b 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -119,7 +119,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { this->collider.dim.yShift = -20; this->timer = 8; this->scroll = 0.0f; - this->actor.world.pos = player->bodyPartsPos[0]; + this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->lightColorFrac = 0.0f; this->adjustLightsArg1 = 0.0f; this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; @@ -230,7 +230,7 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) { Actor* child = this->actor.child; this->unk1B0 = player->unk_B08; - this->actor.world.pos = player->bodyPartsPos[0]; + this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; if (!this->isCharging && (player->unk_B08 >= 0.1f)) { @@ -380,8 +380,8 @@ void EnMThunder_Spin_Attack(EnMThunder* this, PlayState* play) { } if (this->timer > 0) { - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; this->timer--; } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 21146f3797..2c5417c7d6 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -455,7 +455,7 @@ void func_80BC06C4(EnNb* this) { if (this->unk_1E8->id == ACTOR_PLAYER) { player = (Player*)this->unk_1E8; - sp40.y = player->bodyPartsPos[7].y + 3.0f; + sp40.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_1E8->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 755385d004..2b05945d99 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -610,29 +610,29 @@ void EnNeoReeba_UpdatePosition(EnNeoReeba* this, PlayState* play) { void EnNeoReeba_DrawFrozenEffects(EnNeoReeba* this, PlayState* play) { s32 i; - f32 limbPosScale = 10.0f; + f32 bodyPartPosScaleXZ = 10.0f; f32 phi_f2 = 20.0f; f32 drawEffectScale = 0.8f; if (EN_NEO_REEBA_IS_LARGE(&this->actor)) { - limbPosScale *= 1.5f; + bodyPartPosScaleXZ *= 1.5f; phi_f2 *= 1.5f; drawEffectScale *= 1.5f; } - for (i = 0; i < ARRAY_COUNT(this->limbPos) - 1; i++) { - this->limbPos[i] = this->actor.world.pos; + for (i = 0; i <= EN_NEO_REEBA_BODYPART_2; i++) { + this->bodyPartsPos[i] = this->actor.world.pos; - this->limbPos[i].x += limbPosScale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].z += limbPosScale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].y += 5.0f; + this->bodyPartsPos[i].x += bodyPartPosScaleXZ * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].z += bodyPartPosScaleXZ * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].y += 5.0f; } - this->limbPos[ARRAY_COUNT(this->limbPos) - 1] = this->actor.world.pos; - this->limbPos[ARRAY_COUNT(this->limbPos) - 1].y += phi_f2; + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3] = this->actor.world.pos; + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3].y += phi_f2; this->drawEffectScale = drawEffectScale; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), drawEffectScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_NEO_REEBA_BODYPART_MAX, drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } @@ -646,15 +646,15 @@ void EnNeoReeba_DrawEffects(EnNeoReeba* this, PlayState* play) { if ((this->drawEffectType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawEffectType == ACTOR_DRAW_DMGEFF_LIGHT_ORBS) || (this->drawEffectType == ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL)) { - for (i = 0; i < ARRAY_COUNT(this->limbPos) - 1; i++) { - this->limbPos[i] = this->actor.world.pos; - this->limbPos[i].x += scale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].z += scale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].y += -20.0f; + for (i = 0; i <= EN_NEO_REEBA_BODYPART_2; i++) { + this->bodyPartsPos[i] = this->actor.world.pos; + this->bodyPartsPos[i].x += scale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].z += scale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].y += -20.0f; } - this->limbPos[ARRAY_COUNT(this->limbPos) - 1] = this->actor.world.pos; - Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawEffectScale, 0.5f, + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3] = this->actor.world.pos; + Actor_DrawDamageEffects(play, NULL, this->bodyPartsPos, EN_NEO_REEBA_BODYPART_MAX, this->drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } } @@ -672,8 +672,8 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < EN_NEO_REEBA_BODYPART_MAX; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); xVel = Math_SinS(yaw) * 3.0f; zVel = Math_CosS(yaw) * 3.0f; @@ -681,7 +681,8 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play) { iceVel.x = (Rand_Centered() * 3.0f) + xVel; iceVel.z = (Rand_Centered() * 3.0f) + zVel; iceVel.y = (Rand_ZeroOne() * 6.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, + 30); } } } diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h index 2cd24c88e8..1be3d2c4a1 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h @@ -10,6 +10,14 @@ struct EnNeoReeba; typedef void (*EnNeoReebaActionFunc)(struct EnNeoReeba*, PlayState*); +typedef enum EnNeoReebaBodyPart { + /* 0 */ EN_NEO_REEBA_BODYPART_0, + /* 1 */ EN_NEO_REEBA_BODYPART_1, + /* 2 */ EN_NEO_REEBA_BODYPART_2, + /* 3 */ EN_NEO_REEBA_BODYPART_3, + /* 4 */ EN_NEO_REEBA_BODYPART_MAX +} EnNeoReebaBodyPart; + typedef struct EnNeoReeba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -19,7 +27,7 @@ typedef struct EnNeoReeba { /* 0x2AC */ EnNeoReebaActionFunc actionFunc; /* 0x2B0 */ Vec3f targetPos; /* 0x2BC */ Vec3f velToTarget; - /* 0x2C8 */ Vec3f limbPos[4]; + /* 0x2C8 */ Vec3f bodyPartsPos[EN_NEO_REEBA_BODYPART_MAX]; /* 0x2F8 */ f32 sinkRiseRate; /* 0x2FC */ f32 rotationSpeed; /* 0x300 */ f32 drawEffectAlpha; 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 7ebe763670..88e0aea164 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -245,7 +245,7 @@ void EnPametfrog_Thaw(EnPametfrog* this, PlayState* play) { this->collider.base.colType = COLTYPE_HIT6; this->collider.elements->info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, GEKKO_BODYPART_MAX, 2, 0.3f, 0.2f); } } @@ -1379,29 +1379,38 @@ void EnPametfrog_Update(Actor* thisx, PlayState* play) { } } -/* value -1: Limb Not used - * value 0: GEKKO_LIMB_WAIST - * value 1: GEKKO_LIMB_LEFT_SHIN - * value 2: GEKKO_LIMB_LEFT_FOOT - * value 3: GEKKO_LIMB_RIGHT_SHIN - * value 4: GEKKO_LIMB_RIGHT_FOOT - * value 5: GEKKO_LIMB_LEFT_UPPER_ARM - * value 6: GEKKO_LIMB_LEFT_FOREARM - * value 7: GEKKO_LIMB_LEFT_HAND - * value 8: GEKKO_LIMB_RIGHT_UPPER_ARM - * value 9: GEKKO_LIMB_RIGHT_FOREARM - * value 10: GEKKO_LIMB_RIGHT_HAND - * value 11: GEKKO_LIMB_JAW - */ -static s8 limbPosIndex[] = { - -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, 6, -1, 7, 8, 9, -1, 10, -1, 11, -1, -1, +static s8 sLimbToBodyParts[GEKKO_LIMB_MAX] = { + BODYPART_NONE, // GEKKO_LIMB_NONE + BODYPART_NONE, // GEKKO_LIMB_ROOT + GEKKO_BODYPART_WAIST, // GEKKO_LIMB_WAIST + BODYPART_NONE, // GEKKO_LIMB_LEFT_THIGH + GEKKO_BODYPART_LEFT_SHIN, // GEKKO_LIMB_LEFT_SHIN + BODYPART_NONE, // GEKKO_LIMB_LEFT_ANKLE + GEKKO_BODYPART_LEFT_FOOT, // GEKKO_LIMB_LEFT_FOOT + BODYPART_NONE, // GEKKO_LIMB_RIGHT_THIGH + GEKKO_BODYPART_RIGHT_SHIN, // GEKKO_LIMB_RIGHT_SHIN + BODYPART_NONE, // GEKKO_LIMB_RIGHT_ANKLE + GEKKO_BODYPART_RIGHT_FOOT, // GEKKO_LIMB_RIGHT_FOOT + BODYPART_NONE, // GEKKO_LIMB_TORSO + GEKKO_BODYPART_LEFT_UPPER_ARM, // GEKKO_LIMB_LEFT_UPPER_ARM + GEKKO_BODYPART_LEFT_FOREARM, // GEKKO_LIMB_LEFT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_LEFT_WRIST + GEKKO_BODYPART_LEFT_HAND, // GEKKO_LIMB_LEFT_HAND + GEKKO_BODYPART_RIGHT_UPPER_ARM, // GEKKO_LIMB_RIGHT_UPPER_ARM + GEKKO_BODYPART_RIGHT_FOREARM, // GEKKO_LIMB_RIGHT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_RIGHT_WRIST + GEKKO_BODYPART_RIGHT_HAND, // GEKKO_LIMB_RIGHT_HAND + BODYPART_NONE, // GEKKO_LIMB_HEAD + GEKKO_BODYPART_JAW, // GEKKO_LIMB_JAW + BODYPART_NONE, // GEKKO_LIMB_LEFT_EYE + BODYPART_NONE, // GEKKO_LIMB_RIGHT_EYE }; void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPametfrog* this = THIS; Vec3f vec; Vec3s* center; - s8 index; + s8 bodyPartIndex; if (limbIndex == GEKKO_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); @@ -1417,9 +1426,9 @@ void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s center->z = (Math_CosS(this->actor.shape.rot.y) * 35.0f) + this->actor.focus.pos.z; } - index = limbPosIndex[limbIndex]; - if (index != -1) { - Matrix_MultZero(&this->limbPos[index]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); } } @@ -1430,6 +1439,6 @@ void EnPametfrog_Draw(Actor* thisx, PlayState* play) { Matrix_RotateYS(this->spinYaw, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnPametfrog_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, GEKKO_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 31a3be14b3..ac0a0b3f59 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -21,6 +21,23 @@ typedef enum { /* 9 */ GEKKO_DEFEAT } EnPametfrogState; +typedef enum GekkoBodyPart { + /* -1 */ GEKKO_BODYPART_NONE = -1, + /* 0 */ GEKKO_BODYPART_WAIST, + /* 1 */ GEKKO_BODYPART_LEFT_SHIN, + /* 2 */ GEKKO_BODYPART_LEFT_FOOT, + /* 3 */ GEKKO_BODYPART_RIGHT_SHIN, + /* 4 */ GEKKO_BODYPART_RIGHT_FOOT, + /* 5 */ GEKKO_BODYPART_LEFT_UPPER_ARM, + /* 6 */ GEKKO_BODYPART_LEFT_FOREARM, + /* 7 */ GEKKO_BODYPART_LEFT_HAND, + /* 8 */ GEKKO_BODYPART_RIGHT_UPPER_ARM, + /* 9 */ GEKKO_BODYPART_RIGHT_FOREARM, + /* 10 */ GEKKO_BODYPART_RIGHT_HAND, + /* 11 */ GEKKO_BODYPART_JAW, + /* 12 */ GEKKO_BODYPART_MAX +} GekkoBodyPart; + typedef struct EnPametfrog { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -44,7 +61,7 @@ typedef struct EnPametfrog { /* 0x2D0 */ Vec3f unk_2D0; // MtxF xz/yz/zz /* 0x2DC */ Vec3f unk_2DC; // MtxF xy/yy/zy: wallNorm/floorNorm/Base of Gekko walking??? /* 0x2E8 */ Vec3f unk_2E8; // MtxF xx/yx/zx - /* 0x2F4 */ Vec3f limbPos[12]; + /* 0x2F4 */ Vec3f bodyPartsPos[GEKKO_BODYPART_MAX]; /* 0x384 */ ColliderJntSph collider; /* 0x3A4 */ ColliderJntSphElement colElement[2]; } EnPametfrog; // size = 0x424 diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 0c8944602a..94936a7b1b 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -243,7 +243,7 @@ void func_808971DC(EnPeehat* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderSphere.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, PEEHAT_BODYPART_MAX, 2, 0.5f, 0.35f); } } @@ -866,25 +866,50 @@ s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } +static Vec3f D_80899570[] = { + { 1300.0f, 1200.0f, 0.0f }, // PEEHAT_BODYPART_12 + { 1300.0f, -1200.0f, 0.0f }, // PEEHAT_BODYPART_13 + { 1300.0f, 0.0f, 1200.0f }, // PEEHAT_BODYPART_14 + { 1300.0f, 0.0f, -1200.0f }, // PEEHAT_BODYPART_15 +}; + +static s8 sLimbToBodyParts[OBJECT_PH_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_PH_LIMB_NONE + BODYPART_NONE, // OBJECT_PH_LIMB_01 + BODYPART_NONE, // OBJECT_PH_LIMB_02 + BODYPART_NONE, // OBJECT_PH_LIMB_03 + BODYPART_NONE, // OBJECT_PH_LIMB_04 + BODYPART_NONE, // OBJECT_PH_LIMB_05 + BODYPART_NONE, // OBJECT_PH_LIMB_06 + PEEHAT_BODYPART_0, // OBJECT_PH_LIMB_07 + BODYPART_NONE, // OBJECT_PH_LIMB_08 + BODYPART_NONE, // OBJECT_PH_LIMB_09 + PEEHAT_BODYPART_2, // OBJECT_PH_LIMB_0A + BODYPART_NONE, // OBJECT_PH_LIMB_0B + BODYPART_NONE, // OBJECT_PH_LIMB_0C + PEEHAT_BODYPART_4, // OBJECT_PH_LIMB_0D + BODYPART_NONE, // OBJECT_PH_LIMB_0E + BODYPART_NONE, // OBJECT_PH_LIMB_0F + PEEHAT_BODYPART_6, // OBJECT_PH_LIMB_10 + BODYPART_NONE, // OBJECT_PH_LIMB_11 + BODYPART_NONE, // OBJECT_PH_LIMB_12 + PEEHAT_BODYPART_8, // OBJECT_PH_LIMB_13 + BODYPART_NONE, // OBJECT_PH_LIMB_14 + BODYPART_NONE, // OBJECT_PH_LIMB_15 + PEEHAT_BODYPART_10, // OBJECT_PH_LIMB_16 + BODYPART_NONE, // OBJECT_PH_LIMB_17 +}; + void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80899570[] = { - { 1300.0f, 1200.0f, 0.0f }, - { 1300.0f, -1200.0f, 0.0f }, - { 1300.0f, 0.0f, 1200.0f }, - { 1300.0f, 0.0f, -1200.0f }, - }; - static s8 D_808995A0[] = { - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 2, -1, -1, 4, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, - }; PlayState* play = play2; EnPeehat* this = THIS; s32 i; - s32 index = D_808995A0[limbIndex]; + s32 bodyPartIndex = sLimbToBodyParts[limbIndex]; Gfx* gfx; - if (index != -1) { - Matrix_MultVecX(2000.0f, &this->limbPos[index]); - Matrix_MultVecX(4000.0f, &this->limbPos[index + 1]); + if (bodyPartIndex != BODYPART_NONE) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex]); + Matrix_MultVecX(4000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); } if (limbIndex == 4) { @@ -892,14 +917,14 @@ void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVecZ(-5500.0f, &this->unk_2D4[1]); } else if ((limbIndex == 3) && (thisx->params == 0)) { Vec3f* vec = &D_80899570[0]; - Vec3f* vec2 = &this->limbPos[12]; + Vec3f* bodyPartPosPtr = &this->bodyPartsPos[PEEHAT_BODYPART_12]; - for (i = 0; i < ARRAY_COUNT(D_80899570); i++, vec++, vec2++) { - Matrix_MultVec3f(vec, vec2); + for (i = 0; i < ARRAY_COUNT(D_80899570); i++, vec++, bodyPartPosPtr++) { + Matrix_MultVec3f(vec, bodyPartPosPtr); } - Matrix_MultVecX(3000.0f, vec2++); - Matrix_MultVecX(-400.0f, vec2); + Matrix_MultVecX(3000.0f, bodyPartPosPtr++); // PEEHAT_BODYPART_16 + Matrix_MultVecX(-400.0f, bodyPartPosPtr); // PEEHAT_BODYPART_17 OPEN_DISPS(play->state.gfxCtx); @@ -943,11 +968,11 @@ void EnPeehat_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - this->limbPos[i].y -= 50.0f; + for (i = 0; i < PEEHAT_BODYPART_MAX; i++) { + this->bodyPartsPos[i].y -= 50.0f; } } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, PEEHAT_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index 248599c63a..c5ff88b658 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -7,6 +7,28 @@ struct EnPeehat; typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); +typedef enum PeehatBodyPart { + /* 0 */ PEEHAT_BODYPART_0, + /* 1 */ PEEHAT_BODYPART_1, + /* 2 */ PEEHAT_BODYPART_2, + /* 3 */ PEEHAT_BODYPART_3, + /* 4 */ PEEHAT_BODYPART_4, + /* 5 */ PEEHAT_BODYPART_5, + /* 6 */ PEEHAT_BODYPART_6, + /* 7 */ PEEHAT_BODYPART_7, + /* 8 */ PEEHAT_BODYPART_8, + /* 9 */ PEEHAT_BODYPART_9, + /* 10 */ PEEHAT_BODYPART_10, + /* 11 */ PEEHAT_BODYPART_11, + /* 12 */ PEEHAT_BODYPART_12, + /* 13 */ PEEHAT_BODYPART_13, + /* 14 */ PEEHAT_BODYPART_14, + /* 15 */ PEEHAT_BODYPART_15, + /* 16 */ PEEHAT_BODYPART_16, + /* 17 */ PEEHAT_BODYPART_17, + /* 18 */ PEEHAT_BODYPART_MAX +} PeehatBodyPart; + typedef struct EnPeehat { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,7 +50,7 @@ typedef struct EnPeehat { /* 0x2CC */ f32 drawDmgEffScale; /* 0x2D0 */ f32 drawDmgEffFrozenSteamScale; /* 0x2D4 */ Vec3f unk_2D4[2]; - /* 0x2EC */ Vec3f limbPos[18]; + /* 0x2EC */ Vec3f bodyPartsPos[PEEHAT_BODYPART_MAX]; /* 0x3C4 */ ColliderCylinder colliderCylinder; /* 0x410 */ ColliderSphere colliderSphere; /* 0x468 */ ColliderTris colliderTris; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index b6b7c88661..715021ebe5 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1076,7 +1076,7 @@ void func_80AF898C(EnPm* this) { this->unk_372 = CLAMP(this->unk_372, -0x1FFE, 0x1FFE); Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_268->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_268)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_268)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_268->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index f4e938d44a..3ba0cad853 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1122,37 +1122,37 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve return false; } -#define POE_SISTERS_LIMBPOS_INVALID -1 +static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; + +static s8 sLimbToBodyParts[POE_SISTERS_LIMB_MAX] = { + BODYPART_NONE, // POE_SISTERS_LIMB_NONE + BODYPART_NONE, // POE_SISTERS_LIMB_ROOT + POE_SISTERS_BODYPART_LEFT_ARM, // POE_SISTERS_LIMB_LEFT_ARM + POE_SISTERS_BODYPART_LEFT_HAND, // POE_SISTERS_LIMB_LEFT_HAND + POE_SISTERS_BODYPART_RIGHT_UPPER_ARM, // POE_SISTERS_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // POE_SISTERS_LIMB_RIGHT_FOREARM + POE_SISTERS_BODYPART_TORCH_ROOT, // POE_SISTERS_LIMB_TORCH_ROOT + BODYPART_NONE, // POE_SISTERS_LIMB_RIGHT_HAND + BODYPART_NONE, // POE_SISTERS_LIMB_TORCH + BODYPART_NONE, // POE_SISTERS_LIMB_MAIN_BODY + BODYPART_NONE, // POE_SISTERS_LIMB_FACE + BODYPART_NONE, // POE_SISTERS_LIMB_LOWER_BODY +}; void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; - static s8 D_80B1DB08[] = { - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - 0, - 1, - 2, - POE_SISTERS_LIMBPOS_INVALID, - 3, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - }; EnPoSisters* this = THIS; s32 end; f32 brightness; - if (D_80B1DB08[limbIndex] != POE_SISTERS_LIMBPOS_INVALID) { - Matrix_MultZero(&this->limbPos[D_80B1DB08[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } else if (limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { - Matrix_MultVecY(-2500.0f, &this->limbPos[4]); - Matrix_MultVecY(3000.0f, &this->limbPos[5]); + Matrix_MultVecY(-2500.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_MAIN_BODY_0]); + Matrix_MultVecY(3000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_MAIN_BODY_1]); } else if (limbIndex == POE_SISTERS_LIMB_FACE) { - Matrix_MultVecY(-4000.0f, &this->limbPos[6]); + Matrix_MultVecY(-4000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_FACE]); } else if (limbIndex == POE_SISTERS_LIMB_LOWER_BODY) { - Matrix_MultVecX(3000.0f, &this->limbPos[7]); + Matrix_MultVecX(3000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_LOWER_BODY]); } if ((this->actionFunc == EnPoSisters_DeathStage1) && (this->deathTimer >= 8) && @@ -1265,7 +1265,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, POE_SISTERS_BODYPART_MAX, this->actor.scale.x * (1.0f / 0.007f) * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index f800788c7f..510a67f369 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -19,14 +19,26 @@ typedef enum { /* 1 */ POE_SISTERS_TYPE_JO, // red /* 2 */ POE_SISTERS_TYPE_BETH, // blue /* 3 */ POE_SISTERS_TYPE_AMY // green -} EnPoSisterType; +} PoeSisterType; typedef enum { /* 0 */ POE_SISTERS_MEG_REAL, /* 1 */ POE_SISTERS_MEG_CLONE1, /* 2 */ POE_SISTERS_MEG_CLONE2, /* 3 */ POE_SISTERS_MEG_CLONE3 -} EnPoSisterMegCloneID; +} PoeSisterMegCloneId; + +typedef enum PoeSisterBodyPart { + /* 0 */ POE_SISTERS_BODYPART_LEFT_ARM, + /* 1 */ POE_SISTERS_BODYPART_LEFT_HAND, + /* 2 */ POE_SISTERS_BODYPART_RIGHT_UPPER_ARM, + /* 3 */ POE_SISTERS_BODYPART_TORCH_ROOT, + /* 4 */ POE_SISTERS_BODYPART_MAIN_BODY_0, + /* 5 */ POE_SISTERS_BODYPART_MAIN_BODY_1, + /* 6 */ POE_SISTERS_BODYPART_FACE, + /* 7 */ POE_SISTERS_BODYPART_LOWER_BODY, + /* 8 */ POE_SISTERS_BODYPART_MAX +} PoeSisterBodyPart; typedef struct EnPoSisters { /* 0x000 */ Actor actor; @@ -58,7 +70,7 @@ typedef struct EnPoSisters { /* 0x1DE */ Vec3s morphTable[POE_SISTERS_LIMB_MAX]; /* 0x226 */ Color_RGBA8 color; /* 0x22C */ Vec3f firePos[8]; - /* 0x28C */ Vec3f limbPos[8]; // passed to Actor_DrawDamageEffects + /* 0x28C */ Vec3f bodyPartsPos[POE_SISTERS_BODYPART_MAX]; /* 0x2EC */ f32 megDistToPlayer; /* 0x2F0 */ f32 drawDmgEffAlpha; /* 0x2F4 */ f32 drawDmgEffScale; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 5571fae2a9..c79e6910e1 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -864,16 +864,38 @@ s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p return false; } +static s8 sLimbToBodyParts[OBJECT_PO_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_PO_LIMB_NONE + BODYPART_NONE, // OBJECT_PO_LIMB_01 + BODYPART_NONE, // OBJECT_PO_LIMB_02 + BODYPART_NONE, // OBJECT_PO_LIMB_03 + ENPOH_BODYPART_4, // OBJECT_PO_LIMB_04 + ENPOH_BODYPART_5, // OBJECT_PO_LIMB_05 + BODYPART_NONE, // OBJECT_PO_LIMB_06 + BODYPART_NONE, // OBJECT_PO_LIMB_07 + BODYPART_NONE, // OBJECT_PO_LIMB_08 + ENPOH_BODYPART_0, // OBJECT_PO_LIMB_09 + ENPOH_BODYPART_1, // OBJECT_PO_LIMB_0A + BODYPART_NONE, // OBJECT_PO_LIMB_0B + BODYPART_NONE, // OBJECT_PO_LIMB_0C + BODYPART_NONE, // OBJECT_PO_LIMB_0D + BODYPART_NONE, // OBJECT_PO_LIMB_0E + BODYPART_NONE, // OBJECT_PO_LIMB_0F + ENPOH_BODYPART_2, // OBJECT_PO_LIMB_10 + BODYPART_NONE, // OBJECT_PO_LIMB_11 + BODYPART_NONE, // OBJECT_PO_LIMB_12 + ENPOH_BODYPART_3, // OBJECT_PO_LIMB_13 + BODYPART_NONE, // OBJECT_PO_LIMB_14 +}; + +static Vec3f D_80B2F734[] = { + { -600.0f, 500.0f, 1700.0f }, // ENPOH_BODYPART_7 + { -600.0f, 500.0f, -1700.0f }, // ENPOH_BODYPART_8 + { 1000.0f, 1700.0f, 0.0f }, // ENPOH_BODYPART_9 +}; + void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static s8 D_80B2F71C[] = { - -1, -1, -1, -1, 4, 5, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, 3, -1, - }; - static Vec3f D_80B2F734[] = { - { -600.0f, 500.0f, 1700.0f }, - { -600.0f, 500.0f, -1700.0f }, - { 1000.0f, 1700.0f, 0.0f }, - }; - s32 temp_s3; + s32 bodyPartIndex; Vec3f sp60; EnPoh* this = THIS; s32 pad; @@ -897,21 +919,21 @@ void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->unk_199, this->unk_19A, this->unk_19B * (200.0f / 255.0f)); } - temp_s3 = D_80B2F71C[limbIndex]; - if (temp_s3 != -1) { - if (temp_s3 < 4) { - Matrix_MultZero(&this->limbPos[temp_s3]); - } else if (temp_s3 == 4) { - Matrix_MultVecX(2000.0f, &this->limbPos[temp_s3]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= ENPOH_BODYPART_3) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); + } else if (bodyPartIndex == ENPOH_BODYPART_4) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { s32 i; - Vec3f* vec = &this->limbPos[temp_s3 + 2]; + Vec3f* vec = &this->bodyPartsPos[bodyPartIndex + 2]; Vec3f* vec2 = &D_80B2F734[0]; - Matrix_MultVecX(-2000.0f, &this->limbPos[temp_s3]); - Matrix_MultVecY(-2000.0f, &this->limbPos[temp_s3 + 1]); + Matrix_MultVecX(-2000.0f, &this->bodyPartsPos[bodyPartIndex]); // ENPOH_BODYPART_5 + Matrix_MultVecY(-2000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); // ENPOH_BODYPART_6 - for (i = temp_s3 + 2; i < ARRAY_COUNT(this->limbPos); i++, vec++, vec2++) { + for (i = bodyPartIndex + 2; i < ENPOH_BODYPART_MAX; i++, vec++, vec2++) { Matrix_MultVec3f(vec2, vec); } } @@ -959,7 +981,7 @@ void EnPoh_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(&gfx[3], object_po_DL_002D28); POLY_OPA_DISP = &gfx[4]; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENPOH_BODYPART_MAX, this->actor.scale.x * 100.0f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index b07be6195a..5f7439e4a1 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -7,6 +7,20 @@ struct EnPoh; typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); +typedef enum EnPohBodyPart { + /* 0 */ ENPOH_BODYPART_0, + /* 1 */ ENPOH_BODYPART_1, + /* 2 */ ENPOH_BODYPART_2, + /* 3 */ ENPOH_BODYPART_3, + /* 4 */ ENPOH_BODYPART_4, + /* 5 */ ENPOH_BODYPART_5, + /* 6 */ ENPOH_BODYPART_6, + /* 7 */ ENPOH_BODYPART_7, + /* 8 */ ENPOH_BODYPART_8, + /* 9 */ ENPOH_BODYPART_9, + /* 10 */ ENPOH_BODYPART_MAX +} EnPohBodyPart; + typedef struct EnPoh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,7 +42,7 @@ typedef struct EnPoh { /* 0x21A */ Vec3s morphTable[21]; /* 0x298 */ f32 drawDmgEffAlpha; /* 0x29C */ f32 drawDmgEffScale; - /* 0x2A0 */ Vec3f limbPos[10]; + /* 0x2A0 */ Vec3f bodyPartsPos[ENPOH_BODYPART_MAX]; /* 0x318 */ LightNode* lightNode; /* 0x31C */ LightInfo lightInfo; /* 0x32C */ ColliderCylinder colliderCylinder; 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 6dc36e9ebb..48de2c4a88 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -869,8 +869,7 @@ void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play) { if ((this->secondaryTimer == 0) && (this->drawDmgEffTimer == 0)) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, - 0.4f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -906,7 +905,7 @@ void EnPp_SetupDamaged(EnPp* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->drawDmgEffTimer != 0)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1026,7 +1025,7 @@ void EnPp_Dead(EnPp* this, PlayState* play) { return; } - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1189,16 +1188,16 @@ void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { - this->deadBodyPartDrawDmgEffCount = 10; - for (i = 0; i < ARRAY_COUNT(this->deadBodyPartDrawDmgEffPos); i++) { - Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[i], &this->deadBodyPartPos); - this->deadBodyPartDrawDmgEffPos[i].x += Math_SinS(0xCCC * i) * 15.0f; - this->deadBodyPartDrawDmgEffPos[i].y += -5.0f; - this->deadBodyPartDrawDmgEffPos[i].z += Math_CosS(0xCCC * i) * 15.0f; + this->deadBodyPartCount = EN_PP_DEAD_BODYPART_MAX; + for (i = 0; i < EN_PP_DEAD_BODYPART_MAX; i++) { + Math_Vec3f_Copy(&this->deadBodyPartsPos[i], &this->deadBodyPartPos); + this->deadBodyPartsPos[i].x += Math_SinS(0xCCC * i) * 15.0f; + this->deadBodyPartsPos[i].y += -5.0f; + this->deadBodyPartsPos[i].z += Math_CosS(0xCCC * i) * 15.0f; } } else { - Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[0], &this->deadBodyPartPos); - this->deadBodyPartDrawDmgEffCount = 1; + Math_Vec3f_Copy(&this->deadBodyPartsPos[0], &this->deadBodyPartPos); + this->deadBodyPartCount = 1; this->actor.shape.rot.x += this->deadBodyPartRotationalVelocity.x; this->actor.shape.rot.z += this->deadBodyPartRotationalVelocity.z; } @@ -1541,10 +1540,10 @@ void EnPp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, (limbIndex == HIPLOOP_LIMB_CENTER_WING_BASE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE) || (limbIndex == HIPLOOP_LIMB_BACK_LEFT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_EYE) || (limbIndex == HIPLOOP_LIMB_LEFT_EYE)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_PP_BODYPART_MAX) { + this->bodyPartIndex = 0; } if ((this->action == EN_PP_ACTION_SPAWN_BODY_PARTS) && (this->deadBodyPartsSpawnedCount < 6) && @@ -1575,14 +1574,14 @@ void EnPp_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPp_OverrideLimbDraw, EnPp_PostLimbDraw, &this->actor); - if (this->deadBodyPartDrawDmgEffCount != 0) { + if (this->deadBodyPartCount != 0) { scale = 0.4f; if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { scale = 0.6f; } - Actor_DrawDamageEffects(play, &this->actor, this->deadBodyPartDrawDmgEffPos, this->deadBodyPartDrawDmgEffCount, - scale, scale, 1.0f, ACTOR_DRAW_DMGEFF_BLUE_FIRE); + Actor_DrawDamageEffects(play, &this->actor, this->deadBodyPartsPos, this->deadBodyPartCount, scale, scale, 1.0f, + ACTOR_DRAW_DMGEFF_BLUE_FIRE); } if (this->drawDmgEffTimer != 0) { @@ -1600,8 +1599,8 @@ void EnPp_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); } if (this->floorPolyForCircleShadow != NULL) { diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 2409487be3..2f3c0e7b1d 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -25,6 +25,35 @@ typedef enum { /* 26 */ EN_PP_TYPE_BODY_PART_CENTER_WING_MIDDLE = 26 } EnPpType; +typedef enum EnPpBodyPart { + /* 0 */ EN_PP_BODYPART_0, + /* 1 */ EN_PP_BODYPART_1, + /* 2 */ EN_PP_BODYPART_2, + /* 3 */ EN_PP_BODYPART_3, + /* 4 */ EN_PP_BODYPART_4, + /* 5 */ EN_PP_BODYPART_5, + /* 6 */ EN_PP_BODYPART_6, + /* 7 */ EN_PP_BODYPART_7, + /* 8 */ EN_PP_BODYPART_8, + /* 9 */ EN_PP_BODYPART_9, + /* 10 */ EN_PP_BODYPART_10, + /* 11 */ EN_PP_BODYPART_MAX +} EnPpBodyPart; + +typedef enum EnPpDeadBodyPart { + /* 0 */ EN_PP_DEAD_BODYPART_0, + /* 1 */ EN_PP_DEAD_BODYPART_1, + /* 2 */ EN_PP_DEAD_BODYPART_2, + /* 3 */ EN_PP_DEAD_BODYPART_3, + /* 4 */ EN_PP_DEAD_BODYPART_4, + /* 5 */ EN_PP_DEAD_BODYPART_5, + /* 6 */ EN_PP_DEAD_BODYPART_6, + /* 7 */ EN_PP_DEAD_BODYPART_7, + /* 8 */ EN_PP_DEAD_BODYPART_8, + /* 9 */ EN_PP_DEAD_BODYPART_9, + /* 10 */ EN_PP_DEAD_BODYPART_MAX +} EnPpDeadBodyPart; + typedef struct EnPp { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -57,8 +86,8 @@ typedef struct EnPp { /* 0x34C */ Vec3f maskVelocity; /* 0x358 */ Vec3f targetPos; /* 0x364 */ Vec3f deadBodyPartPos; - /* 0x370 */ s32 deadBodyPartDrawDmgEffCount; - /* 0x374 */ Vec3f deadBodyPartDrawDmgEffPos[10]; + /* 0x370 */ s32 deadBodyPartCount; + /* 0x374 */ Vec3f deadBodyPartsPos[EN_PP_DEAD_BODYPART_MAX]; /* 0x3EC */ Vec3s deadBodyPartRotationalVelocity; /* 0x3F2 */ s16 drawDmgEffTimer; /* 0x3F4 */ s16 drawDmgEffType; @@ -66,8 +95,8 @@ typedef struct EnPp { /* 0x3FC */ f32 drawDmgEffFrozenSteamScale; /* 0x400 */ f32 attackRange; /* 0x404 */ s32 hasBeenDamaged; - /* 0x408 */ Vec3f bodyPartsPos[11]; - /* 0x48C */ s16 bodyPartsPosIndex; + /* 0x408 */ Vec3f bodyPartsPos[EN_PP_BODYPART_MAX]; + /* 0x48C */ s16 bodyPartIndex; /* 0x490 */ f32 maskAccelY; /* 0x494 */ ColliderJntSph maskCollider; /* 0x4B4 */ ColliderJntSphElement maskColliderElements[1]; diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 1869dd9cf1..67ad651985 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -589,10 +589,10 @@ void EnPr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if ((limbIndex == 0) || (limbIndex == 1) || (limbIndex == 2) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9)) { - Matrix_MultZero(&this->limbPos[this->unk_228]); - this->unk_228++; - if (this->unk_228 >= ARRAY_COUNT(this->limbPos)) { - this->unk_228 = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; + if (this->bodyPartsCount >= ENPR_BODYPART_MAX) { + this->bodyPartsCount = 0; } } } @@ -627,8 +627,8 @@ void EnPr_Draw(Actor* thisx, PlayState* play) { this->unk_238 = 0.8f; this->unk_234 = 0.8f; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, - drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENPR_BODYPART_MAX, 0.8f, 0.8f, drawDmgEffAlpha, + this->drawDmgEffType); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.h b/src/overlays/actors/ovl_En_Pr/z_en_pr.h index dfa3081ca0..58d1e8be26 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.h +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.h @@ -12,6 +12,20 @@ typedef void (*EnPrActionFunc)(struct EnPr*, PlayState*); #define ENPR_FF00_MAX 20 #define ENPR_FF00_MIN 0 +typedef enum EnPrBodyPart { + /* 0 */ ENPR_BODYPART_0, + /* 1 */ ENPR_BODYPART_1, + /* 2 */ ENPR_BODYPART_2, + /* 3 */ ENPR_BODYPART_3, + /* 4 */ ENPR_BODYPART_4, + /* 5 */ ENPR_BODYPART_5, + /* 6 */ ENPR_BODYPART_6, + /* 7 */ ENPR_BODYPART_7, + /* 8 */ ENPR_BODYPART_8, + /* 9 */ ENPR_BODYPART_9, + /* 10 */ ENPR_BODYPART_MAX +} EnPrBodyPart; + typedef struct EnPr { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -31,13 +45,13 @@ typedef struct EnPr { /* 0x218 */ UNK_TYPE1 unk218[4]; /* 0x21C */ s32 unk_21C; /* 0x220 */ UNK_TYPE1 unk220[0x8]; - /* 0x228 */ s32 unk_228; + /* 0x228 */ s32 bodyPartsCount; /* 0x22C */ s16 unk_22C; /* 0x22E */ s16 drawDmgEffAlpha; /* 0x230 */ s16 drawDmgEffType; /* 0x234 */ f32 unk_234; /* 0x238 */ f32 unk_238; - /* 0x23C */ Vec3f limbPos[10]; + /* 0x23C */ Vec3f bodyPartsPos[ENPR_BODYPART_MAX]; /* 0x2B4 */ f32 unk_2B4; /* 0x2B8 */ f32 unk_2B8; /* 0x2BC */ f32 unk_2BC; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index b2ada549fe..a8e7d52d47 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -878,25 +878,25 @@ void func_80B726B4(EnRailSkb* this, PlayState* play) { static Vec3f D_80B734B8 = { 0.0f, -1.0f, 0.0f }; Vec3f sp84; s32 i; - s32 end; + s32 bodyPartsCount; s16 yaw; if (this->unk_402 & 2) { - end = ARRAY_COUNT(this->limbPos) - 1; + bodyPartsCount = ENRAILSKB_BODYPART_MAX - 1; } else { - end = ARRAY_COUNT(this->limbPos); + bodyPartsCount = ENRAILSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < end; i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(yaw) * 3.0f; sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); } } @@ -1129,11 +1129,11 @@ void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } else if ((limbIndex == 11) && !(this->unk_402 & 2)) { - Matrix_MultVec3f(&D_80B734D0, &this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultVec3f(&D_80B734D0, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -1142,13 +1142,13 @@ void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnRailSkb_Draw(Actor* thisx, PlayState* play) { EnRailSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnRailSkb_OverrideLimbDraw, EnRailSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if ((this->unk_402 & 0x40) && !(this->unk_402 & 0x80)) { diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h index 10c2653c4e..5932799311 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h @@ -12,6 +12,24 @@ typedef void (*EnRailSkbUnkFunc)(struct EnRailSkb*); #define ENRAILSKB_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) #define ENRAILSKB_GET_FF(thisx) ((thisx)->params & 0xFF) +typedef enum EnRailSkbBodyPart { + /* 0 */ ENRAILSKB_BODYPART_0, + /* 1 */ ENRAILSKB_BODYPART_1, + /* 2 */ ENRAILSKB_BODYPART_2, + /* 3 */ ENRAILSKB_BODYPART_3, + /* 4 */ ENRAILSKB_BODYPART_4, + /* 5 */ ENRAILSKB_BODYPART_5, + /* 6 */ ENRAILSKB_BODYPART_6, + /* 7 */ ENRAILSKB_BODYPART_7, + /* 8 */ ENRAILSKB_BODYPART_8, + /* 9 */ ENRAILSKB_BODYPART_9, + /* 10 */ ENRAILSKB_BODYPART_10, + /* 11 */ ENRAILSKB_BODYPART_11, + /* 12 */ ENRAILSKB_BODYPART_12, + /* 13 */ ENRAILSKB_BODYPART_13, + /* 14 */ ENRAILSKB_BODYPART_MAX +} EnRailSkbBodyPart; + typedef struct EnRailSkb { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; @@ -20,8 +38,8 @@ typedef struct EnRailSkb { /* 0x228 */ EnRailSkbActionFunc actionFunc; /* 0x22C */ ObjHakaisi* unk_22C; /* 0x230 */ Vec3s* unk_230; - /* 0x234 */ Vec3f limbPos[14]; - /* 0x2DC */ s32 limbCount; + /* 0x234 */ Vec3f bodyPartsPos[ENRAILSKB_BODYPART_MAX]; + /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ s32 unk_2E0; /* 0x2E4 */ s32 unk_2E4; /* 0x2E8 */ s32 unk_2E8; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 30dd6ced2b..7eef8759b3 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -1061,8 +1061,8 @@ void EnRailgibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s (limbIndex == GIBDO_LIMB_LEFT_FOREARM) || (limbIndex == GIBDO_LIMB_LEFT_HAND) || (limbIndex == GIBDO_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == GIBDO_LIMB_RIGHT_FOREARM) || (limbIndex == GIBDO_LIMB_RIGHT_HAND) || (limbIndex == GIBDO_LIMB_HEAD) || (limbIndex == GIBDO_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1071,7 +1071,7 @@ void EnRailgibud_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->actor.shape.shadowAlpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1093,7 +1093,7 @@ void EnRailgibud_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENRAILGIBUD_BODYPART_MAX, this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index f9d3922c85..42b41ed8a3 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -12,13 +12,32 @@ typedef void (*EnRailgibudActionFunc)(struct EnRailgibud*, PlayState*); #define ENRAILGIBUD_IS_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x80) #define ENRAILGIBUD_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +typedef enum EnRailgibudBodyPart { + /* 0 */ ENRAILGIBUD_BODYPART_0, + /* 1 */ ENRAILGIBUD_BODYPART_1, + /* 2 */ ENRAILGIBUD_BODYPART_2, + /* 3 */ ENRAILGIBUD_BODYPART_3, + /* 4 */ ENRAILGIBUD_BODYPART_4, + /* 5 */ ENRAILGIBUD_BODYPART_5, + /* 6 */ ENRAILGIBUD_BODYPART_6, + /* 7 */ ENRAILGIBUD_BODYPART_7, + /* 8 */ ENRAILGIBUD_BODYPART_8, + /* 9 */ ENRAILGIBUD_BODYPART_9, + /* 10 */ ENRAILGIBUD_BODYPART_10, + /* 11 */ ENRAILGIBUD_BODYPART_11, + /* 12 */ ENRAILGIBUD_BODYPART_12, + /* 13 */ ENRAILGIBUD_BODYPART_13, + /* 14 */ ENRAILGIBUD_BODYPART_14, + /* 15 */ ENRAILGIBUD_BODYPART_MAX +} EnRailgibudBodyPart; + typedef struct EnRailgibud { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnRailgibudActionFunc actionFunc; - /* 0x1D8 */ Vec3f limbPos[15]; - /* 0x28C */ s32 limbIndex; + /* 0x1D8 */ Vec3f bodyPartsPos[ENRAILGIBUD_BODYPART_MAX]; + /* 0x28C */ s32 bodyPartIndex; /* 0x290 */ UNK_TYPE1 unk290[0x4]; /* 0x294 */ Vec3s* points; /* 0x298 */ s32 currentPoint; diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 34fc411926..24bbc9e061 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -1322,8 +1322,8 @@ void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, (limbIndex == REDEAD_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == REDEAD_LIMB_RIGHT_FOREARM) || (limbIndex == REDEAD_LIMB_RIGHT_HAND) || (limbIndex == REDEAD_LIMB_HEAD) || (limbIndex == REDEAD_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1335,7 +1335,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->alpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1363,7 +1363,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, - 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_RD_BODYPART_MAX, this->drawDmgEffScale, 0.5f, + this->drawDmgEffAlpha, this->drawDmgEffType); } } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/src/overlays/actors/ovl_En_Rd/z_en_rd.h index fced38e750..927fbf48be 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.h @@ -30,14 +30,33 @@ typedef enum { /* 7 */ EN_RD_TYPE_PIROUETTE } EnRdType; +typedef enum EnRdBodyPart { + /* 0 */ EN_RD_BODYPART_0, + /* 1 */ EN_RD_BODYPART_1, + /* 2 */ EN_RD_BODYPART_2, + /* 3 */ EN_RD_BODYPART_3, + /* 4 */ EN_RD_BODYPART_4, + /* 5 */ EN_RD_BODYPART_5, + /* 6 */ EN_RD_BODYPART_6, + /* 7 */ EN_RD_BODYPART_7, + /* 8 */ EN_RD_BODYPART_8, + /* 9 */ EN_RD_BODYPART_9, + /* 10 */ EN_RD_BODYPART_10, + /* 11 */ EN_RD_BODYPART_11, + /* 12 */ EN_RD_BODYPART_12, + /* 13 */ EN_RD_BODYPART_13, + /* 14 */ EN_RD_BODYPART_14, + /* 15 */ EN_RD_BODYPART_MAX +} EnRdBodyPart; + typedef struct EnRd { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnRdActionFunc actionFunc; /* 0x18C */ EnRdSetupDanceFunc setupDanceFunc; /* 0x190 */ ColliderCylinder collider; - /* 0x1DC */ Vec3f limbPos[15]; - /* 0x290 */ s32 limbIndex; + /* 0x1DC */ Vec3f bodyPartsPos[EN_RD_BODYPART_MAX]; + /* 0x290 */ s32 bodyPartIndex; /* 0x294 */ f32 drawDmgEffAlpha; /* 0x298 */ f32 drawDmgEffScale; /* 0x29C */ Vec3s jointTable[REDEAD_LIMB_MAX]; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 9bd181c0f5..d1493583a6 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -133,7 +133,7 @@ void EnRr_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); - if (this->actor.params != ENRR_3) { + if (this->actor.params != LIKE_LIKE_PARAM_3) { this->actor.scale.y = 0.015f; this->actor.scale.x = 0.019f; this->actor.scale.z = 0.019f; @@ -152,9 +152,9 @@ void EnRr_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->actor.scale.y * 2000.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if ((this->actor.params == ENRR_2) || (this->actor.params == ENRR_3)) { + if ((this->actor.params == LIKE_LIKE_PARAM_2) || (this->actor.params == LIKE_LIKE_PARAM_3)) { this->actor.colChkInfo.health = 6; - if (this->actor.params == ENRR_2) { + if (this->actor.params == LIKE_LIKE_PARAM_2) { this->actor.colChkInfo.mass = MASS_HEAVY; } } @@ -208,8 +208,8 @@ void func_808FA19C(EnRr* this, PlayState* play) { this->collider1.base.colType = COLTYPE_HIT0; this->collider1.info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 20, 2, this->actor.scale.y * 23.333334f, - this->actor.scale.y * 20.000002f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, LIKE_LIKE_BODYPART_MAX, 2, + this->actor.scale.y * 23.333334f, this->actor.scale.y * 20.000002f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -318,7 +318,7 @@ void func_808FA4F4(EnRr* this, PlayState* play) { Message_StartTextbox(play, 0xF6, NULL); } - if (this->actor.params == ENRR_0) { + if (this->actor.params == LIKE_LIKE_PARAM_0) { sp38 = 8; } else { sp38 = 16; @@ -801,7 +801,7 @@ void EnRr_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actor.params == ENRR_2) { + if (this->actor.params == LIKE_LIKE_PARAM_2) { this->actor.speed = 0.0f; } else { Math_StepToF(&this->actor.speed, 0.0f, 0.1f); @@ -878,7 +878,7 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnRr* this = THIS; Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Mtx)); - Vec3f* vecPtr; + Vec3f* bodyPartPos; s32 i; EnRrStruct* ptr; Vec3f spA4; @@ -897,14 +897,15 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { Matrix_Scale((1.0f + this->unk_324[0].unk_10) * this->unk_324[0].unk_08, 1.0f, (1.0f + this->unk_324[0].unk_10) * this->unk_324[0].unk_08, MTXMODE_APPLY); - vecPtr = &this->limbPos[0]; + bodyPartPos = &this->bodyPartsPos[0]; gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - Matrix_MultVecZ(1842.1053f, vecPtr++); - Matrix_MultVecZ(-1842.1053f, vecPtr++); - Matrix_MultVecX(1842.1053f, vecPtr++); - Matrix_MultVecX(-1842.1053f, vecPtr++); + // LIKE_LIKE_BODYPART_0 - LIKE_LIKE_BODYPART_3 + Matrix_MultVecZ(1842.1053f, bodyPartPos++); + Matrix_MultVecZ(-1842.1053f, bodyPartPos++); + Matrix_MultVecX(1842.1053f, bodyPartPos++); + Matrix_MultVecX(-1842.1053f, bodyPartPos++); Matrix_Pop(); for (i = 1; i < ARRAY_COUNT(this->unk_324); i++) { @@ -921,10 +922,14 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { Matrix_RotateYS(0x2000, MTXMODE_APPLY); } - Matrix_MultVecZ(1842.1053f, vecPtr++); - Matrix_MultVecZ(-1842.1053f, vecPtr++); - Matrix_MultVecX(1842.1053f, vecPtr++); - Matrix_MultVecX(-1842.1053f, vecPtr++); + // LIKE_LIKE_BODYPART_4 - LIKE_LIKE_BODYPART_7 + // LIKE_LIKE_BODYPART_8 - LIKE_LIKE_BODYPART_11 + // LIKE_LIKE_BODYPART_12 - LIKE_LIKE_BODYPART_15 + // LIKE_LIKE_BODYPART_16 - LIKE_LIKE_BODYPART_19 + Matrix_MultVecZ(1842.1053f, bodyPartPos++); + Matrix_MultVecZ(-1842.1053f, bodyPartPos++); + Matrix_MultVecX(1842.1053f, bodyPartPos++); + Matrix_MultVecX(-1842.1053f, bodyPartPos++); Matrix_Pop(); mtx++; if (i == 3) { @@ -939,7 +944,7 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { gSPDisplayList(POLY_OPA_DISP++, gLikeLikeDL); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, LIKE_LIKE_BODYPART_MAX, this->actor.scale.y * 66.66667f * this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/src/overlays/actors/ovl_En_Rr/z_en_rr.h index 6f4178dd9f..3c2bc3964b 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -8,11 +8,35 @@ struct EnRr; typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); typedef enum { - /* 0 */ ENRR_0, - /* 1 */ ENRR_1, - /* 2 */ ENRR_2, - /* 3 */ ENRR_3 -} EnRrParam; + /* 0 */ LIKE_LIKE_PARAM_0, + /* 1 */ LIKE_LIKE_PARAM_1, + /* 2 */ LIKE_LIKE_PARAM_2, + /* 3 */ LIKE_LIKE_PARAM_3 +} LikeLikeParam; + +typedef enum LikeLikeBodyPart { + /* 0 */ LIKE_LIKE_BODYPART_0, + /* 1 */ LIKE_LIKE_BODYPART_1, + /* 2 */ LIKE_LIKE_BODYPART_2, + /* 3 */ LIKE_LIKE_BODYPART_3, + /* 4 */ LIKE_LIKE_BODYPART_4, + /* 5 */ LIKE_LIKE_BODYPART_5, + /* 6 */ LIKE_LIKE_BODYPART_6, + /* 7 */ LIKE_LIKE_BODYPART_7, + /* 8 */ LIKE_LIKE_BODYPART_8, + /* 9 */ LIKE_LIKE_BODYPART_9, + /* 10 */ LIKE_LIKE_BODYPART_10, + /* 11 */ LIKE_LIKE_BODYPART_11, + /* 12 */ LIKE_LIKE_BODYPART_12, + /* 13 */ LIKE_LIKE_BODYPART_13, + /* 14 */ LIKE_LIKE_BODYPART_14, + /* 15 */ LIKE_LIKE_BODYPART_15, + /* 16 */ LIKE_LIKE_BODYPART_16, + /* 17 */ LIKE_LIKE_BODYPART_17, + /* 18 */ LIKE_LIKE_BODYPART_18, + /* 19 */ LIKE_LIKE_BODYPART_19, + /* 20 */ LIKE_LIKE_BODYPART_MAX +} LikeLikeBodyPart; typedef struct { /* 0x00 */ f32 unk_00; @@ -58,7 +82,7 @@ typedef struct EnRr { /* 0x220 */ f32 drawDmgEffScale; /* 0x224 */ f32 drawDmgEffFrozenSteamScale; /* 0x228 */ Vec3f unk_228; - /* 0x234 */ Vec3f limbPos[20]; + /* 0x234 */ Vec3f bodyPartsPos[LIKE_LIKE_BODYPART_MAX]; /* 0x324 */ EnRrStruct unk_324[5]; } EnRr; // size = 0x3C4 diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 551ed94890..4ff7b52fe3 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -97,17 +97,66 @@ static AnimationInfoS sAnimationInfo[] = { { &gAdultRutoSwimmingUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -// in PostLimbdraw, converts limbIndex to bodyPartsPos index -static s8 sBodyPartPosIndices[] = { - -1, -1, 12, 13, 14, -1, 9, 10, 11, -1, 0, 6, -1, -1, 7, 8, 2, -1, -1, 3, 4, 2, 1, +static s8 sLimbToBodyParts[RU2_LIMB_MAX] = { + BODYPART_NONE, // RU2_LIMB_NONE + BODYPART_NONE, // RU2_LIMB_ROOT + RU_BODYPART_12, // RU2_LIMB_LEFT_THIGH + RU_BODYPART_13, // RU2_LIMB_LEFT_LEG + RU_BODYPART_14, // RU2_LIMB_LEFT_FOOT + BODYPART_NONE, // RU2_LIMB_LEFT_TAIL + RU_BODYPART_9, // RU2_LIMB_RIGHT_THIGH + RU_BODYPART_10, // RU2_LIMB_RIGHT_LEG + RU_BODYPART_11, // RU2_LIMB_RIGHT_FOOT + BODYPART_NONE, // RU2_LIMB_RIGHT_TAIL + RU_BODYPART_0, // RU2_LIMB_TORSO + RU_BODYPART_6, // RU2_LIMB_LEFT_UPPER_ARM + BODYPART_NONE, // RU2_LIMB_LEFT_UPPER_WING + BODYPART_NONE, // RU2_LIMB_LEFT_LOWER_WING + RU_BODYPART_7, // RU2_LIMB_LEFT_FOREARM + RU_BODYPART_8, // RU2_LIMB_LEFT_HAND + RU_BODYPART_2, // RU2_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // RU2_LIMB_RIGHT_UPPER_WING + BODYPART_NONE, // RU2_LIMB_RIGHT_LOWER_WING + RU_BODYPART_3, // RU2_LIMB_RIGHT_FOREARM + RU_BODYPART_4, // RU2_LIMB_RIGHT_HAND + RU_BODYPART_2, // RU2_LIMB_HEAD + RU_BODYPART_1, // RU2_LIMB_WAIST }; -static s8 sRuBodyParts[RU_BODYPARTSPOS_COUNT] = { - 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, +static s8 sParentShadowBodyParts[RU_BODYPART_MAX] = { + RU_BODYPART_0, // RU_BODYPART_0 + RU_BODYPART_0, // RU_BODYPART_1 + RU_BODYPART_0, // RU_BODYPART_2 + RU_BODYPART_0, // RU_BODYPART_3 + RU_BODYPART_3, // RU_BODYPART_4 + RU_BODYPART_4, // RU_BODYPART_5 + RU_BODYPART_0, // RU_BODYPART_6 + RU_BODYPART_6, // RU_BODYPART_7 + RU_BODYPART_7, // RU_BODYPART_8 + RU_BODYPART_0, // RU_BODYPART_9 + RU_BODYPART_9, // RU_BODYPART_10 + RU_BODYPART_10, // RU_BODYPART_11 + RU_BODYPART_0, // RU_BODYPART_12 + RU_BODYPART_12, // RU_BODYPART_13 + RU_BODYPART_13, // RU_BODYPART_14 }; -static u8 sRuShadowSizes[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +static u8 sShadowSizes[RU_BODYPART_MAX] = { + 0, // RU_BODYPART_0 + 0, // RU_BODYPART_1 + 0, // RU_BODYPART_2 + 0, // RU_BODYPART_3 + 0, // RU_BODYPART_4 + 0, // RU_BODYPART_5 + 0, // RU_BODYPART_6 + 0, // RU_BODYPART_7 + 0, // RU_BODYPART_8 + 0, // RU_BODYPART_9 + 0, // RU_BODYPART_10 + 0, // RU_BODYPART_11 + 0, // RU_BODYPART_12 + 0, // RU_BODYPART_13 + 0, // RU_BODYPART_14 }; static TrackOptionsSet sTrackOptions = { @@ -202,7 +251,7 @@ void EnRu_UpdateModel(EnRu* this, PlayState* play) { Vec3f playerPos; playerPos.x = player->actor.world.pos.x; - playerPos.y = player->bodyPartsPos[7].y + 3.0f; + playerPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; playerPos.z = player->actor.world.pos.z; SubS_TrackPoint(&playerPos, &this->actor.focus.pos, &this->actor.shape.rot, &this->trackTarget, &this->headRot, &this->torsoRot, &sTrackOptions); @@ -286,8 +335,8 @@ void EnRu_PostLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f headFocus = { 800.0f, 0, 0 }; Vec3f bodyPartPos = { 0, 0, 0 }; - if (sBodyPartPosIndices[limbIndex] >= 0) { - Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sBodyPartPosIndices[limbIndex]]); + if (sLimbToBodyParts[limbIndex] > BODYPART_NONE) { + Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == RU2_LIMB_HEAD) { Matrix_MultVec3f(&headFocus, &thisx->focus.pos); @@ -344,8 +393,8 @@ void EnRu_Draw(Actor* thisx, PlayState* play) { } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(&this->bodyPartsPos[0], &this->actor.world.pos, shadowTex, (i / 5.0f), - (ARRAY_COUNT(sRuBodyParts)), sRuShadowSizes, sRuBodyParts); + SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, RU_BODYPART_MAX, + sShadowSizes, sParentShadowBodyParts); } SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index 7e74031762..83f7d84261 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -12,7 +12,24 @@ struct EnRu; typedef void (*EnRuActionFunc)(struct EnRu*, PlayState*); -#define RU_BODYPARTSPOS_COUNT 15 +typedef enum EnRuBodyPart { + /* 0 */ RU_BODYPART_0, + /* 1 */ RU_BODYPART_1, + /* 2 */ RU_BODYPART_2, + /* 3 */ RU_BODYPART_3, + /* 4 */ RU_BODYPART_4, + /* 5 */ RU_BODYPART_5, + /* 6 */ RU_BODYPART_6, + /* 7 */ RU_BODYPART_7, + /* 8 */ RU_BODYPART_8, + /* 9 */ RU_BODYPART_9, + /* 10 */ RU_BODYPART_10, + /* 11 */ RU_BODYPART_11, + /* 12 */ RU_BODYPART_12, + /* 13 */ RU_BODYPART_13, + /* 14 */ RU_BODYPART_14, + /* 15 */ RU_BODYPART_MAX +} EnruBodyPart; typedef struct EnRu { /* 0x000 */ Actor actor; @@ -34,7 +51,7 @@ typedef struct EnRu { /* 0x324 */ UNK_TYPE1 pad324[0x12]; /* 0x336 */ s16 fidgetTableY[RU2_LIMB_MAX]; /* 0x364 */ s16 fidgetTableZ[RU2_LIMB_MAX]; - /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPARTSPOS_COUNT]; + /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPART_MAX]; /* 0x348 */ UNK_TYPE1 padUNK[6]; /* 0x44E */ s16 eyeState; /* 0x450 */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 62db8ff6fc..5359d5ecef 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -222,7 +222,7 @@ void EnRuppecrow_ShatterIce(EnRuppecrow* this, PlayState* play) { if (this->currentEffect == ENRUPPECROW_EFFECT_ICE) { this->currentEffect = ENRUPPECROW_EFFECT_NONE; this->unk_2C8 = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0x2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENRUPPECROW_BODYPART_MAX, 0x2, 0.2f, 0.2f); } } @@ -640,7 +640,7 @@ void EnRuppecrow_Init(Actor* thisx, PlayState* play2) { EnRuppecrow* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->joinTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h index 5d591258b1..f34df83751 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h @@ -9,19 +9,26 @@ #define ENRUPPECROW_PATH_INDEX_NONE 0x3F #define ENRUPPECROW_RUPEE_COUNT 20 -#define ENRUPPECROW_LIMB_POS_COUNT 4 struct EnRuppecrow; typedef void (*EnRuppecrowActionFunc)(struct EnRuppecrow*, PlayState*); +typedef enum EnRuppecrowBodyPart { + /* 0 */ ENRUPPECROW_BODYPART_0, + /* 1 */ ENRUPPECROW_BODYPART_1, + /* 2 */ ENRUPPECROW_BODYPART_2, + /* 3 */ ENRUPPECROW_BODYPART_3, + /* 4 */ ENRUPPECROW_BODYPART_MAX +} EnRuppecrowBodyPart; + typedef struct EnRuppecrow { /* 0x000 */ Actor actor; /* 0x144 */ EnItem00* rupees[ENRUPPECROW_RUPEE_COUNT]; /* 0x194 */ SkelAnime skelAnime; /* 0x1D8 */ EnRuppecrowActionFunc actionFunc; /* 0x1DC */ UNK_TYPE4 unk_1DC; // unused - /* 0x1E0 */ Vec3s joinTable[OBJECT_CROW_LIMB_MAX]; + /* 0x1E0 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; /* 0x216 */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x24C */ Path* path; /* 0x250 */ s32 currentPoint; @@ -36,7 +43,7 @@ typedef struct EnRuppecrow { /* 0x2C8 */ f32 unk_2C8; // set but not used /* 0x2CC */ f32 unk_2CC; // set but not used /* 0x2D0 */ f32 iceSfxTimer; - /* 0x2D4 */ Vec3f limbPos[ENRUPPECROW_LIMB_POS_COUNT]; + /* 0x2D4 */ Vec3f bodyPartsPos[ENRUPPECROW_BODYPART_MAX]; } EnRuppecrow; // size = 0x304 #endif // Z_EN_RUPPECROW_H diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 06491bba5a..6c232e2f8e 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -127,7 +127,7 @@ void func_80AE626C(EnShn* this) { this->unk_2BC = CLAMP(this->unk_2BC, -0x1FFE, 0x1FFE); Math_Vec3f_Copy(&shnPos, &this->actor.focus.pos); if (this->shnPlayerRef->actor.id == ACTOR_PLAYER) { - playerPos.y = this->shnPlayerRef->bodyPartsPos[7].y + 3.0f; + playerPos.y = this->shnPlayerRef->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&playerPos, &this->shnPlayerRef->actor.focus.pos); } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 1df91a4f02..5057777d4a 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -1008,22 +1008,22 @@ void func_80996BEC(EnSkb* this, PlayState* play) { Vec3f sp84; s32 i; s16 yaw; - s32 end; + s32 bodyPartsCount; if (this->unk_3D8 & 2) { - end = 13; + bodyPartsCount = ENSKB_BODYPART_MAX - 1; } else { - end = 14; + bodyPartsCount = ENSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < end; i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(yaw) * 3.0f; sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); } } @@ -1118,11 +1118,11 @@ void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } else if ((limbIndex == 11) && !(this->unk_3D8 & 2)) { - Matrix_MultVec3f(&D_80997564, &this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultVec3f(&D_80997564, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -1130,13 +1130,13 @@ void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, EnSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if (this->unk_3D8 & 0x40) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 1970ebf8c4..983e8cc5da 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -13,6 +13,24 @@ typedef enum { /* 0 */ ENSKB_PARAM_0 } EnSkbParam; +typedef enum EnSkbBodyPart { + /* 0 */ ENSKB_BODYPART_0, + /* 1 */ ENSKB_BODYPART_1, + /* 2 */ ENSKB_BODYPART_2, + /* 3 */ ENSKB_BODYPART_3, + /* 4 */ ENSKB_BODYPART_4, + /* 5 */ ENSKB_BODYPART_5, + /* 6 */ ENSKB_BODYPART_6, + /* 7 */ ENSKB_BODYPART_7, + /* 8 */ ENSKB_BODYPART_8, + /* 9 */ ENSKB_BODYPART_9, + /* 10 */ ENSKB_BODYPART_10, + /* 11 */ ENSKB_BODYPART_11, + /* 12 */ ENSKB_BODYPART_12, + /* 13 */ ENSKB_BODYPART_13, + /* 14 */ ENSKB_BODYPART_MAX +} EnSkbBodyPart; + typedef struct EnSkb { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -21,8 +39,8 @@ typedef struct EnSkb { /* 0x228 */ EnSkbActionFunc actionFunc; /* 0x22C */ f32 drawDmgEffAlpha; /* 0x230 */ f32 drawDmgEffScale; - /* 0x234 */ Vec3f limbPos[14]; - /* 0x2DC */ s32 limbCount; + /* 0x234 */ Vec3f bodyPartsPos[ENSKB_BODYPART_MAX]; + /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ Vec3s jointTable[20]; /* 0x358 */ Vec3s morphTable[20]; /* 0x3D0 */ s16 unk_3D0; diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 540cf9cb2f..98da2425d1 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -154,22 +154,25 @@ static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; static Vec3f sBubbleAccel = { 0.0f, -0.8f, 0.0f }; static Color_RGBA8 sPrimColors[] = { - { 255, 255, 255, 255 }, - { 255, 255, 0, 255 }, - { 255, 255, 200, 255 }, - { 225, 200, 255, 255 }, + { 255, 255, 255, 255 }, // EN_SLIME_TYPE_BLUE + { 255, 255, 0, 255 }, // EN_SLIME_TYPE_GREEN + { 255, 255, 200, 255 }, // EN_SLIME_TYPE_YELLOW + { 225, 200, 255, 255 }, // EN_SLIME_TYPE_RED }; static Color_RGBA8 sEnvColors[] = { - { 140, 255, 195, 255 }, - { 50, 255, 0, 255 }, - { 255, 180, 0, 255 }, - { 255, 50, 155, 255 }, + { 140, 255, 195, 255 }, // EN_SLIME_TYPE_BLUE + { 50, 255, 0, 255 }, // EN_SLIME_TYPE_GREEN + { 255, 180, 0, 255 }, // EN_SLIME_TYPE_YELLOW + { 255, 50, 155, 255 }, // EN_SLIME_TYPE_RED }; -static Vec3f sLimbPosOffsets[EN_SLIME_LIMBPOS_COUNT] = { - { 2000.0f, 2000.0f, 0.0f }, { -1500.0f, 2500.0f, -500.0f }, { -500.0f, 1000.0f, 2500.0f }, - { 0.0f, 4000.0f, 0.0f }, { 0.0f, 2000.0f, -2000.0f }, +static Vec3f sBodyPartPosOffsets[EN_SLIME_BODYPART_MAX] = { + { 2000.0f, 2000.0f, 0.0f }, // EN_SLIME_BODYPART_0 + { -1500.0f, 2500.0f, -500.0f }, // EN_SLIME_BODYPART_1 + { -500.0f, 1000.0f, 2500.0f }, // EN_SLIME_BODYPART_2 + { 0.0f, 4000.0f, 0.0f }, // EN_SLIME_BODYPART_3 + { 0.0f, 2000.0f, -2000.0f }, // EN_SLIME_BODYPART_4 }; AnimatedMaterial* sSlimeTexAnim; @@ -263,7 +266,7 @@ void EnSlime_Thaw(EnSlime* this, PlayState* play) { this->drawDmgEffType = 0; // So it's not triggered again until Freeze has been called again. this->collider.base.colType = COLTYPE_NONE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_SLIME_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -1217,8 +1220,8 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gChuchuEyesDL); } - for (i = 0; i < EN_SLIME_LIMBPOS_COUNT; i++) { - Matrix_MultVec3f(&sLimbPosOffsets[i], &this->limbPos[i]); + for (i = 0; i < EN_SLIME_BODYPART_MAX; i++) { + Matrix_MultVec3f(&sBodyPartPosOffsets[i], &this->bodyPartsPos[i]); } if (this->actionFunc == EnSlime_Revive) { @@ -1243,7 +1246,7 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_SLIME_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.h b/src/overlays/actors/ovl_En_Slime/z_en_slime.h index 130c442def..fbae533ea4 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.h +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.h @@ -5,14 +5,29 @@ #include "objects/object_slime/object_slime.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define EN_SLIME_LIMBPOS_COUNT 5 +struct EnSlime; + +typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); + #define EN_SLIME_GET_TYPE(thisx) ((thisx)->params) #define EN_SLIME_GET_REVIVE_TIME(thisx) ((((thisx)->params) >> 8) & 0xFF) -struct EnSlime; +typedef enum EnSlimeType { + /* 0 */ EN_SLIME_TYPE_BLUE, + /* 1 */ EN_SLIME_TYPE_GREEN, + /* 2 */ EN_SLIME_TYPE_YELLOW, + /* 3 */ EN_SLIME_TYPE_RED +} EnSlimeType; -typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); +typedef enum EnSlimeBodyPart { + /* 0 */ EN_SLIME_BODYPART_0, + /* 1 */ EN_SLIME_BODYPART_1, + /* 2 */ EN_SLIME_BODYPART_2, + /* 3 */ EN_SLIME_BODYPART_3, + /* 4 */ EN_SLIME_BODYPART_4, + /* 5 */ EN_SLIME_BODYPART_MAX +} EnSlimeBodyPart; typedef struct EnSlime { /* 0x000 */ Actor actor; @@ -34,15 +49,8 @@ typedef struct EnSlime { /* 0x16C */ f32 drawDmgEffFrozenSteamScale; /* 0x170 */ f32 distLimit; /* 0x174 */ Vec3f reviveScale; - /* 0x180 */ Vec3f limbPos[EN_SLIME_LIMBPOS_COUNT]; + /* 0x180 */ Vec3f bodyPartsPos[EN_SLIME_BODYPART_MAX]; /* 0x1BC */ ColliderCylinder collider; } EnSlime; // size = 0x208 -typedef enum EnSlimeType { - /* 0 */ EN_SLIME_TYPE_BLUE, - /* 1 */ EN_SLIME_TYPE_GREEN, - /* 2 */ EN_SLIME_TYPE_YELLOW, - /* 3 */ EN_SLIME_TYPE_RED -} EnSlimeType; - #endif // Z_EN_SLIME_H 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 d289cf89d3..b935b46d47 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -1125,11 +1125,21 @@ void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play) { /** * This maps a given limb based on its limbIndex to its appropriate index - * in the bodyPartsPos array. An index of -1 indicates that the limb is - * not part of the bodyPartsPos array. + * in the bodyPartsPos array. */ -static s8 sLimbIndexToBodyPartsPosIndex[] = { - -1, -1, -1, -1, -1, -1, 0, 1, -1, 2, 3, 4, +static s8 sLimbToBodyParts[EENO_LIMB_MAX] = { + BODYPART_NONE, // EENO_LIMB_NONE + BODYPART_NONE, // EENO_LIMB_ROOT + BODYPART_NONE, // EENO_LIMB_BODY_TOP + BODYPART_NONE, // EENO_LIMB_LEFT_EYE + BODYPART_NONE, // EENO_LIMB_RIGHT_EYE + BODYPART_NONE, // EENO_LIMB_LEFT_UPPER_ARM + EN_SNOWMAN_BODYPART_0, // EENO_LIMB_LEFT_FOREARM + EN_SNOWMAN_BODYPART_1, // EENO_LIMB_LEFT_HAND + BODYPART_NONE, // EENO_LIMB_RIGHT_UPPER_ARM + EN_SNOWMAN_BODYPART_2, // EENO_LIMB_RIGHT_FOREARM + EN_SNOWMAN_BODYPART_3, // EENO_LIMB_RIGHT_HAND + EN_SNOWMAN_BODYPART_4, // EENO_LIMB_BODY_BOTTOM }; /** @@ -1137,8 +1147,11 @@ static s8 sLimbIndexToBodyPartsPosIndex[] = { * bottom limb, each offset by a certain certain amount. */ static Vec3f sBodyBottomBodyPartOffsets[] = { - { 2000.0f, 3000.0f, 0.0f }, { 2000.0f, -2000.0f, 0.0f }, { 3000.0f, 0.0f, 0.0f }, - { 1000.0f, 0.0f, 3000.0f }, { 1000.0f, 0.0f, -3000.0f }, + { 2000.0f, 3000.0f, 0.0f }, // EN_SNOWMAN_BODYPART_4 + { 2000.0f, -2000.0f, 0.0f }, // EN_SNOWMAN_BODYPART_5 + { 3000.0f, 0.0f, 0.0f }, // EN_SNOWMAN_BODYPART_6 + { 1000.0f, 0.0f, 3000.0f }, // EN_SNOWMAN_BODYPART_7 + { 1000.0f, 0.0f, -3000.0f }, // EN_SNOWMAN_BODYPART_8 }; void EnSnowman_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { @@ -1147,13 +1160,13 @@ void EnSnowman_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Gfx* gfx; s32 i; - if (sLimbIndexToBodyPartsPosIndex[limbIndex] != -1) { - if (sLimbIndexToBodyPartsPosIndex[limbIndex] == 4) { - for (i = 0; i < 5; i++) { - Matrix_MultVec3f(&sBodyBottomBodyPartOffsets[i], &this->bodyPartsPos[i + 4]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + if (sLimbToBodyParts[limbIndex] == EN_SNOWMAN_BODYPART_4) { + for (i = 0; i < ARRAY_COUNT(sBodyBottomBodyPartOffsets); i++) { + Matrix_MultVec3f(&sBodyBottomBodyPartOffsets[i], &this->bodyPartsPos[EN_SNOWMAN_BODYPART_4 + i]); } } else { - Matrix_MultZero(&this->bodyPartsPos[sLimbIndexToBodyPartsPosIndex[limbIndex]]); + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } } @@ -1186,7 +1199,7 @@ void EnSnowman_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnSnowman_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_SNOWMAN_BODYPART_MAX, this->drawDmgEffScale * this->eenoScale, 0.0f, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h index 55285fec87..2533c2595c 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h @@ -19,6 +19,19 @@ struct EnSnowman; typedef void (*EnSnowmanActionFunc)(struct EnSnowman*, PlayState*); +typedef enum EnSnowmanBodyPart { + /* 0 */ EN_SNOWMAN_BODYPART_0, + /* 1 */ EN_SNOWMAN_BODYPART_1, + /* 2 */ EN_SNOWMAN_BODYPART_2, + /* 3 */ EN_SNOWMAN_BODYPART_3, + /* 4 */ EN_SNOWMAN_BODYPART_4, + /* 5 */ EN_SNOWMAN_BODYPART_5, + /* 6 */ EN_SNOWMAN_BODYPART_6, + /* 7 */ EN_SNOWMAN_BODYPART_7, + /* 8 */ EN_SNOWMAN_BODYPART_8, + /* 9 */ EN_SNOWMAN_BODYPART_MAX +} EnSnowmanBodyPart; + typedef struct EnSnowman { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -50,7 +63,7 @@ typedef struct EnSnowman { /* 0x2A4 */ f32 drawDmgEffScale; /* 0x2A8 */ Vec3f combinePos; /* 0x2B4 */ Vec3f snowballPos; - /* 0x2C0 */ Vec3f bodyPartsPos[9]; + /* 0x2C0 */ Vec3f bodyPartsPos[EN_SNOWMAN_BODYPART_MAX]; /* 0x32C */ ColliderCylinder collider; } EnSnowman; // size = 0x378 diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 566b074c71..dd8d21f652 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -272,7 +272,7 @@ s32 func_808A576C(EnSt* this) { s32 i; s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % 12) * 0x1555; - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++, phi_s2 += 0x1555) { + for (i = 0; i < ENST_BODYPART_MAX; i++, phi_s2 += 0x1555) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->unk_31C[i] = (Rand_ZeroOne() * 16.0f) + 8.0f; } else { @@ -282,46 +282,46 @@ s32 func_808A576C(EnSt* this) { this->drawDmgEffFrozenSteamScales[i] = 0.90000004f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_BLUE_FIRE)) { - this->unk_358[i].y = ((Rand_ZeroOne() - 0.5f) * 40.0f) - 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 40.0f) - 10.0f; } else { - this->unk_358[i].y = ((Rand_ZeroOne() - 0.5f) * 30.0f) + 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 30.0f) + 10.0f; } - this->unk_358[i].x = Math_SinS(phi_s2) * 18.0f; - this->unk_358[i].z = Math_CosS(phi_s2) * 18.0f; + this->bodyPartsPos[i].x = Math_SinS(phi_s2) * 18.0f; + this->bodyPartsPos[i].z = Math_CosS(phi_s2) * 18.0f; } this->unk_31A = 1; return false; } -s32 func_808A5988(EnSt* this, PlayState* play, s32 arg2) { - s32 ret = false; +s32 func_808A5988(EnSt* this, PlayState* play, s32 bodyPartIndex) { + s32 ret = 0; u8 drawDmgEffType; - Vec3f limbPos[1]; + Vec3f bodyPartPos[1]; f32 drawDmgEffAlpha; - if (arg2 < this->unk_31A) { - if (this->unk_31C[arg2] != 0) { - drawDmgEffAlpha = (f32)this->unk_31C[arg2] / this->unk_334[arg2]; + if (bodyPartIndex < this->unk_31A) { + if (this->unk_31C[bodyPartIndex] != 0) { + drawDmgEffAlpha = (f32)this->unk_31C[bodyPartIndex] / this->unk_334[bodyPartIndex]; drawDmgEffType = this->drawDmgEffType; - Math_ApproachF(&this->drawDmgEffFrozenSteamScales[arg2], 0.6f, 0.3f, 0.5f); - Math_Vec3f_Copy(&limbPos[0], &this->actor.world.pos); + Math_ApproachF(&this->drawDmgEffFrozenSteamScales[bodyPartIndex], 0.6f, 0.3f, 0.5f); + Math_Vec3f_Copy(&bodyPartPos[0], &this->actor.world.pos); - limbPos[0].x += this->unk_358[arg2].x; - limbPos[0].y += this->unk_358[arg2].y; - limbPos[0].z += this->unk_358[arg2].z; + bodyPartPos[0].x += this->bodyPartsPos[bodyPartIndex].x; + bodyPartPos[0].y += this->bodyPartsPos[bodyPartIndex].y; + bodyPartPos[0].z += this->bodyPartsPos[bodyPartIndex].z; if (drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if ((this->unk_334[arg2] - this->unk_31C[arg2]) < 20) { + if ((this->unk_334[bodyPartIndex] - this->unk_31C[bodyPartIndex]) < 20) { drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.6f, - this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); - ret = true; + Actor_DrawDamageEffects(play, &this->actor, bodyPartPos, ARRAY_COUNT(bodyPartPos), 0.6f, + this->drawDmgEffFrozenSteamScales[bodyPartIndex], drawDmgEffAlpha, drawDmgEffType); + ret = 1; } } return ret; @@ -331,14 +331,14 @@ void func_808A5AF8(EnSt* this, PlayState* play) { Vec3f sp54; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_358); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); - sp54.x += this->unk_358[i].x; - sp54.y += this->unk_358[i].y; - sp54.z += this->unk_358[i].z; - Math_Vec3f_Copy(&this->unk_358[i], &sp54); + sp54.x += this->bodyPartsPos[i].x; + sp54.y += this->bodyPartsPos[i].y; + sp54.z += this->bodyPartsPos[i].z; + Math_Vec3f_Copy(&this->bodyPartsPos[i], &sp54); } - Actor_SpawnIceEffects(play, &this->actor, this->unk_358, 12, 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENST_BODYPART_MAX, 3, 0.1f, 0.3f); } s16 func_808A5BEC(EnSt* this) { @@ -558,7 +558,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if (this->collider3.base.acFlags & AC_HIT) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on this->unk_318 = 0; @@ -581,7 +581,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on this->unk_318 = 0; @@ -757,16 +757,16 @@ void func_808A6D84(EnSt* this, PlayState* play) { void func_808A6E24(EnSt* this, PlayState* play) { s32 i; - s32 count = 0; + s32 bodyPartsCount = 0; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { if (DECR(this->unk_31C[i]) == 0) { - count++; + bodyPartsCount++; } } - if (count == ARRAY_COUNT(this->unk_31C)) { + if (bodyPartsCount == ENST_BODYPART_MAX) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 7); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_BLUE_FIRE; this->unk_2CC = 0.0f; @@ -811,20 +811,20 @@ void func_808A6E24(EnSt* this, PlayState* play) { void func_808A701C(EnSt* this, PlayState* play) { s32 i; - s32 count = 0; + s32 bodyPartsCount = 0; if (this->unk_18C & 0x40) { if (DECR(this->unk_318) == 0) { this->unk_18C |= 0x20; } - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { if (DECR(this->unk_31C[i]) == 0) { - count++; + bodyPartsCount++; } } - if (count == ARRAY_COUNT(this->unk_31C)) { + if (bodyPartsCount == ENST_BODYPART_MAX) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0); Actor_Kill(&this->actor); } @@ -892,7 +892,7 @@ void EnSt_Update(Actor* thisx, PlayState* play) { s32 i; // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on } } @@ -918,7 +918,7 @@ s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void func_808A7478(Actor* thisx, PlayState* play) { EnSt* this = THIS; - s32 i; + s32 bodyPartIndex; s32 count; if (!(this->unk_18C & 0x20)) { @@ -937,8 +937,8 @@ void func_808A7478(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } - for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_31C); i++) { - count += func_808A5988(this, play, i); + for (bodyPartIndex = 0, count = 0; bodyPartIndex < ENST_BODYPART_MAX; bodyPartIndex++) { + count += func_808A5988(this, play, bodyPartIndex); } if (count != 0) { diff --git a/src/overlays/actors/ovl_En_St/z_en_st.h b/src/overlays/actors/ovl_En_St/z_en_st.h index 5c63a96644..0dcfb3d00a 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/src/overlays/actors/ovl_En_St/z_en_st.h @@ -13,6 +13,22 @@ typedef void (*EnStActionFunc)(struct EnSt*, PlayState*); #define ENST_3F_63 63 #define ENST_1C0_1 1 +typedef enum EnStBodyPart { + /* 0 */ ENST_BODYPART_0, + /* 1 */ ENST_BODYPART_1, + /* 2 */ ENST_BODYPART_2, + /* 3 */ ENST_BODYPART_3, + /* 4 */ ENST_BODYPART_4, + /* 5 */ ENST_BODYPART_5, + /* 6 */ ENST_BODYPART_6, + /* 7 */ ENST_BODYPART_7, + /* 8 */ ENST_BODYPART_8, + /* 9 */ ENST_BODYPART_9, + /* 10 */ ENST_BODYPART_10, + /* 11 */ ENST_BODYPART_11, + /* 12 */ ENST_BODYPART_MAX +} EnStBodyPart; + typedef struct EnSt { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -39,11 +55,11 @@ typedef struct EnSt { /* 0x316 */ s16 unk_316; /* 0x318 */ s16 unk_318; /* 0x31A */ s16 unk_31A; - /* 0x31C */ s16 unk_31C[12]; - /* 0x334 */ s16 unk_334[12]; + /* 0x31C */ s16 unk_31C[ENST_BODYPART_MAX]; + /* 0x334 */ s16 unk_334[ENST_BODYPART_MAX]; /* 0x34C */ f32 unk_34C; /* 0x350 */ UNK_TYPE1 unk_350[0x8]; - /* 0x358 */ Vec3f unk_358[12]; + /* 0x358 */ Vec3f bodyPartsPos[ENST_BODYPART_MAX]; /* 0x3E8 */ Vec3s jointTable[30]; /* 0x49C */ Vec3s morphTable[30]; } EnSt; // size = 0x550 diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 016f74dd30..3842afa88c 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -173,10 +173,10 @@ void func_808D8940(EnSw* this, PlayState* play) { } s32 func_808D8B58(EnSw* this) { - s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % ARRAY_COUNT(this->unk_464)) * 0x1555; + s16 phi_s2 = (s16)(TRUNCF_BINANG(Rand_ZeroOne() * 1000.0f) % ENSW_BODYPART_MAX) * 0x1555; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_464); i++, phi_s2 += 0x1555) { + for (i = 0; i < ENSW_BODYPART_MAX; i++, phi_s2 += 0x1555) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->unk_464[i] = (Rand_ZeroOne() * 16.0f) + 8.0f; } else { @@ -186,41 +186,41 @@ s32 func_808D8B58(EnSw* this) { this->drawDmgEffFrozenSteamScales[i] = 0.45000002f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_BLUE_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - this->unk_380[i].y = (Rand_ZeroOne() - 0.5f) * 20.0f; + this->bodyPartsPos[i].y = (Rand_ZeroOne() - 0.5f) * 20.0f; } else { - this->unk_380[i].y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + 10.0f; } - this->unk_380[i].x = Math_SinS(phi_s2) * 10.0f; - this->unk_380[i].z = Math_CosS(phi_s2) * 10.0f; + this->bodyPartsPos[i].x = Math_SinS(phi_s2) * 10.0f; + this->bodyPartsPos[i].z = Math_CosS(phi_s2) * 10.0f; } this->unk_462 = 1; return 0; } -s32 func_808D8D60(EnSw* this, PlayState* play, s32 arg2) { - s32 ret = false; +s32 func_808D8D60(EnSw* this, PlayState* play, s32 bodyPartIndex) { + s32 ret = 0; u8 drawDmgEffType; - Vec3f limbPos[1]; + Vec3f bodyPartsPos[1]; f32 drawDmgEffAlpha; - if (arg2 < this->unk_462) { - if (this->unk_464[arg2] != 0) { - drawDmgEffAlpha = (f32)this->unk_464[arg2] / this->unk_47C[arg2]; + if (bodyPartIndex < this->unk_462) { + if (this->unk_464[bodyPartIndex] != 0) { + drawDmgEffAlpha = (f32)this->unk_464[bodyPartIndex] / this->unk_47C[bodyPartIndex]; drawDmgEffType = this->drawDmgEffType; - Math_ApproachF(&this->drawDmgEffFrozenSteamScales[arg2], 0.3f, 0.3f, 0.5f); - Math_Vec3f_Copy(&limbPos[0], &this->actor.world.pos); - limbPos[0].x += this->unk_380[arg2].x; - limbPos[0].y += this->unk_380[arg2].y; - limbPos[0].z += this->unk_380[arg2].z; + Math_ApproachF(&this->drawDmgEffFrozenSteamScales[bodyPartIndex], 0.3f, 0.3f, 0.5f); + Math_Vec3f_Copy(&bodyPartsPos[0], &this->actor.world.pos); + bodyPartsPos[0].x += this->bodyPartsPos[bodyPartIndex].x; + bodyPartsPos[0].y += this->bodyPartsPos[bodyPartIndex].y; + bodyPartsPos[0].z += this->bodyPartsPos[bodyPartIndex].z; if (drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if ((this->unk_47C[arg2] - this->unk_464[arg2]) < 20) { + if ((this->unk_47C[bodyPartIndex] - this->unk_464[bodyPartIndex]) < 20) { drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.3f, - this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); - ret = true; + Actor_DrawDamageEffects(play, &this->actor, bodyPartsPos, ARRAY_COUNT(bodyPartsPos), 0.3f, + this->drawDmgEffFrozenSteamScales[bodyPartIndex], drawDmgEffAlpha, drawDmgEffType); + ret = 1; } } return ret; @@ -230,14 +230,14 @@ void func_808D8ED0(EnSw* this, PlayState* play) { Vec3f sp54; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_380); i++) { + for (i = 0; i < ENSW_BODYPART_MAX; i++) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); - sp54.x += this->unk_380[i].x; - sp54.y += this->unk_380[i].y; - sp54.z += this->unk_380[i].z; - Math_Vec3f_Copy(&this->unk_380[i], &sp54); + sp54.x += this->bodyPartsPos[i].x; + sp54.y += this->bodyPartsPos[i].y; + sp54.z += this->bodyPartsPos[i].z; + Math_Vec3f_Copy(&this->bodyPartsPos[i], &sp54); } - Actor_SpawnIceEffects(play, &this->actor, this->unk_380, ARRAY_COUNT(this->unk_380), 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENSW_BODYPART_MAX, 3, 0.1f, 0.3f); } void func_808D8FC4(EnSw* this, PlayState* play) { @@ -1281,6 +1281,9 @@ s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po case 4: *dList = object_st_DL_0043D8; break; + + default: + break; } } return false; @@ -1288,7 +1291,7 @@ s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = THIS; - s32 i; + s32 bodyPartIndex; s32 count; if (this->unk_410 & 4) { @@ -1301,8 +1304,8 @@ void EnSw_Draw(Actor* thisx, PlayState* play) { &this->actor); } - for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) { - count += func_808D8D60(this, play, i); + for (bodyPartIndex = 0, count = 0; bodyPartIndex < ENSW_BODYPART_MAX; bodyPartIndex++) { + count += func_808D8D60(this, play, bodyPartIndex); } if (count != 0) { diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h index f77d122672..9cb68a3faf 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -15,6 +15,22 @@ typedef void (*EnSwActionFunc)(struct EnSw*, PlayState*); #define ENSW_PATH_INDEX_NONE 0xFF +typedef enum EnSwBodyPart { + /* 0 */ ENSW_BODYPART_0, + /* 1 */ ENSW_BODYPART_1, + /* 2 */ ENSW_BODYPART_2, + /* 3 */ ENSW_BODYPART_3, + /* 4 */ ENSW_BODYPART_4, + /* 5 */ ENSW_BODYPART_5, + /* 6 */ ENSW_BODYPART_6, + /* 7 */ ENSW_BODYPART_7, + /* 8 */ ENSW_BODYPART_8, + /* 9 */ ENSW_BODYPART_9, + /* 10 */ ENSW_BODYPART_10, + /* 11 */ ENSW_BODYPART_11, + /* 12 */ ENSW_BODYPART_MAX +} EnSwBodyPart; + typedef struct EnSw { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,11 +43,11 @@ typedef struct EnSw { /* 0x35C */ Vec3f unk_35C; /* 0x368 */ Vec3f unk_368; /* 0x374 */ Vec3f unk_374; - /* 0x380 */ Vec3f unk_380[12]; + /* 0x380 */ Vec3f bodyPartsPos[ENSW_BODYPART_MAX]; /* 0x410 */ u16 unk_410; /* 0x412 */ u8 drawDmgEffType; /* 0x414 */ f32 unk_414; - /* 0x418 */ f32 drawDmgEffFrozenSteamScales[12]; + /* 0x418 */ f32 drawDmgEffFrozenSteamScales[ENSW_BODYPART_MAX]; /* 0x448 */ f32 unk_448; /* 0x44C */ f32 unk_44C; /* 0x450 */ f32 unk_450; @@ -43,8 +59,8 @@ typedef struct EnSw { /* 0x45E */ s16 unk_45E; /* 0x460 */ s16 unk_460; /* 0x462 */ s16 unk_462; - /* 0x464 */ s16 unk_464[12]; - /* 0x47C */ s16 unk_47C[12]; + /* 0x464 */ s16 unk_464[ENSW_BODYPART_MAX]; + /* 0x47C */ s16 unk_47C[ENSW_BODYPART_MAX]; /* 0x494 */ s16 unk_494; /* 0x496 */ s16 unk_496; /* 0x498 */ s16 unk_498; diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index df20a36961..7e5cebb1c5 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -307,8 +307,8 @@ void EnSyatekiCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec Vec3f* bodyPartPos; if (limbIndex == OBJECT_CROW_LIMB_BODY) { - Matrix_MultVec3f(&sBodyOffset, &this->bodyPartsPos[0]); - this->bodyPartsPos[0].y -= 20.0f; + Matrix_MultVec3f(&sBodyOffset, &this->bodyPartsPos[SG_GUAY_BODYPART_BODY]); + this->bodyPartsPos[SG_GUAY_BODYPART_BODY].y -= 20.0f; } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_TAIL)) { bodyPartPos = &this->bodyPartsPos[(limbIndex >> 1) - 1]; diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index 71f3466453..fd9a679d80 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -13,9 +13,17 @@ struct EnSyatekiCrow; typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, PlayState*); +typedef enum EnSyatekiCrowBodyPart { + /* 0 */ SG_GUAY_BODYPART_BODY, + /* 1 */ SG_GUAY_BODYPART_RIGHT_WING_TIP, + /* 2 */ SG_GUAY_BODYPART_LEFT_WING_TIP, + /* 3 */ SG_GUAY_BODYPART_TAIL, + /* 4 */ SG_GUAY_BODYPART_MAX +} EnSyatekiCrowBodyPart; + typedef struct EnSyatekiCrow { /* 0x000 */ Actor actor; - /* 0x144 */ Vec3f bodyPartsPos[4]; + /* 0x144 */ Vec3f bodyPartsPos[SG_GUAY_BODYPART_MAX]; /* 0x174 */ SkelAnime skelAnime; /* 0x1B8 */ EnSyatekiCrowActionFunc actionFunc; /* 0x1BC */ s16 waitTimer; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 47500edf0b..0a324592bc 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -225,7 +225,7 @@ void func_80BE07A0(EnTab* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_1E0->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_1E0)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_1E0)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_1E0->focus.pos); } diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 37ab26196e..fcf0d89850 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -252,8 +252,8 @@ void EnTalkGibud_Init(Actor* thisx, PlayState* play) { this->drawDmgEffAlpha = 0.0f; this->drawDmgEffScale = 0.0f; - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - this->limbPos[i] = gZeroVec3f; + for (i = 0; i < EN_TALK_GIBUD_BODYPART_MAX; i++) { + this->bodyPartsPos[i] = gZeroVec3f; } if (this->requestedItemIndex < EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BLUE_POTION) { @@ -1188,8 +1188,8 @@ void EnTalkGibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s (limbIndex == GIBDO_LIMB_LEFT_FOREARM) || (limbIndex == GIBDO_LIMB_LEFT_HAND) || (limbIndex == GIBDO_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == GIBDO_LIMB_RIGHT_FOREARM) || (limbIndex == GIBDO_LIMB_RIGHT_HAND) || (limbIndex == GIBDO_LIMB_HEAD) || (limbIndex == GIBDO_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1198,7 +1198,7 @@ void EnTalkGibud_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->actor.shape.shadowAlpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1220,8 +1220,8 @@ void EnTalkGibud_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, - 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_TALK_GIBUD_BODYPART_MAX, + this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h index d887b1c0d3..0819cd893a 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h @@ -11,13 +11,32 @@ struct EnTalkGibud; typedef void (*EnTalkGibudActionFunc)(struct EnTalkGibud*, PlayState*); +typedef enum EnTalkGibudBodyPart { + /* 0 */ EN_TALK_GIBUD_BODYPART_0, + /* 1 */ EN_TALK_GIBUD_BODYPART_1, + /* 2 */ EN_TALK_GIBUD_BODYPART_2, + /* 3 */ EN_TALK_GIBUD_BODYPART_3, + /* 4 */ EN_TALK_GIBUD_BODYPART_4, + /* 5 */ EN_TALK_GIBUD_BODYPART_5, + /* 6 */ EN_TALK_GIBUD_BODYPART_6, + /* 7 */ EN_TALK_GIBUD_BODYPART_7, + /* 8 */ EN_TALK_GIBUD_BODYPART_8, + /* 9 */ EN_TALK_GIBUD_BODYPART_9, + /* 10 */ EN_TALK_GIBUD_BODYPART_10, + /* 11 */ EN_TALK_GIBUD_BODYPART_11, + /* 12 */ EN_TALK_GIBUD_BODYPART_12, + /* 13 */ EN_TALK_GIBUD_BODYPART_13, + /* 14 */ EN_TALK_GIBUD_BODYPART_14, + /* 15 */ EN_TALK_GIBUD_BODYPART_MAX +} EnTalkGibudBodyPart; + typedef struct EnTalkGibud { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnTalkGibudActionFunc actionFunc; - /* 0x1D8 */ Vec3f limbPos[15]; - /* 0x28C */ s32 limbIndex; + /* 0x1D8 */ Vec3f bodyPartsPos[EN_TALK_GIBUD_BODYPART_MAX]; + /* 0x28C */ s32 bodyPartIndex; /* 0x290 */ s32 requestedItemIndex; /* 0x294 */ PlayerItemAction itemAction; /* 0x298 */ s32 switchFlag; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 2e0b176057..b5742b7d69 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -1188,9 +1188,12 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL Actor* leftHandActor = this->player.heldActor; if (leftHandActor != NULL) { - leftHandActor->world.pos.x = (this->player.bodyPartsPos[15].x + this->player.leftHandWorld.pos.x) / 2.0f; - leftHandActor->world.pos.y = (this->player.bodyPartsPos[15].y + this->player.leftHandWorld.pos.y) / 2.0f; - leftHandActor->world.pos.z = (this->player.bodyPartsPos[15].z + this->player.leftHandWorld.pos.z) / 2.0f; + leftHandActor->world.pos.x = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].x + this->player.leftHandWorld.pos.x) / 2.0f; + leftHandActor->world.pos.y = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].y + this->player.leftHandWorld.pos.y) / 2.0f; + leftHandActor->world.pos.z = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].z + this->player.leftHandWorld.pos.z) / 2.0f; } } else if (limbIndex == OBJECT_TEST3_LIMB_0B) { Actor* actor730 = this->player.targetedActor; diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 59cb9d6f0d..5e22503887 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -465,7 +465,7 @@ void func_80C114C0(EnThiefbird* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_THIEFBIRD_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -656,8 +656,8 @@ void func_80C11DF0(EnThiefbird* this, PlayState* play) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); + for (i = 0; i < EN_THIEFBIRD_BODYPART_MAX; i++) { + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); @@ -888,10 +888,10 @@ void func_80C127F4(EnThiefbird* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &this->unk_3EC->actor), 3, 0x2000, 0x100); } - temp_v0 = Math_Vec3f_Pitch(&this->limbPos[9], &this->unk_3EC->actor.world.pos); + temp_v0 = Math_Vec3f_Pitch(&this->bodyPartsPos[EN_THIEFBIRD_BODYPART_9], &this->unk_3EC->actor.world.pos); temp_v0 = CLAMP(temp_v0, -0x3000, 0x3000); Math_SmoothStepToS(&this->actor.shape.rot.x, temp_v0, 4, 0x800, 0x80); - temp_f0 = Actor_WorldDistXYZToPoint(&this->unk_3EC->actor, &this->limbPos[9]); + temp_f0 = Actor_WorldDistXYZToPoint(&this->unk_3EC->actor, &this->bodyPartsPos[EN_THIEFBIRD_BODYPART_9]); this->actor.speed = (0.02f * temp_f0) + 2.0f; this->actor.speed = CLAMP_MAX(this->actor.speed, 4.0f); if ((this->unk_3EC->actor.speed <= 0.0f) && (temp_f0 < 40.0f)) { @@ -1065,14 +1065,31 @@ s32 EnThiefbird_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve return false; } +static s8 sLimbToBodyParts[TAKKURI_LIMB_MAX] = { + BODYPART_NONE, // TAKKURI_LIMB_NONE + EN_THIEFBIRD_BODYPART_0, // TAKKURI_LIMB_BODY + BODYPART_NONE, // TAKKURI_LIMB_LEFT_WING_BASE + EN_THIEFBIRD_BODYPART_1, // TAKKURI_LIMB_LEFT_WING_MIDDLE + EN_THIEFBIRD_BODYPART_3, // TAKKURI_LIMB_LEFT_WING_TIP + BODYPART_NONE, // TAKKURI_LIMB_RIGHT_WING_BASE + EN_THIEFBIRD_BODYPART_2, // TAKKURI_LIMB_RIGHT_WING_MIDDLE + EN_THIEFBIRD_BODYPART_5, // TAKKURI_LIMB_RIGHT_WING_TIP + BODYPART_NONE, // TAKKURI_LIMB_NECK + BODYPART_NONE, // TAKKURI_LIMB_HEAD + EN_THIEFBIRD_BODYPART_7, // TAKKURI_LIMB_RIGHT_EAR + EN_THIEFBIRD_BODYPART_8, // TAKKURI_LIMB_LEFT_EAR + EN_THIEFBIRD_BODYPART_9, // TAKKURI_LIMB_LOWER_BEAK + BODYPART_NONE, // TAKKURI_LIMB_EYES + BODYPART_NONE, // TAKKURI_LIMB_LEGS + EN_THIEFBIRD_BODYPART_10, // TAKKURI_LIMB_FEET + BODYPART_NONE, // TAKKURI_LIMB_STOLEN_ITEM +}; + void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_80C13698[] = { - -1, 0, -1, 1, 3, -1, 2, 5, -1, -1, 7, 8, 9, -1, -1, 10, -1, - }; EnThiefbird* this = THIS; s32 pad; Gfx* gfx; - s8 idx; + s8 bodyPartIndex; Collider_UpdateSpheres(limbIndex, &this->collider); if ((limbIndex == TAKKURI_LIMB_RIGHT_EAR) || (limbIndex == TAKKURI_LIMB_LEFT_EAR)) { @@ -1108,14 +1125,14 @@ void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s } } - idx = D_80C13698[limbIndex]; - if (idx != -1) { - if (idx == 9) { - Matrix_MultVecX(1000.0f, &this->limbPos[idx]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex == EN_THIEFBIRD_BODYPART_9) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { - Matrix_MultZero(&this->limbPos[idx]); - if ((idx == 3) || (idx == 5)) { - Matrix_MultVecX(2000.0f, &this->limbPos[idx + 1]); + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); + if ((bodyPartIndex == EN_THIEFBIRD_BODYPART_3) || (bodyPartIndex == EN_THIEFBIRD_BODYPART_5)) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); } } } @@ -1163,7 +1180,7 @@ void EnThiefbird_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } func_80C13354(this, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_THIEFBIRD_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); Math_Vec3s_ToVec3f(&this->actor.focus.pos, &this->collider.elements[1].dim.worldSphere.center); } diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h index c405552990..bbe354848a 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h @@ -18,6 +18,21 @@ typedef struct { /* 0x22 */ s16 unk_22; } EnThiefbirdUnkStruct; // size = 0x24 +typedef enum EnThiefbirdBodyPart { + /* 0 */ EN_THIEFBIRD_BODYPART_0, + /* 1 */ EN_THIEFBIRD_BODYPART_1, + /* 2 */ EN_THIEFBIRD_BODYPART_2, + /* 3 */ EN_THIEFBIRD_BODYPART_3, + /* 4 */ EN_THIEFBIRD_BODYPART_4, + /* 5 */ EN_THIEFBIRD_BODYPART_5, + /* 6 */ EN_THIEFBIRD_BODYPART_6, + /* 7 */ EN_THIEFBIRD_BODYPART_7, + /* 8 */ EN_THIEFBIRD_BODYPART_8, + /* 9 */ EN_THIEFBIRD_BODYPART_9, + /* 10 */ EN_THIEFBIRD_BODYPART_10, + /* 11 */ EN_THIEFBIRD_BODYPART_MAX +} EnThiefbirdBodyPart; + typedef struct EnThiefbird { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +47,7 @@ typedef struct EnThiefbird { /* 0x208 */ Vec3s morphTable[TAKKURI_LIMB_MAX]; /* 0x270 */ ColliderJntSph collider; /* 0x290 */ ColliderJntSphElement colliderElements[3]; - /* 0x350 */ Vec3f limbPos[11]; + /* 0x350 */ Vec3f bodyPartsPos[EN_THIEFBIRD_BODYPART_MAX]; /* 0x3D4 */ f32 drawDmgEffAlpha; /* 0x3D8 */ f32 drawDmgEffScale; /* 0x3DC */ f32 drawDmgEffFrozenSteamScale; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index b9d547fb02..dbf446aa55 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -245,18 +245,18 @@ void func_80893BCC(EnTite* this, PlayState* play) { SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) { - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { - func_800BBFB0(play, &this->limbPos[i], 1.0f, 2, 80, 15, 1); + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { + func_800BBFB0(play, &this->bodyPartsPos[i], 1.0f, 2, 80, 15, 1); } } else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) { - Vec3f* ptr; + Vec3f* bodyPartPos; - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { for (j = 0; j < 2; j++) { - ptr = &this->limbPos[i]; - sp7C.x = ptr->x + Rand_CenteredFloat(1.0f); - sp7C.y = ptr->y + Rand_CenteredFloat(1.0f); - sp7C.z = ptr->z + Rand_CenteredFloat(1.0f); + bodyPartPos = &this->bodyPartsPos[i]; + sp7C.x = bodyPartPos->x + Rand_CenteredFloat(1.0f); + sp7C.y = bodyPartPos->y + Rand_CenteredFloat(1.0f); + sp7C.z = bodyPartPos->z + Rand_CenteredFloat(1.0f); func_800B0DE0(play, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, (s32)Rand_ZeroFloat(16.0f) + 80, 15); } @@ -282,7 +282,7 @@ void func_80893E54(EnTite* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 9, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENTITE_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -650,8 +650,8 @@ void func_80895020(EnTite* this, PlayState* play) { this->actor.speed = 0.0f; ptr = &this->unk_33C[0]; - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++, ptr++) { - Math_Vec3f_Diff(&this->limbPos[i], &this->actor.world.pos, &sp74); + for (i = 0; i < ENTITE_BODYPART_MAX; i++, ptr++) { + Math_Vec3f_Diff(&this->bodyPartsPos[i], &this->actor.world.pos, &sp74); temp_f0 = Math3D_Vec3fMagnitude(&sp74); if (temp_f0 > 1.0f) { temp_f0 = 1.2f / temp_f0; @@ -671,16 +671,16 @@ void func_808951B8(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 4, 0x1000, 0x400); if (this->unk_2BC == 0) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); - SoundSource_PlaySfxAtFixedWorldPos(play, &this->limbPos[i], 11, NA_SE_EN_EXTINCT); + for (i = 0; i < ENTITE_BODYPART_MAX; i++) { + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } Actor_Kill(&this->actor); return; } - for (i = 0; i < ARRAY_COUNT(this->unk_33C); i++) { - Math_Vec3f_Sum(&this->limbPos[i], &this->unk_33C[i], &this->limbPos[i]); + for (i = 0; i < ENTITE_BODYPART_MAX; i++) { + Math_Vec3f_Sum(&this->bodyPartsPos[i], &this->unk_33C[i], &this->bodyPartsPos[i]); this->unk_33C[i].y += this->actor.gravity; } } @@ -1040,8 +1040,8 @@ void func_808963B4(EnTite* this, PlayState* play) { Vec3f sp48; if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { - Math_Vec3f_Copy(&sp48, &this->limbPos[i]); + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { + Math_Vec3f_Copy(&sp48, &this->bodyPartsPos[i]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } @@ -1049,7 +1049,7 @@ void func_808963B4(EnTite* this, PlayState* play) { s32 temp = play->gameplayFrames & 7; if (!(temp & 1) && (this->actor.depthInWater < 10.0f)) { - Math_Vec3f_Copy(&sp48, &this->limbPos[5 + (temp >> 1)]); + Math_Vec3f_Copy(&sp48, &this->bodyPartsPos[ENTITE_BODYPART_5 + (temp >> 1)]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } @@ -1114,40 +1114,90 @@ s32 EnTite_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* return false; } +static s8 sLimbToBodyParts1[OBJECT_TITE_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_TITE_LIMB_NONE + BODYPART_NONE, // OBJECT_TITE_LIMB_01 + BODYPART_NONE, // OBJECT_TITE_LIMB_02 + BODYPART_NONE, // OBJECT_TITE_LIMB_03 + ENTITE_BODYPART_0, // OBJECT_TITE_LIMB_04 + BODYPART_NONE, // OBJECT_TITE_LIMB_05 + BODYPART_NONE, // OBJECT_TITE_LIMB_06 + BODYPART_NONE, // OBJECT_TITE_LIMB_07 + ENTITE_BODYPART_1, // OBJECT_TITE_LIMB_08 + BODYPART_NONE, // OBJECT_TITE_LIMB_09 + BODYPART_NONE, // OBJECT_TITE_LIMB_0A + BODYPART_NONE, // OBJECT_TITE_LIMB_0B + BODYPART_NONE, // OBJECT_TITE_LIMB_0C + ENTITE_BODYPART_2, // OBJECT_TITE_LIMB_0D + BODYPART_NONE, // OBJECT_TITE_LIMB_0E + BODYPART_NONE, // OBJECT_TITE_LIMB_0F + BODYPART_NONE, // OBJECT_TITE_LIMB_10 + BODYPART_NONE, // OBJECT_TITE_LIMB_11 + ENTITE_BODYPART_3, // OBJECT_TITE_LIMB_12 + BODYPART_NONE, // OBJECT_TITE_LIMB_13 + BODYPART_NONE, // OBJECT_TITE_LIMB_14 + BODYPART_NONE, // OBJECT_TITE_LIMB_15 + BODYPART_NONE, // OBJECT_TITE_LIMB_16 + ENTITE_BODYPART_4, // OBJECT_TITE_LIMB_17 + BODYPART_NONE, // OBJECT_TITE_LIMB_18 +}; + +static s8 sLimbToBodyParts2[OBJECT_TITE_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_TITE_LIMB_NONE + BODYPART_NONE, // OBJECT_TITE_LIMB_01 + BODYPART_NONE, // OBJECT_TITE_LIMB_02 + BODYPART_NONE, // OBJECT_TITE_LIMB_03 + ENTITE_BODYPART_0, // OBJECT_TITE_LIMB_04 + BODYPART_NONE, // OBJECT_TITE_LIMB_05 + BODYPART_NONE, // OBJECT_TITE_LIMB_06 + BODYPART_NONE, // OBJECT_TITE_LIMB_07 + ENTITE_BODYPART_1, // OBJECT_TITE_LIMB_08 + ENTITE_BODYPART_5, // OBJECT_TITE_LIMB_09 + BODYPART_NONE, // OBJECT_TITE_LIMB_0A + BODYPART_NONE, // OBJECT_TITE_LIMB_0B + BODYPART_NONE, // OBJECT_TITE_LIMB_0C + ENTITE_BODYPART_2, // OBJECT_TITE_LIMB_0D + ENTITE_BODYPART_6, // OBJECT_TITE_LIMB_0E + BODYPART_NONE, // OBJECT_TITE_LIMB_0F + BODYPART_NONE, // OBJECT_TITE_LIMB_10 + BODYPART_NONE, // OBJECT_TITE_LIMB_11 + ENTITE_BODYPART_3, // OBJECT_TITE_LIMB_12 + ENTITE_BODYPART_7, // OBJECT_TITE_LIMB_13 + BODYPART_NONE, // OBJECT_TITE_LIMB_14 + BODYPART_NONE, // OBJECT_TITE_LIMB_15 + BODYPART_NONE, // OBJECT_TITE_LIMB_16 + ENTITE_BODYPART_4, // OBJECT_TITE_LIMB_17 + ENTITE_BODYPART_8, // OBJECT_TITE_LIMB_18 +}; + void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_80896B70[] = { - -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, -1, -1, 2, -1, -1, -1, -1, 3, -1, -1, -1, -1, 4, -1, - }; - static s8 D_80896B8C[] = { - -1, -1, -1, -1, 0, -1, -1, -1, 1, 5, -1, -1, -1, 2, 6, -1, -1, -1, 3, 7, -1, -1, -1, 4, 8, - }; EnTite* this = THIS; MtxF* matrix; - s8 idx; + s8 bodyPart1Index; if (this->unk_2BA == 0) { - idx = D_80896B70[limbIndex]; - if (idx != -1) { - Matrix_MultZero(&this->limbPos[idx]); - if (idx >= 1) { - Matrix_MultVecX(2500.0f, &this->limbPos[idx + 4]); + bodyPart1Index = sLimbToBodyParts1[limbIndex]; + if (bodyPart1Index != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[bodyPart1Index]); + if (bodyPart1Index >= ENTITE_BODYPART_1) { + Matrix_MultVecX(2500.0f, &this->bodyPartsPos[ENTITE_BODYPART_4 + bodyPart1Index]); } } } else if (this->unk_2BA > 0) { - if (D_80896B8C[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80896B8C[limbIndex]]); + if (sLimbToBodyParts2[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts2[limbIndex]]); } if (limbIndex == 24) { this->unk_2BA = -1; } - } else if (D_80896B8C[limbIndex] != -1) { + } else if (sLimbToBodyParts2[limbIndex] != BODYPART_NONE) { OPEN_DISPS(play->state.gfxCtx); matrix = Matrix_GetCurrent(); - matrix->xw = this->limbPos[D_80896B8C[limbIndex]].x; - matrix->yw = this->limbPos[D_80896B8C[limbIndex]].y; - matrix->zw = this->limbPos[D_80896B8C[limbIndex]].z; + matrix->xw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].x; + matrix->yw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].y; + matrix->zw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].z; Matrix_RotateZS(this->actor.world.rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1181,7 +1231,7 @@ void EnTite_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTite_OverrideLimbDraw, EnTite_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENTITE_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index af77f4a8db..66fec66b39 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -15,6 +15,19 @@ typedef enum { /* 0 */ ENTITE_MINUS_0 } EnTiteParam; +typedef enum EnTiteBodyPart { + /* 0 */ ENTITE_BODYPART_0, + /* 1 */ ENTITE_BODYPART_1, + /* 2 */ ENTITE_BODYPART_2, + /* 3 */ ENTITE_BODYPART_3, + /* 4 */ ENTITE_BODYPART_4, + /* 5 */ ENTITE_BODYPART_5, + /* 6 */ ENTITE_BODYPART_6, + /* 7 */ ENTITE_BODYPART_7, + /* 8 */ ENTITE_BODYPART_8, + /* 9 */ ENTITE_BODYPART_MAX +} EnTiteBodyPart; + typedef struct EnTite { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -31,8 +44,8 @@ typedef struct EnTite { /* 0x2C4 */ f32 drawDmgEffAlpha; /* 0x2C8 */ f32 drawDmgEffScale; /* 0x2CC */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D0 */ Vec3f limbPos[9]; - /* 0x33C */ Vec3f unk_33C[9]; + /* 0x2D0 */ Vec3f bodyPartsPos[ENTITE_BODYPART_MAX]; + /* 0x33C */ Vec3f unk_33C[ENTITE_BODYPART_MAX]; /* 0x3A8 */ Gfx* unk_3A8; /* 0x3AC */ ColliderSphere collider; } EnTite; // size = 0x404 diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 7ad7786598..93c494489f 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -123,7 +123,7 @@ void func_80AC0A6C(EnTwig* this, PlayState* play) { void func_80AC0A7C(EnTwig* this, PlayState* play) { Player* player = GET_PLAYER(play); - Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]); + Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); this->unk_178 = 0; this->unk_17A = 0; this->actionFunc = func_80AC0AC8; @@ -146,7 +146,7 @@ void func_80AC0AC8(EnTwig* this, PlayState* play) { SubS_ConstructPlane(&this->dyna.actor.world.pos, &D_80AC10D0, &this->dyna.actor.shape.rot, &sp4C); if ((sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) && Math3D_LineSegVsPlane(sp4C.normal.x, sp4C.normal.y, sp4C.normal.z, sp4C.originDist, &this->unk_180, - &player->bodyPartsPos[0], &sp40, 0)) { + &player->bodyPartsPos[PLAYER_BODYPART_WAIST], &sp40, 0)) { if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &sp40) <= SQ(this->dyna.actor.scale.x * 0.345f * 40.0f)) { func_80AC0CC4(this, play); return; @@ -162,7 +162,7 @@ void func_80AC0AC8(EnTwig* this, PlayState* play) { this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; } } - Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]); + Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); } void func_80AC0CC4(EnTwig* this, PlayState* play) { @@ -180,9 +180,12 @@ void func_80AC0D2C(EnTwig* this, PlayState* play) { static Color_RGBA8 sColorYellow = { 255, 255, 0, 0 }; Player* player = GET_PLAYER(play); - Math_SmoothStepToF(&this->dyna.actor.world.pos.x, player->bodyPartsPos[0].x, 0.5f, 100.0f, 0.01f); - Math_SmoothStepToF(&this->dyna.actor.world.pos.y, player->bodyPartsPos[0].y, 0.5f, 100.0f, 0.01f); - Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[0].z, 0.5f, 100.0f, 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.x, player->bodyPartsPos[PLAYER_BODYPART_WAIST].x, 0.5f, 100.0f, + 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.y, player->bodyPartsPos[PLAYER_BODYPART_WAIST].y, 0.5f, 100.0f, + 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_WAIST].z, 0.5f, 100.0f, + 0.01f); this->dyna.actor.shape.rot.z += (s16)this->unk_170; this->dyna.actor.scale.x -= this->unk_174; if (this->dyna.actor.scale.x < 0.0f) { diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 2e7392cfc2..2d9a12b54e 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -137,15 +137,6 @@ static f32 sYOffsetPerForm[PLAYER_FORM_MAX] = { 30.0f, // PLAYER_FORM_HUMAN }; -/** - * This maps a given limb based on its limbIndex to its appropriate index - * in the limbPos array. An index of -1 indicates that the limb is not part - * of the limbPos array. - */ -static s8 sLimbIndexToLimbPosIndex[] = { - -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, -}; - void EnWallmas_Init(Actor* thisx, PlayState* play) { EnWallmas* this = THIS; @@ -220,7 +211,7 @@ void EnWallmas_ThawIfFrozen(EnWallmas* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = 0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, WALLMASTER_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -712,17 +703,49 @@ s32 EnWallmas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } +/** + * This maps a given limb based on its limbIndex to its appropriate index + * in the bodyPartsPos array. + */ +static s8 sLimbToBodyParts[WALLMASTER_LIMB_MAX] = { + BODYPART_NONE, // WALLMASTER_LIMB_NONE + BODYPART_NONE, // WALLMASTER_LIMB_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_HAND + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_ROOT + WALLMASTER_BODYPART_0, // WALLMASTER_LIMB_INDEX_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_MIDDLE + WALLMASTER_BODYPART_1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_ROOT + WALLMASTER_BODYPART_2, // WALLMASTER_LIMB_RING_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_MIDDLE + WALLMASTER_BODYPART_3, // WALLMASTER_LIMB_RING_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_ROOT + WALLMASTER_BODYPART_4, // WALLMASTER_LIMB_MIDDLE_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_MIDDLE + WALLMASTER_BODYPART_5, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_WRIST_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_WRIST + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_ROOT + WALLMASTER_BODYPART_6, // WALLMASTER_LIMB_THUMB_PROXIMAL + WALLMASTER_BODYPART_7, // WALLMASTER_LIMB_THUMB_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_MIDDLE + WALLMASTER_BODYPART_8, // WALLMASTER_LIMB_THUMB_DISTAL +}; + void EnWallmas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnWallmas* this = THIS; Gfx* gfx; - if (sLimbIndexToLimbPosIndex[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[sLimbIndexToLimbPosIndex[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WALLMASTER_LIMB_WRIST) { - Matrix_MultVecX(1000.0f, &this->limbPos[9]); - Matrix_MultVecX(-1000.0f, &this->limbPos[10]); + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[WALLMASTER_BODYPART_9]); + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[WALLMASTER_BODYPART_10]); } else if (limbIndex == WALLMASTER_LIMB_HAND) { OPEN_DISPS(play->state.gfxCtx); @@ -752,7 +775,7 @@ void EnWallmas_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWallmas_OverrideLimbDraw, EnWallmas_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, WALLMASTER_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index 4d1466b95c..383d6d4ca5 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -36,6 +36,21 @@ struct EnWallmas; typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); +typedef enum WallmasterBodyPart { + /* 0 */ WALLMASTER_BODYPART_0, + /* 1 */ WALLMASTER_BODYPART_1, + /* 2 */ WALLMASTER_BODYPART_2, + /* 3 */ WALLMASTER_BODYPART_3, + /* 4 */ WALLMASTER_BODYPART_4, + /* 5 */ WALLMASTER_BODYPART_5, + /* 6 */ WALLMASTER_BODYPART_6, + /* 7 */ WALLMASTER_BODYPART_7, + /* 8 */ WALLMASTER_BODYPART_8, + /* 9 */ WALLMASTER_BODYPART_9, + /* 10 */ WALLMASTER_BODYPART_10, + /* 11 */ WALLMASTER_BODYPART_MAX +} WallmasterBodyPart; + typedef struct EnWallmas { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -50,7 +65,7 @@ typedef struct EnWallmas { /* 0x2C8 */ f32 drawDmgEffAlpha; /* 0x2CC */ f32 drawDmgEffScale; /* 0x2D0 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D4 */ Vec3f limbPos[11]; + /* 0x2D4 */ Vec3f bodyPartsPos[WALLMASTER_BODYPART_MAX]; /* 0x358 */ ColliderCylinder collider; } EnWallmas; // size = 0x3A4 diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 4dc8d75b53..6e31192b21 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -377,7 +377,7 @@ void func_80990854(EnWf* this, PlayState* play) { this->collider2.base.colType = COLTYPE_HIT5; this->collider3.base.colType = COLTYPE_HIT5; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, WOLFOS_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -1549,17 +1549,39 @@ s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } +static s8 sLimbToBodyParts[WOLFOS_NORMAL_LIMB_MAX] = { + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_NONE + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_ROOT + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_THIGH + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_SHIN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_PASTERN + WOLFOS_BODYPART_BACK_LEFT_PAW, // WOLFOS_NORMAL_LIMB_BACK_LEFT_PAW + WOLFOS_BODYPART_TAIL, // WOLFOS_NORMAL_LIMB_TAIL + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_ABDOMEN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_THIGH + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_SHIN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_PASTERN + WOLFOS_BODYPART_BACK_RIGHT_PAW, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_PAW + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_THORAX + WOLFOS_BODYPART_FRONT_RIGHT_UPPER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_UPPER_LEG + WOLFOS_BODYPART_FRONT_RIGHT_LOWER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_LOWER_LEG + WOLFOS_BODYPART_FRONT_RIGHT_CLAW, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_CLAW + WOLFOS_BODYPART_HEAD_ROOT, // WOLFOS_NORMAL_LIMB_HEAD_ROOT + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_HEAD + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_EYES + WOLFOS_BODYPART_FRONT_LEFT_UPPER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_UPPER_LEG + WOLFOS_BODYPART_FRONT_LEFT_LOWER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_LOWER_LEG + WOLFOS_BODYPART_FRONT_LEFT_CLAW, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_CLAW +}; + void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_809942FC[] = { - -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, 2, -1, 3, 4, 5, 6, -1, -1, 7, 8, 9, - }; EnWf* this = THIS; Vec3f sp20; Collider_UpdateSpheres(limbIndex, &this->collider1); - if (D_809942FC[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_809942FC[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WOLFOS_NORMAL_LIMB_TAIL) { @@ -1588,7 +1610,7 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, WOLFOS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.h b/src/overlays/actors/ovl_En_Wf/z_en_wf.h index c8a0c7af80..6e9db0be19 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -10,6 +10,20 @@ typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); #define ENWF_GET_80(thisx) ((thisx)->params & 0x80) +typedef enum WolfosBodyPart { + /* 0 */ WOLFOS_BODYPART_BACK_LEFT_PAW, + /* 1 */ WOLFOS_BODYPART_TAIL, + /* 2 */ WOLFOS_BODYPART_BACK_RIGHT_PAW, + /* 3 */ WOLFOS_BODYPART_FRONT_RIGHT_UPPER_LEG, + /* 4 */ WOLFOS_BODYPART_FRONT_RIGHT_LOWER_LEG, + /* 5 */ WOLFOS_BODYPART_FRONT_RIGHT_CLAW, + /* 6 */ WOLFOS_BODYPART_HEAD_ROOT, + /* 7 */ WOLFOS_BODYPART_FRONT_LEFT_UPPER_LEG, + /* 8 */ WOLFOS_BODYPART_FRONT_LEFT_LOWER_LEG, + /* 9 */ WOLFOS_BODYPART_FRONT_LEFT_CLAW, + /* 10 */ WOLFOS_BODYPART_MAX +} WolfosBodyPart; + typedef struct EnWf { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -30,7 +44,7 @@ typedef struct EnWf { /* 0x2AC */ f32 drawDmgEffAlpha; /* 0x2B0 */ f32 drawDmgEffScale; /* 0x2B4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2B8 */ Vec3f limbPos[10]; + /* 0x2B8 */ Vec3f bodyPartsPos[WOLFOS_BODYPART_MAX]; /* 0x330 */ ColliderJntSph collider1; /* 0x350 */ ColliderJntSphElement collider1Elements[4]; /* 0x450 */ ColliderCylinder collider2; diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index a9d99412ab..9bd3a0bcc8 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -1097,7 +1097,7 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { s32 i; if ((this->drawDmgEffTimer < 50) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 1.0f, 0.7f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_WIZ_BODYPART_MAX, 2, 1.0f, 0.7f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->rotationalVelocity = 0x4E20; @@ -1390,10 +1390,10 @@ void EnWiz_PostLimbDrawOpa(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r (limbIndex == WIZROBE_LIMB_NECK) || (limbIndex == WIZROBE_LIMB_HEAD) || (limbIndex == WIZROBE_LIMB_JAW) || (limbIndex == WIZROBE_LIMB_LEFT_SHIN) || (limbIndex == WIZROBE_LIMB_RIGHT_SHIN) || (limbIndex == WIZROBE_LIMB_LOINCLOTH)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_WIZ_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -1439,10 +1439,10 @@ void EnWiz_PostLimbDrawXlu(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r (limbIndex == WIZROBE_LIMB_NECK) || (limbIndex == WIZROBE_LIMB_HEAD) || (limbIndex == WIZROBE_LIMB_JAW) || (limbIndex == WIZROBE_LIMB_LEFT_SHIN) || (limbIndex == WIZROBE_LIMB_RIGHT_SHIN) || (limbIndex == WIZROBE_LIMB_LOINCLOTH)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_WIZ_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -1487,9 +1487,8 @@ void EnWiz_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_WIZ_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } if (this->platformCount > 0) { diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h index 70f7a6c640..80c8be2084 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h @@ -17,6 +17,22 @@ struct EnWiz; typedef void (*EnWizActionFunc)(struct EnWiz*, PlayState*); +typedef enum EnWizBodyPart { + /* 0 */ EN_WIZ_BODYPART_0, + /* 1 */ EN_WIZ_BODYPART_1, + /* 2 */ EN_WIZ_BODYPART_2, + /* 3 */ EN_WIZ_BODYPART_3, + /* 4 */ EN_WIZ_BODYPART_4, + /* 5 */ EN_WIZ_BODYPART_5, + /* 6 */ EN_WIZ_BODYPART_6, + /* 7 */ EN_WIZ_BODYPART_7, + /* 8 */ EN_WIZ_BODYPART_8, + /* 9 */ EN_WIZ_BODYPART_9, + /* 10 */ EN_WIZ_BODYPART_10, + /* 11 */ EN_WIZ_BODYPART_11, + /* 12 */ EN_WIZ_BODYPART_MAX +} EnWizBodyPart; + typedef struct EnWiz { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -68,8 +84,8 @@ typedef struct EnWiz { /* 0x754 */ s16 drawDmgEffType; /* 0x758 */ f32 drawDmgEffScale; /* 0x75C */ f32 drawDmgEffFrozenSteamScale; - /* 0x760 */ Vec3f bodyPartsPos[12]; - /* 0x7F0 */ s16 bodyPartsPosIndex; + /* 0x760 */ Vec3f bodyPartsPos[EN_WIZ_BODYPART_MAX]; + /* 0x7F0 */ s16 bodyPartIndex; /* 0x7F2 */ s16 ghostAlpha[10]; /* 0x806 */ s16 ghostNextPlatformIndex[10]; /* 0x81C */ Vec3f ghostPos[10]; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index b892b38425..b89d6a5fba 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -98,9 +98,64 @@ static AnimationInfoS sAnimationInfo[] = { { &gZoraWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -s8 sBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -1, -1 }; -s8 sParentBodyParts[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 }; -u8 sShadowSizes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static s8 sLimbToBodyParts[ZORA_LIMB_MAX] = { + BODYPART_NONE, // ZORA_LIMB_NONE + ZORA_BODYPART_1, // ZORA_LIMB_PELVIS + ZORA_BODYPART_12, // ZORA_LIMB_LEFT_THIGH + ZORA_BODYPART_13, // ZORA_LIMB_LEFT_SHIN + ZORA_BODYPART_14, // ZORA_LIMB_LEFT_FOOT + ZORA_BODYPART_9, // ZORA_LIMB_RIGHT_THIGH + ZORA_BODYPART_10, // ZORA_LIMB_RIGHT_SHIN + ZORA_BODYPART_11, // ZORA_LIMB_RIGHT_FOOT + ZORA_BODYPART_0, // ZORA_LIMB_TORSO + ZORA_BODYPART_6, // ZORA_LIMB_LEFT_UPPER_ARM + ZORA_BODYPART_7, // ZORA_LIMB_LEFT_FOREARM + ZORA_BODYPART_8, // ZORA_LIMB_LEFT_HAND + ZORA_BODYPART_3, // ZORA_LIMB_RIGHT_UPPER_ARM + ZORA_BODYPART_4, // ZORA_LIMB_RIGHT_FOREARM + ZORA_BODYPART_5, // ZORA_LIMB_RIGHT_HAND + ZORA_BODYPART_2, // ZORA_LIMB_HEAD + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_1 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_2 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_3 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_FIN +}; + +static s8 sParentShadowBodyParts[ZORA_BODYPART_MAX] = { + ZORA_BODYPART_0, // ZORA_BODYPART_0 + ZORA_BODYPART_0, // ZORA_BODYPART_1 + ZORA_BODYPART_0, // ZORA_BODYPART_2 + ZORA_BODYPART_0, // ZORA_BODYPART_3 + ZORA_BODYPART_3, // ZORA_BODYPART_4 + ZORA_BODYPART_4, // ZORA_BODYPART_5 + ZORA_BODYPART_0, // ZORA_BODYPART_6 + ZORA_BODYPART_6, // ZORA_BODYPART_7 + ZORA_BODYPART_7, // ZORA_BODYPART_8 + ZORA_BODYPART_0, // ZORA_BODYPART_9 + ZORA_BODYPART_9, // ZORA_BODYPART_10 + ZORA_BODYPART_10, // ZORA_BODYPART_11 + ZORA_BODYPART_0, // ZORA_BODYPART_12 + ZORA_BODYPART_12, // ZORA_BODYPART_13 + ZORA_BODYPART_13, // ZORA_BODYPART_14 +}; + +static u8 sShadowSizes[ZORA_BODYPART_MAX] = { + 0, // ZORA_BODYPART_0 + 0, // ZORA_BODYPART_1 + 0, // ZORA_BODYPART_2 + 0, // ZORA_BODYPART_3 + 0, // ZORA_BODYPART_4 + 0, // ZORA_BODYPART_5 + 0, // ZORA_BODYPART_6 + 0, // ZORA_BODYPART_7 + 0, // ZORA_BODYPART_8 + 0, // ZORA_BODYPART_9 + 0, // ZORA_BODYPART_10 + 0, // ZORA_BODYPART_11 + 0, // ZORA_BODYPART_12 + 0, // ZORA_BODYPART_13 + 0, // ZORA_BODYPART_14 +}; s32 EnZo_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; @@ -142,12 +197,12 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { } this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); - if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) { + if (this->isLeftFootGrounded && !leftWasGrounded && isFootGrounded) { Actor_PlaySfx(&this->actor, sfxId); } this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); - if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) { + if (this->isRightFootGrounded && !rightWasGrounded && isFootGrounded) { Actor_PlaySfx(&this->actor, sfxId); } @@ -173,13 +228,14 @@ void EnZo_UpdateCollider(EnZo* this, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } +static TrackOptionsSet sTrackOptions = { + { 0xFA0, 4, 1, 3 }, + { 0x1770, 4, 1, 6 }, + { 0xFA0, 4, 1, 3 }, + { 0x1770, 4, 1, 6 }, +}; + void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { - static TrackOptionsSet sTrackOptions = { - { 0xFA0, 4, 1, 3 }, - { 0x1770, 4, 1, 6 }, - { 0xFA0, 4, 1, 3 }, - { 0x1770, 4, 1, 6 }, - }; Player* player = GET_PLAYER(play); Vec3f point; @@ -316,15 +372,18 @@ void EnZo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp30 = { 400.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - if (sBodyParts[limbIndex] >= 0) { - Matrix_MultVec3f(&zeroVec, &this->bodyPartsPos[sBodyParts[limbIndex]]); + if (sLimbToBodyParts[limbIndex] > BODYPART_NONE) { + Matrix_MultVec3f(&zeroVec, &this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } + if (limbIndex == ZORA_LIMB_HEAD) { Matrix_MultVec3f(&sp30, &this->actor.focus.pos); } + if (limbIndex == ZORA_LIMB_LEFT_FOOT) { Matrix_MultVec3f(&zeroVec, &this->leftFootPos); } + if (limbIndex == ZORA_LIMB_RIGHT_FOOT) { Matrix_MultVec3f(&zeroVec, &this->rightFootPos); } @@ -366,8 +425,8 @@ void EnZo_Draw(Actor* thisx, PlayState* play) { shadowTexIter++; } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, - ARRAY_COUNT(this->bodyPartsPos), sShadowSizes, sParentBodyParts); + SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, ZORA_BODYPART_MAX, + sShadowSizes, sParentShadowBodyParts); } SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 9fbbd09ffd..db620def0a 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -12,6 +12,25 @@ typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); #define ENZO_PATH_INDEX_NONE 0x3F +typedef enum EnZoBodyPart { + /* 0 */ ZORA_BODYPART_0, + /* 1 */ ZORA_BODYPART_1, + /* 2 */ ZORA_BODYPART_2, + /* 3 */ ZORA_BODYPART_3, + /* 4 */ ZORA_BODYPART_4, + /* 5 */ ZORA_BODYPART_5, + /* 6 */ ZORA_BODYPART_6, + /* 7 */ ZORA_BODYPART_7, + /* 8 */ ZORA_BODYPART_8, + /* 9 */ ZORA_BODYPART_9, + /* 10 */ ZORA_BODYPART_10, + /* 11 */ ZORA_BODYPART_11, + /* 12 */ ZORA_BODYPART_12, + /* 13 */ ZORA_BODYPART_13, + /* 14 */ ZORA_BODYPART_14, + /* 15 */ ZORA_BODYPART_MAX +} EnZoBodyPart; + typedef struct EnZo { /* 0x000 */ Actor actor; /* 0x144 */ EnZoActionFunc actionFunc; @@ -32,7 +51,7 @@ typedef struct EnZo { /* 0x300 */ UNK_TYPE1 unk_300[0x12]; /* 0x312 */ s16 fidgetTableY[ZORA_LIMB_MAX]; /* 0x33A */ s16 fidgetTableZ[ZORA_LIMB_MAX]; - /* 0x364 */ Vec3f bodyPartsPos[15]; + /* 0x364 */ Vec3f bodyPartsPos[ZORA_BODYPART_MAX]; /* 0x41A */ UNK_TYPE1 unk_41A[0x6]; /* 0x41E */ s16 eyeIndex; /* 0x420 */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 43717aaf5e..015f1d8ae5 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -62,8 +62,8 @@ void OceffSpot_Init(Actor* thisx, PlayState* play2) { this->actor.scale.y = 0.3f; this->unk16C = 0.0f; this->actor.world.pos.y = player->actor.world.pos.y; - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; } void OceffSpot_Destroy(Actor* thisx, PlayState* play2) { diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index d7af092707..5fa5d58c3a 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -81,8 +81,8 @@ void OceffStorm_Init(Actor* thisx, PlayState* play) { this->actor.draw = OceffStorm_Draw2; } else { this->actor.world.pos.y = player->actor.world.pos.y; - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; gSaveContext.jinxTimer = 0; if ((play->interfaceCtx.restrictions.songOfStorms == 0) && !func_8098176C(play)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 20d16f8174..1e594aaa09 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -12133,7 +12133,7 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, void func_80846460(Player* this) { Vec3f* pos; - Vec3f* bodyPartsPos; + Vec3f* bodyPartPosPtr; s32 i; this->actor.focus.pos.x = this->actor.world.pos.x; @@ -12141,15 +12141,15 @@ void func_80846460(Player* this) { this->actor.focus.pos.y = this->actor.world.pos.y + 24.0f; pos = &this->actor.world.pos; - bodyPartsPos = this->bodyPartsPos; - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { - Math_Vec3f_Copy(bodyPartsPos, pos); - bodyPartsPos++; + bodyPartPosPtr = this->bodyPartsPos; + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { + Math_Vec3f_Copy(bodyPartPosPtr, pos); + bodyPartPosPtr++; } this->bodyPartsPos[PLAYER_BODYPART_HEAD].y = this->actor.world.pos.y + 24.0f; this->bodyPartsPos[PLAYER_BODYPART_WAIST].y = this->actor.world.pos.y + 60.0f; - Math_Vec3f_Copy(this->actor.shape.feetPos, pos); + Math_Vec3f_Copy(&this->actor.shape.feetPos[0], pos); Math_Vec3f_Copy(&this->actor.shape.feetPos[1], pos); } diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index a786327faf..d4dbbd4dbe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -43,7 +43,7 @@ u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPa this->update = EffectSsEnFire_Update; this->rUnused = -15; - if (initParams->bodyPart < 0) { + if (initParams->bodyPart <= BODYPART_NONE) { this->rYaw = Math_Vec3f_Yaw(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.y; this->rPitch = Math_Vec3f_Pitch(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.x; @@ -124,7 +124,7 @@ void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { if (this->actor->update != NULL) { Math_SmoothStepToS(&this->rScale, this->rScaleMax, 1, this->rScaleMax >> 3, 0); - if (this->rBodyPart < 0) { + if (this->rBodyPart <= BODYPART_NONE) { Matrix_Translate(this->actor->world.pos.x, this->actor->world.pos.y, this->actor->world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->rYaw + this->actor->shape.rot.y, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index 57ac1af69d..442b779aca 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -83,7 +83,7 @@ void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { if (this->actor != NULL) { this->vec = this->actor->velocity; - if (this->rBodyPart < 0) { + if (this->rBodyPart <= BODYPART_NONE) { Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); } else { diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 126d53c170..7cce846612 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -921,8 +921,8 @@ 0x801BC240:("gEffFootprintMaterialDL","Gfx","[9]",0x48), 0x801BC288:("gEffFootprintModelDL","Gfx","[3]",0x18), 0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1), - 0x801BC3F0:("gEnHyBodyParts","UNK_TYPE1","",0x1), - 0x801BC400:("gEnHyParentBodyParts","UNK_TYPE1","",0x1), + 0x801BC3F0:("gEnHyLimbToBodyParts","UNK_TYPE1","",0x1), + 0x801BC400:("gEnHyParentShadowBodyParts","UNK_TYPE1","",0x1), 0x801BC410:("gEnHyShadowSizes","s32",[],0x10), 0x801BC420:("sReactionTextIds","u16","[]",0x140A), 0x801BD830:("sGlobalCutsceneList","ActorCutscene","[8]",0x80), @@ -5669,7 +5669,7 @@ 0x8087936C:("D_8087936C","UNK_TYPE1","",0x1), 0x80879370:("D_80879370","UNK_TYPE1","",0x1), 0x8087937C:("D_8087937C","UNK_TYPE1","",0x1), - 0x80879388:("D_80879388","UNK_TYPE1","",0x1), + 0x80879388:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x8087938E:("D_8087938E","UNK_TYPE1","",0x1), 0x8087938F:("D_8087938F","UNK_TYPE1","",0x1), 0x80879394:("D_80879394","UNK_TYPE1","",0x1), @@ -6025,7 +6025,7 @@ 0x80899564:("D_80899564","f32","",0x4), 0x8089956C:("D_8089956C","f32","",0x4), 0x80899570:("D_80899570","UNK_TYPE1","",0x1), - 0x808995A0:("D_808995A0","UNK_TYPE1","",0x1), + 0x808995A0:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808995A3:("D_808995A3","UNK_TYPE1","",0x1), 0x808995A4:("D_808995A4","UNK_TYPE1","",0x1), 0x808995C0:("D_808995C0","f32","",0x4), @@ -6093,7 +6093,7 @@ 0x8089E38C:("D_8089E38C","UNK_TYPE1","",0x1), 0x8089E398:("D_8089E398","UNK_TYPE1","",0x1), 0x8089E3A4:("D_8089E3A4","UNK_TYPE1","",0x1), - 0x8089E3B0:("D_8089E3B0","UNK_TYPE1","",0x1), + 0x8089E3B0:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x8089E3B4:("D_8089E3B4","UNK_TYPE1","",0x1), 0x8089E3B6:("D_8089E3B6","UNK_TYPE1","",0x1), 0x8089E3B7:("D_8089E3B7","UNK_TYPE1","",0x1), @@ -6457,7 +6457,7 @@ 0x808BEF84:("D_808BEF84","UNK_TYPE1","",0x1), 0x808BEF90:("D_808BEF90","UNK_TYPE1","",0x1), 0x808BEF94:("D_808BEF94","UNK_TYPE1","",0x1), - 0x808BEF98:("D_808BEF98","UNK_TYPE1","",0x1), + 0x808BEF98:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808BEF9A:("D_808BEF9A","UNK_TYPE1","",0x1), 0x808BEFA4:("D_808BEFA4","UNK_TYPE1","",0x1), 0x808BEFE0:("D_808BEFE0","f32","",0x4), @@ -6722,7 +6722,7 @@ 0x808D38D4:("D_808D38D4","UNK_TYPE1","",0x1), 0x808D38F4:("D_808D38F4","UNK_TYPE1","",0x1), 0x808D3900:("D_808D3900","UNK_TYPE4","",0x4), - 0x808D393C:("D_808D393C","UNK_TYPE1","",0x1), + 0x808D393C:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808D393E:("D_808D393E","UNK_TYPE1","",0x1), 0x808D394E:("D_808D394E","UNK_TYPE1","",0x1), 0x808D394F:("D_808D394F","UNK_TYPE1","",0x1), @@ -9141,7 +9141,7 @@ 0x809942E8:("D_809942E8","UNK_TYPE1","",0x1), 0x809942EC:("D_809942EC","UNK_TYPE1","",0x1), 0x809942F0:("D_809942F0","UNK_TYPE1","",0x1), - 0x809942FC:("D_809942FC","UNK_TYPE1","",0x1), + 0x809942FC:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80994302:("D_80994302","UNK_TYPE1","",0x1), 0x80994320:("D_80994320","f32","",0x4), 0x80994324:("D_80994324","f32","",0x4), @@ -9415,8 +9415,8 @@ 0x809A61E4:("D_809A61E4","f32","",0x4), 0x809A61E8:("D_809A61E8","f32","",0x4), 0x809A8C80:("sOccupiedIndices","UNK_TYPE4","",0x4), - 0x809A8C94:("sLimbIndexToShadowBodyPartsIndex","UNK_TYPE1","",0x1), - 0x809A8CAC:("sParentBodyParts","UNK_TYPE1","",0x1), + 0x809A8C94:("sLimbToBodyParts","UNK_TYPE1","",0x1), + 0x809A8CAC:("sParentShadowBodyParts","UNK_TYPE1","",0x1), 0x809A8CC4:("sShadowSizes","UNK_TYPE1","",0x1), 0x809A8CDC:("sDamageTable","UNK_TYPE1","",0x1), 0x809A8CFC:("En_Grasshopper_InitVars","UNK_TYPE1","",0x1), @@ -10129,7 +10129,7 @@ 0x809E90FC:("sGyorgDustPrimColor","UNK_TYPE1","",0x1), 0x809E9100:("sGyorgDustEnvColor","UNK_TYPE1","",0x1), 0x809E9104:("D_809E9104","UNK_TYPE1","",0x1), - 0x809E9128:("sGyorgSphElementIndices","s8","[30]",0x1E), + 0x809E9128:("sLimbToBodyParts","s8","[30]",0x1E), 0x809E9148:("D_809E9148","UNK_TYPE1","",0x1), 0x809E9154:("D_809E9154","Vec3f","[7]",0x54), 0x809E91A8:("D_809E91A8","UNK_TYPE1","",0x1), @@ -13005,7 +13005,7 @@ 0x80AD8E58:("D_80AD8E58","UNK_TYPE1","",0x1), 0x80AD8E5C:("D_80AD8E5C","UNK_TYPE1","",0x1), 0x80AD8E68:("D_80AD8E68","UNK_TYPE1","",0x1), - 0x80AD8EA4:("D_80AD8EA4","UNK_TYPE1","",0x1), + 0x80AD8EA4:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80AD8EA5:("D_80AD8EA5","UNK_TYPE1","",0x1), 0x80AD8EC0:("D_80AD8EC0","f32","",0x4), 0x80AD8EC4:("D_80AD8EC4","f32","",0x4), @@ -13770,7 +13770,7 @@ 0x80B1DADC:("D_80B1DADC","UNK_TYPE1","",0x1), 0x80B1DAEC:("D_80B1DAEC","UNK_TYPE1","",0x1), 0x80B1DAFC:("D_80B1DAFC","UNK_TYPE1","",0x1), - 0x80B1DB08:("D_80B1DB08","UNK_TYPE1","",0x1), + 0x80B1DB08:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80B1DB10:("D_80B1DB10","UNK_TYPE1","",0x1), 0x80B1DB11:("D_80B1DB11","UNK_TYPE1","",0x1), 0x80B1DB12:("D_80B1DB12","UNK_TYPE1","",0x1), @@ -13964,7 +13964,7 @@ 0x80B2F700:("D_80B2F700","UNK_TYPE1","",0x1), 0x80B2F708:("D_80B2F708","UNK_TYPE1","",0x1), 0x80B2F710:("D_80B2F710","UNK_TYPE1","",0x1), - 0x80B2F71C:("D_80B2F71C","UNK_TYPE1","",0x1), + 0x80B2F71C:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80B2F734:("D_80B2F734","UNK_TYPE1","",0x1), 0x80B2F760:("D_80B2F760","f32","",0x4), 0x80B2F764:("D_80B2F764","f32","",0x4), @@ -16343,7 +16343,7 @@ 0x80C13670:("D_80C13670","UNK_TYPE1","",0x1), 0x80C1367C:("D_80C1367C","UNK_TYPE1","",0x1), 0x80C1368C:("D_80C1368C","UNK_TYPE1","",0x1), - 0x80C13698:("D_80C13698","UNK_TYPE1","",0x1), + 0x80C13698:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80C136B0:("D_80C136B0","f32","",0x4), 0x80C136B4:("D_80C136B4","f32","",0x4), 0x80C136B8:("D_80C136B8","f32","",0x4),