diff --git a/src/game/clock.c b/src/game/clock.c index 237285694..e48c892e9 100644 --- a/src/game/clock.c +++ b/src/game/clock.c @@ -40,7 +40,11 @@ static bool Clock_CheckElapsedUnit( const double multiplier = (bypass_turbo_cheat ? 1.0 : Clock_GetSpeedMultiplier()) / 1000.0; const double frames = delta * multiplier * unit; - if (frames >= how_often || g_Config.rendering.fps != timer->prev_fps) { + if (g_Config.rendering.fps != timer->prev_fps) { + Clock_ResetTimer(timer); + return false; + } + if (frames >= how_often) { Clock_ResetTimer(timer); return true; } diff --git a/src/game/phase/phase_inventory.c b/src/game/phase/phase_inventory.c index 56df0221f..c1b4570bb 100644 --- a/src/game/phase/phase_inventory.c +++ b/src/game/phase/phase_inventory.c @@ -68,6 +68,7 @@ static int32_t InvItem_GetFrames( const INVENTORY_ITEM *inv_item, FRAME_INFO **out_frame1, FRAME_INFO **out_frame2, int32_t *out_rate); static void Inv_DrawItem(INVENTORY_ITEM *inv_item, int32_t frames); +static bool Inv_CheckDemoTimer(const IMOTION_INFO *motion); static void Phase_Inventory_Start(void *arg); static void Phase_Inventory_End(void); @@ -550,6 +551,23 @@ static void Inv_DrawItem(INVENTORY_ITEM *const inv_item, const int32_t frames) } } +static bool Inv_CheckDemoTimer(const IMOTION_INFO *const motion) +{ + if (!g_Config.enable_demo || !g_GameFlow.has_demo) { + return false; + } + + if (g_InvMode != INV_TITLE_MODE || g_Input.any || g_InputDB.any + || Console_IsOpened()) { + Clock_ResetTimer(&m_DemoTimer); + return false; + } + + return motion->status == RNG_OPEN + && Clock_CheckElapsedMilliseconds( + &m_DemoTimer, g_GameFlow.demo_delay * 1000.0); +} + static void Phase_Inventory_Start(void *arg) { Interpolation_Remember(); @@ -657,19 +675,10 @@ static GAMEFLOW_COMMAND Phase_Inventory_ControlFrame(void) Inv_Ring_CalcAdders(ring, ROTATE_DURATION); Input_Update(); - // Do the demo inactivity check prior to postprocessing of the inputs. - if (g_InvMode != INV_TITLE_MODE || g_Input.any || g_InputDB.any - || Console_IsOpened()) { - Clock_ResetTimer(&m_DemoTimer); - } else if (g_Config.enable_demo && motion->status == RNG_OPEN) { - if (g_GameFlow.has_demo - && Clock_CheckElapsedMilliseconds( - &m_DemoTimer, g_GameFlow.demo_delay * 1000.0)) { - m_StartDemo = true; - } + if (Inv_CheckDemoTimer(motion)) { + m_StartDemo = true; } - Shell_ProcessInput(); Game_ProcessInput();