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
@@ -57,6 +57,9 @@ public sealed class LabSimulation
|
||||
: jumpState.JumpState == 3 && jumpState.EffectRemaining > 0 ? PlayerPose.Fly
|
||||
: !forceFall && Velocity.Y > 0 ? PlayerPose.Jump : PlayerPose.Fall;
|
||||
public int Steps { get; private set; }
|
||||
public int PhysicsSteps { get; private set; }
|
||||
public int ControllerSteps { get; private set; }
|
||||
public int EffectSteps { get; private set; }
|
||||
public int Jumps { get; private set; }
|
||||
public int Landings { get; private set; }
|
||||
public int WallHits { get; private set; }
|
||||
@@ -103,6 +106,7 @@ public sealed class LabSimulation
|
||||
Grounded = true;
|
||||
Noclip = HasNoclipEntry = false;
|
||||
Steps = Jumps = Landings = WallHits = 0;
|
||||
PhysicsSteps = ControllerSteps = EffectSteps = 0;
|
||||
Travel = MaximumRise = 0;
|
||||
CameraEye = DesiredEye().Eye;
|
||||
}
|
||||
@@ -144,21 +148,41 @@ public sealed class LabSimulation
|
||||
return ((float)Math.Sin(radians), (float)Math.Cos(radians));
|
||||
}
|
||||
|
||||
public void Step(PlayerInput input)
|
||||
public void Step(PlayerInput input, bool controlled = true)
|
||||
{
|
||||
if (Noclip) { StepNoclip(input); return; }
|
||||
//47E554 global body integration precedes473740 registry callbacks.
|
||||
// This reconstructs the player/input/fire partial order, not the full
|
||||
// scene registry, original cadence or original collision response.
|
||||
StepPhysics();
|
||||
if (!InputAfterPlayerUpdate) StepInput(input);
|
||||
StepPlayer(input);
|
||||
//42469F..4246DC reasserts ordinary grounded radius before ownership
|
||||
//checks. The scooter's separate radius160 policy remains unimplemented.
|
||||
if (Grounded) InteractionRadius = 60;
|
||||
if (controlled && !InputAfterPlayerUpdate) StepInput(input);
|
||||
if (controlled) StepPlayer(input);
|
||||
var effect = JetpackBurst.StepEffect(jumpState, Grounded, FixedStepClock.Step, Energy, LevelCode);
|
||||
jumpState = effect.State; Energy = effect.Energy; JetpackEffectVisible = effect.Visible;
|
||||
if (InputAfterPlayerUpdate) StepInput(input);
|
||||
EffectSteps++;
|
||||
if (controlled && InputAfterPlayerUpdate) StepInput(input);
|
||||
Steps++;
|
||||
}
|
||||
|
||||
/// <summary>43A750 preparation clears speed and velocity XYZ only. Queued
|
||||
/// impulse, acceleration, mode, jump/hold and owned fire timer survive.</summary>
|
||||
public void PrepareForScript()
|
||||
{
|
||||
Speed = 0; Velocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
/// <summary>Authored AI root/Euler writes. They do not reset body motion or
|
||||
/// destination yaw61C; the full logical/render Euler model remains separate.</summary>
|
||||
public void ApplyAuthoredTransform(Vector3 root, float yaw)
|
||||
{
|
||||
if (!float.IsFinite(root.X) || !float.IsFinite(root.Y) || !float.IsFinite(root.Z) || !float.IsFinite(yaw))
|
||||
throw new ArgumentOutOfRangeException(nameof(root));
|
||||
Position = root - Vector3.UnitY * rootHeight; Yaw = yaw;
|
||||
}
|
||||
|
||||
/// <summary>Modern debug movement; never serialized into original save state.</summary>
|
||||
public bool SetNoclip(bool enabled)
|
||||
{
|
||||
@@ -239,6 +263,7 @@ public sealed class LabSimulation
|
||||
|
||||
private void StepPlayer(PlayerInput input)
|
||||
{
|
||||
ControllerSteps++;
|
||||
const float dt = FixedStepClock.Step;
|
||||
var yawError = MathF.IEEERemainder(targetYaw - Yaw, 360);
|
||||
Yaw = (Yaw + yawError * dt * 3.7f) % 360;
|
||||
@@ -249,7 +274,6 @@ public sealed class LabSimulation
|
||||
{
|
||||
movementMode = 0; TurnRate = 0;
|
||||
}
|
||||
if (Grounded) InteractionRadius = 60;
|
||||
if (Velocity.LengthSquared() != 0 || movementMode == 0 && lateralContribution != 0)
|
||||
Yaw = (Yaw + TurnRate * dt) % 360;
|
||||
var (sin, cos) = Trig(Yaw);
|
||||
@@ -277,6 +301,7 @@ public sealed class LabSimulation
|
||||
|
||||
private void StepPhysics()
|
||||
{
|
||||
PhysicsSteps++;
|
||||
const float dt = FixedStepClock.Step;
|
||||
var wasGrounded = Grounded;
|
||||
var velocity = Velocity;
|
||||
@@ -338,5 +363,5 @@ public sealed class LabSimulation
|
||||
step is >= 80 and < 120, step is >= 60 and < 95, false, step < 180);
|
||||
|
||||
public bool SmokePassed => Steps >= 240 && Travel > 50 && MaximumRise > 20 && Jumps > 0 && Landings > 0 && Grounded;
|
||||
public string Report => $"Walk checkpoint: steps={Steps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, grounded={Grounded}, feet={Position}.";
|
||||
public string Report => $"Walk checkpoint: steps={Steps}, controller={ControllerSteps}, physics={PhysicsSteps}, effect={EffectSteps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, grounded={Grounded}, feet={Position}.";
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>Connect recovered raw-owner preparations and authored transforms to
|
||||
/// the port's player body. Full scene scheduling/other actor classes stay separate.</summary>
|
||||
public sealed class PlayerSceneBinding : IDisposable
|
||||
{
|
||||
private readonly SceneDirector director;
|
||||
private readonly LabSimulation player;
|
||||
private readonly SceneInventory inventory;
|
||||
private readonly string tag;
|
||||
public int UnsupportedGadgetCleanups { get; private set; }
|
||||
|
||||
public PlayerSceneBinding(SceneDirector director, LabSimulation player, SceneInventory inventory, string tag)
|
||||
{
|
||||
this.director = director; this.player = player; this.inventory = inventory; this.tag = tag;
|
||||
director.ActorPreparing += Prepare;
|
||||
director.AuthoredTransformChanged += Transform;
|
||||
}
|
||||
|
||||
public bool Step(PlayerInput input)
|
||||
{
|
||||
var acceptsInput = director.Controlled || player.Noclip;
|
||||
player.Step(input, acceptsInput);
|
||||
var rotation = director.FindActor(tag)?.Rotation ?? Vector3.Zero;
|
||||
director.SyncActor(tag, player.ActorRoot, rotation with { Y = player.Yaw });
|
||||
return acceptsInput;
|
||||
}
|
||||
|
||||
private void Prepare(DirectorActor actor, ScriptPreparation action)
|
||||
{
|
||||
if (!string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase)) return;
|
||||
if (action == ScriptPreparation.StopMotion) player.PrepareForScript();
|
||||
else if (action == ScriptPreparation.ReleaseGadget)
|
||||
{
|
||||
//427FF0 has distinct cases. Only no-selection/jetpack cleanup is
|
||||
//implemented; do not turn the other gadget cases into blanket resets.
|
||||
if (inventory.SelectedGadget is -1 or 3)
|
||||
{ inventory.SelectGadget(-1); player.GadgetMode = -1; }
|
||||
else UnsupportedGadgetCleanups++;
|
||||
}
|
||||
}
|
||||
|
||||
private void Transform(DirectorActor actor)
|
||||
{
|
||||
if (string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase))
|
||||
player.ApplyAuthoredTransform(actor.Position, actor.Rotation.Y);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
director.ActorPreparing -= Prepare;
|
||||
director.AuthoredTransformChanged -= Transform;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public sealed class DirectorActor
|
||||
}
|
||||
|
||||
public sealed record DirectorIssue(string Tag, string Kind, string Detail);
|
||||
public enum ScriptPreparation { StopMotion, ReleaseGadget, FlattenOrientation }
|
||||
|
||||
/// <summary>
|
||||
/// Recovered synchronous AI-trigger dispatch and audio-duration-driven CAM/MCA
|
||||
@@ -71,6 +72,7 @@ public sealed class SceneDirector
|
||||
public List<DirectorActor> Actors { get; } = [];
|
||||
public IReadOnlyList<DirectorIssue> Issues => issues;
|
||||
private string? controlledTag;
|
||||
public string? AuthoredControlledTag => controlledTag;
|
||||
/// <summary>Modern debug override; leaves authored control/camera transitions intact.</summary>
|
||||
public bool DebugForceControl { get; set; }
|
||||
public bool Controlled => Equal(ControlledTag, level.Player?.Tag);
|
||||
@@ -90,6 +92,8 @@ public sealed class SceneDirector
|
||||
public event Action? MusicStopped;
|
||||
public event Action? MusicRestarted;
|
||||
public event Action<DirectorActor>? ActorChanged;
|
||||
public event Action<DirectorActor, ScriptPreparation>? ActorPreparing;
|
||||
public event Action<DirectorActor>? AuthoredTransformChanged;
|
||||
public event Action<string, string>? Unsupported;
|
||||
|
||||
public SceneDirector(GamLevel level, TaskStates tasks, Func<string, int, double> soundDuration)
|
||||
@@ -277,7 +281,7 @@ public sealed class SceneDirector
|
||||
var number = activations.GetValueOrDefault(entity.Offset) + 1;
|
||||
activations[entity.Offset] = number;
|
||||
if (times != -1 && number > times) return;
|
||||
SetControl(entity);
|
||||
SetControl(entity, prepareOwner: true);
|
||||
|
||||
var targetTag = entity.Text("AITarget");
|
||||
if (!IsNone(targetTag))
|
||||
@@ -286,12 +290,13 @@ public sealed class SceneDirector
|
||||
Report(entity.Tag!, entity.Kind, $"AI target {targetTag} absent");
|
||||
else
|
||||
{
|
||||
var transformed = false;
|
||||
var hide = entity.Integer("AIHideObj", -1);
|
||||
if (hide != -1) target.Visible = hide == 0;
|
||||
var positionTag = entity.Text("AINewPos");
|
||||
if (!IsNone(positionTag))
|
||||
{
|
||||
if (actors.TryGetValue(positionTag!, out var marker)) target.Position = marker.Position;
|
||||
if (actors.TryGetValue(positionTag!, out var marker)) { target.Position = marker.Position; transformed = true; }
|
||||
else Report(entity.Tag!, entity.Kind, $"AINewPos {positionTag} absent");
|
||||
}
|
||||
var animation = entity.Text("AIAnim");
|
||||
@@ -302,7 +307,8 @@ public sealed class SceneDirector
|
||||
var patrol = entity.Text("AIPatrol");
|
||||
if (!IsNone(patrol)) target.Patrol = patrol;
|
||||
var yaw = entity.Number("AINewRotY", -1);
|
||||
if (yaw != -1) target.Rotation = target.Rotation with { Y = yaw };
|
||||
if (yaw != -1) { target.Rotation = target.Rotation with { Y = yaw }; transformed = true; }
|
||||
if (transformed) AuthoredTransformChanged?.Invoke(target);
|
||||
ActorChanged?.Invoke(target);
|
||||
if (target.AIstate == 3 && (target.Kind is "3DOG" or "3CAR") && !patrolConsumers.Contains(target.Tag))
|
||||
Report(target.Tag, target.Kind, "Patrol motion/arrival is not yet reconstructed; actor-state callback emitted");
|
||||
@@ -331,15 +337,26 @@ public sealed class SceneDirector
|
||||
private void StartMulti(GamEntity entity)
|
||||
{
|
||||
// MCA's PlayerControlled is its completion target (4311F0), not an
|
||||
// activation grant. Each valid shot clears control at43159E..4315A7.
|
||||
// activation grant. Only initial activation clears control; later shots
|
||||
//use431750 without repeating431502..4315A7 preparation.
|
||||
Toggle(entity);
|
||||
if (IsNone(entity.Text("CameraTarget0"))) return; //431300→431668 returns, not completion.
|
||||
if (skipping) { FinishMulti(entity); return; }
|
||||
//431502 initial activation only. Subsequent431750 shots do not repeat
|
||||
//preparation or clear control. The raw owner guard ignores debug force.
|
||||
PrepareOwner(ScriptPreparation.StopMotion, ScriptPreparation.FlattenOrientation, ScriptPreparation.ReleaseGadget);
|
||||
ControlledTag = null;
|
||||
StartCamera(entity, 0, applyCommon: false);
|
||||
}
|
||||
|
||||
private void StartCamera(GamEntity entity, int index, bool applyCommon = true)
|
||||
{
|
||||
if (applyCommon) { SetControl(entity); Toggle(entity); }
|
||||
if (applyCommon)
|
||||
{
|
||||
if (Equal(entity.Text("PlayerControlled"), "NULL"))
|
||||
PrepareOwner(ScriptPreparation.ReleaseGadget, ScriptPreparation.StopMotion, ScriptPreparation.FlattenOrientation);
|
||||
SetControl(entity); Toggle(entity);
|
||||
}
|
||||
if (entity.Integer("DeactivateInv") != 0) InventoryEnabled = false;
|
||||
if (skipping)
|
||||
{
|
||||
@@ -361,7 +378,6 @@ public sealed class SceneDirector
|
||||
Block(entity, $"Camera target {targetTag} absent", entity.Text("NextTrigger"));
|
||||
return;
|
||||
}
|
||||
if (index >= 0) ControlledTag = null;
|
||||
var database = entity.Text("SoundDatabase") ?? "none";
|
||||
var duration = soundDuration(database, sound);
|
||||
if (!double.IsFinite(duration) || duration < 0)
|
||||
@@ -478,11 +494,33 @@ public sealed class SceneDirector
|
||||
return target.Position + new Vector3(x * cy - pitchedZ * sy, pitchedY, x * sy + pitchedZ * cy);
|
||||
}
|
||||
|
||||
private void SetControl(GamEntity entity)
|
||||
private void PrepareOwner(params ScriptPreparation[] actions)
|
||||
{
|
||||
if (controlledTag == null || !actors.TryGetValue(controlledTag, out var owner)) return;
|
||||
foreach (var action in actions)
|
||||
{
|
||||
// Only Jimmy's derived preparation is modeled here; other classes
|
||||
//receive the boundary without inventing their virtual side effects.
|
||||
if (action == ScriptPreparation.StopMotion && owner.Kind == "3JIM")
|
||||
owner.Speed = 0;
|
||||
else if (action == ScriptPreparation.FlattenOrientation)
|
||||
owner.Rotation = new Vector3(0, owner.Rotation.Y, 0);
|
||||
ActorPreparing?.Invoke(owner, action);
|
||||
//42AFC0 invokes43A750 before the derived STOP animation request.
|
||||
if (action == ScriptPreparation.StopMotion && owner.Kind == "3JIM")
|
||||
{ owner.Animation = "STOP"; ActorChanged?.Invoke(owner); }
|
||||
}
|
||||
}
|
||||
|
||||
private void SetControl(GamEntity entity, bool prepareOwner = false)
|
||||
{
|
||||
var control = entity.Text("PlayerControlled");
|
||||
if (IsNone(control)) return;
|
||||
if (Equal(control, "NULL")) ControlledTag = null;
|
||||
if (Equal(control, "NULL"))
|
||||
{
|
||||
if (prepareOwner) PrepareOwner(ScriptPreparation.StopMotion); //40C4AD; no438/flatten.
|
||||
ControlledTag = null;
|
||||
}
|
||||
else if (actors.ContainsKey(control!)) ControlledTag = control;
|
||||
else Report(entity.Tag!, entity.Kind, $"PlayerControlled target {control} absent");
|
||||
}
|
||||
|
||||
+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