Do the alternative interp failsafe CORRECTLY.

This commit is contained in:
Sally Coolatta 2022-03-27 03:39:19 -04:00
parent d00f2e0622
commit 12353c2d6f

View file

@ -791,23 +791,19 @@ void D_SRB2Loop(void)
if (interp && !(paused || P_AutoPause())) if (interp && !(paused || P_AutoPause()))
{ {
static float tictime = 0.0f; static float tictime = 0.0f;
static float prevtime = 0.0f;
float entertime = I_GetTimeFrac(); float entertime = I_GetTimeFrac();
fixed_t entertimefrac; fixed_t entertimefrac;
#if 1
(void)ticked;
//CONS_Printf("Avg FPS: %f, diff: %f\n========\n", averageFPS, entertime - tictime);
entertimefrac = min(FRACUNIT, FLOAT_TO_FIXED(entertime - tictime));
tictime = entertime;
#else
if (ticked) if (ticked)
tictime = entertime; tictime = entertime;
if (averageFPS < 35.0) // Not convinced it should be doing it this way, but couldn't figure out anything better... if (entertime - prevtime >= 1.0f) // Lagged for more frames than a gametic... shut off interpolation.
entertimefrac = FRACUNIT; entertimefrac = FRACUNIT;
else else
entertimefrac = FLOAT_TO_FIXED(entertime - tictime); entertimefrac = min(FRACUNIT, FLOAT_TO_FIXED(entertime - tictime));
#endif
prevtime = entertime;
// renderdeltatics is a bit awkard to evaluate, since the system time interface is whole tic-based // renderdeltatics is a bit awkard to evaluate, since the system time interface is whole tic-based
renderdeltatics = realtics * FRACUNIT; renderdeltatics = realtics * FRACUNIT;