From 292581f87c101f85397a15ce6f7619fc5eeb2b22 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 5 Aug 2021 09:51:35 +0200 Subject: [PATCH] Fix FPS counter not acocunting for frameskip --- cgdoom/i_system.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cgdoom/i_system.c b/cgdoom/i_system.c index d6f8366..62040a0 100644 --- a/cgdoom/i_system.c +++ b/cgdoom/i_system.c @@ -331,10 +331,11 @@ void I_StartTic (void) extern boolean fpscounteractive; extern int fpscounter_data; + extern int giRefreshMask; /* Number of frames since FPS count started */ static int fps_frames = 0; - /* Time when the FPS count started */ + /* RTC time when the FPS count started */ static int fps_ticks = -1; if(fps_ticks < 0) @@ -343,7 +344,10 @@ void I_StartTic (void) if(++fps_frames >= 16) { int now = RTC_GetTicks(); - fpscounter_data = (now == fps_ticks) ? -1 : 128 * fps_frames / (now - fps_ticks); + if (now == fps_ticks) + fpscounter_data = -1; + else + fpscounter_data = 128 * fps_frames / ((now - fps_ticks) * (giRefreshMask + 1)); fps_ticks = now; fps_frames = 0;