@@ -101,9 +101,9 @@ static FRandom pr_skullpop ("SkullPop");
101
101
CVAR (Bool, sv_singleplayerrespawn, false , CVAR_SERVERINFO | CVAR_CHEAT)
102
102
103
103
// Variables for prediction
104
- CVAR (Bool, cl_noprediction, false , CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
105
104
CVAR(Bool, cl_predict_specials, true , CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
106
105
// Deprecated
106
+ CVAR(Bool, cl_noprediction, false , CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
107
107
CVAR(Float, cl_predict_lerpscale, 0 .05f , CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
108
108
CVAR(Float, cl_predict_lerpthreshold, 2 .00f , CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
109
109
@@ -124,6 +124,11 @@ CUSTOM_CVAR(Float, cl_rubberband_minmove, 20.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFI
124
124
if (self < 0 .1f )
125
125
self = 0 .1f ;
126
126
}
127
+ CUSTOM_CVAR (Float, cl_rubberband_limit, 756 .0f , CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
128
+ {
129
+ if (self < 0 .0f )
130
+ self = 0 .0f ;
131
+ }
127
132
128
133
ColorSetList ColorSets;
129
134
PainFlashList PainFlashes;
@@ -353,6 +358,7 @@ void player_t::CopyFrom(player_t &p, bool copyPSP)
353
358
MUSINFOactor = p.MUSINFOactor ;
354
359
MUSINFOtics = p.MUSINFOtics ;
355
360
SoundClass = p.SoundClass ;
361
+ angleOffsetTargets = p.angleOffsetTargets ;
356
362
if (copyPSP)
357
363
{
358
364
// This needs to transfer ownership completely.
@@ -1422,8 +1428,7 @@ void P_PredictPlayer (player_t *player)
1422
1428
{
1423
1429
int maxtic;
1424
1430
1425
- if (cl_noprediction ||
1426
- singletics ||
1431
+ if (singletics ||
1427
1432
demoplayback ||
1428
1433
player->mo == NULL ||
1429
1434
player != player->mo ->Level ->GetConsolePlayer () ||
@@ -1497,7 +1502,7 @@ void P_PredictPlayer (player_t *player)
1497
1502
1498
1503
// This essentially acts like a mini P_Ticker where only the stuff relevant to the client is actually
1499
1504
// called. Call order is preserved.
1500
- bool rubberband = false ;
1505
+ bool rubberband = false , rubberbandLimit = false ;
1501
1506
DVector3 rubberbandPos = {};
1502
1507
const bool canRubberband = LastPredictedTic >= 0 && cl_rubberband_scale > 0 .0f && cl_rubberband_scale < 1 .0f ;
1503
1508
const double rubberbandThreshold = max<float >(cl_rubberband_minmove, cl_rubberband_threshold);
@@ -1521,9 +1526,11 @@ void P_PredictPlayer (player_t *player)
1521
1526
{
1522
1527
rubberband = true ;
1523
1528
rubberbandPos = player->mo ->Pos ();
1529
+ rubberbandLimit = cl_rubberband_limit > 0 .0f && dist > cl_rubberband_limit * cl_rubberband_limit;
1524
1530
}
1525
1531
}
1526
1532
1533
+ player->oldbuttons = player->cmd .ucmd .buttons ;
1527
1534
player->cmd = localcmds[i % LOCALCMDTICS];
1528
1535
player->mo ->ClearInterpolation ();
1529
1536
player->mo ->ClearFOVInterpolation ();
@@ -1533,21 +1540,29 @@ void P_PredictPlayer (player_t *player)
1533
1540
1534
1541
if (rubberband)
1535
1542
{
1536
- R_ClearInterpolationPath ();
1537
- player->mo ->renderflags &= ~RF_NOINTERPOLATEVIEW;
1538
-
1539
1543
DPrintf (DMSG_NOTIFY, " Prediction mismatch at (%.3f, %.3f, %.3f)\n Expected: (%.3f, %.3f, %.3f)\n Correcting to (%.3f, %.3f, %.3f)\n " ,
1540
1544
LastPredictedPosition.X , LastPredictedPosition.Y , LastPredictedPosition.Z ,
1541
1545
rubberbandPos.X , rubberbandPos.Y , rubberbandPos.Z ,
1542
1546
player->mo ->X (), player->mo ->Y (), player->mo ->Z ());
1543
1547
1544
- DVector3 snapPos = {};
1545
- P_LerpCalculate (player->mo , LastPredictedPosition, snapPos, cl_rubberband_scale, cl_rubberband_threshold, cl_rubberband_minmove);
1546
- player->mo ->PrevPortalGroup = LastPredictedPortalGroup;
1547
- player->mo ->Prev = LastPredictedPosition;
1548
- const double zOfs = player->viewz - player->mo ->Z ();
1549
- player->mo ->SetXYZ (snapPos);
1550
- player->viewz = snapPos.Z + zOfs;
1548
+ if (rubberbandLimit)
1549
+ {
1550
+ // If too far away, instantly snap the player's view to their correct position.
1551
+ player->mo ->renderflags |= RF_NOINTERPOLATEVIEW;
1552
+ }
1553
+ else
1554
+ {
1555
+ R_ClearInterpolationPath ();
1556
+ player->mo ->renderflags &= ~RF_NOINTERPOLATEVIEW;
1557
+
1558
+ DVector3 snapPos = {};
1559
+ P_LerpCalculate (player->mo , LastPredictedPosition, snapPos, cl_rubberband_scale, cl_rubberband_threshold, cl_rubberband_minmove);
1560
+ player->mo ->PrevPortalGroup = LastPredictedPortalGroup;
1561
+ player->mo ->Prev = LastPredictedPosition;
1562
+ const double zOfs = player->viewz - player->mo ->Z ();
1563
+ player->mo ->SetXYZ (snapPos);
1564
+ player->viewz = snapPos.Z + zOfs;
1565
+ }
1551
1566
}
1552
1567
1553
1568
// This is intentionally done after rubberbanding starts since it'll automatically smooth itself towards
0 commit comments