mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 08:41:59 +00:00
Final work on prediction lerping
Added cl_predict_lerpscale and cl_predict_lerpthreshold Added options in menudef Made sure that lerping cannot extrapolate or run on small scales Lerping gets reset when rendering interpolation does or respawn
This commit is contained in:
parent
3e6ad8c1a8
commit
98904039b7
2 changed files with 14 additions and 9 deletions
|
@ -64,14 +64,14 @@ static FRandom pr_skullpop ("SkullPop");
|
|||
CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, cl_predict_specials, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CUSTOM_CVAR(Float, cl_predict_lerpscale, 0.05, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Float, cl_predict_lerpscale, 0.05f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
P_PredictionLerpReset();
|
||||
}
|
||||
CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0.1)
|
||||
self = 0.1;
|
||||
if (self < 0.1f)
|
||||
self = 0.1f;
|
||||
P_PredictionLerpReset();
|
||||
}
|
||||
|
||||
|
@ -2671,7 +2671,8 @@ bool P_LerpCalculate(FVector3 from, FVector3 to, FVector3 &result, float scale)
|
|||
result = result + from;
|
||||
FVector3 delta = result - to;
|
||||
|
||||
return (delta.LengthSquared() > cl_predict_lerpthreshold);
|
||||
// As a fail safe, assume extrapolation is the threshold.
|
||||
return (delta.LengthSquared() > cl_predict_lerpthreshold && scale <= 1.00f);
|
||||
}
|
||||
|
||||
void P_PredictPlayer (player_t *player)
|
||||
|
@ -2759,7 +2760,8 @@ void P_PredictPlayer (player_t *player)
|
|||
}
|
||||
act->BlockNode = NULL;
|
||||
|
||||
bool CanLerp = (cl_predict_lerpscale > 0), DoLerp = false, NoInterpolateOld = R_GetViewInterpolationStatus();
|
||||
// Values too small to be usable for lerping can be considered "off".
|
||||
bool CanLerp = !(cl_predict_lerpscale < 0.01f), DoLerp = false, NoInterpolateOld = R_GetViewInterpolationStatus();
|
||||
for (int i = gametic; i < maxtic; ++i)
|
||||
{
|
||||
if (!NoInterpolateOld)
|
||||
|
@ -2779,7 +2781,10 @@ void P_PredictPlayer (player_t *player)
|
|||
|
||||
if (CanLerp)
|
||||
{
|
||||
if (DoLerp)
|
||||
if (NoInterpolateOld)
|
||||
P_PredictionLerpReset();
|
||||
|
||||
else if (DoLerp)
|
||||
{
|
||||
// If lerping is already in effect, use the previous camera postion so the view doesn't suddenly snap
|
||||
PredictionLerpFrom = (PredictionLerptics == 0) ? PredictionLast : PredictionLerpResult;
|
||||
|
|
|
@ -1612,8 +1612,8 @@ OptionMenu NetworkOptions
|
|||
StaticText "Local options", 1
|
||||
Option "Movement prediction", "cl_noprediction", "OffOn"
|
||||
Option "Predict line actions", "cl_predict_specials", "OnOff"
|
||||
Option "Prediction Lerp Scale", "cl_predict_lerpscale", 0.0, 0.5, 0.01
|
||||
Option "Lerp Threshold", "cl_predict_lerpthreshold", 0.1, 16.0, 0.1
|
||||
Slider "Prediction Lerp Scale", "cl_predict_lerpscale", 0.0, 0.5, 0.05
|
||||
Slider "Lerp Threshold", "cl_predict_lerpthreshold", 0.1, 16.0, 0.1
|
||||
StaticText " "
|
||||
StaticText "Host options", 1
|
||||
Option "Extra Tics", "net_extratic", "ExtraTicMode"
|
||||
|
|
Loading…
Reference in a new issue