diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 91e86d598..44835b5c4 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -6770,6 +6770,9 @@ MAIN_LOOP_RESTART: gameUpdate = true; g_gameUpdateTime = timerGetTicks()-gameUpdateStartTime; + if (g_gameUpdateAvgTime < 0.f) + g_gameUpdateAvgTime = g_gameUpdateTime; + g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES-1.f)*g_gameUpdateAvgTime+g_gameUpdateTime)/((float) GAMEUPDATEAVGTIMENUMSAMPLES); } G_DoCheats(); diff --git a/source/duke3d/src/global.cpp b/source/duke3d/src/global.cpp index 3e02eeb09..50f9e6ec0 100644 --- a/source/duke3d/src/global.cpp +++ b/source/duke3d/src/global.cpp @@ -90,6 +90,8 @@ int32_t g_gametypeFlags[MAXGAMETYPES] = GAMETYPE_TDMSPAWN, }; +float g_gameUpdateAvgTime = -1.f; + int32_t g_actorRespawnTime = 768; int32_t g_bouncemineRadius = 2500; int32_t g_deleteQueueSize = 64; diff --git a/source/duke3d/src/global.h b/source/duke3d/src/global.h index 3f4274a96..1c542abf3 100644 --- a/source/duke3d/src/global.h +++ b/source/duke3d/src/global.h @@ -163,6 +163,8 @@ G_EXTERN uint32_t everyothertime; G_EXTERN uint32_t g_moveThingsCount; G_EXTERN uint32_t g_gameUpdateTime; G_EXTERN uint32_t g_gameUpdateAndDrawTime; +#define GAMEUPDATEAVGTIMENUMSAMPLES 100 +extern float g_gameUpdateAvgTime; #ifndef global_c_ extern char CheatKeys[2]; diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index a8bbe664a..629bb9874 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -837,7 +837,7 @@ static void G_PrintFPS(void) printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET, FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x); - chars = Bsprintf(tempbuf, "Min Game Update: %2d ms Max Game Update: %2d ms", minGameUpdate, maxGameUpdate); + chars = Bsprintf(tempbuf, "Min GU: %2d ms Max GU: %2d ms Avg GU: %5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime); printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x); printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,