record demos as packets

This commit is contained in:
2023-05-21 00:48:03 +03:00
parent 3a59bad850
commit 280be62caa
10 changed files with 579 additions and 255 deletions

View File

@@ -27,9 +27,11 @@ namespace Game
public override bool Predict => true;
public PlayerInputLocal(PlayerActor playerActor, string demoPath)
public PlayerInputLocal(PlayerActor playerActor, string demoPath = null)
{
this.playerActor = playerActor;
if (demoPath == null)
return;
var demoFolder = Directory.GetParent(demoPath);
if (!demoFolder.Exists)
Directory.CreateDirectory(demoFolder.FullName);
@@ -72,6 +74,7 @@ namespace Game
public override void OnEndFrame()
{
currentState.input.frame = frame;
if (IsRecording)
{
currentState.input.verificationPosition = currentState.actor.position;
@@ -79,7 +82,6 @@ namespace Game
currentState.input.verificationViewAngles = currentState.actor.viewAngles;
currentState.input.verificationOrientation = currentState.actor.orientation;
currentState.input.frame = frame;
buffer.Add(currentState.input);
}
@@ -111,14 +113,6 @@ namespace Game
currentState.input.viewDeltaY = 0;
}
public override void RecordCurrentActorState(PlayerActorState actorState)
{
if (!IsRecording)
return;
base.RecordCurrentActorState(actorState);
}
public void FlushDemo()
{
if (!IsRecording)