diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 4a333deb8..1ec0363ef 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -350,7 +350,7 @@ static void Startup(void) SetDispatcher(); S_InitSound(); - timerInit(TICRATE); + timerInit(GameTicRate); loadcons(); fi.initactorflags(); diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index d3b20585b..bbbe19b7a 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -308,6 +308,8 @@ static void checkTimerActive() // //--------------------------------------------------------------------------- +static int lastTic; + bool GameTicker() { if (ps[myconnectindex].gm == MODE_DEMO) @@ -327,9 +329,11 @@ bool GameTicker() gameupdatetime.Reset(); gameupdatetime.Clock(); - while (playrunning() && (int)(totalclock - ototalclock) >= TICSPERFRAME) + int currentTic = I_GetTime(); + + if (playrunning() && currentTic - lastTic >= 1) { - ototalclock += TICSPERFRAME; + lastTic = currentTic; GetInput(); auto const pPlayer = &ps[myconnectindex]; @@ -356,7 +360,7 @@ bool GameTicker() { ototalclock = totalclock - 1; } - double const smoothRatio = calc_smoothratio(totalclock, ototalclock); + double const smoothRatio = I_GetTimeFrac() * 65536.; gameupdatetime.Unclock();