diff --git a/README.md b/README.md
index 658042c..8d154d7 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,8 @@ dotnet run
The default starts the original secret lab (LV1B), including the recovered intro
camera/speech sequence. **Escape or Space** skips the current sequence and restores
control. **Arrows** walk/backpedal/turn; **Shift, Insert, numpad 0 or right mouse**
-jump, and holding jump uses the jet pack after obtaining it. **O** raises/lowers
-the objective panel. **R** resets the scene placement with current progression;
+jump, and holding jump uses the jet pack after obtaining it. **O** opens/closes
+the objective panel; new objectives slide in and disappear automatically. **R** resets the scene placement with current progression;
**C** pauses into inspection, **F11** toggles fullscreen, **Escape** quits during
ordinary play. Use `--skip-intro` to begin with control or `--mute` for silent play.
The lab camera sequence stops background music and DEFAULT restarts it when
diff --git a/docs/analysis/air-steering.md b/docs/analysis/air-steering.md
index 3e29f80..dabeeeb 100644
--- a/docs/analysis/air-steering.md
+++ b/docs/analysis/air-steering.md
@@ -46,8 +46,9 @@ velocityXZ = forward(yaw)*speed + right(yaw)*sideSpeed
Source friction is0.8. Air sideSpeed lacks the additional ground dt factor;
ground437CDx uses (turnRate*(1-friction)*speed/45+keyboardSide)*dt instead.
-The port now preserves the shared turn-rate field through landing and clears it
-on scene reset. Air input's destination yaw is current yaw (439E2B), so the ground
+Correction:437B9E..437BAC clears the shared turn field on grounded/released
+input. Its receiver is the game interface, so interface+614 is complete+6D4.
+The port now clears it at this boundary and on scene reset. Air input's destination yaw is current yaw (439E2B), so the ground
keyboard target offset does not override its direct yaw update.
AirSteering.cs translates this keyboard subset. LabSimulation calls it while
@@ -83,3 +84,18 @@ with identical403.88 powered travel and grounded position. Linux reports zero
validation errors; Wine validation is disabled. Logs: artifacts/package-jetpack-steering.log
and artifacts/windows-jetpack-steering-package/wine.log. Native Windows remains
unverified by the agent. All539 original hashes still match.
+
+
+## Ground-turn cancellation correction
+
+User feedback after the first air-input fix identified intermittent slow turning
+with all jump buttons. The previous integration incorrectly retained TurnRate
+on the ground: an air turn of-30 could cancel most of the opposing+37deg/sec
+walking turn. The original outer reset437B9E..437BAC clears jump state, mode and
+interface+614 (complete+6D4). The port now performs that grounded/released-jump
+reset before ground steering. A17th movement group reproduces opposing air turns
+landing into left/right ground input and requires the full source turn rate.
+A third source-byte regression guards all20 reset bytes and pointer displacement.
+All five SDL bindings (left/right Shift, Insert, keypad0, right mouse) also pass
+identical300-frame powered steering replays, each403.88 travel. No button-specific
+turn multiplier is introduced. Original global update phase order remains open.
diff --git a/docs/analysis/camera-clipping.md b/docs/analysis/camera-clipping.md
new file mode 100644
index 0000000..06b96bb
--- /dev/null
+++ b/docs/analysis/camera-clipping.md
@@ -0,0 +1,103 @@
+# Original geometry clipping overrides
+
+User testing reported a visible distance clipping plane during gameplay which
+disappears in orbit inspection. The port selected10000 only forLV1B and3200 for
+every other level.3200 is the OMediaLayer constructor default, not the original
+gameplay setting for those levels. The following static recovery reads original
+Neutron.exe only; original-game visual comparison remains separate.
+
+Neutron.exe SHA-256: f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.
+EXE text file offsets equal VA minus0x400000 in these ranges.
+
+## Original setup and decisive regression
+
+OMediaLayer ctor DLL1004D340 initializes near20, far3200, FOV0xAAA OMT angle
+units (59.9853515625 degrees). Game geometry layers are globals509A30/509A3C;
+their far field is+0xC0. Original level complete-object RTTI/vtables identify
+initializer virtualB4, whose stores below override those constructor values.
+The near20 and FOV are retained. Sky layer509A38 has its own1000000 far plane;
+this helper does not introduce missing sky rendering or sky-specific states.
+
+Outside LEV1 initializer450580 writes float28000 at45086F to geometry layer
+509A3C. VR04 initializer456AD0 writes50000 at456C04/456C4A to both geometry
+layers. A gameplay3200 far plane therefore clips valid original terrain and
+props in both scenes. Orbit used scene-size-derived far=radius*20 and masked
+the wrong gameplay range rather than correcting the scene setting.
+
+Original level1 geometry spansX[-11080.31,34316.65],Y[-546.06,19685.04],
+Z[-18442.92,26509.07]; VR04 spansX[-6273.61,4535.86],Y[-2.03,7815.47],
+Z[-7364.04,2746.19]. Geometry bounds corroborate the impact but are not used
+as a substitute for the recovered original clipping values.
+
+## Recovered initial geometry-layer far limits
+
+All35 registered level initializers were inspected. This includes3B/E records
+without establishing their normal-gameplay use. Values are world units. An
+unwritten layer retains its constructor3200.
+
+| Original class / GAM code | Initializer VA | Layer509A30 far | Layer509A3C far | Store VAs |
+| --- | --- | --- | --- | --- |
+|CLevel01AGame / LV1A|0x44f0e0|5000|5000|0x44f210, 0x44f256|
+|CLevel01BGame / LV1B|0x44f4b0|10000|10000|0x44f5a5, 0x44f5b1|
+|CLevel01CGame / LV1C|0x44f7e0|10000|10000|0x44f896, 0x44f8a2|
+|CLevel01DGame / LV1D|0x44fb00|120000|120000|0x44fc35, 0x44fc41|
+|CLevel01EGame / LV1E|0x44fe30|120000|120000|0x44ff65, 0x44ff71|
+|CLevel01FGame / LV1F|0x450160|15000|15000|0x4502da, 0x4502f2|
+|CLevel01Game / LEV1|0x450580|3200|28000|0x45086f|
+|CLevel02AGame / LV2A|0x450ab0|3200|3500|0x450c21|
+|CLevel02BGame / LV2B|0x450e30|50000|50000|0x45112d, 0x451173|
+|CLevel02Game / LEV2|0x4513e0|3200|50000|0x4516b2|
+|CLevel03AGame / LV3A|0x451890|3200|80000|0x451a3e|
+|CLevel03BGame / LV3B|0x451c50|40000|40000|0x451e06, 0x451e29|
+|CLevel03CGame / LV3C|0x452030|40000|40000|0x4521e6, 0x452209|
+|CLevel03DGame / LV3D|0x452410|40000|40000|0x4525c6, 0x4525e9|
+|CLevel03EGame / LV3E|0x4527f0|40000|40000|0x4529a6, 0x4529c9|
+|CLevel03Game / LEV3|0x452c20|40000|40000|0x452dd7, 0x452dfa|
+|CLevel04AGame / LV4A|0x453060|10000|10000|0x45320a, 0x45322d|
+|CLevel04BGame / LV4B|0x4534c0|7200|7200|0x4535bd, 0x45364c|
+|CLevel04CGame / LV4C|0x453b10|30000|30000|0x453dfb, 0x453e1e|
+|CLevel04DGame / LV4D|0x454070|10000|10000|0x45421a, 0x45423d|
+|CLevel04Game / LEV4|0x4544a0|30000|30000|0x4546d6, 0x4546f9|
+|CLevel05AGame / LV5A|0x454960|16000|16000|0x454a94, 0x454ad6|
+|CLevel05BGame / LV5B|0x454ce0|16000|16000|0x454e14, 0x454e56|
+|CLevel05Game / LEV5|0x4550b0|12000|12000|0x455242, 0x455288|
+|CLevel06AGame / LV6A|0x4554e0|4000|4000|0x455614, 0x455656|
+|CLevel06Game / LEV6|0x4558b0|4000|4000|0x4559e4, 0x455a26|
+|CLevel07Game / LEV7|0x455c80|10000|10000|0x455dff, 0x455e41|
+|CLevelVR01 / VR01|0x456050|50000|50000|0x456184, 0x4561ca|
+|CLevelVR02 / VR02|0x4563d0|50000|50000|0x456504, 0x45654a|
+|CLevelVR03 / VR03|0x456750|50000|50000|0x456884, 0x4568ca|
+|CLevelVR04 / VR04|0x456ad0|50000|50000|0x456c04, 0x456c4a|
+|CLevelVR05 / VR05|0x456e50|50000|50000|0x456f84, 0x456fca|
+|CLevelVR06 / VR06|0x4571d0|50000|50000|0x457304, 0x45734a|
+|CLevelVR07 / VR07|0x457550|50000|50000|0x457684, 0x4576ca|
+|CLevelVR08 / VR08|0x4578d0|50000|50000|0x457a04, 0x457a4a|
+
+## Implementation boundary
+
+Application/SceneProjection.cs supplies FarPlane(code) and CreateGameplay(code,
+aspect). CreateGameplay returns the original positive-Z,0..1 depth perspective;
+the existing caller applies Vulkan viewport Y flip. Code lookup is case-insensitive.
+Unknown/model-only contexts retain the original generic3200 default.
+
+The current port merges both geometry layers into one draw collection. Where the
+original layers differ, it uses their larger far limit. That is an explicit port
+policy which prevents truncating the layer with the longer original range; exact
+per-layer clipping/masks still require recovered render-layer assignments.
+
+LV4B is a known dynamic exception: initial7200 is stored4535BD/45364C. Task
+callback453690 sets flag+530 when task value1; update4536C0 then animates far
+using12000+19000*timer at453780..453792/453811..453829, finally setting22000
+at45388A..45389E. The standalone helper returns the initial7200 only; task-
+driven fog/color/clip animation is not implemented by this static mapping.
+
+## Verification
+
+ProjectionTests guard exact original outside and VR04 layer-store instructions,
+map every supplied GAM code, check depth0/1 endpoints for all ranges, preserve
+generic fallback and reject invalid aspect ratios. A real outside source camera
+and source geometry regression counts vertices which fit the original28000
+frustum but were cut by the old3200 far plane:3844 vertices are recovered in
+the real LEV1/level1 source view. All three managed groups pass.
+Runtime GPU/readback integration
+belongs to primary; these checks do not by themselves establish rendered fidelity.
diff --git a/docs/analysis/carl-cutscene-control.md b/docs/analysis/carl-cutscene-control.md
new file mode 100644
index 0000000..d92f891
--- /dev/null
+++ b/docs/analysis/carl-cutscene-control.md
@@ -0,0 +1,32 @@
+# Carl's lab conversation control handoff
+
+User testing found Jimmy remained controllable during the lab's ending Carl
+conversation. Static original evidence: LV1B neutron1a is a five-shot3MCA with
+PlayerControlled=JIM1 and NextTrigger=carlwalk. The earlier interpreter applied
+PlayerControlled at activation, prematurely granting the saved completion target.
+
+Original MCA activation431280 chooses the first valid CameraTarget. When an
+actor currently owns control,431502..43159E performs actor preparation, then
+43159E..4315A7 calls game virtual118(NULL). The original game setter475A40 simply
+assigns global controlled entity5099E4. The multi-camera completion4311F0..431228
+reads PlayerControlled and applies its none/NULL/named-target semantics at the end.
+JIM1 in neutron1a therefore restores Jimmy after the conversation, not before it.
+
+SceneDirector.StartMulti no longer applies the completion field. Each valid MCA
+shot clears ControlledTag, and FinishMulti retains the recovered restoration.
+Program's existing simulation gate therefore suppresses walking/turning/jumping
+throughout the conversation. Camera, actor/patrol and dialogue clocks continue;
+Escape/Space skips while preserving authored follow-up actions.
+
+DirectorTests now execute the real neutron1a with natural and skipped completion,
+assert control is absent through every active shot, restored afterward, and guard
+the exact original43159E instruction sequence. Interaction tests retain the
+pre-dialogue score150/SCENE60 side effects. A60-frame headless runtime check
+(--smoke-carl-cutscene) holds move/turn/jump requests and records zero simulation
+steps with active neutron1a and zero Vulkan validation errors. This source/contact
+smoke does not replace live navigation or original-game comparison.
+
+The user separately confirms lab -> tutorial -> lab -> outside is reachable in
+their tested build. Platform and exact checkpoint-return-position fidelity were
+not specified by that report; do not infer complete native-platform/original
+fidelity from transition reachability alone.
diff --git a/docs/analysis/objective-timing.md b/docs/analysis/objective-timing.md
new file mode 100644
index 0000000..d9b72b8
--- /dev/null
+++ b/docs/analysis/objective-timing.md
@@ -0,0 +1,107 @@
+# Objective pad timeout, slide and O key
+
+Read-only Neutron.exe recovery plus managed regression checks. Original text VAs
+below correspond to file offsets VA-0x400000. This fixes the earlier stationary
+HUD approximation; original-game/runtime visual comparison remains separate.
+
+## Timer and phases
+
+Objective selector4F8194 is distinct from animation timer4F8188.406F50 ignores
+nonpositive selectors; for a positive selector it clears44 flags, stores selector,
+resets timer0 at406F76 and enables the selected flag. Initial UI4018A8 and Jimmy
+PostLoad423EC6 set timer20, so merely loading a saved positive selector does not
+prove that its popup should initially appear.
+
+4043D9 checks current controlled entity5099E4 againstNULL. Only a non-null entity
+advances the timer by elapsed seconds at4043E5..4043F1 and invokes407070 through
+virtual4D0. No controlled entity takes40447A..4044BD, hiding objective art and
+leaving the timer unchanged. The test is for any controlled entity, not necessarily
+Jimmy; cutscene control policy must be supplied separately by the caller.
+
+407070 uses these phases (source floats retain their original widths):
+
+| Timer t | Pad | Objective art/digit | Pad vertical offset from stationary layout |
+| --- | --- | --- | --- |
+| t<0.7 | Visible | Hidden | (1-t*1.4285714626312256f)*100 |
+| 0.7<=t<7 | Visible | Visible |0|
+|7<=t<8.7 | Visible | Hidden |(t-7)*1.4285714626312256f*100|
+|t>=8.7 | Hidden | Hidden |No draw|
+
+Entry threshold0.7 is48D974; reciprocal scale is48D970; distance100 is48D96C.
+Stationary end is signed integer7 at4EC498. Exit draw window ends at7+1.7f,
+with1.7 at48D940. The longer exit draw window means the pad can already leave
+the viewport before the branch finally stops drawing it.
+
+Pad top-left is x384,y=380+self[4EC]+slideOffset. Stationary art is
+x384,y=448+self[4EC] (plus15 per visible row), digit x393,y=450+self[4EC].
+Entry4070FD..407138 draws only the pad. Stationary4071BA..407247 shows selected
+flags, digit and pad. Exit407266..40727E hides the44 objective art elements,
+then407280..4072C4 draws the departing pad. At equality8.7 the40725F test exits.
+
+Entry sets self[4E8] and emits effect216 once at4070BA..4070CA. Stationary
+4071BA clears that latch. Resetting the timer while still entering therefore
+does not necessarily replay the sound; ObjectivePanel retains this distinction.
+
+## O opens/closes the pad, separate from gadget layout
+
+407071 reads509887, which is virtual key'O' (4F) plus the recovered keyboard
+array509838. Controller flag509AC9 joins that condition.4F7C30 is its edge latch:
+no input clears the latch at40708F; a newly held input sets it at40715B.
+
+On that edge40714F..407198:
+
+- If timer is nonnegative and less than7, set it to7 and begin slide-out.
+- Otherwise reset it to0 and begin slide-in.
+- Holding the input does not repeat the toggle. Release then press creates a new edge.
+
+The previous port used O to toggle layout offset-69/0. Original helpers406590
+and406650 do change that offset and recreate/hide other gadget UI resources,
+but407070's O branch does not call those helpers. O must control the timer instead.
+The current objective consumer retains layoutOffset=-69; other gadget layout
+transitions remain a separate system.
+
+## Practice/pause policy
+
+While a practice modal is active (excluding source type12),4044D7..404504 sets
+the timer to7+1.7 and hides pad and art. No404D97 resets the timer to0, so dismissing
+practice can explicitly reopen the current objective. This is distinct from
+pausing the timer because no controlled actor exists. Focus/inspection/global
+UI-pause scheduling is a caller policy until the complete original UI loop is
+recovered; the component accepts explicit elapsed seconds and gating arguments.
+
+## Component and integration API
+
+`Game/ObjectivePanel.cs` owns only this presentation state:
+
+```
+var panel = new ObjectivePanel(currentSelector, layoutOffset: -69);
+interactions.ObjectiveChanged += panel.Select;
+// Each active UI tick; pass the actual held O state only when UI input is allowed.
+panel.Key(oHeld);
+panel.Step(seconds, hasControlledActor, modalActive);
+// Pad and content need independent draw visibility.
+panel.PadVisible; panel.ContentVisible; panel.YOffset;
+// On practice No, matching404D97:
+panel.Show();
+```
+
+`Select(positive)` resets timing even when selector is unchanged. Nonpositive
+assignments are the recovered no-op. The current renderer has one selected lab
+objective instead of all44 independent flags; selector0 deliberately shows no
+invented art/digit. `SoundEffect` emits216 at the source entry latch. Constructor
+layout bounds and selectors above43 reject malformed caller input.
+
+## Verification
+
+`source scripts/env.sh`, then:
+
+```
+dotnet run --project tests/GamePort.ObjectiveTests -- ../Original
+```
+
+Six groups pass: exact original constants/instructions; entry/hold/exit positions
+and boundary equality; O edge/hold/reopen/layout separation; repeated selector
+assignments and0 no-art; controlled-entity/modal/pause lifecycle; source sound
+latch plus malformed inputs. The tests compare original Neutron.exe bytes at
+seven decisive timer/input/visibility sites. No original file is modified or
+executed. Renderer composition/native runtime tests belong to primary integration.
diff --git a/docs/analysis/ui.md b/docs/analysis/ui.md
index 2b894e5..143993a 100644
--- a/docs/analysis/ui.md
+++ b/docs/analysis/ui.md
@@ -26,16 +26,16 @@ y=`448 + self[4EC] + visibleRow*15`. `407070` renders the pad at x384,
y=`380+self[4EC]` during its stationary phase and prints selector `%d`
(`4EC794`) at (393,450+offset), font tag SMAL (`534D414C`). `401F9D`
initializes offset=-69; `406590` changes -69 to0, while `406650` changes0 to-69.
-These source paths toggle vertical layout and other gadget UI, not a simple
-objective visibility bit. The pad extends beyond the640x480 reference viewport;
+These source paths toggle vertical layout and other gadget UI. They are separate
+from O, whose recovered timer toggle is documented in objective-timing.md. The pad extends beyond the640x480 reference viewport;
retain clipping rather than repositioning it to fit.
`406F50(index,flag)` only accepts index>0: it clears44 dword flags at4F7D00,
sets selector4F8194, resets animation timer4F8188, then enables the selected
-entry. It does not map selector0 to objective1. The source has sliding/timed
-objective presentation; the consumer currently renders its stationary geometry
-under caller-controlled visibility. Animation and exact source visibility timing
-are not yet implemented.
+entry. It does not map selector0 to objective1. The source has sliding/timed objective presentation, now implemented by
+Game/ObjectivePanel.cs:0.7-second entry, stationary until7 seconds, exit until8.7.
+Pad and content have independent visibility. O toggles this timer.
+See objective-timing.md for exact source rules and regression evidence.
`402D70/402CC0` convert positions using windowWidth/640 and windowHeight/480;
constants at file8D40C=1/640 and8D408=1/480. The port quads use NDC
diff --git a/docs/architecture.md b/docs/architecture.md
index 5bf6c4f..b4cb929 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -122,3 +122,16 @@ walking input. Mode1 logs then falls through to its real handler; it is not a
no-input state. LabSimulation preserves the turn-rate field, uses recovered air
coasting/braking and applies the distinct ground/air lateral formulas. Mouse,
analog, full lean/camera and original global phase order remain incomplete.
+
+
+MCA PlayerControlled is a completion target. Valid multi-camera shots clear active
+control; the player simulation is gated until completion/skip restores it. The
+normal grounded/released controller reset clears the air turn field before ground
+steering, preventing prior air turns from cancelling keyboard turns after landing.
+
+ObjectivePanel owns source elapsed time, entry/stationary/exit phases and O edge
+latching; SceneHud renders its pad and text/digit visibility independently. Practice
+hides the popup and No resets timing. UI clock remains explicit across control loss,
+focus/inspection and fixed simulation ticks. SceneProjection maps all35 original
+level geometry-layer far overrides instead of a universal3200. The merged renderer
+uses the larger layer limit; per-layer masks and dynamic LV4B fog/clipping remain open.
diff --git a/docs/compatibility.md b/docs/compatibility.md
index 7d36a38..269551f 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -16,7 +16,7 @@ separate evidence categories. **The game is not fully reconstructed/playable yet
| Windows walking package under Wine64 | Preliminary240-step window pass | SDL arrows/Shift, walking/jump/landing and800x600 resize; matches Linux movement statistics; validation disabled |
| Linux self-contained package | Native headless/window verified |12s story without SDK/source/Original mounted; GTX1070 practice pause/N/resume/resize, zero validation errors |
| Vulkan1.3 lab | llvmpipe + GTX1070 | Real indexed/textured/depth frame/readback; validation enabled, zero errors |
-| Original camera/projection | Data/math integrated | GAM camera, recovered FOV/clips; startup/follow behavior not compared |
+| Original camera/projection | Source mapping/math + outside GPU before/after |All35 level far overrides; outside28000/tutorial50000; merged layer maximum is a port policy, per-layer masks/dynamic fog incomplete |
| Jimmy normal texture / morph | Native preview verified | Correct atlas slot0, base topology/UV retained; state speed/loop unverified |
| Standing preview placement | Corrected / Linux tested | +38.503Y from actual visible floor/base soles; exact original actor transform unresolved |
| Idle/run/jump/scratch preview | Linux keyboard + GPU tests | Default idle samples identical; 1/2/3/4 select clips; run image changes across frames |
@@ -27,13 +27,13 @@ separate evidence categories. **The game is not fully reconstructed/playable yet
| Mouse/relative input/controller | Incomplete | SDL entry point declaration alone is not behavior |
| Audio stream | Linux dummy device | Original11025Hz mono WAV consumed10752bytes/500ms; speakers untested |
| Physics fragments/RNG | Standalone C# tests | Recovered arithmetic; controller/jump/collision state incomplete |
-| Walking/jump/air controller |16 movement groups + GPU replay pass |Corrected mode1 fall-through to source air handler: acceleration/braking/turning during jumps and bursts; phase/collision/lean remain provisional |
+| Walking/jump/air controller |17 movement groups + GPU replay pass |Corrected mode1 fall-through to source air handler: acceleration/braking/turning during jumps and bursts; phase/collision/lean remain provisional |
| Static source collision | 11 deterministic groups pass | Capsule sweep/slide, walls/ceilings/slopes/ledges; all2869 lab triangles retained; masks/dimensions provisional |
-| Simulation cadence |16 movement groups pass | Fixed60Hz independent of60/120/144Hz rendering, ten-minute finite run; original cadence unresolved |
+| Simulation cadence |17 movement groups pass | Fixed60Hz independent of60/120/144Hz rendering, ten-minute finite run; original cadence unresolved |
| Walking camera and animation | Linux headless/window pass | Original five motion clips, recovered eye180/target99; pivot, timing and obstruction solver provisional |
-| Walk SDL input/resize | Earlier GTX1070/Xvfb240-step pass |Historical pre-air-fix travel1250.12; current corrected managed/headless replay1264.55. Current powered SDL check is below |
+| Walk SDL input/resize | GTX1070/Xvfb input replay pass |Current corrected managed/headless replay1252.09; all five jump bindings produce identical300-frame powered replays,403.88 travel; zero validation errors |
| TSK saves/task gates | All12 originals byte-round-trip | Bounded parse/write, task/items/score/checkpoint CLI resume; full game-state/menu save incomplete |
-| Lab CAM/MCA/AI interpreter | Source sequence tests + Linux GPU pass |16 speech cues, recovered camera formulas, skip/actions/control restoration; no original comparison |
+| Lab CAM/MCA/AI interpreter | Source sequence/Carl lock tests + Linux GPU pass |16 intro cues; neutron1a locks move/turn/jump for all active MCA shots, restores JIM1 at completion/skip; no original comparison |
| Dynamic actors/sprites/models | Linux GPU pass |Carl/Goddard/Jimmy morphs, source Canv timing and9 original lab props; billboard/alpha, pivots and playback timing remain provisional |
| Scene music/speech | Linux dummy-device pass |CAM stops music before speech; full lab chain stays silent, DEFAULT restarts on completion/skip; reset tested. Packaged Linux/Wine64 lifecycle checks pass; speakers/latency/native Windows unverified |
| VR01 star/trophy contacts | Source-data tests pass |5-point stars,300 trophy, acquired flags and contact-enter semantics; distance/exclusions/box approximation |
@@ -43,14 +43,14 @@ separate evidence categories. **The game is not fully reconstructed/playable yet
| Patrol/support |10 patrol +13 support groups pass |Source phases/profiles and8 DLL magnitude refs; Carl sensing, Goddard follow and full wall response incomplete |
| Buttons/doors | Source state tests and GPU props pass |Cooldown, hold/reversal, original model transforms; source broadphase/box order with modern narrowphase |
| Dynamic collision |10 managed groups pass |Includes actual closed/open lab bars; full source solver/activation exclusions incomplete |
-| Lab objectives/practice | Art/data/managed/headless + native Linux window pass |Exact source coordinates, modal pause, Y/N/pointer rules; N resumes and resize800x600 onGTX1070, zero errors; slide/highlight incomplete |
+| Lab objectives/practice | Source timer/O tests + managed/headless/SDL pass |Original popup slide/timeout and O latch integrated; pad/content separate; modal pause/No reset; practice highlights/controller still incomplete |
| Jetpack tutorial |14 vertical groups +16 movement groups +300-step VR04 GPU pass |Powered horizontal travel403.88, turn/brake/release and landing; rise418.98, zero validation errors; phase/shadow/collision/lean approximations |
| Powered SDL/package steering |Linux GTX1070 and preliminary Wine64 window pass |300 frames, Up/Left/Down/Shift received, resize800x600, travel403.88/landing; Linux zero validation errors, Wine validation disabled; native Windows pending |
| Default effects bank |251 exact RIFF exports, SDL dummy pass |Pickup/button/door sounds and owner-loop stop; positional/volume/channel policy incomplete; MPEG-in-RIFF bird1/id162 unsupported by SDL WAV |
| Complete scene/gameplay loop | Incomplete |Lab navigation, exact collision/pivot/cadence and original reference comparison still required |
| Menus/AI/combat/progression/saves | Incomplete | Required future work |
| Original execution | Attempted under isolated Wine11 | Window created, GL/Vulkan rendering unusable; no reference comparison |
-| Native Windows functionality | Loading/rendering user-confirmed | Current story/tutorial/input/audio/resize still unverified natively |
+| Native Windows functionality | User confirms lab/tutorial/lab/outside and corrected build works |User built/tested Windows; comprehensive native input/audio/resize/driver coverage and original comparison remain unverified by the agent |
Generated evidence: artifacts/full-integration-test.log, practice-window.log,
practice-transition.log, jetpack-runtime.log, final-tests.log, test-level1b.ppm, test-player.ppm,
@@ -59,6 +59,14 @@ The lab/player images have been visually inspected; they do not establish origin
visual equivalence. Windows cross-publishing must not be represented as Windows
runtime validation. Package scope and prerequisites are in infrastructure.md.
+Current four-fix regression evidence: artifacts/four-bugs-full-tests.log (complete
+suite and539 preserved hashes), jump-binding-parity.json, outside-fixed-clip.png,
+package-objective-window.log and package-carl-cutscene.log. Both platforms publish
+successfully; packaged Linux popup/Carl checks pass with zero Vulkan validation
+errors. The already-started Wine64 popup/O/resize check passes with validation
+disabled. Further package checks were skipped at the user's request after they
+reported their own Windows build works. No new agent native Windows claim is made.
+
Known visual/behavior limits include incomplete lighting/fog/blend/culling/material
mapping, inferred model/root pivot, provisional collision/cadence/animation timing,
close-wall camera clipping near Jimmy, incomplete class-specific triggers/interactions,
diff --git a/docs/decisions.md b/docs/decisions.md
index bcaf52f..6059a02 100644
--- a/docs/decisions.md
+++ b/docs/decisions.md
@@ -63,3 +63,9 @@
15. **Default recovered scene play.** Start the integrated lab story/interactions by
default; retain --inspect and deterministic smoke modes. Passing direct-contact
tests does not establish navigation, original fidelity or full-game completion.
+16. **Use recovered control and UI lifetimes.** MCA PlayerControlled restores its
+ target at completion; active valid shots clear control. O changes the objective
+ animation timer rather than gadget layout. Reset air-turn state at the recovered
+ grounded/released branch. Use per-level geometry-layer far limits; the current
+ merged renderer uses their maximum until separate layer masks are implemented.
+ Source evidence and regression limits are recorded in the focused analysis docs.
diff --git a/docs/progress.md b/docs/progress.md
index 5b8a7df..dc7b913 100644
--- a/docs/progress.md
+++ b/docs/progress.md
@@ -1,9 +1,43 @@
-# Progress — 2026-10-24
+# Progress — 2026-10-25
**The full reconstruction is incomplete.** The current implementation extends the
user-verified Windows rendering checkpoint into an interactive original lab and
jet pack tutorial flow. This is not a verified faithful complete scene or release.
+## User-reported lab regressions
+
+The user confirms lab -> tutorial -> lab -> outside is reachable. Four follow-up
+bugs are now implemented with source evidence and targeted regressions:
+
+- Carl's neutron1a MCA no longer grants its JIM1 completion target at activation.
+ Active shots clear control; natural/skip completion restores it. Runtime holds
+ move/turn/jump for 60 frames and records zero player simulation steps.
+- Grounded/released jump resets the source turn field (interface+614=complete+6D4).
+ Residual air turn previously opposed subsequent ground steering. 17 movement
+ groups pass, including landing into both opposite directions. All five jump
+ bindings pass identical SDL powered replays; no button-specific turn scale.
+- Gameplay clipping now uses recovered original level overrides: outside28000,
+ tutorials50000, all35 level mappings. The old universal3200 clipped valid distant
+ scenery; actual outside GPU before/after readbacks confirm its recovery.
+- Objectives have source 0.7-second entry, hold until 7, exit until 8.7. O opens/closes
+ via an edge-latched timer instead of changing layout. Modal/control gating and
+ source sound216 are integrated; separate pad/content draw checks pass.
+
+The complete scripts/test.sh run passes, including 39 Python checks, managed
+regressions, scene/GPU/audio checks and all 539 unchanged original hashes
+(artifacts/four-bugs-full-tests.log). Both self-contained packages are rebuilt.
+Packaged Linux popup/O/resize and 60-frame Carl control checks pass on GTX1070
+with zero Vulkan validation errors. The already-started preliminary Wine64 popup
+check also completed successfully (validation disabled). Further package checks
+were skipped at the user's request: the user reports that their own Windows build
+works with these corrections. That report establishes user verification, not an
+agent-run native Windows comparison or complete input/audio/driver coverage.
+
+Reports: analysis/carl-cutscene-control.md, air-steering.md, camera-clipping.md and
+objective-timing.md. Original comparison, per-layer rendering/dynamic fog and full gameplay
+remain incomplete. User loop reachability is distinct from source-faithful
+checkpoint-position restoration and agent native Windows validation.
+
## Jetpack steering correction
User testing exposed frozen airborne steering. The earlier recovery incorrectly
@@ -55,7 +89,7 @@ navigation coverage without proving original collision/cadence fidelity.
- The pickup's internal tag `shrinkray` names the lab jet pack, proven by original
GET JET PACK art and powered-jump inventory checks. It is not a shrink-ray weapon.
- Original objective pad, three lab objective images, digits and PracticeYesNo
- are rendered at source640x480 coordinates. O changes stationary panel offset.
+ are rendered at source640x480 coordinates. O opens/closes the timed popup.
Practice pauses the simulation; Y enters VR04/PHONEBOOTH and N resumes.
Return context is current GAM/latest STRT (LV1B/STARTEXP for NewGame), separate
from the still-unrecovered runtime checkpoint-root restoration.
@@ -89,8 +123,8 @@ confidence and approximation boundaries are retained there.
Managed checks cover source data, director/actions/cameras, task/interactions,
patrol, recovered support, moving-box collision, jetpack states and HUD composition.
-Python currently has38 top-level regression tests plus2 targeted UI extraction tests.
-Existing11 collision and16 movement groups pass;14 jetpack groups pass. Eight
+Python currently has39 top-level regression tests plus2 targeted UI extraction tests.
+Existing11 collision and17 movement groups pass;14 jetpack groups pass. Eight
quick-magnitude float results are checked against an isolated original DLL probe.
Original mode2 standing/jump animation probes confirm zero dynamic-point offsets
for the tested clips. This is DLL evidence, not observed original game behavior.
diff --git a/docs/reverse-engineering.md b/docs/reverse-engineering.md
index e89f212..8fc71e5 100644
--- a/docs/reverse-engineering.md
+++ b/docs/reverse-engineering.md
@@ -16,6 +16,9 @@ probes and modern runtime checks are recorded separately.
- `analysis/dynamic-collision.md`: source3DUD broadphase/triangle order and modern response boundary.
- `analysis/buttons-doors.md`: button contact/cooldown and moving-bar state machine.
- `analysis/ui.md`: original objective/practice canvases, coordinates, input and return strings.
+- `analysis/carl-cutscene-control.md`: MCA activation locks control; serialized target restores it at completion.
+- `analysis/objective-timing.md`: source popup timer/slide/O latch and modal clock behavior.
+- `analysis/camera-clipping.md`: per-level original near/far geometry clipping and merged-layer limits.
- `analysis/air-steering.md`: corrected mode1 fall-through, airborne keyboard handler and source regression evidence.
- `analysis/jetpack.md`: corrected lab pickup identity, powered-jump/effect/energy phases.
- `analysis/sound-effects.md`: default bank identity, preserved wave payloads and loop lifecycle.
diff --git a/docs/tasks.md b/docs/tasks.md
index fe28dcd..2ba4ca8 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -23,16 +23,20 @@ compile, runtime and original-fidelity verification are separate.
- [x] Powered-jump state/effect/energy arithmetic, original FLY/fire morphs and GPU replay.
- [x] Correct mode1 input dispatch and source airborne steering for jumps/bursts;
Up acceleration, Down braking, Left/Right turn and powered travel regressions.
+- [x] Carl conversation control lock, grounded air-turn reset, original level far
+ planes and timed objective/O behavior. Full suite passes; both packages rebuilt;
+ user verifies their own Windows build works. Detailed evidence: progress.md.
## Immediate continuation
-1. Integration milestone c929f94 and the subsequent cutscene music/navigation
- correction are implemented/tested and republished. Preserve native Windows
- story/input/audio as pending; source user feedback is distinct from agent Wine
- checks. Continue original physics/audio/UI recovery and lab underground traversal.
+1. Lab regressions are corrected and republished, with user verification of their
+ own Windows build. Keep comprehensive native Windows driver/audio/input
+ coverage separate from that report and preliminary Wine checks. Continue
+ original physics/audio/UI recovery and lab underground traversal.
2. Managed input-only lab navigation now reaches the outside LOAD with live source
contacts and NPC updates. Keep the direct-contact smoke distinguished from this
- replay. Extend coverage to underground button/door traversal and runtime
+ replay. User confirms lab/tutorial/lab/outside is reachable. Extend coverage to
+ underground button/door traversal and runtime
reference comparison. Recover runtime42AF00 checkpoint restoration on
VR return separately from saved STRT/RETURN strings and unknown TSK StoredVector.
3. Recover47BD80 collision response/479D20 movement phase and source object exclusions.
@@ -43,8 +47,8 @@ compile, runtime and original-fidelity verification are separate.
policies, jetpack sound callbacks and MPEG-in-RIFF bird1/id162 decoding. Default
SoundEffects.omt identity and pickup/button/door stream lifecycle are integrated;
physical/native Windows output and original timing remain unverified.
-5. Complete objective slide/timing, practice highlights/cursor/controller handling,
- energy/gadget UI. Stationary geometry and keyboard/pointer choices are recovered.
+5. Complete practice highlights/cursor/controller handling and energy/gadget UI.
+ Objective slide/timeout/O behavior is now recovered and integrated.
6. Recover Carl sensing409CC0, Goddard follow-state4, actor class defaults and full
morph state/playback-end synchronization. Generic patrol states alone are not AI.
7. Recover original global cadence/object phase order, mouse steering/relative input,
diff --git a/scripts/package.sh b/scripts/package.sh
index 4b3fefb..7968877 100755
--- a/scripts/package.sh
+++ b/scripts/package.sh
@@ -51,16 +51,16 @@ Inspection: arrows/WASD orbit, +/- zoom, 1 idle, 2 run, 3 jump, 4 scratch previe
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
-scene audio. O raises/lowers objectives. The original jet pack pickup opens the
+scene audio. O opens/closes objectives, which also time out. The original jet pack pickup opens the
practice prompt: Y/Yes enters VR04; N/No resumes. Hold jump for a powered burst
after obtaining it. --headless --story-time 12 renders a deterministic story shot.
Original actor/model/sprite props, common patrol, buttons/moving bars, lab task
route, objectives, practice flow and checkpoint CLI are integrated. Collision,
60Hz cadence, pivots, rendering states and animation timing remain provisional.
-Full combat, AI, progression, menus and runtime saves remain incomplete. Initial
-Windows rendering is user-confirmed for an older build; this story/tutorial
-checkpoint still needs native Windows input/physics/audio validation.
+Full combat, AI, progression, menus and runtime saves remain incomplete. The user
+confirms lab/tutorial/lab/outside and that their corrected Windows build works;
+comprehensive native Windows input/physics/audio/driver validation remains pending.
See BUILD-AND-LIMITATIONS.md, COMPATIBILITY.md and docs/ for evidence and remaining
work. SOURCE-README.md describes development from the separate source repository.
diff --git a/scripts/test.sh b/scripts/test.sh
index 67a21cc..cb531fc 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -13,6 +13,8 @@ dotnet run --project tests/GamePort.InteractionTests -- ../Original
dotnet run --project tests/GamePort.LabRouteTests -- ../Original
dotnet run --project tests/GamePort.DynamicCollisionTests -- ../Original
dotnet run --project tests/GamePort.JetpackTests
+dotnet run --project tests/GamePort.ObjectiveTests -- ../Original
+dotnet run --project tests/GamePort.ProjectionTests -- ../Original
python3 tests/GamePort.HudTests/test_ui.py
dotnet run --project tests/GamePort.HudTests -- artifacts/extracted/ui/ui.json
dotnet build GamePort.csproj
@@ -25,6 +27,9 @@ dotnet run --no-build -- --headless --story --story-time 12 --screenshot artifac
dotnet run --no-build -- --headless --story --smoke-practice-prompt --screenshot artifacts/test-practice.ppm
dotnet run --no-build -- --headless --story --smoke-practice-transition
dotnet run --no-build -- --headless --story --smoke-lab-route
+dotnet run --no-build -- --headless --smoke-carl-cutscene --frames 60 --screenshot artifacts/test-carl-cutscene.ppm
+dotnet run --no-build -- --headless --smoke-objective-panel --story-time 1 --screenshot artifacts/test-objective-visible.ppm
+dotnet run --no-build -- --headless --smoke-objective-panel --story-time 9 --screenshot artifacts/test-objective-hidden.ppm
dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-jetpack --screenshot artifacts/test-jetpack.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
@@ -42,6 +47,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 -- --smoke-objective-window --screenshot artifacts/test-objective-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-jetpack --screenshot artifacts/test-jetpack-window.ppm
dotnet run --no-build -- --smoke-practice-window --frames 12 --screenshot artifacts/test-practice-window.ppm
dotnet run --no-build -- --scene artifacts/extracted/level1b/scene.json --smoke-window --frames 6 --screenshot artifacts/test-window.ppm
diff --git a/src/GamePort/Application/LabRouteSmoke.cs b/src/GamePort/Application/LabRouteSmoke.cs
index b56ae3d..bc2991b 100644
--- a/src/GamePort/Application/LabRouteSmoke.cs
+++ b/src/GamePort/Application/LabRouteSmoke.cs
@@ -11,6 +11,17 @@ namespace GamePort.Application;
public static class LabRouteSmoke
{
public static void Run(GamLevel level, SceneDirector director, SceneInteractions interactions, Action? dismissPractice = null)
+ {
+ StartCarl(level, director, interactions, dismissPractice);
+ director.Skip();
+ if (!director.Controlled || interactions.Score != 150 || interactions.Inventory.State(0, 3) != 1
+ || interactions.CurrentObjective != 3)
+ throw new InvalidOperationException("Original lab contact route did not reach the recovered exit state");
+ interactions.Update(level.Entities.Single(e => e.Tag == "LABTONEIGH").Position);
+ Console.WriteLine("Lab direct-contact integration: explanation, shrinkray, Carl callback and exit; score150, gadget3, objective3. Navigation was not exercised.");
+ }
+
+ public static void StartCarl(GamLevel level, SceneDirector director, SceneInteractions interactions, Action? dismissPractice = null)
{
if (level.Code != "LV1B") throw new ArgumentException("Lab route check requires original LV1B");
director.Skip();
@@ -22,11 +33,7 @@ public static class LabRouteSmoke
var carl = director.FindActor("C3DCARL")!;
director.SyncActor(player, carl.Position, Vector3.Zero);
interactions.Update(carl.Position);
- director.Skip();
- if (!director.Controlled || interactions.Score != 150 || interactions.Inventory.State(0, 3) != 1
- || interactions.CurrentObjective != 3)
- throw new InvalidOperationException("Original lab contact route did not reach the recovered exit state");
- interactions.Update(level.Entities.Single(e => e.Tag == "LABTONEIGH").Position);
- Console.WriteLine("Lab direct-contact integration: explanation, shrinkray, Carl callback and exit; score150, gadget3, objective3. Navigation was not exercised.");
+ if (!director.Playing || director.Controlled || director.CurrentTag != "neutron1a")
+ throw new InvalidOperationException("Carl dialogue did not start with original control lock");
}
}
diff --git a/src/GamePort/Application/SceneHud.cs b/src/GamePort/Application/SceneHud.cs
index acd59d4..804ff7e 100644
--- a/src/GamePort/Application/SceneHud.cs
+++ b/src/GamePort/Application/SceneHud.cs
@@ -72,7 +72,7 @@ public sealed class SceneHud
/// Writes the final merged buffer, including when later visual composers copied these vertices.
public void Update(Mesh destination, int currentObjective, bool objectivesVisible, bool practiceVisible,
- float objectiveYOffset = -69)
+ float objectiveYOffset = -69, bool objectiveContentVisible = true)
{
if (!float.IsFinite(objectiveYOffset) || objectiveYOffset < -480 || objectiveYOffset > 480)
throw new ArgumentOutOfRangeException(nameof(objectiveYOffset));
@@ -83,7 +83,8 @@ public sealed class SceneHud
var draw = destination.Draws.FirstOrDefault(d => d.FirstIndex == quad.FirstIndex && d.ScreenSpace
&& d.IndexCount == 6) ?? throw new ArgumentException("Destination omits HUD draws", nameof(destination));
draw.Visible = quad.Canvas == 169 ? practiceVisible : objectivesVisible && currentObjective is >= 1 and <= 3
- && (quad.Canvas == 156 || quad.Canvas == 119 + currentObjective || quad.Canvas == 82 + currentObjective);
+ && (quad.Canvas == 156 || objectiveContentVisible
+ && (quad.Canvas == 119 + currentObjective || quad.Canvas == 82 + currentObjective));
var digit = quad.Canvas is >= 83 and <= 85;
var x = quad.Canvas == 169 ? 210f : digit ? 393f : 384f;
var y = quad.Canvas == 169 ? 210f : (quad.Canvas == 156 ? 380f : digit ? 450f : 448f) + objectiveYOffset;
diff --git a/src/GamePort/Application/SceneProjection.cs b/src/GamePort/Application/SceneProjection.cs
new file mode 100644
index 0000000..96fd563
--- /dev/null
+++ b/src/GamePort/Application/SceneProjection.cs
@@ -0,0 +1,42 @@
+using System.Numerics;
+
+namespace GamePort.Application;
+
+/// Original geometry-layer clipping overrides from level initializers.
+/// The port currently combines both geometry layers, so it uses their larger far
+/// limit. Layer masks and LV4B's task-driven fog/clip transition remain separate.
+///
+public static class SceneProjection
+{
+ public const float NearPlane = 20;
+ public const float FieldOfView = 0xAAA / 16384f * MathF.Tau;
+
+ public static float FarPlane(string? levelCode) => levelCode?.ToUpperInvariant() switch
+ {
+ "LV1A" => 5000,
+ "LV1B" or "LV1C" or "LV4A" or "LV4D" or "LEV7" => 10000,
+ "LV1D" or "LV1E" => 120000,
+ "LV1F" => 15000,
+ "LEV1" => 28000,
+ "LV2A" => 3500,
+ "LV2B" or "LEV2" => 50000,
+ "LV3A" => 80000,
+ "LV3B" or "LV3C" or "LV3D" or "LV3E" or "LEV3" => 40000,
+ "LV4B" => 7200,
+ "LV4C" or "LEV4" => 30000,
+ "LV5A" or "LV5B" => 16000,
+ "LEV5" => 12000,
+ "LV6A" or "LEV6" => 4000,
+ "VR01" or "VR02" or "VR03" or "VR04" or "VR05" or "VR06" or "VR07" or "VR08" => 50000,
+ _ => 3200 // Original OMediaLayer constructor default, not a universal level setting.
+ };
+
+ /// Original positive-Z,0..1 depth perspective. Caller applies the
+ /// existing Vulkan viewport Y flip, just as for the inspection projection.
+ ///
+ public static Matrix4x4 CreateGameplay(string? levelCode, float aspect)
+ {
+ if (!float.IsFinite(aspect) || aspect <= 0) throw new ArgumentOutOfRangeException(nameof(aspect));
+ return Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(FieldOfView, aspect, NearPlane, FarPlane(levelCode));
+ }
+}
diff --git a/src/GamePort/Game/LabSimulation.cs b/src/GamePort/Game/LabSimulation.cs
index 2046e1f..ec2f68f 100644
--- a/src/GamePort/Game/LabSimulation.cs
+++ b/src/GamePort/Game/LabSimulation.cs
@@ -101,6 +101,9 @@ public sealed class LabSimulation
float lateral = 0;
if (Grounded)
{
+ //437B9E..437BAC uses an interface pointer: interface+614 is
+ //complete+6D4. Normal grounded/released input clears air turn.
+ if (!input.Jump) TurnRate = 0;
InteractionRadius = 60; // Jimmy's ordinary grounded update42469B.
float yawDelta = 0;
if (input.Left) { yawDelta += 20; lateral = -1000; Speed = RecoveredMotion.AddSpeed(Speed); }
diff --git a/src/GamePort/Game/ObjectivePanel.cs b/src/GamePort/Game/ObjectivePanel.cs
new file mode 100644
index 0000000..5c94ba2
--- /dev/null
+++ b/src/GamePort/Game/ObjectivePanel.cs
@@ -0,0 +1,86 @@
+namespace GamePort.Game;
+
+///
+/// Objective pad timing from EXE406F50/407070. Layout offset belongs to the
+/// separate gadget UI layout; O controls the animation timer, not that offset.
+/// Current rendering has one selected objective rather than the full44 flags.
+///
+public sealed class ObjectivePanel
+{
+ public const float SlideInSeconds = .7f; //48D974.
+ public const float SlideScale = 1.4285714626312256f; //48D970, original float reciprocal.
+ public const float SlideDistance = 100; //48D96C.
+ public const float HoldUntilSeconds = 7; //Integer4EC498.
+ public const float ExitDuration = 1.7f; //48D940.
+ public const float HiddenInitialTime = 20; //4018A8/423EC6.
+ public static float ExitEnd => HoldUntilSeconds + ExitDuration;
+
+ private bool objectiveKeyHeld;
+ private bool openingSoundPlayed;
+ private bool renderAllowed;
+ public int CurrentObjective { get; private set; }
+ public float Elapsed { get; private set; } = HiddenInitialTime;
+ public float LayoutOffset { get; }
+ public bool PadVisible => renderAllowed && CurrentObjective > 0 && Elapsed < ExitEnd;
+ public bool ContentVisible => PadVisible && Elapsed >= SlideInSeconds && Elapsed < HoldUntilSeconds;
+ public float SlideOffset => Elapsed < SlideInSeconds ? (1 - Elapsed * SlideScale) * SlideDistance
+ : Elapsed < HoldUntilSeconds ? 0 : (Elapsed - HoldUntilSeconds) * SlideScale * SlideDistance;
+ public float YOffset => LayoutOffset + (PadVisible ? SlideOffset : 0);
+ public event Action? SoundEffect;
+
+ /// Loaded selector starts hidden; source initializes its independent timer to20.
+ public ObjectivePanel(int initialObjective = 0, float layoutOffset = -69)
+ {
+ if (initialObjective is < 0 or > 43) throw new ArgumentOutOfRangeException(nameof(initialObjective));
+ if (!float.IsFinite(layoutOffset) || layoutOffset is < -480 or > 480)
+ throw new ArgumentOutOfRangeException(nameof(layoutOffset));
+ CurrentObjective = initialObjective;
+ LayoutOffset = layoutOffset;
+ }
+
+ /// Source406F50: positive assignments reset timing, even for the same selector.
+ public void Select(int objective)
+ {
+ if (objective <= 0) return;
+ if (objective > 43) throw new ArgumentOutOfRangeException(nameof(objective));
+ CurrentObjective = objective;
+ Show();
+ }
+
+ /// Also used after source practice No404D97 resets the panel timer to0.
+ public void Show() => Elapsed = 0;
+
+ /// 407142..407198 edge latch. O hides an opening/stationary panel, otherwise opens it.
+ public void Key(bool held)
+ {
+ if (held && !objectiveKeyHeld)
+ Elapsed = Elapsed >= 0 && Elapsed < HoldUntilSeconds ? HoldUntilSeconds : 0;
+ objectiveKeyHeld = held;
+ }
+
+ ///
+ /// UI clock4043D9..4043F9 advances only with a non-null controlled entity.
+ /// Modal4044D7..404504 forces exit time and hides pad/content. Pause/focus policy
+ /// is explicit: caller supplies0 elapsed while its UI clock is paused.
+ ///
+ public void Step(float seconds, bool hasControlledActor = true, bool modalActive = false)
+ {
+ if (!float.IsFinite(seconds) || seconds < 0) throw new ArgumentOutOfRangeException(nameof(seconds));
+ if (hasControlledActor)
+ {
+ var next = Elapsed + seconds;
+ if (!float.IsFinite(next)) throw new ArgumentOutOfRangeException(nameof(seconds));
+ Elapsed = next;
+ }
+ if (modalActive) Elapsed = ExitEnd;
+ renderAllowed = hasControlledActor && !modalActive;
+ if (!PadVisible) return;
+ if (Elapsed < SlideInSeconds)
+ {
+ if (openingSoundPlayed) return;
+ openingSoundPlayed = true;
+ SoundEffect?.Invoke(216); //4070BA..4070CA.
+ }
+ else if (Elapsed < HoldUntilSeconds) openingSoundPlayed = false;
+ }
+}
diff --git a/src/GamePort/Game/SceneDirector.cs b/src/GamePort/Game/SceneDirector.cs
index 2d66e80..9c3040d 100644
--- a/src/GamePort/Game/SceneDirector.cs
+++ b/src/GamePort/Game/SceneDirector.cs
@@ -320,7 +320,8 @@ public sealed class SceneDirector
private void StartMulti(GamEntity entity)
{
- SetControl(entity);
+ // MCA's PlayerControlled is its completion target (4311F0), not an
+ // activation grant. Each valid shot clears control at43159E..4315A7.
Toggle(entity);
if (skipping) { FinishMulti(entity); return; }
StartCamera(entity, 0, applyCommon: false);
@@ -350,6 +351,7 @@ public sealed class SceneDirector
Block(entity, $"Camera target {targetTag} absent", entity.Text("NextTrigger"));
return;
}
+ if (index >= 0) ControlledTag = null;
var database = entity.Text("SoundDatabase") ?? "none";
var duration = soundDuration(database, sound);
if (!double.IsFinite(duration) || duration < 0)
diff --git a/src/GamePort/Program.cs b/src/GamePort/Program.cs
index 87b0809..5adfa01 100644
--- a/src/GamePort/Program.cs
+++ b/src/GamePort/Program.cs
@@ -77,6 +77,10 @@ internal static class Program
--smoke-practice-transition Headless lab-to-VR04 practice transition
--smoke-practice-window SDL practice pause/dismiss/resize check (12 frames)
--smoke-jetpack 300-step powered steering/jump check in VR04
+ --smoke-jump-key NAME Replay using shift/right-shift/insert/keypad0/right-mouse
+ --smoke-carl-cutscene Verify input stays locked during the lab conversation
+ --smoke-objective-panel Show original lab objective; --story-time tests timeout
+ --smoke-objective-window SDL O-key reopen/close/timeout check
--verify-assets Decode all original PNG/ASE files
--smoke-window Test keyboard event/resize (requires --frames 6 or more)
--no-validation Disable development validation
@@ -211,12 +215,21 @@ internal static class Program
var animationPath = Option(args, "--animation");
var walkSmoke = args.Contains("--smoke-walk");
var jetpackSmoke = args.Contains("--smoke-jetpack");
+ var carlSmoke = args.Contains("--smoke-carl-cutscene");
+ var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
+ var objectiveSmoke = args.Contains("--smoke-objective-panel") || objectiveWindowSmoke;
+ var jumpBinding = Option(args, "--smoke-jump-key") ?? "shift";
+ uint jumpScancode = jumpBinding switch { "shift" => 225, "right-shift" => 229,
+ "insert" => 73, "keypad0" => 98, "right-mouse" => 0,
+ _ => throw new ArgumentException("Unknown jump smoke binding") };
+ if (Option(args, "--smoke-jump-key") != null && !(walkSmoke || jetpackSmoke))
+ throw new ArgumentException("Jump binding smoke option requires a movement smoke mode");
var practiceWindowSmoke = args.Contains("--smoke-practice-window");
if (walkSmoke && jetpackSmoke) throw new ArgumentException("Select one movement smoke check");
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
&& animationPath == null && !args.Contains("--time");
var story = defaultStory || loadedSave != null || saveOutput != null || args.Contains("--story") || args.Contains("--story-time")
- || args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke;
+ || args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke || carlSmoke || 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.");
@@ -239,7 +252,7 @@ internal static class Program
SceneHud? hud = null;
JetpackVisuals? jetpackVisuals = null;
var practice = new PracticePrompt();
- var objectiveOffset = -69f;
+ ObjectivePanel? objectivePanel = null;
var patrols = new Dictionary(StringComparer.OrdinalIgnoreCase);
LevelTransition? transitionRequest = null;
var characterOffset = mesh.Vertices.Length;
@@ -268,6 +281,8 @@ internal static class Program
var tasks = new TaskStates(save.Tasks);
director = new SceneDirector(level!, tasks, resources.Duration);
interactions = new SceneInteractions(director, tasks, save, level!.Code);
+ objectivePanel = new ObjectivePanel(interactions.CurrentObjective);
+ interactions.ObjectiveChanged += objectivePanel.Select;
simulation!.Energy = interactions.Energy;
simulation.JetpackInventoryState = () => interactions.Inventory.State(0, 3);
mechanisms = new SceneMechanisms(director);
@@ -275,7 +290,7 @@ internal static class Program
interactions.PracticeRequested += practice.Show;
practice.Chosen += (mode, accepted) =>
{
- if (!accepted) return;
+ if (!accepted) { objectivePanel.Show(); return; }
// Player43B5A0 receives current/requested GAM and latest STRT tag
// as return context;42AF00's runtime checkpoint is separate.
interactions.SetReturnContext(Path.GetFileName(levelPath!), originalStart!.Tag!);
@@ -324,7 +339,10 @@ 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" : headless ? "1" : "0"));
+ var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : headless ? "1" : "0"));
+ if (objectiveWindowSmoke && (headless || frames < 180)) throw new ArgumentException("Objective window smoke needs180 window frames");
+ if ((carlSmoke || objectiveSmoke) && (level?.Code != "LV1B" || loadedSave != null || objectiveSmoke && !headless && !objectiveWindowSmoke))
+ throw new ArgumentException("Lab conversation/objective smoke requires fresh LV1B (objective check is headless)");
if (jetpackSmoke && (level?.Code != "VR04" || frames < 300))
throw new ArgumentException("Jetpack smoke requires VR04 and at least300 frames");
if (walkSmoke && frames < 240) throw new ArgumentException("Walk smoke requires at least 240 frames.");
@@ -355,6 +373,7 @@ internal static class Program
director.Speech += sceneAudio.Speech;
director.MusicStopped += sceneAudio.StopMusic;
director.MusicRestarted += sceneAudio.RestartMusic;
+ objectivePanel!.SoundEffect += id => { if (level!.Code == "LV1B") sceneAudio.Effect(id); };
interactions!.SoundEffect += id => sceneAudio.Effect(id);
mechanisms!.Sound += (actor, id, loop) => sceneAudio.Effect(id, loop ? actor.Tag : null);
mechanisms.StopSound += actor => sceneAudio.StopLoop(actor.Tag);
@@ -377,6 +396,15 @@ internal static class Program
if (transitionRequest?.LevelFile != "level1.gam")
throw new InvalidOperationException("Original lab exit did not request level1.gam");
}
+ if (carlSmoke) LabRouteSmoke.StartCarl(level!, director, interactions!, () => practice.Key(17, Vector2.Zero));
+ if (objectiveSmoke)
+ {
+ director.Skip();
+ director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
+ director.Skip();
+ if (interactions!.CurrentObjective != 1) throw new InvalidOperationException("Original explanation did not assign objective1");
+ if (objectiveWindowSmoke) objectivePanel!.Step(9);
+ }
if (args.Contains("--smoke-practice-prompt") || args.Contains("--smoke-practice-transition") || practiceWindowSmoke)
{
if ((!headless && !practiceWindowSmoke) || level?.Code != "LV1B") throw new ArgumentException("Practice smoke requires the original lab");
@@ -392,6 +420,7 @@ internal static class Program
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
mechanisms!.Step(FixedStepClock.Step);
director.Step(FixedStepClock.Step);
+ objectivePanel!.Step(FixedStepClock.Step, director.ControlledTag != null, practice.Active);
if (animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)) initialPoseTime = 0;
initialPoseTime += FixedStepClock.Step;
actorVisuals!.Update(FixedStepClock.Step, mesh);
@@ -416,6 +445,9 @@ internal static class Program
var sawJetpackKeys = 0;
float poweredAirTravel = 0;
var poweredAirTurn = false;
+ var objectiveWasHidden = false;
+ var objectiveReopened = false;
+ var objectiveClosing = false;
var sawPracticeDismiss = false;
var sawPracticePause = false;
double last = clock.Elapsed.TotalSeconds;
@@ -436,10 +468,12 @@ internal static class Program
foreach (var (scancode, down, previous) in new[] {
(82u, requested.Forward, injectedInput.Forward),
(81u, requested.Backward, injectedInput.Backward), (80u, requested.Left, injectedInput.Left),
- (79u, requested.Right, injectedInput.Right), (225u, requested.Jump, injectedInput.Jump) })
+ (79u, requested.Right, injectedInput.Right), (jumpScancode, requested.Jump, injectedInput.Jump) })
{
if (down == previous) continue;
- var injected = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = scancode, Down = down ? (byte)1 : (byte)0 };
+ var injected = scancode == 0
+ ? new Sdl.Event { Type = down ? Sdl.MouseButtonDown : Sdl.MouseButtonUp, MouseButton = 3 }
+ : new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = scancode, Down = down ? (byte)1 : (byte)0 };
if (!Sdl.SDL_PushEvent(ref injected)) throw new InvalidOperationException(Sdl.Error);
}
injectedInput = requested;
@@ -460,19 +494,21 @@ internal static class Program
if (practiceWindowSmoke && e.Scancode == 17 && !practice.Active) sawPracticeDismiss = true;
keys.Clear(); mouseJump = false; stepClock.Reset(); continue;
}
- if (e.Type == Sdl.MouseButtonDown && e.MouseButton == 3) mouseJump = true;
+ if (e.Type == Sdl.MouseButtonDown && e.MouseButton == 3)
+ {
+ mouseJump = true;
+ if (jumpScancode == 0) { if (jetpackSmoke) sawJetpackKeys |= 8; if (walkSmoke) sawWalkKeys |= 4; }
+ }
if (e.Type == Sdl.MouseButtonUp && e.MouseButton == 3) mouseJump = false;
if (e.Type == Sdl.KeyDown)
{
keys.Add(e.Scancode);
- if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == 225 ? 4 : 0;
- if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == 225 ? 8 : 0;
+ 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 })
{ sceneAudio?.StopSpeech(); director.Skip(); keys.Clear(); mouseJump = false; }
else if (e.Scancode == 41) running = false;
- if (e.Scancode == 18 && e.Repeat == 0 && director is { Controlled: true, InventoryEnabled: true })
- objectiveOffset = objectiveOffset == -69 ? 0 : -69;
if (inspecting && e.Repeat == 0 && animations?.Select(e.Scancode) == true)
{
animationStarted = clock.Elapsed.TotalSeconds;
@@ -510,12 +546,13 @@ internal static class Program
var elapsed = now - last;
var dt = (float)Math.Min(elapsed, 0.1);
last = now;
- if (simulation != null && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke))
+ if (simulation != null && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke))
{
- var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke ? 1 : stepClock.Advance(elapsed);
+ var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke ? 1 : stepClock.Advance(elapsed);
for (var step = 0; step < steps; step++)
{
- var input = jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
+ var input = carlSmoke ? new PlayerInput(true, false, true, false, true)
+ : jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
: walkSmoke && headless ? LabSimulation.SmokeInput(simulation.Steps) : new PlayerInput(
keys.Contains(82), keys.Contains(81), keys.Contains(80), keys.Contains(79),
mouseJump || keys.Contains(225) || keys.Contains(229) || keys.Contains(73) || keys.Contains(98));
@@ -539,6 +576,8 @@ internal static class Program
mechanisms?.Step(FixedStepClock.Step);
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
director?.Step(FixedStepClock.Step);
+ objectivePanel?.Key(keys.Contains(18) && director is { Controlled: true, InventoryEnabled: true });
+ objectivePanel?.Step(FixedStepClock.Step, director?.ControlledTag != null, practice.Active);
var switched = director is { Controlled: false }
? animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)
: animations!.SelectPose(simulation.Pose);
@@ -579,10 +618,13 @@ internal static class Program
staticVisuals?.Update(mesh);
jetpackVisuals?.Update(mesh, simulation!);
spriteVisuals?.FaceCamera(renderEye, renderTarget, mesh);
- hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && director!.Controlled, practice.Active, objectiveOffset);
- var far = level?.Code == "LV1B" ? 10000 : 3200;
+ objectivePanel?.Key(keys.Contains(18) && !inspecting && !practice.Active
+ && director is { Controlled: true, InventoryEnabled: true });
+ objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
+ hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible,
+ practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible);
var projection = originalCamera || simulation != null && !inspecting
- ? Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(0xAAA / 16384f * MathF.Tau, (float)renderer.Width / renderer.Height, 20, far)
+ ? SceneProjection.CreateGameplay(level?.Code, (float)renderer.Width / renderer.Height)
: Matrix4x4.CreatePerspectiveFieldOfView(MathF.PI / 3, (float)renderer.Width / renderer.Height, Math.Max(radius / 10000, 0.01f), radius * 20);
projection.M22 *= -1;
if (animations != null)
@@ -596,6 +638,19 @@ internal static class Program
count++;
audio?.Pump();
sceneAudio?.Pump();
+ if (objectiveWindowSmoke)
+ {
+ if (count == 1) objectiveWasHidden = !objectivePanel!.PadVisible;
+ if (count == 60) objectiveReopened = objectivePanel!.ContentVisible;
+ if (count == 61) objectiveClosing = objectivePanel!.PadVisible && !objectivePanel.ContentVisible;
+ if (count is 1 or 2 or 60 or 61)
+ {
+ var down = count is 1 or 60;
+ var key = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = 18, Down = down ? (byte)1 : (byte)0 };
+ if (!Sdl.SDL_PushEvent(ref key)) throw new InvalidOperationException(Sdl.Error);
+ }
+ if (count == 1 && !Sdl.SDL_SetWindowSize(window, 800, 600)) throw new InvalidOperationException(Sdl.Error);
+ }
if (practiceWindowSmoke && count == 1)
{
sawPracticePause = practice.Active && simulation!.Steps == 0;
@@ -616,7 +671,7 @@ internal static class Program
if (!Sdl.SDL_PushEvent(ref cycle)) throw new InvalidOperationException(Sdl.Error);
}
}
- if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
+ if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
if (frames > 0 && count >= frames) break;
if (transitionRequest != null) break;
}
@@ -631,11 +686,24 @@ internal static class Program
if (Math.Abs(pixels[i] - 31) + Math.Abs(pixels[i + 1] - 51) + Math.Abs(pixels[i + 2] - 76) > 6) changed++;
Console.WriteLine($"Rendered {count} frame(s), {changed} non-background pixels, {renderer.ValidationErrors} Vulkan validation error(s).");
if (simulation != null) Console.WriteLine(simulation.Report);
+ if (carlSmoke)
+ {
+ var locked = director is { Controlled: false, Playing: true, CurrentTag: "neutron1a" } && simulation!.Steps == 0;
+ Console.WriteLine($"Carl cutscene input lock with held move/turn/jump: {locked}.");
+ if (!locked) return 2;
+ }
+ if (objectiveSmoke) Console.WriteLine($"Objective panel: time={objectivePanel!.Elapsed:F3}, pad={objectivePanel.PadVisible}, content={objectivePanel.ContentVisible}, offset={objectivePanel.YOffset:F3}.");
+ if (objectiveWindowSmoke)
+ {
+ var timedOut = !objectivePanel!.PadVisible;
+ Console.WriteLine($"Objective SDL check: hidden={objectiveWasHidden}, O reopened={objectiveReopened}, O closed={objectiveClosing}, timed out={timedOut}, resize800x600={didResize}.");
+ if (!objectiveWasHidden || !objectiveReopened || !objectiveClosing || !timedOut || !didResize) return 2;
+ }
if (jetpackSmoke)
{
Console.WriteLine($"Powered jump: bursts={simulation!.Bursts}, remaining={simulation.JetpackRemaining:F3}, energy={simulation.Energy:F3}, grounded={simulation.Grounded}.");
Console.WriteLine($"Powered air steering: travel={poweredAirTravel:F2}, turned={poweredAirTurn}.");
- if (!headless) Console.WriteLine($"Jetpack SDL keys received={sawJetpackKeys == 15}, resize800x600={didResize}.");
+ if (!headless) Console.WriteLine($"Jetpack SDL keys received={sawJetpackKeys == 15}, resize800x600={didResize}, jump={jumpBinding}.");
if (simulation.Bursts == 0 || simulation.MaximumRise <= 137.62f || !simulation.Grounded
|| poweredAirTravel <= 20 || !poweredAirTurn || !headless && (sawJetpackKeys != 15 || !didResize)) return 2;
}
diff --git a/tests/GamePort.DirectorTests/Program.cs b/tests/GamePort.DirectorTests/Program.cs
index 6284363..9f8fb38 100644
--- a/tests/GamePort.DirectorTests/Program.cs
+++ b/tests/GamePort.DirectorTests/Program.cs
@@ -42,6 +42,29 @@ Check(skipMusicPlaying,"Skipping must restore selected gameplay music");
Check(skip.FindActor("C3DGODDARD")!.Position==endGoddard,"Skip must preserve AI/toggle actions");
Console.WriteLine("PASS original intro skip preserves action sequence");
+foreach (var finishBySkip in new[] { false, true })
+{
+ var carlScene = new SceneDirector(level, new TaskStates(save.Tasks), (_, _) => .1);
+ carlScene.Begin(level.FindStart()!); carlScene.Skip();
+ Check(carlScene.Controlled, "Carl test starts with normal player control");
+ carlScene.Trigger("neutron1a");
+ Check(carlScene.Playing && carlScene.CurrentTag == "neutron1a" && !carlScene.Controlled,
+ "Carl MCA must lock input despite serialized completion target JIM1");
+ if (finishBySkip) carlScene.Skip();
+ else
+ for (var tick = 0; tick < 100 && carlScene.Playing; tick++)
+ {
+ Check(!carlScene.Controlled, "Every active Carl shot keeps player control locked");
+ carlScene.Step(.1f);
+ }
+ Check(!carlScene.Playing && carlScene.Controlled && !carlScene.Blocked,
+ "Carl sequence restores original JIM1 completion target on finish or skip");
+}
+var carlBytes = File.ReadAllBytes(AssetPath.Resolve(root, "Neutron.exe"));
+Check(carlBytes.AsSpan(0x3159e, 15).SequenceEqual(Convert.FromHexString("8B0D48995000538B11FF9218010000")),
+ "Source MCA clears game controlled pointer before playback");
+Console.WriteLine("PASS end-of-lab Carl cutscene input lock and natural/skip control restoration");
+
foreach(var type in new[]{0,1,2,3,4})
{
var camera=Entity("3MCA","camera",("CameraTarget0","actor"),("SoundDatabase","voice"),("SoundIndex0",1),("CameraType0",type),("LookatVOffset0",100f),("NextTrigger","default"));
diff --git a/tests/GamePort.HudTests/GamePort.HudTests.csproj b/tests/GamePort.HudTests/GamePort.HudTests.csproj
index 14b16ab..06192a1 100644
--- a/tests/GamePort.HudTests/GamePort.HudTests.csproj
+++ b/tests/GamePort.HudTests/GamePort.HudTests.csproj
@@ -5,5 +5,6 @@
+
diff --git a/tests/GamePort.HudTests/Program.cs b/tests/GamePort.HudTests/Program.cs
index edf8a3d..dde679d 100644
--- a/tests/GamePort.HudTests/Program.cs
+++ b/tests/GamePort.HudTests/Program.cs
@@ -2,6 +2,7 @@ using System.Numerics;
using System.Text.Json;
using GamePort.Assets;
using GamePort.Application;
+using GamePort.Game;
var temp = Path.Combine(Path.GetTempPath(), "neutron-hud-" + Guid.NewGuid());
Directory.CreateDirectory(temp);
@@ -35,6 +36,20 @@ try
Near(final.Vertices[1].Position, new(.2f, 2*380f/480-1, 0), "Expanded source HUD offset");
hud.Update(final, 0, true, false);
Check(final.Draws.Skip(1).All(d => !d.Visible), "No invented objective0 image");
+ var panel = new ObjectivePanel();
+ panel.Select(1); panel.Step(0);
+ void PresentPanel() => hud.Update(final, panel.CurrentObjective, panel.PadVisible, false, panel.YOffset, panel.ContentVisible);
+ PresentPanel();
+ Check(final.Draws.Skip(1).Count(d => d.Visible) == 1 && final.Draws[1].Visible,
+ "Entering objective draws only the moving pad");
+ panel.Step(1); PresentPanel();
+ Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "Stationary objective draws pad, text and digit");
+ panel.Step(6.2f); PresentPanel();
+ Check(final.Draws.Skip(1).Count(d => d.Visible) == 1, "Exit hides content before pad slides away");
+ panel.Step(2); PresentPanel();
+ Check(final.Draws.Skip(1).All(d => !d.Visible), "Timed-out objective has no remaining overlay draw");
+ panel.Key(true); panel.Step(1); PresentPanel();
+ Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "O reopens timed-out panel through the timer");
Reject(() => hud.Update(source, 1, true, false), "Missing final ranges");
Reject(() => hud.Update(final, 1, true, false, float.NaN), "Nonfinite HUD offset");
File.WriteAllText(path, Manifest(entries.Select(e => new { e.id, width=e.id==120 ? 0 : e.width, e.height, e.path })));
diff --git a/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj b/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj
index 962d807..d6b7fc4 100644
--- a/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj
+++ b/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj
@@ -9,6 +9,7 @@
+
diff --git a/tests/GamePort.MovementTests/Program.cs b/tests/GamePort.MovementTests/Program.cs
index bb2c69c..f81344c 100644
--- a/tests/GamePort.MovementTests/Program.cs
+++ b/tests/GamePort.MovementTests/Program.cs
@@ -19,6 +19,7 @@ var tests = new (string Name, Action Check)[]
("ordinary jump responds to airborne arrows", AirControl),
("powered jetpack starts moving and turns from stationary takeoff", JetpackControl),
("powered steering remains independent of presentation rate", JetpackReplayRates),
+ ("landing clears residual air turn before ground steering", LandingTurn),
("reset restores spawn, camera and counters", Reset),
("ten-minute simulation remains finite and supported", LongRun),
("original lab placement, floor, walking and jump checkpoint", () => OriginalLab(project, originals)),
@@ -254,6 +255,25 @@ static void JetpackReplayRates()
}
}
+static void LandingTurn()
+{
+ foreach (var initialLeft in new[] { false, true })
+ {
+ var simulation = FlatSimulation();
+ simulation.Step(new(true, false, false, false, true));
+ for (var i = 0; i < 120 && !simulation.Grounded; i++)
+ simulation.Step(new(true, false, initialLeft, !initialLeft, false));
+ Check(simulation.Grounded && MathF.Abs(simulation.TurnRate) > 20,
+ "Landing fixture retains an opposing air turn before outer grounded reset");
+ var before = simulation.Yaw;
+ simulation.Step(new(true, false, !initialLeft, initialLeft, false));
+ Near(simulation.TurnRate, 0, 0, "grounded released-jump reset clears shared air-turn field");
+ var yawChange = MathF.IEEERemainder(simulation.Yaw - before, 360);
+ Near(yawChange, initialLeft ? -10 * FixedStepClock.Step * 3.7f : 10 * FixedStepClock.Step * 3.7f,
+ .0001f, "prior jump turn must not cancel or clamp opposing ground turn");
+ }
+}
+
static void JumpRepress()
{
var simulation = FlatSimulation();
diff --git a/tests/GamePort.ObjectiveTests/GamePort.ObjectiveTests.csproj b/tests/GamePort.ObjectiveTests/GamePort.ObjectiveTests.csproj
new file mode 100644
index 0000000..21c3497
--- /dev/null
+++ b/tests/GamePort.ObjectiveTests/GamePort.ObjectiveTests.csproj
@@ -0,0 +1,4 @@
+
+ Exenet10.0enableenablefalse
+
+
diff --git a/tests/GamePort.ObjectiveTests/Program.cs b/tests/GamePort.ObjectiveTests/Program.cs
new file mode 100644
index 0000000..bf33b8e
--- /dev/null
+++ b/tests/GamePort.ObjectiveTests/Program.cs
@@ -0,0 +1,97 @@
+using System.Buffers.Binary;
+using GamePort.Game;
+
+var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
+var source = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
+float SourceFloat(int va) => BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(va - 0x400000, 4)));
+void Bytes(int va, string hex)
+{
+ var expected = Convert.FromHexString(hex);
+ Require(source.AsSpan(va - 0x400000, expected.Length).SequenceEqual(expected), $"Original instructions differ at0x{va:X}");
+}
+Near(SourceFloat(0x48d974), ObjectivePanel.SlideInSeconds, "source entry boundary");
+Near(SourceFloat(0x48d970), ObjectivePanel.SlideScale, "source slide scale");
+Near(SourceFloat(0x48d96c), ObjectivePanel.SlideDistance, "source slide distance");
+Near(SourceFloat(0x48d940), ObjectivePanel.ExitDuration, "source exit window");
+Require(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(0xec498, 4)) == 7, "Source stationary end differs");
+Bytes(0x406f76, "C70588814F0000000000");
+Bytes(0x4043d9, "391DE4995000");
+Bytes(0x4043e5, "D90588814F00D8442428");
+Bytes(0x407071, "A087985000");
+Bytes(0x40715b, "C705307C4F0001000000");
+Bytes(0x40718e, "C70588814F0000000000");
+Bytes(0x407271, "578BCEFF92CC040000");
+Console.WriteLine("PASS source objective timer/input/visibility instructions and constants");
+
+var panel = new ObjectivePanel(1);
+panel.Step(0);
+Require(!panel.PadVisible && !panel.ContentVisible, "Loaded selector starts hidden at original timer20");
+panel.Select(1); panel.Step(0);
+Require(panel.PadVisible && !panel.ContentVisible, "Slide-in draws pad without objective/digit");
+Near(panel.YOffset, 31, "Entry pad is100 below its layout position");
+panel.Step(.35f);
+Near(panel.YOffset, -19, "Half entry position follows source scale");
+panel.Step(.35f);
+Require(panel.PadVisible && panel.ContentVisible, "Content becomes visible at entry equality.7");
+Near(panel.YOffset, -69, "Stationary original layout offset");
+panel.Step(6.3f);
+Near(panel.Elapsed, 7, "Exact stationary boundary");
+Require(panel.PadVisible && !panel.ContentVisible, "Exit hides content at7, retaining pad");
+panel.Step(.35f);
+Near(panel.YOffset, -19, "Exit pad moves down using source reciprocal");
+panel.Step(ObjectivePanel.ExitEnd-panel.Elapsed);
+Require(!panel.PadVisible && !panel.ContentVisible, "Pad disappears at8.7 equality");
+Console.WriteLine("PASS source slide-in/stationary/slide-out coordinates and exact timeout boundaries");
+
+panel.Key(true); panel.Step(0);
+Require(panel.PadVisible && panel.Elapsed == 0, "O reopens hidden panel");
+panel.Step(1); panel.Key(true);
+Require(panel.ContentVisible && panel.Elapsed == 1, "Held O does not retrigger");
+panel.Key(false); panel.Key(true); panel.Step(0);
+Require(panel.Elapsed == 7 && !panel.ContentVisible, "Next O edge starts slide-out");
+panel.Key(false); panel.Key(true); panel.Step(0);
+Require(panel.Elapsed == 0 && panel.PadVisible, "O during slide-out reopens");
+Near(panel.LayoutOffset, -69, "O does not resize/change gadget layout");
+Console.WriteLine("PASS O edge latch, close/reopen phases and layout separation");
+
+panel.Select(2); panel.Step(1);
+Require(panel.CurrentObjective == 2 && panel.ContentVisible, "New objective shows after entry");
+panel.Select(2); panel.Step(0);
+Require(panel.Elapsed == 0 && !panel.ContentVisible, "Same positive selector also resets timing");
+panel.Select(0);
+Require(panel.CurrentObjective == 2 && panel.Elapsed == 0, "Nonpositive assignment is source no-op");
+var empty = new ObjectivePanel(); empty.Show(); empty.Step(1);
+Require(!empty.PadVisible && !empty.ContentVisible, "Objective0 does not invent art/digit");
+Console.WriteLine("PASS source selector reset/no-op and no-objective presentation");
+
+panel.Step(1);
+var saved = panel.Elapsed;
+panel.Step(10, hasControlledActor: false);
+Require(panel.Elapsed == saved && !panel.PadVisible && !panel.ContentVisible, "No controlled entity freezes/hides UI");
+panel.Step(0);
+Require(panel.ContentVisible && panel.Elapsed == saved, "Explicit paused clock does not consume time");
+panel.Step(0, modalActive: true);
+Require(panel.Elapsed == ObjectivePanel.ExitEnd && !panel.PadVisible && !panel.ContentVisible, "Practice modal forces hidden end time");
+panel.Show(); panel.Step(0);
+Require(panel.PadVisible && panel.Elapsed == 0, "Practice dismissal may explicitly reopen current objective");
+Console.WriteLine("PASS separate controlled-entity, pause and modal lifecycle");
+
+var sounded = new ObjectivePanel();
+var sounds = new List(); sounded.SoundEffect += sounds.Add;
+sounded.Select(1); sounded.Step(0); sounded.Step(.1f); sounded.Select(2); sounded.Step(0);
+Require(sounds.SequenceEqual(new[] {216}), "Entry sound latch survives timer reset during entry");
+sounded.Step(.7f); sounded.Select(3); sounded.Step(0);
+Require(sounds.SequenceEqual(new[] {216,216}), "Stationary phase rearms the next entry sound");
+Throws(() => sounded.Step(float.NaN));
+Throws(() => sounded.Step(-1));
+Throws(() => sounded.Select(44));
+Console.WriteLine("PASS source entry-sound latch and malformed input bounds");
+Console.WriteLine("Objective checks:6 groups passed. Original gameplay comparison remains outstanding.");
+
+static void Require(bool condition, string message) { if (!condition) throw new InvalidOperationException(message); }
+static void Near(float actual, float expected, string message) => Require(MathF.Abs(actual-expected)<.0002f, $"{message}: {actual} != {expected}");
+static void Throws(Action action) where T : Exception
+{
+ try { action(); } catch (T) { return; }
+ throw new InvalidOperationException($"Expected{typeof(T).Name}");
+}
diff --git a/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj b/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj
index 9c71bce..9873b53 100644
--- a/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj
+++ b/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj
@@ -13,6 +13,7 @@
+
diff --git a/tests/GamePort.ProjectionTests/GamePort.ProjectionTests.csproj b/tests/GamePort.ProjectionTests/GamePort.ProjectionTests.csproj
new file mode 100644
index 0000000..4352f23
--- /dev/null
+++ b/tests/GamePort.ProjectionTests/GamePort.ProjectionTests.csproj
@@ -0,0 +1,8 @@
+
+ Exenet10.0enableenablefalse
+
+
+
+
+
+
diff --git a/tests/GamePort.ProjectionTests/Program.cs b/tests/GamePort.ProjectionTests/Program.cs
new file mode 100644
index 0000000..aa9c311
--- /dev/null
+++ b/tests/GamePort.ProjectionTests/Program.cs
@@ -0,0 +1,72 @@
+using System.Numerics;
+using System.Buffers.Binary;
+using GamePort.Application;
+using GamePort.Assets;
+
+var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
+var executable = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
+
+// Guard the actual outside and tutorial layer stores, not just an expected helper value.
+Bytes(0x450869, "8b3d3c9a5000c787c000000000c0da46");
+Bytes(0x456bfe, "8b3d309a5000c787c000000000504347");
+Bytes(0x456c44, "8b3d3c9a5000c787c000000000504347");
+Require(BinaryPrimitives.ReadUInt32LittleEndian(executable.AsSpan(0x450875 - 0x400000, 4)) == BitConverter.SingleToUInt32Bits(28000),
+ "Outside geometry source far clip differs");
+Require(SceneProjection.FarPlane("LEV1") == 28000 && SceneProjection.FarPlane("VR04") == 50000,
+ "Outside/tutorial must not inherit generic3200 clipping");
+Console.WriteLine("PASS source outside/tutorial layer instructions and corrected far clips");
+
+var ranges = new Dictionary
+{
+ [5000] = ["LV1A"], [10000] = ["LV1B", "LV1C", "LV4A", "LV4D", "LEV7"],
+ [120000] = ["LV1D", "LV1E"], [15000] = ["LV1F"], [28000] = ["LEV1"],
+ [3500] = ["LV2A"], [50000] = ["LV2B", "LEV2", "VR01", "VR02", "VR03", "VR04", "VR05", "VR06", "VR07", "VR08"],
+ [80000] = ["LV3A"], [40000] = ["LV3B", "LV3C", "LV3D", "LV3E", "LEV3"],
+ [7200] = ["LV4B"], [30000] = ["LV4C", "LEV4"], [16000] = ["LV5A", "LV5B"],
+ [12000] = ["LEV5"], [4000] = ["LV6A", "LEV6"]
+};
+var codes = Directory.EnumerateFiles(AssetPath.Resolve(original, "gam"))
+ .Where(path => path.EndsWith(".gam", StringComparison.OrdinalIgnoreCase)).Select(path => GamLevel.Load(path).Code).ToHashSet();
+Require(codes.Count == 35 && ranges.Values.SelectMany(x => x).ToHashSet().SetEquals(codes), "Every supplied original level needs a clipping mapping");
+foreach (var (far, levels) in ranges)
+ foreach (var level in levels)
+ {
+ Require(SceneProjection.FarPlane(level.ToLowerInvariant()) == far, "Case-insensitive source scene mapping differs");
+ var projection = SceneProjection.CreateGameplay(level, 4f / 3);
+ var nearClip = Vector4.Transform(new Vector4(0, 0, SceneProjection.NearPlane, 1), projection);
+ var farClip = Vector4.Transform(new Vector4(0, 0, far, 1), projection);
+ Require(MathF.Abs(nearClip.Z / nearClip.W) < .00001f && MathF.Abs(farClip.Z / farClip.W - 1) < .00001f,
+ "Recovered clipping must map to Vulkan0..1 depth");
+ }
+Require(SceneProjection.FarPlane(null) == 3200 && SceneProjection.FarPlane("unknown") == 3200, "Unknown layers retain original engine default");
+foreach (var aspect in new[] { 0, -1, float.NaN, float.PositiveInfinity })
+{
+ try { SceneProjection.CreateGameplay("LEV1", aspect); throw new Exception("Invalid aspect accepted"); }
+ catch (ArgumentOutOfRangeException) { }
+}
+Console.WriteLine("PASS all35 level mappings, inherited fallback, depth endpoints and bounded aspect input");
+
+var outside = Mesh.LoadSceneJson("artifacts/extracted/level1/scene.json");
+var sourceLevel = GamLevel.Load(AssetPath.Resolve(original, "gam/level1.gam"));
+var start = sourceLevel.FindStart("level1")!;
+var view = Matrix4x4.CreateLookAtLeftHanded(start.CameraPosition, start.Position + new Vector3(0, 80, 0), Vector3.UnitY);
+var oldMatrix = view * Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(SceneProjection.FieldOfView, 4f / 3, 20, 3200);
+var newMatrix = view * SceneProjection.CreateGameplay(sourceLevel.Code, 4f / 3);
+var recovered = outside.Vertices.Count(vertex =>
+{
+ var point = new Vector4(vertex.Position, 1);
+ var current = Vector4.Transform(point, newMatrix);
+ var previous = Vector4.Transform(point, oldMatrix);
+ return current.W > 0 && MathF.Abs(current.X) <= current.W && MathF.Abs(current.Y) <= current.W
+ && current.Z >= 0 && current.Z <= current.W && previous.Z > previous.W;
+});
+Require(recovered > 100, "Actual outside geometry must demonstrate the old arbitrary far-plane cut");
+Console.WriteLine($"PASS actual LEV1 source view retains{recovered} vertices formerly beyond the incorrect3200 far plane");
+Console.WriteLine("Projection recovery is statically verified; original-game visual comparison and per-layer/fog fidelity remain separate.");
+
+void Bytes(int address, string expected)
+{
+ var bytes = Convert.FromHexString(expected);
+ Require(executable.AsSpan(address - 0x400000, bytes.Length).SequenceEqual(bytes), $"Source clip instruction differs at{address:X}");
+}
+static void Require(bool condition, string message) { if (!condition) throw new InvalidOperationException(message); }
diff --git a/tests/test_air_steering.py b/tests/test_air_steering.py
index 4bb078c..a6fe38f 100644
--- a/tests/test_air_steering.py
+++ b/tests/test_air_steering.py
@@ -16,6 +16,12 @@ class AirSteeringEvidence(unittest.TestCase):
self.assertEqual(raw[0x38b76:0x38b7c], bytes.fromhex('ff9228010000'))
self.assertEqual(struct.unpack_from('