diff --git a/AGENTS.md b/AGENTS.md
index 7ea1423..83e1e8a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -46,14 +46,17 @@ changes. Current gadget controls/resources/primary-fire findings belong in
docs/gameplay/. Distinguish static recovery, implementation, port tests and original
runtime evidence. Main owns integration/runtime; gadget investigators have
exclusive named files, not shared directories.
-Latest continuation: docs/gameplay/rocketship-component.md. Rocketship input and
-vertical arithmetic are isolated/tested against28 copied-original observations;
-the vehicle is not live. Close its aircraft collision, Euler/camera and owned
-helper/attachment lifecycle gates before VR02 integration. Grappler source is in
+Latest continuation: docs/gameplay/rocketship-live.md. Rocketship is live in bounded
+VR02: source body/callbacks, registration-ordered input, maneuvers/camera, original
+driver/Goddard/flame resources and F1 grant.96 isolated original component cases
+support the source contracts; full pair discovery, other levels, special mission/
+hazard/RNG effects and whole-original/native Windows comparison remain open.
+Grappler source is in
docs/gameplay/grappler.md; no approximate hook/pull mechanic is enabled. Friend
research assessment is docs/reviews/jn-engine-survey.md; use its decompiler leads
with REA/source checks, not its tuned C gameplay. All ownership has returned.
-Playable package baseline remains d6ca417; no package rebuild for this component.
+Preserve baseline69d0187 and parked35a2a66/0272f7b collision checkpoints. Latest
+package provenance and validation are recorded in the live report.
Baseball continuation: docs/gameplay/baseball-implementation.md. Its20-slot
pool, hold/release aiming, original TIME art and boundedVR07 moving targets are
implemented; original dynamic pair discovery/other enemy consumers remain open.
diff --git a/README.md b/README.md
index b5cb37e..834035f 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ VR04 and the bounded VR01/VR07 tutorials use recovered static body response/supp
numeric references. Lab/outside retain the capsule until special contacts and
dynamic collision are recovered; see [body implementation](docs/checkpoint/collision-body-implementation.md).
-**Current milestone: Baseball, Bubble, Invisible, shrink ray and their gadget screen.**
+**Current milestone: VR02 Rocketship, Baseball, Bubble, Invisible, shrink ray and their gadget screen.**
Tab/Space selects owned gadgets and their practice levels; the default device
fires on Enter/Ctrl/left mouse and supports actual VR04 soldier shrink/restore
with original morphs and score effects. Invisible uses the recovered recharge,
@@ -89,6 +89,12 @@ target respawn and original aim display are implemented; full enemy combat and
original dynamic contact scheduling remain incomplete.
**F1 → Player → Give All Gadgets** grants all eight gadgets without changing
the equipped gadget. Close F1, then use Tab/Space to select one.
+Rocketship flight is available in **VR02**: select its Practice tile, then equip
+it there or use **F1 → Player → Give/Select Rocketship**. Up/right mouse accelerates
+and climbs; Down brakes and descends; Left/Right banks. **Enter/T** performs a
+180-degree turn, **R** barrel rolls, and Tab/Space unequips. R resets normally
+when unmounted. Source camera, aircraft body and Jimmy/Goddard/flame visuals are
+included. Other levels and special mission/hazard sequences remain unfinished.
**F2** toggles a compact live debug overlay without pausing play. It shows frame
timing, position/velocity, movement, control/force state, tasks, camera/clipping
diff --git a/docs/architecture.md b/docs/architecture.md
index 52a740c..8f66f5d 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -271,16 +271,17 @@ registry, body response and morph clock are still not reconstructed by this brid
See checkpoint/control-phase-implementation.md. REA tooling is separate from
runtime architecture; setup/provenance are in rea.md.
-## Isolated vehicle components
+## Owned aircraft
-RocketFlight separates ordinary keyboard scalar/bank input from vertical
-acceleration publication. The source applies retained state before the controlled
-input/camera callback. It neither integrates a body nor owns a camera/passenger;
-no live runtime path calls it yet. Twenty-eight isolated copied-original numeric
-references support its bounded arithmetic. Aircraft callbacks, full Euler/camera,
-owned-versus-placed property/reset and helper lifetime remain gates before an
-explicit vehicle owner is added to PlayerSceneBinding/director scheduling.
-The exact resource exporter is opt-in and assigns no attachment transforms.
-See gameplay/rocketship-component.md. Grappler's distinct source ownership and
+Rocketship composes RocketFlight, RocketMotion, RocketOrientation and the source
+static-body/camera adapters in boundedVR02. PlayerSceneBinding schedules ship and
+Jimmy bodies before the fresh/retained input/normal boundary, transfers control
+to the registered3ROC and synchronizes the still-physical passenger afterward.
+Raw control and inventory permission remain distinct from named-Jimmy scripted
+cleanup. Release disables ship integration, stops engine/fire, retains rider root
+and shared eye, and returns Jimmy to FALL. Four dedicated source-pivot morphs
+replace the standing player draw while mounted. Source/probe/port validation and
+unresolved lifetime/pair/camera boundaries are in gameplay/rocketship-live.md.
+Grappler's distinct source ownership and
geometry/material/swing contract is in gameplay/grappler.md; it is not a simple
player movement mode or nearest-tag interaction.
diff --git a/docs/compatibility.md b/docs/compatibility.md
index 1065bdf..5e30ea8 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -3,6 +3,17 @@
Compilation, native runtime, original behavior and full feature completion are
separate evidence categories. **The game is not fully reconstructed/playable yet.**
+VR02 Rocketship (2026-11-03): live aircraft/static support and callbacks, original
+input/facing/maneuvers/camera, owned rider/Goddard/fire and engine lifecycle.
+14 flight/12 final integration groups;96 isolated original component observations.
+Native Linux GTX1070/private Xvfb1920×1080 ten-phase real SDL replay passes with
+zero Vulkan validation errors; headless matches.295 extra ordinary ticks are an
+accelerated port fixture, not original cadence or manual tutorial completion.
+Full268 Python+2 HUD/managed/33 GPU+17 material regression passes;539 hashes verify.
+Other levels, special missions/hazards/RNG, full source pair discovery, generic
+Jimmy post-vehicle Euler/render bridge and original/native Windows comparison
+remain boundaries. See gameplay/rocketship-live.md for package provenance.
+
Give All Gadgets debug action (2026-11-03): F1→Player grants items0..7 without
changing selection. Debug-menu action/navigation/repeat/layout checks and main
build pass; llvmpipe headless1920×1080 view renders all rows with zero Vulkan
diff --git a/docs/debug-menu.md b/docs/debug-menu.md
index 2168717..dc9c75a 100644
--- a/docs/debug-menu.md
+++ b/docs/debug-menu.md
@@ -29,6 +29,12 @@ by themselves. Debug tools do not imply reconstructed progression or full gamepl
Player includes **Give All Gadgets**, which sets all eight gadget tiles to owned
and available in the current scene. It preserves the equipped gadget and other
inventory entries. Normal level-load availability rules still apply afterward.
+**Give/Select Rocketship** equips the live vehicle in VR02; elsewhere it grants
+the tile for Practice entry. Its speed, vertical velocity and contact count appear
+in the Player header. The complete page still fits32 rows and scales uniformly.
+While mounted, Enter/T turns180degrees and R barrel rolls; Tab/Space unequips.
+Force Control continues to drive the mounted pilot without changing authored
+ownership; enabling noclip releases the ship and engine before flying Jimmy.
The General page retains the existing actions. Player adds noclip, staged flight
speeds300/600/1200/2400 (Enter applies), clear motion/queued jump, reopen objective,
diff --git a/docs/decisions.md b/docs/decisions.md
index d5cf398..003c5e4 100644
--- a/docs/decisions.md
+++ b/docs/decisions.md
@@ -248,3 +248,12 @@
versus placed properties, passenger/effect lifetime and control/camera phase
before VR02 integration. Grappler's geometry/material/swing contract likewise
forbids nearest-hook/direct-pull replacement. See gameplay/rocketship-component.md.
+43. **Compose the owned Rocketship in boundedVR02.** Preserve source registration
+ order, rider static-body work, separate raw control/menu permission and
+ named-Jimmy cleanup.1E4 is a dynamic-pair flag, not an integration gate.
+ Dedicated source callbacks, Euler seam, maneuvers, LOOK-to-eye camera and
+ passenger/flame pivots replace provisional movement/render assumptions.
+ Require source/probe admission for other materials/levels; no nearest-ship,
+ invented boost or direct vertical-velocity substitute.96 isolated component
+ observations support contracts; live SDL/Vulkan replay verifies the port,
+ not whole-original or native Windows fidelity. See gameplay/rocketship-live.md.
diff --git a/docs/gameplay/rocketship-body.md b/docs/gameplay/rocketship-body.md
new file mode 100644
index 0000000..668a2af
--- /dev/null
+++ b/docs/gameplay/rocketship-body.md
@@ -0,0 +1,58 @@
+# Rocketship body and VR02 contacts
+
+2026-11-03. `tools/binary/rocketship_body.py` guards callbacks/flags/physics and
+vtable4B25AC; file offsets accompany generated reports. EXE text VAs map to
+VA−400000. Source/complete REA replies and closed sessions are retained under
+`artifacts/rocket-body/rea-{callbacks,vr02-contacts}/`.
+43E8D0 Evidence `ev_8f8b2ab2823b93372092e5e555faff811da178c40935fac0a9bb33142ff43bc1`;
+435CE0 `ev_0134513dc749fa400dba28ed28630e6c567b382aec6c7e93684e19464a165924`;
+435800 `ev_16509f386735a8186417564f0d6b8c8454a6a10bb3d3d3933946589ab8710c9a`.
+Unrecognized raw procedures use guarded source and isolated probes, not a claim
+of successful decompilation.
+
+## Body composition
+
+Rocket radius50, factorfloat32(.6), frictionfloat32(.8), prevent-lowering TRUE
+(43D90D→470F70(1)). Support clearance is float32(30.0000019), not Jimmy75.9.
+Normal479D20/support composition applies. Landing37C→472970 is no-op.
+
+Terminal geometry callback370→43EB70 when normalY<=−.7 unconditionally assigns
+velocityY−120; X/Z, root and acceleration survive. Ordinary Jimmy's positive-Y
+cancellation is incorrect here. Callback374→43E8D0 otherwise has rider effects;
+it does not call generic reflection378→472750 and does not change ship velocity/root.
+
+374 requires rider, selected polygon and material pointer. Missing definition
+uses ordinary effects; defined170/−1 ignores. OrdinaryVR02 material IDs0/2/3/5
+produce rider1A0(−1,−1,1), sound197, duration1 and impact latch/timer reset only
+when no impact is active.130..139 uses−10/5seconds;185..189 uses rider latch
+and an additional rider198 callback. Those special cases are not admitted by
+the bounded live VR02 material profile. Null-material polygons still clip the
+body, but do not emit damage/impact effects.
+
+23 copied-original370/374 cases preserve synthetic root/acceleration and verify
+these branches. `artifacts/rocket-body/source-and-callbacks.json` records their
+inputs/results and generator/executable/log hashes. Six copied479D20/support
+cases in `body-support-probe/wine.log` establish floor30.0000019, no forced
+lowering from75.9, rise with priorVy300 and independent published-speed friction.
+All use synthetic body/rider/audio accessors and separate Wine32 execution;
+no original gameplay runs. OriginalBodyPhysics's Rocketship profile composes
+the ceiling rule and prevent-lowering; caller owns ordinary rider effects.
+
+## Pair flag and actual actor classes
+
+**1E4 writes interface137; it does not disable integration.** It inhibits
+dynamic push/recording, while479D20 integration uses210/live13E. Mounted Jimmy
+can still run static physics before ship update overwrites his transform.
+Earlier broad statements that mounting disables his physical body were wrong.
+
+VR02 contains Jimmy, ship, phone booth, trophy, seven3PIC, LOAD, four patrols,
+STRT and MCA. No authored mine/rock/missile exists. Phone/trophy constructors
+use sphere mode1, pairs=true, world/support/integration=false,137=true,
+radius40/20. They are not missing box geometry for the static resolver. This
+does not prove all source pair callbacks absent.
+
+Pickup435D08 requires caller==raw controlled5099E4: mounted ship qualifies,
+passenger does not. LOAD457EE6 and Phone435800 require C3DJIMMY: actual passenger
+can qualify while Rocketship cannot. Keep distinct actor identity/radii: controlled
+ship50 for pickups and Jimmy60 for LOAD. Current discovery remains the port's
+bounded sphere-overlap adapter; original full pair ordering is not reconstructed.
diff --git a/docs/gameplay/rocketship-component.md b/docs/gameplay/rocketship-component.md
index 56e0d02..0b4d9dc 100644
--- a/docs/gameplay/rocketship-component.md
+++ b/docs/gameplay/rocketship-component.md
@@ -1,5 +1,10 @@
# Rocketship arithmetic and resource checkpoint
+Historical a274670 checkpoint; superseded for live VR02 status by
+[rocketship-live.md](rocketship-live.md). Later source/probes corrected the
+unconditional input-after-apply wording: game and ship callbacks are separate,
+ordered by fresh/retained registration. Mounted Jimmy still runs static physics.
+
2026-11-03. Continued gadgets after the supplied jn-engine assessment c6eb186.
Kept the playable d6ca417 source/packages and parked collision baseline intact.
Independent investigators owned Rocketship source, resources and Grappler source;
diff --git a/docs/gameplay/rocketship-lifecycle.md b/docs/gameplay/rocketship-lifecycle.md
new file mode 100644
index 0000000..10269d5
--- /dev/null
+++ b/docs/gameplay/rocketship-lifecycle.md
@@ -0,0 +1,55 @@
+# Owned Rocketship lifetime, passengers and audio
+
+2026-11-03. `tools/binary/rocketship_lifecycle.py` guards15 spans/six virtuals,
+animation strings and impact constants. Text offsets are VA−400000.
+REA43EA60 Evidence `ev_b28a6f3c3709bd2dc15ad82b84d77485761790d09f103f1796320c254ea7f3c3`;
+471000 `ev_2f4144c8b1d3d2cb8f0055eb0b45bd66fba6241074364da7f86339f9ed58152d`;
+471090 `ev_87e9605c4180524d37fe82ff4a0070b18863a43e7f19e2b398ea393752e31fdc`.
+Complete replies/failures/snapshots remain in artifacts/rocket-lifecycle/rea-20261103.
+43DF70's default provider boundary remains missing; source instructions, guarded
+vtable/callers and isolated component execution supplement it.
+
+## Identity and reset
+
+Jimmycomplete+AB0 owns the ship.43D950 sets retention470F40(0),43D9F9 sets reusable
+game+9,43D916 registers FourCC3ROC through462220 (game+404). Loader46E6A0 finds
+an eligible reusable ID;46E6E0 returns first matching ID in registry order.
+The authored GAM3ROC reapplies properties to that owned object. It is not a
+nearest ship or tag search. VR02 has exactly one serialized3ROC.
+
+Mount copies root/Euler, enables geometryD0 and integration214, transfers game118
+to ship+C0, stores complete Jimmy at shipcomplete+740/interface+680 and selects
+DRIVE. It does not reset ship velocity, scalar or maneuver state. Raw1 cleanup
+428541..428582 disables214, sets137 inhibit, explicitly calls complete128(0)
+→43EA80 to stop engine and hides fire. It restores Jimmy ownership, clears link,
+clears Jimmy velocity/acceleration and enters movementmode1/FALL, retaining his
+last copied root. Level initialization43EA60→41A0B0 and43DB10 is a separate reset;
+do not confuse remount with a new level. Normal unmounted update's base flight
+math still precedes its speed0 tail.
+
+## Update and presentation
+
+43DF70 inherits flight apply, then copies ship root/Euler exactly into rider and
+his proxy root, reasserts control at43E23E and updates owned visuals. Goddard local
+offset(0,10,−25) uses full Euler; fire shares ship root/Euler. JimmyHIDRIVE→jimdrive
+is registered422B04..18; GoddardHIROCK→godrocket at41CE2C..40. Fire41939E..3E8 binds
+firestrato/fire.png and40DD40(0,6,1): source-alpha/one additive. Fire hides for Down
+or speed<=0, shows otherwise. Scripted burst/RNG and twenty linked effects remain
+separate from ordinary VR02, whose constructor EC1 prevents ordinary drive burst.
+
+43E7E0 is the separately dispatched game-controlled input callback. Its rider
+complete1AC target is427370, the gadget menu; Tab/Space must work while the ship
+owns control. Fresh/retained registry order governs input-before/after apply.
+
+Engine43EA80 switches0 stop,1 loop195,2 loop196, stopping old handle first;
+unchanged1/2 does not restart. InputUp chooses2, Down/stopped0, positive coast1.
+Sound197 is ordinary wall hit. All three are PCM in the existing sound bank.
+
+Ordinary wall impact starts duration1 and E84, ED0=false.43E6E8 adds dt and tests
+the unrounded sum **strictly greater** than duration. Equality still pulses;
+expiry restores DRIVE/scale1. Shape-only scale is(1,s,s), s=(sin(time*20)+1)/2.
+Strong ED0 queuesY−700; EC0 burst separately queues−750, excluded from ordinary
+VR02. Eight copied-original suffix cases in impact-probe/wine.log verify strict
+expiry/pulse/queued impulses, including a float-store equality whose unrounded
+sum has expired. Synthetic rider/render/impulse accessors run in isolated Wine32;
+this is not original lifecycle or whole-game verification.
diff --git a/docs/gameplay/rocketship-live.md b/docs/gameplay/rocketship-live.md
new file mode 100644
index 0000000..f4c7d8a
--- /dev/null
+++ b/docs/gameplay/rocketship-live.md
@@ -0,0 +1,86 @@
+# Live VR02 Rocketship checkpoint
+
+2026-11-03. Continues312efcc with a bounded playable aircraft in the authored
+VR02 scene. Original files and supplied friend research remain unchanged. No
+friend gameplay code was imported. Baseline69d0187 and parked collision
+35a2a66/0272f7b remain available for comparison.
+
+## Controls
+
+F1 → Player → Give/Select Rocketship grants its tile. Outside VR02 this retains
+the selection for Practice without enabling an invented player-flight mode.
+Open Tab/Space, choose the Rocketship tile and Practice to enter VR02. Equip
+there using the tile or F1 action. Up/right mouse accelerates and climbs, Down
+brakes/descends, Left/Right banks. Enter/T turns180 degrees; R barrel rolls.
+Tab/Space unequips before opening the gadget panel. R resets while unmounted.
+
+## Source and implementation coverage
+
+Source addresses, structures, caller chains, file offsets, REA Evidence IDs and
+component-probe provenance are in [body](rocketship-body.md),
+[motion/camera](rocketship-motion-camera.md), [lifecycle](rocketship-lifecycle.md)
+and the earlier [component report](rocketship-component.md). EXE text file offsets
+are VA−400000. Original executable/DLL hashes are guarded by the analysis tools.
+
+| Original contract | Current implementation and evidence | Remaining boundary |
+| --- | --- | --- |
+| Jimmy-owned reusable3ROC, ID reuse and mount/cleanup | Rocketship binds the sole authoredVR02 actor; PlayerSceneBinding transfers ownership, seeds root/Euler/shared eye, preserves remount motion and stops engine/fire on release | General retained helper registry across levels |
+| Body before input/normal, fresh/retained registration order | Explicit StepBody, LabSimulation afterPhysics hook, input-before/after normal according to InputAfterPlayerUpdate | Full original traversal and original frame cadence |
+| Radius50/factor.6/friction.8/prevent-lowering; ceiling370 and wall374 | Rocketship body profile with native support references and ordinary material effects | Other-level materials, special damage, complete pair scheduling |
+| Jimmy1E4 dynamic inhibit, independent static body | Jimmy static physics continues before ship root/Euler synchronization | General dynamic push/recording implementation |
+| Scalar/bank, vertical command, Euler/facing/slip, turn/barrel | RocketFlight/RocketOrientation/RocketMotion compare against copied-original numeric fixtures | General x87 bit identity and all modal globals |
+| LOOK→eye clip, shared OLD eye, detail gain and quantized angles | OriginalCameraRay plus source camera math; both detail branches checked in components | Whole-game shared camera ownership, detail initialization and renderer parity |
+| Strato/HIDRIVE/HIROCK/FireStrato and engine195/196, hit197 | Exact extracted morphs/textures; source pivots/full Euler, Goddard offset, additive flame; unchanged engine mode does not restart | Scripted effects, EC0/ED0, RNG and20 linked effects |
+| Controlled-owner pickup vs named-Jimmy LOAD | Ship radius50 used for3PIC; real passenger radius60 used for LOAD | Port sphere discovery remains an adapter; no full pair-order claim |
+| Control loss and menu/reset/noclip | Named-Jimmy MCA release, FALL cleanup, shared eye handoff, Tab/Space, F1 force-control, reset and F3 cleanup | Generic post-vehicle Jimmy Euler/render bridge and complete transition persistence |
+
+Corrections replace earlier symptom-level assumptions:1E4 does not disable
+integration, input is not unconditionally after normal, camera trace starts at
+LOOK rather than ROOT, and turn/barrel controls are not boosts. No nearest-ship
+search, direct vertical-velocity substitute or standing-foot art correction is
+used for this vehicle.
+
+## Verification
+
+96 isolated copied-original observations:14 keyboard,14 vertical,31
+motion/facing/camera,23 callbacks,6 support and8 impact suffix cases. These run
+copied EXE/DLL components with synthetic accessors in separate Wine32 prefixes;
+they do not run original gameplay. Committed fixtures and source guards allow
+repeatable projection checks.14 managed flight groups and12 final Rocketship
+integration groups pass. The latter cover actualVR02, fresh/retained input,
+mount/remount/audio, source support, ceiling/wall, pickup/LOAD identity, RETURN,
+resources, force-control and named-Jimmy cleanup.
+
+Full scripts/test.sh passed268 Python regressions+2 HUD checks, all managed
+suites,33 main GPU completions and17 material checks, with zero Vulkan validation
+errors and539 original files unchanged. Its Rocketship integration run had10
+groups; the final two force-control/MCA groups and tiny related fixes were checked
+afterward by the12-group focused run. The initial selected-project compilation
+failure was corrected by accepting a DirectorActor contact descriptor instead of
+depending on Rocketship; its failed log is preserved separately.
+
+Headless and native Linux GTX1070/private Xvfb1920×1080 replays pass all10 phases:
+mount, flight, bank, turn, roll start/barrel, release, remount and noclip cleanup.
+Native replay receives real injected SDL Up/Left/Enter/R/Tab/F3 events (mask63),
+stops engine audio and reports zero enabled Vulkan validation errors.295 extra
+ordinary ticks reuse received input through binding/interactions/director without
+teleporting or seeding motion/timers; this is accelerated port verification.
+Energy stays20. Captures show Jimmy/Goddard/fire attached during maneuvers.
+
+Logs and readbacks: artifacts/rocketship-live/{integration.log,headless.log,
+native-ipc.log,phases.png}; initial failures are retained separately. The initial
+native sandbox could not access local X11 sockets; a locally approved IPC run
+succeeded. No network display, uploads or original entrypoint execution occurred.
+
+## Release and next work
+
+Clean-source Linux/Windows package provenance and standalone replay are recorded
+after local packaging below. Native Windows execution remains unverified for
+this milestone; cross-publishing does not establish it.
+
+Next evidence gates are non-VR02 reuse/level lifetime, special hazard/mission
+consumers, shared-camera and general Jimmy Euler presentation after cleanup,
+and full original actor-pair scheduling. Grappler and Scooter retain their
+separate recovered contracts and are not enabled through approximate mechanics.
+Manual original-versus-port tutorial completion and native Windows testing are
+still required for broader fidelity claims.
diff --git a/docs/gameplay/rocketship-motion-camera.md b/docs/gameplay/rocketship-motion-camera.md
new file mode 100644
index 0000000..922943b
--- /dev/null
+++ b/docs/gameplay/rocketship-motion-camera.md
@@ -0,0 +1,60 @@
+# Rocketship motion, facing and camera continuation
+
+2026-11-03. Source guards in `tools/binary/rocketship_motion_camera.py` cover
+ten EXE spans/seven virtuals, imports/constants and both authoritative image
+hashes. Text file offsets are VA−400000. Complete REA replies/provider failures
+are retained under `artifacts/rocket-motion-camera/rea-{helpers,camera}/`.
+472480 Evidence `ev_24161f6af107c0a3282a5600306feca8c43be2a6448e12a3df408dfea38a70ce`;
+458F90 `ev_80bdb649020f090d63625bbe8d731786d2097f32b00625615bfe5384197cd040`.
+Use prior41A140/41A6C0 Evidence from rocketship.md. Several queried raw entries
+remain unrecognized; bounded disassembly and copied-original probes supplement
+them. Static evidence is distinct from original runtime execution.
+
+## Corrections and recovered behavior
+
+43DF70/41A140 normal update does not call controlled-input43E7E0. Game44DF80→
+475A70 dispatches raw owner3CC separately. Fresh game registration can put input
+before ship update; retained helpers precede the appended destination game.
+Use the recovered `InputAfterPlayerUpdate` phase boundary, with all body work
+before either callback. Earlier unconditional input-after-apply prose is stale.
+
+- Full local rotation472B10/point472980 uses negative Z, negative X, negative Y,
+ with original lookup trig. This differs from some earlier provisional combined
+ Euler adapters. RocketOrientation is independently scoped and tested.
+- 472480 addition: negative sum becomes360−abs(trunc(sum)); sum>360 subtracts360
+ once; equality360 survives. Negative fractional seams therefore lose fractions.
+- Facing41ADF0 runs through the inherited animated update before horizontal
+ application. It skips while prior barrel timer670>0. Pitch/roll use shortest
+ ±180 deltas; yaw only corrects positive>180. Rates are2/4/3 times dt. All-zero
+ differences clear the source facing flag.
+- Incoming full velocity!=0 permits yaw+=bank*dt and stores previous bank618.
+ Side scalar is previousBank*.0181818176060915*(1−friction)*speed; rotated local
+ forward supplies X/Z, with cos(yaw)*side addedX and sin(yaw)*side addedZ. PreserveY.
+- Enter/T starts latched674=1 while moving; it adds180*dt yaw and decrements/clamps
+ its timer. Horizontal publication skips while the POST-decrement timer>0.
+ R starts latched670=1 and adds270*dt roll, including its finishing frame.
+ These are turn/roll maneuvers, not speed boosts. Modal globals suppress new
+ latch changes; timer updates themselves remain separate.
+- Input destination is(Up?20:Down?−20:0,currentYaw,−bank), with stopped neutral
+ roll0. Source engine mode2 Up,0 Down/stopped,1 positive coast.
+
+## Camera and original observations
+
+Eye local(0,200,−500), look local(0,50,200), both full-Euler transformed.
+Native probe corrects an early static interpretation:419DE0 traces **look→eye**,
+not root→eye. Hit response is look−.75*(look−hit), gain2; miss gain1.
+Follow uses OLD shared eye with gain*dt*(detail<=1?.6:1.2). Aim vector is look−OLD
+eye, independent of updated eye. Original DLL vector::angles uses squared-ratio
+half-acos lookup, quantized inverse heading and signed14-bit pitch/yaw; no atan2.
+
+`artifacts/rocket-motion-camera/original-results.json` records31 copied-original
+transform, horizontal, auxiliary, facing and camera cases. The Win32 harness
+executes copied EXE instructions plus our copied OMT2.dll trig/angles (hash
+3ec41ead…54943), with synthetic body/input/ray accessors. Original entrypoint,
+world integration and gameplay do not run. Source/generator/executable/log hashes
+are retained. The committed numeric fixture is
+`tests/GamePort.RocketFlightTests/original-motion-reference.json`.
+RocketOrientation, RocketMotion and OriginalHeading.Angles compare against these
+31 cases; scalar/vector tolerance.002 and exact integer angle outputs. Existing
+14 input/14 vertical references remain independent. General x87 bit identity,
+whole-game camera cadence and full renderer parity are not established.
diff --git a/docs/gameplay/rocketship.md b/docs/gameplay/rocketship.md
index b794725..cf95527 100644
--- a/docs/gameplay/rocketship.md
+++ b/docs/gameplay/rocketship.md
@@ -43,7 +43,8 @@ Twenty other linked slots retain a separate unresolved effect/child role.
Item1 branch42944D..429686 uses this owned pointer; there is no nearest placed
3ROC search. It activates the ship, copies Jimmy root/Euler via game310/328 into
ship318/330, transfers game118 control to ship+C0 at4295A5, stores rider+740 at
-4295B4, disables Jimmy physical participation through1E4, hides/disables relevant
+4295B4, inhibits Jimmy dynamic push/recording through1E4 (his static physics still
+runs), hides/disables relevant
companion flags, selects Jimmy DRIVE and writes raw gadget1 at42967F. Null owned
pointer skips this equip body. Availability/HUD commands remain separate.
@@ -66,6 +67,9 @@ Rocket registry update43DF70 calls inherited41A140 before its passenger/effect
tail. Controlled callback43E7E0 gates on407060 false and475CA0 true, then invokes
41A6C0, optionally updates a fire-held timer and calls rider complete1AC with dt.
**Apply consumes retained input state; input does not integrate the body.**
+Game475A70 dispatches controlled-input3CC separately; fresh/retained registry
+order determines whether it precedes ship update. The live continuation and
+corrected flag/order contracts are in [rocketship-live.md](rocketship-live.md).
Offsets below are relative to the game interface (game pointer=complete+C0;
addC0 to these offsets for complete-object fields): speed608, bank614,
diff --git a/docs/progress.md b/docs/progress.md
index ef2713e..2d03e9d 100644
--- a/docs/progress.md
+++ b/docs/progress.md
@@ -1,5 +1,28 @@
# Progress — 2026-11-03
+## Live VR02 Rocketship
+
+Implemented owned/reused3ROC flight in VR02: source ceiling/wall/support profile,
+registration-ordered body/input/normal phases, original Euler seam/facing, Enter/T
+turn and R barrel roll, old-eye camera, driver/Goddard/flame art and engine loops.
+Mounted Jimmy retains static physics before ship-root synchronization. Pickups
+use controlled ship radius50; LOAD uses actual Jimmy radius60. Tab/Space, F1,
+cutscene cleanup, force-control, reset and noclip ownership are integrated.
+Source/probe details and boundaries: [rocketship-live.md](gameplay/rocketship-live.md).
+
+96 copied-original observations cover input/vertical, motion/camera, callbacks,
+support and impact components.14 managed flight groups,12 final integration groups
+and source/projection checks pass. Native GTX1070/private Xvfb1920×1080 passes
+all10 render/control phases and real SDL Up/Left/Enter/R/Tab/F3, engine cleanup
+and zero Vulkan validation errors. Headless matches;295 accelerated ordinary
+ticks reuse received input without relocation or timer mutation. Captures inspected.
+Full scripts/test.sh passes268 Python+2 HUD/all managed/33 GPU+17 material checks;
+539 original hashes verify. Initial selected-project compile dependency was fixed
+by passing a DirectorActor contact descriptor; failed log remains separate.
+Final package checks are being recorded in the live report. Other levels,
+special hazards/missions/RNG, original pair ordering and native Windows comparison
+remain open; preserved collision/reference baselines remain untouched.
+
## Give All Gadgets debug action
Added user-requested F1→Player→Give All Gadgets. It sets items0..7 to available
diff --git a/docs/reverse-engineering.md b/docs/reverse-engineering.md
index b884cc4..a0641eb 100644
--- a/docs/reverse-engineering.md
+++ b/docs/reverse-engineering.md
@@ -5,6 +5,13 @@ offsets, virtual addresses, API symbols or observed behavior. Decompiled output
evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL
probes and modern runtime checks are recorded separately.
+- `gameplay/rocketship-live.md`, `rocketship-body.md`, `rocketship-motion-camera.md`
+ and `rocketship-lifecycle.md`: owned/reused3ROC, body flags/callbacks, registry
+ input order, source Euler/maneuvers/shared-eye camera, rider/Goddard/fire/audio
+ lifecycle,96 copied-original component observations and boundedVR02 integration.
+ REA IDs/source offsets and unresolved special materials/pairs/retained lifetime
+ remain explicit; port replay is distinct from original gameplay verification.
+
- `gameplay/bubble-motion.md`, `bubble-body.md`, `bubble-rendering.md`,
`bubble-implementation.md`, `bubble-implementation-review.md`: mode2 controller,
copied-original radius/factor/support references, actualVR01 floor111/texture
diff --git a/docs/tasks.md b/docs/tasks.md
index 0fed012..f72fd75 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -46,6 +46,15 @@ compile, runtime and original-fidelity verification are separate.
## Immediate continuation
+- [x] Live boundedVR02 Rocketship: source aircraft callbacks/support, owned actor
+ control, fresh/retained input order, maneuvers/camera, exact passenger/fire art,
+ engine audio, F1, cutscene/force-control/reset/noclip and distinct pickup/LOAD callers.
+- [x]96 isolated original observations;14 flight/12 final integration groups;
+ native GTX1070/private Xvfb1920×1080 ten-phase SDL replay; full268 Python+2 HUD/
+ managed/33 GPU+17 material suite and539 unchanged original hashes.
+- [ ] Rocketship outside VR02, special hazard/mission/RNG effects, general original
+ pair scheduling and full original/native Windows comparison. See live report.
+
- [x] User-requested F1→Player Give All Gadgets: grant all eight without selecting,
preserve other inventory, keep the32-line layout; debug-menu checks/build pass.
@@ -59,9 +68,9 @@ compile, runtime and original-fidelity verification are separate.
- [x] Export exact Rocketship resources/VR02 records with5 checks; recover
Grappler attachment/material/swing/lifetime source with12 checks. Rocket source
3 checks, existing Gadget15/Movement25 and .NET10 build pass;539 hashes verify.
-- [ ] Close Rocketship aircraft callbacks, normal Euler/slip/roll/camera and
- owned-versus-GAM property/reset/helper/attachment gates; then integrate bounded
- VR02 vehicle ownership, actual art/audio, F1 and live control/RETURN checks.
+- [x] Close ordinary VR02 Rocketship callbacks, Euler/maneuver/camera and
+ owned/GAM reset/attachment gates; integrate actual art/audio, F1 and live control
+ with source RETURN/cutscene ownership regressions. General pair/lifetime remains bounded.
- [ ] Close Grappler ray/material context, attached dispatcher/camera/Euler and
helper lifetime before live mode7. No substitute hook/pull behavior.
diff --git a/scripts/package.sh b/scripts/package.sh
index 2f08caa..fe5975c 100755
--- a/scripts/package.sh
+++ b/scripts/package.sh
@@ -21,6 +21,8 @@ for rid in linux-x64 win-x64; do
cp -a artifacts/extracted/bubble/. "$out/scenes/bubble/"
mkdir -p "$out/scenes/baseball"
cp -a artifacts/extracted/baseball/. "$out/scenes/baseball/"
+ mkdir -p "$out/scenes/rocketship"
+ cp -a artifacts/extracted/rocketship/. "$out/scenes/rocketship/"
mkdir -p "$out/scenes/effects"
cp -a artifacts/extracted/effects/. "$out/scenes/effects/"
cp artifacts/extracted/scene-catalog.json "$out/scenes/scene-catalog.json"
@@ -91,6 +93,12 @@ Its owned tile's Practice Mode opens VR07 with original moving targets,15-second
respawn and source trophy activation. Original ball/crosshair/TIME glyphs scale
uniformly on widescreen. Full enemy combat and original pair scheduling remain
incomplete; flying balls and a pending throw can survive unequipping.
+Rocketship flight is implemented in VR02. Select its Practice tile, then equip
+it there with Tab/Space or F1/Player Give/Select Rocketship. Up/right mouse
+accelerates and climbs, Down brakes and descends, Left/Right banks. Enter/T
+performs a180-degree turn and R barrel rolls; Tab/Space unequips. R remains
+reset when unmounted. Aircraft body/camera and source driver/Goddard/flame art
+are included; other levels and special mission/hazard sequences remain open.
Append --inspect to start directly in the old scene inspector.
The default runs the recovered lab camera/speech sequence; Escape/Space skips
its actions and restores control. --skip-intro starts with control; --mute disables
diff --git a/scripts/test.sh b/scripts/test.sh
index fe47371..4e2521a 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -20,6 +20,7 @@ dotnet run --project tests/GamePort.BubbleTests
dotnet run --project tests/GamePort.BaseballTests
dotnet run --project tests/GamePort.BaseballVisualTests
dotnet run --project tests/GamePort.RocketFlightTests
+dotnet run --project tests/GamePort.RocketshipTests
dotnet run --project tests/GamePort.HeadingTests
dotnet run --project tests/GamePort.BlendTests
dotnet run --project tests/GamePort.CameraRayTests
@@ -63,6 +64,7 @@ dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json
dotnet run --no-build -- --headless --scene artifacts/extracted/VR03/scene.json --level gam/VR03.gam --smoke-invisible --screenshot artifacts/test-invisible.ppm
dotnet run --no-build -- --headless --scene artifacts/extracted/VR01/scene.json --level gam/VR01.gam --smoke-bubble --screenshot artifacts/test-bubble.ppm
dotnet run --no-build -- --headless --scene artifacts/extracted/VR07/scene.json --level gam/VR07.gam --smoke-baseball --screenshot artifacts/test-baseball.ppm
+dotnet run --no-build -- --headless --scene artifacts/extracted/VR02/scene.json --level gam/VR02.gam --smoke-rocketship --screenshot artifacts/test-rocketship.ppm
dotnet run --no-build -- --headless --skip-intro --write-save artifacts/test-checkpoint.tsk
dotnet run --no-build -- --headless --load-save artifacts/test-checkpoint.tsk --skip-intro
dotnet run --no-build -- --headless --story --scene artifacts/extracted/VR01/scene.json --level gam/VR01.gam --smoke-transition --skip-intro
@@ -79,6 +81,7 @@ SDL_AUDIODRIVER=dummy dotnet run --no-build -- --scene-audio-smoke artifacts/ext
SDL_AUDIODRIVER=dummy dotnet run --no-build -- --cutscene-audio-smoke artifacts/extracted/level1b/entities/entities.json
python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json
if [[ "${NEUTRON_WINDOW_TEST:-0}" == 1 ]]; then
+ dotnet run --no-build -- --scene artifacts/extracted/VR02/scene.json --level gam/VR02.gam --smoke-rocketship --width 1920 --height 1080 --screenshot artifacts/test-rocketship-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/VR07/scene.json --level gam/VR07.gam --smoke-baseball --width 1920 --height 1080 --screenshot artifacts/test-baseball-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/VR01/scene.json --level gam/VR01.gam --smoke-bubble --width 1920 --height 1080 --screenshot artifacts/test-bubble-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/VR03/scene.json --level gam/VR03.gam --smoke-invisible --width 1920 --height 1080 --screenshot artifacts/test-invisible-window.ppm
diff --git a/src/GamePort/Application/DebugMenu.cs b/src/GamePort/Application/DebugMenu.cs
index 3ac50a7..4cf09ea 100644
--- a/src/GamePort/Application/DebugMenu.cs
+++ b/src/GamePort/Application/DebugMenu.cs
@@ -8,7 +8,7 @@ public sealed record DebugScene(string LevelFile, string Code, string[] Starts);
public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl, ToggleOverlay,
Noclip, NoclipSpeed, StopMotion, ShowObjective, ReturnNoclipEntry, LevelAvailability, InputOrder, ApplyJetpackState,
CameraObstruction, MuteMusic, MuteSpeech, MuteEffects, RestartMusic, StopEffects, SaveCheckpoint, LoadCheckpoint, Practice,
- GiveInvisible, UnequipGadget, GiveBubble, GiveBaseball, GiveAllGadgets }
+ GiveInvisible, UnequipGadget, GiveBubble, GiveBaseball, GiveAllGadgets, GiveRocketship }
public sealed record DebugMenuView(string[] Lines, int SelectedLine);
public sealed record DebugStatus(string Level, string Start, Vector3 Root, float Yaw, float Speed,
bool Grounded, float Energy, int Score, int SceneTask, string Cutscene, bool Controlled,
@@ -31,6 +31,7 @@ public sealed record DebugSystems
public bool Targetable { get; init; } = true;
public string BubblePhase { get; init; } = "OFF";
public string BaseballState { get; init; } = "OFF";
+ public string? RocketshipState { get; init; }
public float BodyRadius { get; init; } = 60;
public float BodyFactor { get; init; } = 1.265f;
public int Objective { get; init; }
@@ -56,7 +57,7 @@ public sealed class DebugMenu
public const int ItemCount = 12;
public const int PageCount = 3;
public int Page { get; private set; }
- public int PageItems => Page switch { 1 => 15, 2 => 9, _ => ItemCount };
+ public int PageItems => Page switch { 1 => 16, 2 => 9, _ => ItemCount };
private static readonly float[] FlySpeeds = [300, 600, 1200, 2400];
private int flySpeedIndex = 1, jetpackStateIndex = 1;
private static readonly int[] JetpackStates = [0, 1, 4];
@@ -120,7 +121,7 @@ public sealed class DebugMenu
5 => DebugAction.LevelAvailability, 6 => DebugAction.InputOrder,
8 => DebugAction.ApplyJetpackState, 9 => DebugAction.RefillEnergy,
10 => DebugAction.GiveInvisible, 11 => DebugAction.UnequipGadget, 12 => DebugAction.GiveBubble,
- 13 => DebugAction.GiveBaseball, 14 => DebugAction.GiveAllGadgets, _ => DebugAction.None
+ 13 => DebugAction.GiveBaseball, 14 => DebugAction.GiveAllGadgets,15=>DebugAction.GiveRocketship, _ => DebugAction.None
};
if (Page == 2) return Selected switch
{
@@ -160,7 +161,7 @@ public sealed class DebugMenu
$"OBJECTIVE {system.Objective} TIME {F(system.ObjectiveTime)} GADGET STATE {system.JetpackAvailability}",
$"INVISIBLE {F(system.InvisibleRemaining)} RECHARGE {F(system.InvisibleRecharge)}/7 TARGETABLE {system.Targetable}",
$"BUBBLE {system.BubblePhase} BODY R {F(system.BodyRadius)} FACTOR {system.BodyFactor.ToString("0.000",c)}",
- $"BASEBALL {system.BaseballState}", ""];
+ system.RocketshipState is{} rocket?$"ROCKET {rocket}":$"BASEBALL {system.BaseballState}"];
string[] items = Page == 1 ? [
$"NOCLIP (F3): {system.Noclip} (ENTER TOGGLE)",
$"FLY SPEED: {F(FlySpeed)} LIVE {F(system.NoclipSpeed)} (ENTER APPLIES)", "STOP MOTION / CLEAR QUEUED JUMP", "SHOW CURRENT OBJECTIVE",
@@ -168,7 +169,7 @@ public sealed class DebugMenu
$"INPUT AFTER PLAYER: {system.InputAfterPlayer} (TOGGLE)",
$"JET PACK STATE: {JetpackState} (0 NONE / 1 OWNED / 4 DISABLED)", "APPLY JET PACK STATE", "REFILL ENERGY TO 100",
"GIVE / SELECT INVISIBLE", "UNEQUIP CURRENT GADGET", "GIVE / SELECT BUBBLE", "GIVE / SELECT BASEBALL",
- "GIVE ALL GADGETS"] : [
+ "GIVE ALL GADGETS", "GIVE / SELECT ROCKETSHIP (VR02)"] : [
$"STATIC CAMERA OBSTRUCTION: {(system.CameraObstruction?.ToString() ?? "UNAVAILABLE")}",
$"MUTE MUSIC: {system.MusicMuted}", $"MUTE SPEECH: {system.SpeechMuted}", $"MUTE EFFECTS: {system.EffectsMuted}",
"RESTART SELECTED MUSIC", "STOP ALL EFFECTS / LOOPS", "SAVE DEBUG CHECKPOINT", "LOAD DEBUG CHECKPOINT", "SHOW JET PACK PRACTICE PROMPT"];
diff --git a/src/GamePort/Application/RocketshipSmoke.cs b/src/GamePort/Application/RocketshipSmoke.cs
new file mode 100644
index 0000000..d38a556
--- /dev/null
+++ b/src/GamePort/Application/RocketshipSmoke.cs
@@ -0,0 +1,86 @@
+using System.Numerics;
+using GamePort.Game;
+
+namespace GamePort.Application;
+
+/// VR02 ordinary-phase replay; extra ticks reuse the last received
+/// input. No actor relocation, velocity seeding or timer modification.
+public sealed class RocketshipSmoke
+{
+ private readonly LabSimulation player;
+ private readonly PlayerSceneBinding binding;
+ private readonly SceneInventory inventory;
+ private readonly SceneDirector director;
+ private readonly SceneInteractions interactions;
+ private readonly Rocketship ship;
+ private readonly bool[] checks=new bool[10];
+ private readonly Vector3 initial;
+ private readonly float energy;
+ private PlayerInput last;
+ private int extra;
+ private float turnYaw;
+
+ public RocketshipSmoke(LabSimulation player,PlayerSceneBinding binding,SceneDirector director,SceneInteractions interactions)
+ {
+ this.player=player;this.binding=binding;this.director=director;this.interactions=interactions;
+ inventory=interactions.Inventory;ship=binding.Rocketship!;
+ energy=player.Energy;initial=player.ActorRoot;
+ inventory.SetState(0,1,1);inventory.SelectGadget(1);
+ }
+ public void BeforeFrame(int count,Action key,bool headless)
+ {
+ if(count==0&&!headless)key(82,true);
+ if(count==1)Advance(90);
+ if(count==2&&!headless)key(80,true);
+ if(count==3)
+ {
+ Advance(45);
+ if(!headless){key(80,false);key(82,false);}
+ }
+ if(count==4)
+ {
+ Advance(30);turnYaw=ship.Rotation.Y;
+ if(!headless)key(40,true);
+ }
+ if(count==5)
+ {
+ Advance(65);
+ if(!headless){key(40,false);key(21,true);}
+ }
+ if(count==6){Advance(35);if(!headless)key(21,false);}
+ if(count==7)
+ {
+ Advance(30);
+ if(headless)inventory.SelectGadget(-1);else key(43,true);
+ }
+ if(count==8){if(!headless)key(43,false);inventory.SelectGadget(1);}
+ if(count==9){if(headless)player.SetNoclip(true);else key(60,true);}
+ }
+ public void Received(PlayerInput input)=>last=input;
+ private void Advance(int count)
+ {
+ for(var i=0;i100&&ship.Root.Y>initial.Y+30&&ship.FireVisible&&ship.BodySteps>80;
+ if(count==2)checks[2]=ship.Steering.Bank>0;
+ if(count==3)checks[3]=ship.Rotation.Y!=0&&ship.Steering.Bank>10;
+ if(count==4)checks[4]=ship.Maneuver.TurnRemaining>.9f;
+ if(count==5)checks[5]=ship.Maneuver.TurnRemaining==0&&MathF.Abs(MathF.IEEERemainder(ship.Rotation.Y-turnYaw,360))>90&&ship.Maneuver.RollRemaining>.9f;
+ if(count==6)checks[6]=ship.Maneuver.RollRemaining>0&&ship.Rotation.Z>60;
+ if(count==7)checks[7]=!ship.Mounted&&player.GadgetMode==-1&&director.Controlled&&ship.EngineMode==0&&!ship.FireVisible;
+ if(count==8)checks[8]=ship.Mounted&&player.GadgetMode==1;
+ if(count==9)checks[9]=!ship.Mounted&&player.Noclip&&director.Controlled&&ship.EngineMode==0;
+ }
+ public bool Passed=>checks.All(x=>x)&&player.Energy==energy;
+ public string Report=>$"Rocketship fixture: mount={checks[0]}, fly={checks[1]}, bank={checks[2]}, turn={checks[3]}, maneuver={checks[4]}, finish/roll={checks[5]}, barrel={checks[6]}, release={checks[7]}, remount={checks[8]}, noclip cleanup={checks[9]}, extra ordinary ticks={extra}, energy={player.Energy}/{energy}.";
+ public static PlayerInput Input(int count)=>new(count<=2,false,count==2,false,false,RocketTurn:count==4,RocketRoll:count==5);
+ public static string? StageName(int count)=>count switch
+ {0=>"mounted",1=>"flying",2=>"bank",3=>"turn",4=>"maneuver",5=>"roll-start",6=>"barrel",7=>"released",8=>"remounted",9=>"noclip",_=>null};
+}
diff --git a/src/GamePort/Application/RocketshipVisuals.cs b/src/GamePort/Application/RocketshipVisuals.cs
new file mode 100644
index 0000000..56f5c7e
--- /dev/null
+++ b/src/GamePort/Application/RocketshipVisuals.cs
@@ -0,0 +1,53 @@
+using System.Numerics;
+using System.Text.Json;
+using GamePort.Assets;
+using GamePort.Game;
+
+namespace GamePort.Application;
+
+/// Original Strato, HIDRIVE, HIROCK and additive FireStrato resources.
+/// Uses source local pivots/transforms without standing-sole correction.
+public sealed class RocketshipVisuals
+{
+ private sealed record Clip(MorphAnimation Animation,int Offset,MeshDraw Draw);
+ private readonly Clip ship,rider,dog,fire;
+ public Mesh Mesh { get; }
+
+ public RocketshipVisuals(Mesh combined,string preparedRoot)
+ {
+ var root=Path.Combine(preparedRoot,"rocketship");
+ using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(root,"rocketship.json")));
+ if(doc.RootElement.GetProperty("schema").GetInt32()!=1)throw new InvalidDataException("Unknown Rocketship resource schema");
+ Clip Load(string name)
+ {
+ var animation=new MorphAnimation(Path.Combine(root,name,"animation.json"));
+ var offset=combined.Vertices.Length;
+ var id=int.MinValue;while(combined.Textures.ContainsKey(id))id++;
+ combined=animation.AppendTo(combined,id);
+ var draw=combined.Draws[^1];draw.Visible=false;
+ return new(animation,offset,draw);
+ }
+ ship=Load("strato");rider=Load("jimdrive");dog=Load("godrocket");fire=Load("firestrato");
+ fire.Draw.Blend=MeshBlend.Additive;fire.Draw.Opacity=1;
+ Mesh=combined;
+ }
+
+ public void Update(Mesh mesh,Rocketship vehicle,double time,PlayerAppearance appearance)
+ {
+ var ordinary=RocketOrientation.Model(vehicle.Rotation,vehicle.Root,Vector3.One);
+ Draw(ship,RocketOrientation.Model(vehicle.Rotation,vehicle.Root,vehicle.ShapeScale),vehicle.Mounted);
+ Draw(rider,ordinary,vehicle.Mounted);
+ Draw(dog,RocketOrientation.Model(vehicle.Rotation,vehicle.CompanionRoot,Vector3.One),vehicle.Mounted);
+ Draw(fire,ordinary,vehicle.Mounted&&vehicle.FireVisible);
+ PlayerGadgetMaterial.Apply(rider.Draw,appearance);
+ var color=appearance.Color;
+ for(var i=0;i
@@ -226,7 +227,7 @@ public sealed class LabSimulation
return ((float)Math.Sin(radians), (float)Math.Cos(radians));
}
- public void Step(PlayerInput input, bool controlled = true, bool? anyControlled = null)
+ public void Step(PlayerInput input, bool controlled = true, bool? anyControlled = null, Action? afterPhysics = null)
{
if (Noclip)
{
@@ -238,6 +239,7 @@ public sealed class LabSimulation
// This reconstructs the player/input/fire partial order, not the full
// scene registry, original cadence or original collision response.
StepPhysics();
+ afterPhysics?.Invoke();
if (controlled && !InputAfterPlayerUpdate) StepInput(input);
//42469F..4246DC runs independently of raw ownership.
if (Grounded)
@@ -268,6 +270,18 @@ public sealed class LabSimulation
Speed = 0; Velocity = Vector3.Zero;
}
+ public void LeaveRocketship(Vector3 sharedEye)
+ {
+ //4285..4286 cleanup leaves the last copied root and enters air/FALL.
+ Velocity=Vector3.Zero;extraAirAcceleration=0;Speed=0;movementMode=1;
+ forceFall=true;CameraEye=sharedEye;
+ }
+
+ public void RocketImpact()
+ {
+ AdjustEnergy(-1);ScoreChanged?.Invoke(-1);CancelPoweredFlight();
+ }
+
public void StopForPrimaryFire() => Speed = 0;
public void SetShooting(bool shooting) => Shooting = shooting;
public void AdjustEnergy(float delta) => energy.Adjust(delta, LevelCode, id => EnergySound?.Invoke(id));
diff --git a/src/GamePort/Game/OriginalBodyPhysics.cs b/src/GamePort/Game/OriginalBodyPhysics.cs
index 52cd0f2..0d8fa9a 100644
--- a/src/GamePort/Game/OriginalBodyPhysics.cs
+++ b/src/GamePort/Game/OriginalBodyPhysics.cs
@@ -13,7 +13,7 @@ public readonly record struct OrdinaryBodyStep(OrdinaryBodyState Body, Vector3 P
Vector3 SupportAnchor, SupportHit? SupportHit, BodyLandingObservation? Landing,
CameraRayPolygon? Contact, int CollisionPasses, int TriangleTests);
-public enum BodyResponseProfile { Jimmy, Baseball }
+public enum BodyResponseProfile { Jimmy, Baseball, Rocketship }
///
/// Bounded479D20 composition: enabled integration/support/pairs/static flags,
@@ -77,8 +77,13 @@ public sealed class OriginalBodyPhysics
// post-callback previous/live-root equality test permits publication.
if (move.CallbackPolygon is { } contact && contact.StoredNormal.Y <= -.7f)
{
- if (velocity.Y > 0) velocity.Y = 0;
- if (acceleration.Y > 0) acceleration.Y = 0;
+ if (profile == BodyResponseProfile.Rocketship)
+ velocity.Y = -120; //43EB70: unconditional; acceleration survives.
+ else
+ {
+ if (velocity.Y > 0) velocity.Y = 0;
+ if (acceleration.Y > 0) acceleration.Y = 0;
+ }
}
else if (profile == BodyResponseProfile.Baseball && move.CallbackPolygon is { } wall)
{
@@ -105,7 +110,7 @@ public sealed class OriginalBodyPhysics
if (geometryEnabled)
{
var support = OriginalBodySupport.Resolve(new(position, previous, velocity, acceleration, radius, factor,
- PreventLowering: profile == BodyResponseProfile.Jimmy),
+ PreventLowering: profile != BodyResponseProfile.Baseball),
wasSupported, (start, end, sides) => collision.TraceSupport(start, end, sides));
if (support.Supported)
{
diff --git a/src/GamePort/Game/OriginalCameraRay.cs b/src/GamePort/Game/OriginalCameraRay.cs
index 17764a7..139f6d8 100644
--- a/src/GamePort/Game/OriginalCameraRay.cs
+++ b/src/GamePort/Game/OriginalCameraRay.cs
@@ -58,14 +58,15 @@ public sealed class OriginalCameraRay
}
///
- /// LV1B/VR01/VR04/LEV1 complete game slot134 is475CD0 (false), so only the proven
+ /// Route/tutorial complete game slot134 is475CD0 (false), including VR02's
+ ///4CDD30 table (rocketship.md), so only the proven
/// NC/checkpoint gates apply. Reject other levels rather than inventing masks.
/// Prepared source metadata is required; raw render visibility is irrelevant.
///
public static OriginalCameraRay FromRouteScene(Mesh mesh, string levelCode)
{
ArgumentNullException.ThrowIfNull(mesh);
- if (levelCode is not ("LV1B" or "VR01" or "VR04" or "VR07" or "LEV1"))
+ if (levelCode is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "LEV1"))
throw new NotSupportedException("Static camera game-filter recovery covers the route and VR01");
if (mesh.Indices.Length % 3 != 0 || mesh.CollisionPolygons.Length != mesh.Indices.Length / 3)
throw new InvalidDataException("Original camera query requires source polygon metadata");
diff --git a/src/GamePort/Game/OriginalHeading.cs b/src/GamePort/Game/OriginalHeading.cs
index e910a7b..d0f8b71 100644
--- a/src/GamePort/Game/OriginalHeading.cs
+++ b/src/GamePort/Game/OriginalHeading.cs
@@ -8,6 +8,9 @@ public static class OriginalHeading
private static readonly ushort[] halfAcos = BuildHalfAcos();
public static float Degrees(Vector3 vector)
+ => HeadingUnits(vector) * 0.02197265625f;
+
+ private static int HeadingUnits(Vector3 vector)
{
if (!float.IsFinite(vector.X) || !float.IsFinite(vector.Y) || !float.IsFinite(vector.Z))
throw new ArgumentOutOfRangeException(nameof(vector), "A finite direction is required.");
@@ -24,7 +27,29 @@ public static class OriginalHeading
angle = x < 0 ? 8192 + angle : 8192 - angle;
else if (x < 0)
angle = 16384 - angle;
- return ((-angle) & 0x3fff) * 0.02197265625f;
+ return (-angle) & 0x3fff;
+ }
+
+ /// Copied OMT2 vector::angles pitch/yaw, in signed14-bit circle units.
+ public static (int Pitch,int Yaw) Angles(Vector3 vector)
+ {
+ var heading=HeadingUnits(vector);
+ var radians=((-heading)&16383)*(Math.Tau/16384);
+ float sine=(float)Math.Sin(radians), cosine=(float)Math.Cos(radians);
+ var h=(double)vector.X*sine+(double)vector.Z*cosine;
+ double y=vector.Y;
+ int value=0;
+ if (h!=0||y!=0)
+ {
+ var index=(int)(16384*y*y/(h*h+y*y));
+ value=halfAcos[Math.Clamp(index,0,16384)];
+ if(y<0) value=h<0 ? 8192+value : 8192-value;
+ else if(h<0) value=16384-value;
+ }
+ var pitch=(4096-value)&16383;
+ if(pitch>8192)pitch-=16384;
+ if(heading>8192)heading-=16384;
+ return (pitch,heading);
}
private static ushort[] BuildHalfAcos()
diff --git a/src/GamePort/Game/OriginalStaticCollision.cs b/src/GamePort/Game/OriginalStaticCollision.cs
index b1ce786..1931566 100644
--- a/src/GamePort/Game/OriginalStaticCollision.cs
+++ b/src/GamePort/Game/OriginalStaticCollision.cs
@@ -61,7 +61,7 @@ public sealed class OriginalStaticCollision
public static OriginalStaticCollision FromRouteScene(Mesh mesh, string level)
{
ArgumentNullException.ThrowIfNull(mesh);
- if (level is not ("LV1B" or "VR01" or "VR04" or "VR07" or "LEV1"))
+ if (level is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "LEV1"))
throw new NotSupportedException("Original static game-filter recovery covers the route and VR01");
if (mesh.Indices.Length % 3 != 0 || mesh.CollisionPolygons.Length != mesh.Indices.Length / 3)
throw new InvalidDataException("Source static collision requires original polygon metadata");
diff --git a/src/GamePort/Game/PlayerSceneBinding.cs b/src/GamePort/Game/PlayerSceneBinding.cs
index 36a659c..a810a89 100644
--- a/src/GamePort/Game/PlayerSceneBinding.cs
+++ b/src/GamePort/Game/PlayerSceneBinding.cs
@@ -10,11 +10,17 @@ public sealed class PlayerSceneBinding : IDisposable
private readonly LabSimulation player;
private readonly SceneInventory inventory;
private readonly string tag;
+ public Rocketship? Rocketship { get; }
+ public bool InventoryControlled=>director.InventoryEnabled&&(director.Controlled||
+ Rocketship is{Mounted:true} rocket&&director.ControlledTag==rocket.Actor.Tag);
public int UnsupportedGadgetCleanups { get; private set; }
- public PlayerSceneBinding(SceneDirector director, LabSimulation player, SceneInventory inventory, string tag)
+ public PlayerSceneBinding(SceneDirector director, LabSimulation player, SceneInventory inventory, string tag,
+ Rocketship? rocketship=null)
{
this.director = director; this.player = player; this.inventory = inventory; this.tag = tag;
+ Rocketship=rocketship;
+ if(rocketship!=null)rocketship.RiderHit+=player.RocketImpact;
director.ActorPreparing += Prepare;
director.AuthoredTransformChanged += Transform;
director.GadgetReleaseRequested += Release;
@@ -27,11 +33,23 @@ public sealed class PlayerSceneBinding : IDisposable
public bool Step(PlayerInput input)
{
- var acceptsInput = director.Controlled || player.Noclip;
- player.Step(input, acceptsInput, director.ControlledTag != null);
+ if(player.Noclip&&Rocketship?.Mounted==true)inventory.SelectGadget(-1);
+ bool VehicleControl()=>Rocketship is{Mounted:true} r&&(director.AuthoredControlledTag==r.Actor.Tag||director.DebugForceControl);
+ var acceptsInput = director.Controlled || player.Noclip || VehicleControl();
+ Rocketship?.StepBody(FixedStepClock.Step);
+ player.Step(input,(director.Controlled&&Rocketship?.Mounted!=true)||player.Noclip,director.ControlledTag!=null,
+ ()=>{if(!player.InputAfterPlayerUpdate&&VehicleControl())Rocketship!.StepInput(input,FixedStepClock.Step);});
+ Rocketship?.StepFrame(input,FixedStepClock.Step);
+ if(Rocketship is{Mounted:true} rocket)
+ {
+ //43DF70 copies passenger transforms and reasserts ship ownership.
+ player.ApplyAuthoredTransform(rocket.Root,rocket.Rotation.Y);
+ director.TransferControl(rocket.Actor);
+ if(player.InputAfterPlayerUpdate&&VehicleControl())rocket.StepInput(input,FixedStepClock.Step);
+ }
if (player.GadgetMode==0 && player.Grounded && director.FindActor(tag) is{} actor) actor.Animation="STOP";
var rotation=director.FindActor(tag)?.Rotation ?? Vector3.Zero;
- director.SyncActor(tag,player.ActorRoot,player.TracksBubbleOrientation
+ director.SyncActor(tag,player.ActorRoot,Rocketship is{Mounted:true} vehicle?vehicle.Rotation:player.TracksBubbleOrientation
? new(player.Pitch,player.Yaw,player.Roll) : rotation with{Y=player.Yaw});
return acceptsInput;
}
@@ -50,15 +68,36 @@ public sealed class PlayerSceneBinding : IDisposable
if (!string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase)) return;
//427FF0 switches raw mode, not display selection. A rejected Invisible
//equip can leave display2 with raw mode-1; cleanup does not equip it.
- if (player.GadgetMode is 0 or 2 or 6 || inventory.SelectedGadget is -1 or 3)
+ if (player.GadgetMode is 0 or 1 or 2 or 6 || inventory.SelectedGadget is -1 or 3)
{ inventory.SelectGadget(-1); player.GadgetMode = -1; }
else if (player.GadgetMode != -1) UnsupportedGadgetCleanups++;
}
private void Selected(int item)
{
+ if(Rocketship?.Mounted==true)
+ {
+ Rocketship.Release();
+ player.LeaveRocketship(Rocketship.CameraEye);
+ if(director.FindActor(tag) is{} rider){rider.Animation="FALL";director.TransferControl(rider);}
+ }
if (item==0 && director.FindActor(tag) is{} actor) player.SeedBubbleTilt(actor.Rotation);
- player.GadgetMode=GadgetScreen.EquippedMode(item);
+ //The display tile remains available for Practice outside the bounded
+ //live scene; unsupported selection must not invent a Jimmy flight mode.
+ player.GadgetMode=item==1&&Rocketship==null?-1:GadgetScreen.EquippedMode(item);
+ if(item==1&&Rocketship!=null)
+ {
+ var rider=director.FindActor(tag)!;
+ Rocketship.Mount(player.ActorRoot,rider.Rotation with{Y=player.Yaw},player.CameraEye);
+ rider.Animation="DRIVE";
+ director.TransferControl(Rocketship.Actor);
+ }
+ }
+
+ public void ResetVehicle()
+ {
+ if(Rocketship?.Mounted==true)inventory.SelectGadget(-1);
+ Rocketship?.Reset();
}
private void DefaultGadget() => inventory.SelectGadget(-1);
@@ -93,5 +132,6 @@ public sealed class PlayerSceneBinding : IDisposable
player.Invisible.EquippedChanged -= InvisibleEquipped;
player.Baseball.EquippedChanged -= BaseballEquipped;
player.DefaultGadgetRequested -= DefaultGadget;
+ if(Rocketship!=null)Rocketship.RiderHit-=player.RocketImpact;
}
}
diff --git a/src/GamePort/Game/RocketFlight.cs b/src/GamePort/Game/RocketFlight.cs
index 5cf2291..a57bc86 100644
--- a/src/GamePort/Game/RocketFlight.cs
+++ b/src/GamePort/Game/RocketFlight.cs
@@ -11,9 +11,10 @@ public readonly record struct RocketVerticalStep(RocketVerticalState State, floa
///
/// Bounded ordinary keyboard branch of C3DFlyingObject41A6C0. Input updates
-/// retained scalars/flags after41A140's application in the ordinary update. Mouse,
+/// retained scalars/flags separately from41A140's application; registry order
+/// determines which callback comes first. Mouse,
/// analog, boost/roll, camera and body integration are separate contracts.
-/// See gameplay/rocketship.md; this component does not enable a live vehicle.
+/// The VR02 scene adapter composes this component with body and ownership phases.
///
public static class RocketFlight
{
diff --git a/src/GamePort/Game/RocketMotion.cs b/src/GamePort/Game/RocketMotion.cs
new file mode 100644
index 0000000..c711f77
--- /dev/null
+++ b/src/GamePort/Game/RocketMotion.cs
@@ -0,0 +1,79 @@
+using System.Numerics;
+
+namespace GamePort.Game;
+
+public readonly record struct RocketManeuver(float TurnRemaining=0,float RollRemaining=0,
+ bool TurnLatched=false,bool RollLatched=false);
+public readonly record struct RocketHorizontal(Vector3 Velocity,Vector3 Rotation,float PreviousBank,RocketManeuver Maneuver);
+public readonly record struct RocketCamera(Vector3 Eye,Vector3 Target,Vector3 Look,Vector3 DesiredEye,int Pitch,int Yaw);
+
+/// 41A140 horizontal/auxiliary publication and41AC0E follow camera.
+/// Callers own body integration, facing and registry input placement.
+public static class RocketMotion
+{
+ public static RocketHorizontal Apply(Vector3 velocity,Vector3 rotation,float speed,float bank,
+ float previousBank,float seconds,RocketManeuver maneuver=default,bool turnPressed=false,
+ bool rollPressed=false,bool suppressed=false,float friction=.8f)
+ {
+ Validate(seconds);Finite(velocity);Finite(rotation);
+ if(!float.IsFinite(speed)||!float.IsFinite(bank)||!float.IsFinite(previousBank)||!float.IsFinite(friction)
+ ||!float.IsFinite(maneuver.TurnRemaining)||!float.IsFinite(maneuver.RollRemaining))
+ throw new ArgumentOutOfRangeException(nameof(speed));
+ bool moving=velocity!=Vector3.Zero;
+ float turn=maneuver.TurnRemaining,roll=maneuver.RollRemaining;
+ bool turnLatch=maneuver.TurnLatched,rollLatch=maneuver.RollLatched;
+ if(!suppressed)
+ {
+ if(!turnPressed)turnLatch=false;
+ else if(moving&&!turnLatch){turnLatch=true;if(turn<=0)turn=1;}
+ if(!rollPressed)rollLatch=false;
+ else if(moving&&!rollLatch){rollLatch=true;if(roll<=0)roll=1;}
+ }
+ if(turn>0)
+ {
+ rotation=rotation with{Y=RocketOrientation.AddAxis(rotation.Y,180*seconds)};
+ turn=MathF.Max(0,turn-seconds);
+ }
+ else if(moving)
+ {
+ previousBank=bank;
+ rotation=rotation with{Y=RocketOrientation.AddAxis(rotation.Y,bank*seconds)};
+ }
+ if(roll>0)
+ {
+ roll=MathF.Max(0,roll-seconds);
+ rotation=rotation with{Z=RocketOrientation.AddAxis(rotation.Z,270*seconds)};
+ }
+ if(turn<=0)
+ {
+ var forward=RocketOrientation.Rotate(new(0,0,speed),rotation);
+ float side=moving?(float)((double)previousBank*.0181818176060915f*(1-(double)friction)*speed):0;
+ var(sin,cos)=RocketOrientation.Trig(rotation.Y);
+ velocity=new(forward.X+cos*side,velocity.Y,forward.Z+sin*side);
+ }
+ return new(velocity,rotation,previousBank,new(turn,roll,turnLatch,rollLatch));
+ }
+
+ public static RocketCamera Follow(Vector3 root,Vector3 rotation,Vector3 oldEye,float seconds,
+ Func? ray=null,int detail=0)
+ {
+ Validate(seconds);Finite(root);Finite(rotation);Finite(oldEye);
+ var desired=root+RocketOrientation.Rotate(new(0,200,-500),rotation);
+ var look=root+RocketOrientation.Rotate(new(0,50,200),rotation);
+ float gain=1;
+ if(ray?.Invoke(look,desired) is{} hit){desired=look-(look-hit.Position)*.75f;gain=2;}
+ var eye=oldEye+(desired-oldEye)*(gain*seconds*(detail<=1?.6f:1.2f));
+ var(pitch,yaw)=OriginalHeading.Angles(look-oldEye);
+ var direction=RocketOrientation.Rotate(Vector3.UnitZ,new(pitch*.02197265625f,yaw*.02197265625f,0));
+ return new(eye,eye+direction*200,look,desired,pitch,yaw);
+ }
+
+ private static void Validate(float seconds)
+ {
+ if(!float.IsFinite(seconds)||seconds<=0||seconds>=1)throw new ArgumentOutOfRangeException(nameof(seconds));
+ }
+ private static void Finite(Vector3 value)
+ {
+ if(!float.IsFinite(value.X)||!float.IsFinite(value.Y)||!float.IsFinite(value.Z))throw new ArgumentOutOfRangeException(nameof(value));
+ }
+}
diff --git a/src/GamePort/Game/RocketOrientation.cs b/src/GamePort/Game/RocketOrientation.cs
new file mode 100644
index 0000000..25adf79
--- /dev/null
+++ b/src/GamePort/Game/RocketOrientation.cs
@@ -0,0 +1,70 @@
+using System.Numerics;
+
+namespace GamePort.Game;
+
+/// 472B10/472480/41ADF0. Lookup angles and the source's asymmetric
+/// negative seam are intentional. Numeric original references accompany the
+/// Rocketship tests; double intermediates approximate x87, not its full ABI.
+public static class RocketOrientation
+{
+ public static (float Sin, float Cos) Trig(float degrees)
+ {
+ if (!float.IsFinite(degrees) || Math.Abs(degrees) > 40000000)
+ throw new ArgumentOutOfRangeException(nameof(degrees));
+ var index = (int)((double)degrees * 45.511112213134766) & 16383;
+ return Units(index);
+ }
+
+ public static (float Sin, float Cos) Units(int index)
+ {
+ var radians = (index & 16383) * (Math.Tau / 16384);
+ return ((float)Math.Sin(radians), (float)Math.Cos(radians));
+ }
+
+ public static Vector3 Rotate(Vector3 vector, Vector3 euler)
+ {
+ Finite(vector); Finite(euler);
+ var (sx,cx)=Trig(euler.X); var (sy,cy)=Trig(euler.Y); var (sz,cz)=Trig(euler.Z);
+ var a=(float)((double)cz*vector.Y-(double)sz*vector.X);
+ var b=(double)cz*vector.X+(double)sz*vector.Y;
+ var c=(double)cx*vector.Z-(double)a*sx;
+ return new((float)(b*cy-c*sy),(float)((double)a*cx+(double)sx*vector.Z),(float)(c*cy+b*sy));
+ }
+
+ public static float AddAxis(float value, float delta)
+ {
+ var total=(double)value+delta;
+ if (!double.IsFinite(total) || Math.Abs(total)>int.MaxValue)
+ throw new ArgumentOutOfRangeException(nameof(delta));
+ if (total<0) total=360-Math.Abs(Math.Truncate(total));
+ else if (total>360) total-=360;
+ return (float)total;
+ }
+
+ public static Vector3 Add(Vector3 angles, Vector3 delta) =>
+ new(AddAxis(angles.X,delta.X),AddAxis(angles.Y,delta.Y),AddAxis(angles.Z,delta.Z));
+
+ public static Vector3 Face(Vector3 rotation, Vector3 destination, float seconds, bool barrelRolling=false)
+ {
+ Finite(rotation); Finite(destination);
+ if (!float.IsFinite(seconds) || seconds<=0 || seconds>=1)
+ throw new ArgumentOutOfRangeException(nameof(seconds));
+ if (barrelRolling) return rotation;
+ var difference=destination-rotation;
+ float Arc(float value,bool yaw=false) => value>180 ? value-360 : !yaw&&value< -180 ? value+360 : value;
+ return Add(rotation,new(Arc(difference.X)*seconds*2,Arc(difference.Y,true)*seconds*4,Arc(difference.Z)*seconds*3));
+ }
+
+ public static Matrix4x4 Model(Vector3 euler, Vector3 root, Vector3 scale)
+ {
+ Finite(root); Finite(scale);
+ var x=Rotate(Vector3.UnitX,euler);var y=Rotate(Vector3.UnitY,euler);var z=Rotate(Vector3.UnitZ,euler);
+ return Matrix4x4.CreateScale(scale)*new Matrix4x4(x.X,x.Y,x.Z,0,y.X,y.Y,y.Z,0,z.X,z.Y,z.Z,0,root.X,root.Y,root.Z,1);
+ }
+
+ private static void Finite(Vector3 value)
+ {
+ if (!float.IsFinite(value.X)||!float.IsFinite(value.Y)||!float.IsFinite(value.Z))
+ throw new ArgumentOutOfRangeException(nameof(value));
+ }
+}
diff --git a/src/GamePort/Game/Rocketship.cs b/src/GamePort/Game/Rocketship.cs
new file mode 100644
index 0000000..9d93f52
--- /dev/null
+++ b/src/GamePort/Game/Rocketship.cs
@@ -0,0 +1,143 @@
+using System.Numerics;
+using GamePort.Assets;
+
+namespace GamePort.Game;
+
+/// Jimmy's owned/reused3ROC. Bounded to the recovered VR02 static
+/// scene; caller places body, registry and input phases explicitly.
+public sealed class Rocketship
+{
+ private readonly OriginalBodyPhysics physics;
+ private readonly OriginalCameraRay cameraRay;
+ private readonly RocketFlightTuning tuning;
+ private readonly float accelerationLean,decelerationLean;
+ private OrdinaryBodyState body;
+ private bool facing;
+ private float verticalCommand,previousBank;
+ private Vector3 destination;
+ public DirectorActor Actor { get; }
+ public bool Mounted { get; private set; }
+ public Vector3 Root=>body.Position;
+ public Vector3 Velocity=>body.Velocity;
+ public Vector3 Acceleration=>body.Acceleration;
+ public Vector3 Rotation { get; private set; }
+ public bool Supported=>body.Supported;
+ public RocketSteering Steering { get; private set; }
+ public RocketManeuver Maneuver { get; private set; }
+ public Vector3 CameraEye { get; private set; }
+ public Vector3 CameraTarget { get; private set; }
+ public Vector3 CompanionRoot=>Root+RocketOrientation.Rotate(new(0,10,-25),Rotation);
+ public bool FireVisible { get; private set; }
+ public Vector3 ShapeScale { get; private set; }=Vector3.One;
+ public bool ImpactActive { get; private set; }
+ public float ImpactTime { get; private set; }
+ public int Contacts { get; private set; }
+ public int BodySteps { get; private set; }
+ public int FrameSteps { get; private set; }
+ public int InputSteps { get; private set; }
+ public int EngineMode { get; private set; }
+ public event Action? EngineSound;
+ public event Action? EngineStopped;
+ public event Action? Sound;
+ public event Action? RiderHit;
+
+ public Rocketship(DirectorActor actor,Mesh world,string level)
+ {
+ if(level!="VR02"||actor.Kind!="3ROC"||actor.SourceGam is not{} source)
+ throw new NotSupportedException("Live Rocketship requires the authored VR02 ship");
+ Actor=actor;
+ float Required(string name)=>source.Properties.TryGetValue(name,out var p)?p.Float:
+ throw new InvalidDataException($"Missing authored Rocketship {name}");
+ tuning=new(Required("AccelRate"),Required("DecelRate"),Required("MaxSpeed"),3900,
+ Required("UpRate"),Required("DownRate"),Required("MaxVertVelocity"));
+ accelerationLean=Required("AccelLean");decelerationLean=Required("DecelLean");
+ if(world.CollisionPolygons.Any(p=>p.MaterialId is{} id&&id is not(0 or 2 or 3 or 5)))
+ throw new NotSupportedException("Rocketship VR02 contact materials require their recovered profile");
+ physics=new(OriginalStaticCollision.FromRouteScene(world,level));
+ cameraRay=OriginalCameraRay.FromRouteScene(world,level);
+ Reset();
+ }
+
+ public void Reset()
+ {
+ if(EngineMode!=0)SetEngine(0);
+ Mounted=FireVisible=facing=ImpactActive=false;
+ body=new(Actor.SourceGam!.Position,Vector3.Zero,Vector3.Zero,Vector3.Zero);
+ Rotation=Actor.SourceGam.Rotation;destination=Rotation;
+ Steering=default;Maneuver=default;verticalCommand=previousBank=ImpactTime=0;
+ ShapeScale=Vector3.One;Contacts=BodySteps=FrameSteps=InputSteps=0;
+ Actor.BodyEnabled=Actor.Visible=false;
+ }
+
+ public void Mount(Vector3 root,Vector3 rotation,Vector3 sharedEye)
+ {
+ //42944D copies transforms and flags; it does not reset retained motion.
+ body=body with{Position=root};Rotation=rotation;CameraEye=sharedEye;
+ CameraTarget=sharedEye+Vector3.UnitZ*200;
+ Mounted=true;Actor.BodyEnabled=Actor.Visible=true;SyncActor();
+ }
+
+ public void Release()
+ {
+ //428541 disables integration and explicitly stops43EA80 before hiding.
+ Mounted=FireVisible=false;Actor.BodyEnabled=Actor.Visible=false;SetEngine(0);
+ }
+
+ public void StepBody(float seconds)
+ {
+ if(!Mounted)return;
+ var step=physics.Step(body,seconds,50,.6f,profile:BodyResponseProfile.Rocketship);
+ body=step.Body;BodySteps++;
+ //43E8D0 ordinary VR02 material path; null material has no side effects.
+ if(step.Contact is{} wall&&wall.StoredNormal.Y>-.7f&&wall.MaterialId.HasValue&&!ImpactActive)
+ {
+ ImpactActive=true;ImpactTime=0;Contacts++;
+ RiderHit?.Invoke();Sound?.Invoke(197);
+ }
+ }
+
+ public void StepFrame(PlayerInput input,float seconds)
+ {
+ if(facing)Rotation=RocketOrientation.Face(Rotation,destination,seconds,Maneuver.RollRemaining>0);
+ var motion=RocketMotion.Apply(body.Velocity,Rotation,Steering.Speed,Steering.Bank,previousBank,seconds,
+ Maneuver,input.RocketTurn,input.RocketRoll);
+ Rotation=motion.Rotation;previousBank=motion.PreviousBank;Maneuver=motion.Maneuver;
+ var vertical=RocketFlight.StepVertical(new(Root.Y,motion.Velocity.Y,verticalCommand),Steering,tuning,RecoveredMotion.Gravity.Y);
+ verticalCommand=vertical.State.CommandedAcceleration;
+ body=body with{Position=Root with{Y=vertical.State.Height},Velocity=motion.Velocity with{Y=vertical.State.Velocity},
+ Acceleration=body.Acceleration with{Y=vertical.BodyAcceleration}};
+ FrameSteps++;
+ if(!Mounted){Steering=Steering with{Speed=0};return;}
+ FireVisible=!Steering.Down&&Steering.Speed>0;
+ if(ImpactActive)
+ {
+ double time=(double)ImpactTime+seconds;
+ ImpactTime=(float)time;
+ if(time>1){ImpactActive=false;ShapeScale=Vector3.One;}
+ else {float pulse=(float)((Math.Sin(time*20)+1)*.5);ShapeScale=new(1,pulse,pulse);}
+ }
+ SyncActor();
+ }
+
+ public void StepInput(PlayerInput input,float seconds)
+ {
+ if(!Mounted)return;
+ Steering=RocketFlight.StepKeyboardInput(Steering,input with{Forward=input.Forward||input.RocketMouseRise},Supported,seconds,tuning);
+ destination=new(Steering.Up?accelerationLean:Steering.Down?decelerationLean:0,Rotation.Y,
+ Steering.Up||Steering.Down||Steering.Speed>0?-Steering.Bank:0);
+ facing=true;
+ SetEngine(Steering.Up?2:Steering.Down||Steering.Speed<=0?0:1);
+ var camera=RocketMotion.Follow(Root,Rotation,CameraEye,seconds,(a,b)=>cameraRay.Trace(a,b));
+ CameraEye=camera.Eye;CameraTarget=camera.Target;InputSteps++;
+ }
+
+ private void SetEngine(int mode)
+ {
+ if(EngineMode==mode)return;
+ if(EngineMode!=0)EngineStopped?.Invoke();
+ EngineMode=mode;
+ if(mode!=0)EngineSound?.Invoke(mode==1?195:196);
+ }
+
+ private void SyncActor(){Actor.Position=Root;Actor.Rotation=Rotation;Actor.Speed=Steering.Speed;}
+}
diff --git a/src/GamePort/Game/SceneDirector.cs b/src/GamePort/Game/SceneDirector.cs
index 2b090f0..edda6ec 100644
--- a/src/GamePort/Game/SceneDirector.cs
+++ b/src/GamePort/Game/SceneDirector.cs
@@ -183,6 +183,12 @@ public sealed class SceneDirector
public DirectorActor? FindActor(string tag) => actors.GetValueOrDefault(tag);
+ internal void TransferControl(DirectorActor actor)
+ {
+ if(!Actors.Contains(actor))throw new ArgumentException("Control requires a registered actor",nameof(actor));
+ ControlledTag=actor.Tag;
+ }
+
public void RegisterPatrolConsumer(string tag) => patrolConsumers.Add(tag);
public void SyncActor(string tag, Vector3 position, Vector3 rotation)
diff --git a/src/GamePort/Game/SceneInteractions.cs b/src/GamePort/Game/SceneInteractions.cs
index 04f9806..9b6029f 100644
--- a/src/GamePort/Game/SceneInteractions.cs
+++ b/src/GamePort/Game/SceneInteractions.cs
@@ -77,15 +77,17 @@ public sealed class SceneInteractions
&& id > 0 && id < itemStates.Length && itemStates[id] != 0) actor.Active = actor.Visible = false;
}
- public void Update(Vector3 activePlayerRoot, float playerRadius = 60)
+ public void Update(Vector3 activePlayerRoot, float playerRadius = 60, DirectorActor? vehicle = null)
{
if (!float.IsFinite(activePlayerRoot.X + activePlayerRoot.Y + activePlayerRoot.Z)
|| !float.IsFinite(playerRadius) || playerRadius < 0) throw new ArgumentOutOfRangeException(nameof(activePlayerRoot));
- if (!director.Controlled) return;
+ bool VehicleControlled()=>vehicle is{Kind:"3ROC"}&&director.AuthoredControlledTag==vehicle.Tag;
+ bool Controlled()=>director.Controlled||VehicleControlled();
+ if (!Controlled()) return;
HideCollected();
foreach (var actor in director.Actors)
{
- if (!director.Controlled) break;
+ if (!Controlled()) break;
if (actor.SourceGam is not { } source || source.Kind is not ("3PIC" or "3TRO" or "LOAD" or "3CAR")) continue;
// C3DFriend update41B972..988 calls the talk dispatcher every update
// in state0, even when a prior contact found no matching TalkTrigger.
@@ -95,7 +97,10 @@ public sealed class SceneInteractions
if (!director.Controlled) break;
}
// Carl InitObject413E2F..45 sets radius100 and support factor0.75.
- var radius = playerRadius + (source.Kind == "3TRO" ? 20 : source.Kind == "3CAR" ? 100 : source.Number("Radius"));
+ //435D08 pickups require the raw controlled ship.457EE6 LOAD requires
+ //the real Jimmy passenger; the coincident actors keep distinct radii.
+ var contactRadius=source.Kind=="3PIC"&&VehicleControlled()?50:playerRadius;
+ var radius = contactRadius + (source.Kind == "3TRO" ? 20 : source.Kind == "3CAR" ? 100 : source.Number("Radius"));
var overlaps = actor.Active && (source.Kind!="3TRO" || actor.BodyEnabled)
&& OriginalBodySupport.QuickMagnitude(activePlayerRoot - actor.Position) < radius;
if (!overlaps) { contacts.Remove(source.Offset); continue; }
diff --git a/src/GamePort/Program.cs b/src/GamePort/Program.cs
index d15008c..38ffc4b 100644
--- a/src/GamePort/Program.cs
+++ b/src/GamePort/Program.cs
@@ -89,6 +89,7 @@ internal static class Program
--smoke-shrink-ray Fire at an actual VR04 soldier; explicit player-placement fixture
--smoke-invisible Accelerated recharge/activation/flash/expiry/unequip fixture in VR03
--smoke-baseball VR07 aim/release/flight/target/respawn fixture
+ --smoke-rocketship VR02 flight/turn/roll/control fixture
--smoke-bubble VR01 expand/throttle/bounce/cleanup/fade input fixture
--gadget-menu Render original gadget panel (--skip-intro); fixture owns item3
--smoke-gadget-menu SDL menu input/pause/selection/practice/Return check (24 frames)
@@ -262,6 +263,7 @@ internal static class Program
var invisibleSmoke = args.Contains("--smoke-invisible");
var bubbleSmoke = args.Contains("--smoke-bubble");
var baseballSmoke = args.Contains("--smoke-baseball");
+ var rocketSmoke = args.Contains("--smoke-rocketship");
var carlSmoke = args.Contains("--smoke-carl-cutscene");
var controlPhaseSmoke = args.Contains("--smoke-control-phases");
var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
@@ -282,7 +284,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 || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || gadgetWindowSmoke || practiceWindowSmoke || practiceReturnSmoke || carlSmoke || controlPhaseSmoke || objectiveSmoke;
+ || args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || gadgetWindowSmoke || 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.");
@@ -315,6 +317,8 @@ internal static class Program
SceneBaseballs? baseballs = null;
BaseballVisuals? baseballVisuals = null;
BaseballAimOverlay? baseballAim = null;
+ Rocketship? rocketship = null;
+ RocketshipVisuals? rocketshipVisuals = null;
var practice = new PracticePrompt();
ObjectivePanel? objectivePanel = null;
var patrols = new Dictionary(StringComparer.OrdinalIgnoreCase);
@@ -343,13 +347,13 @@ internal static class Program
var standingPose = AseMesh.Load(AssetPath.Resolve(root, "ASE/jimstop.ase"));
if (walking)
{
- var cameraRay = level!.Code is "LV1B" or "VR01" or "VR04" or "VR07" or "LEV1"
+ var cameraRay = level!.Code is "LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "LEV1"
? OriginalCameraRay.FromRouteScene(world, level.Code) : null;
debugCameraRay = cameraRay;
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation.Y,
cameraRay == null ? null : (look, eye) => cameraRay.Trace(look, eye),
cameraRay == null ? null : (start, end) => cameraRay.TraceGeometry(start, end),
- level.Code is "VR01" or "VR04" or "VR07" ? OriginalStaticCollision.FromRouteScene(world,level.Code) : null, energy)
+ level.Code is "VR01" or "VR02" or "VR04" or "VR07" ? OriginalStaticCollision.FromRouteScene(world,level.Code) : null, energy)
{ LevelCode = level.Code, InputAfterPlayerUpdate = carriedSave != null };
if (carriedPlayer != null)
{
@@ -389,6 +393,7 @@ internal static class Program
simulation!.Energy = interactions.Energy;
simulation.JetpackInventoryState = () => interactions.Inventory.State(0, 3);
simulation.ScoreChanged += interactions.ChangeScore;
+ if(level.Code=="VR02")rocketship=new(director.Actors.Single(a=>a.Kind=="3ROC"),world,level.Code);
if (level.Code is "LV1B" or "VR04" or "LEV1")
{
gadgets = new SceneGadgets(director,interactions.Inventory,simulation,world);
@@ -457,6 +462,11 @@ internal static class Program
mesh = bubbleVisuals.Mesh;
baseballVisuals = new(mesh,Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scene!)!,"..")));
mesh = baseballVisuals.Mesh;
+ if(rocketship!=null)
+ {
+ rocketshipVisuals=new(mesh,Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scene!)!,"..")));
+ mesh=rocketshipVisuals.Mesh;
+ }
if (gadgets != null)
{
rayVisuals = new ShrinkRayVisuals(mesh,Path.GetFullPath(Path.Combine(Path.GetDirectoryName(scene!)!, "..")),root);
@@ -500,7 +510,7 @@ 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" : shrinkSmoke ? "90" : invisibleSmoke || bubbleSmoke || baseballSmoke ? "8" : gadgetWindowSmoke ? "24" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : controlPhaseSmoke ? "32" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
+ var frames = int.Parse(Option(args, "--frames") ?? (rocketSmoke ? "10" : walkSmoke ? "240" : jetpackSmoke ? "300" : shrinkSmoke ? "90" : invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke ? "8" : gadgetWindowSmoke ? "24" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : controlPhaseSmoke ? "32" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
if (gadgetWindowSmoke && (headless || level?.Code != "LV1B" || loadedSave != null || frames < 24))
throw new ArgumentException("Gadget menu SDL fixture requires a fresh windowed lab and24 frames");
if (shrinkSmoke && (level?.Code != "VR04" || gadgets == null || frames < 60))
@@ -511,6 +521,8 @@ internal static class Program
throw new ArgumentException("Bubble smoke requires a fresh VR01 and at least8 frames");
if(baseballSmoke && (level?.Code!="VR07" || frames<8 || loadedSave!=null))
throw new ArgumentException("Baseball fixture requires a fresh VR07 and at least8 frames");
+ if(rocketSmoke&&(level?.Code!="VR02"||frames<10||loadedSave!=null))
+ throw new ArgumentException("Rocketship fixture requires fresh VR02 and at least10 frames");
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))
@@ -535,7 +547,7 @@ internal static class Program
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!);
+ : new PlayerSceneBinding(director, simulation!, interactions!.Inventory, level!.Player!.Tag!,rocketship);
var renderer = presentation.LoadScene(mesh, texture, headless,
walking ? WalkTitle : animations?.WindowTitle ?? "Jimmy Neutron — scene preview | C camera",
width, height, !args.Contains("--no-validation"));
@@ -546,6 +558,8 @@ internal static class Program
InvisibleSmoke? invisibleFixture = null;
BubbleSmoke? bubbleFixture = null;
BaseballSmoke? baseballFixture = null;
+ RocketshipSmoke? rocketFixture=null;
+ var sawRocketKeys=0;
var sawBaseballKeys=0;
var sawBubbleKeys=0;
Console.WriteLine($"Scene presentation: revision={renderer.SceneRevision}, windows={presentation.WindowCreationCount}, renderers={presentation.RendererCreationCount}, window ID={(window == 0 ? 0 : Sdl.SDL_GetWindowID(window))}, size={renderer.Width}x{renderer.Height}.");
@@ -560,6 +574,12 @@ internal static class Program
simulation.BubbleSoundStopped += () => sceneAudio?.StopLoop("bubble");
}
if(baseballs!=null)baseballs.Sound+=id=>sceneAudio?.Effect(id);
+ if(rocketship!=null)
+ {
+ rocketship.Sound+=id=>sceneAudio?.Effect(id);
+ rocketship.EngineSound+=id=>sceneAudio?.Effect(id,"rocket-engine");
+ rocketship.EngineStopped+=()=>sceneAudio?.StopLoop("rocket-engine");
+ }
if (gadgets != null)
{
gadgets.Sound += (id,loop) => sceneAudio?.Effect(id,loop ? "shrink-ray" : null);
@@ -603,7 +623,7 @@ internal static class Program
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
}
- if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
+ if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); }
if (controlPhaseSmoke)
{
@@ -685,6 +705,7 @@ internal static class Program
}
if (invisibleSmoke) invisibleFixture = new(simulation!,interactions!.Inventory);
if(baseballSmoke)baseballFixture=new(simulation!,playerBinding!,interactions!.Inventory,baseballs!,director);
+ if(rocketSmoke)rocketFixture=new(simulation!,playerBinding!,director,interactions!);
if (bubbleSmoke) bubbleFixture = new(simulation!,interactions!.Inventory);
if (shrinkSmoke)
{
@@ -776,7 +797,8 @@ internal static class Program
gadgetScreen?.Close();
if (simulation == null) { debugMenu.Message = "RESET REQUIRES PLAY MODE"; return; }
if (practice.Active) practice.Key(17, Vector2.Zero);
- simulation.Reset(); poseTime = 0; sceneAudio?.StopSpeech(); director?.Begin(originalStart!);
+ playerBinding?.ResetVehicle();simulation.Reset(); poseTime = 0; sceneAudio?.StopSpeech(); director?.Begin(originalStart!);
+ rocketship?.Reset();
interactions?.Reset(); mechanisms?.Reset(); gadgets?.Reset(); baseballs?.Reset(); mouseFire = false;
director?.SyncActor(level!.Player!.Tag!, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
}
@@ -804,7 +826,7 @@ internal static class Program
case DebugAction.Resume: debugMenu.Close(); break;
case DebugAction.Camera: ToggleCamera(); debugMenu.Close(); break;
case DebugAction.SkipCutscene:
- if (director is { Playing: true } or { Blocked: true } or { Controlled: false })
+ if (director is { Playing: true } or { Blocked: true }||director is{Controlled:false}&&rocketship?.Mounted!=true)
{ sceneAudio?.StopSpeech(); director.Skip(); debugMenu.Message = "CUTSCENE SKIPPED"; }
else debugMenu.Message = "NO ACTIVE CUTSCENE";
break;
@@ -872,6 +894,11 @@ internal static class Program
for (var item = 0; item < 8; item++) interactions.Inventory.SetState(0,item,1);
debugMenu.Message = "ALL 8 GADGETS GIVEN - TAB/SPACE OPENS GADGETS DURING PLAY";
break;
+ case DebugAction.GiveRocketship when interactions != null:
+ interactions.Inventory.SetState(0,1,1);interactions.Inventory.SelectGadget(1);
+ debugMenu.Message=rocketship?.Mounted==true?"ROCKETSHIP EQUIPPED - ARROWS FLY, ENTER/T TURN, R ROLL":
+ "ROCKETSHIP GIVEN - SELECT ITS PRACTICE TILE TO FLY IN VR02";
+ break;
case DebugAction.CameraObstruction when debugCameraRay != null:
debugCameraRay.Enabled = !debugCameraRay.Enabled; debugMenu.Message = "STATIC CAMERA QUERY TOGGLED"; break;
case DebugAction.MuteMusic or DebugAction.MuteSpeech or DebugAction.MuteEffects when sceneAudio != null:
@@ -937,6 +964,11 @@ internal static class Program
}
while (running)
{
+ rocketFixture?.BeforeFrame(count,(key,down)=>
+ {
+ var e=new Sdl.Event{Type=down?Sdl.KeyDown:Sdl.KeyUp,Scancode=key,Down=down?(byte)1:(byte)0};
+ if(!Sdl.SDL_PushEvent(ref e))throw new InvalidOperationException(Sdl.Error);
+ },headless);
baseballFixture?.BeforeFrame(count,(key,down)=>
{
var e=new Sdl.Event{Type=down?Sdl.KeyDown:Sdl.KeyUp,Scancode=key,Down=down?(byte)1:(byte)0};
@@ -998,6 +1030,8 @@ internal static class Program
}
while (!headless && Sdl.SDL_PollEvent(out var e))
{
+ if(rocketSmoke&&e.Type==Sdl.KeyDown)
+ sawRocketKeys|=e.Scancode switch{82=>1,80=>2,40=>4,21=>8,43=>16,60=>32,_=>0};
if(baseballSmoke && e.Type==Sdl.KeyDown)
sawBaseballKeys|=e.Scancode switch{224=>1,80=>2,82=>4,43=>8,_=>0};
if (bubbleSmoke && e.Type==Sdl.KeyDown)
@@ -1049,11 +1083,11 @@ internal static class Program
}
if (e.Type == Sdl.KeyDown && e.Scancode is 43 or 44
&& !inspecting && simulation?.Noclip != true && !practice.Active && gadgetScreen != null
- && (gadgetScreen.Open || director is { Controlled: true, InventoryEnabled: true }))
+ && (gadgetScreen.Open || playerBinding?.InventoryControlled==true))
{
var first = gadgetHeldKeys.Count == 0;
gadgetHeldKeys.Add(e.Scancode);
- if (first && e.Repeat == 0) gadgetScreen.Toggle(director is { Controlled: true, InventoryEnabled: true });
+ if (first && e.Repeat == 0) gadgetScreen.Toggle(playerBinding?.InventoryControlled==true);
debugCapturedKeys.UnionWith(keys);
keys.Clear(); mouseJump = mouseFire = false; stepClock.Reset(); continue;
}
@@ -1083,7 +1117,7 @@ internal static class Program
if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == jumpScancode ? 4 : 0;
if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == jumpScancode ? 8 : 0;
if (smoke && e.Scancode == 79) sawKey = true;
- if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false }
+ if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false }&&rocketship?.Mounted!=true
&& (e.Scancode != 44 || simulation?.Noclip != true))
{ sceneAudio?.StopSpeech(); director.Skip(); keys.Clear(); mouseJump = false; }
else if (e.Scancode == 41) running = false;
@@ -1097,7 +1131,7 @@ internal static class Program
{
ToggleCamera(); keys.Clear(); mouseJump = false; stepClock.Reset();
}
- if (!inspecting && e.Scancode == 21 && e.Repeat == 0)
+ if (!inspecting && e.Scancode == 21 && e.Repeat == 0 && rocketship?.Mounted!=true)
{
ResetScene();
}
@@ -1126,12 +1160,13 @@ internal static class Program
}
}
if (debugMenu.Open) animationStarted += elapsed;
- if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && gadgetScreen?.Open != true && (active || headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || gadgetWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke))
+ if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && gadgetScreen?.Open != true && (active || headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || gadgetWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke))
{
- var steps = headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || gadgetWindowSmoke || practiceWindowSmoke || carlSmoke || controlPhaseSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
+ var steps = headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || gadgetWindowSmoke || practiceWindowSmoke || carlSmoke || controlPhaseSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
for (var step = 0; step < steps; step++)
{
var input = carlSmoke || controlPhaseSmoke ? new PlayerInput(true, false, true, false, true)
+ : rocketSmoke && headless ? RocketshipSmoke.Input(count)
: baseballSmoke && headless ? BaseballSmoke.Input(count)
: bubbleSmoke && headless ? BubbleSmoke.Input(count)
: invisibleSmoke && headless ? new PlayerInput(false,false,false,false,false,Fire:count==1)
@@ -1142,7 +1177,8 @@ internal static class Program
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),
- mouseFire || keys.Contains(40) || keys.Contains(88) || keys.Contains(224) || keys.Contains(228));
+ mouseFire || keys.Contains(40) || keys.Contains(88) || keys.Contains(224) || keys.Contains(228),
+ RocketTurn:keys.Contains(40)||keys.Contains(88)||keys.Contains(23),RocketRoll:keys.Contains(21),RocketMouseRise:mouseJump);
gadgets?.StepBodies(FixedStepClock.Step);
baseballs?.StepBodies(FixedStepClock.Step);
var before = simulation.Position;
@@ -1150,6 +1186,7 @@ internal static class Program
bool acceptsInput;
if (playerBinding != null) acceptsInput = playerBinding.Step(input);
else { simulation.Step(input); acceptsInput = true; }
+ rocketFixture?.Received(input);
gadgets?.StepTimers(FixedStepClock.Step);
baseballs?.StepTargets(FixedStepClock.Step);
if (jetpackSmoke && powered)
@@ -1163,7 +1200,7 @@ internal static class Program
if (!simulation.Noclip)
{
director?.Touch(level!.Player!.Tag!, simulation.ActorRoot);
- interactions?.Update(simulation.ActorRoot, simulation.InteractionRadius);
+ interactions?.Update(simulation.ActorRoot, simulation.InteractionRadius,rocketship is{Mounted:true}?rocketship.Actor:null);
}
if (practice.Active) { keys.Clear(); mouseJump = false; stepClock.Reset(); break; }
if (!simulation.Noclip) mechanisms?.Update(simulation.ActorRoot, simulation.InteractionRadius);
@@ -1206,6 +1243,11 @@ internal static class Program
view = Matrix4x4.CreateLookAtLeftHanded(simulation.CameraEye, simulation.CameraTarget, Vector3.UnitY);
renderEye = simulation.CameraEye; renderTarget = simulation.CameraTarget;
}
+ if(!inspecting&&rocketship is{Mounted:true})
+ {
+ renderEye=rocketship.CameraEye;renderTarget=rocketship.CameraTarget;
+ view=Matrix4x4.CreateLookAtLeftHanded(renderEye,renderTarget,Vector3.UnitY);
+ }
if (!inspecting && simulation?.Noclip != true && director?.CameraEye is { } storyEye && director.CameraTarget is { } storyTarget)
{
view = Matrix4x4.CreateLookAtLeftHanded(storyEye, storyTarget, Vector3.UnitY);
@@ -1220,6 +1262,7 @@ internal static class Program
bubbleVisuals?.Update(mesh,simulation!.Bubble,simulation.BubbleRoot,renderEye,renderTarget);
baseballVisuals?.Update(mesh,simulation!.Baseball.Projectiles,renderEye,renderTarget);
baseballAim?.Update(mesh,simulation!.Baseball,renderer.Width,renderer.Height);
+ if(rocketship!=null)rocketshipVisuals?.Update(mesh,rocketship,rocketship.FrameSteps/60d,simulation!.Appearance);
spriteVisuals?.FaceCamera(renderEye, renderTarget, mesh);
objectivePanel?.Key(keys.Contains(18) && !debugMenu.Open && !inspecting && !practice.Active && gadgetScreen?.Open != true
&& director is { Controlled: true, InventoryEnabled: true });
@@ -1234,7 +1277,7 @@ internal static class Program
}
var gameplayProjection = originalCamera || simulation != null && !inspecting;
var cameraMode = simulation?.Noclip == true && !inspecting ? "NOCLIP" : !inspecting && director?.CameraEye != null ? "CUTSCENE"
- : simulation != null && !inspecting ? "GAMEPLAY" : originalCamera ? "STRT" : "ORBIT";
+ : rocketship?.Mounted==true&&!inspecting?"ROCKETSHIP":simulation != null && !inspecting ? "GAMEPLAY" : originalCamera ? "STRT" : "ORBIT";
var debugStatus = new DebugStatus(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
simulation?.ActorRoot ?? Vector3.Zero, simulation?.Yaw ?? 0, simulation?.Speed ?? 0,
simulation?.Grounded ?? false, simulation?.Energy ?? 0, interactions?.Score ?? 0,
@@ -1253,6 +1296,7 @@ internal static class Program
BubblePhase = simulation?.Bubble.Active==true ? "ACTIVE" : simulation?.Bubble.Expanding==true ? "EXPAND"
: simulation?.Bubble.Collapsing==true ? "FADE" : "OFF",
BaseballState=simulation==null?"OFF":$"{(simulation.Baseball.Equipped?"ON":"OFF")} AIM {simulation.Baseball.SavedPitch:F1} PENDING {simulation.Baseball.PendingThrow} THROWS {simulation.Baseball.Throws}",
+ RocketshipState=rocketship==null?null:$"{(rocketship.Mounted?"ON":"OFF")} SPEED {rocketship.Steering.Speed:F1} VY {rocketship.Velocity.Y:F1} HIT {rocketship.Contacts}",
BodyRadius = simulation?.InteractionRadius ?? 60, BodyFactor=simulation?.BodyFactor ?? 1.265f,
Objective = interactions?.CurrentObjective ?? 0, ObjectiveTime = objectivePanel?.Elapsed ?? 0,
CameraObstruction = debugCameraRay?.Enabled, CameraPolygons = debugCameraRay?.PolygonCount ?? 0,
@@ -1284,6 +1328,7 @@ internal static class Program
}
if (simulation != null && characterDraw != null)
{
+ characterDraw.Visible=rocketship?.Mounted!=true;
PlayerGadgetMaterial.Apply(characterDraw,simulation.Appearance);
var color=simulation.Appearance.Color;
for(var i=0;i
Exenet10.0
enableenablefalse
-
+
+
diff --git a/tests/GamePort.RocketFlightTests/MotionReferences.cs b/tests/GamePort.RocketFlightTests/MotionReferences.cs
new file mode 100644
index 0000000..6835e5b
--- /dev/null
+++ b/tests/GamePort.RocketFlightTests/MotionReferences.cs
@@ -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}");
+ }
+}
diff --git a/tests/GamePort.RocketFlightTests/Program.cs b/tests/GamePort.RocketFlightTests/Program.cs
index 18d881e..cebfc75 100644
--- a/tests/GamePort.RocketFlightTests/Program.cs
+++ b/tests/GamePort.RocketFlightTests/Program.cs
@@ -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}"); }
diff --git a/tests/GamePort.RocketFlightTests/original-motion-reference.json b/tests/GamePort.RocketFlightTests/original-motion-reference.json
new file mode 100644
index 0000000..e792e21
--- /dev/null
+++ b/tests/GamePort.RocketFlightTests/original-motion-reference.json
@@ -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
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/GamePort.RocketshipTests/GamePort.RocketshipTests.csproj b/tests/GamePort.RocketshipTests/GamePort.RocketshipTests.csproj
new file mode 100644
index 0000000..15529fb
--- /dev/null
+++ b/tests/GamePort.RocketshipTests/GamePort.RocketshipTests.csproj
@@ -0,0 +1,8 @@
+
+ Exenet10.0
+ enableenablefalse
+
+
+
+
+
diff --git a/tests/GamePort.RocketshipTests/Program.cs b/tests/GamePort.RocketshipTests/Program.cs
new file mode 100644
index 0000000..c210e95
--- /dev/null
+++ b/tests/GamePort.RocketshipTests/Program.cs
@@ -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 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();
+}
diff --git a/tests/fixtures/rocket-body-reference.json b/tests/fixtures/rocket-body-reference.json
new file mode 100644
index 0000000..d8e635d
--- /dev/null
+++ b/tests/fixtures/rocket-body-reference.json
@@ -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
+ }
+ }
+ ]
+}
diff --git a/tests/fixtures/rocket-impact-reference.json b/tests/fixtures/rocket-impact-reference.json
new file mode 100644
index 0000000..aadbe4c
--- /dev/null
+++ b/tests/fixtures/rocket-impact-reference.json
@@ -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
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/test_rocketship_body.py b/tests/test_rocketship_body.py
new file mode 100644
index 0000000..07bce12
--- /dev/null
+++ b/tests/test_rocketship_body.py
@@ -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()
diff --git a/tests/test_rocketship_lifecycle.py b/tests/test_rocketship_lifecycle.py
new file mode 100644
index 0000000..0e52b1d
--- /dev/null
+++ b/tests/test_rocketship_lifecycle.py
@@ -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()
diff --git a/tests/test_rocketship_motion_camera.py b/tests/test_rocketship_motion_camera.py
new file mode 100644
index 0000000..c7d2bf5
--- /dev/null
+++ b/tests/test_rocketship_motion_camera.py
@@ -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')
diff --git a/tools/binary/rocketship_body.py b/tools/binary/rocketship_body.py
new file mode 100644
index 0000000..9c2fe25
--- /dev/null
+++ b/tools/binary/rocketship_body.py
@@ -0,0 +1,167 @@
+#!/usr/bin/env python3
+"""Guarded Rocketship body callbacks and isolated probe evidence.
+
+Pure projections omit actual rider/audio/scene execution. The optional C probe
+executes copied370/374 instructions with synthetic body/rider/audio dependencies.
+"""
+from __future__ import annotations
+
+import argparse
+from dataclasses import dataclass
+import hashlib
+import json
+import math
+from pathlib import Path
+import re
+import struct
+
+from checkpoint_script_state import EXE_SHA256, find_case, read_va
+from pe_inspect import PE
+from rocketship import collect as rocket_collect
+
+BODIES = (
+ ('ceiling', 0x43eb70, 0x43ebaf, '501a86c0a0263c4087932081a1516579f3a1fdb985d244682997e012a242ad3f'),
+ ('wall', 0x43e8d0, 0x43ea49, '5a3c59889ae6ee9c4d599c1116782c7a2e8213c1b2cad9c22f7b8b55c1ee32a2'),
+ ('physics', 0x479d20, 0x47a32a, '5f4b05518bef5e5f0ecc3909ff0de0b43d2c7350c6beae0c4f797d3238a77fa1'),
+ ('prevent_setter', 0x470f70, 0x470f83, 'b4963d8c48531af2870e39531aadfa8c1178542943ba51d8e3b57184256ee81a'),
+ ('pair_getter', 0x471930, 0x471937, '72ca47ad0ea64edf6110c3a080c805774593958fb2d34dce19f63261a8242327'),
+ ('pair_setter', 0x471940, 0x47194d, 'fa5b69a6074a26a0b8dd535d288645d2875039673639282571e029a60479cd37'),
+ ('pair_notify_gate', 0x470bf0, 0x470c44, '5211f48735716c7a7426486f0b44ae9e93388546d825437edc6ef3f787e2aa8d'),
+ ('dynamic_push_gate', 0x47b2eb, 0x47b3a5, '75e20325939a77354add4decb44bba860003d56914426dc1b98f6d52c08056cb'),
+)
+TABLES = ((0x370, 0x43eb70), (0x374, 0x43e8d0), (0x378, 0x472750),
+ (0x37c, 0x472970), (0x1e0, 0x471930), (0x1e4, 0x471940),
+ (0x208, 0x4719d0), (0x20c, 0x4719e0), (0x210, 0x4719f0))
+
+
+def collect(original: Path | str):
+ report = rocket_collect(Path(original))
+ pe = PE(find_case(Path(original), 'Neutron.exe'))
+ records = []
+ for name, start, end, expected in BODIES:
+ digest = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
+ if digest != expected:
+ raise ValueError(f'Changed Rocketship body span {name}')
+ records.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)),
+ length=end-start, sha256=digest))
+ for slot, target in TABLES:
+ if struct.unpack('
+#include
+#include
+#include
+#include
+#define TC __attribute__((thiscall))
+typedef struct {float x,y,z,w;} Vec;
+static unsigned char *mapped,object[0x1100],rider[0x2100],polygon[0x30],material[0x20],definition[0x20];
+static uintptr_t body_table[0x400/4],rider_table[0x200/4];
+static Vec velocity,acceleration,root;
+static unsigned rider_calls,secondary_calls,sound_calls;
+static float damage,duration;static int points,sound_id;
+#define AT(va) (mapped+(va)-0x400000)
+#define F(g,off) (*(float*)((g)+(off)))
+static void require(int ok,const char*m){if(!ok){fprintf(stderr,"FAIL %s\n",m);exit(2);}}
+static Vec* TC get_velocity(void*self,Vec*out){(void)self;*out=velocity;return out;}
+static void TC set_velocity(void*self,float x,float y,float z){(void)self;velocity.x=x;velocity.y=y;velocity.z=z;}
+static void TC rider_impact(void*self,float d,int p,float seconds){(void)self;rider_calls++;damage=d;points=p;duration=seconds;}
+static void TC rider_secondary(void*self){(void)self;secondary_calls++;}
+static int __cdecl sound(int unused,int id,int loop){(void)unused;(void)loop;sound_calls++;sound_id=id;return 77;}
+static void TC missing(void*self){(void)self;require(0,"unexpected virtual");}
+static void map_copy(void){
+ mapped=VirtualAlloc(NULL,0x299000,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);require(mapped!=NULL,"map");
+ FILE*f=fopen("Neutron.exe","rb");require(f!=NULL,"copied EXE");fseek(f,0,SEEK_END);long size=ftell(f);rewind(f);
+ require(size==1019904,"source size");unsigned char*data=malloc(size);require(data!=NULL,"buffer");
+ require(fread(data,1,size,f)==(size_t)size,"read");fclose(f);require(*(uint16_t*)data==IMAGE_DOS_SIGNATURE,"DOS");
+ uint32_t offset=*(uint32_t*)(data+0x3c);require(offset<(uint32_t)size-sizeof(IMAGE_NT_HEADERS32),"NT bounds");
+ IMAGE_NT_HEADERS32*nt=(void*)(data+offset);require(nt->Signature==IMAGE_NT_SIGNATURE&&nt->FileHeader.Machine==IMAGE_FILE_MACHINE_I386&&nt->OptionalHeader.ImageBase==0x400000&&nt->OptionalHeader.SizeOfImage==0x299000,"PE");
+ IMAGE_SECTION_HEADER*s=IMAGE_FIRST_SECTION(nt);require((unsigned char*)(s+nt->FileHeader.NumberOfSections)<=data+size,"sections");
+ for(unsigned i=0;iFileHeader.NumberOfSections;i++){
+ require((uint64_t)s[i].PointerToRawData+s[i].SizeOfRawData<=(uint64_t)size&&(uint64_t)s[i].VirtualAddress+s[i].SizeOfRawData<=0x299000,"section bounds");
+ memcpy(mapped+s[i].VirtualAddress,data+s[i].PointerToRawData,s[i].SizeOfRawData);
+ }
+ free(data);
+ /* Relative source CALL458980 is retained, but its external audio body is
+ * replaced by a record-only thunk. Callback instruction ranges unchanged. */
+ unsigned char*stub=AT(0x458980);stub[0]=0xb8;*(uint32_t*)(stub+1)=(uint32_t)sound;stub[5]=0xff;stub[6]=0xe0;
+ for(unsigned i=0;iduration:
+ active=impulse_flag=False
+ scale=(1.,1.,1.,1.)
+ drive=True
+ else:
+ pulse=f32((math.sin(source_time*20.)+1.)*.5)
+ scale=(1.,pulse,pulse,1.)
+ if drive_burst:impulses.append(-750.)
+ return dict(active=active,timer=timer,impulse_flag=impulse_flag,scale=scale,
+ select_drive=drive,queued_y=impulses)
+
+
+def impact_probe_source(original):
+ collect(original)
+ pe=PE(find_case(Path(original),'Neutron.exe'))
+ code=read_va(pe,0x43e6e8,0x43e7db-0x43e6e8)
+ pairs=[]
+ for target in (0x495324,0x492a58,0x48e5d0):
+ encoded=struct.pack('
+#include
+#include
+#include
+#include
+#define TC __attribute__((thiscall))
+#define AT(a) (mapped+(a)-0x400000)
+#define F(g,o) (*(float*)((g)+(o)))
+static unsigned char*mapped,*thunk,object[0x1000],rider[0x200],render[0x100];
+static uintptr_t table[0x400/4],rider_table[0x200/4];
+static int selected,impulse_count;static float impulses[4];
+static void require(int ok,const char*what){if(!ok){fprintf(stderr,"FAIL %s\n",what);exit(2);}}
+static void TC missing(void*self){(void)self;require(0,"unexpected virtual");}
+static void TC select_drive(void*self,const char*name,int restart){(void)self;(void)name;(void)restart;selected++;}
+static void TC impulse(void*self,float x,float y,float z){(void)self;require(x==0&&z==0&&impulse_count<4,"impulse shape");impulses[impulse_count++]=y;}
+static void map_copy(void){
+ mapped=VirtualAlloc(NULL,0x299000,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);require(mapped!=NULL,"map source");
+ FILE*f=fopen("Neutron.exe","rb");require(f!=NULL,"copied EXE");fseek(f,0,SEEK_END);long size=ftell(f);rewind(f);require(size==1019904,"source size");
+ unsigned char*d=malloc(size);require(d!=NULL,"source buffer");require(fread(d,1,size,f)==(size_t)size,"read source");fclose(f);
+ require(*(uint16_t*)d==IMAGE_DOS_SIGNATURE,"DOS");uint32_t off=*(uint32_t*)(d+0x3c);require(off<(uint32_t)size-sizeof(IMAGE_NT_HEADERS32),"NT bounds");
+ IMAGE_NT_HEADERS32*nt=(void*)(d+off);require(nt->Signature==IMAGE_NT_SIGNATURE&&nt->FileHeader.Machine==IMAGE_FILE_MACHINE_I386&&nt->OptionalHeader.ImageBase==0x400000&&nt->OptionalHeader.SizeOfImage==0x299000,"PE identity");
+ IMAGE_SECTION_HEADER*s=IMAGE_FIRST_SECTION(nt);require((unsigned char*)(s+nt->FileHeader.NumberOfSections)<=d+size,"section table");
+ for(unsigned i=0;iFileHeader.NumberOfSections;i++){require((uint64_t)s[i].PointerToRawData+s[i].SizeOfRawData<=(uint64_t)size&&(uint64_t)s[i].VirtualAddress+s[i].SizeOfRawData<=0x299000,"section bounds");memcpy(mapped+s[i].VirtualAddress,d+s[i].PointerToRawData,s[i].SizeOfRawData);}free(d);
+ static const struct{uint32_t va,target;} patches[]={/* RELOCATIONS */};
+ for(unsigned i=0;i360:total-=360
+ return f32(total)
+
+
+def facing(rotation,destination,dt,enabled=True,barrel_timer=0):
+ if not enabled or barrel_timer>0:return tuple(rotation),enabled
+ differences=[]
+ active=False
+ for axis,(target,current) in enumerate(zip(destination,rotation)):
+ d=target-current
+ if d!=0:
+ active=True
+ if d>180:d-=360
+ elif axis!=1 and d<-180:d+=360
+ differences.append(d)
+ increments=[f32(d*dt*k) for d,k in zip(differences,(2,4,3))]
+ return tuple(add_axis(v,d) for v,d in zip(rotation,increments)),active
+
+
+def horizontal(velocity,rotation,speed,bank,previous_bank,dt,friction=.8,
+ turn_timer=0,roll_timer=0,turn_latch=False,roll_latch=False,
+ turn_pressed=False,roll_pressed=False,suppressed=False):
+ """Ordinary no-boost/no-roll apply, after inherited facing, before vertical."""
+ moving=any(v!=0 for v in velocity)
+ if not suppressed:
+ if not turn_pressed:turn_latch=False
+ elif moving and not turn_latch:
+ turn_latch=True
+ if turn_timer<=0:turn_timer=1
+ if not roll_pressed:roll_latch=False
+ elif moving and not roll_latch:
+ roll_latch=True
+ if roll_timer<=0:roll_timer=1
+ if turn_timer>0:
+ rotation=(rotation[0],add_axis(rotation[1],f32(180*dt)),rotation[2])
+ turn_timer=f32(max(0,turn_timer-dt))
+ elif moving:
+ previous_bank=bank
+ rotation=(rotation[0],add_axis(rotation[1],f32(bank*dt)),rotation[2])
+ if roll_timer>0:
+ roll_timer=f32(max(0,roll_timer-dt))
+ rotation=(rotation[0],rotation[1],add_axis(rotation[2],f32(270*dt)))
+ if moving:
+ side=f32(previous_bank*f32(.0181818176060915)*(1-f32(friction))*speed)
+ sy,cy=trig(rotation[1])
+ side_x=f32(cy*side);side_z=f32(sy*side)
+ else:side_x=side_z=0
+ forward=rotate((0,0,speed),rotation)
+ outgoing=velocity if turn_timer>0 else (f32(forward[0]+side_x),velocity[1],f32(forward[2]+side_z))
+ return dict(rotation=tuple(rotation),velocity=tuple(outgoing),previous_bank=previous_bank,
+ turn_timer=turn_timer,roll_timer=roll_timer,turn_latch=turn_latch,roll_latch=roll_latch)
+
+
+def camera(root,rotation,old_eye,dt,detail=0,hit=None):
+ eye_local=rotate((0,200,-500),rotation);look_local=rotate((0,50,200),rotation)
+ eye=tuple(f32(a+b) for a,b in zip(root,eye_local))
+ look=tuple(f32(a+b) for a,b in zip(root,look_local))
+ gain=1
+ if hit is not None:
+ eye=tuple(f32(a-(a-b)*.75) for a,b in zip(look,hit));gain=2
+ multiplier=f32(.6 if detail<=1 else 1.2)
+ updated=tuple(f32(old+(want-old)*gain*dt*multiplier) for old,want in zip(old_eye,eye))
+ direction=tuple(f32(a-b) for a,b in zip(look,old_eye))
+ pitch,yaw=angles(direction)
+ return dict(eye=updated,desired_eye=eye,look=look,direction=direction,gain=gain,pitch=pitch,yaw=yaw)
+
+
+def angles(vector):
+ x,y,z=vector;heading=heading_units(x,z)
+ a=(-heading)&16383
+ sine=f32(math.sin(a*math.tau/16384));cosine=f32(math.cos(a*math.tau/16384))
+ h=x*sine+z*cosine
+ if h==0 and y==0:value=0
+ else:
+ value=half_acos_table()[math.trunc(16384*y*y/(h*h+y*y))]
+ if y<0:value=8192+value if h<0 else 8192-value
+ elif h<0:value=16384-value
+ pitch=(4096-value)&16383
+ if pitch>8192:pitch-=16384
+ return pitch,heading-16384 if heading>8192 else heading
+
+
+def ingest(report,log,executable,source):
+ content=Path(log).read_text()
+ if 'ROCKET_MOTION_CAMERA_COMPLETE:' not in content:raise ValueError('Incomplete original probe')
+ cases=[];seen=set()
+ for line in content.splitlines():
+ fields=line.split()
+ if not fields or fields[0] not in ('TRANSFORM','MOTION','AUX','FACING','CAMERA'):continue
+ kind,name,*pairs=fields
+ if (kind,name) in seen:raise ValueError('Repeated original case')
+ seen.add((kind,name));sample={}
+ for pair in pairs:
+ key,value=pair.split('=',1)
+ numbers=[float(v) for v in value.split(',')]
+ if not all(math.isfinite(v) for v in numbers):raise ValueError('Nonfinite original result')
+ sample[key]=numbers if ',' in value else numbers[0]
+ cases.append(dict(kind=kind,name=name,values=sample))
+ if len(cases)!=31:raise ValueError('Unexpected original case count')
+ return dict(scope='Copied EXE motion/facing/camera and copied OMT trig/angles; synthetic actor/body/ray/input dependencies; no game entrypoint',
+ source_sha256=report['source_sha256'],dll_sha256=report['dll_sha256'],
+ generator_sha256=hashlib.sha256(Path(source).read_bytes()).hexdigest(),
+ executable_sha256=hashlib.sha256(Path(executable).read_bytes()).hexdigest(),
+ log_sha256=hashlib.sha256(Path(log).read_bytes()).hexdigest(),cases=cases)
+
+
+def probe_source(report):
+ prefix=BASE_PROBE[:BASE_PROBE.index('static void run(')]
+ prefix=prefix.replace('#include ','#include \n#include ')
+ prefix=prefix.replace('memcpy(AT(0x41ac0e),finish,sizeof(finish));','(void)finish;')
+ reloc=',\n'.join(f'{{0x{a:x},0x{b:x}}}' for a,b in report['relocations'])
+ return prefix.replace('/* RELOCATIONS */',reloc)+PROBE_TAIL
+
+
+PROBE_TAIL=r'''
+typedef struct{float x,y,z,w;}Vec;
+typedef void(TC*Angles)(const float*,short*,short*);
+static Vec root,velocity;
+static Vec trace_start,trace_end,hit_point;
+static int ray_hit;
+static HMODULE omt;
+static Vec*TC get_root(void*self,Vec*out){(void)self;*out=root;return out;}
+static Vec*TC get_velocity(void*self,Vec*out){(void)self;*out=velocity;return out;}
+static void TC set_velocity(void*self,float x,float y,float z){(void)self;velocity.x=x;velocity.y=y;velocity.z=z;}
+static int __cdecl trace(Vec start,Vec end,int sides){(void)sides;trace_start=start;trace_end=end;memcpy(AT(0x5cfc60),&hit_point,sizeof(hit_point));return ray_hit;}
+static void __cdecl base_skip(float dt){(void)dt;}
+static void patch_jump(unsigned va,void*fn){unsigned char*p=AT(va);p[0]=0xb8;*(uintptr_t*)(p+1)=(uintptr_t)fn;p[5]=0xff;p[6]=0xe0;}
+static void setup(void){
+ map_copy();omt=LoadLibraryA("Z:\\work\\game\\OMT2.dll");require(omt!=NULL,"copied OMT2");
+ *(void**)AT(0x48d108)=GetProcAddress(omt,"?angles@OMedia3DVector@@QAEXAAF0@Z");
+ *(void**)AT(0x48d10c)=GetProcAddress(omt,"?global@OMediaCosSinTable@@2V1@A");
+ require(*(void**)AT(0x48d108)&&*(void**)AT(0x48d10c),"original angles/trig exports");
+ patch_jump(0x47c210,trace);
+ const unsigned char ready[]={0xb0,1,0xc3};memcpy(AT(0x475ca0),ready,sizeof(ready));
+ const unsigned char base[]={0xc2,4,0};memcpy(AT(0x40e050),base,sizeof(base));
+ const unsigned char finish[]={0x5f,0x5e,0x5b,0x83,0xc4,0x38,0xc2,4,0};memcpy(AT(0x41a470),finish,sizeof(finish));
+ table[0x310/4]=(uintptr_t)get_root;table[0x2bc/4]=(uintptr_t)get_velocity;table[0x2c4/4]=(uintptr_t)set_velocity;
+ table[0x328/4]=(uintptr_t)AT(0x4723f0);table[0x334/4]=(uintptr_t)AT(0x472480);table[0x36c/4]=(uintptr_t)AT(0x472660);
+ table[0x248/4]=(uintptr_t)AT(0x471ad0);table[0x384/4]=(uintptr_t)AT(0x472980);table[0x38c/4]=(uintptr_t)AT(0x472b10);
+ outer[0x12c/4]=(uintptr_t)AT(0x419de0);
+}
+static unsigned char*reset(float pitch,float yaw,float roll){
+ memset(object,0,sizeof(object));unsigned char*g=object+0xc0;*(uintptr_t**)object=outer;*(uintptr_t**)g=table;
+ memset(AT(0x509830),0,0x1d0);*(void**)AT(0x509a50)=camera;
+ memset(camera,0,sizeof(camera));F(g,0x224)=pitch;F(g,0x228)=yaw;F(g,0x22c)=roll;
+ F(g,0x150)=.8f;root=(Vec){100,200,300,1};ray_hit=0;mouse_x=mouse_y=grounded=0;
+ *(int*)AT(0x4f81ac)=0;return g;
+}
+static void transform_case(const char*name,float p,float y,float r,float x,float v,float z){
+ unsigned char*g=reset(p,y,r);Vec out;((Vec*(TC*)(void*,Vec*,float,float,float))AT(0x472b10))(g,&out,x,v,z);
+ printf("TRANSFORM %s euler=%.9g,%.9g,%.9g vector=%.9g,%.9g,%.9g observed=%.9g,%.9g,%.9g\n",name,p,y,r,x,v,z,out.x,out.y,out.z);
+}
+static void motion_case(const char*name,float vx,float vy,float vz,float p,float y,float r,float speed,float bank,float previous,float dt){
+ unsigned char*g=reset(p,y,r);velocity=(Vec){vx,vy,vz,0};F(g,0x608)=speed;F(g,0x614)=bank;F(g,0x618)=previous;
+ ((void(TC*)(void*,float))AT(0x41a140))(g,dt);
+ printf("MOTION %s incoming=%.9g,%.9g,%.9g euler=%.9g,%.9g,%.9g speed=%.9g bank=%.9g previous=%.9g dt=%.9g observed_rotation=%.9g,%.9g,%.9g observed_velocity=%.9g,%.9g,%.9g observed_previous=%.9g\n",name,vx,vy,vz,p,y,r,speed,bank,previous,dt,F(g,0x224),F(g,0x228),F(g,0x22c),velocity.x,velocity.y,velocity.z,F(g,0x618));
+}
+static void aux_case(const char*name,float turn,float roll,int turn_press,int roll_press,int tlatch,int rlatch,float vy,float dt,int suppressed){
+ unsigned char*g=reset(0,0,0);velocity=(Vec){10,vy,100,0};F(g,0x608)=400;F(g,0x614)=16;F(g,0x618)=7;
+ F(g,0x674)=turn;F(g,0x670)=roll;g[0x679]=tlatch;g[0x678]=rlatch;
+ *(char*)AT(0x509845)=turn_press;*(char*)AT(0x50988a)=roll_press;*(char*)AT(0x4f8198)=suppressed;
+ ((void(TC*)(void*,float))AT(0x41a140))(g,dt);*(char*)AT(0x4f8198)=0;
+ printf("AUX %s timer=%.9g,%.9g pressed=%d,%d latch=%d,%d vy=%.9g dt=%.9g suppressed=%d observed_rotation=%.9g,%.9g,%.9g observed_velocity=%.9g,%.9g,%.9g observed_timer=%.9g,%.9g observed_latch=%d,%d observed_previous=%.9g\n",name,turn,roll,turn_press,roll_press,tlatch,rlatch,vy,dt,suppressed,F(g,0x224),F(g,0x228),F(g,0x22c),velocity.x,velocity.y,velocity.z,F(g,0x674),F(g,0x670),g[0x679],g[0x678],F(g,0x618));
+}
+static void facing_case(const char*name,float p,float y,float r,float dp,float dy,float dr,float dt){
+ unsigned char*g=reset(p,y,r);F(g,0x274)=dp;F(g,0x278)=dy;F(g,0x27c)=dr;g[0xa]=1;
+ ((void(TC*)(void*,float))AT(0x41adf0))(g,dt);
+ printf("FACING %s euler=%.9g,%.9g,%.9g dest=%.9g,%.9g,%.9g dt=%.9g observed_rotation=%.9g,%.9g,%.9g active=%d\n",name,p,y,r,dp,dy,dr,dt,F(g,0x224),F(g,0x228),F(g,0x22c),g[0xa]);
+}
+static void camera_case(const char*name,float p,float y,float r,float ex,float ey,float ez,float dt,int detail,int hit){
+ unsigned char*g=reset(p,y,r);F(g,0x5fc)=400;F(g,0x600)=1;F(g,0x604)=1400;F(g,0x660)=20;F(g,0x664)=-20;
+ F(g,0x63c)=0;F(g,0x640)=200;F(g,0x644)=-500;F(g,0x64c)=0;F(g,0x650)=50;F(g,0x654)=200;
+ F(camera,0x44)=ex;F(camera,0x48)=ey;F(camera,0x4c)=ez;*(int*)AT(0x4f81ac)=detail;ray_hit=hit;hit_point=(Vec){80,250,100,1};
+ ((void(TC*)(void*,float))AT(0x41a6c0))(g,dt);
+ printf("CAMERA %s euler=%.9g,%.9g,%.9g old=%.9g,%.9g,%.9g dt=%.9g detail=%d hit=%d observed_eye=%.9g,%.9g,%.9g pitch=%d yaw=%d trace_start=%.9g,%.9g,%.9g trace_end=%.9g,%.9g,%.9g\n",name,p,y,r,ex,ey,ez,dt,detail,hit,F(camera,0x44),F(camera,0x48),F(camera,0x4c),*(short*)(camera+0x50),*(short*)(camera+0x52),trace_start.x,trace_start.y,trace_start.z,trace_end.x,trace_end.y,trace_end.z);
+}
+int main(void){setbuf(stdout,NULL);setup();
+ transform_case("forward",0,0,0,0,0,100);
+ transform_case("yaw90",0,90,0,0,0,100);
+ transform_case("pitch20",20,0,0,0,0,100);
+ transform_case("roll45",0,0,45,10,20,30);
+ transform_case("combined",20,70,35,10,20,30);
+ transform_case("negative",-20,-70,-35,10,20,30);
+ motion_case("stationary",0,0,0,0,0,0,400,16,7,.1f);
+ motion_case("vertical_only",0,10,0,0,0,0,400,16,7,.1f);
+ motion_case("left",0,0,100,0,0,0,400,16,7,.1f);
+ motion_case("right_seam",0,0,100,0,0,0,400,-16,7,.1f);
+ motion_case("pitch",0,0,100,20,70,0,1000,0,7,.1f);
+ motion_case("all_euler",0,10,100,20,70,35,1000,25,7,1.f/60);
+ motion_case("retained_bank_no_motion",0,0,0,20,70,35,1000,25,7,.1f);
+ aux_case("turn_start",0,0,1,0,0,0,10,.1f,0);
+ aux_case("roll_start",0,0,0,1,0,0,10,.1f,0);
+ aux_case("turn_finish",.05f,0,1,0,1,0,10,.1f,0);
+ aux_case("roll_finish",0,.05f,0,1,0,1,10,.1f,0);
+ aux_case("held_no_restart",0,0,1,0,1,0,10,.1f,0);
+ aux_case("released",0,0,0,0,1,1,10,.1f,0);
+ aux_case("suppressed",0,0,1,1,0,0,10,.1f,1);
+ facing_case("normal",0,20,0,20,20,-16,.1f);
+ facing_case("wrap",350,359,350,10,1,10,.1f);
+ facing_case("negative_yaw_delta",0,359,0,0,1,0,.1f);
+ facing_case("same",0,0,0,0,0,0,.1f);
+ facing_case("negative_fraction",0,0,0,-.5f,0,-.5f,.1f);
+ camera_case("straight",0,0,0,-40,50,-100,.1f,0,0);
+ camera_case("detail1",0,0,0,-40,50,-100,.1f,1,0);
+ camera_case("detail2",0,0,0,-40,50,-100,.1f,2,0);
+ camera_case("blocked",0,0,0,-40,50,-100,.1f,0,1);
+ camera_case("combined",20,70,35,-40,50,-100,1.f/60,0,0);
+ camera_case("combined_blocked",20,70,35,-40,50,-100,1.f/60,2,1);
+ puts("ROCKET_MOTION_CAMERA_COMPLETE: isolated copied EXE and OMT math, synthetic dependencies, no game entrypoint");FreeLibrary(omt);return 0;}
+'''
+
+
+def main():
+ cli=argparse.ArgumentParser(description=__doc__)
+ cli.add_argument('original',type=Path);cli.add_argument('--output',type=Path)
+ cli.add_argument('--probe-source',type=Path)
+ cli.add_argument('--probe-log',type=Path);cli.add_argument('--probe-executable',type=Path)
+ cli.add_argument('--compiled-source',type=Path)
+ args=cli.parse_args();report=collect(args.original)
+ for output in (args.output,args.probe_source):
+ if output is not None and output.resolve().is_relative_to(args.original.resolve()):cli.error('Use generated outputs outside originals')
+ if args.probe_source:
+ args.probe_source.parent.mkdir(parents=True,exist_ok=True);args.probe_source.write_text(probe_source(report))
+ if any((args.probe_log,args.probe_executable,args.compiled_source)):
+ if not all((args.probe_log,args.probe_executable,args.compiled_source)):cli.error('Supply log, executable and compiled source together')
+ report['original_probe']=ingest(report,args.probe_log,args.probe_executable,args.compiled_source)
+ if args.output:args.output.write_text(json.dumps(report,indent=2)+'\n')
+ else:print(json.dumps(report,indent=2))
+
+
+if __name__=='__main__':main()
diff --git a/tools/extractors/prepare.py b/tools/extractors/prepare.py
index 568102c..0733bf6 100644
--- a/tools/extractors/prepare.py
+++ b/tools/extractors/prepare.py
@@ -14,6 +14,7 @@ from gadget_resources import export_gadget_resources
from gadget_followup_assets import export_meter
from bubble_resources import export_bubble
from baseball_resources import export_baseball
+from rocketship_resources import export_rocketship
from sound_bank import export_sound_bank
@@ -86,6 +87,7 @@ def main():
export_meter(args.original, args.output / 'invisible-meter')
export_bubble(args.original,args.output/'bubble')
export_baseball(args.original,args.output/'baseball')
+ export_rocketship(args.original,args.output/'rocketship')
effects = export_sound_bank(args.original, args.output / 'effects')
print(f"SoundEffects.omt: {len(effects['resources'])} original sound identities")
for name in args.audio: