- add `cl_debugintrpl` CVAR to print interpolation information to the console.

* Also revert back to use of `xs_CRoundToInt()` that was accidentally removed previously.
This commit is contained in:
Mitchell Richters 2020-07-31 12:24:44 +10:00 committed by Christoph Oelckers
parent 1cf857e788
commit 52d9fd4cda
3 changed files with 13 additions and 1 deletions

View File

@ -1040,6 +1040,7 @@ void S_SetSoundPaused(int state)
int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int realgameticspersec) int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int realgameticspersec)
{ {
double const gametics = 1'000'000'000. / realgameticspersec;
uint64_t currentTime = I_nsTime(); uint64_t currentTime = I_nsTime();
if ((lastototalclk == ototalclk) && (lastTime != 0)) if ((lastototalclk == ototalclk) && (lastTime != 0))
@ -1053,7 +1054,16 @@ int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int
} }
lastTime = currentTime; lastTime = currentTime;
return clamp(MaxSmoothRatio * (elapsedTime / (1'000'000'000. / realgameticspersec)), 0, MaxSmoothRatio); double ratioScale = elapsedTime / gametics;
int smoothratio = clamp(xs_CRoundToInt(MaxSmoothRatio * ratioScale), 0, MaxSmoothRatio);
if (cl_debugintrpl)
{
Printf("ototalclk: %d\ntotalclk: %d\ngametics: %.3f ms\nelapsedTime: %.3f ms\nratioScale: %f\nsmoothratio: %d\n",
ototalclk, totalclk, (gametics / 1'000'000.), (elapsedTime / 1'000'000.), ratioScale, smoothratio);
}
return smoothratio;
} }
FString G_GetDemoPath() FString G_GetDemoPath()

View File

@ -90,6 +90,7 @@ CVARD(Bool, cl_slopetilting, false, CVAR_ARCHIVE, "enable/disable slope tilting"
CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // only implemented in Blood CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // only implemented in Blood
CVARD(Bool, cl_sointerpolation, true, CVAR_ARCHIVE, "enable/disable sector object interpolation") // only implemented in SW CVARD(Bool, cl_sointerpolation, true, CVAR_ARCHIVE, "enable/disable sector object interpolation") // only implemented in SW
CVARD(Bool, cl_syncinput, false, CVAR_ARCHIVE, "enable/disable synchronized input with game's ticrate") // only implemented in SW CVARD(Bool, cl_syncinput, false, CVAR_ARCHIVE, "enable/disable synchronized input with game's ticrate") // only implemented in SW
CVARD(Bool, cl_debugintrpl, false, CVAR_NOSAVE, "print information regarding calculated smoothratio for interpolation") // only implemented in SW
CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the crosshair") CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the crosshair")
{ {
if (self < 1) self = 1; if (self < 1) self = 1;

View File

@ -25,6 +25,7 @@ EXTERN_CVAR(Int, cl_weaponswitch)
EXTERN_CVAR(Int, cl_crosshairscale) EXTERN_CVAR(Int, cl_crosshairscale)
EXTERN_CVAR(Bool, cl_sointerpolation) EXTERN_CVAR(Bool, cl_sointerpolation)
EXTERN_CVAR(Bool, cl_syncinput) EXTERN_CVAR(Bool, cl_syncinput)
EXTERN_CVAR(Bool, cl_debugintrpl)
EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs) EXTERN_CVAR(Bool, demoplay_diffs)