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_Demo_Kankyo/z_demo_kankyo.c b/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 6af0792c6..7fd2eef66 100644 --- a/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -399,7 +399,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, PlayState* play) { } if (((this->effects[i].posBase.x + this->effects[i].posOffset.x) - newEye.x) > halfScreenHeight) { - // 2S2H [Interpolation] Here and below, skip particle interpolation on next frame when positionmoves + // 2S2H [Interpolation] Here and below, skip particle interp on next frame when position moves if (ABS(this->effects[i].posBase.x - (newEye.x - halfScreenHeight)) >= 120.0f) { this->effects[i].epoch++; } 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; } } diff --git a/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 71bbc75fc..7a8222bc9 100644 --- a/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -281,6 +281,7 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) { if (((this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C) - temp_f24) > temp_120) { this->unk_14C[i].unk_00 = temp_f24 - temp_120; + // 2S2H [Interpolation] Here and below, skip particle interp on next frame when position moves this->unk_14C[i].epoch++; } @@ -455,6 +456,7 @@ void func_808DCDB4(ObjectKankyo* this, PlayState* play) { if (((this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C) - temp_f26) > temp_80) { this->unk_14C[i].unk_00 = temp_f26 - temp_80; + // 2S2H [Interpolation] Here and below, skip particle interp on next frame when position moves this->unk_14C[i].epoch++; } @@ -588,7 +590,6 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { Matrix_Scale(0.05f + tempf, 0.05f + tempf, 0.05f + tempf, MTXMODE_APPLY); temp_f2 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye) / 300.0f; temp_f2 = ((1.0f < temp_f2) ? 0.0f : (((1.0f - temp_f2) > 1.0f) ? 1.0f : 1.0f - temp_f2)); - temp_f2 = 1.59375f; gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(160.0f * temp_f2)); @@ -658,7 +659,6 @@ void func_808DD970(Actor* thisx, PlayState* play2) { Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); temp_f0 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye); temp_f0 = (u8)(255.0f * phi_f26) * (1.0f - (temp_f0 / 300.0f)); - temp_f0 = 255; gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 55, temp_f0);