From 5bb4f1d193ce042f5258407abeca5db064c979aa Mon Sep 17 00:00:00 2001 From: fgsfds Date: Wed, 15 Nov 2023 00:25:10 +0100 Subject: [PATCH] port: fix (?) slomo at high framerates --- src/game/lv.c | 8 ++++---- src/include/game/lv.h | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/lv.c b/src/game/lv.c index a45954107..e100aeda9 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -2059,7 +2059,7 @@ void lvTick(void) if (slowmo == SLOWMOTION_ON) { if (g_Vars.speedpillon == false || g_Vars.in_cutscene) { if (g_Vars.lvupdate240 > LV_SLOMO_TICK_CAP) { - g_Vars.lvupdate240 = LV_SLOMO_TICK_CAP; + g_Vars.lvupdate240 = LV_SLOMO_TICK_RATE; } } } else if (slowmo == SLOWMOTION_SMART) { @@ -2090,7 +2090,7 @@ void lvTick(void) if (foundnearbychr) { if (g_Vars.lvupdate240 > LV_SLOMO_TICK_CAP) { - g_Vars.lvupdate240 = LV_SLOMO_TICK_CAP; + g_Vars.lvupdate240 = LV_SLOMO_TICK_RATE; } } else { if (g_Vars.lvupdate240 > TICKS(8)) { @@ -2099,7 +2099,7 @@ void lvTick(void) } } else { if (g_Vars.lvupdate240 > LV_SLOMO_TICK_CAP) { - g_Vars.lvupdate240 = LV_SLOMO_TICK_CAP; + g_Vars.lvupdate240 = LV_SLOMO_TICK_RATE; } } } @@ -2107,7 +2107,7 @@ void lvTick(void) // Slow motion settings are off if (g_Vars.speedpillon && g_Vars.in_cutscene == false) { if (g_Vars.lvupdate240 > LV_SLOMO_TICK_CAP) { - g_Vars.lvupdate240 = LV_SLOMO_TICK_CAP; + g_Vars.lvupdate240 = LV_SLOMO_TICK_RATE; } } } diff --git a/src/include/game/lv.h b/src/include/game/lv.h index 961af91d0..f4f6dc808 100644 --- a/src/include/game/lv.h +++ b/src/include/game/lv.h @@ -6,10 +6,12 @@ #ifdef PLATFORM_N64 // game runs at ~30, so slomo = 1/2 of 30fps -#define LV_SLOMO_TICK_CAP TICKS(4) +#define LV_SLOMO_TICK_CAP 4 +#define LV_SLOMO_TICK_RATE LV_SLOMO_TICK_CAP #else -// game runs at 60+, so slomo = 1/2 of 60fps -#define LV_SLOMO_TICK_CAP TICKS(2) +// game runs at 60+, so slomo = 1/2 of whatever framerate we're running at +#define LV_SLOMO_TICK_CAP 1 // capping at >= 240fps would make it explode +#define LV_SLOMO_TICK_RATE (g_Vars.lvupdate240 / 2) #endif u32 getVar80084040(void);