From bf37c2f7765f4fd3f11973d6c7a7cc0f7ac2bc83 Mon Sep 17 00:00:00 2001 From: Sally Coolatta <tehrealsalt@gmail.com> Date: Sat, 16 Apr 2022 02:58:43 -0400 Subject: [PATCH] Adjust how FPS cap is checked to improve FPS stability --- src/d_main.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index fcff182a98..731710a9c6 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -723,6 +723,7 @@ void D_SRB2Loop(void) boolean ticked; boolean interp; boolean doDisplay = false; + boolean frameCap = false; if (dedicated) server = true; @@ -803,11 +804,25 @@ void D_SRB2Loop(void) doDisplay = false; ticked = false; - if (!realtics && !singletics && !interp) + frameCap = false; + if (interp) { - // Non-interp sleep - I_Sleep(); - continue; + frameCap = D_CheckFrameCap(); + } + + if (!realtics && !singletics) + { + if (interp) + { + if (frameCap) + continue; + } + else + { + // Non-interp sleep + I_Sleep(); + continue; + } } #ifdef HW3SOUND @@ -869,7 +884,7 @@ void D_SRB2Loop(void) // TryRunTics needs ran if possible to prevent lagged map changes, // (and if that runs, the code above needs to also run) // so this is done here after TryRunTics. - if (D_CheckFrameCap()) + if (frameCap) { continue; } -- GitLab