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
@@ -42,6 +42,29 @@ Check(skipMusicPlaying,"Skipping must restore selected gameplay music");
|
||||
Check(skip.FindActor("C3DGODDARD")!.Position==endGoddard,"Skip must preserve AI/toggle actions");
|
||||
Console.WriteLine("PASS original intro skip preserves action sequence");
|
||||
|
||||
foreach (var finishBySkip in new[] { false, true })
|
||||
{
|
||||
var carlScene = new SceneDirector(level, new TaskStates(save.Tasks), (_, _) => .1);
|
||||
carlScene.Begin(level.FindStart()!); carlScene.Skip();
|
||||
Check(carlScene.Controlled, "Carl test starts with normal player control");
|
||||
carlScene.Trigger("neutron1a");
|
||||
Check(carlScene.Playing && carlScene.CurrentTag == "neutron1a" && !carlScene.Controlled,
|
||||
"Carl MCA must lock input despite serialized completion target JIM1");
|
||||
if (finishBySkip) carlScene.Skip();
|
||||
else
|
||||
for (var tick = 0; tick < 100 && carlScene.Playing; tick++)
|
||||
{
|
||||
Check(!carlScene.Controlled, "Every active Carl shot keeps player control locked");
|
||||
carlScene.Step(.1f);
|
||||
}
|
||||
Check(!carlScene.Playing && carlScene.Controlled && !carlScene.Blocked,
|
||||
"Carl sequence restores original JIM1 completion target on finish or skip");
|
||||
}
|
||||
var carlBytes = File.ReadAllBytes(AssetPath.Resolve(root, "Neutron.exe"));
|
||||
Check(carlBytes.AsSpan(0x3159e, 15).SequenceEqual(Convert.FromHexString("8B0D48995000538B11FF9218010000")),
|
||||
"Source MCA clears game controlled pointer before playback");
|
||||
Console.WriteLine("PASS end-of-lab Carl cutscene input lock and natural/skip control restoration");
|
||||
|
||||
foreach(var type in new[]{0,1,2,3,4})
|
||||
{
|
||||
var camera=Entity("3MCA","camera",("CameraTarget0","actor"),("SoundDatabase","voice"),("SoundIndex0",1),("CameraType0",type),("LookatVOffset0",100f),("NextTrigger","default"));
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<Compile Include="../../src/GamePort/Assets/Mesh.cs"/>
|
||||
<Compile Include="../../src/GamePort/Assets/PngImage.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/SceneHud.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/ObjectivePanel.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -2,6 +2,7 @@ using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using GamePort.Assets;
|
||||
using GamePort.Application;
|
||||
using GamePort.Game;
|
||||
|
||||
var temp = Path.Combine(Path.GetTempPath(), "neutron-hud-" + Guid.NewGuid());
|
||||
Directory.CreateDirectory(temp);
|
||||
@@ -35,6 +36,20 @@ try
|
||||
Near(final.Vertices[1].Position, new(.2f, 2*380f/480-1, 0), "Expanded source HUD offset");
|
||||
hud.Update(final, 0, true, false);
|
||||
Check(final.Draws.Skip(1).All(d => !d.Visible), "No invented objective0 image");
|
||||
var panel = new ObjectivePanel();
|
||||
panel.Select(1); panel.Step(0);
|
||||
void PresentPanel() => hud.Update(final, panel.CurrentObjective, panel.PadVisible, false, panel.YOffset, panel.ContentVisible);
|
||||
PresentPanel();
|
||||
Check(final.Draws.Skip(1).Count(d => d.Visible) == 1 && final.Draws[1].Visible,
|
||||
"Entering objective draws only the moving pad");
|
||||
panel.Step(1); PresentPanel();
|
||||
Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "Stationary objective draws pad, text and digit");
|
||||
panel.Step(6.2f); PresentPanel();
|
||||
Check(final.Draws.Skip(1).Count(d => d.Visible) == 1, "Exit hides content before pad slides away");
|
||||
panel.Step(2); PresentPanel();
|
||||
Check(final.Draws.Skip(1).All(d => !d.Visible), "Timed-out objective has no remaining overlay draw");
|
||||
panel.Key(true); panel.Step(1); PresentPanel();
|
||||
Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "O reopens timed-out panel through the timer");
|
||||
Reject(() => hud.Update(source, 1, true, false), "Missing final ranges");
|
||||
Reject(() => hud.Update(final, 1, true, false, float.NaN), "Nonfinite HUD offset");
|
||||
File.WriteAllText(path, Manifest(entries.Select(e => new { e.id, width=e.id==120 ? 0 : e.width, e.height, e.path })));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<Compile Include="../../src/GamePort/Game/TaskActivation.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/TaskStates.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/LabSimulation.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
||||
|
||||
@@ -19,6 +19,7 @@ var tests = new (string Name, Action Check)[]
|
||||
("ordinary jump responds to airborne arrows", AirControl),
|
||||
("powered jetpack starts moving and turns from stationary takeoff", JetpackControl),
|
||||
("powered steering remains independent of presentation rate", JetpackReplayRates),
|
||||
("landing clears residual air turn before ground steering", LandingTurn),
|
||||
("reset restores spawn, camera and counters", Reset),
|
||||
("ten-minute simulation remains finite and supported", LongRun),
|
||||
("original lab placement, floor, walking and jump checkpoint", () => OriginalLab(project, originals)),
|
||||
@@ -254,6 +255,25 @@ static void JetpackReplayRates()
|
||||
}
|
||||
}
|
||||
|
||||
static void LandingTurn()
|
||||
{
|
||||
foreach (var initialLeft in new[] { false, true })
|
||||
{
|
||||
var simulation = FlatSimulation();
|
||||
simulation.Step(new(true, false, false, false, true));
|
||||
for (var i = 0; i < 120 && !simulation.Grounded; i++)
|
||||
simulation.Step(new(true, false, initialLeft, !initialLeft, false));
|
||||
Check(simulation.Grounded && MathF.Abs(simulation.TurnRate) > 20,
|
||||
"Landing fixture retains an opposing air turn before outer grounded reset");
|
||||
var before = simulation.Yaw;
|
||||
simulation.Step(new(true, false, !initialLeft, initialLeft, false));
|
||||
Near(simulation.TurnRate, 0, 0, "grounded released-jump reset clears shared air-turn field");
|
||||
var yawChange = MathF.IEEERemainder(simulation.Yaw - before, 360);
|
||||
Near(yawChange, initialLeft ? -10 * FixedStepClock.Step * 3.7f : 10 * FixedStepClock.Step * 3.7f,
|
||||
.0001f, "prior jump turn must not cancel or clamp opposing ground turn");
|
||||
}
|
||||
}
|
||||
|
||||
static void JumpRepress()
|
||||
{
|
||||
var simulation = FlatSimulation();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||
<ItemGroup><Compile Include="Program.cs"/><Compile Include="../../src/GamePort/Game/ObjectivePanel.cs"/></ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Buffers.Binary;
|
||||
using GamePort.Game;
|
||||
|
||||
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
||||
var source = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
|
||||
float SourceFloat(int va) => BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(va - 0x400000, 4)));
|
||||
void Bytes(int va, string hex)
|
||||
{
|
||||
var expected = Convert.FromHexString(hex);
|
||||
Require(source.AsSpan(va - 0x400000, expected.Length).SequenceEqual(expected), $"Original instructions differ at0x{va:X}");
|
||||
}
|
||||
Near(SourceFloat(0x48d974), ObjectivePanel.SlideInSeconds, "source entry boundary");
|
||||
Near(SourceFloat(0x48d970), ObjectivePanel.SlideScale, "source slide scale");
|
||||
Near(SourceFloat(0x48d96c), ObjectivePanel.SlideDistance, "source slide distance");
|
||||
Near(SourceFloat(0x48d940), ObjectivePanel.ExitDuration, "source exit window");
|
||||
Require(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(0xec498, 4)) == 7, "Source stationary end differs");
|
||||
Bytes(0x406f76, "C70588814F0000000000");
|
||||
Bytes(0x4043d9, "391DE4995000");
|
||||
Bytes(0x4043e5, "D90588814F00D8442428");
|
||||
Bytes(0x407071, "A087985000");
|
||||
Bytes(0x40715b, "C705307C4F0001000000");
|
||||
Bytes(0x40718e, "C70588814F0000000000");
|
||||
Bytes(0x407271, "578BCEFF92CC040000");
|
||||
Console.WriteLine("PASS source objective timer/input/visibility instructions and constants");
|
||||
|
||||
var panel = new ObjectivePanel(1);
|
||||
panel.Step(0);
|
||||
Require(!panel.PadVisible && !panel.ContentVisible, "Loaded selector starts hidden at original timer20");
|
||||
panel.Select(1); panel.Step(0);
|
||||
Require(panel.PadVisible && !panel.ContentVisible, "Slide-in draws pad without objective/digit");
|
||||
Near(panel.YOffset, 31, "Entry pad is100 below its layout position");
|
||||
panel.Step(.35f);
|
||||
Near(panel.YOffset, -19, "Half entry position follows source scale");
|
||||
panel.Step(.35f);
|
||||
Require(panel.PadVisible && panel.ContentVisible, "Content becomes visible at entry equality.7");
|
||||
Near(panel.YOffset, -69, "Stationary original layout offset");
|
||||
panel.Step(6.3f);
|
||||
Near(panel.Elapsed, 7, "Exact stationary boundary");
|
||||
Require(panel.PadVisible && !panel.ContentVisible, "Exit hides content at7, retaining pad");
|
||||
panel.Step(.35f);
|
||||
Near(panel.YOffset, -19, "Exit pad moves down using source reciprocal");
|
||||
panel.Step(ObjectivePanel.ExitEnd-panel.Elapsed);
|
||||
Require(!panel.PadVisible && !panel.ContentVisible, "Pad disappears at8.7 equality");
|
||||
Console.WriteLine("PASS source slide-in/stationary/slide-out coordinates and exact timeout boundaries");
|
||||
|
||||
panel.Key(true); panel.Step(0);
|
||||
Require(panel.PadVisible && panel.Elapsed == 0, "O reopens hidden panel");
|
||||
panel.Step(1); panel.Key(true);
|
||||
Require(panel.ContentVisible && panel.Elapsed == 1, "Held O does not retrigger");
|
||||
panel.Key(false); panel.Key(true); panel.Step(0);
|
||||
Require(panel.Elapsed == 7 && !panel.ContentVisible, "Next O edge starts slide-out");
|
||||
panel.Key(false); panel.Key(true); panel.Step(0);
|
||||
Require(panel.Elapsed == 0 && panel.PadVisible, "O during slide-out reopens");
|
||||
Near(panel.LayoutOffset, -69, "O does not resize/change gadget layout");
|
||||
Console.WriteLine("PASS O edge latch, close/reopen phases and layout separation");
|
||||
|
||||
panel.Select(2); panel.Step(1);
|
||||
Require(panel.CurrentObjective == 2 && panel.ContentVisible, "New objective shows after entry");
|
||||
panel.Select(2); panel.Step(0);
|
||||
Require(panel.Elapsed == 0 && !panel.ContentVisible, "Same positive selector also resets timing");
|
||||
panel.Select(0);
|
||||
Require(panel.CurrentObjective == 2 && panel.Elapsed == 0, "Nonpositive assignment is source no-op");
|
||||
var empty = new ObjectivePanel(); empty.Show(); empty.Step(1);
|
||||
Require(!empty.PadVisible && !empty.ContentVisible, "Objective0 does not invent art/digit");
|
||||
Console.WriteLine("PASS source selector reset/no-op and no-objective presentation");
|
||||
|
||||
panel.Step(1);
|
||||
var saved = panel.Elapsed;
|
||||
panel.Step(10, hasControlledActor: false);
|
||||
Require(panel.Elapsed == saved && !panel.PadVisible && !panel.ContentVisible, "No controlled entity freezes/hides UI");
|
||||
panel.Step(0);
|
||||
Require(panel.ContentVisible && panel.Elapsed == saved, "Explicit paused clock does not consume time");
|
||||
panel.Step(0, modalActive: true);
|
||||
Require(panel.Elapsed == ObjectivePanel.ExitEnd && !panel.PadVisible && !panel.ContentVisible, "Practice modal forces hidden end time");
|
||||
panel.Show(); panel.Step(0);
|
||||
Require(panel.PadVisible && panel.Elapsed == 0, "Practice dismissal may explicitly reopen current objective");
|
||||
Console.WriteLine("PASS separate controlled-entity, pause and modal lifecycle");
|
||||
|
||||
var sounded = new ObjectivePanel();
|
||||
var sounds = new List<int>(); sounded.SoundEffect += sounds.Add;
|
||||
sounded.Select(1); sounded.Step(0); sounded.Step(.1f); sounded.Select(2); sounded.Step(0);
|
||||
Require(sounds.SequenceEqual(new[] {216}), "Entry sound latch survives timer reset during entry");
|
||||
sounded.Step(.7f); sounded.Select(3); sounded.Step(0);
|
||||
Require(sounds.SequenceEqual(new[] {216,216}), "Stationary phase rearms the next entry sound");
|
||||
Throws<ArgumentOutOfRangeException>(() => sounded.Step(float.NaN));
|
||||
Throws<ArgumentOutOfRangeException>(() => sounded.Step(-1));
|
||||
Throws<ArgumentOutOfRangeException>(() => sounded.Select(44));
|
||||
Console.WriteLine("PASS source entry-sound latch and malformed input bounds");
|
||||
Console.WriteLine("Objective checks:6 groups passed. Original gameplay comparison remains outstanding.");
|
||||
|
||||
static void Require(bool condition, string message) { if (!condition) throw new InvalidOperationException(message); }
|
||||
static void Near(float actual, float expected, string message) => Require(MathF.Abs(actual-expected)<.0002f, $"{message}: {actual} != {expected}");
|
||||
static void Throws<T>(Action action) where T : Exception
|
||||
{
|
||||
try { action(); } catch (T) { return; }
|
||||
throw new InvalidOperationException($"Expected{typeof(T).Name}");
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<Compile Include="../../src/GamePort/Game/TaskStates.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/TaskActivation.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/LabSimulation.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/SceneProjection.cs"/>
|
||||
<Compile Include="../../src/GamePort/Assets/*.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.Numerics;
|
||||
using System.Buffers.Binary;
|
||||
using GamePort.Application;
|
||||
using GamePort.Assets;
|
||||
|
||||
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
||||
var executable = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
|
||||
|
||||
// Guard the actual outside and tutorial layer stores, not just an expected helper value.
|
||||
Bytes(0x450869, "8b3d3c9a5000c787c000000000c0da46");
|
||||
Bytes(0x456bfe, "8b3d309a5000c787c000000000504347");
|
||||
Bytes(0x456c44, "8b3d3c9a5000c787c000000000504347");
|
||||
Require(BinaryPrimitives.ReadUInt32LittleEndian(executable.AsSpan(0x450875 - 0x400000, 4)) == BitConverter.SingleToUInt32Bits(28000),
|
||||
"Outside geometry source far clip differs");
|
||||
Require(SceneProjection.FarPlane("LEV1") == 28000 && SceneProjection.FarPlane("VR04") == 50000,
|
||||
"Outside/tutorial must not inherit generic3200 clipping");
|
||||
Console.WriteLine("PASS source outside/tutorial layer instructions and corrected far clips");
|
||||
|
||||
var ranges = new Dictionary<float, string[]>
|
||||
{
|
||||
[5000] = ["LV1A"], [10000] = ["LV1B", "LV1C", "LV4A", "LV4D", "LEV7"],
|
||||
[120000] = ["LV1D", "LV1E"], [15000] = ["LV1F"], [28000] = ["LEV1"],
|
||||
[3500] = ["LV2A"], [50000] = ["LV2B", "LEV2", "VR01", "VR02", "VR03", "VR04", "VR05", "VR06", "VR07", "VR08"],
|
||||
[80000] = ["LV3A"], [40000] = ["LV3B", "LV3C", "LV3D", "LV3E", "LEV3"],
|
||||
[7200] = ["LV4B"], [30000] = ["LV4C", "LEV4"], [16000] = ["LV5A", "LV5B"],
|
||||
[12000] = ["LEV5"], [4000] = ["LV6A", "LEV6"]
|
||||
};
|
||||
var codes = Directory.EnumerateFiles(AssetPath.Resolve(original, "gam"))
|
||||
.Where(path => path.EndsWith(".gam", StringComparison.OrdinalIgnoreCase)).Select(path => GamLevel.Load(path).Code).ToHashSet();
|
||||
Require(codes.Count == 35 && ranges.Values.SelectMany(x => x).ToHashSet().SetEquals(codes), "Every supplied original level needs a clipping mapping");
|
||||
foreach (var (far, levels) in ranges)
|
||||
foreach (var level in levels)
|
||||
{
|
||||
Require(SceneProjection.FarPlane(level.ToLowerInvariant()) == far, "Case-insensitive source scene mapping differs");
|
||||
var projection = SceneProjection.CreateGameplay(level, 4f / 3);
|
||||
var nearClip = Vector4.Transform(new Vector4(0, 0, SceneProjection.NearPlane, 1), projection);
|
||||
var farClip = Vector4.Transform(new Vector4(0, 0, far, 1), projection);
|
||||
Require(MathF.Abs(nearClip.Z / nearClip.W) < .00001f && MathF.Abs(farClip.Z / farClip.W - 1) < .00001f,
|
||||
"Recovered clipping must map to Vulkan0..1 depth");
|
||||
}
|
||||
Require(SceneProjection.FarPlane(null) == 3200 && SceneProjection.FarPlane("unknown") == 3200, "Unknown layers retain original engine default");
|
||||
foreach (var aspect in new[] { 0, -1, float.NaN, float.PositiveInfinity })
|
||||
{
|
||||
try { SceneProjection.CreateGameplay("LEV1", aspect); throw new Exception("Invalid aspect accepted"); }
|
||||
catch (ArgumentOutOfRangeException) { }
|
||||
}
|
||||
Console.WriteLine("PASS all35 level mappings, inherited fallback, depth endpoints and bounded aspect input");
|
||||
|
||||
var outside = Mesh.LoadSceneJson("artifacts/extracted/level1/scene.json");
|
||||
var sourceLevel = GamLevel.Load(AssetPath.Resolve(original, "gam/level1.gam"));
|
||||
var start = sourceLevel.FindStart("level1")!;
|
||||
var view = Matrix4x4.CreateLookAtLeftHanded(start.CameraPosition, start.Position + new Vector3(0, 80, 0), Vector3.UnitY);
|
||||
var oldMatrix = view * Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(SceneProjection.FieldOfView, 4f / 3, 20, 3200);
|
||||
var newMatrix = view * SceneProjection.CreateGameplay(sourceLevel.Code, 4f / 3);
|
||||
var recovered = outside.Vertices.Count(vertex =>
|
||||
{
|
||||
var point = new Vector4(vertex.Position, 1);
|
||||
var current = Vector4.Transform(point, newMatrix);
|
||||
var previous = Vector4.Transform(point, oldMatrix);
|
||||
return current.W > 0 && MathF.Abs(current.X) <= current.W && MathF.Abs(current.Y) <= current.W
|
||||
&& current.Z >= 0 && current.Z <= current.W && previous.Z > previous.W;
|
||||
});
|
||||
Require(recovered > 100, "Actual outside geometry must demonstrate the old arbitrary far-plane cut");
|
||||
Console.WriteLine($"PASS actual LEV1 source view retains{recovered} vertices formerly beyond the incorrect3200 far plane");
|
||||
Console.WriteLine("Projection recovery is statically verified; original-game visual comparison and per-layer/fog fidelity remain separate.");
|
||||
|
||||
void Bytes(int address, string expected)
|
||||
{
|
||||
var bytes = Convert.FromHexString(expected);
|
||||
Require(executable.AsSpan(address - 0x400000, bytes.Length).SequenceEqual(bytes), $"Source clip instruction differs at{address:X}");
|
||||
}
|
||||
static void Require(bool condition, string message) { if (!condition) throw new InvalidOperationException(message); }
|
||||
@@ -16,6 +16,12 @@ class AirSteeringEvidence(unittest.TestCase):
|
||||
self.assertEqual(raw[0x38b76:0x38b7c], bytes.fromhex('ff9228010000'))
|
||||
self.assertEqual(struct.unpack_from('<I', raw, 0xa3bdc+0x128)[0], 0x439900)
|
||||
|
||||
def test_grounded_outer_reset_clears_air_turn_in_interface_coordinates(self):
|
||||
raw = EXE.read_bytes()
|
||||
self.assertEqual(raw[0x37b9e:0x37bb2], bytes.fromhex(
|
||||
'66899e2807000066899e04070000899e14060000'))
|
||||
self.assertEqual(0xc0+0x614, 0x6d4)
|
||||
|
||||
def test_source_air_input_constants_and_decisive_instructions(self):
|
||||
raw = EXE.read_bytes()
|
||||
for address, value in [(0x48d96c,100), (0x48d948,.5), (0x4afd28,-30),
|
||||
|
||||
Reference in new issue
Block a user