From e1477702ca139175af769347a3ad0d7a13a31fde Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Wed, 25 May 2022 19:23:27 -0700 Subject: [PATCH] EffectSsKirakira OK (#801) * OK * cleanup * KiraKira -> Kirakira --- assets/xml/objects/gameplay_keep.xml | 2 +- include/functions.h | 8 +- spec | 3 +- src/code/z_effect_soft_sprite_old_init.c | 16 +- src/code/z_en_item00.c | 4 +- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 2 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 4 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 2 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 2 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 2 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 4 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 2 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.c | 2 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 2 +- .../z_eff_ss_kirakira.c | 144 ++++++++++++++++-- .../z_eff_ss_kirakira.h | 2 +- tools/disasm/functions.txt | 8 +- tools/namefixer.py | 5 + tools/sizes/code_functions.csv | 8 +- 23 files changed, 180 insertions(+), 50 deletions(-) diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 8328b14ab5..f73e9252f4 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1180,7 +1180,7 @@ - + diff --git a/include/functions.h b/include/functions.h index 0e12b35a5f..8c04ba259d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -541,11 +541,11 @@ void func_800B139C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel); void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); +void EffectSsKirakira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsKirakira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -// void EffectSsKiraKira_SpawnFocused(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); +void EffectSsKirakira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); +// void EffectSsKirakira_SpawnFocused(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); // void EffectSsBomb2_SpawnFade(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4); void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); // void EffectSsBlast_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, Color_RGBA8* param_5, Color_RGBA8* param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); diff --git a/spec b/spec index 5cb8e71236..5c30f08c12 100644 --- a/spec +++ b/spec @@ -1784,8 +1784,7 @@ beginseg name "ovl_Effect_Ss_Kirakira" compress include "build/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.o" - include "build/data/ovl_Effect_Ss_Kirakira/ovl_Effect_Ss_Kirakira.data.o" - include "build/data/ovl_Effect_Ss_Kirakira/ovl_Effect_Ss_Kirakira.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Kirakira/ovl_Effect_Ss_Kirakira_reloc.o" endseg beginseg diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 0300144e10..1e9b255736 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -206,21 +206,21 @@ void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { } } -void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void EffectSsKirakira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { Color_RGBA8 primColor = { 255, 255, 200, 255 }; Color_RGBA8 envColor = { 255, 200, 0, 0 }; - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); + EffectSsKirakira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); } -void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKirakira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16); + EffectSsKirakira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16); } -void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKirakira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { - EffectSsKiraKiraInitParams initParams; + EffectSsKirakiraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); @@ -239,9 +239,9 @@ void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); } -void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, +void EffectSsKirakira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { - EffectSsKiraKiraInitParams initParams; + EffectSsKirakiraInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); Math_Vec3f_Copy(&initParams.velocity, velocity); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 1c600bfa01..6b01753ccd 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -346,7 +346,7 @@ void func_800A6650(EnItem00* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f); pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f); pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); + EffectSsKirakira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); } if ((this->actor.bgCheckFlags & 3) != 0) { if (this->actor.velocity.y > -2.0f) { @@ -403,7 +403,7 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 10.0f); pos.y = this->actor.world.pos.y + ((Rand_ZeroOne() - 0.5f) * 10.0f); pos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 10.0f); - EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); + EffectSsKirakira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); } if (this->actor.bgCheckFlags & 0x0003) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 6e27d1dc9c..7e5c39c2fb 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -147,7 +147,7 @@ void BgKin2Fence_SpawnEyeSparkles(BgKin2Fence* this, GlobalContext* globalCtx, s for (i = 0; i < 2; i++) { Matrix_MultiplyVector3fByState(&eyeSparkleSpawnPositions[mask][i], &sp58); - EffectSsKiraKira_SpawnDispersed(globalCtx, &sp58, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 6000, -10); + EffectSsKirakira_SpawnDispersed(globalCtx, &sp58, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 6000, -10); } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 163619876f..fa94a59815 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -1148,6 +1148,6 @@ void func_808BB8D4(DoorWarp1* this, GlobalContext* globalCtx, s32 arg2) { sVelocity.x = -Math_SinS(rand - 0x8000) * 5.0f; sVelocity.z = Math_CosS(rand - 0x8000) * 5.0f; } - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAccel, &primColor, &envColor, scale, life); + EffectSsKirakira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAccel, &primColor, &envColor, scale, life); } } diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index e536356037..856b459a37 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -296,7 +296,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054A90); + gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); } @@ -352,7 +352,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054A90); + gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); } 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 c5b9381f6f..20092f5b04 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -196,7 +196,7 @@ void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { effectPos.x = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.x; effectPos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + 40.0f); effectPos.z = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); + EffectSsKirakira_SpawnSmall(globalCtx, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_WALK); Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 4.0f, 3, 8.0f, 300, 15, 0); diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 45cc5bdae5..e604198463 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -731,7 +731,7 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(sp5C, sp5C, sp5C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054A90); + gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); Matrix_StatePop(); Matrix_RotateY(this->actor.world.rot.y, MTXMODE_APPLY); 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 62d455147f..a3a433cf12 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1259,7 +1259,7 @@ void func_8088F5F4(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) { envColor.g = this->outerColor.g; envColor.b = this->outerColor.b; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, + EffectSsKirakira_SpawnDispersed(globalCtx, &sparklePos, &sparkleVelocity, &sparkleAccel, &primColor, &envColor, 1000, sparkleLife); } } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 36ad91c0fb..7676a9b78c 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -176,7 +176,7 @@ void EnElforg_SpawnSparkles(EnElforg* this, GlobalContext* globalCtx, s32 life) index = (this->area < STRAY_FAIRY_AREA_CLOCK_TOWN || this->area >= STRAY_FAIRY_AREA_MAX) ? STRAY_FAIRY_AREA_CLOCK_TOWN : this->area; - EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAcceleration, &sPrimColors[index], + EffectSsKirakira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAcceleration, &sPrimColors[index], &sEnvColors[index], 1000, life); } diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index ebe127fcff..f45cafa53b 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -269,7 +269,7 @@ void func_80B3B4B0(EnGg2* this, GlobalContext* globalCtx) { sp64.x = (Rand_Centered() * 50.0f) + this->unk_304.x; sp64.y = this->unk_304.y; sp64.z = (Rand_Centered() * 50.0f) + this->unk_304.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sp64, &D_80B3C088, &D_80B3C094, &sp60, &sp5C, 3000, 40); + EffectSsKirakira_SpawnDispersed(globalCtx, &sp64, &D_80B3C088, &D_80B3C094, &sp60, &sp5C, 3000, 40); } } diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 557b96b31a..6c698234bc 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1577,7 +1577,7 @@ void func_80B45EC8(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { spA8.y = ((Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y) - 90.0f; spA8.z = (spA8.z * 100.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); + EffectSsKirakira_SpawnDispersed(globalCtx, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index de1a18241c..78b370c3b7 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -237,7 +237,7 @@ void func_80A90D34(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 210, 210, 230, 128); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 0); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054A90); + gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -289,7 +289,7 @@ void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 220, 220, 230, 192); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054A90); + gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index f4514a9aa0..2a990bc26c 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -398,7 +398,7 @@ void func_80B93DE8(Vec3f* arg0, GlobalContext* globalCtx, s32 arg2) { sp2C.x = randPlusMinusPoint5Scaled(30.0f) + arg0->x; sp2C.y = arg0->y + 3.0f; sp2C.z = randPlusMinusPoint5Scaled(30.0f) + arg0->z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sp2C, &D_80B9598C, &D_80B95998, &D_80B959A4, &D_80B959A8, 1000, arg2); + EffectSsKirakira_SpawnDispersed(globalCtx, &sp2C, &D_80B9598C, &D_80B95998, &D_80B959A4, &D_80B959A8, 1000, arg2); } s32 func_80B93EA0(EnZog* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index b4a85a3a04..8a1ae2df7b 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -302,7 +302,7 @@ void ObjBigicicle_Update(Actor* thisx, GlobalContext* globalCtx) { sp44.z = (((215.0f + Rand_ZeroFloat(65.0f)) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)) * this->actor.scale.z) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sp44, &gZeroVec3f, &gZeroVec3f, &D_80AE9894, &D_80AE9898, 2000, 5); + EffectSsKirakira_SpawnDispersed(globalCtx, &sp44, &gZeroVec3f, &gZeroVec3f, &D_80AE9894, &D_80AE9898, 2000, 5); } CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index d6ac6f3427..bdffb1b520 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -260,7 +260,7 @@ void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { } sp6C.z = (phi_v0 * (15.0f + (sp58 * 15.0f)) * this->actor.scale.z) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnDispersed(globalCtx, &sp6C, &gZeroVec3f, &gZeroVec3f, &D_80932378, &D_8093237C, 2000, 5); + EffectSsKirakira_SpawnDispersed(globalCtx, &sp6C, &gZeroVec3f, &gZeroVec3f, &D_80932378, &D_8093237C, 2000, 5); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c index b78891a2e0..4c7c01ca36 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c @@ -1,33 +1,159 @@ /* * File: z_eff_ss_kirakira.c * Overlay: ovl_Effect_Ss_Kirakira - * Description: + * Description: Sparkles */ #include "z_eff_ss_kirakira.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rRotSpeed regs[0] +#define rYaw regs[1] +#define rPrimColorR regs[2] +#define rPrimColorG regs[3] +#define rPrimColorB regs[4] +#define rPrimColorA regs[5] +#define rEnvColorR regs[6] +#define rEnvColorG regs[7] +#define rEnvColorB regs[8] +#define rEnvColorA regs[9] +#define rAlphaStep regs[10] +#define rScale regs[11] +#define rLifespan regs[12] #define PARAMS ((EffectSsKirakiraInitParams*)initParamsx) -s32 EffectSsKirakira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsKirakira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); void func_80977DB4(GlobalContext* globalCtx, u32 index, EffectSs* this); void func_80977E6C(GlobalContext* globalCtx, u32 index, EffectSs* this); void func_80977F28(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsKirakira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Kirakira_InitVars = { EFFECT_SS_KIRAKIRA, EffectSsKirakira_Init, }; -#endif +u32 EffectSsKirakira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { + EffectSsKirakiraInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kirakira/EffectSsKirakira_Init.s") + this->pos = initParams->pos; + this->velocity = initParams->velocity; + this->accel = initParams->accel; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kirakira/EffectSsKirakira_Draw.s") + if ((this->life = initParams->life) < 0) { + this->life = -this->life; + this->gfx = gEffSparklesDL; + this->update = func_80977F28; + this->rEnvColorA = initParams->scale; + this->rScale = 0; + } else { + this->gfx = gEffSparklesDL; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kirakira/func_80977DB4.s") + if (initParams->updateMode == 0) { + this->update = func_80977DB4; + } else { + this->update = func_80977E6C; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kirakira/func_80977E6C.s") + this->rEnvColorA = initParams->envColor.a; + this->rScale = initParams->scale; + if (this->rScale < 0) { + this->gfx = gameplay_keep_DL_06A800; + this->rScale = -this->rScale; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kirakira/func_80977F28.s") + this->draw = EffectSsKirakira_Draw; + this->rRotSpeed = initParams->rotSpeed; + this->rYaw = initParams->yaw; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rAlphaStep = initParams->alphaStep; + this->rLifespan = initParams->life; + + return 1; +} + +void EffectSsKirakira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx; + f32 scale = this->rScale / 10000.0f; + s32 pad; + MtxF mfTrans; + MtxF mfRot; + MtxF mfScale; + MtxF mfTransBillboard; + MtxF mfTransBillboardRot; + MtxF mfResult; + Mtx* mtx; + + gfxCtx = globalCtx->state.gfxCtx; + + OPEN_DISPS(gfxCtx); + + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); + SkinMatrix_SetRotateRPY(&mfRot, 0, 0, this->rYaw); + SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); + SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRot, &mfTransBillboardRot); + SkinMatrix_MtxFMtxFMult(&mfTransBillboardRot, &mfScale, &mfResult); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, + (((s8)((55.0f / this->rLifespan) * this->life) + 200))); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); + gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + } + + CLOSE_DISPS(gfxCtx); +} + +void func_80977DB4(GlobalContext* globalCtx, u32 index, EffectSs* this) { + this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f; + this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f; + this->rEnvColorA += this->rAlphaStep; + + if (this->rEnvColorA < 0) { + this->rEnvColorA = 0; + this->rAlphaStep = -this->rAlphaStep; + } else if (this->rEnvColorA > 255) { + this->rEnvColorA = 255; + this->rAlphaStep = -this->rAlphaStep; + } + + this->rYaw += this->rRotSpeed; +} + +void func_80977E6C(GlobalContext* globalCtx, u32 index, EffectSs* this) { + this->velocity.x *= 0.95f; + this->velocity.z *= 0.95f; + this->accel.x = randPlusMinusPoint5Scaled(0.2f); + this->accel.z = randPlusMinusPoint5Scaled(0.2f); + this->rEnvColorA += this->rAlphaStep; + + if (this->rEnvColorA < 0) { + this->rEnvColorA = 0; + this->rAlphaStep = -this->rAlphaStep; + } else if (this->rEnvColorA > 255) { + this->rEnvColorA = 255; + this->rAlphaStep = -this->rAlphaStep; + } + + this->rYaw += this->rRotSpeed; +} + +void func_80977F28(GlobalContext* globalCtx, u32 index, EffectSs* this) { + this->rScale = this->rEnvColorA * Math_SinS((32768.0f / this->rLifespan) * this->life); +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h index c3020f590b..66e73e0a53 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h @@ -15,7 +15,7 @@ typedef struct { /* 0x34 */ s16 rotSpeed; /* 0x36 */ s16 yaw; /* 0x38 */ u8 updateMode; -} EffectSsKiraKiraInitParams; // size = 0x3C +} EffectSsKirakiraInitParams; // size = 0x3C extern const EffectSsInit Effect_Ss_Kirakira_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index e552ca3367..017df4ba11 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -596,10 +596,10 @@ 0x800B13D8:("func_800B13D8",), 0x800B14D4:("func_800B14D4",), 0x800B1598:("func_800B1598",), - 0x800B165C:("EffectSsKiraKira_SpawnSmallYellow",), - 0x800B16B8:("EffectSsKiraKira_SpawnSmall",), - 0x800B16F4:("EffectSsKiraKira_SpawnDispersed",), - 0x800B1830:("EffectSsKiraKira_SpawnFocused",), + 0x800B165C:("EffectSsKirakira_SpawnSmallYellow",), + 0x800B16B8:("EffectSsKirakira_SpawnSmall",), + 0x800B16F4:("EffectSsKirakira_SpawnDispersed",), + 0x800B1830:("EffectSsKirakira_SpawnFocused",), 0x800B1908:("EffectSsBomb2_SpawnFade",), 0x800B1970:("EffectSsBomb2_SpawnLayered",), 0x800B19E0:("EffectSsBlast_Spawn",), diff --git a/tools/namefixer.py b/tools/namefixer.py index 7ce3790db6..c4a83d13f3 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -499,6 +499,11 @@ wordReplace = { "func_8015E750": "Message_FindCreditsMessage", "func_80133038": "Schedule_RunScript", + "EffectSsKiraKira_SpawnSmallYellow": "EffectSsKirakira_SpawnSmallYellow", + "EffectSsKiraKira_SpawnSmall": "EffectSsKirakira_SpawnSmall", + "EffectSsKiraKira_SpawnDispersed": "EffectSsKirakira_SpawnDispersed", + "EffectSsKiraKira_SpawnFocused": "EffectSsKirakira_SpawnFocused", + # Struct members "skelAnime.unk03": "skelAnime.taper", "skelAnime.animCurrentSeg": "skelAnime.animation", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index ffff2a55ba..2989dbfb65 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -110,10 +110,10 @@ asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B139C.s,func_800B13 asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B13D8.s,func_800B13D8,0x800B13D8,0x3F asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B14D4.s,func_800B14D4,0x800B14D4,0x31 asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B1598.s,func_800B1598,0x800B1598,0x31 -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKiraKira_SpawnSmallYellow.s,EffectSsKiraKira_SpawnSmallYellow,0x800B165C,0x17 -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKiraKira_SpawnSmall.s,EffectSsKiraKira_SpawnSmall,0x800B16B8,0xF -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKiraKira_SpawnDispersed.s,EffectSsKiraKira_SpawnDispersed,0x800B16F4,0x4F -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKiraKira_SpawnFocused.s,EffectSsKiraKira_SpawnFocused,0x800B1830,0x36 +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKirakira_SpawnSmallYellow.s,EffectSsKirakira_SpawnSmallYellow,0x800B165C,0x17 +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKirakira_SpawnSmall.s,EffectSsKirakira_SpawnSmall,0x800B16B8,0xF +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKirakira_SpawnDispersed.s,EffectSsKirakira_SpawnDispersed,0x800B16F4,0x4F +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKirakira_SpawnFocused.s,EffectSsKirakira_SpawnFocused,0x800B1830,0x36 asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsBomb2_SpawnFade.s,EffectSsBomb2_SpawnFade,0x800B1908,0x1A asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsBomb2_SpawnLayered.s,EffectSsBomb2_SpawnLayered,0x800B1970,0x1C asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsBlast_Spawn.s,EffectSsBlast_Spawn,0x800B19E0,0x24