Run body and fire phases during scripted control locks
This commit is contained in:
1 parent
5876da112c
commit
c285b57091
35 files changed
+1503
-45
No files matched your search
+54
-18
@@ -87,6 +87,7 @@ internal static class Program
|
||||
--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-control-phases Airborne cutscene body/fire and restoration fixture
|
||||
--smoke-objective-panel Show original lab objective; --story-time tests timeout
|
||||
--smoke-objective-window SDL O-key reopen/close/timeout check
|
||||
--debug-menu Start with the F1 debug menu open
|
||||
@@ -251,6 +252,7 @@ internal static class Program
|
||||
var walkSmoke = args.Contains("--smoke-walk");
|
||||
var jetpackSmoke = args.Contains("--smoke-jetpack");
|
||||
var carlSmoke = args.Contains("--smoke-carl-cutscene");
|
||||
var controlPhaseSmoke = args.Contains("--smoke-control-phases");
|
||||
var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
|
||||
var objectiveSmoke = args.Contains("--smoke-objective-panel") || objectiveWindowSmoke;
|
||||
var jumpBinding = Option(args, "--smoke-jump-key") ?? "shift";
|
||||
@@ -268,7 +270,7 @@ internal static class Program
|
||||
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 || practiceReturnSmoke || carlSmoke || objectiveSmoke;
|
||||
|| args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke || practiceReturnSmoke || carlSmoke || controlPhaseSmoke || 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.");
|
||||
@@ -428,7 +430,9 @@ 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" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
||||
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : controlPhaseSmoke ? "32" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
||||
if (controlPhaseSmoke && (level?.Code != "LV1B" || loadedSave != null || frames < 32 || director == null))
|
||||
throw new ArgumentException("Control-phase fixture needs a fresh lab and at least32 frames");
|
||||
if (toolsSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
|
||||
throw new ArgumentException("Debug tools smoke requires a fresh windowed lab and at least16 frames");
|
||||
if (debugSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
|
||||
@@ -450,6 +454,8 @@ internal static class Program
|
||||
var width = uint.Parse(Option(args, "--width") ?? "960");
|
||||
var height = uint.Parse(Option(args, "--height") ?? "720");
|
||||
if (width is < 64 or > 8192 || height is < 64 or > 8192) throw new ArgumentException("Viewport dimensions must be64..8192");
|
||||
using var playerBinding = director == null ? null
|
||||
: new PlayerSceneBinding(director, simulation!, interactions!.Inventory, level!.Player!.Tag!);
|
||||
var renderer = presentation.LoadScene(mesh, texture, headless,
|
||||
walking ? WalkTitle : animations?.WindowTitle ?? "Jimmy Neutron — scene preview | C camera",
|
||||
width, height, !args.Contains("--no-validation"));
|
||||
@@ -490,7 +496,15 @@ internal static class Program
|
||||
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
|
||||
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
||||
}
|
||||
if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||
if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||
if (controlPhaseSmoke)
|
||||
{
|
||||
interactions.Inventory.SetState(0, 3, 1); interactions.Inventory.SelectGadget(3);
|
||||
simulation.ApplyRetainedLevelState(new("LV1B", 3, 1, .625f, 6.125f));
|
||||
simulation.RestoreReturnRoot(simulation.ActorRoot + Vector3.UnitY * 200);
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
director.Trigger("neutron1a");
|
||||
}
|
||||
if (practiceReturnSmoke && level.Code == "VR04")
|
||||
{
|
||||
if (interactions!.Inventory.State(0, 3) != 1)
|
||||
@@ -540,6 +554,8 @@ internal static class Program
|
||||
}
|
||||
for (var tick = 0; tick < (int)Math.Round(storyTime * 60) && !practice.Active && !debugMenu.Open; tick++)
|
||||
{
|
||||
playerBinding!.Step(default);
|
||||
interactions!.UpdateEnergy(simulation!.Energy);
|
||||
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
||||
mechanisms!.Step(FixedStepClock.Step);
|
||||
director.Step(FixedStepClock.Step);
|
||||
@@ -595,6 +611,8 @@ internal static class Program
|
||||
var debugPausedSteps = simulation?.Steps ?? 0;
|
||||
var toolsPaused = false; var toolsMoved = false; var toolsStopped = false; var toolsSaved = false; var toolsSystems = false;
|
||||
var toolsEntry = simulation?.ActorRoot ?? Vector3.Zero;
|
||||
var controlEntry = simulation?.ActorRoot ?? Vector3.Zero;
|
||||
var phasesLocked = false; var phasesResumed = false;
|
||||
void ResetScene()
|
||||
{
|
||||
if (simulation == null) { debugMenu.Message = "RESET REQUIRES PLAY MODE"; return; }
|
||||
@@ -846,28 +864,29 @@ internal static class Program
|
||||
if (debugMenu.Open) animationStarted += elapsed;
|
||||
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke))
|
||||
{
|
||||
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
|
||||
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || controlPhaseSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
|
||||
for (var step = 0; step < steps; step++)
|
||||
{
|
||||
var input = carlSmoke ? new PlayerInput(true, false, true, false, true)
|
||||
var input = carlSmoke || controlPhaseSmoke ? new PlayerInput(true, false, true, false, true)
|
||||
: jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
|
||||
: walkSmoke && headless ? LabSimulation.SmokeInput(simulation.Steps) : new PlayerInput(
|
||||
keys.Contains(82) || simulation.Noclip && keys.Contains(26), keys.Contains(81) || simulation.Noclip && keys.Contains(22), keys.Contains(80), keys.Contains(79),
|
||||
mouseJump || keys.Contains(225) || keys.Contains(229) || keys.Contains(73) || keys.Contains(98),
|
||||
keys.Contains(44) || keys.Contains(8), keys.Contains(224) || keys.Contains(228) || keys.Contains(20),
|
||||
keys.Contains(4), keys.Contains(7), keys.Contains(225) || keys.Contains(229));
|
||||
if (director?.Controlled != false || simulation.Noclip)
|
||||
var before = simulation.Position;
|
||||
var powered = simulation.JetpackEffectVisible && !simulation.Grounded;
|
||||
bool acceptsInput;
|
||||
if (playerBinding != null) acceptsInput = playerBinding.Step(input);
|
||||
else { simulation.Step(input); acceptsInput = true; }
|
||||
if (jetpackSmoke && powered)
|
||||
{
|
||||
poweredAirTravel += Vector2.Distance(new(before.X, before.Z), new(simulation.Position.X, simulation.Position.Z));
|
||||
poweredAirTurn |= MathF.Abs(simulation.TurnRate) > 1;
|
||||
}
|
||||
interactions?.UpdateEnergy(simulation.Energy);
|
||||
if (acceptsInput)
|
||||
{
|
||||
var before = simulation.Position;
|
||||
var powered = simulation.JetpackEffectVisible && !simulation.Grounded;
|
||||
simulation.Step(input);
|
||||
if (jetpackSmoke && powered)
|
||||
{
|
||||
poweredAirTravel += Vector2.Distance(new(before.X, before.Z), new(simulation.Position.X, simulation.Position.Z));
|
||||
poweredAirTurn |= MathF.Abs(simulation.TurnRate) > 1;
|
||||
}
|
||||
interactions?.UpdateEnergy(simulation.Energy);
|
||||
director?.SyncActor(level!.Player!.Tag!, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
if (!simulation.Noclip)
|
||||
{
|
||||
director?.Touch(level!.Player!.Tag!, simulation.ActorRoot);
|
||||
@@ -976,6 +995,16 @@ internal static class Program
|
||||
diagnostics.ObserveFrame(presentedAt - lastPresentedAt);
|
||||
lastPresentedAt = presentedAt;
|
||||
count++;
|
||||
if (controlPhaseSmoke && count == 15)
|
||||
{
|
||||
phasesLocked = director is { Controlled: false, Playing: true }
|
||||
&& simulation is { ControllerSteps: 0, PhysicsSteps: 15, EffectSteps: 15, Jumps: 0, Speed: 0, TurnRate: 0 }
|
||||
&& simulation.ActorRoot.Y < controlEntry.Y && simulation.JetpackRemaining is > 0 and < 6.125f
|
||||
&& simulation.Energy < 20 && Vector2.Distance(new(simulation.ActorRoot.X, simulation.ActorRoot.Z), new(controlEntry.X, controlEntry.Z)) < .001f;
|
||||
director!.Skip();
|
||||
}
|
||||
if (controlPhaseSmoke && count == 30)
|
||||
phasesResumed = director!.Controlled && simulation!.ControllerSteps == 15 && simulation.Travel > 1;
|
||||
audio?.Pump();
|
||||
sceneAudio?.Pump();
|
||||
if (toolsSmoke)
|
||||
@@ -1198,10 +1227,17 @@ internal static class Program
|
||||
}
|
||||
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}.");
|
||||
var locked = director is { Controlled: false, Playing: true, CurrentTag: "neutron1a" }
|
||||
&& simulation is { ControllerSteps: 0, Jumps: 0, Speed: 0, TurnRate: 0 }
|
||||
&& simulation.PhysicsSteps == simulation.Steps && simulation.EffectSteps == simulation.Steps && simulation.Steps >= frames;
|
||||
Console.WriteLine($"Carl cutscene input lock with held move/turn/jump: {locked}; body/fire continue={simulation!.PhysicsSteps}/{simulation.EffectSteps}.");
|
||||
if (!locked) return 2;
|
||||
}
|
||||
if (controlPhaseSmoke)
|
||||
{
|
||||
Console.WriteLine($"Control-phase fixture: locked input with body/fire/energy continuing={phasesLocked}; held-input resumption={phasesResumed}.");
|
||||
if (!phasesLocked || !phasesResumed) return 2;
|
||||
}
|
||||
if (objectiveSmoke) Console.WriteLine($"Objective panel: time={objectivePanel!.Elapsed:F3}, pad={objectivePanel.PadVisible}, content={objectivePanel.ContentVisible}, offset={objectivePanel.YOffset:F3}.");
|
||||
if (objectiveWindowSmoke)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user