Restore tutorial return placement and source terrain collision eligibility
This commit is contained in:
1 parent
ca08c468ba
commit
8d60a68511
36 files changed
+991
-69
No files matched your search
@@ -35,8 +35,8 @@ control returns, including after skipping.
|
||||
The original lab pickup is internally tagged `shrinkray`; the original objective
|
||||
art identifies it as the **jet pack**. Its practice prompt accepts **Y** or a click
|
||||
on Yes to enter VR04, and **N** or a click on No to resume. Enter selects the
|
||||
hovered Yes region, otherwise No. The original practice return uses the saved
|
||||
lab start tag. Runtime checkpoint-position restoration is still unrecovered.
|
||||
hovered Yes region, otherwise No. Practice RETURN restores Jimmy and Goddard to
|
||||
the saved departure position, retains the lab start's yaw and suppresses its intro.
|
||||
In the air, Up accelerates, Left/Right turn, and Down brakes horizontal motion. Source patrol/door logic is integrated, while
|
||||
sensing, full collision response, alpha/lighting and audio effects remain incomplete.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This checkpoint implements deterministic static geometric collision against the
|
||||
extracted original scene. It is **not the recovered original collision solver**.
|
||||
The original collision masks, class activation rules, shape selection, tolerances,
|
||||
Remaining collision masks, class activation rules, tolerances,
|
||||
step handling and controller state integration are still unresolved. No original
|
||||
runtime comparison establishes collision fidelity.
|
||||
|
||||
@@ -12,8 +12,10 @@ runtime comparison establishes collision fidelity.
|
||||
`5a33d11311fc222631eb8f7384d1863192cb1f55f7e67035caa0ae12fd9892ab`.
|
||||
The existing read-only extractor produces
|
||||
`artifacts/extracted/level1b/scene.json` in unchanged original Y-up world units:
|
||||
8,607 expanded vertices and 2,869 triangles. Collision uses **all nondegenerate
|
||||
source triangles**, independent of `Mesh.Draws`, texture or material resolution.
|
||||
8,607 expanded vertices and 2,869 triangles. Collision now excludes the18
|
||||
triangles of shape94 ncwater, following the recovered NC shape-name gate at
|
||||
44DD2F..44DD70. All2,851 other nondegenerate source triangles remain eligible,
|
||||
independent of `Mesh.Draws`, texture or material resolution.
|
||||
The actual lab has no degenerate triangles removed by this rule. Mesh vertex/index
|
||||
arrays and original files are not modified.
|
||||
|
||||
@@ -27,10 +29,11 @@ collision mask. Rendering visibility alone is therefore not used to discard them
|
||||
The regression creates a mesh with no visible draws and proves its original
|
||||
triangles still block movement.
|
||||
|
||||
No decorative surface is excluded at this checkpoint: there is insufficient
|
||||
specific evidence for a general exclusion rule. This conservative policy can block
|
||||
on decorative surfaces or invisible proxies that original state/activation logic
|
||||
would disable. Animated/dynamic scene entities are not added to this static mesh.
|
||||
The NC exclusion is a shape-name prefix rule, not a material heuristic. The shape
|
||||
metadata already exists in prepared scene mesh records; vertex/index/render data
|
||||
is preserved. Other activation/mask rules remain unresolved. See water-collision.md
|
||||
and underground-route.md for source bytes and the actual passage regression.
|
||||
Animated/dynamic scene entities are not added to this static mesh.
|
||||
There is no invented room-sized collision box or coordinate clamp.
|
||||
|
||||
## Capsule coordinates and API
|
||||
|
||||
@@ -120,7 +120,9 @@ and SCENE exactly35 at0x4365ED..FD. Only that gate performs:
|
||||
1. Active Jimmy complete+0x1E8 at0x43662C, resolved through complete vtable
|
||||
0x4A3BDC to0x42AF00: capture current level code and physics root at complete
|
||||
+0x1E48/+0x1E38. The port emits CheckpointCaptured(root); it does not guess
|
||||
that this is the unidentified TSK StoredVector or change a STRT checkpoint.
|
||||
that this is TSK StoredVector or change a STRT checkpoint. Follow-up recovery
|
||||
identifies StoredVector as the separate departure root at+9A8; see
|
||||
runtime-checkpoint.md.
|
||||
2. SCENE50 assignment0x436632..639.
|
||||
3. Inventory setter0x4038C0(group0,item3,state1) at0x43663E..644.
|
||||
4. Help/item-information page0 via0x406F90(0), call0x43664B.
|
||||
@@ -186,8 +188,8 @@ flags at0x4F7D00, stores the selector0x4F8194 and sets flag[objective]=1. Releva
|
||||
lab milestones35/50/60 select1/2/3;65 does not replace the selector. The port
|
||||
maps all44 supplied milestone states (including140/141 selecting8), exposes
|
||||
CurrentObjective/ObjectiveChanged, and saves the selector in OtherCounter.
|
||||
The lab stationary objective panel and practice modal are integrated; timed UI
|
||||
slides/highlights and remaining objective consumers are separate work.
|
||||
The objective timer/slide/O behavior and practice modal are integrated;
|
||||
practice highlights and remaining objective consumers are separate work.
|
||||
|
||||
### Verification and boundaries
|
||||
|
||||
|
||||
@@ -198,8 +198,11 @@ The checkpoint filter immediately returns false when polygon material is null
|
||||
(`0x4794E8..0x4794ED`). **Null material is therefore retained for static collision**,
|
||||
even though it is skipped by drawing. This directly supports retaining the lab's
|
||||
325 unresolved-material triangles. The actual LV1B materials contain no
|
||||
`cstart`/`ccheck*` names, so all2,869 source triangles reach this registration
|
||||
path. No general "decorative" name filter was found in it.
|
||||
`cstart`/`ccheck*` names. Follow-up recovery of the CALLER at44DD2F..44DD70
|
||||
shows that NC-prefixed shape names skip464B00 entirely: shape94 ncwater's18
|
||||
triangles are excluded, leaving2,851 registered source triangles. The polygon
|
||||
function itself has no general decorative-material filter. See water-collision.md
|
||||
for source bytes, vtable path and the distinction between shape and material names.
|
||||
|
||||
Two grids are populated: all polygons at base `0x5CFC7C` and a wall/ceiling grid
|
||||
at `0x509B24` when stored polygon normal.Y is strictly below0.7
|
||||
@@ -289,7 +292,9 @@ All13 groups pass: original-DLL math bit references; source winding/two-sided
|
||||
override; strict endpoint/start; nearest/tie identity; root/velocity/acceleration;
|
||||
height guard independent of velocity;0.1 factor boundary; crossed-geometry query
|
||||
lift; disabled geometry; invalid input; ten-second gravity stability/jump; actual
|
||||
2869 lab triangles including invisible proxies and predicted root76.448635.
|
||||
2869 raw lab triangles including invisible proxies and predicted root76.448635.
|
||||
That standalone raw-array support test does not apply registration masks; the
|
||||
integrated OriginalScenePhysics now omits NC shapes before support/wall queries.
|
||||
|
||||
tools/binary/collision_mode2_probe.c builds with local i686-w64-mingw32-gcc and
|
||||
runs only via tools/recon/reference_capture.py --asset-probe --probe-executable
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
# Practice RETURN position and independent Jimmy checkpoint
|
||||
|
||||
Read-only static recovery, 2026-10-25. Neutron.exe SHA-256:
|
||||
f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.
|
||||
Text/data VAs below map to file offsets VA-0x400000. The distinction between
|
||||
Jimmy's complete object and its interface at complete+C0 is essential here.
|
||||
|
||||
## Three separate pieces of state
|
||||
|
||||
| Complete-object fields | Recovered purpose | Evidence |
|
||||
| --- | --- | --- |
|
||||
|+724/+774|Current/requested STRT and secondary saved string|43B6A7..43B6E0, TSK writer460057..46006F|
|
||||
|+88C/+8F0|RETURN level filename and STRT strings|43B6F8..43B758, LOAD457FB9..45815C|
|
||||
|+9A8/+9AC/+9B0/+9B4|Saved departure root, fourth vector component; first three floats serialized as TSK StoredVector|43B7B1..43B7CC, writer46008B..4600B0, reader460B9E..460BBA|
|
||||
|+954|Suppress the matching STRT's initial trigger once|RETURN458014, STRT4427F2..44282A/442887..4428AD|
|
||||
|+9A5|Preserve saved departure root during RETURN staging and restore it on PostLoad|RETURN458028, transition43B78E..43B7CF, Jimmy423A90..423B24|
|
||||
|+1E38..+1E47 and+1E48|Independent Jimmy checkpoint root and level FourCC|42AF00..42AF4E and42AF50..42AFB7|
|
||||
|
||||
The earlier unknown TSK StoredVector can now be identified as the saved transition
|
||||
departure root. It is not Jimmy42AF00's+1E38 checkpoint and is not an arbitrary
|
||||
full save of the current player position. Existing wire names and layout remain
|
||||
unchanged; unknown values still round-trip without normalization.
|
||||
|
||||
## Ordinary departure captures the live root
|
||||
|
||||
Jimmy complete vtable4A3BDC+168 points to Player43B5A0. After staging all four
|
||||
level/start strings,43B78E checks byte[complete+9A5]. If zero,43B798..43B7A9 invokes
|
||||
the player interface's virtual310 root getter.43B7B1..43B7CC copies its16 bytes to
|
||||
complete+9A8. If9A5 is nonzero, the branch jumps directly to43B7CF and retains the
|
||||
previous root. The routine then schedules level loading through game virtual100
|
||||
at43B7E1..43B7F1. No yaw, camera or full physics state is captured by this block.
|
||||
|
||||
The practice Yes branch4046AF stages VR04/PHONEBOOTH with current level/STRT as
|
||||
return strings. The saved root must therefore be captured when accepting the
|
||||
practice transition, from the live player root at that point. Merely keeping
|
||||
the original STARTEXP coordinates cannot reproduce RETURN placement.
|
||||
|
||||
## RETURN preserves and restores that root
|
||||
|
||||
LOAD's RETURN branch calls Jimmy's gadget cleanup slot178 at457FF7, sets
|
||||
complete+954 to1 at458014 and complete+9A5 to1 at458028. It resolves the stored
|
||||
return strings and calls the same transition virtual168 at45815C. Since9A5 is
|
||||
already set,43B5A0 does not replace the lab's saved root with the tutorial exit.
|
||||
|
||||
Jimmy PostLoad first applies the requested STRT's authored position and rotation.
|
||||
At423A90 it tests interface+8E5 (=complete+9A5). When nonzero it clears the byte
|
||||
at423A9E, passes interface+8E8/8EC/8F0 (=complete+9A8/9AC/9B0) to the root setter
|
||||
virtual16C at423ABF, and updates the attached companion root at423AE3..423B1E.
|
||||
The pending return flag is consumed. The requested STRT's authored yaw remains;
|
||||
there is no separate saved departure yaw in this path.
|
||||
|
||||
The companion receives the **identical saved root**, with no added offset. At
|
||||
423AE3..423B09 the16-byte stack argument is copied directly from
|
||||
interface+8E8/+8EC/+8F0/+8F4. The receiver at[interface+95C] is Jimmy complete+A1C,
|
||||
the Goddard complete pointer created by423C98->41C810 and stored at423CAE.
|
||||
423B12 addsC0 and423B1E calls Goddard interface+168. Goddard's vtable49F480+168
|
||||
is471680, which forwards the XYZ components unchanged to virtual16C=471630,
|
||||
the ordinary root setter. No rotation is passed. Restore the available Goddard
|
||||
actor to the same saved root as Jimmy; let his own130*.3 support settle his Y
|
||||
afterward rather than adding a gstart/forward offset. Goddard follow-state4
|
||||
behavior remains independently incomplete.
|
||||
|
||||
STRT PostLoad compares its tag with player complete+724 and checks complete+954.
|
||||
When that flag is set,4427F2..44280D clears it without scheduling the initial
|
||||
trigger or clearing player control. Without the flag,442819 sets its deferred
|
||||
trigger byte and44282A clears control. The alternate no-valid-trigger path also
|
||||
clears954 at442887..4428A4. Returning to STARTEXP must suppress LABEXP entirely;
|
||||
fast-forwarding the intro would still execute its authored actor/task effects.
|
||||
|
||||
## Why the TSK vector is the same departure root
|
||||
|
||||
The writer45FEE0 finds JIM1 with474070 at460043. That lookup returns the animated
|
||||
interface, so its three float writes from+8E8/+8EC/+8F0 at46008B..4600B0 correspond
|
||||
to complete+9A8/+9AC/+9B0. The loader explicitly converts controlled interface to
|
||||
complete by subtractingC0 at460A79, reads three floats at460B6F..460B9C, and writes
|
||||
complete+9A8/+9AC/+9B0 at460BA3/460BAD/460BBA. This resolves the apparent different
|
||||
offsets on the two sides of the wire format.
|
||||
|
||||
The wire format does not serialize954/9A5. An explicit scan of the supplied EXE's
|
||||
9A5 and interface8E5 operands finds constructor reset4376C8, staging check43B78E,
|
||||
RETURN setter458028 and PostLoad test/clear423A90/423A9E. Direct TSK loader4603F0
|
||||
does not itself set the pending-return flag. The current fresh --load-save STRT
|
||||
spawn policy therefore stays separate from a live RETURN continuation; a stored
|
||||
nonzero vector alone must not force player placement or suppress scene triggers.
|
||||
Broader menu/load paths and original runtime comparison remain unverified.
|
||||
|
||||
## The independent pickup checkpoint remains separate
|
||||
|
||||
Jimmy complete vtable+1E8 points to42AF00. It captures the current game level
|
||||
FourCC at complete+1E48 and root at complete+1E38.42AF50 repeats that capture and
|
||||
calls an attached effect callback. The lab jet pack pickup invokes42AF00 before
|
||||
SCENE35->50 and opening practice. No consumer of those two capture fields has
|
||||
been established by this recovery. Their exact future use must not be invented
|
||||
from the name checkpoint or conflated with RETURN/TSK departure state.
|
||||
|
||||
## Implementation and tests
|
||||
|
||||
Game/RuntimeCheckpoint.Stage(storedRoot,currentRoot,returning) selects the live
|
||||
root for an ordinary departure and preserves the stored root for RETURN. Its
|
||||
Returning and ActivateStartTrigger flags describe only that transition; they are
|
||||
not serialized. Finite input checks reject invalid runtime state while preserving
|
||||
all finite original coordinates. Source consumers still own scene loading,
|
||||
root/companion placement and trigger scheduling.
|
||||
|
||||
```
|
||||
source scripts/env.sh
|
||||
dotnet run --project tests/GamePort.CheckpointTests -- ../Original
|
||||
```
|
||||
|
||||
The test checks decisive original instruction bytes/vtable addresses, independent
|
||||
checkpoint versus return offsets, a lab->serialized VR04->RETURN lifecycle, and
|
||||
all12 original TSK byte round-trips. Runtime integration now carries RETURN identity
|
||||
through SceneContinuation, captures live roots when requesting ordinary transitions
|
||||
and writes them into TSK snapshots. LabSimulation restores exact XYZ without floor
|
||||
snapping; SceneDirector suppresses the STRT trigger rather than fast-forwarding it.
|
||||
Goddard receives the same root with his rotation retained.
|
||||
|
||||
`dotnet run -- --headless --smoke-practice-return` exercises lab -> VR04 -> lab with
|
||||
three actual renderer initializations. It walks45 input steps before departure,
|
||||
then uses explicit source pickup/exit contacts (not a navigation replay). The saved
|
||||
departure differs from STARTEXP by more than100 horizontal units; RETURN must
|
||||
restore that exact root and the companion, retain yaw155 and have control with no
|
||||
active intro. These assertions occur before the returned scene's first physics
|
||||
tick, keeping placement distinct from support settling. Movement/director tests
|
||||
also check unsupported-root settling and one-time trigger suppression.
|
||||
Static recovery and managed/headless checks do not establish original or native
|
||||
Windows runtime fidelity. Complete companion follow-state behavior remains open.
|
||||
+6
-3
@@ -82,7 +82,9 @@ the argument addresses and literal targets are certain. Modal1/2/3 dispatch
|
||||
VR03/VR02/VR01 respectively, so type0 must not be routed toVR01.
|
||||
Runtime checkpoint42AF00 captures the current level code and a16-byte
|
||||
actor root into Jimmy+1E48/+1E38 separately. This does not prove the
|
||||
meaning of the saved TSK StoredVector or justify overwriting it.
|
||||
meaning of the saved TSK StoredVector by itself. Follow-up43B5A0/RETURN/TSK
|
||||
recovery proves that vector is the separate departure root at+9A8; see
|
||||
runtime-checkpoint.md for capture/restore and initial-trigger suppression.
|
||||
|
||||
No path404D1E hides practice elements, clears4F8198, disables cursor and
|
||||
unpauses main game virtual168(0); yes continues into the level transition.
|
||||
@@ -129,5 +131,6 @@ Follow-up field tracing confirms the meaning of the two staged return arguments:
|
||||
|
||||
Therefore source modal0 Yes preserves current `level1b.gam`/`STARTEXP` as the
|
||||
return pair for the normal NewGame route, while entering VR04/PHONEBOOTH.
|
||||
Its separately captured checkpoint root and unknown TSK StoredVector remain
|
||||
distinct evidence; a new PHONEBOOTH return marker must not be invented.
|
||||
Its separately captured pickup checkpoint root and TSK departure root remain
|
||||
distinct. RETURN restores the latter after applying the requested STRT yaw and
|
||||
suppresses that STRT's initial trigger; no new PHONEBOOTH marker is invented.
|
||||
@@ -0,0 +1,84 @@
|
||||
# Lab underground passage replay
|
||||
|
||||
2026-10-25. Deterministic managed integration using original LV1B source geometry,
|
||||
STRT, switches and bars. This is a port navigation check; no original executable
|
||||
was run and no original files were modified. Full collision/cadence fidelity and
|
||||
progression into this fixture are not established by this replay.
|
||||
|
||||
## Fixture and original records
|
||||
|
||||
The player begins at the original STRT `riverlab` at approximately
|
||||
(3785.4702,-1040.4089,-2597.4324), yaw0. SCENE65 is an explicit initial task fixture,
|
||||
assigned before constructing the director. It is not a recovered task award or a
|
||||
claim that the preceding port story already reaches65. NewGame supplies all other
|
||||
save values. The separate underground LOAD remains untouched; its SCENE65 gate
|
||||
and level1.gam/riverlab destination are recorded in lab-progression.md.
|
||||
|
||||
Original bar root is (3810.1970,-1076.0883,-1180.4956), duration5 seconds,
|
||||
OpenAmount500 and OpenTime3. Both distinct `C3DBUTTON` actors target these bars
|
||||
with Toggle-1. The higher/near-door switch is approximately
|
||||
(3401.5176,-987.4839,-1198.4617); the lower/river switch is
|
||||
(4059.9485,-1195.6429,-1921.8291). Source state machine addresses, sound lifetime,
|
||||
strict contact/timeout and duplicate-tag handling are in buttons-doors.md.
|
||||
|
||||
## Input route and assertions
|
||||
|
||||
`tests/GamePort.UndergroundRouteTests` uses the same live player/director/contact,
|
||||
mechanism, NPC patrol and dynamic-door collision consumers as the existing lab
|
||||
route. Only the initial authored STRT supplies the player position. Subsequent
|
||||
movement comes from `PlayerInput`; every step checks finite, continuous movement,
|
||||
control ownership and the absence of a positional warp.
|
||||
|
||||
The modern test follower walks to the lower switch, centers before the arched
|
||||
masonry, crosses the raised bars, approaches the upper switch, recenters and
|
||||
returns through the doorway. Heading tolerance6 degrees, waypoint arrival30
|
||||
units and90 release ticks between legs are test input choices, not original AI.
|
||||
A naive diagonal approach catches the actual arched entrance edge, so approaching
|
||||
the center before advancing is material to this navigation test.
|
||||
|
||||
Both switches must enter DOWN through real player contacts. The original bars
|
||||
must reach their full500-unit opening. At each of the two gate-plane crossings,
|
||||
the current source box's minimumY must exceed the live capsule's head, so the test
|
||||
cannot pass merely by walking through a still-obstructing moving gate. The live
|
||||
source-gated dynamic resolver runs on every player step. After returning,1200
|
||||
released ticks establish cooldown reset and timed closure. SCENE, score and
|
||||
transition destination must remain unchanged by this button route.
|
||||
|
||||
A separate negative query tests the reclosed gate using the replay's actual
|
||||
standing root height, with an80-unit sphere sweep from gateZ-100 to gateZ-20.
|
||||
It must enter the recovered dynamic broadphase and be blocked at gateZ-76 or
|
||||
farther away. This query never assigns or repositions the live player and is not
|
||||
represented as an extra input-navigation leg. The narrowphase remains the explicit
|
||||
modern adapter documented in dynamic-collision.md.
|
||||
|
||||
## Water collision defect exposed and corrected
|
||||
|
||||
Before the NC shape exclusion was implemented, the first simulation step raised
|
||||
the riverlab actor85.89 units from its real floor to the `ncwater` plane at
|
||||
Y-1006.045. Actor root then stood at about-930.095. Its146-unit vertical difference
|
||||
from the reclosed bar root exceeded the original normal-body broadphase limit140
|
||||
(2*doorRadius40 + JimmyRadius60), silently skipping closed-bar tests.
|
||||
|
||||
The original level loader excludes shapes whose names begin NC from terrain
|
||||
registration; it is not a generic water-material guess. The recovered rule is now
|
||||
consumed by both capsule terrain and source body support. See water-collision.md
|
||||
for binary addresses and direct source regressions. The route's first-step guard
|
||||
rejects that former rise. Corrected live root height stays near-1016, allowing the
|
||||
closed-gate negative query to exercise both source broadphase and provisional
|
||||
narrowphase. Full water/swimming gameplay remains a separate system.
|
||||
|
||||
## Verification
|
||||
|
||||
From GamePort:
|
||||
|
||||
```
|
||||
source scripts/env.sh
|
||||
dotnet run --project tests/GamePort.UndergroundRouteTests -- ../Original
|
||||
```
|
||||
|
||||
Pass recorded in artifacts/underground-route.log:2763 steps,4153.21 horizontal
|
||||
travel,0 jumps,3 small support landings,1.79 maximum rise,14 masonry wall hits,
|
||||
grounded final feet (3814.5361,-1092.0243,-2058.7490). Both gate crossings have
|
||||
clearance, both switches reset UP and the bars reclose. This establishes the
|
||||
managed port route from its explicit fixture, not a native-platform GPU test,
|
||||
whole-game progression or source-identical movement/response.
|
||||
@@ -0,0 +1,80 @@
|
||||
# NC shape collision registration
|
||||
|
||||
Static original EXE/OMT evidence, 2026-10-25. Original files were read only; no
|
||||
original instructions were executed. This corrects the earlier statement in
|
||||
original-collision.md that all 2,869 lab triangles reach static registration.
|
||||
The polygon registration function has no general decorative-material filter,
|
||||
but its caller omits entire shapes whose names begin with NC.
|
||||
|
||||
## Recovered call path
|
||||
|
||||
Addresses are preferred Neutron.exe VAs. For these `.text` addresses the file
|
||||
offset is VA minus 0x400000. EXE SHA-256:
|
||||
f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.
|
||||
|
||||
LV1B initialization calls game complete-object slot 0x158 at **0x44F569**.
|
||||
CLevel01BGame complete vtable **0x4C3CD0**, slot 0x158, resolves to **0x44DBF0**.
|
||||
That shared scene loader iterates original shape resources, using 0x477BA0
|
||||
(which explicitly requests `3DSh` at 0x477BC2) and the resource's shape name.
|
||||
Its string is derived from the shape's database metadata at 0x44DC65 onward.
|
||||
|
||||
For each terrain object, after assigning its source shape, it tests:
|
||||
|
||||
- 0x44DD27: lowercase the first name character with 0x47F9B9.
|
||||
- 0x44DD2F: compare against `n` (0x6E); other names take InitPhysics.
|
||||
- 0x44DD5C: lowercase the second name character.
|
||||
- 0x44DD64: compare against `c` (0x63).
|
||||
- **0x44DD67**: equality jumps to 0x44DD70, bypassing the InitPhysics call.
|
||||
- 0x44DD69..0x44DD6D: ordinary names call terrain interface slot **0x2C**.
|
||||
|
||||
C3DTerrain interface vtable **0x4D4CCC**, slot 0x2C, is **0x464B00**.
|
||||
That function reads the assigned shape and calls static registration **0x479140**
|
||||
at **0x464B18**. Omitting InitPhysics therefore excludes the whole NC shape
|
||||
from both static collision grids, including the support-ray grid.
|
||||
0x47F9B9 is the CRT lowercase routine; its default ASCII path maps A..Z by +32
|
||||
(0x47F9CC..0x47F9DE). The equivalent ASCII prefix rule is case-insensitive.
|
||||
|
||||
The other shared scene loaders retain the same gate: 0x44D4F0 checks at
|
||||
0x44D62F/0x44D664 and skips 0x44D66D; 0x44D810 checks at 0x44D94F/0x44D984
|
||||
and skips 0x44D98D. Rendering setup and material processing continue after the
|
||||
gate. This is a **shape-name rule**, not a material-name, visibility or alpha rule.
|
||||
Do not delete NC geometry from rendering or use a substring/material heuristic.
|
||||
|
||||
## Actual supplied geometry
|
||||
|
||||
| Archive | Shape ID/name | Payload file offset | Size | Excluded triangles |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| level1b.omt | 94 / ncwater | 353257 | 2162 | 18 |
|
||||
| level1.omt | 172 / ncwater | 1962491 | 2398 | 20 |
|
||||
| level1.omt | 174 / ncwater2 | 1163215 | 310 | 2 |
|
||||
| level1.omt | 178 / ncwater3 | 1111837 | 310 | 2 |
|
||||
|
||||
Lab source/draw geometry remains **2,869** triangles. Static registered geometry
|
||||
is **2,851**, including all **325 null-material triangles**. VR04 has no NC-named
|
||||
shapes. level1b.omt SHA-256 is
|
||||
5a33d11311fc222631eb8f7384d1863192cb1f55f7e67035caa0ae12fd9892ab;
|
||||
level1.omt SHA-256 is
|
||||
a1b525c433c613fc7e63b8fa69abb51a7a91565dce78970745afe158a05e7f6b.
|
||||
|
||||
Lab shape 94 includes the large horizontal surface at Y=-1006.0449829101562
|
||||
covering X=3342.3577..4225.8027 and Z=-3466.2422..2431.9878. Material 181 is
|
||||
also named ncwater, but that coincidence is not the source registration gate.
|
||||
Treating this shape as solid lets the provisional capsule overlap correction
|
||||
push the riverlab player up onto that water plane. Excluding its static collision
|
||||
has direct source support; the observed pop alone would not justify a filter.
|
||||
|
||||
## Reproduction and limits
|
||||
|
||||
Run `python3 tools/binary/water_collision_evidence.py` from GamePort for nine
|
||||
instruction-byte checks, two direct vtable checks and source geometry counts.
|
||||
`python3 -m unittest discover -s tests -p test_water_collision.py -v` passes both
|
||||
groups, including ASCII case variants, prefix versus substring and preservation
|
||||
of null-material lab proxies. Generated facts: artifacts/water-collision-evidence.json.
|
||||
|
||||
MeshPolygonSource now obtains shape names from prepared mesh records; its
|
||||
TerrainCollision flag filters both SceneCollision and OriginalScenePhysics support
|
||||
without changing source/render arrays. The managed underground replay verifies
|
||||
both open passage and a closed source-gated box query at the corrected root height.
|
||||
These facts establish source collision
|
||||
eligibility, not a complete original sphere solver, water hazard/swimming behavior,
|
||||
NPC phase order or original runtime comparison. Those remain separate work.
|
||||
+15
-2
@@ -97,8 +97,8 @@ snapshots live energy, tasks, inventory, objective selector and RETURN strings.
|
||||
PracticePrompt implements source strict Yes/No regions and keyboard dispatch;
|
||||
Program pauses simulation while modal, clears held input and rebuilds VR04 on Yes.
|
||||
SceneHud appends source640x480 screen quads; the Vulkan overlay pipeline disables
|
||||
depth and draws after world geometry using identity transforms. Panel slide timing,
|
||||
full HUD state and practice highlighting remain incomplete. Fixed-size authored art
|
||||
depth and draws after world geometry using identity transforms. Full HUD state
|
||||
and practice highlighting remain incomplete. Fixed-size authored art
|
||||
is scaled with the viewport; input uses matching logical-window coordinates.
|
||||
|
||||
Prepared effects/effects.json preserves251 original SoundEffects.omt identities
|
||||
@@ -135,3 +135,16 @@ hides the popup and No resets timing. UI clock remains explicit across control l
|
||||
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.
|
||||
|
||||
RuntimeCheckpoint stages the departure root independently of pickup42AF00's
|
||||
checkpoint. LevelTransition retains RETURN identity after resolving its filename.
|
||||
Program captures the live root when a normal transition is requested, preserves
|
||||
it for RETURN, carries the pending flag only in memory and stores the root in
|
||||
TSK StoredVector. Destination initialization retains STRT yaw, restores Jimmy
|
||||
and Goddard position and suppresses the initial trigger once. Fresh TSK loading
|
||||
does not imply pending RETURN. Full actor-state/camera/fade restoration is separate.
|
||||
|
||||
MeshPolygonSource obtains shape names from prepared mesh records. Its recovered
|
||||
NC-prefix terrain eligibility is consumed by SceneCollision and OriginalScenePhysics
|
||||
support/wall queries; rendering and raw source triangles remain unchanged. Other
|
||||
collision masks and the modern narrowphase remain explicit fidelity limits.
|
||||
+15
-5
@@ -27,9 +27,9 @@ 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 |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 |17 movement groups pass | Fixed60Hz independent of60/120/144Hz rendering, ten-minute finite run; original cadence unresolved |
|
||||
| Walking/jump/air controller |18 movement groups + GPU replay pass |Corrected mode1 fall-through to source air handler: acceleration/braking/turning during jumps and bursts; RETURN root placement; phase/collision/lean remain provisional |
|
||||
| Static source collision |11 deterministic groups + source NC byte checks pass |2851 lab collision triangles after excluding18 NC-shape triangles; all2869 render/source triangles and325 null-material proxies retained; solver/dimensions provisional |
|
||||
| Simulation cadence |18 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 | 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 |
|
||||
@@ -37,9 +37,10 @@ separate evidence categories. **The game is not fully reconstructed/playable yet
|
||||
| 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 |
|
||||
| RETURN / renderer recreation | Linux headless pass |Original VR01 RETURN dispatch renders VR01 thenLV1B, zero validation errors; fades/window transition unverified |
|
||||
| RETURN / renderer recreation |Source byte/helper/director tests + Linux headless pass |Lab/VR04/lab restores live departure root and companion, retains STRT yaw and suppresses intro once; fresh TSK loading separate; fades/window transition unverified |
|
||||
| Supplied scene availability |All35 GAMs supplied;33 have OMT geometry |Level3B/E GAMs are duplicate four-entity records apart from level code; registered OMT archives absent, normal gameplay use unverified; no substitution or established blocker |
|
||||
| Lab task/contact route | Managed input replay + headless GPU pass |914 input-only movement steps with live contacts/NPC updates reachSCENE60, score150, jetpack andlevel1; separate direct-contact GPU rebuild check |
|
||||
| Lab task/contact route | Managed input replay + headless GPU pass |887 input-only movement steps with live contacts/NPC updates reachSCENE60, score150, jetpack andlevel1; separate direct-contact GPU rebuild check |
|
||||
| Lab underground passage |2763-step managed input replay pass |Both switches,2 clear crossings and timed reclosure; closed-gate negative sweep; explicit riverlab/SCENE65 fixture, prior progression and original comparison unverified |
|
||||
| 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 |
|
||||
@@ -67,6 +68,15 @@ 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.
|
||||
|
||||
Subsequent RETURN/underground checkpoint: artifacts/return-underground-tests.log
|
||||
passes the complete suite (41 Python checks,18 movement groups, source checkpoint
|
||||
checks, actual lab/VR04/lab rendering, underground input replay and539 unchanged
|
||||
originals). RETURN restores the exact departure root and companion, retains STRT
|
||||
yaw and suppresses intro, with zero Vulkan validation errors. NC registration
|
||||
exclusion fixes the underground water-plane rise while retaining rendering.
|
||||
Both Linux x64 and Windows x64 self-contained executables republish successfully.
|
||||
No subsequent native Windows/Wine runtime check is claimed.
|
||||
|
||||
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,
|
||||
|
||||
+11
-1
@@ -55,7 +55,8 @@
|
||||
13. **Correct prototype names from original evidence.** The pickup tagged SHRINKRAY
|
||||
is the jet pack in original objective art and inventory slot0/3 code. Practice0
|
||||
entersVR04/PHONEBOOTH with current GAM/STRT return context. Do not invent a
|
||||
shrink-ray weapon, VR01 mapping or TSK StoredVector checkpoint meaning.
|
||||
shrink-ray weapon or VR01 mapping. Later recovery identifies TSK StoredVector
|
||||
as the separate transition departure root; see decision17.
|
||||
14. **Compose original UI and effect assets.** Draw source640x480 UI in a separate
|
||||
depth-disabled overlay; retain clipped original coordinates. Use exact default
|
||||
SoundEffects.omt identities for lab effects, preserve encoded RIFF resources
|
||||
@@ -69,3 +70,12 @@
|
||||
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.
|
||||
17. **Keep transition restoration separate from pickup checkpoints.** Source
|
||||
RETURN flags preserve the departure root at+9A8, restore player/companion
|
||||
position and suppress STRT once. Serialize only the proven root in StoredVector;
|
||||
carry pending RETURN in memory. Retain authored STRT yaw and ordinary fresh-save
|
||||
spawning. Pickup42AF00's+1E38/+1E48 is a different, still-unconsumed capture.
|
||||
18. **Apply terrain eligibility at shape registration.** Source level loaders skip
|
||||
NC-prefixed shape names. Use prepared shape metadata for player and actor
|
||||
terrain queries; retain rendered geometry and null-material proxies. Do not
|
||||
infer a generic water-material rule or full water gameplay from this finding.
|
||||
+41
-8
@@ -4,7 +4,40 @@
|
||||
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
|
||||
## RETURN placement and underground passage
|
||||
|
||||
Recovered and integrated the next lab checkpoint:
|
||||
|
||||
- TSK StoredVector is the departure root at Jimmy+9A8. Ordinary transitions
|
||||
capture the live root; RETURN preserves it, restores Jimmy and Goddard to it,
|
||||
retains destination STRT yaw and suppresses the initial STRT trigger once.
|
||||
Fresh TSK loading does not imply pending RETURN. Pickup42AF00's separate
|
||||
+1E38/+1E48 checkpoint remains unconsumed rather than being conflated with it.
|
||||
- Original shared level loaders omit NC-prefixed SHAPE names from terrain
|
||||
registration. Both player terrain and source actor support now use that rule.
|
||||
All2869 lab render/source triangles remain;2851 are collision-eligible, including
|
||||
all325 null-material proxy triangles. No material-name water filter was added.
|
||||
- The underground replay starts at the original riverlab STRT with explicit
|
||||
SCENE65 fixture, then uses only live movement/contacts. It operates both switches,
|
||||
crosses fully clear bars twice, waits for reclosure and checks the closed box
|
||||
blocks a source-gated negative sweep.2763 steps,4153.21 travel, no jumps/warps.
|
||||
The former85.89-unit first-step rise onto decorative water is now rejected.
|
||||
|
||||
The headless lab -> VR04 -> lab RETURN check restores the actual departure root
|
||||
(4921.8735,76.49398,502.37677), separate from STARTEXP, with no intro playback.
|
||||
Complete scripts/test.sh passes:41 Python checks,18 movement groups,11 collision
|
||||
groups, four source/checkpoint groups, director/route/underground regressions,
|
||||
headless Vulkan scene/RETURN checks, audio lifecycle and539 unchanged hashes.
|
||||
Evidence: artifacts/return-underground-tests.log. The three-scene RETURN check
|
||||
includes exact companion placement and reports zero Vulkan validation errors.
|
||||
Both self-contained executables are republished successfully; no new Wine/native Windows
|
||||
runtime check is claimed, following the user's preference to skip that check.
|
||||
Reports: analysis/runtime-checkpoint.md, water-collision.md, underground-route.md.
|
||||
The underground fixture does not establish progression into SCENE65; full water
|
||||
hazards, Goddard follow/support phase, fades and original runtime comparison remain
|
||||
incomplete. Native Windows testing of these new changes is not agent-verified.
|
||||
|
||||
## User-reported lab regressions (preceding milestone ca08c46)
|
||||
|
||||
The user confirms lab -> tutorial -> lab -> outside is reachable. Four follow-up
|
||||
bugs are now implemented with source evidence and targeted regressions:
|
||||
@@ -66,8 +99,8 @@ report and exact static rules support this fix.
|
||||
|
||||
An additional managed replay now walks through explanation, jet pack, Carl and
|
||||
outside LOAD using only movement inputs, source live contacts and NPC patrol/body
|
||||
updates. It reachesSCENE60/score150 with jet pack owned after914 movement steps
|
||||
and7038.29 travel with corrected airborne input; the player is never repositioned. This strengthens port lab
|
||||
updates. The current replay reachesSCENE60/score150 with jet pack owned after887 movement steps
|
||||
and7078.63 travel; the player is never repositioned. This strengthens port lab
|
||||
navigation coverage without proving original collision/cadence fidelity.
|
||||
|
||||
## Current integrated behavior
|
||||
@@ -91,8 +124,8 @@ navigation coverage without proving original collision/cadence fidelity.
|
||||
- Original objective pad, three lab objective images, digits and PracticeYesNo
|
||||
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.
|
||||
Return context is current GAM/latest STRT (LV1B/STARTEXP for NewGame).
|
||||
RETURN restores the saved departure root; the pickup checkpoint is separate.
|
||||
- Button contact/cooldown/down/up/next-trigger and vertical-door duration,
|
||||
reversal/hold/next-trigger logic. Source dynamic-box broadphase/triangle ordering
|
||||
is translated; narrowphase/response still uses a modern approximation.
|
||||
@@ -159,9 +192,9 @@ No usable original gameplay reference has been captured: isolated Wine GL/Vulkan
|
||||
attempts fail rendering. Continue static recovery and isolated DLL probes locally;
|
||||
comparison on a working original installation remains required for fidelity.
|
||||
|
||||
Next priorities are lab navigation/door collision and checkpoint return-position
|
||||
fidelity; original collision47BD80/479D20 and phase/cadence; audio-bank/SFX mapping;
|
||||
UI slide/highlights/energy gauges; actor sensing/animation completion. Then expand
|
||||
Next priorities are progression from outside into later lab task states;
|
||||
original collision47BD80/479D20 and phase/cadence; audio-bank/SFX mapping;
|
||||
practice highlights/energy gauges; actor sensing/animation completion. Then expand
|
||||
remaining gadgets, damage/combat/enemies, menus/configuration, full saves and all
|
||||
level progression. Lighting/fog/blend/culling and sprite/pivot fidelity are open.
|
||||
Do not claim complete gameplay based on direct-contact route or GPU smoke tests.
|
||||
|
||||
@@ -51,6 +51,11 @@ the older preliminary movement interpretations.
|
||||
|
||||
## Unresolved
|
||||
|
||||
Follow-up evidence: `analysis/runtime-checkpoint.md` identifies TSK StoredVector,
|
||||
RETURN placement and one-time STRT suppression; `analysis/water-collision.md`
|
||||
recovers the NC shape registration gate; `analysis/underground-route.md` records
|
||||
input-only passage coverage with an explicit riverlab/SCENE65 fixture.
|
||||
|
||||
Original execution under isolated Wine/Windows; complete gameplay algorithms;
|
||||
remaining actor animations and render states; full runtime save state; exact historical timing and
|
||||
Windows runtime compatibility. Follow `tasks.md` for concrete next actions.
|
||||
+7
-1
@@ -20,11 +20,17 @@ support these field sizes/order. Reader calls at`0x4605A8–0x460633`,
|
||||
|18|4200 int32|Global0x4F8438..0x4FC5D8; acquired-item slots referenced by pickup code|
|
||||
|16818|29 int32|One int at each8-byte record from0x4F7DB8..0x4F7EA0; semantics pending|
|
||||
|16934|4 Pascal strings|Startpoint, reserved name, return level, return start|
|
||||
|after strings|3 float32|Stored vector; exact meaning unresolved, not assumed player position|
|
||||
|after strings|3 float32|Transition departure root at Jimmy complete+9A8; captured on ordinary departure, preserved/restored by RETURN|
|
||||
|after vector|19 int32|9 group0 and10 group1 inventory states; source getters sign-extend shorts|
|
||||
|after inventory|int32 count|Task entry count|
|
||||
|per task|Pascal string +int32|Task name and state, in original order|
|
||||
|
||||
The vector identity is established by writer46008B..4600B0 and reader460B9E..460BBA,
|
||||
which access complete+9A8 (interface+8E8). It is separate from pickup42AF00's
|
||||
complete+1E38 checkpoint. Pending RETURN flags are not serialized; fresh save
|
||||
loading still selects its STRT. See analysis/runtime-checkpoint.md for the source
|
||||
capture, one-time position restoration and start-trigger suppression rules.
|
||||
|
||||
No version tag/checksum was found in this supplied format. Unknown tables/fields
|
||||
and unusual existing inventory values are preserved. Several old saves contain
|
||||
large or negative inventory states; normalizing them to booleans would break
|
||||
|
||||
+9
-5
@@ -26,19 +26,23 @@ compile, runtime and original-fidelity verification are separate.
|
||||
- [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.
|
||||
- [x] Source RETURN departure-root/TSK identity, player/companion restoration and
|
||||
one-time STRT suppression; source NC-shape terrain exclusion; input-only
|
||||
underground passage both ways from explicit riverlab/SCENE65 fixture.
|
||||
|
||||
## Immediate continuation
|
||||
|
||||
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.
|
||||
original physics/audio/UI recovery and progression beyond the outside checkpoint.
|
||||
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. 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.
|
||||
replay. User confirms lab/tutorial/lab/outside is reachable. Underground passage
|
||||
now passes from explicit riverlab/SCENE65 fixture; recover actual progression
|
||||
into that task state and extend input coverage to later scenes. RETURN uses
|
||||
the recovered TSK departure root. Find consumers of independent42AF00
|
||||
+1E38/+1E48 checkpoint separately; do not conflate the two again.
|
||||
3. Recover47BD80 collision response/479D20 movement phase and source object exclusions.
|
||||
Support trace/magnitude/radii/factors and dynamic broadphase are recovered;
|
||||
wall response, Jimmy capsule/visual pivot, stairs and camera obstruction remain
|
||||
|
||||
@@ -54,6 +54,7 @@ its actions and restores control. --skip-intro starts with control; --mute disab
|
||||
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.
|
||||
Tutorial RETURN restores the departure position and suppresses the lab intro.
|
||||
|
||||
Original actor/model/sprite props, common patrol, buttons/moving bars, lab task
|
||||
route, objectives, practice flow and checkpoint CLI are integrated. Collision,
|
||||
|
||||
@@ -10,7 +10,9 @@ dotnet run --project tests/GamePort.DirectorTests -- ../Original
|
||||
dotnet run --project tests/GamePort.PatrolTests -- ../Original
|
||||
dotnet run --project tests/GamePort.SupportTests -- ../Original
|
||||
dotnet run --project tests/GamePort.InteractionTests -- ../Original
|
||||
dotnet run --project tests/GamePort.CheckpointTests -- ../Original
|
||||
dotnet run --project tests/GamePort.LabRouteTests -- ../Original
|
||||
dotnet run --project tests/GamePort.UndergroundRouteTests -- ../Original
|
||||
dotnet run --project tests/GamePort.DynamicCollisionTests -- ../Original
|
||||
dotnet run --project tests/GamePort.JetpackTests
|
||||
dotnet run --project tests/GamePort.ObjectiveTests -- ../Original
|
||||
@@ -26,6 +28,7 @@ dotnet run --no-build -- --headless --smoke-walk --screenshot artifacts/test-wal
|
||||
dotnet run --no-build -- --headless --story --story-time 12 --screenshot artifacts/test-story.ppm
|
||||
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 --smoke-practice-return --screenshot artifacts/test-practice-return.ppm
|
||||
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
|
||||
|
||||
@@ -39,11 +39,23 @@ public sealed record Mesh(MeshVertex[] Vertices, uint[] Indices)
|
||||
var indices = root.GetProperty("indices").EnumerateArray().Select(p => p.GetUInt32()).ToArray();
|
||||
if (indices.Length % 3 != 0 || indices.Any(i => i >= vertices.Length)) throw new InvalidDataException("Invalid scene triangle indices.");
|
||||
if (vertices.Length == 0 || indices.Length == 0) throw new InvalidDataException("Empty scene mesh.");
|
||||
// Level loaders omit NC-prefixed SHAPE names from terrain registration
|
||||
// (LV1B44DD2F..44DD70). Material names and draw visibility are separate.
|
||||
var shapeNames = new Dictionary<int, string>();
|
||||
if (root.TryGetProperty("meshes", out var shapeMeshes))
|
||||
foreach (var shape in shapeMeshes.EnumerateArray())
|
||||
{
|
||||
if (!shape.TryGetProperty("shapeId", out var id) || !shape.TryGetProperty("name", out var name)) continue;
|
||||
var text = name.GetString() ?? "";
|
||||
if (shapeNames.TryGetValue(id.GetInt32(), out var existing) && existing != text)
|
||||
throw new InvalidDataException("Conflicting source shape names");
|
||||
shapeNames[id.GetInt32()] = text;
|
||||
}
|
||||
var collisionPolygons = root.TryGetProperty("collisionPolygons", out var polygonList)
|
||||
? polygonList.EnumerateArray().Select(p => new MeshPolygonSource(p.GetProperty("shapeId").GetInt32(),
|
||||
p.GetProperty("polygonIndex").GetInt32(),
|
||||
new Vector3(p.GetProperty("normal")[0].GetSingle(), p.GetProperty("normal")[1].GetSingle(), p.GetProperty("normal")[2].GetSingle()),
|
||||
p.GetProperty("materialName").GetString())).ToArray() : [];
|
||||
p.GetProperty("materialName").GetString(), shapeNames.GetValueOrDefault(p.GetProperty("shapeId").GetInt32()))).ToArray() : [];
|
||||
if (collisionPolygons.Length != 0 && (collisionPolygons.Length != indices.Length / 3
|
||||
|| collisionPolygons.Any(p => !float.IsFinite(p.Normal.X + p.Normal.Y + p.Normal.Z))))
|
||||
throw new InvalidDataException("Invalid source collision polygon metadata");
|
||||
@@ -84,7 +96,10 @@ public sealed record Mesh(MeshVertex[] Vertices, uint[] Indices)
|
||||
}
|
||||
}
|
||||
|
||||
public readonly record struct MeshPolygonSource(int ShapeId, int PolygonIndex, Vector3 Normal, string? MaterialName);
|
||||
public readonly record struct MeshPolygonSource(int ShapeId, int PolygonIndex, Vector3 Normal, string? MaterialName, string? ShapeName = null)
|
||||
{
|
||||
public bool TerrainCollision => ShapeName?.StartsWith("nc", StringComparison.OrdinalIgnoreCase) != true;
|
||||
}
|
||||
|
||||
public sealed record MeshDraw(uint FirstIndex,uint IndexCount,int TextureId)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace GamePort.Assets;
|
||||
|
||||
public sealed record SavedTask(string Name, int State);
|
||||
|
||||
/// <summary>Original TSK wire layout recovered at EXE0x45FEE0/0x4603F0; unknown fields retained.</summary>
|
||||
/// <summary>Original TSK wire layout at EXE0x45FEE0/0x4603F0; unknown fields retained.
|
||||
/// StoredVector is the transition departure root, not Jimmy42AF00's separate checkpoint.</summary>
|
||||
public sealed record OriginalSave(string LevelCode, float PlayerValue, short Counter,
|
||||
int Score, int OtherCounter, int[] ItemStates, int[] LevelCounters,
|
||||
string StartPoint, string ReservedName, string ReturnLevel, string ReturnStart,
|
||||
|
||||
@@ -85,6 +85,16 @@ public sealed class LabSimulation
|
||||
CameraEye = DesiredEye();
|
||||
}
|
||||
|
||||
/// <summary>Jimmy PostLoad423A90..423ABF restores the saved RETURN root.
|
||||
/// Yaw remains the authored STRT yaw; the source stores only XYZ here.</summary>
|
||||
public void RestoreReturnRoot(Vector3 root)
|
||||
{
|
||||
if (!float.IsFinite(root.X) || !float.IsFinite(root.Y) || !float.IsFinite(root.Z))
|
||||
throw new ArgumentOutOfRangeException(nameof(root));
|
||||
Position = root - Vector3.UnitY * rootHeight;
|
||||
CameraEye = DesiredEye();
|
||||
}
|
||||
|
||||
// EXE 0x47F940 truncates, then degree lookup masks to the 16384-entry table.
|
||||
// Table generated with modern trig; x87 bit-identical table recovery is pending.
|
||||
public static (float Sin, float Cos) Trig(float degrees)
|
||||
|
||||
@@ -19,7 +19,7 @@ public sealed class OriginalScenePhysics
|
||||
throw new InvalidDataException("Prepare source collision polygon metadata before original root support");
|
||||
walls = new SceneCollision(world, wallsAndCeilingsOnly: true);
|
||||
support = Enumerable.Range(0, world.Indices.Length / 3)
|
||||
.Where(i => !Checkpoint(world.CollisionPolygons[i].MaterialName))
|
||||
.Where(i => world.CollisionPolygons[i].TerrainCollision && !Checkpoint(world.CollisionPolygons[i].MaterialName))
|
||||
.Select(i => new SupportTriangle(world.Vertices[world.Indices[i * 3]].Position,
|
||||
world.Vertices[world.Indices[i * 3 + 1]].Position, world.Vertices[world.Indices[i * 3 + 2]].Position,
|
||||
world.CollisionPolygons[i].ShapeId, world.CollisionPolygons[i].PolygonIndex)).ToArray();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>
|
||||
/// Player43B5A0 stages a level transition. Ordinary departure captures the current
|
||||
/// root at complete+9A8; RETURN preserves it using complete+9A5. PostLoad restores
|
||||
/// that root and STRT suppresses its initial trigger using the separate+954 flag.
|
||||
/// This is distinct from Jimmy42AF00's currently unconsumed+1E38 checkpoint.
|
||||
/// </summary>
|
||||
public sealed class RuntimeCheckpoint
|
||||
{
|
||||
public Vector3 Root { get; }
|
||||
public bool Returning { get; }
|
||||
public bool ActivateStartTrigger => !Returning;
|
||||
|
||||
private RuntimeCheckpoint(Vector3 root, bool returning)
|
||||
{
|
||||
Root = root;
|
||||
Returning = returning;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only RETURN restores a root on scene entry. No rotation is captured here;
|
||||
/// the destination STRT remains the source of authored spawn rotation.
|
||||
/// Root is the same vector serialized in OriginalSave.StoredVector.
|
||||
/// </summary>
|
||||
public static RuntimeCheckpoint Stage(Vector3 storedRoot, Vector3 currentRoot, bool returning)
|
||||
{
|
||||
Validate(storedRoot, nameof(storedRoot));
|
||||
Validate(currentRoot, nameof(currentRoot));
|
||||
return new(returning ? storedRoot : currentRoot, returning);
|
||||
}
|
||||
|
||||
private static void Validate(Vector3 root, string name)
|
||||
{
|
||||
if (!float.IsFinite(root.X) || !float.IsFinite(root.Y) || !float.IsFinite(root.Z))
|
||||
throw new ArgumentOutOfRangeException(name, "Transition roots must be finite");
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ namespace GamePort.Game;
|
||||
|
||||
/// <summary>
|
||||
/// Provisional geometric reconstruction for the controllable-scene checkpoint.
|
||||
/// Uses source triangles, including invisible proxies, without claiming the
|
||||
/// original game's unrecovered collision-mask/state rules or solver tolerances.
|
||||
/// Uses source terrain-eligible triangles, including invisible proxies. NC shape
|
||||
/// exclusion is recovered; remaining masks/state rules and solver are provisional.
|
||||
/// Positions are the bottom of a vertical capsule in original Y-up world units.
|
||||
/// </summary>
|
||||
public sealed class SceneCollision
|
||||
@@ -35,6 +35,8 @@ public sealed class SceneCollision
|
||||
// proxies remain present and block movement in this provisional policy.
|
||||
for (var i = 0; i < mesh.Indices.Length; i += 3)
|
||||
{
|
||||
if (mesh.CollisionPolygons.Length == mesh.Indices.Length / 3
|
||||
&& !mesh.CollisionPolygons[i / 3].TerrainCollision) continue;
|
||||
// EXE4798B3 registers only stored normal.Y<.7 in the wall/ceiling
|
||||
// grid. Render normals and a recomputed cross product differ.
|
||||
if (wallsAndCeilingsOnly && mesh.CollisionPolygons[i / 3].Normal.Y >= .7f) continue;
|
||||
|
||||
@@ -113,7 +113,7 @@ public sealed class SceneDirector
|
||||
tasks.Assigned += OnTaskAssigned;
|
||||
}
|
||||
|
||||
public void Begin(GamEntity start)
|
||||
public void Begin(GamEntity start, bool activateStartTrigger = true)
|
||||
{
|
||||
if (start.Kind != "STRT") throw new ArgumentException("Expected original STRT entity", nameof(start));
|
||||
shot = null; pending.Clear(); activations.Clear();
|
||||
@@ -131,7 +131,9 @@ public sealed class SceneDirector
|
||||
actor.SpritePlaying = initial.SpritePlaying; actor.SpriteRevision++;
|
||||
ApplyTask(actor, tasks.Get(source.Text("TaskName")));
|
||||
}
|
||||
var trigger = start.Text("StartTrigger");
|
||||
// RETURN sets Jimmy+954; STRT4427F2..44282A consumes that flag and
|
||||
// suppresses its trigger once. Do not fast-forward the trigger's actions.
|
||||
var trigger = activateStartTrigger ? start.Text("StartTrigger") : null;
|
||||
ControlledTag = IsNone(trigger) ? level.Player?.Tag : null; // EXE4426B7.
|
||||
if (!IsNone(trigger)) Trigger(trigger!, start.Tag);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using GamePort.Assets;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
public sealed record LevelTransition(string LevelFile, string StartPoint, float FadeTime, int FadeType);
|
||||
public sealed record LevelTransition(string LevelFile, string StartPoint, float FadeTime, int FadeType, bool Returning = false);
|
||||
|
||||
/// <summary>
|
||||
/// Recovered star/trophy/lab jetpack contacts, Carl talk dispatch and LOAD gates. Uses source root spheres
|
||||
@@ -122,11 +122,12 @@ public sealed class SceneInteractions
|
||||
if (!TaskActivation.Load(source, tasks)) break;
|
||||
var destination = source.Text("LevelName") ?? "none";
|
||||
var start = source.Text("StartPoint") ?? "none";
|
||||
if (string.Equals(destination, "RETURN", StringComparison.OrdinalIgnoreCase))
|
||||
var returning = string.Equals(destination, "RETURN", StringComparison.OrdinalIgnoreCase);
|
||||
if (returning)
|
||||
{ destination = ReturnLevel; start = ReturnStart; }
|
||||
if (string.Equals(destination, "none", StringComparison.OrdinalIgnoreCase))
|
||||
{ unsupported.Add("RETURN has no stored destination"); break; }
|
||||
Transition?.Invoke(new(destination, start, source.Number("FadeTime"), source.Integer("FadeType")));
|
||||
Transition?.Invoke(new(destination, start, source.Number("FadeTime"), source.Integer("FadeType"), returning));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+56
-14
@@ -16,11 +16,12 @@ internal static class Program
|
||||
try
|
||||
{
|
||||
OriginalSave? carriedSave = null;
|
||||
var returning = false;
|
||||
while (true)
|
||||
{
|
||||
var result = Run(args, carriedSave, out var continuation);
|
||||
var result = Run(args, carriedSave, returning, out var continuation);
|
||||
if (result != 0 || continuation == null) return result;
|
||||
args = continuation.Args; carriedSave = continuation.Save;
|
||||
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
||||
}
|
||||
}
|
||||
catch (Exception error) { Console.Error.WriteLine(error); return 1; }
|
||||
@@ -35,9 +36,9 @@ internal static class Program
|
||||
return args[i + 1];
|
||||
}
|
||||
|
||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save);
|
||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning);
|
||||
|
||||
private static int Run(string[] args, OriginalSave? carriedSave, out SceneContinuation? continuation)
|
||||
private static int Run(string[] args, OriginalSave? carriedSave, bool returning, out SceneContinuation? continuation)
|
||||
{
|
||||
continuation = null;
|
||||
if (args.Contains("--help"))
|
||||
@@ -75,6 +76,7 @@ internal static class Program
|
||||
--smoke-lab-route Headless source lab contact route / next-scene rebuild
|
||||
--smoke-practice-prompt Headless original jet pack practice prompt
|
||||
--smoke-practice-transition Headless lab-to-VR04 practice transition
|
||||
--smoke-practice-return Headless lab/VR04/RETURN root and intro-suppression check
|
||||
--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
|
||||
@@ -225,11 +227,12 @@ internal static class Program
|
||||
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");
|
||||
var practiceReturnSmoke = args.Contains("--smoke-practice-return");
|
||||
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 || carlSmoke || objectiveSmoke;
|
||||
|| args.Contains("--skip-intro") || jetpackSmoke || practiceWindowSmoke || practiceReturnSmoke || 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.");
|
||||
@@ -255,6 +258,15 @@ internal static class Program
|
||||
ObjectivePanel? objectivePanel = null;
|
||||
var patrols = new Dictionary<string, ActorPatrol>(StringComparer.OrdinalIgnoreCase);
|
||||
LevelTransition? transitionRequest = null;
|
||||
Vector3 returnRoot = loadedSave?.StoredVector ?? Vector3.Zero;
|
||||
void RequestTransition(LevelTransition request)
|
||||
{
|
||||
if (transitionRequest != null) return;
|
||||
//43B5A0 captures live root for ordinary outbound transitions;
|
||||
//RETURN preserves it for the destination PostLoad restore.
|
||||
returnRoot = RuntimeCheckpoint.Stage(returnRoot, simulation!.ActorRoot, request.Returning).Root;
|
||||
transitionRequest = request;
|
||||
}
|
||||
var characterOffset = mesh.Vertices.Length;
|
||||
var characterModel = Matrix4x4.Identity;
|
||||
if (animationPath != null)
|
||||
@@ -265,6 +277,7 @@ internal static class Program
|
||||
var standingPose = AseMesh.Load(AssetPath.Resolve(root, "ASE/jimstop.ase"));
|
||||
if (walking) simulation = new LabSimulation(new SceneCollision(mesh), standingPose, originalStart.Position, originalStart.Rotation.Y)
|
||||
{ LevelCode = level!.Code };
|
||||
if (walking && returning) simulation!.RestoreReturnRoot(returnRoot);
|
||||
var placement = PreviewCharacterPlacement.Create(mesh, standingPose, originalStart.Position, originalStart.Rotation.Y);
|
||||
characterModel = placement.Model;
|
||||
mesh = animations.Current.AppendTo(mesh);
|
||||
@@ -278,6 +291,7 @@ internal static class Program
|
||||
resources = new PreparedEntityResources(Path.Combine(Path.GetDirectoryName(scene!)!, "entities/entities.json"),
|
||||
Path.Combine(Path.GetDirectoryName(scene!)!, "../effects/effects.json"));
|
||||
var save = loadedSave ?? OriginalSave.Load(AssetPath.Resolve(root, "NewGame.tsk"));
|
||||
returnRoot = save.StoredVector;
|
||||
var tasks = new TaskStates(save.Tasks);
|
||||
director = new SceneDirector(level!, tasks, resources.Duration);
|
||||
interactions = new SceneInteractions(director, tasks, save, level!.Code);
|
||||
@@ -286,15 +300,14 @@ internal static class Program
|
||||
simulation!.Energy = interactions.Energy;
|
||||
simulation.JetpackInventoryState = () => interactions.Inventory.State(0, 3);
|
||||
mechanisms = new SceneMechanisms(director);
|
||||
interactions.Transition += request => transitionRequest ??= request;
|
||||
interactions.Transition += RequestTransition;
|
||||
interactions.PracticeRequested += practice.Show;
|
||||
practice.Chosen += (mode, accepted) =>
|
||||
{
|
||||
if (!accepted) { objectivePanel.Show(); return; }
|
||||
// Player43B5A0 receives current/requested GAM and latest STRT tag
|
||||
// as return context;42AF00's runtime checkpoint is separate.
|
||||
// Player43B5A0 captures root separately from42AF00's pickup checkpoint.
|
||||
interactions.SetReturnContext(Path.GetFileName(levelPath!), originalStart!.Tag!);
|
||||
transitionRequest ??= new(PracticePrompt.Destination(mode), "PHONEBOOTH", 0, -1);
|
||||
RequestTransition(new(PracticePrompt.Destination(mode), "PHONEBOOTH", 0, -1));
|
||||
};
|
||||
interactions.Collected += (entity, points) => Console.WriteLine($"Collected {entity.Tag}: +{points}; score={interactions.Score}.");
|
||||
foreach (var actor in director.Actors.Where(a => a.Kind is "3DOG" or "3CAR"))
|
||||
@@ -332,6 +345,8 @@ internal static class Program
|
||||
var fixedTimeText = Option(args, "--time");
|
||||
double? fixedTime = fixedTimeText == null ? null : double.Parse(fixedTimeText, System.Globalization.CultureInfo.InvariantCulture);
|
||||
var headless = args.Contains("--headless");
|
||||
if (practiceReturnSmoke && (!headless || level?.Code is not ("LV1B" or "VR04") || carriedSave == null && loadedSave != null))
|
||||
throw new ArgumentException("Practice RETURN check requires a fresh headless lab or its carried tutorial/return");
|
||||
if (args.Contains("--smoke-transition") && (!headless || level?.Code is not ("VR01" or "VR04") || interactions == null))
|
||||
throw new ArgumentException("Transition smoke requires headless story playback of VR01 or VR04.");
|
||||
if (args.Contains("--smoke-lab-route") && (!headless || level?.Code != "LV1B" || interactions == null || loadedSave != null))
|
||||
@@ -379,11 +394,29 @@ internal static class Program
|
||||
mechanisms.StopSound += actor => sceneAudio.StopLoop(actor.Tag);
|
||||
sceneAudio.Music(originalStart!.Text("MusicDatabase") ?? "none", originalStart.Integer("MusicIndex", -1));
|
||||
}
|
||||
director.Begin(originalStart!);
|
||||
director.Begin(originalStart!, activateStartTrigger: !returning);
|
||||
interactions!.Reset();
|
||||
mechanisms!.Reset();
|
||||
director.SyncActor(level!.Player!.Tag!, simulation!.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
if (returning && director.FindActor("C3DGODDARD") is { } companion)
|
||||
director.SyncActor(companion.Tag, returnRoot, companion.Rotation); //423AE3..423B1E, no offset.
|
||||
if (practiceReturnSmoke && returning)
|
||||
{
|
||||
var restored = director.Controlled && !director.Playing && director.CurrentTag == null
|
||||
&& Vector3.Distance(simulation.ActorRoot, returnRoot) < .001f
|
||||
&& Vector2.Distance(new(returnRoot.X, returnRoot.Z), new(originalStart!.Position.X, originalStart.Position.Z)) > 100;
|
||||
var companionRestored = director.FindActor("C3DGODDARD")?.Position == returnRoot;
|
||||
restored &= companionRestored;
|
||||
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}.");
|
||||
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
||||
}
|
||||
if (args.Contains("--skip-intro") || jetpackSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||
if (practiceReturnSmoke && level.Code == "VR04")
|
||||
{
|
||||
director.Skip();
|
||||
interactions!.Update(level.Entities.First(e => e.Kind == "LOAD").Position);
|
||||
if (transitionRequest is not { Returning: true }) throw new InvalidOperationException("VR04 exit did not preserve RETURN identity");
|
||||
}
|
||||
if (args.Contains("--smoke-transition"))
|
||||
{
|
||||
director.Skip();
|
||||
@@ -405,15 +438,23 @@ internal static class Program
|
||||
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 (args.Contains("--smoke-practice-prompt") || args.Contains("--smoke-practice-transition") || practiceWindowSmoke
|
||||
|| practiceReturnSmoke && level.Code == "LV1B" && !returning)
|
||||
{
|
||||
if ((!headless && !practiceWindowSmoke) || level?.Code != "LV1B") throw new ArgumentException("Practice smoke requires the original lab");
|
||||
director.Skip();
|
||||
if (practiceReturnSmoke)
|
||||
{
|
||||
// Move the real player away from STRT so an accidental
|
||||
// restart at the authored spawn cannot pass this check.
|
||||
for (var tick = 0; tick < 45; tick++) simulation.Step(new(true, false, false, false, false));
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
}
|
||||
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
||||
director.Skip();
|
||||
interactions!.Update(director.FindActor("shrinkray")!.Position);
|
||||
if (!practice.Active) throw new InvalidOperationException("Original lab pickup did not open practice modal");
|
||||
if (args.Contains("--smoke-practice-transition")) practice.Key(28, Vector2.Zero);
|
||||
if (args.Contains("--smoke-practice-transition") || practiceReturnSmoke) practice.Key(28, Vector2.Zero);
|
||||
}
|
||||
for (var tick = 0; tick < (int)Math.Round(storyTime * 60) && !practice.Active; tick++)
|
||||
{
|
||||
@@ -720,7 +761,7 @@ internal static class Program
|
||||
if (interactions != null && saveOutput is { } output)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(output)!);
|
||||
var snapshot = interactions.Snapshot() with { LevelCode = level!.Code, StartPoint = originalStart!.Tag! };
|
||||
var snapshot = interactions.Snapshot() with { LevelCode = level!.Code, StartPoint = originalStart!.Tag!, StoredVector = returnRoot };
|
||||
var temporary = output + "." + Guid.NewGuid().ToString("N") + ".tmp";
|
||||
try
|
||||
{
|
||||
@@ -743,7 +784,8 @@ internal static class Program
|
||||
}
|
||||
nextArgs.AddRange(["--scene", nextScene, "--level", "gam/" + transitionRequest.LevelFile,
|
||||
"--start", transitionRequest.StartPoint]);
|
||||
continuation = new(nextArgs.ToArray(), interactions!.Snapshot() with { StartPoint = transitionRequest.StartPoint });
|
||||
continuation = new(nextArgs.ToArray(), interactions!.Snapshot() with {
|
||||
StartPoint = transitionRequest.StartPoint, StoredVector = returnRoot }, transitionRequest.Returning);
|
||||
Console.WriteLine($"Loading original destination: {transitionRequest.LevelFile}, start={transitionRequest.StartPoint}; fade behavior remains unreconstructed.");
|
||||
}
|
||||
if (walkSmoke && !simulation!.SmokePassed) return 2;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="../../src/GamePort/Game/RuntimeCheckpoint.cs" Link="RuntimeCheckpoint.cs" />
|
||||
<Compile Include="../../src/GamePort/Assets/OriginalSave.cs" Link="OriginalSave.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Buffers.Binary;
|
||||
using System.Numerics;
|
||||
using GamePort.Assets;
|
||||
using GamePort.Game;
|
||||
|
||||
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
||||
var source = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
|
||||
void Bytes(int va, string hex)
|
||||
{
|
||||
var expected = Convert.FromHexString(hex);
|
||||
Require(source.AsSpan(va - 0x400000, expected.Length).SequenceEqual(expected), $"Source instructions differ at0x{va:X}");
|
||||
}
|
||||
int Pointer(int va) => BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(va - 0x400000, 4));
|
||||
|
||||
Require(Pointer(0x4a3bdc + 0x168) == 0x43b5a0, "Jimmy transition vtable target");
|
||||
Require(Pointer(0x4a3bdc + 0x1e8) == 0x42af00, "Separate Jimmy checkpoint vtable target");
|
||||
Bytes(0x42af1b, "898E481E0000");
|
||||
Bytes(0x42af30, "81C6381E0000");
|
||||
Bytes(0x43b78e, "8A83A509000084C07537");
|
||||
Bytes(0x43b7b1, "8D8BA80900008993A80900008B50048951048B50088951088B400C89410C");
|
||||
Bytes(0x458014, "88905409000074088D8340FFFFFFEB0233C085DB8890A5090000");
|
||||
Bytes(0x423a90, "8A85E508000084C00F8486000000C685E508000000");
|
||||
Bytes(0x423abf, "FF926C010000");
|
||||
Bytes(0x423ae3, "8B8DE80800008BC48964242089088B95EC0800008950048B8DF00800008948088B95F408000089500C");
|
||||
Bytes(0x423b0c, "8B855C0900008D88C00000008B80C0000000FF9068010000");
|
||||
Require(Pointer(0x49f480 + 0x168) == 0x471680 && Pointer(0x49f480 + 0x16c) == 0x471630,
|
||||
"Goddard root setter retains unchanged XYZ");
|
||||
Bytes(0x471680, "8B54240C8B01528B54240C528B54240C52FF906C010000C21000");
|
||||
Bytes(0x4427f2, "8A905409000084D2741D85C9740F8D8140FFFFFFC6805409000000EB21");
|
||||
Bytes(0x442887, "8A905409000084D2741C85C974108D8140FFFFFF5F5EC6805409000000");
|
||||
Bytes(0x46008b, "8D87E80800008D4C241C50FFD58D8FEC080000518D4C2420FFD581C7F00800008D4C241C57FFD5");
|
||||
Bytes(0x460ba3, "898DA80900008B5424688995AC0900008B44246C8B55008985B0090000");
|
||||
Console.WriteLine("PASS source departure/RETURN root, start-trigger suppression and TSK vector identity");
|
||||
|
||||
var initial = OriginalSave.Load(Path.Combine(original, "NewGame.tsk"));
|
||||
var departingRoot = new Vector3(3321.25f, 76.5f, -456.75f);
|
||||
var tutorialRoot = new Vector3(-31, 211, 584);
|
||||
var departure = RuntimeCheckpoint.Stage(initial.StoredVector, departingRoot, false);
|
||||
Require(!departure.Returning && departure.ActivateStartTrigger, "Ordinary departure retains destination start trigger");
|
||||
Require(departure.Root == departingRoot, "Departure captures live actor root, not STRT position");
|
||||
var tutorialSave = initial with { LevelCode = "VR04", StartPoint = "PHONEBOOTH",
|
||||
ReturnLevel = "level1b.gam", ReturnStart = "STARTEXP", StoredVector = departure.Root };
|
||||
var reloaded = OriginalSave.Parse(tutorialSave.Encode());
|
||||
var returning = RuntimeCheckpoint.Stage(reloaded.StoredVector, tutorialRoot, true);
|
||||
Require(returning.Returning && !returning.ActivateStartTrigger, "RETURN suppresses destination start trigger");
|
||||
Require(returning.Root == departingRoot && returning.Root != tutorialRoot, "RETURN preserves departure root across TSK encoding");
|
||||
Require(reloaded.ReturnLevel == "level1b.gam" && reloaded.ReturnStart == "STARTEXP", "Return strings stay separate from captured root");
|
||||
var nextDeparture = RuntimeCheckpoint.Stage(returning.Root, tutorialRoot, false);
|
||||
Require(nextDeparture.Root == tutorialRoot && nextDeparture.ActivateStartTrigger, "RETURN suppression is per transition, not permanent");
|
||||
Console.WriteLine("PASS lab departure -> serialized tutorial -> RETURN preserves root and suppresses intro once");
|
||||
|
||||
var saves = Directory.EnumerateFiles(original).Where(p => p.EndsWith(".tsk", StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
Require(saves.Length == 12, "Expected all12 supplied saves");
|
||||
foreach (var path in saves)
|
||||
{
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
var save = OriginalSave.Parse(bytes);
|
||||
Require(save.Encode().SequenceEqual(bytes), $"Wire layout changed for {path}");
|
||||
var returnStage = RuntimeCheckpoint.Stage(save.StoredVector, tutorialRoot, true);
|
||||
Require(returnStage.Root == save.StoredVector, $"RETURN did not preserve original vector in {path}");
|
||||
var freshLoad = RuntimeCheckpoint.Stage(save.StoredVector, tutorialRoot, false);
|
||||
Require(!freshLoad.Returning && freshLoad.ActivateStartTrigger, "Loaded TSK vector alone does not imply pending RETURN");
|
||||
}
|
||||
Console.WriteLine("PASS all12 original TSK vectors remain byte-identical and distinct from pending RETURN state");
|
||||
|
||||
foreach (var bad in new[] { new Vector3(float.NaN, 0, 0), new Vector3(0, float.PositiveInfinity, 0), new Vector3(0, 0, float.NegativeInfinity) })
|
||||
{
|
||||
Reject(() => RuntimeCheckpoint.Stage(bad, departingRoot, true));
|
||||
Reject(() => RuntimeCheckpoint.Stage(departingRoot, bad, false));
|
||||
}
|
||||
// Large but finite roots are valid serialized evidence; avoid inventing world bounds.
|
||||
Require(RuntimeCheckpoint.Stage(Vector3.Zero, new(float.MaxValue, 0, -float.MaxValue), false).Root.X == float.MaxValue,
|
||||
"Finite original coordinates must not be normalized or truncated");
|
||||
Console.WriteLine("PASS nonfinite input rejection without invented coordinate bounds");
|
||||
|
||||
static void Require(bool condition, string message)
|
||||
{
|
||||
if (!condition) throw new InvalidOperationException(message);
|
||||
}
|
||||
static void Reject(Action action)
|
||||
{
|
||||
try { action(); }
|
||||
catch (ArgumentOutOfRangeException) { return; }
|
||||
throw new InvalidOperationException("Expected nonfinite root rejection");
|
||||
}
|
||||
@@ -162,6 +162,12 @@ static void SourcePolicy()
|
||||
var scene = new SceneCollision(mesh);
|
||||
Check(scene.TriangleCount == 2, "unrendered source proxy retained");
|
||||
Check(scene.Move(Vector3.Zero, new Vector3(100, 0, 0), 1, 4).HitWall, "proxy blocks under provisional policy");
|
||||
var source = mesh with { CollisionPolygons = [new(1, 0, Vector3.UnitX, "wall", "NcWater"), new(1, 1, Vector3.UnitX, "wall", "NcWater")] };
|
||||
var excluded = new SceneCollision(source);
|
||||
Check(excluded.TriangleCount == 0 && !excluded.Move(Vector3.Zero, new(100, 0, 0), 1, 4).HitWall,
|
||||
"NC shape is drawn separately but omitted from terrain registration");
|
||||
var materialOnly = source with { CollisionPolygons = source.CollisionPolygons.Select(p => p with { ShapeName = "wall", MaterialName = "ncwater" }).ToArray() };
|
||||
Check(new SceneCollision(materialOnly).TriangleCount == 2, "NC material name alone does not disable collision");
|
||||
var degenerate = new SceneCollision(new Builder().Triangle(Vector3.Zero, Vector3.One, Vector3.One).Build());
|
||||
Check(degenerate.TriangleCount == 0, "degenerate triangles skipped");
|
||||
Throws<ArgumentOutOfRangeException>(() => scene.Move(Vector3.Zero, Vector3.Zero, 0, 4));
|
||||
@@ -179,8 +185,13 @@ static void OriginalLab()
|
||||
var root = FindRoot();
|
||||
var file = Path.Combine(root, "artifacts/extracted/level1b/scene.json");
|
||||
Check(File.Exists(file), "prepared original lab required (run extractors/prepare.py)");
|
||||
var scene = new SceneCollision(Mesh.LoadSceneJson(file));
|
||||
Check(scene.TriangleCount == 2869, "all original lab triangles included");
|
||||
var mesh = Mesh.LoadSceneJson(file);
|
||||
var scene = new SceneCollision(mesh);
|
||||
Check(mesh.Indices.Length / 3 == 2869 && mesh.CollisionPolygons.Count(p => !p.TerrainCollision) == 18,
|
||||
"NC registration exclusion preserves all render/source polygons");
|
||||
Check(mesh.CollisionPolygons.Where(p => !p.TerrainCollision).All(p => p.ShapeId == 94 && p.ShapeName == "ncwater"),
|
||||
"Actual shape names are recovered from prepared mesh records");
|
||||
Check(scene.TriangleCount == 2851, "source terrain registration excludes18 NC-shape triangles while retaining proxies");
|
||||
var originalRoot = new Vector3(5071.933105f, 26.661896f, 824.103943f);
|
||||
var floor = scene.GroundHeight(originalRoot, 100)!.Value;
|
||||
Near(floor, .5486332f, .001f, "actual lab floor below GAM root");
|
||||
|
||||
@@ -42,6 +42,20 @@ 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");
|
||||
|
||||
var returnDirector = new SceneDirector(level, new TaskStates(save.Tasks), (_, _) => 10);
|
||||
var returnCues = 0;
|
||||
returnDirector.Speech += (_, _) => returnCues++;
|
||||
var sourceGoddard = returnDirector.FindActor("C3DGODDARD")!.Position;
|
||||
returnDirector.Begin(level.FindStart()!, activateStartTrigger: false);
|
||||
Check(returnDirector.Controlled && !returnDirector.Playing && returnCues == 0,
|
||||
"RETURN suppresses the start trigger rather than replaying/skipping its dialogue");
|
||||
Check(returnDirector.FindActor("C3DGODDARD")!.Position == sourceGoddard,
|
||||
"Suppressing LABEXP must not execute its teleport/patrol actions");
|
||||
returnDirector.Begin(level.FindStart()!);
|
||||
Check(!returnDirector.Controlled && returnDirector.CurrentTag == "LABEXP1" && returnCues == 1,
|
||||
"Return suppression does not persist into a later normal start");
|
||||
Console.WriteLine("PASS RETURN suppresses STRT actions once and preserves normal start behavior");
|
||||
|
||||
foreach (var finishBySkip in new[] { false, true })
|
||||
{
|
||||
var carlScene = new SceneDirector(level, new TaskStates(save.Tasks), (_, _) => .1);
|
||||
@@ -191,7 +205,7 @@ var restoredDirector=new SceneDirector(vr,new TaskStates(save.Tasks),(_,_)=>1);v
|
||||
Check(restoredDirector.Actors.Where(a=>a.Kind=="3PIC").All(a=>!a.Visible && !a.Active),"Loaded acquired stars must hide before contact");
|
||||
var transitions=0;LevelTransition? returned=null;interactions.Transition += request=>{transitions++;returned=request;};
|
||||
var returnGate=vr.Entities.First(e=>e.Kind=="LOAD");interactions.Update(returnGate.Position);interactions.Update(returnGate.Position);
|
||||
Check(transitions==1 && returned!.LevelFile==save.ReturnLevel && returned.StartPoint==save.ReturnStart,"RETURN uses stored destination and contact-enter gating");
|
||||
Check(transitions==1 && returned!.Returning && returned.LevelFile==save.ReturnLevel && returned.StartPoint==save.ReturnStart,"RETURN uses stored destination, restore flag and contact-enter gating");
|
||||
Console.WriteLine("PASS original VR01 star/trophy score, strict contact entry, acquired-state save/reload and RETURN request");
|
||||
|
||||
static GamEntity Entity(string kind,string tag,params (string Name,object Value)[] values)
|
||||
|
||||
@@ -66,7 +66,7 @@ var snapshot = interactions.Snapshot();
|
||||
var decoded = OriginalSave.Parse(snapshot.Encode());
|
||||
Check(decoded.InventoryStates[3] == 1 && decoded.ItemStates[301] == 1 && decoded.Score == 150 && decoded.OtherCounter == 3,
|
||||
"Original TSK serializes acquired gadget, score and objective selector");
|
||||
Check(decoded.StoredVector == original.StoredVector, "Unknown saved vector is not overwritten by inferred checkpoint data");
|
||||
Check(decoded.StoredVector == original.StoredVector, "Pickup42AF00 does not overwrite the separate saved transition root");
|
||||
var restoredTasks = new TaskStates(decoded.Tasks);
|
||||
var restoredDirector = new SceneDirector(lab, restoredTasks, (_, _) => 5);
|
||||
var restored = new SceneInteractions(restoredDirector, restoredTasks, decoded, lab.Code);
|
||||
|
||||
@@ -21,6 +21,7 @@ var tests = new (string Name, Action Check)[]
|
||||
("powered steering remains independent of presentation rate", JetpackReplayRates),
|
||||
("landing clears residual air turn before ground steering", LandingTurn),
|
||||
("reset restores spawn, camera and counters", Reset),
|
||||
("RETURN restores exact root with authored start yaw", ReturnRoot),
|
||||
("ten-minute simulation remains finite and supported", LongRun),
|
||||
("original lab placement, floor, walking and jump checkpoint", () => OriginalLab(project, originals)),
|
||||
};
|
||||
@@ -274,6 +275,23 @@ static void LandingTurn()
|
||||
}
|
||||
}
|
||||
|
||||
static void ReturnRoot()
|
||||
{
|
||||
var simulation = FlatSimulation();
|
||||
var destination = simulation.ActorRoot + new Vector3(450, 100, -250);
|
||||
var yaw = simulation.Yaw;
|
||||
simulation.RestoreReturnRoot(destination);
|
||||
NearVector(simulation.ActorRoot, destination, .0001f, "restore stored XYZ without floor snapping");
|
||||
Near(simulation.Yaw, yaw, 0, "RETURN has no stored rotation; retain STRT yaw");
|
||||
Check(simulation.Velocity == Vector3.Zero && simulation.Steps == 0, "fresh destination keeps initial motion state");
|
||||
Check(Vector3.Distance(simulation.CameraEye, simulation.ActorRoot) < 500, "camera follows restored root");
|
||||
Throws<ArgumentOutOfRangeException>(() => simulation.RestoreReturnRoot(new(float.NaN, 0, 0)));
|
||||
simulation.Step(default);
|
||||
Check(simulation.ActorRoot.Y < destination.Y && !simulation.Grounded, "restored unsupported root settles through physics");
|
||||
simulation.Reset();
|
||||
Check(Vector3.Distance(simulation.ActorRoot, destination) > 100, "ordinary reset still uses the source start");
|
||||
}
|
||||
|
||||
static void JumpRepress()
|
||||
{
|
||||
var simulation = FlatSimulation();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs"/>
|
||||
<Compile Include="../../src/GamePort/Assets/*.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/*.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/StaticSceneVisuals.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,159 @@
|
||||
using System.Numerics;
|
||||
using GamePort.Assets;
|
||||
using GamePort.Game;
|
||||
using GamePort.Application;
|
||||
|
||||
// Modern input replay using original geometry/actors, not recovered navigation.
|
||||
// SCENE65 is an explicit initial fixture, not an award or proof that the prior
|
||||
// game progression reaches65. The player starts only at authored STRT riverlab.
|
||||
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
||||
var prepared = Path.GetFullPath("artifacts/extracted");
|
||||
var level = GamLevel.Load(AssetPath.Resolve(original, "gam/level1b.gam"));
|
||||
var start = level.FindStart("riverlab")!;
|
||||
var world = Mesh.LoadSceneJson(Path.Combine(prepared, "level1b/scene.json"));
|
||||
var save = OriginalSave.Load(AssetPath.Resolve(original, "NewGame.tsk"));
|
||||
var tasks = new TaskStates(save.Tasks);
|
||||
tasks.SetExisting("SCENE", 65);
|
||||
var resources = new PreparedEntityResources(Path.Combine(prepared, "level1b/entities/entities.json"));
|
||||
var director = new SceneDirector(level, tasks, resources.Duration);
|
||||
var interactions = new SceneInteractions(director, tasks, save, level.Code);
|
||||
var mechanisms = new SceneMechanisms(director);
|
||||
var visuals = new StaticSceneVisuals(world, director, original, Path.Combine(prepared, "level1b/models"));
|
||||
var simulation = new LabSimulation(new SceneCollision(world), AseMesh.Load(AssetPath.Resolve(original, "ASE/jimstop.ase")),
|
||||
start.Position, start.Rotation.Y) { JetpackInventoryState = () => interactions.Inventory.State(0, 3) };
|
||||
var resolverCalls = 0;
|
||||
simulation.DynamicRootResolver = (before, after, radius) =>
|
||||
{
|
||||
resolverCalls++;
|
||||
return DynamicBodyResponse.Resolve(visuals.DoorColliders(), before, after, radius);
|
||||
};
|
||||
var patrols = new List<ActorPatrol>();
|
||||
foreach (var actor in director.Actors.Where(a => a.Kind is "3DOG" or "3CAR"))
|
||||
{
|
||||
var physics = new OriginalScenePhysics(world);
|
||||
var grounded = false;
|
||||
var patrol = new ActorPatrol(actor, director.FindActor, (body, dt) =>
|
||||
{
|
||||
var step = physics.Step(body.Position, body.Velocity, actor.Kind == "3DOG" ? 130 : 100,
|
||||
actor.Kind == "3DOG" ? .3f : .75f, grounded, dt);
|
||||
grounded = step.Supported;
|
||||
return new(step.Body.Position, step.Body.Velocity);
|
||||
});
|
||||
patrols.Add(patrol);
|
||||
director.RegisterPatrolConsumer(actor.Tag);
|
||||
director.ActorChanged += changed => { if (ReferenceEquals(changed, actor)) patrol.SynchronizeAuthoredState(); };
|
||||
}
|
||||
LevelTransition? destination = null;
|
||||
interactions.Transition += request => destination ??= request;
|
||||
director.Begin(start);
|
||||
interactions.Reset(); mechanisms.Reset();
|
||||
Require(director.Controlled && !director.Playing, "Authored underground start must grant control without the lab intro");
|
||||
var bars = director.FindActor("bars")!;
|
||||
var closedY = bars.SourceGam!.Position.Y;
|
||||
var amount = bars.SourceGam.Number("OpenAmount");
|
||||
var buttons = director.Actors.Where(a => a.Kind == "3BUT").ToArray();
|
||||
Require(buttons.Length == 2 && buttons[0].Position.Y > buttons[1].Position.Y && buttons[0].Position.Z > buttons[1].Position.Z,
|
||||
"Source switch ordering/door sides changed");
|
||||
Require(bars.Position.Y == closedY && buttons.All(b => b.Animation == "UP"), "Authored bars/switches must begin closed/available");
|
||||
var pressed = new bool[2];
|
||||
var sawFullyOpen = false;
|
||||
var openingLoops = 0;
|
||||
var stoppedLoops = 0;
|
||||
var crossings = 0;
|
||||
mechanisms.Sound += (_, id, loop) => { if (id == 59 && loop) openingLoops++; };
|
||||
mechanisms.StopSound += _ => stoppedLoops++;
|
||||
|
||||
// Explicit center approaches keep the capsule away from the arched entrance's
|
||||
// masonry. These waypoint coordinates are test input policy, not source AI.
|
||||
Walk("lower switch", new(buttons[1].Position.X, buttons[1].Position.Z));
|
||||
Require(pressed[1] && bars.Position.Y > closedY, "Lower switch contact did not start opening the original bars");
|
||||
Walk("lower center approach", new(bars.Position.X, -1900));
|
||||
Walk("lower gate approach", new(bars.Position.X, bars.Position.Z - 200));
|
||||
Walk("upper passage", new(bars.Position.X, bars.Position.Z + 300));
|
||||
Require(crossings == 1 && sawFullyOpen, "Lower-to-upper passage did not cross the open source doorway");
|
||||
Walk("upper switch approach", new(3500, -900));
|
||||
Require(pressed[0], "Upper switch was not pressed through live player contact");
|
||||
Walk("upper center approach", new(bars.Position.X, -900));
|
||||
Walk("lower return passage", new(bars.Position.X, -1450));
|
||||
Require(crossings == 2, "Upper-to-lower passage did not cross the source doorway");
|
||||
Walk("lower return", new(bars.Position.X, -2000));
|
||||
for (var i = 0; i < 1200; i++) Tick(default);
|
||||
Require(MathF.Abs(bars.Position.Y - closedY) < .01f && buttons.All(b => b.Animation == "UP"),
|
||||
"Timed bars and both switches did not return to their authored resting states");
|
||||
// A separate negative collision query uses the replay's actual standing root
|
||||
// height. It never assigns the player position or bypasses a button during play.
|
||||
// Correct NC-water exclusion leaves this body inside the source broadphase;
|
||||
// treating water as solid raised it85.89 units and incorrectly skipped the bars.
|
||||
var probeBefore = new Vector3(bars.Position.X, simulation.ActorRoot.Y, bars.Position.Z - 100);
|
||||
var probeAfter = probeBefore + new Vector3(0, 0, 80);
|
||||
var probeBox = visuals.DoorColliders().Single();
|
||||
Require(DynamicSceneCollision.BroadPhase(probeBox, new(probeBefore, probeAfter, 60)),
|
||||
"Closed source gate must receive the actual standing-height body sweep");
|
||||
var liveRoot = simulation.ActorRoot;
|
||||
var blocked = DynamicBodyResponse.Resolve([probeBox], probeBefore, probeAfter, 60);
|
||||
Require(blocked.Z < bars.Position.Z - 76 && simulation.ActorRoot == liveRoot,
|
||||
"Closed bars failed the negative sweep, or the query moved the live player");
|
||||
Require(tasks.Get("SCENE") == 65 && interactions.Score == save.Score && destination == null,
|
||||
"Walking the button route must not invent task/score or enter the separate river LOAD");
|
||||
Require(simulation.Steps > 1200 && simulation.Travel > 3500 && simulation.Jumps == 0 && simulation.Grounded,
|
||||
"Replay did not exercise actual grounded movement");
|
||||
Require(resolverCalls == simulation.Steps && openingLoops >= 1 && stoppedLoops >= 1,
|
||||
"Live dynamic collision or door-loop lifetime was not exercised");
|
||||
Require(!director.Blocked && mechanisms.Unsupported.Count == 0, "Route encountered unsupported director/mechanism behavior");
|
||||
Console.WriteLine($"PASS input-only underground passage both ways, both switches, timed reclose, {crossings} clear crossings. {simulation.Report}");
|
||||
Console.WriteLine("Initial fixture is original riverlab/SCENE65. Original collision, timing, water and prior progression fidelity remain separate evidence.");
|
||||
|
||||
void Walk(string name, Vector2 target)
|
||||
{
|
||||
for (var tick = 0; tick < 1800; tick++)
|
||||
{
|
||||
var difference = target - new Vector2(simulation.Position.X, simulation.Position.Z);
|
||||
if (difference.Length() < 30)
|
||||
{
|
||||
// Release before turning for the next leg. Source steering changes
|
||||
// yaw while decelerating, rather than snapping the heading or root.
|
||||
for (var pause = 0; pause < 90; pause++) Tick(default);
|
||||
Console.WriteLine($"PASS walked {name}: root={simulation.ActorRoot}, barsY={bars.Position.Y:F2}");
|
||||
return;
|
||||
}
|
||||
var desiredYaw = MathF.Atan2(-difference.X, difference.Y) * 180 / MathF.PI;
|
||||
var error = MathF.IEEERemainder(desiredYaw - simulation.Yaw, 360);
|
||||
Tick(new(MathF.Abs(error) < 6, false, error > 1, error < -1, false));
|
||||
}
|
||||
throw new InvalidOperationException($"Input route blocked at {name}: {simulation.ActorRoot}");
|
||||
}
|
||||
|
||||
void Tick(PlayerInput input)
|
||||
{
|
||||
Require(director.Controlled, "Underground route unexpectedly lost player control");
|
||||
var previous = simulation.ActorRoot;
|
||||
simulation.Step(input);
|
||||
Require(Vector3.Distance(previous, simulation.ActorRoot) < 100, "Player warped during input replay");
|
||||
if (simulation.Steps == 1)
|
||||
Require(MathF.Abs(previous.Y - simulation.ActorRoot.Y) < 1,
|
||||
"Authored riverlab spawn popped onto an excluded NC water surface");
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
director.Touch(level.Player.Tag!, simulation.ActorRoot);
|
||||
interactions.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
mechanisms.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
// Test actual aperture clearance when crossing the gate plane, before this
|
||||
// frame's mechanism movement. The resolver uses this same current transform.
|
||||
if ((previous.Z - bars.Position.Z) * (simulation.ActorRoot.Z - bars.Position.Z) < 0)
|
||||
{
|
||||
var box = visuals.DoorColliders().Single();
|
||||
var minimumY = DynamicSceneCollision.Corners(box).Min(p => p.Y);
|
||||
Require(minimumY > simulation.Position.Y + simulation.BodyHeight,
|
||||
"Replay crossed the bars before the moving doorway cleared the player");
|
||||
crossings++;
|
||||
}
|
||||
mechanisms.Step(FixedStepClock.Step);
|
||||
foreach (var patrol in patrols) patrol.Step(FixedStepClock.Step);
|
||||
director.Step(FixedStepClock.Step);
|
||||
for (var i = 0; i < buttons.Length; i++) pressed[i] |= buttons[i].Animation == "DOWN";
|
||||
sawFullyOpen |= MathF.Abs(bars.Position.Y - closedY - amount) < .01f;
|
||||
}
|
||||
|
||||
static void Require(bool condition, string message)
|
||||
{
|
||||
if (!condition) throw new InvalidOperationException(message);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Original NC-shape registration and source corpus regression."""
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
PROJECT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(PROJECT / 'tools/binary'))
|
||||
from water_collision_evidence import evidence, static_shape_enabled
|
||||
|
||||
|
||||
class WaterCollisionTests(unittest.TestCase):
|
||||
def test_original_instructions_and_lab_shape_count(self):
|
||||
result = evidence()
|
||||
self.assertEqual(result['instruction_checks'], 9)
|
||||
self.assertEqual(result['vtable_checks'], 2)
|
||||
lab = result['scenes']['level1b']
|
||||
self.assertEqual(lab['excluded_shapes'], [dict(id=94, name='ncwater', triangles=18)])
|
||||
self.assertEqual(lab['source_triangles'], 2869)
|
||||
self.assertEqual(lab['registered_triangles'], 2851)
|
||||
self.assertEqual(lab['registered_null_material_triangles'], 325)
|
||||
self.assertEqual(result['scenes']['VR04']['excluded_shapes'], [])
|
||||
outside = result['scenes']['level1']
|
||||
self.assertEqual(outside['source_triangles'] - outside['registered_triangles'], 24)
|
||||
|
||||
def test_rule_is_shape_prefix_not_material_or_substring(self):
|
||||
for name in ('ncwater', 'NCwater', 'Ncwater', 'nCwater', 'nc', 'NC'):
|
||||
self.assertFalse(static_shape_enabled(name), name)
|
||||
for name in ('', 'n', 'c', 'water', 'waternc', 'wall_nc', 'Box06', 'phoneblock'):
|
||||
self.assertTrue(static_shape_enabled(name), name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only evidence for NC-named static shape registration exclusions.
|
||||
|
||||
Run from GamePort. Checks original instruction bytes/vtable slots, then counts
|
||||
source polygons. No original instructions are executed or modified.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
PROJECT = HERE.parent.parent
|
||||
sys.path.insert(0, str(HERE))
|
||||
sys.path.insert(0, str(PROJECT / 'tools/extractors'))
|
||||
from pe_inspect import PE
|
||||
from omt import Database, read_shape
|
||||
|
||||
|
||||
def static_shape_enabled(name):
|
||||
"""44DD2F..44DD6D: ASCII case-insensitive NC prefix omits InitPhysics."""
|
||||
return name[:2].lower() != 'nc'
|
||||
|
||||
|
||||
def evidence(originals=None):
|
||||
originals = Path(originals) if originals else PROJECT.parent / 'Original'
|
||||
pe = PE(originals / 'Neutron.exe')
|
||||
sequences = {
|
||||
'lab_initializer_calls_colour_shape_loader': (0x44f569, 'ff9058010000'),
|
||||
'shape_loader_lowercase_first': (0x44dd27, 'e88d1c0300'),
|
||||
'shape_loader_first_is_n': (0x44dd2f, '83f86e7535'),
|
||||
'shape_loader_lowercase_second': (0x44dd5c, 'e8581c0300'),
|
||||
'shape_loader_second_is_c_skips_initphysics': (0x44dd64, '83f8637407'),
|
||||
'shape_loader_ordinary_initphysics': (0x44dd69, '8b178bcfff522c'),
|
||||
'terrain_initphysics_register_shape': (0x464b11, '8b8e1404000051e823460100'),
|
||||
'resource_lookup_is_3dsh': (0x477bc2, '6868534433'),
|
||||
'ascii_lowercase_bounds': (0x47f9cc, '83f8410f8caa00000083f85a0f8fa100000083c020'),
|
||||
}
|
||||
for label, (va, hex_bytes) in sequences.items():
|
||||
offset = pe.offset(va - pe.base)
|
||||
actual = pe.data[offset:offset + len(hex_bytes) // 2].hex()
|
||||
if actual != hex_bytes:
|
||||
raise ValueError(f'{label} source bytes differ at {va:#x}: {actual}')
|
||||
slots = {'lab_game_slot158': (0x4c3cd0 + 0x158, 0x44dbf0),
|
||||
'terrain_interface_slot2c': (0x4d4ccc + 0x2c, 0x464b00)}
|
||||
for label, (va, expected) in slots.items():
|
||||
actual = pe.u32(pe.offset(va - pe.base))
|
||||
if actual != expected:
|
||||
raise ValueError(f'{label} differs: {actual:#x}')
|
||||
scenes = {}
|
||||
for level in ('level1b', 'level1', 'VR04'):
|
||||
db = Database(originals / 'omt' / f'{level}.omt')
|
||||
material_names = {e.id: e.name for e in db.entries if e.type == '3DMa'}
|
||||
excluded, included = [], []
|
||||
null_triangles = 0
|
||||
for entry in db.entries:
|
||||
if entry.type != '3DSh':
|
||||
continue
|
||||
shape = read_shape(db.payload(entry))
|
||||
triangles = sum(len(p['corners']) - 2 for p in shape['polygons'])
|
||||
fact = {'id': entry.id, 'name': entry.name, 'triangles': triangles}
|
||||
if static_shape_enabled(entry.name):
|
||||
included.append(fact)
|
||||
null_triangles += sum(len(p['corners']) - 2 for p in shape['polygons']
|
||||
if not p['material'] or p['material']['id'] not in material_names)
|
||||
else:
|
||||
excluded.append(fact)
|
||||
scenes[level] = dict(excluded_shapes=excluded,
|
||||
source_triangles=sum(e['triangles'] for e in included + excluded),
|
||||
registered_triangles=sum(e['triangles'] for e in included),
|
||||
registered_null_material_triangles=null_triangles)
|
||||
return dict(source_sha256=hashlib.sha256(pe.data).hexdigest(),
|
||||
instruction_checks=len(sequences), vtable_checks=len(slots), scenes=scenes,
|
||||
rule='Case-insensitive shape name starts NC: skip static collision registration; retain render geometry.',
|
||||
limitation='Static source/data proof. No original runtime comparison; water/hazard behavior and full solver remain incomplete.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(json.dumps(evidence(), indent=2))
|
||||
Reference in new issue
Block a user