Fix lab cutscene control, landing steering, clipping and objective timeout
This commit is contained in:
1 parent
976e677019
commit
ca08c468ba
33 files changed
+871
-64
No files matched your search
+87
-19
@@ -77,6 +77,10 @@ internal static class Program
|
||||
--smoke-practice-transition Headless lab-to-VR04 practice transition
|
||||
--smoke-practice-window SDL practice pause/dismiss/resize check (12 frames)
|
||||
--smoke-jetpack 300-step powered steering/jump check in VR04
|
||||
--smoke-jump-key NAME Replay using shift/right-shift/insert/keypad0/right-mouse
|
||||
--smoke-carl-cutscene Verify input stays locked during the lab conversation
|
||||
--smoke-objective-panel Show original lab objective; --story-time tests timeout
|
||||
--smoke-objective-window SDL O-key reopen/close/timeout check
|
||||
--verify-assets Decode all original PNG/ASE files
|
||||
--smoke-window Test keyboard event/resize (requires --frames 6 or more)
|
||||
--no-validation Disable development validation
|
||||
@@ -211,12 +215,21 @@ internal static class Program
|
||||
var animationPath = Option(args, "--animation");
|
||||
var walkSmoke = args.Contains("--smoke-walk");
|
||||
var jetpackSmoke = args.Contains("--smoke-jetpack");
|
||||
var carlSmoke = args.Contains("--smoke-carl-cutscene");
|
||||
var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
|
||||
var objectiveSmoke = args.Contains("--smoke-objective-panel") || objectiveWindowSmoke;
|
||||
var jumpBinding = Option(args, "--smoke-jump-key") ?? "shift";
|
||||
uint jumpScancode = jumpBinding switch { "shift" => 225, "right-shift" => 229,
|
||||
"insert" => 73, "keypad0" => 98, "right-mouse" => 0,
|
||||
_ => throw new ArgumentException("Unknown jump smoke binding") };
|
||||
if (Option(args, "--smoke-jump-key") != null && !(walkSmoke || jetpackSmoke))
|
||||
throw new ArgumentException("Jump binding smoke option requires a movement smoke mode");
|
||||
var practiceWindowSmoke = args.Contains("--smoke-practice-window");
|
||||
if (walkSmoke && jetpackSmoke) throw new ArgumentException("Select one movement smoke check");
|
||||
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
|
||||
&& animationPath == null && !args.Contains("--time");
|
||||
var story = defaultStory || loadedSave != null || saveOutput != null || args.Contains("--story") || args.Contains("--story-time")
|
||||
|| args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke;
|
||||
|| args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveSmoke;
|
||||
if (story && (args.Contains("--inspect") || walkSmoke || args.Contains("--smoke-window")))
|
||||
throw new ArgumentException("Story playback requires its own simulation mode.");
|
||||
if (walkSmoke && args.Contains("--inspect")) throw new ArgumentException("Walk smoke cannot run in inspection mode.");
|
||||
@@ -239,7 +252,7 @@ internal static class Program
|
||||
SceneHud? hud = null;
|
||||
JetpackVisuals? jetpackVisuals = null;
|
||||
var practice = new PracticePrompt();
|
||||
var objectiveOffset = -69f;
|
||||
ObjectivePanel? objectivePanel = null;
|
||||
var patrols = new Dictionary<string, ActorPatrol>(StringComparer.OrdinalIgnoreCase);
|
||||
LevelTransition? transitionRequest = null;
|
||||
var characterOffset = mesh.Vertices.Length;
|
||||
@@ -268,6 +281,8 @@ internal static class Program
|
||||
var tasks = new TaskStates(save.Tasks);
|
||||
director = new SceneDirector(level!, tasks, resources.Duration);
|
||||
interactions = new SceneInteractions(director, tasks, save, level!.Code);
|
||||
objectivePanel = new ObjectivePanel(interactions.CurrentObjective);
|
||||
interactions.ObjectiveChanged += objectivePanel.Select;
|
||||
simulation!.Energy = interactions.Energy;
|
||||
simulation.JetpackInventoryState = () => interactions.Inventory.State(0, 3);
|
||||
mechanisms = new SceneMechanisms(director);
|
||||
@@ -275,7 +290,7 @@ internal static class Program
|
||||
interactions.PracticeRequested += practice.Show;
|
||||
practice.Chosen += (mode, accepted) =>
|
||||
{
|
||||
if (!accepted) return;
|
||||
if (!accepted) { objectivePanel.Show(); return; }
|
||||
// Player43B5A0 receives current/requested GAM and latest STRT tag
|
||||
// as return context;42AF00's runtime checkpoint is separate.
|
||||
interactions.SetReturnContext(Path.GetFileName(levelPath!), originalStart!.Tag!);
|
||||
@@ -324,7 +339,10 @@ internal static class Program
|
||||
var storyTime = double.Parse(Option(args, "--story-time") ?? "0", System.Globalization.CultureInfo.InvariantCulture);
|
||||
if (!double.IsFinite(storyTime) || storyTime < 0 || storyTime > 3600 || storyTime > 0 && !headless)
|
||||
throw new ArgumentException("Story time must be0..3600 seconds in headless mode.");
|
||||
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : headless ? "1" : "0"));
|
||||
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : headless ? "1" : "0"));
|
||||
if (objectiveWindowSmoke && (headless || frames < 180)) throw new ArgumentException("Objective window smoke needs180 window frames");
|
||||
if ((carlSmoke || objectiveSmoke) && (level?.Code != "LV1B" || loadedSave != null || objectiveSmoke && !headless && !objectiveWindowSmoke))
|
||||
throw new ArgumentException("Lab conversation/objective smoke requires fresh LV1B (objective check is headless)");
|
||||
if (jetpackSmoke && (level?.Code != "VR04" || frames < 300))
|
||||
throw new ArgumentException("Jetpack smoke requires VR04 and at least300 frames");
|
||||
if (walkSmoke && frames < 240) throw new ArgumentException("Walk smoke requires at least 240 frames.");
|
||||
@@ -355,6 +373,7 @@ internal static class Program
|
||||
director.Speech += sceneAudio.Speech;
|
||||
director.MusicStopped += sceneAudio.StopMusic;
|
||||
director.MusicRestarted += sceneAudio.RestartMusic;
|
||||
objectivePanel!.SoundEffect += id => { if (level!.Code == "LV1B") sceneAudio.Effect(id); };
|
||||
interactions!.SoundEffect += id => sceneAudio.Effect(id);
|
||||
mechanisms!.Sound += (actor, id, loop) => sceneAudio.Effect(id, loop ? actor.Tag : null);
|
||||
mechanisms.StopSound += actor => sceneAudio.StopLoop(actor.Tag);
|
||||
@@ -377,6 +396,15 @@ internal static class Program
|
||||
if (transitionRequest?.LevelFile != "level1.gam")
|
||||
throw new InvalidOperationException("Original lab exit did not request level1.gam");
|
||||
}
|
||||
if (carlSmoke) LabRouteSmoke.StartCarl(level!, director, interactions!, () => practice.Key(17, Vector2.Zero));
|
||||
if (objectiveSmoke)
|
||||
{
|
||||
director.Skip();
|
||||
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
||||
director.Skip();
|
||||
if (interactions!.CurrentObjective != 1) throw new InvalidOperationException("Original explanation did not assign objective1");
|
||||
if (objectiveWindowSmoke) objectivePanel!.Step(9);
|
||||
}
|
||||
if (args.Contains("--smoke-practice-prompt") || args.Contains("--smoke-practice-transition") || practiceWindowSmoke)
|
||||
{
|
||||
if ((!headless && !practiceWindowSmoke) || level?.Code != "LV1B") throw new ArgumentException("Practice smoke requires the original lab");
|
||||
@@ -392,6 +420,7 @@ internal static class Program
|
||||
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
||||
mechanisms!.Step(FixedStepClock.Step);
|
||||
director.Step(FixedStepClock.Step);
|
||||
objectivePanel!.Step(FixedStepClock.Step, director.ControlledTag != null, practice.Active);
|
||||
if (animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)) initialPoseTime = 0;
|
||||
initialPoseTime += FixedStepClock.Step;
|
||||
actorVisuals!.Update(FixedStepClock.Step, mesh);
|
||||
@@ -416,6 +445,9 @@ internal static class Program
|
||||
var sawJetpackKeys = 0;
|
||||
float poweredAirTravel = 0;
|
||||
var poweredAirTurn = false;
|
||||
var objectiveWasHidden = false;
|
||||
var objectiveReopened = false;
|
||||
var objectiveClosing = false;
|
||||
var sawPracticeDismiss = false;
|
||||
var sawPracticePause = false;
|
||||
double last = clock.Elapsed.TotalSeconds;
|
||||
@@ -436,10 +468,12 @@ internal static class Program
|
||||
foreach (var (scancode, down, previous) in new[] {
|
||||
(82u, requested.Forward, injectedInput.Forward),
|
||||
(81u, requested.Backward, injectedInput.Backward), (80u, requested.Left, injectedInput.Left),
|
||||
(79u, requested.Right, injectedInput.Right), (225u, requested.Jump, injectedInput.Jump) })
|
||||
(79u, requested.Right, injectedInput.Right), (jumpScancode, requested.Jump, injectedInput.Jump) })
|
||||
{
|
||||
if (down == previous) continue;
|
||||
var injected = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = scancode, Down = down ? (byte)1 : (byte)0 };
|
||||
var injected = scancode == 0
|
||||
? new Sdl.Event { Type = down ? Sdl.MouseButtonDown : Sdl.MouseButtonUp, MouseButton = 3 }
|
||||
: new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = scancode, Down = down ? (byte)1 : (byte)0 };
|
||||
if (!Sdl.SDL_PushEvent(ref injected)) throw new InvalidOperationException(Sdl.Error);
|
||||
}
|
||||
injectedInput = requested;
|
||||
@@ -460,19 +494,21 @@ internal static class Program
|
||||
if (practiceWindowSmoke && e.Scancode == 17 && !practice.Active) sawPracticeDismiss = true;
|
||||
keys.Clear(); mouseJump = false; stepClock.Reset(); continue;
|
||||
}
|
||||
if (e.Type == Sdl.MouseButtonDown && e.MouseButton == 3) mouseJump = true;
|
||||
if (e.Type == Sdl.MouseButtonDown && e.MouseButton == 3)
|
||||
{
|
||||
mouseJump = true;
|
||||
if (jumpScancode == 0) { if (jetpackSmoke) sawJetpackKeys |= 8; if (walkSmoke) sawWalkKeys |= 4; }
|
||||
}
|
||||
if (e.Type == Sdl.MouseButtonUp && e.MouseButton == 3) mouseJump = false;
|
||||
if (e.Type == Sdl.KeyDown)
|
||||
{
|
||||
keys.Add(e.Scancode);
|
||||
if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == 225 ? 4 : 0;
|
||||
if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == 225 ? 8 : 0;
|
||||
if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == jumpScancode ? 4 : 0;
|
||||
if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == jumpScancode ? 8 : 0;
|
||||
if (smoke && e.Scancode == 79) sawKey = true;
|
||||
if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false })
|
||||
{ sceneAudio?.StopSpeech(); director.Skip(); keys.Clear(); mouseJump = false; }
|
||||
else if (e.Scancode == 41) running = false;
|
||||
if (e.Scancode == 18 && e.Repeat == 0 && director is { Controlled: true, InventoryEnabled: true })
|
||||
objectiveOffset = objectiveOffset == -69 ? 0 : -69;
|
||||
if (inspecting && e.Repeat == 0 && animations?.Select(e.Scancode) == true)
|
||||
{
|
||||
animationStarted = clock.Elapsed.TotalSeconds;
|
||||
@@ -510,12 +546,13 @@ internal static class Program
|
||||
var elapsed = now - last;
|
||||
var dt = (float)Math.Min(elapsed, 0.1);
|
||||
last = now;
|
||||
if (simulation != null && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke))
|
||||
if (simulation != null && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke))
|
||||
{
|
||||
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke ? 1 : stepClock.Advance(elapsed);
|
||||
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke ? 1 : stepClock.Advance(elapsed);
|
||||
for (var step = 0; step < steps; step++)
|
||||
{
|
||||
var input = jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
|
||||
var input = carlSmoke ? new PlayerInput(true, false, true, false, true)
|
||||
: jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
|
||||
: walkSmoke && headless ? LabSimulation.SmokeInput(simulation.Steps) : new PlayerInput(
|
||||
keys.Contains(82), keys.Contains(81), keys.Contains(80), keys.Contains(79),
|
||||
mouseJump || keys.Contains(225) || keys.Contains(229) || keys.Contains(73) || keys.Contains(98));
|
||||
@@ -539,6 +576,8 @@ internal static class Program
|
||||
mechanisms?.Step(FixedStepClock.Step);
|
||||
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
||||
director?.Step(FixedStepClock.Step);
|
||||
objectivePanel?.Key(keys.Contains(18) && director is { Controlled: true, InventoryEnabled: true });
|
||||
objectivePanel?.Step(FixedStepClock.Step, director?.ControlledTag != null, practice.Active);
|
||||
var switched = director is { Controlled: false }
|
||||
? animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)
|
||||
: animations!.SelectPose(simulation.Pose);
|
||||
@@ -579,10 +618,13 @@ internal static class Program
|
||||
staticVisuals?.Update(mesh);
|
||||
jetpackVisuals?.Update(mesh, simulation!);
|
||||
spriteVisuals?.FaceCamera(renderEye, renderTarget, mesh);
|
||||
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && director!.Controlled, practice.Active, objectiveOffset);
|
||||
var far = level?.Code == "LV1B" ? 10000 : 3200;
|
||||
objectivePanel?.Key(keys.Contains(18) && !inspecting && !practice.Active
|
||||
&& director is { Controlled: true, InventoryEnabled: true });
|
||||
objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
|
||||
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible,
|
||||
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible);
|
||||
var projection = originalCamera || simulation != null && !inspecting
|
||||
? Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(0xAAA / 16384f * MathF.Tau, (float)renderer.Width / renderer.Height, 20, far)
|
||||
? SceneProjection.CreateGameplay(level?.Code, (float)renderer.Width / renderer.Height)
|
||||
: Matrix4x4.CreatePerspectiveFieldOfView(MathF.PI / 3, (float)renderer.Width / renderer.Height, Math.Max(radius / 10000, 0.01f), radius * 20);
|
||||
projection.M22 *= -1;
|
||||
if (animations != null)
|
||||
@@ -596,6 +638,19 @@ internal static class Program
|
||||
count++;
|
||||
audio?.Pump();
|
||||
sceneAudio?.Pump();
|
||||
if (objectiveWindowSmoke)
|
||||
{
|
||||
if (count == 1) objectiveWasHidden = !objectivePanel!.PadVisible;
|
||||
if (count == 60) objectiveReopened = objectivePanel!.ContentVisible;
|
||||
if (count == 61) objectiveClosing = objectivePanel!.PadVisible && !objectivePanel.ContentVisible;
|
||||
if (count is 1 or 2 or 60 or 61)
|
||||
{
|
||||
var down = count is 1 or 60;
|
||||
var key = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = 18, Down = down ? (byte)1 : (byte)0 };
|
||||
if (!Sdl.SDL_PushEvent(ref key)) throw new InvalidOperationException(Sdl.Error);
|
||||
}
|
||||
if (count == 1 && !Sdl.SDL_SetWindowSize(window, 800, 600)) throw new InvalidOperationException(Sdl.Error);
|
||||
}
|
||||
if (practiceWindowSmoke && count == 1)
|
||||
{
|
||||
sawPracticePause = practice.Active && simulation!.Steps == 0;
|
||||
@@ -616,7 +671,7 @@ internal static class Program
|
||||
if (!Sdl.SDL_PushEvent(ref cycle)) throw new InvalidOperationException(Sdl.Error);
|
||||
}
|
||||
}
|
||||
if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
|
||||
if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
|
||||
if (frames > 0 && count >= frames) break;
|
||||
if (transitionRequest != null) break;
|
||||
}
|
||||
@@ -631,11 +686,24 @@ internal static class Program
|
||||
if (Math.Abs(pixels[i] - 31) + Math.Abs(pixels[i + 1] - 51) + Math.Abs(pixels[i + 2] - 76) > 6) changed++;
|
||||
Console.WriteLine($"Rendered {count} frame(s), {changed} non-background pixels, {renderer.ValidationErrors} Vulkan validation error(s).");
|
||||
if (simulation != null) Console.WriteLine(simulation.Report);
|
||||
if (carlSmoke)
|
||||
{
|
||||
var locked = director is { Controlled: false, Playing: true, CurrentTag: "neutron1a" } && simulation!.Steps == 0;
|
||||
Console.WriteLine($"Carl cutscene input lock with held move/turn/jump: {locked}.");
|
||||
if (!locked) return 2;
|
||||
}
|
||||
if (objectiveSmoke) Console.WriteLine($"Objective panel: time={objectivePanel!.Elapsed:F3}, pad={objectivePanel.PadVisible}, content={objectivePanel.ContentVisible}, offset={objectivePanel.YOffset:F3}.");
|
||||
if (objectiveWindowSmoke)
|
||||
{
|
||||
var timedOut = !objectivePanel!.PadVisible;
|
||||
Console.WriteLine($"Objective SDL check: hidden={objectiveWasHidden}, O reopened={objectiveReopened}, O closed={objectiveClosing}, timed out={timedOut}, resize800x600={didResize}.");
|
||||
if (!objectiveWasHidden || !objectiveReopened || !objectiveClosing || !timedOut || !didResize) return 2;
|
||||
}
|
||||
if (jetpackSmoke)
|
||||
{
|
||||
Console.WriteLine($"Powered jump: bursts={simulation!.Bursts}, remaining={simulation.JetpackRemaining:F3}, energy={simulation.Energy:F3}, grounded={simulation.Grounded}.");
|
||||
Console.WriteLine($"Powered air steering: travel={poweredAirTravel:F2}, turned={poweredAirTurn}.");
|
||||
if (!headless) Console.WriteLine($"Jetpack SDL keys received={sawJetpackKeys == 15}, resize800x600={didResize}.");
|
||||
if (!headless) Console.WriteLine($"Jetpack SDL keys received={sawJetpackKeys == 15}, resize800x600={didResize}, jump={jumpBinding}.");
|
||||
if (simulation.Bursts == 0 || simulation.MaximumRise <= 137.62f || !simulation.Grounded
|
||||
|| poweredAirTravel <= 20 || !poweredAirTurn || !headless && (sawJetpackKeys != 15 || !didResize)) return 2;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user