Fix FPS counter not acocunting for frameskip

This commit is contained in:
Lephenixnoir 2021-08-05 09:51:35 +02:00
parent d9f23fc156
commit 292581f87c
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 6 additions and 2 deletions

View File

@ -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;