uint64_t in G_FPSLimit()

git-svn-id: https://svn.eduke32.com/eduke32@8070 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-09-02 05:55:23 +00:00 committed by Christoph Oelckers
parent 4d20afa9ed
commit 1ba0406b4d

View file

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