From 9d601c06dd1736a1235b76528b2ba4b1554c8c02 Mon Sep 17 00:00:00 2001 From: Archez Date: Thu, 28 Nov 2024 14:30:15 -0500 Subject: [PATCH] update twinmold effect tracking --- .../overlays/actors/ovl_Boss_02/z_boss_02.c | 22 ++++++++----------- .../overlays/actors/ovl_Boss_02/z_boss_02.h | 2 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 4 ++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.c index a202805cd..5a9194a8c 100644 --- a/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -534,7 +534,7 @@ void Boss02_SpawnEffectSand(TwinmoldEffect* effects, Vec3f* pos, f32 scale) { effects->timer = 0; effects->targetScale = 2.0f * scale; effects->accel.x = effects->accel.z = 0.0f; - effects->justSpawned = true; + effects->epoch++; break; } } @@ -557,7 +557,7 @@ void Boss02_SpawnEffectFragment(TwinmoldEffect* effects, Vec3f* pos) { effects->scale = Rand_ZeroFloat(0.04f) + 0.02f; effects->rotY = Rand_ZeroFloat(32767.0f); effects->rotX = Rand_ZeroFloat(32767.0f); - effects->justSpawned = true; + effects->epoch++; break; } } @@ -574,7 +574,7 @@ void Boss02_SpawnEffectFlash(TwinmoldEffect* effects, Vec3f* pos) { Math_Vec3f_Copy(&effects->accel, &gZeroVec3f); effects->alpha = 255; effects->scale = 0.0f; - effects->justSpawned = true; + effects->epoch++; break; } } @@ -1573,10 +1573,9 @@ void Boss02_DrawEffects(PlayState* play) { for (i = 0; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { if (effect->type == TWINMOLD_EFFECT_SAND) { - // Here and below, set a highbit for effects that just spawned to skip interoplating from an old effect - FrameInterpolation_RecordOpenChild(effect, effect->type | (effect->justSpawned ? (1 << 30) : 0)); + // Here and below, key by effect type merged with epoch + FrameInterpolation_RecordOpenChild(effect, (effect->epoch << 4) | effect->type); FrameInterpolation_IgnoreActorMtx(); - effect->justSpawned = false; if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustMaterialDL); gDPSetEnvColor(POLY_XLU_DISP++, 185, 140, 70, 128); @@ -1607,9 +1606,8 @@ void Boss02_DrawEffects(PlayState* play) { effect = (TwinmoldEffect*)play->specialEffects; for (i = 0, flag = false; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { if (effect->type == TWINMOLD_EFFECT_FRAGMENT) { - FrameInterpolation_RecordOpenChild(effect, effect->type | (effect->justSpawned ? (1 << 30) : 0)); + FrameInterpolation_RecordOpenChild(effect, (effect->epoch << 4) | effect->type); FrameInterpolation_IgnoreActorMtx(); - effect->justSpawned = false; if (!flag) { gDPSetCombineLERP(POLY_OPA_DISP++, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0); @@ -1632,9 +1630,8 @@ void Boss02_DrawEffects(PlayState* play) { effect = (TwinmoldEffect*)play->specialEffects; for (i = 0, flag = false; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { if (effect->type == TWINMOLD_EFFECT_FLASH) { - FrameInterpolation_RecordOpenChild(effect, effect->type | (effect->justSpawned ? (1 << 30) : 0)); + FrameInterpolation_RecordOpenChild(effect, (effect->epoch << 4) | effect->type); FrameInterpolation_IgnoreActorMtx(); - effect->justSpawned = false; if (!flag) { //! @bug - dev forgot to set flag to 1, should only apply to first entry? gSPDisplayList(POLY_XLU_DISP++, gLightOrbMaterial1DL); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); @@ -1656,9 +1653,8 @@ void Boss02_DrawEffects(PlayState* play) { effect = (TwinmoldEffect*)play->specialEffects; for (i = 0, flag = false; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { if (effect->type == TWINMOLD_EFFECT_BLACK_DUST) { - FrameInterpolation_RecordOpenChild(effect, effect->type | (effect->justSpawned ? (1 << 30) : 0)); + FrameInterpolation_RecordOpenChild(effect, (effect->epoch << 4) | effect->type); FrameInterpolation_IgnoreActorMtx(); - effect->justSpawned = false; if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustMaterialDL); gDPSetEnvColor(POLY_XLU_DISP++, 30, 30, 30, 128); @@ -2365,6 +2361,6 @@ void Boss02_Reset(void) { for (int i = 0; i < TWINMOLD_EFFECT_COUNT; i++) { sTwinmoldEffects[i].type = TWINMOLD_EFFECT_NONE; - sTwinmoldEffects[i].justSpawned = false; + sTwinmoldEffects[i].epoch = 0; } } diff --git a/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.h b/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.h index 37efa665b..9cd4fc52d 100644 --- a/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.h +++ b/mm/src/overlays/actors/ovl_Boss_02/z_boss_02.h @@ -23,7 +23,7 @@ typedef struct { /* 0x34 */ f32 scale; /* 0x38 */ f32 targetScale; // 2S2H [Port] - /* */ u8 justSpawned; // Tracks when an effect is spawned for use with interpolation skipping + /* */ s16 epoch; // Tracks when an effect is spawned for use with interpolation skipping } TwinmoldEffect; // size = 0x3C typedef enum { diff --git a/mm/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/mm/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index e978361df..df1a9b3db 100644 --- a/mm/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/mm/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -182,7 +182,7 @@ void EnTanron5_SpawnEffectSand(TwinmoldEffect* effect, Vec3f* pos, f32 scale) { effect->timer = 0; effect->scale = scale; effect->targetScale = 2.0f * scale; - effect->justSpawned = true; + effect->epoch++; break; } } @@ -207,7 +207,7 @@ void EnTanron5_SpawnEffectBlackDust(TwinmoldEffect* effect, Vec3f* pos, f32 scal effect->timer = 0; effect->scale = scale; effect->targetScale = 2.0f * scale; - effect->justSpawned = true; + effect->epoch++; break; } }