From 1ba0406b4d228d5cc332c3df068424cd689d9499 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 2 Sep 2019 05:55:23 +0000 Subject: [PATCH] uint64_t in G_FPSLimit() git-svn-id: https://svn.eduke32.com/eduke32@8070 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/game.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index f7474bc83..15222a9dc 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -6333,16 +6333,17 @@ int G_FPSLimit(void) if (!r_maxfps) return 1; - static double nextPageDelay; - static double lastFrameTicks; + static double nextPageDelay; + static uint64_t lastFrameTicks; - double const frameTicks = timerGetTicksU64(); - double const elapsedTime = frameTicks-lastFrameTicks; + uint64_t const frameTicks = timerGetTicksU64(); + uint64_t const elapsedTime = frameTicks - lastFrameTicks; + double const dElapsedTime = elapsedTime; - if (elapsedTime >= nextPageDelay) + if (dElapsedTime >= floor(nextPageDelay)) { - if (elapsedTime <= nextPageDelay+g_frameDelay) - nextPageDelay += g_frameDelay-elapsedTime; + if (dElapsedTime <= nextPageDelay+g_frameDelay) + nextPageDelay += g_frameDelay-dElapsedTime; lastFrameTicks = frameTicks;