diff -r 0f0c92215f57 src/sdl/i_system.cpp --- a/src/sdl/i_system.cpp Sat Jan 01 12:49:07 2022 -0800 +++ b/src/sdl/i_system.cpp Sat Jan 01 14:44:05 2022 -0800 @@ -142,14 +142,13 @@ static DWORD TicStart; -static DWORD TicNext; static DWORD BaseTime; static int TicFrozen; // Signal based timer. static Semaphore timerWait; static int tics; -static DWORD sig_start, sig_next; +static DWORD sig_start; void I_SelectTimer(); @@ -187,14 +186,7 @@ if (saveMS) { - // [Leo] Replaced the expressions for TicStart and TicNext below. - /* TicStart = tm; - TicNext = Scale((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE); - */ - DWORD CurrentTic = ((tm - BaseTime) * TICRATE) / 1000; - TicStart = (CurrentTic * 1000 / TICRATE) + BaseTime; - TicNext = ((CurrentTic + 1) * 1000 / TICRATE) + BaseTime; } return Scale(tm - BaseTime, TICRATE, 1000); } @@ -204,7 +196,6 @@ if (saveMS) { TicStart = sig_start; - TicNext = sig_next; } return tics; } @@ -275,7 +266,6 @@ if(!TicFrozen) tics++; sig_start = SDL_GetTicks(); - sig_next = Scale((Scale (sig_start, TICRATE, 1000) + 1), 1000, TICRATE); SEMAPHORE_SIGNAL(timerWait) } @@ -318,15 +308,14 @@ fixed_t I_GetTimeFrac (uint32 *ms) { DWORD now = SDL_GetTicks (); - if (ms) *ms = TicNext; - DWORD step = TicNext - TicStart; - if (step == 0) + if (ms) *ms = TicStart + (1000 / TICRATE); + if (TicStart == 0) { return FRACUNIT; } else { - fixed_t frac = clamp ((now - TicStart)*FRACUNIT/step, 0, FRACUNIT); + fixed_t frac = clamp ((now - TicStart)*FRACUNIT*TICRATE/1000, 0, FRACUNIT); return frac; } }