mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- restore legacy interpolation path behind CVAR cl_legacyintrpl
.
* Hoping the old path being available will allow the new code to be merged. * Applied offset to sum of `(totalclk - ototalclk)` of 0.5 to ensure calculated smoothratio under legacy path always returns a value. * For the above, consider Duke 3D with 4 game tics per ticrate, the returned values would be: 0 16384 32768 49152 * With offset of 0.5, the following values are returned depending on how far advanced `totalclk` is from `ototalclk`: 8192 24576 40960 57344
This commit is contained in:
parent
0aca26e197
commit
5000fde281
3 changed files with 41 additions and 20 deletions
|
@ -1040,6 +1040,16 @@ 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 ratio;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if (cl_debugintrpl)
|
||||||
|
{
|
||||||
|
Printf("ototalclk: %d\ntotalclk: %d\n", ototalclk, totalclk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cl_legacyintrpl)
|
||||||
|
{
|
||||||
double const gametics = 1'000'000'000. / realgameticspersec;
|
double const gametics = 1'000'000'000. / realgameticspersec;
|
||||||
uint64_t currentTime = I_nsTime();
|
uint64_t currentTime = I_nsTime();
|
||||||
|
|
||||||
|
@ -1053,17 +1063,26 @@ int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int
|
||||||
elapsedTime = 0;
|
elapsedTime = 0;
|
||||||
}
|
}
|
||||||
lastTime = currentTime;
|
lastTime = currentTime;
|
||||||
|
ratio = elapsedTime / gametics;
|
||||||
double ratioScale = elapsedTime / gametics;
|
|
||||||
int smoothratio = clamp(xs_CRoundToInt(MaxSmoothRatio * ratioScale), 0, MaxSmoothRatio);
|
|
||||||
|
|
||||||
if (cl_debugintrpl)
|
if (cl_debugintrpl)
|
||||||
{
|
{
|
||||||
Printf("ototalclk: %d\ntotalclk: %d\ngametics: %.3f ms\nelapsedTime: %.3f ms\nratioScale: %f\nsmoothratio: %d\n",
|
Printf("gametics: %.3f ms\nelapsedTime: %.3f ms\n", (gametics / 1'000'000.), (elapsedTime / 1'000'000.));
|
||||||
ototalclk, totalclk, (gametics / 1'000'000.), (elapsedTime / 1'000'000.), ratioScale, smoothratio);
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ratio = (0.5 + (totalclk - ototalclk)) / (120 / realgameticspersec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return smoothratio;
|
result = clamp(xs_CRoundToInt(ratio * MaxSmoothRatio), 0, MaxSmoothRatio);
|
||||||
|
|
||||||
|
if (cl_debugintrpl)
|
||||||
|
{
|
||||||
|
Printf("ratio: %f\nresult: %d\n", ratio, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString G_GetDemoPath()
|
FString G_GetDemoPath()
|
||||||
|
|
|
@ -90,7 +90,8 @@ 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
|
CVARD(Bool, cl_debugintrpl, false, CVAR_NOSAVE, "print information regarding calculated smoothratio for interpolation")
|
||||||
|
CVARD(Bool, cl_legacyintrpl, false, CVAR_ARCHIVE, "perform legacy interpolation calculations")
|
||||||
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;
|
||||||
|
|
|
@ -26,6 +26,7 @@ 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, cl_debugintrpl)
|
||||||
|
EXTERN_CVAR(Bool, cl_legacyintrpl)
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, demorec_seeds_cvar)
|
EXTERN_CVAR(Bool, demorec_seeds_cvar)
|
||||||
EXTERN_CVAR(Bool, demoplay_diffs)
|
EXTERN_CVAR(Bool, demoplay_diffs)
|
||||||
|
|
Loading…
Reference in a new issue