Recover retained route state and complete PostLoad availability tails
This commit is contained in:
1 parent
1dddfefc68
commit
9ad5a8ef6b
36 files changed
+1559
-32
No files matched your search
+33
-9
@@ -17,13 +17,15 @@ internal static class Program
|
||||
{
|
||||
using var presentation = new RenderSession();
|
||||
OriginalSave? carriedSave = null;
|
||||
PlayerLevelState? carriedPlayer = null;
|
||||
var returning = false;
|
||||
var diagnostics = new DebugDiagnostics { Enabled = args.Contains("--debug-overlay") };
|
||||
while (true)
|
||||
{
|
||||
var result = Run(args, carriedSave, returning, diagnostics, presentation, out var continuation);
|
||||
var result = Run(args, carriedSave, carriedPlayer, returning, diagnostics, presentation, out var continuation);
|
||||
if (result != 0 || continuation == null) return result;
|
||||
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
||||
carriedPlayer = continuation.Player;
|
||||
}
|
||||
}
|
||||
catch (Exception error) { Console.Error.WriteLine(error); return 1; }
|
||||
@@ -38,9 +40,9 @@ internal static class Program
|
||||
return args[i + 1];
|
||||
}
|
||||
|
||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning);
|
||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning, PlayerLevelState? Player);
|
||||
|
||||
private static int Run(string[] args, OriginalSave? carriedSave, bool returning, DebugDiagnostics diagnostics,
|
||||
private static int Run(string[] args, OriginalSave? carriedSave, PlayerLevelState? carriedPlayer, bool returning, DebugDiagnostics diagnostics,
|
||||
RenderSession presentation, out SceneContinuation? continuation)
|
||||
{
|
||||
continuation = null;
|
||||
@@ -160,17 +162,23 @@ internal static class Program
|
||||
if (Option(args, "--effects-audio-smoke") is { } effectsManifest)
|
||||
{
|
||||
using var mixer = new SceneAudio(new PreparedEntityResources(effectsManifest));
|
||||
// Start transport only after both streams exist, so slow stream
|
||||
// creation cannot consume the entire baseline before it is sampled.
|
||||
mixer.SetPaused(true);
|
||||
mixer.Effect(59, "bars"); mixer.Effect(58);
|
||||
var before = mixer.QueuedEffectBytes;
|
||||
Thread.Sleep(200);
|
||||
var consumed = mixer.QueuedEffectBytes < before;
|
||||
mixer.SetPaused(false);
|
||||
var consumptionClock = Stopwatch.StartNew();
|
||||
while (mixer.QueuedEffectBytes >= before && consumptionClock.ElapsedMilliseconds < 3000) Thread.Sleep(20);
|
||||
var after = mixer.QueuedEffectBytes;
|
||||
var consumed = before > 0 && after < before;
|
||||
mixer.Pump();
|
||||
mixer.StopLoop("bars");
|
||||
var stopped = mixer.LoopCount == 0 && mixer.EffectCount == 1;
|
||||
mixer.Effect(230);
|
||||
var mixed = mixer.EffectCount == 2;
|
||||
mixer.StopEffects();
|
||||
Console.WriteLine($"Original effects: consumed={consumed}, loop stopped={stopped}, independent one-shots={mixed}, cleared={mixer.QueuedEffectBytes == 0}.");
|
||||
Console.WriteLine($"Original effects: consumed={consumed}, loop stopped={stopped}, independent one-shots={mixed}, cleared={mixer.QueuedEffectBytes == 0}; baseline={before}, after={after}.");
|
||||
return consumed && stopped && mixed && mixer.QueuedEffectBytes == 0 ? 0 : 2;
|
||||
}
|
||||
if (Option(args, "--scene-audio-smoke") is { } sceneAudioManifest)
|
||||
@@ -316,6 +324,16 @@ internal static class Program
|
||||
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation.Y,
|
||||
cameraRay == null ? null : (look, eye) => cameraRay.Trace(look, eye))
|
||||
{ LevelCode = level.Code, InputAfterPlayerUpdate = carriedSave != null };
|
||||
if (carriedPlayer != null)
|
||||
{
|
||||
var applied = simulation.ApplyRetainedLevelState(carriedPlayer);
|
||||
if (applied)
|
||||
Console.WriteLine($"Retained player scalars: mode={simulation.MovementMode}, hold={simulation.JumpHoldSeconds}, fire={simulation.JetpackRemaining}; jump={simulation.JumpState}, velocity={simulation.Velocity}, speed={simulation.Speed}.");
|
||||
if (practiceReturnSmoke && (!applied || simulation.MovementMode != carriedPlayer.MovementMode
|
||||
|| simulation.JumpHoldSeconds != carriedPlayer.HoldSeconds || simulation.JetpackRemaining != carriedPlayer.EffectRemaining
|
||||
|| simulation.JumpState != 0 || simulation.Speed != 0 || simulation.Velocity != Vector3.Zero || simulation.PendingImpulse != Vector3.Zero))
|
||||
throw new InvalidOperationException("Retained route scalar/body reset boundary changed");
|
||||
}
|
||||
}
|
||||
if (walking && returning) simulation!.RestoreReturnRoot(returnRoot);
|
||||
var placement = PreviewCharacterPlacement.Create(mesh, standingPose, originalStart.Position, originalStart.Rotation.Y);
|
||||
@@ -475,8 +493,8 @@ internal static class Program
|
||||
if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||
if (practiceReturnSmoke && level.Code == "VR04")
|
||||
{
|
||||
if (interactions!.Inventory.State(0, 3) != 4)
|
||||
throw new InvalidOperationException("Tutorial PostLoad did not disable the owned gadget before VR04's bypass");
|
||||
if (interactions!.Inventory.State(0, 3) != 1)
|
||||
throw new InvalidOperationException("VR04 PostLoad tail did not re-enable its owned practice jetpack");
|
||||
director.Skip();
|
||||
interactions!.Update(level.Entities.First(e => e.Kind == "LOAD").Position);
|
||||
if (transitionRequest is not { Returning: true }) throw new InvalidOperationException("VR04 exit did not preserve RETURN identity");
|
||||
@@ -1237,8 +1255,14 @@ internal static class Program
|
||||
nextArgs.AddRange(["--scene", nextScene, "--level", "gam/" + transitionRequest.LevelFile,
|
||||
"--start", transitionRequest.StartPoint]);
|
||||
if (toolsSmoke) nextArgs.AddRange(["--frames", "2"]);
|
||||
// Deliberate test sentinels after the last departure tick: the
|
||||
// destination assertion observes loader state, before grounding
|
||||
// or controller/fire callbacks can legitimately change it.
|
||||
if (practiceReturnSmoke && simulation != null)
|
||||
simulation.ApplyRetainedLevelState(new(level!.Code, 3, 1, .625f, 6.125f));
|
||||
continuation = new(nextArgs.ToArray(), (debugCheckpointToLoad ?? interactions!.Snapshot()) with {
|
||||
StartPoint = transitionRequest.StartPoint, StoredVector = debugCheckpointToLoad?.StoredVector ?? returnRoot }, transitionRequest.Returning);
|
||||
StartPoint = transitionRequest.StartPoint, StoredVector = debugCheckpointToLoad?.StoredVector ?? returnRoot }, transitionRequest.Returning,
|
||||
debugCheckpointToLoad == null ? simulation?.CaptureLevelState(interactions!.Inventory.SelectedGadget) : null);
|
||||
Console.WriteLine($"Loading original destination: {transitionRequest.LevelFile}, start={transitionRequest.StartPoint}; fade behavior remains unreconstructed.");
|
||||
}
|
||||
if (walkSmoke && !simulation!.SmokePassed) return 2;
|
||||
|
||||
Reference in new issue
Block a user