Added RNG snapshotting for predicting
Allows RNG seeds to be played back in a predictive way paving the road for predictive behaviors that rely on RNG.
This commit is contained in:
parent
597b06ae52
commit
a1a4a97dcd
4 changed files with 26 additions and 4 deletions
|
|
@ -144,6 +144,8 @@ static DVector3 LastPredictedPosition;
|
|||
static int LastPredictedPortalGroup;
|
||||
static int LastPredictedTic;
|
||||
|
||||
static TArray<FRandom> PredictionRNG;
|
||||
|
||||
static player_t PredictionPlayerBackup;
|
||||
static AActor *PredictionActor;
|
||||
static TArray<uint8_t> PredictionActorBackupArray;
|
||||
|
|
@ -1461,6 +1463,8 @@ void P_PredictPlayer (player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
FRandom::SaveRNGState(PredictionRNG);
|
||||
|
||||
// Save original values for restoration later
|
||||
PredictionPlayerBackup.CopyFrom(*player, false);
|
||||
|
||||
|
|
@ -1600,6 +1604,8 @@ void P_UnPredictPlayer ()
|
|||
// Q: Can this happen? If yes, can we continue?
|
||||
}
|
||||
|
||||
FRandom::RestoreRNGState(PredictionRNG);
|
||||
|
||||
AActor *savedcamera = player->camera;
|
||||
|
||||
auto &actInvSel = act->PointerVar<AActor*>(NAME_InvSel);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue