Implement evidence-backed VR02 Rocketship flight and ownership

This commit is contained in:
UnixNight committed 2026-11-03 16:42:09 -05:00
1 parent 312efccb77
commit e77add5fdf
50 files changed
+4326 -66

No files matched your search

+2 -1
View File
@@ -83,7 +83,8 @@ Require(menu.Key(40)==DebugAction.GiveAllGadgets && menu.Key(40,true)==DebugActi
var allGadgetsView=menu.View(new("LV1B","STARTEXP",Vector3.Zero,0,0,true,20,0,30,"NONE",true,0,10000,false));
Require(allGadgetsView.Lines.Length<=32 && allGadgetsView.Lines[allGadgetsView.SelectedLine]=="GIVE ALL GADGETS",
"Last player action remains visible within the widescreen overlay capacity");
menu.Key(81); Require(menu.Selected==0,"Player navigation wraps after Give All Gadgets");
menu.Key(81);Require(menu.Key(40)==DebugAction.GiveRocketship,"Player tools expose Rocketship after Give All Gadgets");
menu.Key(81); Require(menu.Selected==0,"Player navigation wraps after Rocketship");
Console.WriteLine("PASS Give All Gadgets navigation, repeat handling and overlay bounds");
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
@@ -1,8 +1,9 @@
<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/Assets/*.cs"/>
<ItemGroup><Compile Include="Program.cs"/><Compile Include="MotionReferences.cs"/><Compile Include="../../src/GamePort/Assets/*.cs"/>
<Compile Include="../../src/GamePort/Game/*.cs"/></ItemGroup>
<ItemGroup><Content Include="original-input-reference.json" CopyToOutputDirectory="PreserveNewest"/>
<Content Include="original-vertical-reference.json" CopyToOutputDirectory="PreserveNewest"/></ItemGroup>
<ItemGroup><Content Include="original-motion-reference.json" CopyToOutputDirectory="PreserveNewest"/></ItemGroup>
</Project>
@@ -0,0 +1,65 @@
using System.Numerics;
using System.Text.Json;
using GamePort.Game;
static class MotionReferences
{
public static void Run()
{
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-motion-reference.json")));
var cases=doc.RootElement.GetProperty("cases");
if(cases.GetArrayLength()!=31)throw new Exception("Expected31 original motion/camera references");
foreach(var item in cases.EnumerateArray())
{
var p=item.GetProperty("values");var label=item.GetProperty("name").GetString()!;
float F(string name)=>p.GetProperty(name).GetSingle();
Vector3 V(string name){var a=p.GetProperty(name);return new(a[0].GetSingle(),a[1].GetSingle(),a[2].GetSingle());}
var kind=item.GetProperty("kind").GetString();
if(kind=="TRANSFORM")
{
Near(RocketOrientation.Rotate(V("vector"),V("euler")),V("observed"),label);
Near(Vector3.Transform(V("vector"),RocketOrientation.Model(V("euler"),Vector3.Zero,Vector3.One)),V("observed"),label+" model");
}
else if(kind=="MOTION")
{
var actual=RocketMotion.Apply(V("incoming"),V("euler"),F("speed"),F("bank"),F("previous"),F("dt"));
Near(actual.Velocity,V("observed_velocity"),label);Near(actual.Rotation,V("observed_rotation"),label);
Near(actual.PreviousBank,F("observed_previous"),label);
}
else if(kind=="AUX")
{
var timers=p.GetProperty("timer");var latches=p.GetProperty("latch");var pressed=p.GetProperty("pressed");
var actual=RocketMotion.Apply(new(10,F("vy"),100),Vector3.Zero,400,16,7,F("dt"),
new(timers[0].GetSingle(),timers[1].GetSingle(),latches[0].GetSingle()!=0,latches[1].GetSingle()!=0),
pressed[0].GetSingle()!=0,pressed[1].GetSingle()!=0,F("suppressed")!=0);
Near(actual.Velocity,V("observed_velocity"),label);Near(actual.Rotation,V("observed_rotation"),label);
Near(actual.PreviousBank,F("observed_previous"),label);
var expected=p.GetProperty("observed_timer");var expectedLatch=p.GetProperty("observed_latch");
Near(actual.Maneuver.TurnRemaining,expected[0].GetSingle(),label);Near(actual.Maneuver.RollRemaining,expected[1].GetSingle(),label);
if(actual.Maneuver.TurnLatched!=(expectedLatch[0].GetSingle()!=0)||actual.Maneuver.RollLatched!=(expectedLatch[1].GetSingle()!=0))
throw new Exception(label+" original latch mismatch");
}
else if(kind=="FACING")Near(RocketOrientation.Face(V("euler"),V("dest"),F("dt")),V("observed_rotation"),label);
else if(kind=="CAMERA")
{
Vector3 start=default,end=default;
SupportHit? Ray(Vector3 a,Vector3 b){start=a;end=b;return F("hit")!=0?new(new(80,250,100),0,0,0):null;}
var actual=RocketMotion.Follow(new(100,200,300),V("euler"),V("old"),F("dt"),Ray,(int)F("detail"));
Near(start,V("trace_start"),label+" origin");Near(end,V("trace_end"),label+" endpoint");
Near(actual.Eye,V("observed_eye"),label+" eye");
if(actual.Pitch!=(int)F("pitch")||actual.Yaw!=(int)F("yaw"))throw new Exception($"{label} angles {actual.Pitch},{actual.Yaw}");
}
else throw new Exception("Unknown original fixture kind");
}
}
static void Near(Vector3 actual,Vector3 expected,string label)
{
Near(actual.X,expected.X,label+" X");Near(actual.Y,expected.Y,label+" Y");Near(actual.Z,expected.Z,label+" Z");
}
static void Near(float actual,float expected,string label)
{
if(!float.IsFinite(actual)||!float.IsFinite(expected)||MathF.Abs(actual-expected)>.002f)
throw new Exception($"{label}: {actual} != {expected}");
}
}
@@ -15,6 +15,7 @@ var checks = new (string Name, Action Check)[]
("low scalar retains acceleration and skips height clamp", LowSpeed),
("fourteen copied-original input-prefix numeric references", OriginalReferences),
("fourteen copied-original vertical-suffix numeric references", OriginalVerticalReferences),
("31 copied-original transform/motion/maneuver/facing/camera cases", MotionReferences.Run),
("state, tuning and timestep admission", Invalid),
};
foreach (var (name, check) in checks) { check(); Console.WriteLine($"PASS {name}"); }
@@ -0,0 +1,964 @@
{
"scope": "Copied EXE motion/facing/camera and copied OMT trig/angles; synthetic actor/body/ray/input dependencies; no game entrypoint",
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"dll_sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943",
"generator_sha256": "888a8cf1d3b85a8cce67fff3187b3c5d0c53d2ce6b88ae30d8eb1f92ff030d30",
"executable_sha256": "d30b5ca51e6913f3044d639dd3bc0396abc835be35766df4395bb2b192cb4e5d",
"log_sha256": "e4162e49430d1b995809e7bbba98cbadb37a6ace2b395f3245f5df1599917249",
"cases": [
{
"kind": "TRANSFORM",
"name": "forward",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"vector": [
0.0,
0.0,
100.0
],
"observed": [
0.0,
0.0,
100.0
]
}
},
{
"kind": "TRANSFORM",
"name": "yaw90",
"values": {
"euler": [
0.0,
90.0,
0.0
],
"vector": [
0.0,
0.0,
100.0
],
"observed": [
-100.0,
0.0,
0.0
]
}
},
{
"kind": "TRANSFORM",
"name": "pitch20",
"values": {
"euler": [
20.0,
0.0,
0.0
],
"vector": [
0.0,
0.0,
100.0
],
"observed": [
0.0,
34.1940079,
93.9721756
]
}
},
{
"kind": "TRANSFORM",
"name": "roll45",
"values": {
"euler": [
0.0,
0.0,
45.0
],
"vector": [
10.0,
20.0,
30.0
],
"observed": [
21.2132034,
7.07106781,
30.0
]
}
},
{
"kind": "TRANSFORM",
"name": "combined",
"values": {
"euler": [
20.0,
70.0,
35.0
],
"vector": [
10.0,
20.0,
30.0
],
"observed": [
-16.336235,
20.2699776,
26.8748093
]
}
},
{
"kind": "TRANSFORM",
"name": "negative",
"values": {
"euler": [
-20.0,
-70.0,
-35.0
],
"vector": [
10.0,
20.0,
30.0
],
"observed": [
32.4752121,
10.5283689,
15.3138475
]
}
},
{
"kind": "MOTION",
"name": "stationary",
"values": {
"incoming": [
0.0,
0.0,
0.0
],
"euler": [
0.0,
0.0,
0.0
],
"speed": 400.0,
"bank": 16.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
0.0,
0.0,
0.0
],
"observed_velocity": [
0.0,
0.0,
400.0
],
"observed_previous": 7.0
}
},
{
"kind": "MOTION",
"name": "vertical_only",
"values": {
"incoming": [
0.0,
10.0,
0.0
],
"euler": [
0.0,
0.0,
0.0
],
"speed": 400.0,
"bank": 16.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
0.0,
1.60000002,
0.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_previous": 16.0
}
},
{
"kind": "MOTION",
"name": "left",
"values": {
"incoming": [
0.0,
0.0,
100.0
],
"euler": [
0.0,
0.0,
0.0
],
"speed": 400.0,
"bank": 16.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
0.0,
1.60000002,
0.0
],
"observed_velocity": [
12.2205973,
0.0,
400.490051
],
"observed_previous": 16.0
}
},
{
"kind": "MOTION",
"name": "right_seam",
"values": {
"incoming": [
0.0,
0.0,
100.0
],
"euler": [
0.0,
0.0,
0.0
],
"speed": 400.0,
"bank": -16.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
0.0,
359.0,
0.0
],
"observed_velocity": [
-16.2131596,
0.0,
400.348297
],
"observed_previous": -16.0
}
},
{
"kind": "MOTION",
"name": "pitch",
"values": {
"incoming": [
0.0,
0.0,
100.0
],
"euler": [
20.0,
70.0,
0.0
],
"speed": 1000.0,
"bank": 0.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
20.0,
70.0,
0.0
],
"observed_velocity": [
-882.953735,
0.0,
321.667145
],
"observed_previous": 0.0
}
},
{
"kind": "MOTION",
"name": "all_euler",
"values": {
"incoming": [
0.0,
10.0,
100.0
],
"euler": [
20.0,
70.0,
35.0
],
"speed": 1000.0,
"bank": 25.0,
"previous": 7.0,
"dt": 0.0166666675,
"observed_rotation": [
20.0,
70.4166641,
35.0
],
"observed_velocity": [
-854.779053,
10.0,
400.866882
],
"observed_previous": 25.0
}
},
{
"kind": "MOTION",
"name": "retained_bank_no_motion",
"values": {
"incoming": [
0.0,
0.0,
0.0
],
"euler": [
20.0,
70.0,
35.0
],
"speed": 1000.0,
"bank": 25.0,
"previous": 7.0,
"dt": 0.100000001,
"observed_rotation": [
20.0,
70.0,
35.0
],
"observed_velocity": [
-882.953735,
0.0,
321.667145
],
"observed_previous": 7.0
}
},
{
"kind": "AUX",
"name": "turn_start",
"values": {
"timer": [
0.0,
0.0
],
"pressed": [
1.0,
0.0
],
"latch": [
0.0,
0.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
18.0,
0.0
],
"observed_velocity": [
10.0,
10.0,
100.0
],
"observed_timer": [
0.899999976,
0.0
],
"observed_latch": [
1.0,
0.0
],
"observed_previous": 7.0
}
},
{
"kind": "AUX",
"name": "roll_start",
"values": {
"timer": [
0.0,
0.0
],
"pressed": [
0.0,
1.0
],
"latch": [
0.0,
0.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
1.60000002,
27.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_timer": [
0.0,
0.899999976
],
"observed_latch": [
0.0,
1.0
],
"observed_previous": 16.0
}
},
{
"kind": "AUX",
"name": "turn_finish",
"values": {
"timer": [
0.0500000007,
0.0
],
"pressed": [
1.0,
0.0
],
"latch": [
1.0,
0.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
18.0,
0.0
],
"observed_velocity": [
-113.893898,
10.0,
383.577667
],
"observed_timer": [
0.0,
0.0
],
"observed_latch": [
1.0,
0.0
],
"observed_previous": 7.0
}
},
{
"kind": "AUX",
"name": "roll_finish",
"values": {
"timer": [
0.0,
0.0500000007
],
"pressed": [
0.0,
1.0
],
"latch": [
0.0,
1.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
1.60000002,
27.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_timer": [
0.0,
0.0
],
"observed_latch": [
0.0,
1.0
],
"observed_previous": 16.0
}
},
{
"kind": "AUX",
"name": "held_no_restart",
"values": {
"timer": [
0.0,
0.0
],
"pressed": [
1.0,
0.0
],
"latch": [
1.0,
0.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
1.60000002,
0.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_timer": [
0.0,
0.0
],
"observed_latch": [
1.0,
0.0
],
"observed_previous": 16.0
}
},
{
"kind": "AUX",
"name": "released",
"values": {
"timer": [
0.0,
0.0
],
"pressed": [
0.0,
0.0
],
"latch": [
1.0,
1.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 0.0,
"observed_rotation": [
0.0,
1.60000002,
0.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_timer": [
0.0,
0.0
],
"observed_latch": [
0.0,
0.0
],
"observed_previous": 16.0
}
},
{
"kind": "AUX",
"name": "suppressed",
"values": {
"timer": [
0.0,
0.0
],
"pressed": [
1.0,
1.0
],
"latch": [
0.0,
0.0
],
"vy": 10.0,
"dt": 0.100000001,
"suppressed": 1.0,
"observed_rotation": [
0.0,
1.60000002,
0.0
],
"observed_velocity": [
12.2205973,
10.0,
400.490051
],
"observed_timer": [
0.0,
0.0
],
"observed_latch": [
0.0,
0.0
],
"observed_previous": 16.0
}
},
{
"kind": "FACING",
"name": "normal",
"values": {
"euler": [
0.0,
20.0,
0.0
],
"dest": [
20.0,
20.0,
-16.0
],
"dt": 0.100000001,
"observed_rotation": [
4.0,
20.0,
356.0
],
"active": 1.0
}
},
{
"kind": "FACING",
"name": "wrap",
"values": {
"euler": [
350.0,
359.0,
350.0
],
"dest": [
10.0,
1.0,
10.0
],
"dt": 0.100000001,
"observed_rotation": [
354.0,
215.800003,
356.0
],
"active": 1.0
}
},
{
"kind": "FACING",
"name": "negative_yaw_delta",
"values": {
"euler": [
0.0,
359.0,
0.0
],
"dest": [
0.0,
1.0,
0.0
],
"dt": 0.100000001,
"observed_rotation": [
0.0,
215.800003,
0.0
],
"active": 1.0
}
},
{
"kind": "FACING",
"name": "same",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"dest": [
0.0,
0.0,
0.0
],
"dt": 0.100000001,
"observed_rotation": [
0.0,
0.0,
0.0
],
"active": 0.0
}
},
{
"kind": "FACING",
"name": "negative_fraction",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"dest": [
-0.5,
0.0,
-0.5
],
"dt": 0.100000001,
"observed_rotation": [
360.0,
0.0,
360.0
],
"active": 1.0
}
},
{
"kind": "CAMERA",
"name": "straight",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.100000001,
"detail": 0.0,
"hit": 0.0,
"observed_eye": [
-31.6000004,
71.0,
-106.0
],
"pitch": 819.0,
"yaw": -597.0,
"trace_start": [
100.0,
250.0,
500.0
],
"trace_end": [
100.0,
400.0,
-200.0
]
}
},
{
"kind": "CAMERA",
"name": "detail1",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.100000001,
"detail": 1.0,
"hit": 0.0,
"observed_eye": [
-31.6000004,
71.0,
-106.0
],
"pitch": 819.0,
"yaw": -597.0,
"trace_start": [
100.0,
250.0,
500.0
],
"trace_end": [
100.0,
400.0,
-200.0
]
}
},
{
"kind": "CAMERA",
"name": "detail2",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.100000001,
"detail": 2.0,
"hit": 0.0,
"observed_eye": [
-23.1999989,
92.0,
-112.0
],
"pitch": 819.0,
"yaw": -597.0,
"trace_start": [
100.0,
250.0,
500.0
],
"trace_end": [
100.0,
400.0,
-200.0
]
}
},
{
"kind": "CAMERA",
"name": "blocked",
"values": {
"euler": [
0.0,
0.0,
0.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.100000001,
"detail": 0.0,
"hit": 1.0,
"observed_eye": [
-25.0,
74.0,
-63.9999962
],
"pitch": 819.0,
"yaw": -597.0,
"trace_start": [
100.0,
250.0,
500.0
],
"trace_end": [
100.0,
400.0,
-200.0
]
}
},
{
"kind": "CAMERA",
"name": "combined",
"values": {
"euler": [
20.0,
70.0,
35.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.0166666675,
"detail": 0.0,
"hit": 0.0,
"observed_eye": [
-33.2662659,
51.3302155,
-96.7228088
],
"pitch": 1267.0,
"yaw": 73.0,
"trace_start": [
-53.6166077,
306.885956,
386.471588
],
"trace_end": [
633.373413,
183.021698,
227.71904
]
}
},
{
"kind": "CAMERA",
"name": "combined_blocked",
"values": {
"euler": [
20.0,
70.0,
35.0
],
"old": [
-40.0,
50.0,
-100.0
],
"dt": 0.0166666675,
"detail": 2.0,
"hit": 1.0,
"observed_eye": [
-36.5361671,
58.5688629,
-89.1352844
],
"pitch": 1267.0,
"yaw": 73.0,
"trace_start": [
-53.6166077,
306.885956,
386.471588
],
"trace_end": [
633.373413,
183.021698,
227.71904
]
}
}
]
}
@@ -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/Assets/*.cs"/>
<Compile Include="../../src/GamePort/Game/*.cs"/>
<Compile Include="../../src/GamePort/Application/PlayerGadgetMaterial.cs"/>
<Compile Include="../../src/GamePort/Application/RocketshipVisuals.cs"/></ItemGroup>
</Project>
+158
View File
@@ -0,0 +1,158 @@
using System.Numerics;
using GamePort.Assets;
using GamePort.Game;
using GamePort.Application;
var tests=new(string,Action)[]{
("owned actor handoff and actual passenger/body phases",Ownership),
("fresh versus retained input registration order",InputOrder),
("release/remount preserves ship motion and stops engine",Remount),
("vehicle Tab access uses rider menu callback",Menu),
("noclip releases vehicle and scene reset clears its state",ResetAndNoclip),
("debug force-control preserves mounted input and authored ownership",ForcedControl),
("named Jimmy cutscene cleanup releases the controlled vehicle",Cutscene),
("six copied-original50/.6 support references",Support),
("Rocket ceiling370 preserves acceleration and forces minus120",Ceiling),
("Rocket wall374 does not inherit horizontal reflection",Wall),
("actual passenger can activate RETURN while ship owns control",Return),
("exact four resource families and additive fire visibility",Visuals),
};
foreach(var(name,check)in tests){check();Console.WriteLine("PASS "+name);}
Console.WriteLine($"Rocketship integration: {tests.Length} groups passed; bounded static VR02, not original whole-game verification.");
static void Ownership()
{
using var f=new Fixture();var root=f.Player.ActorRoot;f.Mount();
Check(f.Director.ControlledTag==f.Ship.Actor.Tag&&!f.Director.Controlled&&f.Binding.InventoryControlled,"ship ownership/menu");
Near(f.Ship.Root,root,"owned ship uses Jimmy root, not authored ship placement");
int body=f.Player.PhysicsSteps,controller=f.Player.ControllerSteps;
for(int i=0;i<20;i++)f.Binding.Step(new(true,false,false,false,false));
Check(f.Player.PhysicsSteps==body+20&&f.Player.ControllerSteps==controller,"passenger static physics remains live without controller");
Near(f.Player.ActorRoot,f.Ship.Root,"passenger copied after its own physics");
Check(f.Ship.InputSteps==20&&f.Ship.Steering.Speed==1400&&f.Player.Energy==20,"flight input/tutorial energy");
}
static void InputOrder()
{
using var fresh=new Fixture();using var retained=new Fixture();retained.Player.InputAfterPlayerUpdate=true;
fresh.Mount();retained.Mount();var input=new PlayerInput(true,false,false,false,false);
fresh.Binding.Step(input);retained.Binding.Step(input);
Check(fresh.Ship.Velocity.Z>300&&retained.Ship.Velocity.Z==0,"fresh input precedes apply, retained follows");
Check(fresh.Ship.Steering.Speed==400&&retained.Ship.Steering.Speed==400,"same stored scalar, different publication phase");
}
static void Remount()
{
using var f=new Fixture();var sounds=new List<int>();int stopped=0;
f.Ship.EngineSound+=sounds.Add;f.Ship.EngineStopped+=()=>stopped++;
f.Mount();for(int i=0;i<12;i++)f.Binding.Step(new(true,false,false,false,false));
var velocity=f.Ship.Velocity;var scalar=f.Ship.Steering.Speed;var root=f.Player.ActorRoot;
f.Interactions.Inventory.SelectGadget(-1);
Check(!f.Ship.Mounted&&f.Director.Controlled&&f.Player.GadgetMode==-1&&f.Ship.EngineMode==0,"cleanup owners/engine");
Near(f.Player.ActorRoot,root,"cleanup retains copied root");Near(f.Player.Velocity,Vector3.Zero,"cleanup clears Jimmy velocity");
f.Interactions.Inventory.SelectGadget(1);
Near(f.Ship.Velocity,velocity,"remount retains ship velocity");Check(f.Ship.Steering.Speed==scalar,"remount retains scalar");
Check(sounds.SequenceEqual(new[]{196})&&stopped==1,"unchanged engine mode does not restart; cleanup stops once");
}
static void Menu()
{
using var f=new Fixture();f.Mount();var screen=new GadgetScreen(f.Interactions.Inventory,()=>f.Player.GadgetMode);
Check(screen.Toggle(f.Binding.InventoryControlled)&&!screen.Open&&!f.Ship.Mounted,"firstTab unequips ship");
Check(screen.Toggle(f.Binding.InventoryControlled)&&screen.Open,"secondTab opens panel");
}
static void ResetAndNoclip()
{
using var f=new Fixture();f.Mount();f.Player.SetNoclip(true);f.Binding.Step(default);
Check(!f.Ship.Mounted&&f.Player.Noclip&&f.Director.Controlled&&f.Ship.EngineMode==0,"noclip cleanup");
f.Binding.ResetVehicle();Check(f.Ship.FrameSteps==0&&!f.Ship.Actor.Visible,"scene reset clears owned state");
}
static void ForcedControl()
{
using var f=new Fixture();f.Mount();f.Binding.Step(new(true,false,false,false,false));
int input=f.Ship.InputSteps;f.Director.DebugForceControl=true;
f.Binding.Step(new(false,true,false,false,false));
Check(f.Ship.InputSteps==input+1&&f.Ship.Steering.Down,"mounted pilot still receives forced input");
Check(f.Ship.Mounted&&f.Director.AuthoredControlledTag==f.Ship.Actor.Tag,"force override preserves authored ship owner");
f.Director.DebugForceControl=false;Check(f.Director.ControlledTag==f.Ship.Actor.Tag,"disabling override restores effective ship owner");
}
static void Cutscene()
{
using var f=new Fixture();f.Mount();f.Binding.Step(new(true,false,false,false,false));
f.Director.Trigger("rs");
Check(!f.Ship.Mounted&&f.Player.GadgetMode==-1&&f.Ship.EngineMode==0&&!f.Ship.FireVisible,"MCA named-Jimmy cleanup releases ship/engine/fire");
}
static void Support()
{
var floor=new CameraRayPolygon(new(new(-1000,0,-1000),new(1000,0,-1000),new(0,0,1000)),Vector3.UnitY);
var physics=new OriginalBodyPhysics(new([floor]));
var cases=new(float Y,Vector3 Velocity,bool Supported,float Published,Vector3 Root,Vector3 Out,bool Grounded)[]{
(30,Vector3.Zero,false,0,new(0,30.0000019f,0),Vector3.Zero,true),
(26,Vector3.Zero,false,0,new(0,30.0000019f,0),Vector3.Zero,true),
(75.9f,Vector3.Zero,false,0,new(0,75.6777802f,0),new(0,-13.333334f,0),false),
(30,new(0,300,0),false,0,new(0,34.7777786f,0),new(0,286.666656f,0),false),
(30,new(120,0,-60),true,0,new(2,30.0000019f,-1),new(118.400002f,0,-59.2000008f),true),
(30,new(120,0,-60),true,100,new(2,30.0000019f,-1),new(120,0,-60),true),
};
foreach(var c in cases)
{
var r=physics.Step(new(new(0,c.Y,0),c.Velocity,Vector3.Zero,Vector3.Zero,c.Supported,c.Published),1f/60,50,.6f,profile:BodyResponseProfile.Rocketship);
Near(r.Body.Position,c.Root,"original root");Near(r.Body.Velocity,c.Out,"original velocity");Check(r.Body.Supported==c.Grounded,"original support");
}
}
static void Ceiling()
{
var ceiling=new CameraRayPolygon(new(new(-1000,300,-1000),new(1000,300,1000),new(1000,300,-1000)),-Vector3.UnitY);
var p=new OriginalBodyPhysics(new([ceiling]));var acceleration=new Vector3(3,1800,5);
var result=p.Step(new(new(100,249,0),new(0,200,0),acceleration,Vector3.Zero),1f/60,50,.6f,profile:BodyResponseProfile.Rocketship);
Check(result.Contact.HasValue&&result.Body.Velocity.Y==-120,$"source370 unconditional downward velocity: contact={result.Contact?.StoredNormal} body={result.Body}");
Near(result.Body.Acceleration,acceleration,"source370 retains acceleration");
}
static void Wall()
{
var wall=new CameraRayPolygon(new(new(0,-1000,-1000),new(0,1000,-1000),new(0,1000,1000)),-Vector3.UnitX,MaterialId:0);
var p=new OriginalBodyPhysics(new([wall]));
var result=p.Step(new(new(-51,300,0),new(300,0,20),Vector3.Zero,Vector3.Zero),1f/60,50,.6f,profile:BodyResponseProfile.Rocketship);
Check(result.Contact.HasValue&&MathF.Abs(result.Body.Velocity.X-300)<.001f&&MathF.Abs(result.Body.Velocity.Z-20)<.001f,$"no invented generic reflection: contact={result.Contact?.StoredNormal}, body={result.Body}");
}
static void Return()
{
using var f=new Fixture();LevelTransition? transition=null;f.Interactions.Transition+=t=>transition=t;
f.Interactions.SetReturnContext("level1b.gam","STARTEXP");f.Mount();
var exit=f.Director.Actors.Single(a=>a.Kind=="LOAD");
f.Ship.Mount(exit.Position,Vector3.Zero,f.Player.CameraEye);f.Binding.Step(default);
f.Interactions.Update(f.Player.ActorRoot,f.Player.InteractionRadius,f.Ship.Actor);
Check(transition is{Returning:true,LevelFile:"level1b.gam",StartPoint:"STARTEXP"},"passenger LOAD gate resolves stored RETURN");
}
static void Visuals()
{
using var f=new Fixture();var visuals=new RocketshipVisuals(f.World,Path.GetFullPath("artifacts/extracted"));
visuals.Update(visuals.Mesh,f.Ship,0,f.Player.Appearance);Check(visuals.Mesh.Draws.TakeLast(4).All(d=>!d.Visible),"unmounted owned visuals hidden");
f.Mount();f.Binding.Step(new(true,false,false,false,false));visuals.Update(visuals.Mesh,f.Ship,.1,f.Player.Appearance);
Check(visuals.Mesh.Draws.TakeLast(4).All(d=>d.Visible)&&visuals.Mesh.Draws[^1].Blend==MeshBlend.Additive,"body/driver/dog/fire source layers");
f.Interactions.Inventory.SelectGadget(-1);visuals.Update(visuals.Mesh,f.Ship,.2,f.Player.Appearance);
Check(visuals.Mesh.Draws.TakeLast(4).All(d=>!d.Visible),"cleanup hides every owned layer");
}
static void Check(bool ok,string message){if(!ok)throw new Exception(message);}
static void Near(Vector3 actual,Vector3 expected,string message)=>Check(float.IsFinite(actual.X+actual.Y+actual.Z)&&Vector3.Distance(actual,expected)<.002f,$"{message}: {actual} != {expected}");
sealed class Fixture:IDisposable
{
public Mesh World {get;}=Mesh.LoadSceneJson("artifacts/extracted/VR02/scene.json");
public SceneDirector Director {get;}
public SceneInteractions Interactions {get;}
public LabSimulation Player {get;}
public Rocketship Ship {get;}
public PlayerSceneBinding Binding {get;}
public Fixture()
{
var level=GamLevel.Load("../Original/gam/VR02.gam");var save=OriginalSave.Load("../Original/NewGame.tsk");var tasks=new TaskStates(save.Tasks);
Director=new(level,tasks,(_,_)=>0);Interactions=new(Director,tasks,save);
var start=level.FindStart()!;Director.Begin(start,activateStartTrigger:false);
var ray=OriginalCameraRay.FromRouteScene(World,"VR02");
Player=new(new(World),new MorphAnimation("artifacts/extracted/animations/jimstop/animation.json").Base,start.Position,start.Rotation.Y,
(a,b)=>ray.Trace(a,b),(a,b)=>ray.TraceGeometry(a,b),OriginalStaticCollision.FromRouteScene(World,"VR02")){LevelCode="VR02"};
Director.SyncActor(level.Player!.Tag!,Player.ActorRoot,new(0,Player.Yaw,0));
Ship=new(Director.Actors.Single(a=>a.Kind=="3ROC"),World,"VR02");
Binding=new(Director,Player,Interactions.Inventory,level.Player.Tag!,Ship);
}
public void Mount(){Interactions.Inventory.SetState(0,1,1);Interactions.Inventory.SelectGadget(1);}
public void Dispose()=>Binding.Dispose();
}
+934
View File
@@ -0,0 +1,934 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"scope": "Copied370/374; body accessors, rider and audio synthetic",
"generator_sha256": "a98aa94ac55ec775d3378c7ba2fccdc5e3dd82ce4f03a453dd3f7c4286093c45",
"executable_sha256": "1052f2e4c1b34fe694811f86e8914b9437695527152825edfb05685427217660",
"log_sha256": "8958319c59218f83a114aceecf6cac958d412d3c4a09bac003b1c93c2ac9b7b0",
"cases": [
{
"name": "ceiling_up",
"input": {
"ceiling_velocity": 200.0
},
"observed": {
"velocity": [
11.0,
-120.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "ceiling_down",
"input": {
"ceiling_velocity": -900.0
},
"observed": {
"velocity": [
11.0,
-120.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "ceiling_zero",
"input": {
"ceiling_velocity": 0.0
},
"observed": {
"velocity": [
11.0,
-120.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "ordinary",
"input": {
"id": 0,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ordinary5",
"input": {
"id": 5,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "no_rider",
"input": {
"id": 0,
"rider": 0,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "no_polygon",
"input": {
"id": 0,
"rider": 1,
"polygon": 0,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "no_material",
"input": {
"id": 0,
"rider": 1,
"polygon": 1,
"material": 0,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "no_definition",
"input": {
"id": 170,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 0,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ignored170",
"input": {
"id": 170,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "ignored_minus1",
"input": {
"id": -1,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "strong130",
"input": {
"id": 130,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 5.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -10.0,
"points": -10.0,
"seconds": 5.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "strong139",
"input": {
"id": 139,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 5.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -10.0,
"points": -10.0,
"seconds": 5.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ordinary129",
"input": {
"id": 129,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ordinary140",
"input": {
"id": 140,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "special185",
"input": {
"id": 185,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 0
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 5.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -5.0,
"points": -5.0,
"seconds": 5.0,
"secondary": 1.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "special189",
"input": {
"id": 189,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 0
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 5.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -5.0,
"points": -5.0,
"seconds": 5.0,
"secondary": 1.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ordinary184",
"input": {
"id": 184,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "ordinary190",
"input": {
"id": 190,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -1.0,
"points": -1.0,
"seconds": 1.0,
"secondary": 0.0,
"sounds": 1.0,
"soundid": 197.0
}
},
{
"name": "active_ordinary",
"input": {
"id": 0,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 1,
"rider_latch": 0
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 0.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "active_strong",
"input": {
"id": 130,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 1,
"rider_latch": 0
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 0.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "flag_special",
"input": {
"id": 185,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 0,
"rider_latch": 1
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 0.0,
"timer": 2.5,
"duration": 13.0,
"impulse": 1.0,
"riderflag": 1.0,
"calls": 0.0,
"damage": 0.0,
"points": 0.0,
"seconds": 0.0,
"secondary": 0.0,
"sounds": 0.0,
"soundid": 0.0
}
},
{
"name": "active_special",
"input": {
"id": 185,
"rider": 1,
"polygon": 1,
"material": 1,
"definition": 1,
"active": 1,
"rider_latch": 0
},
"observed": {
"velocity": [
11.0,
200.0,
22.0
],
"acceleration": [
33.0,
444.0,
55.0
],
"root": [
66.0,
77.0,
88.0
],
"active": 1.0,
"timer": 0.0,
"duration": 5.0,
"impulse": 0.0,
"riderflag": 0.0,
"calls": 1.0,
"damage": -5.0,
"points": -5.0,
"seconds": 5.0,
"secondary": 1.0,
"sounds": 1.0,
"soundid": 197.0
}
}
]
}
+233
View File
@@ -0,0 +1,233 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"generator_sha256": "93b88ce32c11513756e9bba88de54a13ab077fda975cd33830f0fa53e66005e4",
"executable_sha256": "82c610faabee6c1278bfe733f63d67ac5095ad2b8ff30a823d946711d1004098",
"log_sha256": "8f286bd1c44c6cee8c2138bd3e77f4f89f241beec9b8773f7d361cfba034dcd4",
"scope": "Copied43E6E8..43E7DB impact suffix; synthetic rider/render/queued-impulse; no original game entrypoint",
"cases": [
{
"name": "inactive",
"input": {
"active": 0.0,
"timer": 0.75,
"duration": 1.0,
"strong": 0.0,
"dt": 0.10000000149011612,
"burst": 0.0
},
"observed": {
"active": 0.0,
"timer": 0.75,
"strong": 0.0,
"scale": [
1.25,
1.25,
1.25,
1.25
],
"drive": 0.0,
"count": 0.0,
"impulses": [
0.0,
0.0
]
}
},
{
"name": "ordinary",
"input": {
"active": 1.0,
"timer": 0.0,
"duration": 1.0,
"strong": 0.0,
"dt": 0.01666666753590107,
"burst": 0.0
},
"observed": {
"active": 1.0,
"timer": 0.0166666675,
"strong": 0.0,
"scale": [
1.0,
0.663597345,
0.663597345,
1.0
],
"drive": 0.0,
"count": 0.0,
"impulses": [
0.0,
0.0
]
}
},
{
"name": "equal",
"input": {
"active": 1.0,
"timer": 0.5,
"duration": 1.0,
"strong": 0.0,
"dt": 0.5,
"burst": 0.0
},
"observed": {
"active": 1.0,
"timer": 1.0,
"strong": 0.0,
"scale": [
1.0,
0.956472635,
0.956472635,
1.0
],
"drive": 0.0,
"count": 0.0,
"impulses": [
0.0,
0.0
]
}
},
{
"name": "expired",
"input": {
"active": 1.0,
"timer": 0.8999999761581421,
"duration": 1.0,
"strong": 0.0,
"dt": 0.20000000298023224,
"burst": 0.0
},
"observed": {
"active": 0.0,
"timer": 1.10000002,
"strong": 0.0,
"scale": [
1.0,
1.0,
1.0,
1.0
],
"drive": 1.0,
"count": 0.0,
"impulses": [
0.0,
0.0
]
}
},
{
"name": "strong",
"input": {
"active": 1.0,
"timer": 0.10000000149011612,
"duration": 1.0,
"strong": 1.0,
"dt": 0.10000000149011612,
"burst": 0.0
},
"observed": {
"active": 1.0,
"timer": 0.200000003,
"strong": 1.0,
"scale": [
1.0,
0.121598735,
0.121598735,
1.0
],
"drive": 0.0,
"count": 1.0,
"impulses": [
-700.0,
0.0
]
}
},
{
"name": "expired_both",
"input": {
"active": 1.0,
"timer": 1.0,
"duration": 1.0,
"strong": 1.0,
"dt": 0.10000000149011612,
"burst": 1.0
},
"observed": {
"active": 0.0,
"timer": 1.10000002,
"strong": 0.0,
"scale": [
1.0,
1.0,
1.0,
1.0
],
"drive": 1.0,
"count": 2.0,
"impulses": [
-700.0,
-750.0
]
}
},
{
"name": "inactive_burst",
"input": {
"active": 0.0,
"timer": 0.75,
"duration": 1.0,
"strong": 0.0,
"dt": 0.10000000149011612,
"burst": 1.0
},
"observed": {
"active": 0.0,
"timer": 0.75,
"strong": 0.0,
"scale": [
1.25,
1.25,
1.25,
1.25
],
"drive": 0.0,
"count": 1.0,
"impulses": [
-750.0,
0.0
]
}
},
{
"name": "rounded_expired",
"input": {
"active": 1.0,
"timer": 0.9999999403953552,
"duration": 1.0,
"strong": 0.0,
"dt": 1.0000000116860974e-07,
"burst": 0.0
},
"observed": {
"active": 0.0,
"timer": 1.0,
"strong": 0.0,
"scale": [
1.0,
1.0,
1.0,
1.0
],
"drive": 1.0,
"count": 0.0,
"impulses": [
0.0,
0.0
]
}
}
]
}
+49
View File
@@ -0,0 +1,49 @@
"""Guarded callbacks compared with23 isolated original observations."""
import json
from pathlib import Path
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from rocketship_body import collect,wall_effect,ceiling_velocity
class RocketBodyTests(unittest.TestCase):
def test_original_callbacks_flags_and_support_contract(self):
report=collect(ROOT.parent/'Original')
self.assertEqual(len(report['body_callbacks']),8)
self.assertTrue(report['prevent_lowering'])
self.assertFalse(report['flag137_is_integration_gate'])
self.assertFalse(report['wall_uses_reflection'])
self.assertAlmostEqual(report['support_clearance_f32'],30.0000019,places=5)
def test_23_copied_original_callback_cases(self):
reference=json.loads((ROOT/'tests/fixtures/rocket-body-reference.json').read_text())
self.assertEqual(len(reference['cases']),23)
self.assertEqual(reference['source_sha256'],collect(ROOT.parent/'Original')['sha256'])
for case in reference['cases']:
with self.subTest(case['name']):
p=case['input'];observed=case['observed']
if 'ceiling_velocity' in p:
actual=ceiling_velocity((11,p['ceiling_velocity'],22))
self.assertEqual(list(actual),observed['velocity'])
continue
effect=wall_effect(p['id'],rider=bool(p['rider']),polygon=bool(p['polygon']),material=bool(p['material']),
definition=bool(p['definition']),active=bool(p['active']),rider_latch=bool(p['rider_latch']))
self.assertEqual(observed['calls'],int(effect is not None))
if effect:
self.assertEqual(observed['damage'],effect.energy_delta)
self.assertEqual(observed['points'],effect.score_delta)
self.assertEqual(observed['duration'],effect.duration)
self.assertEqual(observed['soundid'],effect.sound)
self.assertEqual(observed['secondary'],int(effect.secondary_rider_callback))
self.assertEqual(observed['velocity'],[11,200,22])
def test_missing_material_and_missing_definition_are_distinct(self):
self.assertIsNone(wall_effect(0,material=False))
self.assertIsNotNone(wall_effect(170,definition=False))
self.assertIsNone(wall_effect(170))
if __name__=='__main__':unittest.main()
+86
View File
@@ -0,0 +1,86 @@
"""Source lifecycle guards and bounded projections; no original lifecycle run."""
from pathlib import Path
import json
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from rocketship_lifecycle import (ROCKET_ID,collect,engine_input,engine_transition,
impact_tail,resolve_reused)
class RocketLifecycleTests(unittest.TestCase):
def test_eight_copied_original_impact_suffix_cases(self):
reference=json.loads((ROOT/'tests/fixtures/rocket-impact-reference.json').read_text())
self.assertEqual(len(reference['cases']),8)
for case in reference['cases']:
with self.subTest(case['name']):
p=case['input'];actual=impact_tail(bool(p['active']),p['timer'],p['duration'],bool(p['strong']),p['dt'],bool(p['burst']))
observed=case['observed']
self.assertEqual(actual['active'],bool(observed['active']))
self.assertEqual(actual['select_drive'],bool(observed['drive']))
self.assertAlmostEqual(actual['timer'],observed['timer'],places=5)
self.assertEqual(actual['queued_y'],observed['impulses'][:int(observed['count'])])
if actual['scale'] is not None:
for a,b in zip(actual['scale'],observed['scale'],strict=True):self.assertAlmostEqual(a,b,places=5)
def test_source_identity_bindings_and_pointer_bases(self):
report=collect(ROOT.parent/'Original')
self.assertEqual(len(report['bodies']),15)
self.assertEqual(len(report['virtuals']),6)
self.assertEqual(report['companion_local'],[0,10,-25])
self.assertEqual(report['rider_local'],[0,0,0])
self.assertTrue(all(int(b['va'],16)-int(b['file_offset'],16)==0x400000 for b in report['bodies']))
def test_serialized_rocket_reuses_owned_first_id_not_nearest_or_tag(self):
entries=[('Jimmy',0x334a494d,True),('owned',ROCKET_ID,True),('other',ROCKET_ID,True)]
self.assertEqual(resolve_reused(entries),'owned')
self.assertIsNone(resolve_reused([('unowned',ROCKET_ID,False)]))
def test_lookup_is_distinct_from_reusable_predicate(self):
self.assertEqual(resolve_reused([('first',ROCKET_ID,False),('later',ROCKET_ID,True)]),'first')
def test_engine_input_priority_and_stopped_coast(self):
self.assertEqual(engine_input(True,True,0),2)
self.assertEqual(engine_input(False,True,1400),0)
self.assertEqual(engine_input(False,False,1),1)
self.assertEqual(engine_input(False,False,0),0)
def test_engine_stops_old_handle_before_changing_modes(self):
self.assertEqual(engine_transition(1,True,2),dict(stop=True,start=196,mode=2))
self.assertEqual(engine_transition(2,True,1),dict(stop=True,start=195,mode=1))
self.assertEqual(engine_transition(2,True,0),dict(stop=True,start=None,mode=0))
def test_same_mode_does_not_restart_missing_handle(self):
self.assertEqual(engine_transition(2,False,2),dict(stop=False,start=None,mode=2))
self.assertEqual(engine_transition(0,False,1),dict(stop=False,start=195,mode=1))
def test_exact_duration_remains_active_and_preserves_scale_axes(self):
result=impact_tail(True,.5,1,False,.5)
self.assertTrue(result['active'])
self.assertFalse(result['select_drive'])
self.assertEqual((result['scale'][0],result['scale'][3]),(1.,1.))
self.assertEqual(result['scale'][1],result['scale'][2])
self.assertEqual(result['queued_y'],[])
def test_expiry_keeps_pre_expiry_impulse_order_then_drive_burst(self):
result=impact_tail(True,1,1,True,.1,True)
self.assertFalse(result['active'])
self.assertFalse(result['impulse_flag'])
self.assertTrue(result['select_drive'])
self.assertEqual(result['scale'],(1.,1.,1.,1.))
self.assertEqual(result['queued_y'],[-700.,-750.])
def test_inactive_tail_retains_scale_and_timer(self):
result=impact_tail(False,.75,1,False,.1)
self.assertIsNone(result['scale'])
self.assertEqual(result['timer'],.75)
def test_invalid_projection_states_rejected(self):
with self.assertRaises(ValueError):engine_transition(0,False,3)
with self.assertRaises(ValueError):engine_input(False,False,float('nan'))
with self.assertRaises(ValueError):impact_tail(True,0,1,False,1)
if __name__=='__main__':unittest.main()
+44
View File
@@ -0,0 +1,44 @@
"""Source guards and31 captured component cases, not original gameplay."""
import json
from pathlib import Path
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from rocketship_motion_camera import collect,rotate,facing,horizontal,camera
class RocketMotionTests(unittest.TestCase):
def vector(self,actual,expected):
for a,b in zip(actual,expected,strict=True):self.assertAlmostEqual(a,b,delta=.002)
def test_guarded_source_both_original_images_and_dispatch(self):
report=collect(ROOT.parent/'Original')
self.assertEqual(len(report['bodies']),10)
self.assertEqual(len(report['vtables']),7)
self.assertTrue(all(int(b['va'],16)-int(b['file_offset'],16)==0x400000 for b in report['bodies']))
def test_31_original_transform_motion_facing_and_camera_cases(self):
reference=json.loads((ROOT/'tests/GamePort.RocketFlightTests/original-motion-reference.json').read_text())
self.assertEqual(len(reference['cases']),31)
for case in reference['cases']:
with self.subTest(case['name']):
p=case['values'];kind=case['kind']
if kind=='TRANSFORM':self.vector(rotate(p['vector'],p['euler']),p['observed'])
elif kind=='FACING':self.vector(facing(p['euler'],p['dest'],p['dt'])[0],p['observed_rotation'])
elif kind in ('MOTION','AUX'):
if kind=='MOTION':
actual=horizontal(p['incoming'],p['euler'],p['speed'],p['bank'],p['previous'],p['dt'])
else:
actual=horizontal((10,p['vy'],100),(0,0,0),400,16,7,p['dt'],turn_timer=p['timer'][0],roll_timer=p['timer'][1],
turn_latch=bool(p['latch'][0]),roll_latch=bool(p['latch'][1]),turn_pressed=bool(p['pressed'][0]),
roll_pressed=bool(p['pressed'][1]),suppressed=bool(p['suppressed']))
self.vector((actual['turn_timer'],actual['roll_timer']),p['observed_timer'])
self.vector(actual['rotation'],p['observed_rotation']);self.vector(actual['velocity'],p['observed_velocity'])
self.assertAlmostEqual(actual['previous_bank'],p['observed_previous'],delta=.002)
elif kind=='CAMERA':
actual=camera((100,200,300),p['euler'],p['old'],p['dt'],p['detail'],(80,250,100)if p['hit']else None)
self.vector(actual['eye'],p['observed_eye']);self.vector(actual['look'],p['trace_start'])
self.assertEqual((actual['pitch'],actual['yaw']),(p['pitch'],p['yaw']))
else:self.fail('Unknown component case')