From 3585ab8a59a45bed50962c1f9e901753950dfe99 Mon Sep 17 00:00:00 2001 From: Irastris Date: Thu, 9 Jul 2026 20:57:38 -0400 Subject: [PATCH] Add deltatime to bloom/fog transitions --- src/d/d_kankyo.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index 36949adc76..048b8b844d 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -37,6 +37,7 @@ #include "dusk/settings.h" #include "dusk/frame_interpolation.h" #include "dusk/game_clock.h" +static f32 timeScale = 1.0f; #endif static void GxXFog_set(); @@ -1799,6 +1800,9 @@ void dScnKy_env_light_c::setLight_palno_get(u8* prev_envr_id_p, u8* next_envr_id u8 psel_idx = 0; int i; int sp14 = 0; +#if TARGET_PC + const f32 timeScale = (pattern_ratio_p == &g_env_light.pat_ratio) ? ::timeScale : 1.0f; +#endif if (*init_timer_p != 0) { (*init_timer_p)++; @@ -2132,14 +2136,22 @@ void dScnKy_env_light_c::setLight_palno_get(u8* prev_envr_id_p, u8* next_envr_id if (g_env_light.mColPatMode == 0) { if (pselect_p->change_rate > 0.0f) { +#if TARGET_PC + *pattern_ratio_p += timeScale * ((1.0f / 30) / pselect_p->change_rate); +#else *pattern_ratio_p += (1.0f / 30) / pselect_p->change_rate; +#endif } // pattern change rate is faster in hyrule field if (strcmp(dComIfGp_getStartStageName(), "F_SP121") == 0 && *prev_pat_p == *next_pat_p) { +#if TARGET_PC + *pattern_ratio_p += timeScale * (1.0f / 15); +#else *pattern_ratio_p += (1.0f / 15); +#endif } if (*pattern_ratio_p >= 1.0f) { @@ -2332,6 +2344,10 @@ void dScnKy_env_light_c::setLight() { u8 next_pal_start_id; u8 prev_pal_end_id; u8 next_pal_end_id; +#if TARGET_PC + const f32 deltaTime = dusk::game_clock::consume_interval(this); + timeScale = deltaTime / dusk::game_clock::period_for_original_frames(1.0f); +#endif setLight_palno_get(&g_env_light.PrevCol, &g_env_light.UseCol, &g_env_light.wether_pat0, &g_env_light.wether_pat1, &prev_pal_start_id, &prev_pal_end_id, &next_pal_start_id, &next_pal_end_id, &color_ratio, &start_pat_pal_id, @@ -2517,8 +2533,6 @@ void dScnKy_env_light_c::setLight() { f32 sin = cM_ssin(S_fuwan_sin); #if TARGET_PC - const f32 deltaTime = dusk::game_clock::consume_interval(this); - const f32 timeScale = deltaTime / dusk::game_clock::period_for_original_frames(1.0f); S_fuwan_sin += (s16)((cM_rndF(2000.0f) + 500) * timeScale); #else S_fuwan_sin += (s16)cM_rndF(2000.0f) + 500;