Expand debug system pages and add noclip exploration
This commit is contained in:
1 parent
b915a2c2e4
commit
d7838980fd
20 files changed
+628
-47
No files matched your search
+195
-19
@@ -88,6 +88,9 @@ internal static class Program
|
||||
--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
|
||||
--debug-page NAME Open general, player or systems debug page
|
||||
--noclip Start modern debug flight (F3 toggles)
|
||||
--smoke-debug-tools SDL pages/noclip/audio/checkpoint check
|
||||
--debug-overlay Start with live F2 diagnostics visible
|
||||
--smoke-debug-menu SDL debug navigation/pause/actions/resize check
|
||||
--smoke-debug-overlay SDL live diagnostics/input/menu/resize check
|
||||
@@ -251,6 +254,7 @@ internal static class Program
|
||||
var practiceWindowSmoke = args.Contains("--smoke-practice-window");
|
||||
var practiceReturnSmoke = args.Contains("--smoke-practice-return");
|
||||
var debugSmoke = args.Contains("--smoke-debug-menu");
|
||||
var toolsSmoke = args.Contains("--smoke-debug-tools");
|
||||
var diagnosticsSmoke = args.Contains("--smoke-debug-overlay");
|
||||
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")
|
||||
@@ -283,6 +287,10 @@ internal static class Program
|
||||
ObjectivePanel? objectivePanel = null;
|
||||
var patrols = new Dictionary<string, ActorPatrol>(StringComparer.OrdinalIgnoreCase);
|
||||
LevelTransition? transitionRequest = null;
|
||||
OriginalSave? debugCheckpointToLoad = null;
|
||||
OriginalCameraRay? debugCameraRay = null;
|
||||
var debugCheckpointFile = toolsSmoke ? Path.GetFullPath("artifacts/debug-expansion/checkpoint.tsk")
|
||||
: Path.Combine(AppContext.BaseDirectory, "debug-checkpoint.tsk");
|
||||
Vector3 returnRoot = loadedSave?.StoredVector ?? Vector3.Zero;
|
||||
void RequestTransition(LevelTransition request)
|
||||
{
|
||||
@@ -304,6 +312,7 @@ internal static class Program
|
||||
{
|
||||
var cameraRay = level!.Code is "LV1B" or "VR04" or "LEV1"
|
||||
? OriginalCameraRay.FromRouteScene(world, level.Code) : null;
|
||||
debugCameraRay = cameraRay;
|
||||
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 };
|
||||
@@ -378,6 +387,14 @@ internal static class Program
|
||||
? DebugMenu.AvailableScenes(root, Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scene)!, ".."))) : [],
|
||||
Path.GetFileName(levelPath), originalStart?.Tag);
|
||||
if (args.Contains("--debug-menu")) debugMenu.Toggle(storyTasks?.Get("SCENE") ?? 0);
|
||||
if (Option(args, "--debug-page") is { } debugPage)
|
||||
{
|
||||
var page = debugPage.ToLowerInvariant() switch { "general" => 0, "player" => 1, "systems" => 2,
|
||||
_ => throw new ArgumentException("Debug page must be general, player or systems") };
|
||||
if (!debugMenu.Open) debugMenu.Toggle(storyTasks?.Get("SCENE") ?? 0);
|
||||
for (var i = 0; i < page; i++) debugMenu.Key(43);
|
||||
}
|
||||
if (args.Contains("--noclip") && simulation != null) simulation.SetNoclip(true);
|
||||
var debugOverlay = new DebugMenuOverlay(mesh);
|
||||
mesh = debugOverlay.Mesh;
|
||||
Console.WriteLine($"Loaded original geometry and overlays: {mesh.Vertices.Length} vertices, {mesh.Indices.Length / 3} triangles, {mesh.Textures.Count + (scene == null ? 1 : 0)} textures.");
|
||||
@@ -393,7 +410,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" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
||||
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
||||
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))
|
||||
throw new ArgumentException("Debug SDL smoke requires fresh windowed LV1B, closed debug menu and at least16 frames");
|
||||
if (diagnosticsSmoke && (headless || frames < 24 || director == null || level?.Code != "LV1B" || loadedSave != null
|
||||
@@ -453,7 +472,7 @@ 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) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||
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)
|
||||
@@ -556,6 +575,8 @@ internal static class Program
|
||||
var diagnosticsInitialTravel = simulation?.Travel ?? 0;
|
||||
var debugPausedRoot = simulation?.ActorRoot ?? Vector3.Zero;
|
||||
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;
|
||||
void ResetScene()
|
||||
{
|
||||
if (simulation == null) { debugMenu.Message = "RESET REQUIRES PLAY MODE"; return; }
|
||||
@@ -612,10 +633,86 @@ internal static class Program
|
||||
case DebugAction.ToggleOverlay:
|
||||
diagnostics.Enabled = !diagnostics.Enabled;
|
||||
debugMenu.Message = $"LIVE OVERLAY {diagnostics.Enabled}; F2 TOGGLE DURING PLAY"; break;
|
||||
case DebugAction.Noclip when simulation != null:
|
||||
if (inspecting) ToggleCamera();
|
||||
var returnedToEntry = simulation.SetNoclip(!simulation.Noclip);
|
||||
SyncDebugPlayer();
|
||||
debugMenu.Message = returnedToEntry ? "NOCLIP OFF; INSIDE TERRAIN, RESTORED ENTRY POSITION"
|
||||
: $"NOCLIP {simulation.Noclip}; F3 TOGGLE, CLOSE MENU TO MOVE";
|
||||
break;
|
||||
case DebugAction.NoclipSpeed when simulation != null:
|
||||
simulation.NoclipSpeed = debugMenu.FlySpeed; debugMenu.Message = "FLY SPEED APPLIED"; break;
|
||||
case DebugAction.StopMotion when simulation != null:
|
||||
simulation.StopDebugMotion(); debugMenu.Message = "MOTION AND QUEUED JUMP CLEARED"; break;
|
||||
case DebugAction.ReturnNoclipEntry when simulation != null:
|
||||
debugMenu.Message = simulation.ReturnToNoclipEntry() ? "RESTORED NOCLIP ENTRY POSITION" : "ENABLE NOCLIP FIRST";
|
||||
SyncDebugPlayer(); break;
|
||||
case DebugAction.ShowObjective when objectivePanel != null:
|
||||
objectivePanel.Show(); debugMenu.Message = "OBJECTIVE TIMER REOPENED"; break;
|
||||
case DebugAction.LevelAvailability when interactions != null:
|
||||
interactions.Inventory.ApplyLevelAvailability(level!.Code); debugMenu.Message = "SOURCE LEVEL AVAILABILITY APPLIED"; break;
|
||||
case DebugAction.InputOrder when simulation != null:
|
||||
simulation.InputAfterPlayerUpdate = !simulation.InputAfterPlayerUpdate;
|
||||
debugMenu.Message = "DEBUG INPUT ORDER TOGGLED; NEW LEVEL RESTORES SOURCE POLICY"; break;
|
||||
case DebugAction.ApplyJetpackState when interactions != null:
|
||||
interactions.Inventory.SetState(0, 3, debugMenu.JetpackState); debugMenu.Message = "JET PACK AVAILABILITY APPLIED"; break;
|
||||
case DebugAction.CameraObstruction when debugCameraRay != null:
|
||||
debugCameraRay.Enabled = !debugCameraRay.Enabled; debugMenu.Message = "STATIC CAMERA QUERY TOGGLED"; break;
|
||||
case DebugAction.MuteMusic or DebugAction.MuteSpeech or DebugAction.MuteEffects when sceneAudio != null:
|
||||
sceneAudio.SetDebugMute(sceneAudio.MusicMuted ^ (action == DebugAction.MuteMusic),
|
||||
sceneAudio.SpeechMuted ^ (action == DebugAction.MuteSpeech), sceneAudio.EffectsMuted ^ (action == DebugAction.MuteEffects));
|
||||
debugMenu.Message = "AUDIO MUTE UPDATED; PLAYBACK CLOCK CONTINUES"; break;
|
||||
case DebugAction.RestartMusic when sceneAudio != null:
|
||||
sceneAudio.RestartMusic(); debugMenu.Message = "SELECTED MUSIC RESTARTED"; break;
|
||||
case DebugAction.StopEffects when sceneAudio != null:
|
||||
sceneAudio.StopEffects(); debugMenu.Message = "ALL EFFECTS AND LOOPS STOPPED"; break;
|
||||
case DebugAction.Practice when interactions != null:
|
||||
practice.Show(0); debugMenu.Close(); break;
|
||||
case DebugAction.SaveCheckpoint when interactions != null:
|
||||
try
|
||||
{
|
||||
var debugSnapshot = interactions.Snapshot() with { LevelCode = level!.Code, StartPoint = originalStart!.Tag!, StoredVector = returnRoot };
|
||||
var temporaryCheckpoint = debugCheckpointFile + ".tmp";
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(debugCheckpointFile)!);
|
||||
File.WriteAllBytes(temporaryCheckpoint, debugSnapshot.Encode()); File.Move(temporaryCheckpoint, debugCheckpointFile, true);
|
||||
debugMenu.Message = "SAVED LEVEL/START/PROGRESSION; NOT LIVE POSITION";
|
||||
}
|
||||
catch (Exception error) when (error is IOException or UnauthorizedAccessException)
|
||||
{ debugMenu.Message = "CHECKPOINT WRITE FAILED: " + error.Message; }
|
||||
break;
|
||||
case DebugAction.LoadCheckpoint when interactions != null:
|
||||
try
|
||||
{
|
||||
var debugSave = OriginalSave.Load(debugCheckpointFile);
|
||||
var savedScene = debugMenu.FindScene(debugSave.LevelCode);
|
||||
if (savedScene == null) { debugMenu.Message = "CHECKPOINT LEVEL GEOMETRY UNAVAILABLE"; break; }
|
||||
var savedStart = GamLevel.Load(AssetPath.Resolve(root, "gam/" + savedScene.LevelFile))
|
||||
.FindStart(debugSave.StartPoint.Equals("none", StringComparison.OrdinalIgnoreCase) ? null : debugSave.StartPoint);
|
||||
if (savedStart == null) { debugMenu.Message = "CHECKPOINT START UNAVAILABLE"; break; }
|
||||
var savedWorld = Mesh.LoadSceneJson(AssetPath.Resolve(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scene!)!, "..")),
|
||||
Path.GetFileNameWithoutExtension(savedScene.LevelFile) + "/scene.json"));
|
||||
if (new SceneCollision(savedWorld).GroundHeight(savedStart.Position, 2500) == null)
|
||||
{ debugMenu.Message = "CHECKPOINT START HAS NO SUPPORTED FLOOR"; break; }
|
||||
debugCheckpointToLoad = debugSave;
|
||||
RequestTransition(new(savedScene.LevelFile, savedStart.Tag!, 0, -1)); debugMenu.Close();
|
||||
}
|
||||
catch (Exception error) when (error is IOException or UnauthorizedAccessException or InvalidDataException)
|
||||
{ debugMenu.Message = "CHECKPOINT LOAD FAILED: " + error.Message; }
|
||||
break;
|
||||
case DebugAction.None: break;
|
||||
case DebugAction.CameraObstruction: debugMenu.Message = "SOURCE STATIC QUERY UNAVAILABLE IN THIS SCENE"; break;
|
||||
case DebugAction.MuteMusic or DebugAction.MuteSpeech or DebugAction.MuteEffects or DebugAction.RestartMusic or DebugAction.StopEffects:
|
||||
debugMenu.Message = "SCENE AUDIO UNAVAILABLE (--MUTE / HEADLESS)"; break;
|
||||
default: debugMenu.Message = "ACTION REQUIRES PLAY MODE"; break;
|
||||
}
|
||||
}
|
||||
void SyncDebugPlayer()
|
||||
{
|
||||
if (simulation == null) return;
|
||||
characterModel = simulation.Model;
|
||||
if (level?.Player?.Tag is { } tag)
|
||||
director?.SyncActor(tag, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
}
|
||||
Vector2 Pointer()
|
||||
{
|
||||
Sdl.SDL_GetMouseState(out var x, out var y);
|
||||
@@ -657,6 +754,12 @@ internal static class Program
|
||||
if (e.Repeat == 0) diagnostics.Enabled = !diagnostics.Enabled;
|
||||
continue;
|
||||
}
|
||||
if (e.Type == Sdl.KeyDown && e.Scancode == DebugMenu.NoclipKey)
|
||||
{
|
||||
debugCapturedKeys.Add(e.Scancode);
|
||||
if (e.Repeat == 0) { DebugCommand(DebugAction.Noclip); DebugInputBoundary(); }
|
||||
continue;
|
||||
}
|
||||
if (e.Type == Sdl.KeyDown && e.Scancode == DebugMenu.ToggleKey)
|
||||
{
|
||||
debugCapturedKeys.Add(e.Scancode);
|
||||
@@ -693,7 +796,8 @@ internal static class Program
|
||||
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 })
|
||||
if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false }
|
||||
&& (e.Scancode != 44 || simulation?.Noclip != true))
|
||||
{ sceneAudio?.StopSpeech(); director.Skip(); keys.Clear(); mouseJump = false; }
|
||||
else if (e.Scancode == 41) running = false;
|
||||
if (inspecting && e.Repeat == 0 && animations?.Select(e.Scancode) == true)
|
||||
@@ -722,17 +826,19 @@ internal static class Program
|
||||
var dt = (float)Math.Min(elapsed, 0.1);
|
||||
last = now;
|
||||
if (debugMenu.Open) animationStarted += elapsed;
|
||||
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke))
|
||||
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 ? 1 : stepClock.Advance(elapsed);
|
||||
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || 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)
|
||||
: 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));
|
||||
if (director?.Controlled != false)
|
||||
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;
|
||||
@@ -744,17 +850,20 @@ internal static class Program
|
||||
}
|
||||
interactions?.UpdateEnergy(simulation.Energy);
|
||||
director?.SyncActor(level!.Player!.Tag!, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
director?.Touch(level!.Player!.Tag!, simulation.ActorRoot);
|
||||
interactions?.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
if (!simulation.Noclip)
|
||||
{
|
||||
director?.Touch(level!.Player!.Tag!, simulation.ActorRoot);
|
||||
interactions?.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
}
|
||||
if (practice.Active) { keys.Clear(); mouseJump = false; stepClock.Reset(); break; }
|
||||
mechanisms?.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
if (!simulation.Noclip) mechanisms?.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
}
|
||||
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 }
|
||||
var switched = director is { Controlled: false } && !simulation.Noclip
|
||||
? animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)
|
||||
: animations!.SelectPose(simulation.Pose);
|
||||
if (switched) poseTime = 0;
|
||||
@@ -786,7 +895,7 @@ internal static class Program
|
||||
view = Matrix4x4.CreateLookAtLeftHanded(simulation.CameraEye, simulation.CameraTarget, Vector3.UnitY);
|
||||
renderEye = simulation.CameraEye; renderTarget = simulation.CameraTarget;
|
||||
}
|
||||
if (!inspecting && director?.CameraEye is { } storyEye && director.CameraTarget is { } storyTarget)
|
||||
if (!inspecting && simulation?.Noclip != true && director?.CameraEye is { } storyEye && director.CameraTarget is { } storyTarget)
|
||||
{
|
||||
view = Matrix4x4.CreateLookAtLeftHanded(storyEye, storyTarget, Vector3.UnitY);
|
||||
renderEye = storyEye; renderTarget = storyTarget;
|
||||
@@ -800,7 +909,7 @@ internal static class Program
|
||||
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible,
|
||||
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible, renderer.Width, renderer.Height);
|
||||
var gameplayProjection = originalCamera || simulation != null && !inspecting;
|
||||
var cameraMode = !inspecting && director?.CameraEye != null ? "CUTSCENE"
|
||||
var cameraMode = simulation?.Noclip == true && !inspecting ? "NOCLIP" : !inspecting && director?.CameraEye != null ? "CUTSCENE"
|
||||
: simulation != null && !inspecting ? "GAMEPLAY" : originalCamera ? "STRT" : "ORBIT";
|
||||
var debugStatus = new DebugStatus(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
|
||||
simulation?.ActorRoot ?? Vector3.Zero, simulation?.Yaw ?? 0, simulation?.Speed ?? 0,
|
||||
@@ -808,7 +917,21 @@ internal static class Program
|
||||
storyTasks?.Get("SCENE") ?? 0, director?.CurrentTag ?? "NONE", director?.Controlled ?? false,
|
||||
(director?.Issues.Count ?? 0) + (interactions?.Unsupported.Count ?? 0) + (mechanisms?.Unsupported.Count ?? 0),
|
||||
gameplayProjection ? SceneProjection.FarPlane(level?.Code) : radius * 20,
|
||||
inspecting, director?.DebugForceControl ?? false, diagnostics.Enabled, cameraMode);
|
||||
inspecting, director?.DebugForceControl ?? false, diagnostics.Enabled, cameraMode, new DebugSystems
|
||||
{
|
||||
Noclip = simulation?.Noclip ?? false, NoclipSpeed = simulation?.NoclipSpeed ?? 600,
|
||||
Velocity = simulation?.Velocity ?? Vector3.Zero, PendingImpulse = simulation?.PendingImpulse ?? Vector3.Zero,
|
||||
MovementMode = simulation?.MovementMode ?? 0, InputAfterPlayer = simulation?.InputAfterPlayerUpdate ?? false,
|
||||
JumpState = simulation?.JumpState ?? 0, JumpHold = simulation?.JumpHoldSeconds ?? 0,
|
||||
BurnRemaining = simulation?.JetpackRemaining ?? 0, JetpackAvailability = interactions?.Inventory.State(0, 3) ?? 0,
|
||||
Objective = interactions?.CurrentObjective ?? 0, ObjectiveTime = objectivePanel?.Elapsed ?? 0,
|
||||
CameraObstruction = debugCameraRay?.Enabled, CameraPolygons = debugCameraRay?.PolygonCount ?? 0,
|
||||
CameraWallPolygons = debugCameraRay?.WallPolygonCount ?? 0, CameraTests = debugCameraRay?.LastTriangleTests ?? 0,
|
||||
AudioAvailable = sceneAudio != null, MusicMuted = sceneAudio?.MusicMuted ?? false,
|
||||
SpeechMuted = sceneAudio?.SpeechMuted ?? false, EffectsMuted = sceneAudio?.EffectsMuted ?? false,
|
||||
MusicBytes = sceneAudio?.QueuedMusicBytes ?? 0, SpeechBytes = sceneAudio?.QueuedSpeechBytes ?? 0,
|
||||
EffectBytes = sceneAudio?.QueuedEffectBytes ?? 0
|
||||
});
|
||||
var debugView = debugMenu.View(debugStatus);
|
||||
var liveDebugLines = diagnostics.Lines(debugStatus, new(simulation?.Velocity ?? Vector3.Zero,
|
||||
simulation?.TurnRate ?? 0, simulation?.Pose.ToString() ?? "NONE", simulation?.Steps ?? 0,
|
||||
@@ -837,6 +960,51 @@ internal static class Program
|
||||
count++;
|
||||
audio?.Pump();
|
||||
sceneAudio?.Pump();
|
||||
if (toolsSmoke)
|
||||
{
|
||||
void PushTool(uint key, bool down = true, bool repeat = false)
|
||||
{
|
||||
var e = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = key,
|
||||
Down = down ? (byte)1 : (byte)0, Repeat = repeat ? (byte)1 : (byte)0 };
|
||||
if (!Sdl.SDL_PushEvent(ref e)) throw new InvalidOperationException(Sdl.Error);
|
||||
}
|
||||
void TapTool(uint key) { PushTool(key); PushTool(key, false); }
|
||||
if (count == 1) { toolsEntry = simulation!.ActorRoot; TapTool(DebugMenu.ToggleKey); }
|
||||
if (count == 2) { TapTool(43); TapTool(40); }
|
||||
if (count == 3)
|
||||
{
|
||||
toolsPaused = debugMenu.Open && debugMenu.Page == 1 && simulation!.Noclip
|
||||
&& simulation.ActorRoot == toolsEntry && sceneAudio?.Paused != false;
|
||||
director!.Trigger("neutron1a"); // Flight must work without changing scripted control ownership.
|
||||
TapTool(DebugMenu.ToggleKey); PushTool(26); PushTool(44);
|
||||
}
|
||||
if (count == 7)
|
||||
{
|
||||
toolsMoved = simulation!.Noclip && simulation.ActorRoot.Y > toolsEntry.Y + 20
|
||||
&& Vector3.Distance(simulation.ActorRoot, toolsEntry) > 30 && simulation.Jumps == 0
|
||||
&& director is { Controlled: false, Playing: true, CurrentTag: "neutron1a" };
|
||||
PushTool(DebugMenu.NoclipKey); PushTool(DebugMenu.NoclipKey, repeat: true); PushTool(DebugMenu.NoclipKey, false);
|
||||
}
|
||||
if (count == 8)
|
||||
{
|
||||
toolsStopped = !simulation!.Noclip && simulation.PendingImpulse == Vector3.Zero && simulation.Speed == 0 && simulation.Jumps == 0;
|
||||
PushTool(26, false); PushTool(44, false); TapTool(DebugMenu.ToggleKey);
|
||||
}
|
||||
if (count == 9) TapTool(43);
|
||||
if (count == 10)
|
||||
{
|
||||
TapTool(40); TapTool(81); TapTool(40); // Camera query and music mute.
|
||||
for (var i = 0; i < 5; i++) TapTool(81);
|
||||
TapTool(40); // Save progression.
|
||||
}
|
||||
if (count == 11)
|
||||
{
|
||||
toolsSystems = debugMenu.Page == 2 && debugCameraRay?.Enabled == false && sceneAudio?.MusicMuted == true;
|
||||
toolsSaved = File.Exists(debugCheckpointFile) && OriginalSave.Load(debugCheckpointFile).Tasks.Any(t => t.Name == "SCENE" && t.State == 30);
|
||||
storyTasks!.SetExisting("SCENE", 35);
|
||||
TapTool(81); TapTool(40); // Load the saved progression and rebuild through normal continuation.
|
||||
}
|
||||
}
|
||||
if (diagnosticsSmoke)
|
||||
{
|
||||
void Push(uint key, bool down = true, bool repeat = false)
|
||||
@@ -1003,6 +1171,13 @@ internal static class Program
|
||||
Console.WriteLine($"Debug SDL check: paused={debugPauseObserved}, actions={debugActionsObserved}, Escape/input capture={debugEscapeObserved}, resumed={debugResumeObserved}, forced movement during MCA={debugForceObserved}, resize800x600={didResize}.");
|
||||
if (!debugPauseObserved || !debugActionsObserved || !debugEscapeObserved || !debugResumeObserved || !debugForceObserved || !didResize) return 2;
|
||||
}
|
||||
if (toolsSmoke)
|
||||
{
|
||||
var loaded = debugCheckpointToLoad?.Tasks.Any(t => t.Name == "SCENE" && t.State == 30) == true
|
||||
&& transitionRequest?.LevelFile.Equals("level1b.gam", StringComparison.OrdinalIgnoreCase) == true;
|
||||
Console.WriteLine($"Debug tools SDL check: paused={toolsPaused}, flight={toolsMoved}, stop/input capture={toolsStopped}, systems={toolsSystems}, saved={toolsSaved}, loaded={loaded}.");
|
||||
if (!toolsPaused || !toolsMoved || !toolsStopped || !toolsSystems || !toolsSaved || !loaded) return 2;
|
||||
}
|
||||
if (carlSmoke)
|
||||
{
|
||||
var locked = director is { Controlled: false, Playing: true, CurrentTag: "neutron1a" } && simulation!.Steps == 0;
|
||||
@@ -1055,14 +1230,15 @@ internal static class Program
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (args[i] is "--smoke-transition" or "--smoke-lab-route" or "--smoke-practice-prompt" or "--smoke-practice-transition"
|
||||
or "--debug-menu" or "--smoke-debug-menu" or "--smoke-debug-overlay") continue;
|
||||
if (args[i] is "--scene" or "--level" or "--start" or "--load-save" or "--story-time") { i++; continue; }
|
||||
or "--debug-menu" or "--smoke-debug-menu" or "--smoke-debug-overlay" or "--smoke-debug-tools" or "--noclip") continue;
|
||||
if (args[i] is "--scene" or "--level" or "--start" or "--load-save" or "--story-time" or "--debug-page") { i++; continue; }
|
||||
nextArgs.Add(args[i]);
|
||||
}
|
||||
nextArgs.AddRange(["--scene", nextScene, "--level", "gam/" + transitionRequest.LevelFile,
|
||||
"--start", transitionRequest.StartPoint]);
|
||||
continuation = new(nextArgs.ToArray(), interactions!.Snapshot() with {
|
||||
StartPoint = transitionRequest.StartPoint, StoredVector = returnRoot }, transitionRequest.Returning);
|
||||
if (toolsSmoke) nextArgs.AddRange(["--frames", "2"]);
|
||||
continuation = new(nextArgs.ToArray(), (debugCheckpointToLoad ?? interactions!.Snapshot()) with {
|
||||
StartPoint = transitionRequest.StartPoint, StoredVector = debugCheckpointToLoad?.StoredVector ?? returnRoot }, transitionRequest.Returning);
|
||||
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