Implement timed Invisible gadget and shared energy warnings
This commit is contained in:
1 parent
3527d33810
commit
1897dd2b90
44 files changed
+2466
-39
No files matched your search
@@ -46,6 +46,11 @@ changes. Current gadget controls/resources/primary-fire findings belong in
|
|||||||
docs/gameplay/. Distinguish static recovery, implementation, port tests and original
|
docs/gameplay/. Distinguish static recovery, implementation, port tests and original
|
||||||
runtime evidence. Main owns integration/runtime; gadget investigators have
|
runtime evidence. Main owns integration/runtime; gadget investigators have
|
||||||
exclusive named files, not shared directories.
|
exclusive named files, not shared directories.
|
||||||
|
Latest continuation: docs/gameplay/invisible-implementation.md. Invisible's timed
|
||||||
|
effect, original meter, companion/cutscene cleanup and shared energy warnings are
|
||||||
|
implemented; Bubble source is recorded in bubble.md pending movementmode2/body.
|
||||||
|
All current investigator ownership has returned to primary. Keep full enemy AI,
|
||||||
|
suppression globals, render state and original/native Windows verification distinct.
|
||||||
|
|
||||||
Use REA for original-binary investigations from now on, including delegated
|
Use REA for original-binary investigations from now on, including delegated
|
||||||
investigations. Preserve its Evidence and cross-check relevant addresses/bytes;
|
investigations. Preserve its Evidence and cross-check relevant addresses/bytes;
|
||||||
|
|||||||
@@ -20,12 +20,16 @@ VR04 now uses recovered static body response/support/friction with original-code
|
|||||||
numeric references. Lab/outside retain the capsule until special contacts and
|
numeric references. Lab/outside retain the capsule until special contacts and
|
||||||
dynamic collision are recovered; see [body implementation](docs/checkpoint/collision-body-implementation.md).
|
dynamic collision are recovered; see [body implementation](docs/checkpoint/collision-body-implementation.md).
|
||||||
|
|
||||||
**Current milestone: original gadget screen and playable shrink ray.**
|
**Current milestone: gadget screen, shrink ray and timed Invisible device.**
|
||||||
Tab/Space selects owned gadgets and their practice levels; the default device
|
Tab/Space selects owned gadgets and their practice levels; the default device
|
||||||
fires on Enter/Ctrl/left mouse and supports actual VR04 soldier shrink/restore
|
fires on Enter/Ctrl/left mouse and supports actual VR04 soldier shrink/restore
|
||||||
with original morphs and score effects. Other gadget effects remain incomplete.
|
with original morphs and score effects. Invisible uses the recovered recharge,
|
||||||
|
activation, blend flash, meter and cleanup rules; full enemy sensing/combat and
|
||||||
|
other gadget effects remain incomplete.
|
||||||
See [gadget implementation](docs/gameplay/gadgets-implementation.md) for recovered
|
See [gadget implementation](docs/gameplay/gadgets-implementation.md) for recovered
|
||||||
rules, modern policies and the verification boundary.
|
rules, modern policies and the verification boundary.
|
||||||
|
The [Invisible continuation](docs/gameplay/invisible-implementation.md) records
|
||||||
|
the later implementation and shared energy-warning sounds.
|
||||||
|
|
||||||
The runtime includes recovered camera/speech triggers, moving props, Carl/Goddard
|
The runtime includes recovered camera/speech triggers, moving props, Carl/Goddard
|
||||||
patrol logic, pickups, objectives, the practice prompt, VR04 powered jumping and
|
patrol logic, pickups, objectives, the practice prompt, VR04 powered jumping and
|
||||||
@@ -66,6 +70,10 @@ jetpack state controls, camera obstruction, audio category mutes, objective/prac
|
|||||||
controls and checkpoint save/load. **F3** toggles noclip: WASD moves/strafe, arrows
|
controls and checkpoint save/load. **F3** toggles noclip: WASD moves/strafe, arrows
|
||||||
move/turn, Space/E rises, Ctrl/Q descends and Shift triples flight speed. Noclip
|
move/turn, Space/E rises, Ctrl/Q descends and Shift triples flight speed. Noclip
|
||||||
bypasses collision and contact triggers; reset or a new level disables it.
|
bypasses collision and contact triggers; reset or a new level disables it.
|
||||||
|
F1→Player also grants/selects Invisible, unequips it, and shows its timers and
|
||||||
|
targetability state. After selecting Invisible, allow7 seconds to recharge, then
|
||||||
|
fire without jump to activate for7 seconds at a fixed2-energy cost (tutorials
|
||||||
|
are exempt). Its last3 seconds flash before normal rendering returns.
|
||||||
|
|
||||||
**F2** toggles a compact live debug overlay without pausing play. It shows frame
|
**F2** toggles a compact live debug overlay without pausing play. It shows frame
|
||||||
timing, position/velocity, movement, control/force state, tasks, camera/clipping
|
timing, position/velocity, movement, control/force state, tasks, camera/clipping
|
||||||
@@ -89,7 +97,7 @@ equipped, the first press unequips it. Use the mouse or arrows to point, then
|
|||||||
Enter/Ctrl or a mouse button to select. Escape or Return closes the screen.
|
Enter/Ctrl or a mouse button to select. Escape or Return closes the screen.
|
||||||
Practice Mode followed by an owned gadget enters its original tutorial directly.
|
Practice Mode followed by an owned gadget enters its original tutorial directly.
|
||||||
The screen scales uniformly on widescreen and pauses port gameplay while music
|
The screen scales uniformly on widescreen and pauses port gameplay while music
|
||||||
continues. Other gadget selection art is present; their special behaviors remain
|
continues. Other gadget selection art is present; the remaining special behaviors stay
|
||||||
future work. F1's jetpack availability control also controls shrink-ray ownership.
|
future work. F1's jetpack availability control also controls shrink-ray ownership.
|
||||||
|
|
||||||
The pickup's original objective calls its jump action the **jet pack**. Its
|
The pickup's original objective calls its jump action the **jet pack**. Its
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ SDL3 for platform windowing, input and audio. Linux x64 and Windows x64 are
|
|||||||
equally required. Source is `src/GamePort/`; root executable csproj allows
|
equally required. Source is `src/GamePort/`; root executable csproj allows
|
||||||
`dotnet build` and `dotnet run` from GamePort. No runtime network dependencies.
|
`dotnet build` and `dotnet run` from GamePort. No runtime network dependencies.
|
||||||
|
|
||||||
|
The Invisible continuation adds `InvisibleGadget` in Jimmy's post-movement wrapper
|
||||||
|
phase, separate from input identity. `PlayerSceneBinding` supplies raw-any-control,
|
||||||
|
handles equip/companion flags and receives a named-Jimmy cleanup event from CAM/
|
||||||
|
initial MCA, distinct from raw-owner preparation. `PlayerGadgetMaterial` changes
|
||||||
|
the existing atlas draw; `InvisibleMeterOverlay` loads original Canv21/22 and
|
||||||
|
uses shared uniform viewport scaling. `PlayerEnergy` is application-session owned
|
||||||
|
across scene rebuilds, preserving scalar/warning latch separately from TSK.
|
||||||
|
See gameplay/invisible-implementation.md for exact coverage and remaining gates.
|
||||||
|
|
||||||
The first gadget slice separates UI display selection from the equipped raw mode.
|
The first gadget slice separates UI display selection from the equipped raw mode.
|
||||||
`GadgetScreen` owns group0 panel state/hit regions; `GadgetMenuOverlay` loads54
|
`GadgetScreen` owns group0 panel state/hit regions; `GadgetMenuOverlay` loads54
|
||||||
original canvases and applies shared uniform640×480 viewport/pointer transforms.
|
original canvases and applies shared uniform640×480 viewport/pointer transforms.
|
||||||
|
|||||||
@@ -3,6 +3,20 @@
|
|||||||
Compilation, native runtime, original behavior and full feature completion are
|
Compilation, native runtime, original behavior and full feature completion are
|
||||||
separate evidence categories. **The game is not fully reconstructed/playable yet.**
|
separate evidence categories. **The game is not fully reconstructed/playable yet.**
|
||||||
|
|
||||||
|
Invisible continuation (2026-11-02): recovered mode2 timers, fixed energy cost,
|
||||||
|
alpha/blend flashing, original meter and companion/cutscene cleanup are integrated.
|
||||||
|
Shared source energy warning latch/audio now serves ray/jetpack/Invisible. Fifteen
|
||||||
|
managed groups and182 Python source/parser checks pass. Native Linux/private
|
||||||
|
Xvfb GTX1070 at1920×1080 verifies real SDL Ctrl/Tab and six rendered phases with
|
||||||
|
zero enabled Vulkan validation errors; headless matches. The fixture accelerates
|
||||||
|
836 ordinary player ticks between captures and does not prove original cadence,
|
||||||
|
enemy immunity, original pixel placement/visual parity or tutorial completion.
|
||||||
|
Full scripts/test.sh passes182 Python+2 HUD, all managed suites,30 main GPU
|
||||||
|
completions and17 isolated Vulkan material checks, with zero enabled validation
|
||||||
|
errors. SDL dummy lifecycle and539 original hashes pass. New packages await the
|
||||||
|
clean source milestone; Windows native gadget verification remains open.
|
||||||
|
See gameplay/invisible-implementation.md and artifacts/gadget-followup/.
|
||||||
|
|
||||||
Gadgets (2026-10-27 UTC): original gadget screen and combined shrink-ray/jetpack
|
Gadgets (2026-10-27 UTC): original gadget screen and combined shrink-ray/jetpack
|
||||||
are implemented; actual VR04 soldiers use original shrink morphs, source timer,
|
are implemented; actual VR04 soldiers use original shrink morphs, source timer,
|
||||||
authored AI reset and ordinary10-point score/save effect. First complete run:
|
authored AI reset and ordinary10-point score/save effect. First complete run:
|
||||||
|
|||||||
+4
-1
@@ -29,7 +29,10 @@ by themselves. Debug tools do not imply reconstructed progression or full gamepl
|
|||||||
The General page retains the existing actions. Player adds noclip, staged flight
|
The General page retains the existing actions. Player adds noclip, staged flight
|
||||||
speeds300/600/1200/2400 (Enter applies), clear motion/queued jump, reopen objective,
|
speeds300/600/1200/2400 (Enter applies), clear motion/queued jump, reopen objective,
|
||||||
return to noclip entry, apply source level gadget availability, toggle input after
|
return to noclip entry, apply source level gadget availability, toggle input after
|
||||||
player, staged jetpack states0/1/4 with a separate Apply row, and energy refill.
|
player, staged jetpack states0/1/4 with a separate Apply row, energy refill,
|
||||||
|
Give/Select Invisible and Unequip Current Gadget. Invisible obeys its source
|
||||||
|
energy/recharge gates; a grant is not instant activation. The header shows
|
||||||
|
remaining time, recharge and targetability. Full enemy sensing is not implied.
|
||||||
State0 means unowned,1 enabled and4 disabled by the level. The full availability
|
State0 means unowned,1 enabled and4 disabled by the level. The full availability
|
||||||
action re-enables the matching VR practice gadget and applies LV1B restrictions
|
action re-enables the matching VR practice gadget and applies LV1B restrictions
|
||||||
on gadgets1/7 after the common prefix. Other level-specific tails remain incomplete. These controls expose
|
on gadgets1/7 after the common prefix. Other level-specific tails remain incomplete. These controls expose
|
||||||
|
|||||||
@@ -200,3 +200,12 @@
|
|||||||
Keep modern full-panel pause, upright effect transform, additive branch and
|
Keep modern full-panel pause, upright effect transform, additive branch and
|
||||||
blended-depth policy explicit. Other gadgets, full AI and warning-audio
|
blended-depth policy explicit. Other gadgets, full AI and warning-audio
|
||||||
lifecycle remain independent evidence gates, not guessed feature completion.
|
lifecycle remain independent evidence gates, not guessed feature completion.
|
||||||
|
37. **Preserve timed gadget and cleanup ownership.** Invisible's seven-second
|
||||||
|
recharge/active clocks run after movement with any nonnull controlled pointer;
|
||||||
|
raw-null pause is distinct from cleanup. CAM/MCA default DeactivateInv to1
|
||||||
|
and explicitly release named Jimmy before target validation, independently
|
||||||
|
of raw-owner438. Keep failed display2/raw−1 selection, source blend flashing,
|
||||||
|
original meter art and companion body flags separate from AI activation.
|
||||||
|
Energy scalar and warning latch share one session owner; raw saved/refill
|
||||||
|
assignment is not a helper-driven warning rearm. Full enemy sensing,
|
||||||
|
suppression globals, graphics options and canvas alignment remain explicit.
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
# Bubble gadget source contract
|
||||||
|
|
||||||
|
2026-11-01. Recovered static contract for the next gadget; **no Bubble runtime
|
||||||
|
implementation or original-game execution is claimed by this investigation**.
|
||||||
|
Original EXE SHA-256
|
||||||
|
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||||
|
Preferred VAs below map to file offsets VA−400000 in the supplied text section;
|
||||||
|
`tools/binary/bubble.py` independently PE-maps and exports every retained site.
|
||||||
|
Output is `artifacts/bubble/source-contract.json`:12 bounded span hashes,37
|
||||||
|
instruction sites and6 virtual bindings. Originals were read only.
|
||||||
|
|
||||||
|
## REA evidence and scope
|
||||||
|
|
||||||
|
Two local REA/Ghidra sessions inspected the generated
|
||||||
|
`artifacts/uncontrolled-phases/rea/Neutron.exe` copy, exported complete Evidence
|
||||||
|
and closed/snapshotted under `artifacts/bubble/`.
|
||||||
|
|
||||||
|
| Procedure | Evidence / saved reply |
|
||||||
|
| --- | --- |
|
||||||
|
| Bubble constructor410840 | `ev_a0c9ee6d5757a741190f3dfcc093bdc7d7b802bcdcd2cbc029422550d34e7cb2`, `rea-effect/00.json` |
|
||||||
|
| Start410CA0 | `ev_097f43eb24a762785dd495220c26a8995d541c69de3e9a88d4c195e24a04b1ce`, `rea-effect/02.json` |
|
||||||
|
| Stop410D00 | `ev_d88f2e5a0b0b2ea4f47758084f3c2a6c605f18a1b8c7c4aa3b7cff0e9465b2e7`, `rea-effect/03.json` |
|
||||||
|
|
||||||
|
427FF0,4299B0,429A30 (`rea-core/`) and410AE0 (`rea-effect/01.json`) were not
|
||||||
|
recognized as procedures by the native profile. Numeric VA queries fell back to
|
||||||
|
unmapped file-offset errors; the complete diagnostics remain on disk. These are
|
||||||
|
not successful decompilations. Contracts below use reviewed fixed instruction
|
||||||
|
ranges/virtual bindings, supported by the successful constructor/start/stop
|
||||||
|
Evidence. No unchanged failed query was repeated. Supplementary objdump output
|
||||||
|
is retained as `equip.asm`, `cleanup.asm`, `class.asm`, `position.asm` and
|
||||||
|
`exe.asm`; source hashes and mapping keep this independently reviewable.
|
||||||
|
|
||||||
|
## Owners and layout — recovered
|
||||||
|
|
||||||
|
The [group0 menu](gadget-controls.md) names item0 **BUBBLE** and maps its practice
|
||||||
|
to VR01. Global signed WORD4F0588 is equipped raw mode; source movement mode is
|
||||||
|
a separate WORD at Jimmy complete7C4/interface704. The Bubble is owned at Jimmy
|
||||||
|
completeA14/interface954. Constructor42232C calls410840, stores the result42233C
|
||||||
|
and initially hides it at42236E. It is not a free-moving projectile or Jimmy's
|
||||||
|
physical body.
|
||||||
|
|
||||||
|
Bubble complete vtable492970; game interface is complete+C8 with table49250C.
|
||||||
|
Game slot3C4 binds410AE0 update; generic1C binds464130. Constructor4108F7 registers
|
||||||
|
FourCC `3BUB`; class name is `C3DBUBBLE`. Constructor4352F0 supplies the sprite
|
||||||
|
base. Own body integration/triangle collision is disabled through471030(0) and
|
||||||
|
4710C0(0); Jimmy's body instead changes radius/factor when equipped.
|
||||||
|
|
||||||
|
| Bubble complete field | Purpose established here |
|
||||||
|
| --- | --- |
|
||||||
|
|90..9C|RGBA sprite color; expanding/collapsing writes all four components|
|
||||||
|
|AC/B0|Sprite width/height; initially200/200 via4645F0(200)|
|
||||||
|
|B4/B8|Source/destination blend enums6 /1 or7|
|
||||||
|
|57C|Integer base pulse size240, initialized410935|
|
||||||
|
|584|Copied archive name `RetainedSprites.omt`|
|
||||||
|
|5E8|Loaded original canvas resource; constructor477890(archive,1)|
|
||||||
|
|600|Float visual timer, incremented each effect update|
|
||||||
|
|604|Float pulse `sin(timer*10)*30` while active|
|
||||||
|
|610|Float fade scalar|
|
||||||
|
|614/615/616|Active / expanding / collapsing flags respectively|
|
||||||
|
|
||||||
|
The retained resource is Canv1 of RetainedSprites.omt, not an ASE sphere. Exact
|
||||||
|
archive/pixels/tutorial inventory is independently documented by the asset
|
||||||
|
investigator. The sprite's full camera-facing transform remains a rendering
|
||||||
|
adapter dependency; the ellipse/pulse does not justify inventing sphere geometry.
|
||||||
|
|
||||||
|
## Equip and cleanup — recovered
|
||||||
|
|
||||||
|
Complete Jimmy174→428D50 dispatches item0 to428F61. The common menu caller closes
|
||||||
|
and invokes cleanup178 first; arbitrary calls to174 without that caller are not
|
||||||
|
equivalent. Bubble branch order:
|
||||||
|
|
||||||
|
1. Require the owned Bubble pointer. If absent, return without a new effect.
|
||||||
|
2. If runtime Practice state(0,9)==2, reset that state and load `vr01.gam` at
|
||||||
|
428FCA using existing return strings. This precedes energy and visual-state tests.
|
||||||
|
3. At428FDA require energy4F83D4>0 or Jimmy complete9F8 nonzero. The latter is
|
||||||
|
retained here as an unnamed exemption flag; its complete ownership is open.
|
||||||
|
Failure writes raw mode−1 at428FFA and returns.
|
||||||
|
4. Reject Bubble active614, collapsing616 or expanding615 before starting another
|
||||||
|
transition. These flags are not a generic cooldown invented by the port.
|
||||||
|
5. At429049/429058 invoke game110/100 for **radius160/factor0.415**; write raw mode0
|
||||||
|
at429065, movement mode2 at429072 and max controller speed1350 at42907B.
|
||||||
|
6. Call410CA0 at429085. Start sets expanding615, timer600=0, unhides the sprite
|
||||||
|
if necessary and chooses blend6/1 (additive) or6/7 (conventional alpha) from
|
||||||
|
graphics flag509A13. It does not clear other transition flags itself.
|
||||||
|
7. Start loop SFX2 at429093..4290A1 only if Jimmy completeA40 handle is−1, then
|
||||||
|
animation refresh148. Source animation selection also depends on movement/body.
|
||||||
|
|
||||||
|
Cleanup178→427FF0 dispatches raw mode0 to428037. With the owned Bubble it sets
|
||||||
|
Jimmy A20=0.5, movement mode0, **max controller speed650**, calls410D00 to begin
|
||||||
|
collapse, then **separately clears expanding615** at42806B. It stops the A40 loop
|
||||||
|
and resets handle−1; invokes radius60/factor1.265; writes raw mode−1 at4280BB.
|
||||||
|
The source's explicit650 cleanup value must not silently be replaced by the
|
||||||
|
constructor's600 or by generic authored-state restoration. The A20 consumer is
|
||||||
|
not closed here. Missing-pointer cleanup falls to the shared raw−1 tail without
|
||||||
|
these body/effect changes. Cleanup also restores selected-device HUD3 via the
|
||||||
|
common prelude. It does not directly transfer raw controlled-pointer ownership.
|
||||||
|
|
||||||
|
## Active input, movement and interactions — recovered boundary
|
||||||
|
|
||||||
|
426030's input callback retains its existing global/game/control predicates.
|
||||||
|
Within it426264 tests **movement mode2**, not raw mode0, then426272..426280 calls
|
||||||
|
42A920 with `−0.5*dt`. The common energy helper owns VR exemption, clamp and warning
|
||||||
|
sounds; no duplicate exemption is implied by the Bubble branch. After adjustment,
|
||||||
|
426285..42629F invokes cleanup178 if energy<=0. Consequently controlled Bubble
|
||||||
|
input drains0.5 energy/second outside exempt tutorial handling. Loss of input
|
||||||
|
ownership can stop this branch while the independently registered effect still
|
||||||
|
updates. This is not permission to pause every clock on raw-control loss.
|
||||||
|
|
||||||
|
The same branch positions the sprite using current camera eye509A50+44..4C:
|
||||||
|
`direction=normalize(JimmyRoot+(0,100,0)−eye)`;
|
||||||
|
`BubbleRoot=JimmyRoot+(0,50,0)−direction*80` (4262A5..4263DA).
|
||||||
|
This is camera-relative and differs from simply drawing a sphere centered at
|
||||||
|
JimmyRoot. Zero-length normalization/imported-vector rounding remains open.
|
||||||
|
|
||||||
|
Generic input438B1E..438B98 maps movement modes1 **and2** to shared439900, while
|
||||||
|
mode0 maps438BC0 and3 maps43A120. The prior air-steering recovery of439900 is useful,
|
||||||
|
but does not close Bubble's complete jumping/body/mode transition behavior.
|
||||||
|
Supported Jimmy wrapper4246A9..4246E3 explicitly restores live radius160/raw mode0
|
||||||
|
or60 otherwise, before the later movement/fire phases. A live Bubble integration
|
||||||
|
must preserve source authored/live radii and movementmode2, including support.
|
||||||
|
|
||||||
|
Ordinary primary fire4266AC rejects raw mode0 before controller-speed-zero,
|
||||||
|
SHOOT and the ray scan. Jetpack dispatch also skips raw mode0 at4260D3. Bubble
|
||||||
|
must not keep the ordinary beam or powered-jump path active merely because item3
|
||||||
|
is owned. Other generic movement/jump paths still need caller-complete recovery.
|
||||||
|
Source callbacks42A870 and42A8D0 return early for raw mode0 before their energy/
|
||||||
|
score/flash effects, and42AB0E skips an additional SFX190. Their complete callers/
|
||||||
|
meaning are not traced here; this establishes specific bypasses, **not** universal
|
||||||
|
invulnerability against every hazard, actor or script.
|
||||||
|
|
||||||
|
## Sprite transitions — recovered, with numeric projection limits
|
||||||
|
|
||||||
|
410AE0 first increments float timer600 bydt, then processes flags in priority
|
||||||
|
order active614, expanding615, collapsing616:
|
||||||
|
|
||||||
|
- **Active:** pulse=sin(timer*10)*30; width=(float)integer57C=240 and height=240+pulse.
|
||||||
|
If509A13 is true, RGBA becomes(1,1,1,0.5); otherwise existing RGBA is retained.
|
||||||
|
This does not geometrically scale Jimmy or the sprite during fade.
|
||||||
|
- **Expanding:** scalar610=timer; strictly `timer>double1` clamps scalar1, sets
|
||||||
|
active614 and clears expanding615. RGBA=(scalar,scalar,scalar,scalar).
|
||||||
|
At exactly1 it remains expanding until a later update.
|
||||||
|
- **Collapsing:** scalar610=1−timer; strictly scalar<0 clamps0, clears collapsing616
|
||||||
|
and hides the sprite. RGBA=(scalar,scalar,scalar,scalar). Exactly0 retains collapse
|
||||||
|
until a later update. Stop410D00 sets collapsing616, clears active614 and timer0;
|
||||||
|
Jimmy cleanup must additionally clear expanding615 or expansion retains priority.
|
||||||
|
|
||||||
|
The Python projection retains these state/strict-boundary distinctions and
|
||||||
|
single-precision stored values. It does not claim x87 intermediate/fsin bit parity
|
||||||
|
or original runtime observations. Blending both RGB and alpha during fade can
|
||||||
|
change perceived brightness; replacing it with alpha-only is a behavior change.
|
||||||
|
|
||||||
|
## Validation, current implementation and next action
|
||||||
|
|
||||||
|
Six Python source-contract groups pass in `artifacts/bubble/tests.log`: original
|
||||||
|
identity/span/site/virtual guards and offsets, equip order/flags, movement2 drain,
|
||||||
|
strict expand boundary/color without size scaling, active pulse/graphics alpha,
|
||||||
|
and cleanup priority/strict-negative collapse. This is static/source-projection
|
||||||
|
validation, not native Bubble gameplay or an original game capture.
|
||||||
|
|
||||||
|
The port's group0 selection/practice already exposes Bubble, but **this agent made
|
||||||
|
no runtime changes**. Raw mode0 radius160 is a named future case; the existing
|
||||||
|
ordinary static Jimmy body subset must not be advertised as complete Bubble
|
||||||
|
physics. Recommended next coherent implementation: retain an owned sprite with
|
||||||
|
original Canv1, source transition flags and camera-relative placement; integrate
|
||||||
|
source radius/factor/maxspeed/movement2/ordinary-fire cancellation together,
|
||||||
|
including source cleanup650, controlled−0.5dt and independent visual clock.
|
||||||
|
First recover the generic mode2 jump/body transitions and actual VR01 support/
|
||||||
|
collision class coverage, then test equip→expand→move/jump→empty/Tab cleanup→fade
|
||||||
|
and tutorial/RETURN persistence. Full hazard/AI immunity and renderer orientation
|
||||||
|
remain explicit gates. Invisible is the primary's selected next playable slice;
|
||||||
|
this Bubble contract is ready for that later chunk without speculative physics.
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
# Bubble / Invisible resource and tutorial follow-up
|
||||||
|
|
||||||
|
2026-11-01. Original asset parsing, decoded-pixel inspection and local REA static
|
||||||
|
analysis. Originals remain untouched. This report does not establish original
|
||||||
|
gameplay execution, enemy detection, tutorial completion or native Windows runtime.
|
||||||
|
Primary selected Invisible as the next bounded gameplay implementation; Bubble
|
||||||
|
resource observations are retained for the later effect.
|
||||||
|
|
||||||
|
## Evidence and reusable output
|
||||||
|
|
||||||
|
`tools/extractors/gadget_followup_assets.py` inventories exact original resources,
|
||||||
|
seven current Jimmy clips and both authored tutorials. It retains archive/payload
|
||||||
|
hashes, resource byte offsets, GAM property offsets/raw bytes and duplicate tags.
|
||||||
|
It also guards the source image identities and eight bounded meter code spans.
|
||||||
|
No game code is executed by this utility. Generated report and inspected images:
|
||||||
|
`artifacts/gadget-followup-assets/resources.json`, `orangebubble.png`,
|
||||||
|
`controls_109.png`, `controls_111.png`, `canvas_21.png`, `canvas_22.png`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 tools/extractors/gadget_followup_assets.py ../Original \
|
||||||
|
--output artifacts/gadget-followup-assets/resources.json \
|
||||||
|
--meter-output artifacts/extracted/invisible-meter
|
||||||
|
python3 -m unittest discover -s tests -p test_gadget_followup_assets.py -v
|
||||||
|
```
|
||||||
|
|
||||||
|
`export_meter(original, output)` writes `meter.json` schema1, reference640×480,
|
||||||
|
exactly two texture records and original decoded RGBA/PNG files. Records contain
|
||||||
|
id/name/width/height/path/png/sourceOffset/sourceBytes/sourceSha256/rgbaSha256.
|
||||||
|
Both names/dimensions are checked before any files are written. Original root,
|
||||||
|
its subtrees and ancestor outputs are rejected. Pixel files are neither recolored
|
||||||
|
nor resized; state/tint/geometry belong to the caller. Six checks pass in
|
||||||
|
`artifacts/gadget-followup-assets/tests.log`: exact assets, tutorial source offsets,
|
||||||
|
duplicate identity, output protection, pixel export and guarded meter spans.
|
||||||
|
|
||||||
|
## Invisible uses the existing Jimmy family — asset facts
|
||||||
|
|
||||||
|
`png/jimycarl.png` is256×256; all65,536 texels have alpha255. The existing
|
||||||
|
prepared Jimmy atlas therefore has no translucent source pixels to replace for
|
||||||
|
this effect. Source `jimstop.ASE` has426 vertices/814 faces, two samples at10fps,
|
||||||
|
480 ticks/frame, and supplies3,551 UV entries/814 UV faces. `jimrun`,
|
||||||
|
`jimbackpedal`, `jimjump`, `jimfall`, `jimfly` and `jimshoot` have the same
|
||||||
|
vertex/face counts and no UV tables; existing preparation uses the standing UV
|
||||||
|
topology. This report verifies counts and resource identity, not every morph's
|
||||||
|
original interpolation phase.
|
||||||
|
|
||||||
|
No additional ASE or PNG is required for the recovered Invisible material path.
|
||||||
|
[Invisible source](invisible.md) owns the activation/timer/state interpretation;
|
||||||
|
[material report](gadget-blending.md) already traces complete slot114→40E4A0
|
||||||
|
positive RGBA/material alpha and source blend enums. Existing port fragment
|
||||||
|
cutout occurs before multiplying material opacity, so alpha0.7 does not discard
|
||||||
|
this fully opaque source atlas. Original fixed-function alpha-test interaction
|
||||||
|
and full material-state parity remain separate renderer questions.
|
||||||
|
|
||||||
|
The original control strip Canv111 `BmenuLInvisible` visibly labels primary mouse
|
||||||
|
and Ctrl as INVISIBLE. Bubble strip109 separately labels mouse movement/forward,
|
||||||
|
jump and Ctrl/Insert keyboard equivalents. These inspected pixels corroborate
|
||||||
|
the input descriptions; they do not establish a held/edge policy, timers or
|
||||||
|
power consumption. Menu/HUD resources already exported for both items are in
|
||||||
|
[gadget assets](gadget-assets.md); no invented icons are needed.
|
||||||
|
|
||||||
|
## Recharge-meter resources and source chain
|
||||||
|
|
||||||
|
Original `screens.omt` SHA256:
|
||||||
|
`e8e95231f5d302b41f4fbf33df1c5a08ce4645370f9f519527ff1727b73b7a5e`.
|
||||||
|
|
||||||
|
| Canvas | Source offset / bytes | Exact decoded dimensions |
|
||||||
|
| --- | --- | --- |
|
||||||
|
|21 `meter` |0x88E18 /8118 |30×110, border/backplate |
|
||||||
|
|22 `metercolor` |0x8C5D8 /9138 |30×110, original multicolor fill |
|
||||||
|
|
||||||
|
REA inspected private hashed copies. EXE identity is
|
||||||
|
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`;
|
||||||
|
DLL identity is `3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943`.
|
||||||
|
Complete replies, exports and closed snapshots are in
|
||||||
|
`artifacts/gadget-followup-assets/rea-meter/` and `rea-meter-dll/`.
|
||||||
|
The renderer/alignment follow-up is exported/closed in `rea-meter-surface/`.
|
||||||
|
|
||||||
|
| Source function | REA Evidence |
|
||||||
|
| --- | --- |
|
||||||
|
|401430 menu construction |`ev_e7355ffccf1c4066e58d93e229e4a89662e01045e555d178cb2c11b1ddb5b42b` |
|
||||||
|
|402D70 canvas placement |`ev_37b8296fe0ea52d6b1d36ba096c60700a7dca3986cb7966b8d6d2884253bf4f0` |
|
||||||
|
|4037F0 meter percent |`ev_525ca303ce70c16f524063053ebdd9fecd82054cf480d8f2f30f1ec0d7e08333` |
|
||||||
|
|DLL10029430 canvas render |`ev_f133d0c29cd7b2969814c4b89df37e369776d954543980c93dc69bc3ccb7e579` |
|
||||||
|
|DLL10029180 canvas construction |`ev_856445a19d924cf5ec157575da27686731caca9a1a611895a98d269fe31c4b03` |
|
||||||
|
|DLL10037AC0 draw_surface |`ev_143b978a715b32486294f27aa987c926c0cf8f52e09a2116b81ec34803d9962b` |
|
||||||
|
|DLL10029870 update_logic |`ev_5021f9ff80b9087cafdf449976e363921d6159833f003efe15870f24932d8343` |
|
||||||
|
|DLL10029890 compute_auto_align |`ev_b963c3e443054b1425af94a27efd37cc157f6dd2070d2d87cbb2a78f72dc083e` |
|
||||||
|
|DLL10029930 get_canv_wordsize |`ev_d766e30f3466351eaea497f58546f564563849cf9fdc269c42b131c01ac542a5` |
|
||||||
|
|
||||||
|
Constructor401430 opens `omt/screens.omt` and binds global4F7CB0 to canvas21 at
|
||||||
|
4017CB, global4F8028 to canvas22 at401865 through402D70→menu454/402E30. Literal
|
||||||
|
coordinate arguments are(320,7) and(322,4). Constructor sets sprite source blend6,
|
||||||
|
destination1 or7 according to graphics509A13; RGBA initiallywhite. Runtime
|
||||||
|
menu484/488 show/hide both;48C/490 change fill tint to red(1,.2,.2,1)/white.
|
||||||
|
Those latter caller/state branches are guarded by [Invisible](invisible.md).
|
||||||
|
|
||||||
|
4037F0 (raw0x37F0) clamps only negative percent to0, writes fill width
|
||||||
|
`screenWidth/640*27`, and height `screenHeight/480*percent*1.04`. Global4F6560 is
|
||||||
|
screen width,4F655E height. The multiplier at48D908/raw8D908 is a stored double
|
||||||
|
**1.04**, not0.01. At100 percent the logical height is104. Width/height are fields
|
||||||
|
AC/B0; source sprite placement44/48 stays separate. No forced100 clamp is proven
|
||||||
|
in this leaf. Caller supplies the actual timer/recharge conversion.
|
||||||
|
|
||||||
|
Texture resize is **full-image stretch**, not percentage UV cropping. Canvas
|
||||||
|
render10029430 obtains custom AC/B0 dimensions when flagC4 bit0 is set, then
|
||||||
|
forwards the original canvas, cached offsets, dimensions and RGBA90 to renderer
|
||||||
|
slotB0.402D70 sets flagC4 to1. DX draw_surface10037AC0 builds a rectangle using
|
||||||
|
the supplied width/height, with source UV0..0.9999 for the single-texture path;
|
||||||
|
the tiled path distributes the complete source canvas across those dimensions.
|
||||||
|
Percentage does not enter UV selection. The modern texture uses0..1 over the
|
||||||
|
exact decoded image; legacy edge epsilon/texture padding remain renderer details.
|
||||||
|
The tint multiplies this original gradient once; no replacement solid fill or
|
||||||
|
partial-source gradient crop is evidenced. Source48C/490 tint leaves are already
|
||||||
|
in the guarded192-byte meter_tint span0x3730..37F0.
|
||||||
|
|
||||||
|
Modern layout policy: interpret the source coordinates using a640×480 logical
|
||||||
|
viewport with uniform widescreen scale, background rectangle(320,7,30,110),
|
||||||
|
fill width27 and bottom114/top `114−1.04*percent`. This preserves source initial
|
||||||
|
bottom placement while changing height. It is explicitly not a fully closed
|
||||||
|
original pixel-position recovery:402D70 writes alignment modesBC/C0=3;
|
||||||
|
constructor initializes cached offsetsA0/A4=0, while engine update_logic10029870
|
||||||
|
can recompute−half-size offsets through10029890. Canvas render forwards cached
|
||||||
|
offsets and dimensions. Whether these menu sprites enter that engine logic pass,
|
||||||
|
and the exact frame of recomputation, remain unresolved. Pseudocode for402D70
|
||||||
|
has incorrectly recovered parameters; its arguments/formulas above are checked
|
||||||
|
against the guarded instructions, not copied from its prototype.
|
||||||
|
|
||||||
|
## Original tutorial fixtures
|
||||||
|
|
||||||
|
| Data | VR01 Bubble | VR03 Invisible |
|
||||||
|
| --- | --- | --- |
|
||||||
|
|GAM SHA256 |`7938214fb62784fcb34245491342a5f33e3615bdc178e4883a9e285e6869904f` |`8acc4d3b8c416c41c1900ac0b1f895ab5819781e5dd87d19a1f177414660d5b2` |
|
||||||
|
|Entity count |16 |67 |
|
||||||
|
|Scene shape |`VRRoom`,60 vertices/80 triangles |`Box01`,280 vertices/424 triangles |
|
||||||
|
|PHONEBOOTH STRT offset |0x45C |0x406 |
|
||||||
|
|Authored root |(−2678.0381,87.3322,−2783.4011) |(−292.9982,160.3451,−2467.5544) |
|
||||||
|
|Yaw |290 |290 |
|
||||||
|
|Intro |`bu`,3MCA0xA61 |`inv`,3MCA0x8EEE |
|
||||||
|
|Voicepractice IDs |24/23/22 |21/20/37 |
|
||||||
|
|Return LOAD offsets |0x83C radius400;0x1631 radius300 |0x94DE radius300 |
|
||||||
|
|
||||||
|
Both intros serialize PlayerControlled=NULL and NextTrigger=default. VR01 has
|
||||||
|
DeactivateInv=1; VR03 omits that property. Absence is not evidence forfalse;
|
||||||
|
the constructor/default binding is documented separately by the Invisible
|
||||||
|
investigator. VR03 source SoundIndex0/1/2 properties occur at0x90F7/0x9176/0x91F5.
|
||||||
|
The voice bank also contains invisibility4/ID38, but this intro does not use it.
|
||||||
|
|
||||||
|
VR03 contains eight actual3SOL at source offsets0x7BA,14B0,1EB7,342B,4828,4D2F,
|
||||||
|
5736,633B. All share ObjectTag `C3DYOKIANSOLDIER`; keep actor identity by instance/
|
||||||
|
source offset, never collapse them into one dictionary/tag lookup. Each serializes
|
||||||
|
AIState2, VisibleRange2500,FOV359,TargetNameJIM1. These data values do not recover
|
||||||
|
the target-detection algorithm or prove combat/AI is implemented.
|
||||||
|
Literal patrol links contain two missing names: yok3→`tok4`, and soldier0x5736
|
||||||
|
starts at `fyoy1`; supplied patrols contain `yok4`/`fyok1`. Preserve these original
|
||||||
|
strings rather than silently repairing them. VR01 contains no3SOL.
|
||||||
|
|
||||||
|
A meaningful bounded Invisible fixture can load actualVR03/PHONEBOOTH, skip or
|
||||||
|
complete its source intro, and exercise equipped/ready/activation/expiry/recharge/
|
||||||
|
cleanup against the current player, atlas and meter. It must establish item2
|
||||||
|
availability through the existing inventory/PostLoad contract. No fake enemy or
|
||||||
|
invented vision/combat response is needed to verify this first effect. Tutorial
|
||||||
|
navigation, stealth detection and trophy/RETURN completion remain separate tests.
|
||||||
|
|
||||||
|
## Bubble assets retained for later
|
||||||
|
|
||||||
|
`RetainedSprites.omt` Canv1 `orangebubble` at0x17FCE/66322 bytes decodes146×146,
|
||||||
|
with15,824 opaque and5,492 transparent pixels. RGBA SHA256:
|
||||||
|
`a3a678c47c1ce94946b1136560a84f3ef86c6884b981256a9fbff62fe8a988e4`.
|
||||||
|
This is confirmed by the Bubble constructor's explicit archive/ID binding, not
|
||||||
|
just its name: [Bubble report](bubble.md), constructor410840 REA
|
||||||
|
`ev_a0c9ee6d5757a741190f3dfcc093bdc7d7b802bcdcd2cbc029422550d34e7cb2`,
|
||||||
|
saved/exported/closed in `artifacts/bubble/rea-effect/`. No new ASE is indicated.
|
||||||
|
SoundEffects Wave2/3/106 are gravitybubble/gravitybubbleoff/bubble boing; serialized
|
||||||
|
resource identities alone do not establish repeat/stop ownership. Bubble pulse,
|
||||||
|
growth/fade/collision and billboard orientation belong to that system report.
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
# First playable gadget implementation
|
# First playable gadget implementation
|
||||||
|
|
||||||
|
Historical first slice. [Invisible continuation](invisible-implementation.md)
|
||||||
|
supersedes its unimplemented Invisible/shared energy-warning items; other limits
|
||||||
|
below remain scoped to the recorded2026-10-27 implementation.
|
||||||
|
|
||||||
2026-10-27. User-directed gameplay continuation; collision checkpoint35a2a66/
|
2026-10-27. User-directed gameplay continuation; collision checkpoint35a2a66/
|
||||||
0272f7b remains parked. This implements the original gadget screen and the combined
|
0272f7b remains parked. This implements the original gadget screen and the combined
|
||||||
shrink-ray/jetpack device, with a bounded3SOL target consumer. It does not complete
|
shrink-ray/jetpack device, with a bounded3SOL target consumer. It does not complete
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# Invisible gameplay continuation
|
||||||
|
|
||||||
|
2026-11-02. Implements original item2/raw mode2 and shared energy warnings.
|
||||||
|
Collision recovery remains parked at35a2a66/0272f7b; the preceding gadget
|
||||||
|
source/packages7b5230c remain a separate verified milestone.
|
||||||
|
|
||||||
|
## Coverage and evidence
|
||||||
|
|
||||||
|
| System | Original contract | Port / remaining boundary |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Selection428E51 | Display2 precedes actual equip;9F8 tutorial override | Failed equip can retain display2/raw−1; successful equip starts both clocks0 |
|
||||||
|
| Wrapper424E80 | After base movement; any controlled pointer | Separate from Jimmy input identity; raw NULL freezes/hides meter |
|
||||||
|
| Activation | Recharge exactly7, energy>2/override, fixed−2 | Initial7-second recharge;7-second active timer; held reactivation; jump blocks activation only |
|
||||||
|
| Material114/FC/target55D | Alpha.7, indexed blend flash; target eligibility | Existing Jimmy draw; targetability retained, full enemy AI consumers absent |
|
||||||
|
| Meter4037F0 | Canv21/22, full gradient stretch, size/tint | Exact original pixels; logical placement/uniform scale is declared modern policy |
|
||||||
|
| Companion/cleanup427FF0 | Immediate hide, D0/214 flags,9E8 restore guard | Separate movement/body flags; body integration gated without blanket AI pause |
|
||||||
|
| CAM4165B7/MCA43129A | Default DeactivateInv1, named Jimmy lookup | Prelude separate from raw438 preparation; AI-null retains effect |
|
||||||
|
| Energy42A920 | Scalar4F83D4 and warning latch4F83DC | Shared owner and80/182 callback order/hysteresis across ordinary loads |
|
||||||
|
| Bubble follow-up | Equip/visual/drain/cleanup recovered | Runtime pending full movementmode2/jump/body contract |
|
||||||
|
|
||||||
|
Static reports retain hashes, VAs/file offsets, guarded bodies/sites, complete
|
||||||
|
REA Evidence, exports/snapshots and provider errors: [Invisible](invisible.md),
|
||||||
|
[assets/meter](gadget-followup-assets.md), [shared energy](player-energy.md),
|
||||||
|
[independent review](invisible-review.md) and [Bubble](bubble.md). No new whole
|
||||||
|
original-game execution was performed. The retained complete42A920 REA record
|
||||||
|
was reused rather than repeating that investigation.
|
||||||
|
|
||||||
|
## Implementation and ownership
|
||||||
|
|
||||||
|
LabSimulation owns InvisibleGadget and invokes it after controlled movement,
|
||||||
|
before its existing owned jetpack-effect phase. PlayerSceneBinding supplies both
|
||||||
|
Jimmy input permission and raw-any-control. Another controlled actor permits
|
||||||
|
this wrapper without granting Jimmy movement. Raw NULL freezes both timers and
|
||||||
|
hides the meter without ending the material effect. The pure recovered suppressor
|
||||||
|
branch is tested, but source globals4F8182/4F83E0 have no complete lifecycle
|
||||||
|
provider yet. Existing modal/focus/debug capture remains a broader port policy.
|
||||||
|
|
||||||
|
Successful equip hides Goddard immediately, starts both timers0 and colors/shows
|
||||||
|
the meter red. Initial recharge must reach exactly7 before a later tick can
|
||||||
|
activate. Held primary without jump requires energy strictly>2 or the tutorial
|
||||||
|
override, spends fixed2, sets remaining7/targetablefalse/alpha.7, then decrements
|
||||||
|
remaining in the same invocation. No continuous Invisible drain, invented sound
|
||||||
|
or edge latch is added. Ordinary jumping remains possible.
|
||||||
|
|
||||||
|
At remaining<=3, trunc(remaining×5)%2 selects conventional versus additive blend
|
||||||
|
on material0. Expiry<=0 restores opaque/targetable/red; recharge begins next tick.
|
||||||
|
The additive initial branch follows the existing chosen source graphics-option
|
||||||
|
path; its original option predicate remains open. Blended world depth writes
|
||||||
|
remain disabled as an explicit renderer policy. Captures verify port output,
|
||||||
|
not original visual parity or self-occlusion equivalence.
|
||||||
|
|
||||||
|
PlayerGadgetMaterial changes the existing atlas draw without changing pose,
|
||||||
|
geometry or authored visibility. InvisibleMeterOverlay uses exact Canv21/22 RGBA,
|
||||||
|
source width27/height percent×1.04, white/red vertex tint and full texture stretch.
|
||||||
|
Percentage is published before recharge clamps7, preserving its small ready
|
||||||
|
overshoot. Source local positions become centered640×480 logical rectangles
|
||||||
|
with uniform widescreen scale. Cached engine autoalignment scheduling is still
|
||||||
|
open; original pixel-placement fidelity is not claimed.
|
||||||
|
|
||||||
|
SceneDirector emits named-Jimmy GadgetReleaseRequested at initial CAM/MCA
|
||||||
|
activation when DeactivateInv is absent/true, before first MCA target/skip checks.
|
||||||
|
This differs from ordered raw-owner438/410/flatten callbacks. Explicit0 can bypass
|
||||||
|
the named prelude; raw-owner preparation can still clean. AI-null stops motion
|
||||||
|
and clears control without invented cleanup. Release stores remaining7/recharge0
|
||||||
|
and restores local state. Modern reset clears timers/diagnostics explicitly.
|
||||||
|
|
||||||
|
Companion movement/body-enable fields are distinct from AI Active. Equip disables
|
||||||
|
both and hides Goddard; cleanup restores them outside the six proven PostLoad9E8
|
||||||
|
blocked levels. ActorPatrol skips disabled body integration while retaining its
|
||||||
|
bounded AI subset. Independent future writes to movement/body flags, full
|
||||||
|
companion lifecycle and other AI modes remain separate work.
|
||||||
|
|
||||||
|
PlayerEnergy retains scalar and warning latch across ordinary scene rebuilds.
|
||||||
|
Ray, active jetpack and Invisible share tutorial bypass, empty-crossing80 before
|
||||||
|
write, low182 after scalar/before latch, strict<19 warning and>20 rearm. Raw saved
|
||||||
|
scalar/debug refill does not invent a latch reset. TSK retains its original
|
||||||
|
scalar only; complete damage/energy/pickup consumers remain unported.
|
||||||
|
|
||||||
|
## Controls and verification
|
||||||
|
|
||||||
|
Select owned Invisible in Tab/Space, wait for recharge, then hold Enter/Ctrl/left
|
||||||
|
mouse without jump. F1→Player adds Give/Select Invisible, Unequip and timer/
|
||||||
|
targetability diagnostics. F1 retains the existing gameplay/audio pause policy;
|
||||||
|
Tab while a special gadget is equipped unequips first.
|
||||||
|
|
||||||
|
Fifteen managed groups cover numeric/sound order, retained energy ownership,
|
||||||
|
strict gates, same-tick decrement, held activation, flash/expiry, raw-null/other
|
||||||
|
owner distinctions, named cleanup, companion restoration, failed display/raw
|
||||||
|
equip separation and original meter/widescreen geometry. Source coverage grows
|
||||||
|
to182 Python checks plus separate HUD tests. Independent review ran the earlier
|
||||||
|
12 groups before the final three binding/meter groups were added.
|
||||||
|
|
||||||
|
The eight-frame --smoke-invisible fixture explicitly advances836 additional
|
||||||
|
normal player ticks between rendered phases. It grants owned item2 and skips the
|
||||||
|
intro without relocating actors or directly mutating timers/materials. Headless
|
||||||
|
and native1920×1080 GTX1070/private Xvfb pass charged, activated, alpha flash,
|
||||||
|
additive flash, expired and unequipped checks; native uses real SDL Ctrl/Tab.
|
||||||
|
Tutorial energy stays20. Both report zero enabled Vulkan validation errors.
|
||||||
|
Six-phase captures were inspected. Logs/captures: artifacts/gadget-followup/.
|
||||||
|
|
||||||
|
These accelerated observations do not establish real-time original cadence,
|
||||||
|
manual navigation, enemy immunity, tutorial completion or native Windows runtime.
|
||||||
|
Complete scripts/test.sh passes182 Python+2 HUD checks, all managed suites,
|
||||||
|
30 main GPU completions and17 isolated Vulkan material checks, with zero enabled
|
||||||
|
validation errors. SDL dummy lifecycle and539 unchanged originals pass. Package
|
||||||
|
results follow the clean source milestone in progress.md. Full enemy sensing/
|
||||||
|
combat, graphics-option selection, cached canvas
|
||||||
|
alignment, exact scheduler/x87 boundaries and the other gadgets remain open.
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
# Invisible implementation review
|
||||||
|
|
||||||
|
2026-11-01. Independent read-only review of the primary's current Invisible/energy
|
||||||
|
runtime against [invisible.md](invisible.md), retained companion/preparation
|
||||||
|
evidence and the original42A920 instructions. Reviewed files:
|
||||||
|
InvisibleGadget, PlayerEnergy, LabSimulation, PlayerSceneBinding,
|
||||||
|
PlayerGadgetMaterial, SceneDirector, ActorPatrol, Program and InvisibleTests.
|
||||||
|
The reviewer edits only this report; primary owns fixes and integration.
|
||||||
|
|
||||||
|
## Directly evidenced correction found and resolved
|
||||||
|
|
||||||
|
The initial SceneDirector only released gadgets through current raw-owner438
|
||||||
|
preparation. Original CAM4165B7..4165DC and MCA43129A..4312CC separately inspect
|
||||||
|
DeactivateInv and look up **JIM1**, even when the controlled pointer is already
|
||||||
|
NULL or another actor owns it. Both constructors default the property1; absent
|
||||||
|
GAM data does not mean false. MCA's prelude runs before its first target-none
|
||||||
|
branch. The initial implementation could therefore retain active Invisible
|
||||||
|
through a CAM/MCA where original code cleans it.
|
||||||
|
|
||||||
|
Primary added GadgetReleaseRequested with an explicit JIM1 lookup and
|
||||||
|
Integer("DeactivateInv",1) at single-CAM/initial-MCA activation, before target/
|
||||||
|
skip checks. PlayerSceneBinding subscribes and uses existing selected-gadget
|
||||||
|
cleanup. Re-reading confirms that correction is present. Existing ordered raw
|
||||||
|
438/410/flatten preparation remains separate. Later MCA shot changes do not
|
||||||
|
repeat the initial prelude. AI-null still dispatches410 without invented438/
|
||||||
|
gadget cleanup; its raw-null pause can retain Invisible state as source does.
|
||||||
|
|
||||||
|
## Confirmed source alignment
|
||||||
|
|
||||||
|
- Invisible runs immediately after the player movement phase and before the
|
||||||
|
existing owned effect phase. AnyControlled is passed separately from Jimmy
|
||||||
|
input ownership. Null raw control freezes timers/hides the meter; a different
|
||||||
|
nonnull owner can permit the wrapper without permitting Jimmy movement.
|
||||||
|
- Equip accepts energy>0 or VR override. Display selection2 is retained even
|
||||||
|
when the actual raw-mode equip rejects; caller cleanup removes the old special
|
||||||
|
mode first. Successful equip resets both clocks0. Unequip stores remaining7,
|
||||||
|
recharge0 and restores opaque/targetable presentation; modern full reset
|
||||||
|
starts0 and clears diagnostic counts explicitly.
|
||||||
|
- Activation uses remaining0 and recharge exactly7, primary without jump,
|
||||||
|
energy strictly>2 or override, one fixed−2 adjustment and same-call remaining
|
||||||
|
decrement. Initial recharge must complete first; reaching7 cannot activate
|
||||||
|
until the next invocation. Held primary can reactivate after another recharge.
|
||||||
|
- Recharge runs only with remaining0 and positive energy/override, clamps7 and
|
||||||
|
turns the meter white. Expiry<=0 restores opaque/targetable/red; recharge
|
||||||
|
starts next call. Active duration continues at zero energy or during jumps.
|
||||||
|
- Opacity0.7, additive initial branch and last3s alternating conventional/
|
||||||
|
additive blend match the guarded material path. Expiry argument0 means reset
|
||||||
|
material alpha1/blend-disabled, not alpha0. The one-atlas Jimmy draw keeps
|
||||||
|
authored visibility and geometry; no invented whole-model hide/fade is used.
|
||||||
|
- PlayerEnergy implements strict19/20 warning hysteresis, empty-crossing sound80
|
||||||
|
before the scalar write, low182 after the write/before latch and VR01..08
|
||||||
|
helper bypass. The scalar and warning latch share a session owner across
|
||||||
|
ordinary loads; raw saved/debug scalar assignment does not rearm the helper.
|
||||||
|
The upper clamp compares the pre-store sum, and callback-driven scalar changes
|
||||||
|
are respected by reloading after the crossing callback, as source42A975 does.
|
||||||
|
- Companion hide/disable occurs on equip, including recharge, not on activation.
|
||||||
|
The binding preserves distinct AI activation, body-enable and movement-enable
|
||||||
|
fields. Its six-level restore exclusion matches the bounded PostLoad9E8
|
||||||
|
mapping; it does not restore a saved previous visibility or blanket-pause AI.
|
||||||
|
|
||||||
|
## Explicit remaining boundaries
|
||||||
|
|
||||||
|
1. The pure Invisible suppressor branch is implemented/tested, but LabSimulation
|
||||||
|
currently supplies no provider for source global4F8182, nor the primary helper's
|
||||||
|
independent4F83E0 veto. Modern modal/focus/debug capture clears input/pauses
|
||||||
|
simulation. Those policies do not establish the complete original global
|
||||||
|
suppression lifecycle; document this as partial input coverage.
|
||||||
|
2. Source55D/49D target eligibility is stored/observable, but full enemy sensing,
|
||||||
|
lost-target, existing attack and class-specific consumers are absent. Generic
|
||||||
|
409CC0 also permits positive enemy934 when the flag is false. Do not describe
|
||||||
|
the slice as universal enemy avoidance or invulnerability.
|
||||||
|
3. Companion9E8 is represented by known initial level policy. Later source
|
||||||
|
setters/dynamic modes remain outside this bridge. MovementEnabled is stored
|
||||||
|
but has no independent modern consumer yet; the bounded equip/cleanup path
|
||||||
|
writes it together with BodyEnabled, which gates body integration. Independent
|
||||||
|
changes to only one flag require their original consumers before expansion.
|
||||||
|
4. Additive is the declared graphics509A13=false branch. The original setting
|
||||||
|
predicate, general multi-material/LOD behavior, transparent depth state,
|
||||||
|
original registry cadence and exhaustive x87 meter boundaries remain open.
|
||||||
|
Existing full-panel/noclip pauses and full scene rebuild are modern policies.
|
||||||
|
5. Meter resources/layout are being integrated by primary from the independent
|
||||||
|
asset report. This review does not certify that unfinished overlay or final
|
||||||
|
native/packaged renders. Full game and native Windows comparison remain open.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
The reviewer independently ran the current twelve managed Invisible/energy groups
|
||||||
|
successfully using the existing project SDK, logged in
|
||||||
|
`artifacts/invisible/runtime-review-tests.log`. That run covers energy callback
|
||||||
|
ordering/hysteresis/retention/tutorial bypass, first recharge, activation strict
|
||||||
|
threshold/jump, raw-null/suppressor pause, flash/expiry, repeated held activation,
|
||||||
|
cleanup and material mapping. It predates the primary's additional binding/
|
||||||
|
companion fixtures. Nine source/static-projection groups independently pass in
|
||||||
|
`artifacts/invisible/tests.log`; these do not execute original code.
|
||||||
|
|
||||||
|
Final integration should retain explicit fixtures for raw-other-owner activation
|
||||||
|
without Jimmy movement, AI-null freeze, named-Jimmy CAM/MCA cleanup while already
|
||||||
|
raw-null, DeactivateInv default/explicit0, failed equip/display separation and
|
||||||
|
companion restore restrictions. Primary owns those runtime additions and the
|
||||||
|
complete suite, actual SDL/GPU input/readback, builds and release evidence.
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
# Invisible gadget source contract
|
||||||
|
|
||||||
|
2026-11-01. Original item2/raw mode2. This report records static recovery and
|
||||||
|
bounded source projections; it does not claim original gameplay execution, port
|
||||||
|
integration or native platform verification. Original files were read only.
|
||||||
|
|
||||||
|
## Evidence and addresses
|
||||||
|
|
||||||
|
EXE SHA256 is `f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||||
|
`tools/binary/invisible.py ../Original` guards seven complete bounded spans,
|
||||||
|
50 decisive instruction slices, eight virtual bindings and six constants. Its
|
||||||
|
`artifacts/invisible/source-contract.json` records preferred VAs, PE-mapped file
|
||||||
|
offsets, bytes and hashes. All code addresses below map to file offset VA−400000;
|
||||||
|
the helper computes rather than assumes that mapping. Main source callers and
|
||||||
|
state fields are distinct from the display item index documented in
|
||||||
|
[gadget-controls.md](gadget-controls.md).
|
||||||
|
|
||||||
|
REA/Ghidra12.1.4 inspected a generated hashed EXE copy. Complete replies,
|
||||||
|
Evidence export and closed-session snapshot are retained in
|
||||||
|
`artifacts/invisible/rea-invisible-ipc/`:
|
||||||
|
|
||||||
|
| Procedure | REA Evidence |
|
||||||
|
| --- | --- |
|
||||||
|
|40E4A0 linked-model alpha/material setter|`ev_615030aa60b2346083853c40aa719ebc466e9f393fd870ea9722536a4f64cfac`|
|
||||||
|
|409CC0 generic enemy target predicate|`ev_1c4fe58878638158ea6f33db1474848910256873c00f266968debbf2ea35bf3f`|
|
||||||
|
|4037F0 meter size setter|`ev_525ca303ce70c16f524063053ebdd9fecd82054cf480d8f2f30f1ec0d7e08333`|
|
||||||
|
|
||||||
|
424E80 and427FF0 entry queries were unrecognized and returned input/mapping
|
||||||
|
errors; no pseudocode is attributed to them. Their bounded instructions, vtable
|
||||||
|
targets, branches and exact source identity supply the contracts below. The
|
||||||
|
earlier default-sandbox batch (`rea-update/`) failed Ghidra's Unix-socket bind;
|
||||||
|
its diagnostics and closed snapshot are retained, and `doctor.json` records the
|
||||||
|
diagnostic follow-up. Local IPC permission fixed that host restriction without
|
||||||
|
changing REA/client configuration or executing the target. Both sessions closed.
|
||||||
|
|
||||||
|
## State owners and update order — recovered
|
||||||
|
|
||||||
|
Jimmy complete-object vtable4A3BDC has1C8→424E80,178→427FF0,
|
||||||
|
FC→40DD40(indexed material blend) and114→40E4A0(all linked materials alpha).
|
||||||
|
Global signed WORD4F0588 is equipped mode. Menu display2 is separate.
|
||||||
|
|
||||||
|
| Jimmy complete field | Meaning established by this path |
|
||||||
|
| --- | --- |
|
||||||
|
|1E1C float|Remaining Invisible duration; constructor/equip zero, activation7|
|
||||||
|
|1E20 float|Recharge; constructor/equip/activation zero, ready exactly7|
|
||||||
|
|55D byte (=game-interface49D)|AI target visibility/eligibility flag; false while effect active|
|
||||||
|
|9F8 byte (=game-interface938)|Energy override; constructor false, PostLoad true for VR01..08|
|
||||||
|
|A18 pointer|Menu/UI owner|
|
||||||
|
|A1C pointer|Goddard/companion owner|
|
||||||
|
|
||||||
|
Jimmy game-interface frame424600 calls base movement437940 at424C34, then
|
||||||
|
complete slot1C8 at424C3F, then later complete1B4/1B0. Thus Invisible is a Jimmy
|
||||||
|
wrapper phase after movement, distinct from the controlled-input callback and
|
||||||
|
the ordinary ray's input phase. Existing full registry/fixed-step approximation
|
||||||
|
remains separate.
|
||||||
|
|
||||||
|
At424E80 a null controlled pointer5099E4 hides both meter sprites and returns,
|
||||||
|
freezing Invisible timers. Any nonnull controlled pointer passes; the leaf does
|
||||||
|
not compare it with Jimmy's identity. Mode!=2 then returns. Mode2 shows both
|
||||||
|
meter sprites before the remaining activation/timer branches. Menu modal/frame
|
||||||
|
eligibility can stop the enclosing frame before this leaf; do not treat this
|
||||||
|
as proof all menu/audio clocks follow this routine.
|
||||||
|
|
||||||
|
## Equip and activation — recovered
|
||||||
|
|
||||||
|
Selecting item2 reaches428E51 after the menu caller's close/old-gadget cleanup.
|
||||||
|
The display-selection callback already ran at428D97. With energy<=0 and9F8 false,
|
||||||
|
the branch writes raw mode−1 and skips companion/timer/target-flag/meter setup.
|
||||||
|
It still reaches Practice-state handling and may load VR03. Do not restore the
|
||||||
|
old special mode or normalize display2 into raw2 after a rejected equip.
|
||||||
|
|
||||||
|
With energy>0 or9F8 true, equip hides Goddard immediately through complete58(1),
|
||||||
|
sets Goddard gameD0(0) and214(false), writes raw mode2, zeroes both timers, sets
|
||||||
|
Jimmy55D=true and colors/shows the meter red. Goddard stays hidden for the entire
|
||||||
|
equipped mode, including recharge; this is not a shared fade with Jimmy.
|
||||||
|
|
||||||
|
Activation in424EBA..424F68 requires primary helper42A7A0 true and jump helper
|
||||||
|
42A730 false. If global4F8182 is true on that branch, the function returns before
|
||||||
|
either timer advances. Suppression does not freeze a call with primary false or
|
||||||
|
jump true. Otherwise activation requires remaining exactly0, recharge bits
|
||||||
|
exactly float7, and energy **strictly>2** or9F8 true. Failed energy at this ready
|
||||||
|
branch returns. Held primary has no separate edge latch here and can activate
|
||||||
|
again after another completed recharge.
|
||||||
|
|
||||||
|
Success calls42A920 with fixed delta−2, sets remaining7, writes indexed material0
|
||||||
|
blend6/1, applies alpha0.7 to all linked Jimmy materials, clears target flag55D
|
||||||
|
and resets recharge0. The same invocation then decrements remaining bydt. There
|
||||||
|
is no continuous Invisible energy drain, invented fire cooldown or activation
|
||||||
|
sound in this leaf. Shared42A920 may emit its own energy warnings; primary owns
|
||||||
|
that lifecycle. Ordinary jumps are allowed: mode2 is accepted in42A759; no
|
||||||
|
Invisible-specific pose, new model or forced grounded requirement appears here.
|
||||||
|
|
||||||
|
## Timers, meter and material — recovered
|
||||||
|
|
||||||
|
After activation attempt, only remaining==0 and(energy>0 or9F8) grows recharge
|
||||||
|
bydt. The meter receives recharge×stored-float(1/7)×100. At recharge>=7 the fill
|
||||||
|
is colored white, then recharge is clamped to exactly7. Reaching ready during
|
||||||
|
this call permits activation on the **next** invocation.
|
||||||
|
|
||||||
|
Independently, remaining>0 subtractsdt, writes meter percentage
|
||||||
|
max(remaining×stored-float(1/7)×100,0), then expires at remaining<=0. Expiry sets
|
||||||
|
remaining0, indexed blend6/7, alpha-reset argument0, target flagtrue and red meter.
|
||||||
|
It does not grow recharge in that call; recharge resumes on the next invocation.
|
||||||
|
If remaining is still positive and<=3, trunc(remaining×5)%2 selects indexed
|
||||||
|
material0 dest7 when odd, dest1 when even; source factor remains6. This is a
|
||||||
|
blend flash, not alpha on/off, uniform transparency ramp or mesh hiding.
|
||||||
|
|
||||||
|
40DD40(index,source,destination) writes the indexed material30/34 fields.
|
||||||
|
40E4A0(alpha>0) walks the linked model57C material array88..8C, writes diffuse
|
||||||
|
RGBA(1,1,1,alpha), enables blend flag38 bit0 and selects source6/dest1 when graphics
|
||||||
|
flag509A13 is false, dest7 when true. For alpha<=0 it clears the blend bit, restores
|
||||||
|
RGBA1 and6/7. Therefore expiry/cleanup mean opaque alpha1, not invisible alpha0.
|
||||||
|
6/1 is SrcAlpha/One additive,6/7 SrcAlpha/InvSrcAlpha conventional alpha per
|
||||||
|
[gadget-blending.md](gadget-blending.md). The graphics-option predicate remains
|
||||||
|
unclosed. An upright current-Jimmy renderer can use the existing material variants;
|
||||||
|
do not claim complete original material/LOD/depth-state equivalence.
|
||||||
|
|
||||||
|
Menu48D414 binds484→4036C0(show both),488→403700(hide both),
|
||||||
|
48C→403730(red fill(1,.2,.2,1), show),490→4037A0(white fill).
|
||||||
|
4037F0 sets fill width27×(windowWidth/640), height
|
||||||
|
max(percent,0)×1.04×(windowHeight/480). Source meter sprite pointers are
|
||||||
|
4F7CB0/4F8028. [Follow-up asset report](gadget-followup-assets.md) owns exact
|
||||||
|
Canv21/22 bindings/layout and modern uniform-widescreen adaptation. Arithmetic
|
||||||
|
uses x87 intermediates and float stores; exhaustive boundary equivalence is not
|
||||||
|
claimed by the Python projection.
|
||||||
|
|
||||||
|
## Cleanup, control and AI consumers — recovered boundaries
|
||||||
|
|
||||||
|
427FF0 dispatches the mode table428844; entry2 reaches42810C. It writes material0
|
||||||
|
blend6/7, remaining7 (not0), target flagtrue, recharge0 and hides both meter sprites.
|
||||||
|
If Goddard exists and its complete9E8 flag is false, it shows Goddard and re-enables
|
||||||
|
gameD0/214. It resets Jimmy alpha through114(0) and raw mode−1. Selecting Invisible
|
||||||
|
again resets both timers0. Source constructor4227BE/C7 also starts both0.
|
||||||
|
|
||||||
|
CAM and initial MCA can explicitly clean inventions. CAM constructor415C09/D5
|
||||||
|
defaults DeactivateInv to1 at complete9C0; property415F74 binds game-interface8F8
|
||||||
|
(interface offsetC8 proven415A60). Activation4165B7 checks the field before JIM1
|
||||||
|
lookup/cleanup178. MCA constructor430AA0 defaults completeEB8=1; property430D82
|
||||||
|
binds interfaceDF0 (offsetC8 at430930), activation43129A/CC checks then cleans.
|
||||||
|
Both use exact string `DeactivateInv` at4EDF10. Omitted GAM property therefore
|
||||||
|
keeps defaulttrue; an explicit0 can suppress that prelude. Ordered raw-owner438
|
||||||
|
preparation also calls cleanup178 at42AE14. AI-null40C4AD..527 calls410, STOP/
|
||||||
|
sound148 and clears raw control, but that inspected block does **not** call438/
|
||||||
|
178. Do not blanket-cancel Invisible on every control loss: timers can freeze
|
||||||
|
with the effect retained while raw control is null. Reset/ordinary-load behavior
|
||||||
|
must respect proven Init/PostLoad and callback boundaries, not one broad reset.
|
||||||
|
|
||||||
|
Generic enemy reads target game-interface49D at40847C,408788,4087FC to gate
|
||||||
|
chase/acquisition/lost-target branches. REA409CC0 confirms a target pointer is
|
||||||
|
required and the eligibility test permits49D=true **or** positive enemy934;
|
||||||
|
Invisible is not proof universal enemy immunity. Later enemy modes/reaction
|
||||||
|
consumers, attacks already underway and class-specific overrides remain open.
|
||||||
|
The port can retain the flag and report its state without claiming enemies avoid
|
||||||
|
Jimmy until the corresponding AI consumers are implemented.
|
||||||
|
|
||||||
|
## Verification and recommended bounded implementation
|
||||||
|
|
||||||
|
Nine deterministic Python groups pass in `artifacts/invisible/tests.log`:
|
||||||
|
source identity/spans/sites/vtables/constants, equip/activation threshold split,
|
||||||
|
first recharge/next-call activation, fixed cost/same-call decrement, jump and
|
||||||
|
suppressor/control gates, zero-energy clocks, blend flash/exact-zero expiry,
|
||||||
|
cleanup and source graphics branch. These are independently transcribed static
|
||||||
|
projections, not original execution or modern runtime verification.
|
||||||
|
|
||||||
|
Implement mode2 in the existing post-movement Jimmy wrapper phase with separate
|
||||||
|
raw-any-control and Jimmy-input ownership. Preserve exact timers/strict gates,
|
||||||
|
original material/meter resources, Goddard hide/restore and evidence-backed
|
||||||
|
cleanup points. Verify initial recharge, held activation, ordinary jump, last3s
|
||||||
|
blend flash, expiry/recharge, low-energy rejection, VR exemption, modal pause,
|
||||||
|
explicit/implicit cutscene cleanup and AI-null freeze. Keep full enemy AI,
|
||||||
|
original graphics-option choice, exact scheduler/x87 boundaries and native
|
||||||
|
Windows/original whole-game comparison explicitly unresolved.
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# Shared player energy and warning sounds
|
||||||
|
|
||||||
|
2026-11-01. Static recovery reuses the complete local REA/Ghidra12.1.4 record
|
||||||
|
`artifacts/shrink-ray/rea-primary-followup/04.json`, Evidence
|
||||||
|
`ev_71897af12f4bfa1de946c6f17f3bbed34764fdc84258ce64516c8f1f904b465d`.
|
||||||
|
Its exported bundle and closed snapshot remain beside it. No duplicate analysis
|
||||||
|
session or original execution was needed. Supplementary instruction cross-checks
|
||||||
|
are in `artifacts/gadget-followup/energy.instructions.txt`.
|
||||||
|
|
||||||
|
`tools/binary/player_energy.py ../Original` checks the full original EXE hash,
|
||||||
|
the complete42A920..42AA13 body, ten decisive sites and four constants. Output
|
||||||
|
`artifacts/gadget-followup/energy-source.json` records PE-mapped file offsets
|
||||||
|
for all preferred VAs below. Original EXE SHA256:
|
||||||
|
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||||
|
For these .text locations, mapped file offset is VA−400000.
|
||||||
|
|
||||||
|
## Recovered state and order
|
||||||
|
|
||||||
|
Global float4F83D4 is the player energy scalar; byte4F83DC is a separate low-warning
|
||||||
|
latch. Jimmy constructor42217E clearsEBX,422980 writesBL to the latch. Existing
|
||||||
|
retained-loader evidence shows ordinary loads reuse Jimmy without repeating his
|
||||||
|
constructor. TSK stores PlayerValue, not this latch; direct scalar load is distinct
|
||||||
|
from calling the adjustment helper. Full new-game/load UI ownership remains open.
|
||||||
|
|
||||||
|
42A92B..42A93D compares the current game's FourCC against numericVR01..VR08 and
|
||||||
|
returns for those tutorials without changing scalar, latch or playing sounds.
|
||||||
|
Otherwise:
|
||||||
|
|
||||||
|
1. When old energy>0 and the requested sum<=0,42A967..42A972 requests SFX80 before
|
||||||
|
the scalar changes. Staying at zero is not another crossing.
|
||||||
|
2.42A975 reloads the live scalar, adds the delta and stores float32. The upper100
|
||||||
|
comparison uses the still-live x87 sum. Above100 clamps100, clears the latch
|
||||||
|
and returns (42A985..42A9A3).
|
||||||
|
3. Negative stored energy clamps0. Stored energy<19 emits SFX182 once if the latch
|
||||||
|
is false, then sets it true (42A9C3..42A9F7). The scalar is already published
|
||||||
|
when that sound is requested; the latch is written afterward.
|
||||||
|
4. Values19..20 inclusive preserve the latch; strictly>20 clears it
|
||||||
|
(42A9F8..42AA12). A direct assignment/refill is not itself this helper call.
|
||||||
|
|
||||||
|
The shared consumers include ordinary ray426F5A (−dt), powered-fire421FB0's active
|
||||||
|
phase (−dt×.5), Invisible424F26 (fixed−2 on activation), and Bubble42627C
|
||||||
|
(−dt×.5; Bubble runtime remains pending). Tutorial immunity does not bypass the
|
||||||
|
individual caller's activation gate; Jimmy PostLoad independently sets its9F8
|
||||||
|
energy-override field for VR01..08.
|
||||||
|
|
||||||
|
## Current implementation and verification boundaries
|
||||||
|
|
||||||
|
`PlayerEnergy` owns scalar and warning latch. Main retains one instance across
|
||||||
|
ordinary scene rebuilds; LabSimulation delegates scalar access and adjustments to
|
||||||
|
it. Warning callbacks run in source write order and feed SceneAudio's existing
|
||||||
|
SFX bank/gate. The ray and positive jetpack-effect phase now call this owner;
|
||||||
|
Invisible spends2 through the same path. The independent JetpackBurst pure helper
|
||||||
|
continues to expose its numeric projection for algorithm tests.
|
||||||
|
|
||||||
|
Modern doubles preserve the relevant two-float sum before stores; exhaustive x87
|
||||||
|
rounding/control-word equivalence is not claimed. Nonfinite input is rejected.
|
||||||
|
Saved scalar assignment and modern debug refill do not infer a warning reset.
|
||||||
|
The modern debug checkpoint/load interface is not an original full save UI.
|
||||||
|
|
||||||
|
Managed tests cover strict19/20 boundaries, one-shot warning episodes, crossing
|
||||||
|
sound before scalar/low sound after scalar, clamp, tutorial bypass and shared
|
||||||
|
ordinary-load ownership. Source tests guard constructor, both new callsites,
|
||||||
|
body/constants and offsets. They are port/static checks, separate from listening
|
||||||
|
to the original whole game or native Windows verification. Whole energy/damage/
|
||||||
|
pickup consumers, soundbank timing and exact original scheduler remain open.
|
||||||
+37
-1
@@ -1,4 +1,40 @@
|
|||||||
# Progress — 2026-10-27
|
# Progress — 2026-11-02
|
||||||
|
|
||||||
|
## Invisible and shared energy continuation
|
||||||
|
|
||||||
|
Implemented original item2/raw mode2: initial7-second recharge, fixed2-energy
|
||||||
|
activation,7-second active timer, original alpha.7/last3-second blend flash,
|
||||||
|
original Canv21/22 meter, companion hide/body flags and source cleanup. Enter/
|
||||||
|
Ctrl/left mouse activates after recharge without jump. F1→Player grants/selects
|
||||||
|
Invisible, unequips it and shows remaining/recharge/targetability diagnostics.
|
||||||
|
Raw-null control freezes its timers; named-Jimmy CAM/MCA DeactivateInv cleanup
|
||||||
|
is independent from raw-owner preparation. Full enemy sensing remains unported.
|
||||||
|
|
||||||
|
PlayerEnergy now retains the shared scalar/warning latch across ordinary loads;
|
||||||
|
ray, active jetpack and Invisible adjustments use original empty80/low182 sounds
|
||||||
|
with strict19/20 hysteresis and source callback order. The existing complete
|
||||||
|
42A920 REA record is reused; new independent REA reports cover Invisible,
|
||||||
|
material/AI dependencies, meter art/UV/rendering and Bubble's next-step contract.
|
||||||
|
All investigators have returned file ownership; original files remain read only.
|
||||||
|
|
||||||
|
Fifteen managed Invisible/energy groups pass, including binding/control/companion
|
||||||
|
and widescreen meter checks.182 Python checks and independent review pass. Native
|
||||||
|
GTX1070/private Xvfb at1920×1080 passes real SDL Ctrl/Tab through all six rendered
|
||||||
|
phases, zero enabled Vulkan validation errors; headless matches. This explicit
|
||||||
|
fixture advances836 extra normal player ticks, not an original-cadence capture.
|
||||||
|
Six-phase readbacks were inspected. Complete scripts/test.sh passes182 Python+2
|
||||||
|
HUD checks, all managed suites,30 main GPU completions and17 isolated Vulkan
|
||||||
|
material checks with zero enabled validation errors. SDL dummy lifecycle and all
|
||||||
|
539 original hashes pass. Log: integration.log. Clean package/standalone release
|
||||||
|
results will be recorded after the verified source milestone.
|
||||||
|
Logs: artifacts/gadget-followup/; reports: gameplay/invisible-implementation.md,
|
||||||
|
invisible.md, player-energy.md, gadget-followup-assets.md and invisible-review.md.
|
||||||
|
|
||||||
|
Bubble evidence now records original Canv1 effect, equip/cleanup, controlled
|
||||||
|
energy drain and movementmode2/radius/factor changes. Runtime waits for that
|
||||||
|
mode's full movement/jump/body contract. Other gadgets/full enemy AI, global
|
||||||
|
suppression lifecycle, graphics-option/depth state, cached canvas alignment,
|
||||||
|
original runtime and native Windows verification remain open.
|
||||||
|
|
||||||
## Gameplay gadgets — user-directed continuation
|
## Gameplay gadgets — user-directed continuation
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ offsets, virtual addresses, API symbols or observed behavior. Decompiled output
|
|||||||
evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL
|
evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL
|
||||||
probes and modern runtime checks are recorded separately.
|
probes and modern runtime checks are recorded separately.
|
||||||
|
|
||||||
|
- `gameplay/invisible.md`, `invisible-implementation.md`, `invisible-review.md`:
|
||||||
|
timed mode2/targetability/material state, named-Jimmy versus raw-owner cleanup,
|
||||||
|
bounded implementation and independent review. `gadget-followup-assets.md`
|
||||||
|
records original meter/tutorial resources, UV stretch and alignment uncertainty;
|
||||||
|
`player-energy.md` reuses42A920 REA for warning-latch/callback order.
|
||||||
|
`bubble.md` records the next gadget's physics/visual/drain contracts and gates.
|
||||||
|
|
||||||
- `gameplay/gadgets-implementation.md`: first playable gadget scope and evidence
|
- `gameplay/gadgets-implementation.md`: first playable gadget scope and evidence
|
||||||
map. `gadget-controls.md`/`gadget-assets.md` retain original group0 state, menu
|
map. `gadget-controls.md`/`gadget-assets.md` retain original group0 state, menu
|
||||||
rectangles and54 canvases. `shrink-ray.md` traces input/ownership/energy/target
|
rectangles and54 canvases. `shrink-ray.md` traces input/ownership/energy/target
|
||||||
|
|||||||
+9
-2
@@ -65,8 +65,15 @@ the resume backlog, not prerequisites imposed on this user-directed gadget work.
|
|||||||
- [x] Managed/source/GPU checks and native Linux menu/ray input fixtures.
|
- [x] Managed/source/GPU checks and native Linux menu/ray input fixtures.
|
||||||
- [x] Rebuild clean7b5230c Linux/Windows gadget packages, verify54 canvases/new
|
- [x] Rebuild clean7b5230c Linux/Windows gadget packages, verify54 canvases/new
|
||||||
manifests in both, and run standalone Linux menu/ray fixtures from /tmp.
|
manifests in both, and run standalone Linux menu/ray fixtures from /tmp.
|
||||||
- [ ] Other special gadget effects and equip cleanup, energy-warning audio,
|
- [x] Invisible source, timed activation/recharge/flash, original meter, companion
|
||||||
enemy AI/reaction consumers and original/native Windows comparison.
|
body/visibility and named-Jimmy cutscene cleanup; shared energy warning lifecycle.
|
||||||
|
- [x] Independent review,182 Python/15 Invisible managed groups, native Linux SDL
|
||||||
|
six-phase render at1920×1080; complete integration30 GPU+17 material checks pass.
|
||||||
|
- [ ] Build clean Invisible Linux/Windows packages and verify standalone resources.
|
||||||
|
- [x] Recover Bubble visual/equip/drain/cleanup source contracts with REA/guards.
|
||||||
|
- [ ] Close Bubble movementmode2/jump/body contract, then implement original sprite
|
||||||
|
effect and physics in a bounded tutorial. Other effects/full enemy AI and
|
||||||
|
original/native Windows comparison remain independent backlog.
|
||||||
|
|
||||||
Details: [first gadget slice](gameplay/gadgets-implementation.md). Investigators
|
Details: [first gadget slice](gameplay/gadgets-implementation.md). Investigators
|
||||||
have returned all file ownership to primary. Complete final regression, native
|
have returned all file ownership to primary. Complete final regression, native
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ for rid in linux-x64 win-x64; do
|
|||||||
cp -a artifacts/extracted/ui/. "$out/scenes/ui/"
|
cp -a artifacts/extracted/ui/. "$out/scenes/ui/"
|
||||||
mkdir -p "$out/scenes/gadgets"
|
mkdir -p "$out/scenes/gadgets"
|
||||||
cp -a artifacts/extracted/gadgets/. "$out/scenes/gadgets/"
|
cp -a artifacts/extracted/gadgets/. "$out/scenes/gadgets/"
|
||||||
|
mkdir -p "$out/scenes/invisible-meter"
|
||||||
|
cp -a artifacts/extracted/invisible-meter/. "$out/scenes/invisible-meter/"
|
||||||
mkdir -p "$out/scenes/effects"
|
mkdir -p "$out/scenes/effects"
|
||||||
cp -a artifacts/extracted/effects/. "$out/scenes/effects/"
|
cp -a artifacts/extracted/effects/. "$out/scenes/effects/"
|
||||||
cp artifacts/extracted/scene-catalog.json "$out/scenes/scene-catalog.json"
|
cp artifacts/extracted/scene-catalog.json "$out/scenes/scene-catalog.json"
|
||||||
@@ -70,6 +72,11 @@ Practice Mode plus an owned gadget opens its tutorial. The combined shrink-ray/
|
|||||||
jetpack pickup fires on Enter/Ctrl/left mouse and bursts on jump. Original Yokian
|
jetpack pickup fires on Enter/Ctrl/left mouse and bursts on jump. Original Yokian
|
||||||
soldiers support the shrink morph,30-second restoration and10-point reward.
|
soldiers support the shrink morph,30-second restoration and10-point reward.
|
||||||
Other gadget effects and full enemy AI/combat remain incomplete.
|
Other gadget effects and full enemy AI/combat remain incomplete.
|
||||||
|
Invisible is now implemented: select its owned tile, wait7 seconds to recharge,
|
||||||
|
then fire without jump for a7-second effect costing2 energy (tutorials exempt).
|
||||||
|
F1/Player can Give/Select Invisible, Unequip, and show its timers/targetability.
|
||||||
|
The original meter and final3-second flashing are included; enemy sensing remains
|
||||||
|
incomplete. Source warning sounds for low/empty energy are shared by gadgets.
|
||||||
Append --inspect to start directly in the old scene inspector.
|
Append --inspect to start directly in the old scene inspector.
|
||||||
The default runs the recovered lab camera/speech sequence; Escape/Space skips
|
The default runs the recovered lab camera/speech sequence; Escape/Space skips
|
||||||
its actions and restores control. --skip-intro starts with control; --mute disables
|
its actions and restores control. --skip-intro starts with control; --mute disables
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ dotnet run --project tests/GamePort.SphereResponseTests
|
|||||||
dotnet run --project tests/GamePort.StaticCollisionTests
|
dotnet run --project tests/GamePort.StaticCollisionTests
|
||||||
dotnet run --project tests/GamePort.BodyPhysicsTests
|
dotnet run --project tests/GamePort.BodyPhysicsTests
|
||||||
dotnet run --project tests/GamePort.GadgetTests
|
dotnet run --project tests/GamePort.GadgetTests
|
||||||
|
dotnet run --project tests/GamePort.InvisibleTests
|
||||||
dotnet run --project tests/GamePort.HeadingTests
|
dotnet run --project tests/GamePort.HeadingTests
|
||||||
dotnet run --project tests/GamePort.BlendTests
|
dotnet run --project tests/GamePort.BlendTests
|
||||||
dotnet run --project tests/GamePort.CameraRayTests
|
dotnet run --project tests/GamePort.CameraRayTests
|
||||||
@@ -53,6 +54,7 @@ dotnet run --no-build -- --headless --smoke-objective-panel --story-time 1 --scr
|
|||||||
dotnet run --no-build -- --headless --smoke-objective-panel --story-time 9 --screenshot artifacts/test-objective-hidden.ppm
|
dotnet run --no-build -- --headless --smoke-objective-panel --story-time 9 --screenshot artifacts/test-objective-hidden.ppm
|
||||||
dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-jetpack --screenshot artifacts/test-jetpack.ppm
|
dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-jetpack --screenshot artifacts/test-jetpack.ppm
|
||||||
dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-shrink-ray --screenshot artifacts/test-shrink-ray.ppm
|
dotnet run --no-build -- --headless --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-shrink-ray --screenshot artifacts/test-shrink-ray.ppm
|
||||||
|
dotnet run --no-build -- --headless --scene artifacts/extracted/VR03/scene.json --level gam/VR03.gam --smoke-invisible --screenshot artifacts/test-invisible.ppm
|
||||||
dotnet run --no-build -- --headless --skip-intro --write-save artifacts/test-checkpoint.tsk
|
dotnet run --no-build -- --headless --skip-intro --write-save artifacts/test-checkpoint.tsk
|
||||||
dotnet run --no-build -- --headless --load-save artifacts/test-checkpoint.tsk --skip-intro
|
dotnet run --no-build -- --headless --load-save artifacts/test-checkpoint.tsk --skip-intro
|
||||||
dotnet run --no-build -- --headless --story --scene artifacts/extracted/VR01/scene.json --level gam/VR01.gam --smoke-transition --skip-intro
|
dotnet run --no-build -- --headless --story --scene artifacts/extracted/VR01/scene.json --level gam/VR01.gam --smoke-transition --skip-intro
|
||||||
@@ -69,6 +71,7 @@ SDL_AUDIODRIVER=dummy dotnet run --no-build -- --scene-audio-smoke artifacts/ext
|
|||||||
SDL_AUDIODRIVER=dummy dotnet run --no-build -- --cutscene-audio-smoke artifacts/extracted/level1b/entities/entities.json
|
SDL_AUDIODRIVER=dummy dotnet run --no-build -- --cutscene-audio-smoke artifacts/extracted/level1b/entities/entities.json
|
||||||
python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json
|
python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json
|
||||||
if [[ "${NEUTRON_WINDOW_TEST:-0}" == 1 ]]; then
|
if [[ "${NEUTRON_WINDOW_TEST:-0}" == 1 ]]; then
|
||||||
|
dotnet run --no-build -- --scene artifacts/extracted/VR03/scene.json --level gam/VR03.gam --smoke-invisible --width 1920 --height 1080 --screenshot artifacts/test-invisible-window.ppm
|
||||||
dotnet run --no-build -- --smoke-gadget-menu --width 1920 --height 1080 --screenshot artifacts/test-gadget-menu-window.ppm
|
dotnet run --no-build -- --smoke-gadget-menu --width 1920 --height 1080 --screenshot artifacts/test-gadget-menu-window.ppm
|
||||||
dotnet run --no-build -- --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-shrink-ray --screenshot artifacts/test-shrink-ray-window.ppm
|
dotnet run --no-build -- --scene artifacts/extracted/VR04/scene.json --level gam/VR04.gam --smoke-shrink-ray --screenshot artifacts/test-shrink-ray-window.ppm
|
||||||
dotnet run --no-build -- --smoke-debug-tools
|
dotnet run --no-build -- --smoke-debug-tools
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ namespace GamePort.Application;
|
|||||||
public sealed record DebugScene(string LevelFile, string Code, string[] Starts);
|
public sealed record DebugScene(string LevelFile, string Code, string[] Starts);
|
||||||
public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl, ToggleOverlay,
|
public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl, ToggleOverlay,
|
||||||
Noclip, NoclipSpeed, StopMotion, ShowObjective, ReturnNoclipEntry, LevelAvailability, InputOrder, ApplyJetpackState,
|
Noclip, NoclipSpeed, StopMotion, ShowObjective, ReturnNoclipEntry, LevelAvailability, InputOrder, ApplyJetpackState,
|
||||||
CameraObstruction, MuteMusic, MuteSpeech, MuteEffects, RestartMusic, StopEffects, SaveCheckpoint, LoadCheckpoint, Practice }
|
CameraObstruction, MuteMusic, MuteSpeech, MuteEffects, RestartMusic, StopEffects, SaveCheckpoint, LoadCheckpoint, Practice,
|
||||||
|
GiveInvisible, UnequipGadget }
|
||||||
public sealed record DebugMenuView(string[] Lines, int SelectedLine);
|
public sealed record DebugMenuView(string[] Lines, int SelectedLine);
|
||||||
public sealed record DebugStatus(string Level, string Start, Vector3 Root, float Yaw, float Speed,
|
public sealed record DebugStatus(string Level, string Start, Vector3 Root, float Yaw, float Speed,
|
||||||
bool Grounded, float Energy, int Score, int SceneTask, string Cutscene, bool Controlled,
|
bool Grounded, float Energy, int Score, int SceneTask, string Cutscene, bool Controlled,
|
||||||
@@ -25,6 +26,9 @@ public sealed record DebugSystems
|
|||||||
public float JumpHold { get; init; }
|
public float JumpHold { get; init; }
|
||||||
public float BurnRemaining { get; init; }
|
public float BurnRemaining { get; init; }
|
||||||
public int JetpackAvailability { get; init; }
|
public int JetpackAvailability { get; init; }
|
||||||
|
public float InvisibleRemaining { get; init; }
|
||||||
|
public float InvisibleRecharge { get; init; }
|
||||||
|
public bool Targetable { get; init; } = true;
|
||||||
public int Objective { get; init; }
|
public int Objective { get; init; }
|
||||||
public float ObjectiveTime { get; init; }
|
public float ObjectiveTime { get; init; }
|
||||||
public bool? CameraObstruction { get; init; }
|
public bool? CameraObstruction { get; init; }
|
||||||
@@ -48,7 +52,7 @@ public sealed class DebugMenu
|
|||||||
public const int ItemCount = 12;
|
public const int ItemCount = 12;
|
||||||
public const int PageCount = 3;
|
public const int PageCount = 3;
|
||||||
public int Page { get; private set; }
|
public int Page { get; private set; }
|
||||||
public int PageItems => Page switch { 1 => 10, 2 => 9, _ => ItemCount };
|
public int PageItems => Page switch { 1 => 12, 2 => 9, _ => ItemCount };
|
||||||
private static readonly float[] FlySpeeds = [300, 600, 1200, 2400];
|
private static readonly float[] FlySpeeds = [300, 600, 1200, 2400];
|
||||||
private int flySpeedIndex = 1, jetpackStateIndex = 1;
|
private int flySpeedIndex = 1, jetpackStateIndex = 1;
|
||||||
private static readonly int[] JetpackStates = [0, 1, 4];
|
private static readonly int[] JetpackStates = [0, 1, 4];
|
||||||
@@ -110,7 +114,8 @@ public sealed class DebugMenu
|
|||||||
0 => DebugAction.Noclip, 1 => DebugAction.NoclipSpeed, 2 => DebugAction.StopMotion,
|
0 => DebugAction.Noclip, 1 => DebugAction.NoclipSpeed, 2 => DebugAction.StopMotion,
|
||||||
3 => DebugAction.ShowObjective, 4 => DebugAction.ReturnNoclipEntry,
|
3 => DebugAction.ShowObjective, 4 => DebugAction.ReturnNoclipEntry,
|
||||||
5 => DebugAction.LevelAvailability, 6 => DebugAction.InputOrder,
|
5 => DebugAction.LevelAvailability, 6 => DebugAction.InputOrder,
|
||||||
8 => DebugAction.ApplyJetpackState, 9 => DebugAction.RefillEnergy, _ => DebugAction.None
|
8 => DebugAction.ApplyJetpackState, 9 => DebugAction.RefillEnergy,
|
||||||
|
10 => DebugAction.GiveInvisible, 11 => DebugAction.UnequipGadget, _ => DebugAction.None
|
||||||
};
|
};
|
||||||
if (Page == 2) return Selected switch
|
if (Page == 2) return Selected switch
|
||||||
{
|
{
|
||||||
@@ -147,13 +152,15 @@ public sealed class DebugMenu
|
|||||||
Page == 1 ? $"PENDING {V(system.PendingImpulse)}" : $"AUDIO BYTES MUSIC {system.MusicBytes} VOICE {system.SpeechBytes}",
|
Page == 1 ? $"PENDING {V(system.PendingImpulse)}" : $"AUDIO BYTES MUSIC {system.MusicBytes} VOICE {system.SpeechBytes}",
|
||||||
Page == 1 ? $"JUMP {system.JumpState} HOLD {F(system.JumpHold)} BURN {F(system.BurnRemaining)}"
|
Page == 1 ? $"JUMP {system.JumpState} HOLD {F(system.JumpHold)} BURN {F(system.BurnRemaining)}"
|
||||||
: $"EFFECT BYTES {system.EffectBytes} AUDIO AVAILABLE {system.AudioAvailable}",
|
: $"EFFECT BYTES {system.EffectBytes} AUDIO AVAILABLE {system.AudioAvailable}",
|
||||||
$"OBJECTIVE {system.Objective} TIME {F(system.ObjectiveTime)} GADGET STATE {system.JetpackAvailability}", ""];
|
$"OBJECTIVE {system.Objective} TIME {F(system.ObjectiveTime)} GADGET STATE {system.JetpackAvailability}",
|
||||||
|
$"INVISIBLE {F(system.InvisibleRemaining)} RECHARGE {F(system.InvisibleRecharge)}/7 TARGETABLE {system.Targetable}", ""];
|
||||||
string[] items = Page == 1 ? [
|
string[] items = Page == 1 ? [
|
||||||
$"NOCLIP (F3): {system.Noclip} (ENTER TOGGLE)",
|
$"NOCLIP (F3): {system.Noclip} (ENTER TOGGLE)",
|
||||||
$"FLY SPEED: {F(FlySpeed)} LIVE {F(system.NoclipSpeed)} (ENTER APPLIES)", "STOP MOTION / CLEAR QUEUED JUMP", "SHOW CURRENT OBJECTIVE",
|
$"FLY SPEED: {F(FlySpeed)} LIVE {F(system.NoclipSpeed)} (ENTER APPLIES)", "STOP MOTION / CLEAR QUEUED JUMP", "SHOW CURRENT OBJECTIVE",
|
||||||
"RETURN TO NOCLIP ENTRY POSITION", "APPLY THIS LEVEL'S GADGET AVAILABILITY",
|
"RETURN TO NOCLIP ENTRY POSITION", "APPLY THIS LEVEL'S GADGET AVAILABILITY",
|
||||||
$"INPUT AFTER PLAYER: {system.InputAfterPlayer} (TOGGLE)",
|
$"INPUT AFTER PLAYER: {system.InputAfterPlayer} (TOGGLE)",
|
||||||
$"JET PACK STATE: {JetpackState} (0 NONE / 1 OWNED / 4 DISABLED)", "APPLY JET PACK STATE", "REFILL ENERGY TO 100"] : [
|
$"JET PACK STATE: {JetpackState} (0 NONE / 1 OWNED / 4 DISABLED)", "APPLY JET PACK STATE", "REFILL ENERGY TO 100",
|
||||||
|
"GIVE / SELECT INVISIBLE", "UNEQUIP CURRENT GADGET"] : [
|
||||||
$"STATIC CAMERA OBSTRUCTION: {(system.CameraObstruction?.ToString() ?? "UNAVAILABLE")}",
|
$"STATIC CAMERA OBSTRUCTION: {(system.CameraObstruction?.ToString() ?? "UNAVAILABLE")}",
|
||||||
$"MUTE MUSIC: {system.MusicMuted}", $"MUTE SPEECH: {system.SpeechMuted}", $"MUTE EFFECTS: {system.EffectsMuted}",
|
$"MUTE MUSIC: {system.MusicMuted}", $"MUTE SPEECH: {system.SpeechMuted}", $"MUTE EFFECTS: {system.EffectsMuted}",
|
||||||
"RESTART SELECTED MUSIC", "STOP ALL EFFECTS / LOOPS", "SAVE DEBUG CHECKPOINT", "LOAD DEBUG CHECKPOINT", "SHOW JET PACK PRACTICE PROMPT"];
|
"RESTART SELECTED MUSIC", "STOP ALL EFFECTS / LOOPS", "SAVE DEBUG CHECKPOINT", "LOAD DEBUG CHECKPOINT", "SHOW JET PACK PRACTICE PROMPT"];
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using System.Text.Json;
|
||||||
|
using GamePort.Assets;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
namespace GamePort.Application;
|
||||||
|
|
||||||
|
/// <summary>Original Canv21/22 meter. Source size/tint/full-image stretch with
|
||||||
|
/// a declared logical rectangle conversion and uniform centered widescreen UI.</summary>
|
||||||
|
public sealed class InvisibleMeterOverlay
|
||||||
|
{
|
||||||
|
private readonly int offset;
|
||||||
|
private readonly uint firstIndex;
|
||||||
|
public Mesh Mesh { get; }
|
||||||
|
|
||||||
|
public InvisibleMeterOverlay(Mesh combined, string manifest)
|
||||||
|
{
|
||||||
|
var full = Path.GetFullPath(manifest);
|
||||||
|
var directory = Path.GetDirectoryName(full)!;
|
||||||
|
if (new FileInfo(full).Length > 16 * 1024) throw new InvalidDataException("Meter manifest exceeds limit");
|
||||||
|
using var document = JsonDocument.Parse(File.ReadAllBytes(full), new JsonDocumentOptions {MaxDepth=10});
|
||||||
|
var root = document.RootElement;
|
||||||
|
if (root.GetProperty("schema").GetInt32() != 1 || root.GetProperty("referenceWidth").GetInt32() != 640
|
||||||
|
|| root.GetProperty("referenceHeight").GetInt32() != 480 || root.GetProperty("textures").GetArrayLength() != 2)
|
||||||
|
throw new InvalidDataException("Unsupported Invisible meter format");
|
||||||
|
offset = combined.Vertices.Length; firstIndex = (uint)combined.Indices.Length;
|
||||||
|
var vertices = combined.Vertices.ToList(); var indices = combined.Indices.ToList();
|
||||||
|
var draws = combined.Draws.ToList(); var textures = new Dictionary<int,PngImage>(combined.Textures);
|
||||||
|
if (!combined.HasExplicitDraws && indices.Count != 0) draws.Add(new(0,(uint)indices.Count,-1));
|
||||||
|
var seen = new HashSet<int>();
|
||||||
|
foreach (var entry in root.GetProperty("textures").EnumerateArray().OrderBy(e=>e.GetProperty("id").GetInt32()))
|
||||||
|
{
|
||||||
|
var id = entry.GetProperty("id").GetInt32();
|
||||||
|
if (id is not (21 or 22) || !seen.Add(id) || entry.GetProperty("width").GetInt32()!=30
|
||||||
|
|| entry.GetProperty("height").GetInt32()!=110) throw new InvalidDataException("Invalid source meter canvas");
|
||||||
|
var path = Path.GetFullPath(Path.Combine(directory,entry.GetProperty("path").GetString()!));
|
||||||
|
if (!path.StartsWith(directory+Path.DirectorySeparatorChar,StringComparison.Ordinal)
|
||||||
|
|| new FileInfo(path).Length != 30*110*4) throw new InvalidDataException("Invalid meter pixel path/length");
|
||||||
|
var textureId = int.MinValue+15000; while(textures.ContainsKey(textureId))textureId++;
|
||||||
|
textures.Add(textureId,new(30,110,File.ReadAllBytes(path)));
|
||||||
|
var first = (uint)vertices.Count;
|
||||||
|
vertices.AddRange([new(Vector3.Zero,new(0,0),Vector3.One),new(Vector3.Zero,new(.9999f,0),Vector3.One),
|
||||||
|
new(Vector3.Zero,new(.9999f,.9999f),Vector3.One),new(Vector3.Zero,new(0,.9999f),Vector3.One)]);
|
||||||
|
indices.AddRange([first,first+1,first+2,first,first+2,first+3]);
|
||||||
|
draws.Add(new((uint)indices.Count-6,6,textureId){ScreenSpace=true,Visible=false});
|
||||||
|
}
|
||||||
|
Mesh = new(vertices.ToArray(),indices.ToArray()) {HasExplicitDraws=true,Draws=draws.ToArray(),Textures=textures,
|
||||||
|
CollisionPolygons=combined.CollisionPolygons,HasCollisionMaterialIds=combined.HasCollisionMaterialIds};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(Mesh destination, InvisibleGadget device, uint width, uint height)
|
||||||
|
{
|
||||||
|
var viewport = new UiViewport(width,height);
|
||||||
|
var visible = device.Equipped && device.MeterVisible;
|
||||||
|
var color = device.MeterReady ? Vector3.One : new Vector3(1,.2f,.2f);
|
||||||
|
var fillHeight = (float)(Math.Max(device.MeterPercent,0)*1.04);
|
||||||
|
Quad(0,new(320,7),new(30,110),Vector3.One);
|
||||||
|
Quad(1,new(322,114-fillHeight),new(27,fillHeight),color);
|
||||||
|
void Quad(int index, Vector2 position, Vector2 size, Vector3 tint)
|
||||||
|
{
|
||||||
|
destination.Draws.First(d=>d.ScreenSpace&&d.FirstIndex==firstIndex+(uint)index*6).Visible=visible;
|
||||||
|
var p = position+viewport.CenterOffset;
|
||||||
|
var corners = new[] {p,p+new Vector2(size.X,0),p+size,p+new Vector2(0,size.Y)};
|
||||||
|
for(var i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
destination.Vertices[offset+index*4+i].Position=viewport.ToNdc(corners[i]);
|
||||||
|
destination.Vertices[offset+index*4+i].Color=tint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using GamePort.Assets;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
namespace GamePort.Application;
|
||||||
|
|
||||||
|
/// <summary>Accelerated port verification: full player ticks between six rendered
|
||||||
|
/// phases. No actor relocation or direct timer/material writes; not original cadence.</summary>
|
||||||
|
public sealed class InvisibleSmoke
|
||||||
|
{
|
||||||
|
private readonly LabSimulation player;
|
||||||
|
private readonly SceneInventory inventory;
|
||||||
|
private readonly bool[] checks = new bool[6];
|
||||||
|
private readonly float initialEnergy;
|
||||||
|
private int acceleratedTicks;
|
||||||
|
|
||||||
|
public InvisibleSmoke(LabSimulation player, SceneInventory inventory)
|
||||||
|
{
|
||||||
|
this.player = player; this.inventory = inventory; initialEnergy = player.Energy;
|
||||||
|
inventory.SetState(0,2,1); inventory.SelectGadget(2);
|
||||||
|
if (player.GadgetMode != 2 || !player.Invisible.Equipped)
|
||||||
|
throw new InvalidOperationException("Invisible fixture requires a connected, eligible player binding");
|
||||||
|
Advance(() => player.Invisible.Recharge == 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeforeFrame(int count, Action<uint,bool> injectKey, bool headless)
|
||||||
|
{
|
||||||
|
if (count == 1 && !headless) injectKey(224,true);
|
||||||
|
if (count == 2 && !headless) injectKey(224,false);
|
||||||
|
if (count == 3) Advance(() => player.Invisible.Active && player.Invisible.Remaining <= 2.9f && player.Invisible.ConventionalBlend);
|
||||||
|
if (count == 4) Advance(() => player.Invisible.Active && !player.Invisible.ConventionalBlend);
|
||||||
|
if (count == 5) Advance(() => !player.Invisible.Active);
|
||||||
|
if (count == 6)
|
||||||
|
{
|
||||||
|
if (headless) inventory.SelectGadget(-1);
|
||||||
|
else injectKey(43,true);
|
||||||
|
}
|
||||||
|
if (count == 7 && !headless) injectKey(43,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Advance(Func<bool> done)
|
||||||
|
{
|
||||||
|
for(var i=0;i<1000;i++)
|
||||||
|
{
|
||||||
|
if(done())return;
|
||||||
|
player.Step(default); acceleratedTicks++;
|
||||||
|
}
|
||||||
|
throw new InvalidOperationException("Invisible fixture did not reach the requested source phase");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterFrame(int count, MeshDraw material)
|
||||||
|
{
|
||||||
|
var device = player.Invisible;
|
||||||
|
if(count==0)checks[0]=device.Recharge==7 && device.Targetable && material.Opacity==1 && device.MeterReady;
|
||||||
|
if(count==1)checks[1]=device.Active && device.Activations==1 && device.Remaining>3
|
||||||
|
&& material.Opacity==.7f && material.Blend==MeshBlend.Additive
|
||||||
|
&& player.Energy==(player.IgnoresGadgetEnergy ? initialEnergy : initialEnergy-2);
|
||||||
|
if(count==3)checks[2]=device.Active && material.Opacity==.7f && material.Blend==MeshBlend.Alpha;
|
||||||
|
if(count==4)checks[3]=device.Active && material.Blend==MeshBlend.Additive && device.Remaining<=3;
|
||||||
|
if(count==5)checks[4]=!device.Active && device.Targetable && material.Opacity==1 && material.Blend==MeshBlend.Opaque;
|
||||||
|
if(count==7)checks[5]=player.GadgetMode==-1 && !device.Equipped && !device.MeterVisible && device.Targetable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Passed => checks.All(value=>value);
|
||||||
|
public string Report => $"Invisible fixture: charged={checks[0]}, activation={checks[1]}, alpha flash={checks[2]}, additive flash={checks[3]}, expiry={checks[4]}, unequip={checks[5]}, accelerated player ticks={acceleratedTicks}, energy={player.Energy:F3}.";
|
||||||
|
public static string? StageName(int count) => count switch
|
||||||
|
{0=>"charged",1=>"active",3=>"alpha",4=>"additive",5=>"expired",7=>"unequipped",_=>null};
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using GamePort.Assets;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
namespace GamePort.Application;
|
||||||
|
|
||||||
|
/// <summary>Current Jimmy atlas is one linked material. Source114 alpha and
|
||||||
|
/// indexed0 FC blend changes affect that draw without changing pose/visibility.</summary>
|
||||||
|
public static class PlayerGadgetMaterial
|
||||||
|
{
|
||||||
|
public static void Apply(MeshDraw draw, InvisibleGadget invisible)
|
||||||
|
{
|
||||||
|
draw.Opacity = invisible.Opacity;
|
||||||
|
draw.Blend = !invisible.Active ? MeshBlend.Opaque
|
||||||
|
: invisible.ConventionalBlend ? MeshBlend.Alpha : MeshBlend.Additive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,7 +90,7 @@ public sealed class ActorPatrol
|
|||||||
if (!float.IsFinite(actor.Speed)) throw new InvalidOperationException("Nonfinite Goddard speed");
|
if (!float.IsFinite(actor.Speed)) throw new InvalidOperationException("Nonfinite Goddard speed");
|
||||||
|
|
||||||
// EXE408023->40E050: the body consumes the *previous* velocity first.
|
// EXE408023->40E050: the body consumes the *previous* velocity first.
|
||||||
var body = integrateBody(new(actor.Position, Velocity), dt);
|
var body = actor.BodyEnabled ? integrateBody(new(actor.Position, Velocity), dt) : new PatrolBodyState(actor.Position, Velocity);
|
||||||
if (!Finite(body.Position) || !Finite(body.Velocity))
|
if (!Finite(body.Position) || !Finite(body.Velocity))
|
||||||
throw new InvalidOperationException("Goddard body solver produced nonfinite state");
|
throw new InvalidOperationException("Goddard body solver produced nonfinite state");
|
||||||
actor.Position = body.Position;
|
actor.Position = body.Position;
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
namespace GamePort.Game;
|
||||||
|
|
||||||
|
/// <summary>Jimmy424E80 timed Invisible device; material state and source
|
||||||
|
/// targetable55D are distinct from raw control and authored visibility.</summary>
|
||||||
|
public sealed class InvisibleGadget
|
||||||
|
{
|
||||||
|
public const float Duration = 7;
|
||||||
|
public bool Equipped { get; private set; }
|
||||||
|
public float Remaining { get; private set; }
|
||||||
|
public float Recharge { get; private set; }
|
||||||
|
public bool Targetable { get; private set; } = true;
|
||||||
|
public float Opacity { get; private set; } = 1;
|
||||||
|
public bool ConventionalBlend { get; private set; }
|
||||||
|
public bool MeterVisible { get; private set; }
|
||||||
|
public bool MeterReady { get; private set; }
|
||||||
|
public float MeterPercent { get; private set; }
|
||||||
|
public int Activations { get; private set; }
|
||||||
|
public bool Active => Equipped && !Targetable;
|
||||||
|
public event Action<bool>? EquippedChanged;
|
||||||
|
|
||||||
|
public bool Equip(float energy, bool energyOverride)
|
||||||
|
{
|
||||||
|
if (!float.IsFinite(energy)) throw new ArgumentOutOfRangeException(nameof(energy));
|
||||||
|
if (energy <= 0 && !energyOverride) return false;
|
||||||
|
Equipped = true; Remaining = Recharge = 0; Targetable = true;
|
||||||
|
Opacity = 1; ConventionalBlend = false; MeterReady = false; MeterVisible = true;
|
||||||
|
EquippedChanged?.Invoke(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Release()
|
||||||
|
{
|
||||||
|
Equipped = false; Remaining = Duration; Recharge = 0;
|
||||||
|
Targetable = true; Opacity = 1; ConventionalBlend = false;
|
||||||
|
MeterVisible = false; MeterReady = false;
|
||||||
|
EquippedChanged?.Invoke(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Release(); Remaining = MeterPercent = 0; Activations = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Step(float seconds, bool anyControlled, bool primary, bool jump,
|
||||||
|
float energy, bool energyOverride, Action<float> adjustEnergy, bool suppressed = false)
|
||||||
|
{
|
||||||
|
if (!float.IsFinite(seconds) || seconds < 0 || seconds >= 1)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(seconds));
|
||||||
|
if (!float.IsFinite(energy)) throw new ArgumentOutOfRangeException(nameof(energy));
|
||||||
|
ArgumentNullException.ThrowIfNull(adjustEnergy);
|
||||||
|
//Any controlled pointer, not necessarily Jimmy's identity. A NULL
|
||||||
|
//owner freezes timers and hides both meter sprites without cleanup.
|
||||||
|
if (!anyControlled) { MeterVisible = false; return; }
|
||||||
|
if (!Equipped) return;
|
||||||
|
MeterVisible = true;
|
||||||
|
if (primary && !jump)
|
||||||
|
{
|
||||||
|
if (suppressed) return;
|
||||||
|
if (Remaining == 0 && Recharge == Duration)
|
||||||
|
{
|
||||||
|
if (energy <= 2 && !energyOverride) return;
|
||||||
|
adjustEnergy(-2);
|
||||||
|
Remaining = Duration; Recharge = 0; Activations++;
|
||||||
|
ConventionalBlend = false; Opacity = .7f; Targetable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Remaining == 0 && (energy > 0 || energyOverride))
|
||||||
|
{
|
||||||
|
var sum = (double)Recharge + seconds;
|
||||||
|
Recharge = (float)sum;
|
||||||
|
MeterPercent = (float)(sum * (1f / 7) * 100);
|
||||||
|
if (Recharge >= Duration) { Recharge = Duration; MeterReady = true; }
|
||||||
|
}
|
||||||
|
if (Remaining <= 0) return;
|
||||||
|
var remaining = (double)Remaining - seconds;
|
||||||
|
Remaining = (float)remaining;
|
||||||
|
MeterPercent = (float)Math.Max(remaining * (1f / 7) * 100, 0);
|
||||||
|
if (Remaining <= 0)
|
||||||
|
{
|
||||||
|
Remaining = 0; Opacity = 1; Targetable = true;
|
||||||
|
ConventionalBlend = false; MeterReady = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Remaining <= 3)
|
||||||
|
ConventionalBlend = ((int)((double)Remaining * 5) & 1) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ public sealed class LabSimulation
|
|||||||
private readonly Func<Vector3, Vector3, SupportHit?>? cameraRay;
|
private readonly Func<Vector3, Vector3, SupportHit?>? cameraRay;
|
||||||
private readonly Func<Vector3, Vector3, SupportHit?>? ceilingRay;
|
private readonly Func<Vector3, Vector3, SupportHit?>? ceilingRay;
|
||||||
private readonly OriginalBodyPhysics? originalBody;
|
private readonly OriginalBodyPhysics? originalBody;
|
||||||
|
private readonly PlayerEnergy energy;
|
||||||
private readonly Vector3 sourceStart;
|
private readonly Vector3 sourceStart;
|
||||||
private readonly float startYaw, modelMinimumY, rootHeight, startFloor;
|
private readonly float startYaw, modelMinimumY, rootHeight, startFloor;
|
||||||
private float targetYaw, extraAirAcceleration, shadowDistance, lateralContribution;
|
private float targetYaw, extraAirAcceleration, shadowDistance, lateralContribution;
|
||||||
@@ -28,13 +29,28 @@ public sealed class LabSimulation
|
|||||||
private bool forceFall;
|
private bool forceFall;
|
||||||
private Vector3 noclipEntry;
|
private Vector3 noclipEntry;
|
||||||
private float noclipEntryYaw;
|
private float noclipEntryYaw;
|
||||||
|
private int gadgetMode = -1;
|
||||||
public bool Noclip { get; private set; }
|
public bool Noclip { get; private set; }
|
||||||
public bool HasNoclipEntry { get; private set; }
|
public bool HasNoclipEntry { get; private set; }
|
||||||
public float NoclipSpeed { get; set; } = 600;
|
public float NoclipSpeed { get; set; } = 600;
|
||||||
public Func<int>? JetpackInventoryState { get; set; }
|
public Func<int>? JetpackInventoryState { get; set; }
|
||||||
public string LevelCode { get; set; } = "LV1B";
|
public string LevelCode { get; set; } = "LV1B";
|
||||||
public int GadgetMode { get; set; } = -1;
|
public InvisibleGadget Invisible { get; } = new();
|
||||||
public float Energy { get; set; } = 20;
|
public int GadgetMode
|
||||||
|
{
|
||||||
|
get => gadgetMode;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (gadgetMode == 2) Invisible.Release();
|
||||||
|
gadgetMode = -1;
|
||||||
|
if (value == 2 && !Invisible.Equip(Energy, IgnoresGadgetEnergy)) return;
|
||||||
|
gadgetMode = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool IgnoresGadgetEnergy => PlayerEnergy.IsTutorial(LevelCode);
|
||||||
|
public float Energy { get => energy.Value; set => energy.Value = value; }
|
||||||
|
public bool LowEnergyWarning => energy.LowWarning;
|
||||||
|
public event Action<int>? EnergySound;
|
||||||
//Source260/live15C serves both body collision and contact tests. The name
|
//Source260/live15C serves both body collision and contact tests. The name
|
||||||
//predates source-body integration; burst100 is not an interaction-only size.
|
//predates source-body integration; burst100 is not an interaction-only size.
|
||||||
public float InteractionRadius { get; private set; } = 60;
|
public float InteractionRadius { get; private set; } = 60;
|
||||||
@@ -84,12 +100,13 @@ public sealed class LabSimulation
|
|||||||
public LabSimulation(SceneCollision collision, Mesh standingPose, Vector3 start, float yaw,
|
public LabSimulation(SceneCollision collision, Mesh standingPose, Vector3 start, float yaw,
|
||||||
Func<Vector3, Vector3, SupportHit?>? cameraRay = null,
|
Func<Vector3, Vector3, SupportHit?>? cameraRay = null,
|
||||||
Func<Vector3, Vector3, SupportHit?>? ceilingRay = null,
|
Func<Vector3, Vector3, SupportHit?>? ceilingRay = null,
|
||||||
OriginalStaticCollision? originalCollision = null)
|
OriginalStaticCollision? originalCollision = null, PlayerEnergy? energy = null)
|
||||||
{
|
{
|
||||||
this.collision = collision;
|
this.collision = collision;
|
||||||
this.cameraRay = cameraRay;
|
this.cameraRay = cameraRay;
|
||||||
this.ceilingRay = ceilingRay;
|
this.ceilingRay = ceilingRay;
|
||||||
originalBody = originalCollision == null ? null : new OriginalBodyPhysics(originalCollision);
|
originalBody = originalCollision == null ? null : new OriginalBodyPhysics(originalCollision);
|
||||||
|
this.energy = energy ?? new PlayerEnergy();
|
||||||
sourceStart = start;
|
sourceStart = start;
|
||||||
startYaw = yaw;
|
startYaw = yaw;
|
||||||
var bounds = standingPose.Bounds();
|
var bounds = standingPose.Bounds();
|
||||||
@@ -107,6 +124,8 @@ public sealed class LabSimulation
|
|||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
|
if (gadgetMode == 2) gadgetMode = -1;
|
||||||
|
Invisible.Reset();
|
||||||
var floor = collision.GroundHeight(sourceStart, 2500)!.Value;
|
var floor = collision.GroundHeight(sourceStart, 2500)!.Value;
|
||||||
Position = new(sourceStart.X, floor + (UsesOriginalBody ? 0 : SceneCollision.Skin), sourceStart.Z);
|
Position = new(sourceStart.X, floor + (UsesOriginalBody ? 0 : SceneCollision.Skin), sourceStart.Z);
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
@@ -162,7 +181,7 @@ public sealed class LabSimulation
|
|||||||
return ((float)Math.Sin(radians), (float)Math.Cos(radians));
|
return ((float)Math.Sin(radians), (float)Math.Cos(radians));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Step(PlayerInput input, bool controlled = true)
|
public void Step(PlayerInput input, bool controlled = true, bool? anyControlled = null)
|
||||||
{
|
{
|
||||||
if (Noclip) { StepNoclip(input); return; }
|
if (Noclip) { StepNoclip(input); return; }
|
||||||
//47E554 global body integration precedes473740 registry callbacks.
|
//47E554 global body integration precedes473740 registry callbacks.
|
||||||
@@ -176,8 +195,11 @@ public sealed class LabSimulation
|
|||||||
//424BE0..424C34 runs this wrapper before437940's ownership gate.
|
//424BE0..424C34 runs this wrapper before437940's ownership gate.
|
||||||
StepCeiling();
|
StepCeiling();
|
||||||
if (controlled) StepPlayer(input);
|
if (controlled) StepPlayer(input);
|
||||||
|
Invisible.Step(FixedStepClock.Step, anyControlled ?? controlled, input.Fire, input.Jump,
|
||||||
|
Energy, IgnoresGadgetEnergy, AdjustEnergy);
|
||||||
var effect = JetpackBurst.StepEffect(jumpState, Grounded, FixedStepClock.Step, Energy, LevelCode);
|
var effect = JetpackBurst.StepEffect(jumpState, Grounded, FixedStepClock.Step, Energy, LevelCode);
|
||||||
jumpState = effect.State; Energy = effect.Energy; JetpackEffectVisible = effect.Visible;
|
jumpState = effect.State; JetpackEffectVisible = effect.Visible;
|
||||||
|
if (effect.Visible) AdjustEnergy(-FixedStepClock.Step * JetpackBurst.EnergyPerSecond);
|
||||||
EffectSteps++;
|
EffectSteps++;
|
||||||
if (controlled && InputAfterPlayerUpdate) StepInput(input);
|
if (controlled && InputAfterPlayerUpdate) StepInput(input);
|
||||||
Steps++;
|
Steps++;
|
||||||
@@ -192,6 +214,7 @@ public sealed class LabSimulation
|
|||||||
|
|
||||||
public void StopForPrimaryFire() => Speed = 0;
|
public void StopForPrimaryFire() => Speed = 0;
|
||||||
public void SetShooting(bool shooting) => Shooting = shooting;
|
public void SetShooting(bool shooting) => Shooting = shooting;
|
||||||
|
public void AdjustEnergy(float delta) => energy.Adjust(delta, LevelCode, id => EnergySound?.Invoke(id));
|
||||||
|
|
||||||
private void StepCeiling()
|
private void StepCeiling()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
namespace GamePort.Game;
|
||||||
|
|
||||||
|
/// <summary>42A920 global energy and low-warning latch. Retained across ordinary
|
||||||
|
/// level loads; the original TSK stores the scalar, not this warning latch.</summary>
|
||||||
|
public sealed class PlayerEnergy
|
||||||
|
{
|
||||||
|
private float value = 20;
|
||||||
|
public float Value
|
||||||
|
{
|
||||||
|
get => value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!float.IsFinite(value)) throw new ArgumentOutOfRangeException(nameof(value));
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool LowWarning { get; private set; }
|
||||||
|
|
||||||
|
public void Adjust(float delta, string level, Action<int>? sound = null)
|
||||||
|
{
|
||||||
|
if (!float.IsFinite(delta)) throw new ArgumentOutOfRangeException(nameof(delta));
|
||||||
|
ArgumentNullException.ThrowIfNull(level);
|
||||||
|
if (IsTutorial(level)) return;
|
||||||
|
//The first x87 sum is compared before a float store. Sound80 precedes
|
||||||
|
//the write; the helper then reloads the live global for the actual add.
|
||||||
|
if (value > 0 && (double)value + delta <= 0) sound?.Invoke(80);
|
||||||
|
var sum = (double)value + delta;
|
||||||
|
value = (float)sum;
|
||||||
|
if (sum > 100) { value = 100; LowWarning = false; return; }
|
||||||
|
if (value < 0) value = 0;
|
||||||
|
if (value < 19)
|
||||||
|
{
|
||||||
|
if (!LowWarning)
|
||||||
|
{
|
||||||
|
sound?.Invoke(182);
|
||||||
|
LowWarning = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (value > 20) LowWarning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsTutorial(string level)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(level);
|
||||||
|
if (level.Length != 4) return false;
|
||||||
|
var code = ((uint)level[0] << 24) | ((uint)level[1] << 16)
|
||||||
|
| ((uint)level[2] << 8) | level[3];
|
||||||
|
return code is >= 0x56523031 and <= 0x56523038;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,14 +17,16 @@ public sealed class PlayerSceneBinding : IDisposable
|
|||||||
this.director = director; this.player = player; this.inventory = inventory; this.tag = tag;
|
this.director = director; this.player = player; this.inventory = inventory; this.tag = tag;
|
||||||
director.ActorPreparing += Prepare;
|
director.ActorPreparing += Prepare;
|
||||||
director.AuthoredTransformChanged += Transform;
|
director.AuthoredTransformChanged += Transform;
|
||||||
|
director.GadgetReleaseRequested += Release;
|
||||||
inventory.GadgetSelected += Selected;
|
inventory.GadgetSelected += Selected;
|
||||||
|
player.Invisible.EquippedChanged += InvisibleEquipped;
|
||||||
Selected(inventory.SelectedGadget);
|
Selected(inventory.SelectedGadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Step(PlayerInput input)
|
public bool Step(PlayerInput input)
|
||||||
{
|
{
|
||||||
var acceptsInput = director.Controlled || player.Noclip;
|
var acceptsInput = director.Controlled || player.Noclip;
|
||||||
player.Step(input, acceptsInput);
|
player.Step(input, acceptsInput, director.ControlledTag != null);
|
||||||
var rotation = director.FindActor(tag)?.Rotation ?? Vector3.Zero;
|
var rotation = director.FindActor(tag)?.Rotation ?? Vector3.Zero;
|
||||||
director.SyncActor(tag, player.ActorRoot, rotation with { Y = player.Yaw });
|
director.SyncActor(tag, player.ActorRoot, rotation with { Y = player.Yaw });
|
||||||
return acceptsInput;
|
return acceptsInput;
|
||||||
@@ -35,17 +37,30 @@ public sealed class PlayerSceneBinding : IDisposable
|
|||||||
if (!string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase)) return;
|
if (!string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase)) return;
|
||||||
if (action == ScriptPreparation.StopMotion) player.PrepareForScript();
|
if (action == ScriptPreparation.StopMotion) player.PrepareForScript();
|
||||||
else if (action == ScriptPreparation.ReleaseGadget)
|
else if (action == ScriptPreparation.ReleaseGadget)
|
||||||
{
|
Release(actor);
|
||||||
//427FF0 has distinct cases. Only no-selection/jetpack cleanup is
|
}
|
||||||
//implemented; do not turn the other gadget cases into blanket resets.
|
|
||||||
if (inventory.SelectedGadget is -1 or 3)
|
private void Release(DirectorActor actor)
|
||||||
{ inventory.SelectGadget(-1); player.GadgetMode = -1; }
|
{
|
||||||
else UnsupportedGadgetCleanups++;
|
if (!string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase)) return;
|
||||||
}
|
//427FF0 switches raw mode, not display selection. A rejected Invisible
|
||||||
|
//equip can leave display2 with raw mode-1; cleanup does not equip it.
|
||||||
|
if (player.GadgetMode == 2 || inventory.SelectedGadget is -1 or 3)
|
||||||
|
{ inventory.SelectGadget(-1); player.GadgetMode = -1; }
|
||||||
|
else if (player.GadgetMode != -1) UnsupportedGadgetCleanups++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Selected(int item) => player.GadgetMode = GadgetScreen.EquippedMode(item);
|
private void Selected(int item) => player.GadgetMode = GadgetScreen.EquippedMode(item);
|
||||||
|
|
||||||
|
private void InvisibleEquipped(bool equipped)
|
||||||
|
{
|
||||||
|
if (director.FindActor("C3DGODDARD") is not { } companion) return;
|
||||||
|
//427FF0 requires Goddard complete9E8==false before showing/enabling.
|
||||||
|
//These six PostLoad levels set that flag (retained-companion.md).
|
||||||
|
if (!equipped && player.LevelCode is "LEV6" or "LEV7" or "LV1C" or "LV1D" or "LV4A" or "LV6A") return;
|
||||||
|
companion.Visible = companion.MovementEnabled = companion.BodyEnabled = !equipped;
|
||||||
|
}
|
||||||
|
|
||||||
private void Transform(DirectorActor actor)
|
private void Transform(DirectorActor actor)
|
||||||
{
|
{
|
||||||
if (string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -56,6 +71,8 @@ public sealed class PlayerSceneBinding : IDisposable
|
|||||||
{
|
{
|
||||||
director.ActorPreparing -= Prepare;
|
director.ActorPreparing -= Prepare;
|
||||||
director.AuthoredTransformChanged -= Transform;
|
director.AuthoredTransformChanged -= Transform;
|
||||||
|
director.GadgetReleaseRequested -= Release;
|
||||||
inventory.GadgetSelected -= Selected;
|
inventory.GadgetSelected -= Selected;
|
||||||
|
player.Invisible.EquippedChanged -= InvisibleEquipped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,10 @@ public sealed class DirectorActor
|
|||||||
public Vector3 Rotation { get; internal set; }
|
public Vector3 Rotation { get; internal set; }
|
||||||
public bool Visible { get; internal set; }
|
public bool Visible { get; internal set; }
|
||||||
public bool Active { get; internal set; }
|
public bool Active { get; internal set; }
|
||||||
|
//Source body integration and movement-enable flags are separate from AI
|
||||||
|
//activation. Only the bounded companion gadget consumer writes them here.
|
||||||
|
public bool BodyEnabled { get; internal set; } = true;
|
||||||
|
public bool MovementEnabled { get; internal set; } = true;
|
||||||
public string Animation { get; internal set; } = "STOP";
|
public string Animation { get; internal set; } = "STOP";
|
||||||
public int AIstate { get; internal set; }
|
public int AIstate { get; internal set; }
|
||||||
public float Speed { get; internal set; }
|
public float Speed { get; internal set; }
|
||||||
@@ -93,6 +97,7 @@ public sealed class SceneDirector
|
|||||||
public event Action? MusicRestarted;
|
public event Action? MusicRestarted;
|
||||||
public event Action<DirectorActor>? ActorChanged;
|
public event Action<DirectorActor>? ActorChanged;
|
||||||
public event Action<DirectorActor, ScriptPreparation>? ActorPreparing;
|
public event Action<DirectorActor, ScriptPreparation>? ActorPreparing;
|
||||||
|
public event Action<DirectorActor>? GadgetReleaseRequested;
|
||||||
public event Action<DirectorActor>? AuthoredTransformChanged;
|
public event Action<DirectorActor>? AuthoredTransformChanged;
|
||||||
public event Action<string, string>? Unsupported;
|
public event Action<string, string>? Unsupported;
|
||||||
|
|
||||||
@@ -138,6 +143,7 @@ public sealed class SceneDirector
|
|||||||
var initial = new DirectorActor(source, actor.Tag, actor.Kind, source.Position);
|
var initial = new DirectorActor(source, actor.Tag, actor.Kind, source.Position);
|
||||||
actor.Position = initial.Position; actor.Rotation = initial.Rotation;
|
actor.Position = initial.Position; actor.Rotation = initial.Rotation;
|
||||||
actor.Visible = initial.Visible; actor.Active = initial.Active;
|
actor.Visible = initial.Visible; actor.Active = initial.Active;
|
||||||
|
actor.BodyEnabled = initial.BodyEnabled; actor.MovementEnabled = initial.MovementEnabled;
|
||||||
actor.Animation = initial.Animation; actor.AIstate = initial.AIstate;
|
actor.Animation = initial.Animation; actor.AIstate = initial.AIstate;
|
||||||
actor.Speed = initial.Speed; actor.Patrol = initial.Patrol;
|
actor.Speed = initial.Speed; actor.Patrol = initial.Patrol;
|
||||||
actor.SpritePlaying = initial.SpritePlaying; actor.SpriteRevision++;
|
actor.SpritePlaying = initial.SpritePlaying; actor.SpriteRevision++;
|
||||||
@@ -336,6 +342,7 @@ public sealed class SceneDirector
|
|||||||
|
|
||||||
private void StartMulti(GamEntity entity)
|
private void StartMulti(GamEntity entity)
|
||||||
{
|
{
|
||||||
|
DeactivateInvention(entity); //43129A: explicit Jimmy lookup, before first target check.
|
||||||
// MCA's PlayerControlled is its completion target (4311F0), not an
|
// MCA's PlayerControlled is its completion target (4311F0), not an
|
||||||
// activation grant. Only initial activation clears control; later shots
|
// activation grant. Only initial activation clears control; later shots
|
||||||
//use431750 without repeating431502..4315A7 preparation.
|
//use431750 without repeating431502..4315A7 preparation.
|
||||||
@@ -353,11 +360,12 @@ public sealed class SceneDirector
|
|||||||
{
|
{
|
||||||
if (applyCommon)
|
if (applyCommon)
|
||||||
{
|
{
|
||||||
|
DeactivateInvention(entity); //4165B7, distinct from raw-owner preparation.
|
||||||
if (Equal(entity.Text("PlayerControlled"), "NULL"))
|
if (Equal(entity.Text("PlayerControlled"), "NULL"))
|
||||||
PrepareOwner(ScriptPreparation.ReleaseGadget, ScriptPreparation.StopMotion, ScriptPreparation.FlattenOrientation);
|
PrepareOwner(ScriptPreparation.ReleaseGadget, ScriptPreparation.StopMotion, ScriptPreparation.FlattenOrientation);
|
||||||
SetControl(entity); Toggle(entity);
|
SetControl(entity); Toggle(entity);
|
||||||
}
|
}
|
||||||
if (entity.Integer("DeactivateInv") != 0) InventoryEnabled = false;
|
if (entity.Integer("DeactivateInv", 1) != 0) InventoryEnabled = false;
|
||||||
if (skipping)
|
if (skipping)
|
||||||
{
|
{
|
||||||
if (index >= 0) FinishMulti(entity);
|
if (index >= 0) FinishMulti(entity);
|
||||||
@@ -512,6 +520,14 @@ public sealed class SceneDirector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeactivateInvention(GamEntity source)
|
||||||
|
{
|
||||||
|
//Both CAM/MCA constructors default this property to true. The source
|
||||||
|
//explicitly looks up Jimmy even when a different actor owns control.
|
||||||
|
if (source.Integer("DeactivateInv", 1) != 0 && actors.TryGetValue("JIM1", out var jimmy))
|
||||||
|
GadgetReleaseRequested?.Invoke(jimmy);
|
||||||
|
}
|
||||||
|
|
||||||
private void SetControl(GamEntity entity, bool prepareOwner = false)
|
private void SetControl(GamEntity entity, bool prepareOwner = false)
|
||||||
{
|
{
|
||||||
var control = entity.Text("PlayerControlled");
|
var control = entity.Text("PlayerControlled");
|
||||||
|
|||||||
@@ -52,12 +52,11 @@ public sealed class SceneGadgets : IDisposable
|
|||||||
player.SetShooting(player.Grounded);
|
player.SetShooting(player.Grounded);
|
||||||
if (!loop) { Sound?.Invoke(0,true); loop = true; }
|
if (!loop) { Sound?.Invoke(0,true); loop = true; }
|
||||||
const float dt = FixedStepClock.Step;
|
const float dt = FixedStepClock.Step;
|
||||||
if (!(player.LevelCode.Length == 4 && player.LevelCode.StartsWith("VR0",StringComparison.Ordinal)
|
player.AdjustEnergy(-dt);
|
||||||
&& player.LevelCode[3] is >= '1' and <= '8')) player.Energy = Math.Clamp(player.Energy - dt,0,100);
|
|
||||||
//Bridge modern signed float yaw to the source's nonnegative Euler domain.
|
//Bridge modern signed float yaw to the source's nonnegative Euler domain.
|
||||||
var yaw = (player.Yaw % 360 + 360) % 360;
|
var yaw = (player.Yaw % 360 + 360) % 360;
|
||||||
var hits = Ray.Fire(player.ActorRoot,yaw,dt,
|
var hits = Ray.Fire(player.ActorRoot,yaw,dt,
|
||||||
Soldiers.Select(s => new ShrinkCandidate(s.Actor.Tag,s.Actor.Position,Shrunk:s.Shrunk)),
|
Soldiers.Select(s => new ShrinkCandidate(s.Actor.Tag,s.Actor.Position,BodyEnabled:s.Actor.BodyEnabled,Shrunk:s.Shrunk)),
|
||||||
(start,end) => geometry.TraceGeometry(start,end));
|
(start,end) => geometry.TraceGeometry(start,end));
|
||||||
foreach (var tag in hits)
|
foreach (var tag in hits)
|
||||||
{
|
{
|
||||||
|
|||||||
+51
-9
@@ -20,9 +20,10 @@ internal static class Program
|
|||||||
PlayerLevelState? carriedPlayer = null;
|
PlayerLevelState? carriedPlayer = null;
|
||||||
var returning = false;
|
var returning = false;
|
||||||
var diagnostics = new DebugDiagnostics { Enabled = args.Contains("--debug-overlay") };
|
var diagnostics = new DebugDiagnostics { Enabled = args.Contains("--debug-overlay") };
|
||||||
|
var energy = new PlayerEnergy();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var result = Run(args, carriedSave, carriedPlayer, returning, diagnostics, presentation, out var continuation);
|
var result = Run(args, carriedSave, carriedPlayer, returning, diagnostics, presentation, energy, out var continuation);
|
||||||
if (result != 0 || continuation == null) return result;
|
if (result != 0 || continuation == null) return result;
|
||||||
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
||||||
carriedPlayer = continuation.Player;
|
carriedPlayer = continuation.Player;
|
||||||
@@ -43,7 +44,7 @@ internal static class Program
|
|||||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning, PlayerLevelState? Player);
|
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning, PlayerLevelState? Player);
|
||||||
|
|
||||||
private static int Run(string[] args, OriginalSave? carriedSave, PlayerLevelState? carriedPlayer, bool returning, DebugDiagnostics diagnostics,
|
private static int Run(string[] args, OriginalSave? carriedSave, PlayerLevelState? carriedPlayer, bool returning, DebugDiagnostics diagnostics,
|
||||||
RenderSession presentation, out SceneContinuation? continuation)
|
RenderSession presentation, PlayerEnergy energy, out SceneContinuation? continuation)
|
||||||
{
|
{
|
||||||
continuation = null;
|
continuation = null;
|
||||||
if (args.Contains("--help"))
|
if (args.Contains("--help"))
|
||||||
@@ -86,6 +87,7 @@ internal static class Program
|
|||||||
--smoke-practice-window SDL practice pause/dismiss/resize check (12 frames)
|
--smoke-practice-window SDL practice pause/dismiss/resize check (12 frames)
|
||||||
--smoke-jetpack 300-step powered steering/jump check in VR04
|
--smoke-jetpack 300-step powered steering/jump check in VR04
|
||||||
--smoke-shrink-ray Fire at an actual VR04 soldier; explicit player-placement fixture
|
--smoke-shrink-ray Fire at an actual VR04 soldier; explicit player-placement fixture
|
||||||
|
--smoke-invisible Accelerated recharge/activation/flash/expiry/unequip fixture in VR03
|
||||||
--gadget-menu Render original gadget panel (--skip-intro); fixture owns item3
|
--gadget-menu Render original gadget panel (--skip-intro); fixture owns item3
|
||||||
--smoke-gadget-menu SDL menu input/pause/selection/practice/Return check (24 frames)
|
--smoke-gadget-menu SDL menu input/pause/selection/practice/Return check (24 frames)
|
||||||
--smoke-jump-key NAME Replay using shift/right-shift/insert/keypad0/right-mouse
|
--smoke-jump-key NAME Replay using shift/right-shift/insert/keypad0/right-mouse
|
||||||
@@ -255,6 +257,7 @@ internal static class Program
|
|||||||
var walkSmoke = args.Contains("--smoke-walk");
|
var walkSmoke = args.Contains("--smoke-walk");
|
||||||
var jetpackSmoke = args.Contains("--smoke-jetpack");
|
var jetpackSmoke = args.Contains("--smoke-jetpack");
|
||||||
var shrinkSmoke = args.Contains("--smoke-shrink-ray");
|
var shrinkSmoke = args.Contains("--smoke-shrink-ray");
|
||||||
|
var invisibleSmoke = args.Contains("--smoke-invisible");
|
||||||
var carlSmoke = args.Contains("--smoke-carl-cutscene");
|
var carlSmoke = args.Contains("--smoke-carl-cutscene");
|
||||||
var controlPhaseSmoke = args.Contains("--smoke-control-phases");
|
var controlPhaseSmoke = args.Contains("--smoke-control-phases");
|
||||||
var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
|
var objectiveWindowSmoke = args.Contains("--smoke-objective-window");
|
||||||
@@ -275,7 +278,7 @@ internal static class Program
|
|||||||
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
|
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
|
||||||
&& animationPath == null && !args.Contains("--time");
|
&& animationPath == null && !args.Contains("--time");
|
||||||
var story = defaultStory || loadedSave != null || saveOutput != null || args.Contains("--story") || args.Contains("--story-time")
|
var story = defaultStory || loadedSave != null || saveOutput != null || args.Contains("--story") || args.Contains("--story-time")
|
||||||
|| args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || gadgetWindowSmoke || practiceWindowSmoke || practiceReturnSmoke || carlSmoke || controlPhaseSmoke || objectiveSmoke;
|
|| args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || gadgetWindowSmoke || practiceWindowSmoke || practiceReturnSmoke || carlSmoke || controlPhaseSmoke || objectiveSmoke;
|
||||||
if (story && (args.Contains("--inspect") || walkSmoke || args.Contains("--smoke-window")))
|
if (story && (args.Contains("--inspect") || walkSmoke || args.Contains("--smoke-window")))
|
||||||
throw new ArgumentException("Story playback requires its own simulation mode.");
|
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.");
|
if (walkSmoke && args.Contains("--inspect")) throw new ArgumentException("Walk smoke cannot run in inspection mode.");
|
||||||
@@ -299,6 +302,7 @@ internal static class Program
|
|||||||
SceneHud? hud = null;
|
SceneHud? hud = null;
|
||||||
GadgetScreen? gadgetScreen = null;
|
GadgetScreen? gadgetScreen = null;
|
||||||
GadgetMenuOverlay? gadgetOverlay = null;
|
GadgetMenuOverlay? gadgetOverlay = null;
|
||||||
|
InvisibleMeterOverlay? invisibleMeter = null;
|
||||||
SceneGadgets? gadgets = null;
|
SceneGadgets? gadgets = null;
|
||||||
ShrinkRayVisuals? rayVisuals = null;
|
ShrinkRayVisuals? rayVisuals = null;
|
||||||
ShrinkSoldierVisuals? soldierVisuals = null;
|
ShrinkSoldierVisuals? soldierVisuals = null;
|
||||||
@@ -322,6 +326,7 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
var characterOffset = mesh.Vertices.Length;
|
var characterOffset = mesh.Vertices.Length;
|
||||||
var characterModel = Matrix4x4.Identity;
|
var characterModel = Matrix4x4.Identity;
|
||||||
|
MeshDraw? characterDraw = null;
|
||||||
if (animationPath != null)
|
if (animationPath != null)
|
||||||
{
|
{
|
||||||
if (scene == null || originalStart == null)
|
if (scene == null || originalStart == null)
|
||||||
@@ -336,7 +341,7 @@ internal static class Program
|
|||||||
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation.Y,
|
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation.Y,
|
||||||
cameraRay == null ? null : (look, eye) => cameraRay.Trace(look, eye),
|
cameraRay == null ? null : (look, eye) => cameraRay.Trace(look, eye),
|
||||||
cameraRay == null ? null : (start, end) => cameraRay.TraceGeometry(start, end),
|
cameraRay == null ? null : (start, end) => cameraRay.TraceGeometry(start, end),
|
||||||
level.Code == "VR04" ? OriginalStaticCollision.FromRouteScene(world,level.Code) : null)
|
level.Code == "VR04" ? OriginalStaticCollision.FromRouteScene(world,level.Code) : null, energy)
|
||||||
{ LevelCode = level.Code, InputAfterPlayerUpdate = carriedSave != null };
|
{ LevelCode = level.Code, InputAfterPlayerUpdate = carriedSave != null };
|
||||||
if (carriedPlayer != null)
|
if (carriedPlayer != null)
|
||||||
{
|
{
|
||||||
@@ -353,6 +358,7 @@ internal static class Program
|
|||||||
var placement = PreviewCharacterPlacement.Create(mesh, standingPose, originalStart.Position, originalStart.Rotation.Y);
|
var placement = PreviewCharacterPlacement.Create(mesh, standingPose, originalStart.Position, originalStart.Rotation.Y);
|
||||||
characterModel = placement.Model;
|
characterModel = placement.Model;
|
||||||
mesh = animations.Current.AppendTo(mesh);
|
mesh = animations.Current.AppendTo(mesh);
|
||||||
|
characterDraw = mesh.Draws[^1];
|
||||||
if (walking)
|
if (walking)
|
||||||
Console.WriteLine("Controllable lab: arrows move/turn; Shift/Insert/right mouse jump; Enter/Ctrl/left mouse fire; Tab/Space gadgets; R reset; C inspect; F11 fullscreen; Escape quit. Collision, pivot and timing remain provisional.");
|
Console.WriteLine("Controllable lab: arrows move/turn; Shift/Insert/right mouse jump; Enter/Ctrl/left mouse fire; Tab/Space gadgets; R reset; C inspect; F11 fullscreen; Escape quit. Collision, pivot and timing remain provisional.");
|
||||||
else
|
else
|
||||||
@@ -440,6 +446,8 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
hud = new SceneHud(mesh, Path.Combine(Path.GetDirectoryName(scene!)!, "../ui/ui.json"));
|
hud = new SceneHud(mesh, Path.Combine(Path.GetDirectoryName(scene!)!, "../ui/ui.json"));
|
||||||
mesh = hud.Mesh;
|
mesh = hud.Mesh;
|
||||||
|
invisibleMeter = new InvisibleMeterOverlay(mesh,Path.Combine(Path.GetDirectoryName(scene!)!,"../invisible-meter/meter.json"));
|
||||||
|
mesh = invisibleMeter.Mesh;
|
||||||
gadgetOverlay = new GadgetMenuOverlay(mesh, Path.Combine(Path.GetDirectoryName(scene!)!, "../gadgets/gadgets.json"));
|
gadgetOverlay = new GadgetMenuOverlay(mesh, Path.Combine(Path.GetDirectoryName(scene!)!, "../gadgets/gadgets.json"));
|
||||||
mesh = gadgetOverlay.Mesh;
|
mesh = gadgetOverlay.Mesh;
|
||||||
Console.WriteLine($"Prepared source model actors: {staticVisuals.ActorCount}.");
|
Console.WriteLine($"Prepared source model actors: {staticVisuals.ActorCount}.");
|
||||||
@@ -472,11 +480,13 @@ internal static class Program
|
|||||||
var storyTime = double.Parse(Option(args, "--story-time") ?? "0", System.Globalization.CultureInfo.InvariantCulture);
|
var storyTime = double.Parse(Option(args, "--story-time") ?? "0", System.Globalization.CultureInfo.InvariantCulture);
|
||||||
if (!double.IsFinite(storyTime) || storyTime < 0 || storyTime > 3600 || storyTime > 0 && !headless)
|
if (!double.IsFinite(storyTime) || storyTime < 0 || storyTime > 3600 || storyTime > 0 && !headless)
|
||||||
throw new ArgumentException("Story time must be0..3600 seconds in headless mode.");
|
throw new ArgumentException("Story time must be0..3600 seconds in headless mode.");
|
||||||
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : shrinkSmoke ? "90" : gadgetWindowSmoke ? "24" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : controlPhaseSmoke ? "32" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : shrinkSmoke ? "90" : invisibleSmoke ? "8" : gadgetWindowSmoke ? "24" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : controlPhaseSmoke ? "32" : toolsSmoke ? "20" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
|
||||||
if (gadgetWindowSmoke && (headless || level?.Code != "LV1B" || loadedSave != null || frames < 24))
|
if (gadgetWindowSmoke && (headless || level?.Code != "LV1B" || loadedSave != null || frames < 24))
|
||||||
throw new ArgumentException("Gadget menu SDL fixture requires a fresh windowed lab and24 frames");
|
throw new ArgumentException("Gadget menu SDL fixture requires a fresh windowed lab and24 frames");
|
||||||
if (shrinkSmoke && (level?.Code != "VR04" || gadgets == null || frames < 60))
|
if (shrinkSmoke && (level?.Code != "VR04" || gadgets == null || frames < 60))
|
||||||
throw new ArgumentException("Shrink-ray smoke requires actual VR04 and at least60 frames");
|
throw new ArgumentException("Shrink-ray smoke requires actual VR04 and at least60 frames");
|
||||||
|
if (invisibleSmoke && (level?.Code != "VR03" || frames < 8 || loadedSave != null))
|
||||||
|
throw new ArgumentException("Invisible smoke requires a fresh VR03 and at least8 frames");
|
||||||
if (controlPhaseSmoke && (level?.Code != "LV1B" || loadedSave != null || frames < 32 || director == null))
|
if (controlPhaseSmoke && (level?.Code != "LV1B" || loadedSave != null || frames < 32 || director == null))
|
||||||
throw new ArgumentException("Control-phase fixture needs a fresh lab and at least32 frames");
|
throw new ArgumentException("Control-phase fixture needs a fresh lab and at least32 frames");
|
||||||
if (toolsSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
|
if (toolsSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
|
||||||
@@ -509,6 +519,7 @@ internal static class Program
|
|||||||
ShrinkSoldier? shrinkVictim = null;
|
ShrinkSoldier? shrinkVictim = null;
|
||||||
var shrinkPhaseMask = 0;
|
var shrinkPhaseMask = 0;
|
||||||
var sawShrinkKey = false;
|
var sawShrinkKey = false;
|
||||||
|
InvisibleSmoke? invisibleFixture = null;
|
||||||
Console.WriteLine($"Scene presentation: revision={renderer.SceneRevision}, windows={presentation.WindowCreationCount}, renderers={presentation.RendererCreationCount}, window ID={(window == 0 ? 0 : Sdl.SDL_GetWindowID(window))}, size={renderer.Width}x{renderer.Height}.");
|
Console.WriteLine($"Scene presentation: revision={renderer.SceneRevision}, windows={presentation.WindowCreationCount}, renderers={presentation.RendererCreationCount}, window ID={(window == 0 ? 0 : Sdl.SDL_GetWindowID(window))}, size={renderer.Width}x{renderer.Height}.");
|
||||||
{
|
{
|
||||||
using var audio = Option(args, "--audio") is { } audioFile
|
using var audio = Option(args, "--audio") is { } audioFile
|
||||||
@@ -535,6 +546,7 @@ internal static class Program
|
|||||||
director.MusicRestarted += sceneAudio.RestartMusic;
|
director.MusicRestarted += sceneAudio.RestartMusic;
|
||||||
objectivePanel!.SoundEffect += id => { if (level!.Code == "LV1B") sceneAudio.Effect(id); };
|
objectivePanel!.SoundEffect += id => { if (level!.Code == "LV1B") sceneAudio.Effect(id); };
|
||||||
interactions!.SoundEffect += id => sceneAudio.Effect(id);
|
interactions!.SoundEffect += id => sceneAudio.Effect(id);
|
||||||
|
simulation!.EnergySound += id => sceneAudio.Effect(id);
|
||||||
mechanisms!.Sound += (actor, id, loop) => sceneAudio.Effect(id, loop ? actor.Tag : null);
|
mechanisms!.Sound += (actor, id, loop) => sceneAudio.Effect(id, loop ? actor.Tag : null);
|
||||||
mechanisms.StopSound += actor => sceneAudio.StopLoop(actor.Tag);
|
mechanisms.StopSound += actor => sceneAudio.StopLoop(actor.Tag);
|
||||||
sceneAudio.Music(originalStart!.Text("MusicDatabase") ?? "none", originalStart.Integer("MusicIndex", -1));
|
sceneAudio.Music(originalStart!.Text("MusicDatabase") ?? "none", originalStart.Integer("MusicIndex", -1));
|
||||||
@@ -556,7 +568,7 @@ internal static class Program
|
|||||||
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
|
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
|
||||||
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
||||||
}
|
}
|
||||||
if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
||||||
if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); }
|
if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); }
|
||||||
if (controlPhaseSmoke)
|
if (controlPhaseSmoke)
|
||||||
{
|
{
|
||||||
@@ -636,6 +648,7 @@ internal static class Program
|
|||||||
throw new InvalidOperationException("Gadget screen requires player control (--skip-intro)");
|
throw new InvalidOperationException("Gadget screen requires player control (--skip-intro)");
|
||||||
gadgetScreen.Point(new(200,380), level!.Code, storyTasks!.Get("SCENE"));
|
gadgetScreen.Point(new(200,380), level!.Code, storyTasks!.Get("SCENE"));
|
||||||
}
|
}
|
||||||
|
if (invisibleSmoke) invisibleFixture = new(simulation!,interactions!.Inventory);
|
||||||
if (shrinkSmoke)
|
if (shrinkSmoke)
|
||||||
{
|
{
|
||||||
//Explicit test placement near an ACTUAL authored soldier.
|
//Explicit test placement near an ACTUAL authored soldier.
|
||||||
@@ -803,6 +816,12 @@ internal static class Program
|
|||||||
debugMenu.Message = "DEBUG INPUT ORDER TOGGLED; NEW LEVEL RESTORES SOURCE POLICY"; break;
|
debugMenu.Message = "DEBUG INPUT ORDER TOGGLED; NEW LEVEL RESTORES SOURCE POLICY"; break;
|
||||||
case DebugAction.ApplyJetpackState when interactions != null:
|
case DebugAction.ApplyJetpackState when interactions != null:
|
||||||
interactions.Inventory.SetState(0, 3, debugMenu.JetpackState); debugMenu.Message = "JET PACK AVAILABILITY APPLIED"; break;
|
interactions.Inventory.SetState(0, 3, debugMenu.JetpackState); debugMenu.Message = "JET PACK AVAILABILITY APPLIED"; break;
|
||||||
|
case DebugAction.GiveInvisible when interactions != null:
|
||||||
|
interactions.Inventory.SetState(0,2,1); interactions.Inventory.SelectGadget(2);
|
||||||
|
debugMenu.Message = simulation?.GadgetMode == 2 ? "INVISIBLE EQUIPPED - RECHARGE 7 SECONDS, THEN FIRE"
|
||||||
|
: "INVISIBLE OWNED - ENERGY REQUIRED TO EQUIP"; break;
|
||||||
|
case DebugAction.UnequipGadget when interactions != null:
|
||||||
|
interactions.Inventory.SelectGadget(-1); debugMenu.Message = "GADGET UNEQUIPPED"; break;
|
||||||
case DebugAction.CameraObstruction when debugCameraRay != null:
|
case DebugAction.CameraObstruction when debugCameraRay != null:
|
||||||
debugCameraRay.Enabled = !debugCameraRay.Enabled; debugMenu.Message = "STATIC CAMERA QUERY TOGGLED"; break;
|
debugCameraRay.Enabled = !debugCameraRay.Enabled; debugMenu.Message = "STATIC CAMERA QUERY TOGGLED"; break;
|
||||||
case DebugAction.MuteMusic or DebugAction.MuteSpeech or DebugAction.MuteEffects when sceneAudio != null:
|
case DebugAction.MuteMusic or DebugAction.MuteSpeech or DebugAction.MuteEffects when sceneAudio != null:
|
||||||
@@ -868,6 +887,11 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
|
invisibleFixture?.BeforeFrame(count,(key,down)=>
|
||||||
|
{
|
||||||
|
var e = new Sdl.Event {Type=down?Sdl.KeyDown:Sdl.KeyUp,Scancode=key,Down=down?(byte)1:(byte)0};
|
||||||
|
if(!Sdl.SDL_PushEvent(ref e)) throw new InvalidOperationException(Sdl.Error);
|
||||||
|
},headless);
|
||||||
if (gadgetWindowSmoke)
|
if (gadgetWindowSmoke)
|
||||||
{
|
{
|
||||||
void Key(uint key,bool down) { var e=new Sdl.Event {Type=down?Sdl.KeyDown:Sdl.KeyUp,Scancode=key,Down=down?(byte)1:(byte)0};
|
void Key(uint key,bool down) { var e=new Sdl.Event {Type=down?Sdl.KeyDown:Sdl.KeyUp,Scancode=key,Down=down?(byte)1:(byte)0};
|
||||||
@@ -990,7 +1014,7 @@ internal static class Program
|
|||||||
if (e.Type == Sdl.MouseButtonUp && e.MouseButton == 3) mouseJump = false;
|
if (e.Type == Sdl.MouseButtonUp && e.MouseButton == 3) mouseJump = false;
|
||||||
if (e.Type == Sdl.KeyDown)
|
if (e.Type == Sdl.KeyDown)
|
||||||
{
|
{
|
||||||
if (shrinkSmoke && e.Scancode == 224) sawShrinkKey = true;
|
if ((shrinkSmoke || invisibleSmoke) && e.Scancode == 224) sawShrinkKey = true;
|
||||||
keys.Add(e.Scancode);
|
keys.Add(e.Scancode);
|
||||||
if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == jumpScancode ? 4 : 0;
|
if (walkSmoke) sawWalkKeys |= e.Scancode == 82 ? 1 : e.Scancode == 79 ? 2 : e.Scancode == jumpScancode ? 4 : 0;
|
||||||
if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == jumpScancode ? 8 : 0;
|
if (jetpackSmoke) sawJetpackKeys |= e.Scancode == 82 ? 1 : e.Scancode == 81 ? 2 : e.Scancode == 80 ? 4 : e.Scancode == jumpScancode ? 8 : 0;
|
||||||
@@ -1038,12 +1062,13 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debugMenu.Open) animationStarted += elapsed;
|
if (debugMenu.Open) animationStarted += elapsed;
|
||||||
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && gadgetScreen?.Open != true && (active || headless || walkSmoke || jetpackSmoke || shrinkSmoke || gadgetWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke))
|
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && gadgetScreen?.Open != true && (active || headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || gadgetWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke))
|
||||||
{
|
{
|
||||||
var steps = headless || walkSmoke || jetpackSmoke || shrinkSmoke || gadgetWindowSmoke || practiceWindowSmoke || carlSmoke || controlPhaseSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
|
var steps = headless || walkSmoke || jetpackSmoke || shrinkSmoke || invisibleSmoke || gadgetWindowSmoke || practiceWindowSmoke || carlSmoke || controlPhaseSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke ? 1 : stepClock.Advance(elapsed);
|
||||||
for (var step = 0; step < steps; step++)
|
for (var step = 0; step < steps; step++)
|
||||||
{
|
{
|
||||||
var input = carlSmoke || controlPhaseSmoke ? new PlayerInput(true, false, true, false, true)
|
var input = carlSmoke || controlPhaseSmoke ? new PlayerInput(true, false, true, false, true)
|
||||||
|
: invisibleSmoke && headless ? new PlayerInput(false,false,false,false,false,Fire:count==1)
|
||||||
: shrinkSmoke && headless ? new PlayerInput(false,false,false,false,false,Fire:true)
|
: shrinkSmoke && headless ? new PlayerInput(false,false,false,false,false,Fire:true)
|
||||||
: jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
|
: jetpackSmoke && headless ? LabSimulation.JetpackSmokeInput(simulation.Steps)
|
||||||
: walkSmoke && headless ? LabSimulation.SmokeInput(simulation.Steps) : new PlayerInput(
|
: walkSmoke && headless ? LabSimulation.SmokeInput(simulation.Steps) : new PlayerInput(
|
||||||
@@ -1130,6 +1155,7 @@ internal static class Program
|
|||||||
objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
|
objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
|
||||||
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible && gadgetScreen?.Open != true,
|
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible && gadgetScreen?.Open != true,
|
||||||
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible, renderer.Width, renderer.Height);
|
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible, renderer.Width, renderer.Height);
|
||||||
|
invisibleMeter?.Update(mesh,simulation!.Invisible,renderer.Width,renderer.Height);
|
||||||
if (gadgetScreen != null)
|
if (gadgetScreen != null)
|
||||||
{
|
{
|
||||||
if (!headless) gadgetScreen.Point(Pointer(),level!.Code,storyTasks!.Get("SCENE"));
|
if (!headless) gadgetScreen.Point(Pointer(),level!.Code,storyTasks!.Get("SCENE"));
|
||||||
@@ -1151,6 +1177,8 @@ internal static class Program
|
|||||||
MovementMode = simulation?.MovementMode ?? 0, InputAfterPlayer = simulation?.InputAfterPlayerUpdate ?? false,
|
MovementMode = simulation?.MovementMode ?? 0, InputAfterPlayer = simulation?.InputAfterPlayerUpdate ?? false,
|
||||||
JumpState = simulation?.JumpState ?? 0, JumpHold = simulation?.JumpHoldSeconds ?? 0,
|
JumpState = simulation?.JumpState ?? 0, JumpHold = simulation?.JumpHoldSeconds ?? 0,
|
||||||
BurnRemaining = simulation?.JetpackRemaining ?? 0, JetpackAvailability = interactions?.Inventory.State(0, 3) ?? 0,
|
BurnRemaining = simulation?.JetpackRemaining ?? 0, JetpackAvailability = interactions?.Inventory.State(0, 3) ?? 0,
|
||||||
|
InvisibleRemaining = simulation?.Invisible.Remaining ?? 0, InvisibleRecharge = simulation?.Invisible.Recharge ?? 0,
|
||||||
|
Targetable = simulation?.Invisible.Targetable ?? true,
|
||||||
Objective = interactions?.CurrentObjective ?? 0, ObjectiveTime = objectivePanel?.Elapsed ?? 0,
|
Objective = interactions?.CurrentObjective ?? 0, ObjectiveTime = objectivePanel?.Elapsed ?? 0,
|
||||||
CameraObstruction = debugCameraRay?.Enabled, CameraPolygons = debugCameraRay?.PolygonCount ?? 0,
|
CameraObstruction = debugCameraRay?.Enabled, CameraPolygons = debugCameraRay?.PolygonCount ?? 0,
|
||||||
CameraWallPolygons = debugCameraRay?.WallPolygonCount ?? 0, CameraTests = debugCameraRay?.LastTriangleTests ?? 0,
|
CameraWallPolygons = debugCameraRay?.WallPolygonCount ?? 0, CameraTests = debugCameraRay?.LastTriangleTests ?? 0,
|
||||||
@@ -1179,8 +1207,16 @@ internal static class Program
|
|||||||
: fixedTime ?? (headless ? count / 60.0 : now - animationStarted),
|
: fixedTime ?? (headless ? count / 60.0 : now - animationStarted),
|
||||||
mesh.Vertices.AsSpan(characterOffset, animations.Current.Base.Vertices.Length), characterModel);
|
mesh.Vertices.AsSpan(characterOffset, animations.Current.Base.Vertices.Length), characterModel);
|
||||||
}
|
}
|
||||||
|
if (simulation != null && characterDraw != null)
|
||||||
|
PlayerGadgetMaterial.Apply(characterDraw, simulation.Invisible);
|
||||||
renderer.UpdateVertices(mesh.Vertices);
|
renderer.UpdateVertices(mesh.Vertices);
|
||||||
renderer.Render(view * projection);
|
renderer.Render(view * projection);
|
||||||
|
if (invisibleFixture != null)
|
||||||
|
{
|
||||||
|
invisibleFixture.AfterFrame(count,characterDraw!);
|
||||||
|
if (InvisibleSmoke.StageName(count) is { } stage && Option(args,"--screenshot") is { } capture)
|
||||||
|
renderer.SavePpm(Path.ChangeExtension(capture,$".{stage}.ppm"));
|
||||||
|
}
|
||||||
var presentedAt = clock.Elapsed.TotalSeconds;
|
var presentedAt = clock.Elapsed.TotalSeconds;
|
||||||
diagnostics.ObserveFrame(presentedAt - lastPresentedAt);
|
diagnostics.ObserveFrame(presentedAt - lastPresentedAt);
|
||||||
lastPresentedAt = presentedAt;
|
lastPresentedAt = presentedAt;
|
||||||
@@ -1443,6 +1479,12 @@ internal static class Program
|
|||||||
if (simulation.Bursts == 0 || simulation.MaximumRise <= 137.62f || !simulation.Grounded
|
if (simulation.Bursts == 0 || simulation.MaximumRise <= 137.62f || !simulation.Grounded
|
||||||
|| poweredAirTravel <= 20 || !poweredAirTurn || !headless && (sawJetpackKeys != 15 || !didResize)) return 2;
|
|| poweredAirTravel <= 20 || !poweredAirTurn || !headless && (sawJetpackKeys != 15 || !didResize)) return 2;
|
||||||
}
|
}
|
||||||
|
if (invisibleFixture != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine(invisibleFixture.Report);
|
||||||
|
if (!headless) Console.WriteLine($"Invisible SDL primary received: {sawShrinkKey}.");
|
||||||
|
if (!invisibleFixture.Passed || !headless && !sawShrinkKey) return 2;
|
||||||
|
}
|
||||||
if (shrinkSmoke)
|
if (shrinkSmoke)
|
||||||
{
|
{
|
||||||
var renderedHeight = soldierVisuals!.RenderedHeight(shrinkVictim!.Actor.Tag,mesh);
|
var renderedHeight = soldierVisuals!.RenderedHeight(shrinkVictim!.Actor.Tag,mesh);
|
||||||
|
|||||||
@@ -66,6 +66,15 @@ Require(menu.Page == 0, "Tab cycles all three pages");
|
|||||||
Require(menu.FindScene("VR04")?.LevelFile == "VR04.gam" && menu.FindScene("MISSING") == null, "Checkpoint resolution only uses prepared catalog");
|
Require(menu.FindScene("VR04")?.LevelFile == "VR04.gam" && menu.FindScene("MISSING") == null, "Checkpoint resolution only uses prepared catalog");
|
||||||
Console.WriteLine("PASS paged player/systems tools, noclip, staged settings and bounded overlay views");
|
Console.WriteLine("PASS paged player/systems tools, noclip, staged settings and bounded overlay views");
|
||||||
|
|
||||||
|
menu.Key(43);
|
||||||
|
for(var i=0;i<10;i++)menu.Key(81);
|
||||||
|
Require(menu.Key(40)==DebugAction.GiveInvisible,"Player tools can grant/select implemented Invisible device");
|
||||||
|
menu.Key(81);Require(menu.Key(40)==DebugAction.UnequipGadget,"Explicit gadget unequip");
|
||||||
|
var invisibleView=menu.View(new("LV1B","STARTEXP",Vector3.Zero,0,0,true,20,0,30,"NONE",true,0,10000,false,
|
||||||
|
Systems:new(){InvisibleRemaining=4.5f,InvisibleRecharge=0,Targetable=false}));
|
||||||
|
Require(invisibleView.Lines.Length<=32 && invisibleView.Lines.Any(s=>s.Contains("INVISIBLE 4.5")),"Bounded Invisible timer/target diagnostics");
|
||||||
|
Console.WriteLine("PASS Invisible debug commands and live phase diagnostics");
|
||||||
|
|
||||||
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
||||||
var catalog = DebugMenu.AvailableScenes(original, Path.GetFullPath("artifacts/extracted"));
|
var catalog = DebugMenu.AvailableScenes(original, Path.GetFullPath("artifacts/extracted"));
|
||||||
Require(catalog.Length == 33 && catalog.All(s => s.Starts.Length > 0), "Only33 supplied scenes with prepared geometry are offered");
|
Require(catalog.Length == 33 && catalog.All(s => s.Starts.Length > 0), "Only33 supplied scenes with prepared geometry are offered");
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<Compile Include="../../src/GamePort/Game/PlayerLevelState.cs"/>
|
<Compile Include="../../src/GamePort/Game/PlayerLevelState.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Game/PlayerEnergy.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Game/InvisibleGadget.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/FixedStepClock.cs"/>
|
<Compile Include="../../src/GamePort/Game/FixedStepClock.cs"/>
|
||||||
|
|||||||
@@ -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/Assets/*.cs" />
|
||||||
|
<Compile Include="../../src/GamePort/Game/*.cs" />
|
||||||
|
<Compile Include="../../src/GamePort/Application/PlayerGadgetMaterial.cs" />
|
||||||
|
<Compile Include="../../src/GamePort/Application/InvisibleMeterOverlay.cs" />
|
||||||
|
<Compile Include="../../src/GamePort/Application/UiViewport.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using System.Buffers.Binary;
|
||||||
|
using System.Text;
|
||||||
|
using GamePort.Assets;
|
||||||
|
using GamePort.Game;
|
||||||
|
using GamePort.Application;
|
||||||
|
|
||||||
|
void Check(bool value, string message) { if (!value) throw new Exception(message); }
|
||||||
|
var count = 0;
|
||||||
|
void Test(string name, Action action) { action(); count++; Console.WriteLine($"PASS {name}"); }
|
||||||
|
void Charge(InvisibleGadget gadget, float energy = 20, bool exemption = false)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < 450 && gadget.Recharge != 7; i++)
|
||||||
|
gadget.Step(1f / 60, true, false, false, energy, exemption, _ => throw new Exception("Recharge spends no energy"));
|
||||||
|
Check(gadget.Recharge == 7, "ready clamp must reach exact7");
|
||||||
|
}
|
||||||
|
InvisibleGadget Ready(float energy = 20, bool exemption = false)
|
||||||
|
{
|
||||||
|
var gadget = new InvisibleGadget(); Check(gadget.Equip(energy, exemption), "equip"); Charge(gadget, energy, exemption); return gadget;
|
||||||
|
}
|
||||||
|
Test("energy low warning uses19/20 hysteresis and preserves callback order", () => {
|
||||||
|
var energy = new PlayerEnergy(); var sounds = new List<int>();
|
||||||
|
energy.Adjust(-1, "LV1B", sounds.Add); Check(energy.Value == 19 && sounds.Count == 0, "exact19 is not low");
|
||||||
|
energy.Adjust(-.5f, "LV1B", id => { Check(energy.Value == 18.5f && !energy.LowWarning, "low callback after scalar/before latch"); sounds.Add(id); });
|
||||||
|
energy.Adjust(-1, "LV1B", sounds.Add); Check(sounds.SequenceEqual(new[] {182}), "warn once per low episode");
|
||||||
|
energy.Value = 20; energy.Adjust(0, "LV1B"); Check(energy.LowWarning, "exact20 keeps latch");
|
||||||
|
energy.Value = MathF.BitIncrement(20); energy.Adjust(0, "LV1B"); Check(!energy.LowWarning, "above20 clears");
|
||||||
|
energy.Adjust(-2, "LV1B", sounds.Add); Check(sounds.SequenceEqual(new[] {182,182}), "renewed episode warns");
|
||||||
|
});
|
||||||
|
Test("empty crossing sounds before write, then low warning; continuing empty does not repeat", () => {
|
||||||
|
var energy = new PlayerEnergy { Value = 1 }; var seen = new List<int>();
|
||||||
|
energy.Adjust(-2, "LEV1", id => { seen.Add(id); Check(id == 80 ? energy.Value == 1 : energy.Value == 0, "source write order"); });
|
||||||
|
Check(seen.SequenceEqual(new[] {80,182}) && energy.Value == 0, "crossing then low sound");
|
||||||
|
energy.Adjust(-2, "LEV1", seen.Add); Check(seen.Count == 2, "empty is not another crossing");
|
||||||
|
energy.Value = 200; energy.Adjust(0, "LEV1"); Check(energy.Value == 100 && !energy.LowWarning, "upper clamp clears latch");
|
||||||
|
});
|
||||||
|
Test("tutorial energy helper bypasses scalar, sounds and warning latch", () => {
|
||||||
|
var energy = new PlayerEnergy { Value = 1 }; energy.Adjust(0, "LV1B");
|
||||||
|
for (var i = 1; i <= 8; i++) {
|
||||||
|
energy.Adjust(-100, $"VR0{i}", _ => throw new Exception("tutorial sound"));
|
||||||
|
Check(energy.Value == 1 && energy.LowWarning, "tutorial must not clear retained low latch");
|
||||||
|
}
|
||||||
|
Check(!PlayerEnergy.IsTutorial("VR09") && !PlayerEnergy.IsTutorial("vr03"), "exact numeric FourCC range");
|
||||||
|
});
|
||||||
|
Test("energy latch is retained separately from original saved scalar", () => {
|
||||||
|
var state = new PlayerEnergy { Value = 1 }; state.Adjust(0, "LV1B");
|
||||||
|
var world = new Mesh([new(new(-1000,0,-1000),Vector2.Zero,Vector3.One),new(new(1000,0,-1000),Vector2.Zero,Vector3.One),
|
||||||
|
new(new(1000,0,1000),Vector2.Zero,Vector3.One),new(new(-1000,0,1000),Vector2.Zero,Vector3.One)],[0,2,1,0,3,2]);
|
||||||
|
var standing = AseMesh.Load("../Original/ASE/jimstop.ase");
|
||||||
|
var first = new LabSimulation(new SceneCollision(world),standing,new(0,80,0),0,energy:state);
|
||||||
|
var second = new LabSimulation(new SceneCollision(world),standing,new(0,80,0),0,energy:state) {LevelCode="LEV1"};
|
||||||
|
var sounds = 0; second.EnergySound += _ => sounds++;
|
||||||
|
second.Energy = 2; second.AdjustEnergy(-.5f);
|
||||||
|
Check(first.Energy == 1.5f && second.LowEnergyWarning && sounds == 0, "ordinary load shares scalar/latch owner");
|
||||||
|
second.Energy = 100; Check(second.LowEnergyWarning, "raw save/debug scalar assignment is not helper rearm");
|
||||||
|
});
|
||||||
|
Test("Invisible equip gates zero energy but tutorial override permits it", () => {
|
||||||
|
var device = new InvisibleGadget();
|
||||||
|
Check(!device.Equip(0,false) && !device.Equipped, "ordinary empty equip fails");
|
||||||
|
Check(device.Equip(0,true) && device.Recharge == 0 && device.Remaining == 0 && device.Targetable, "VR override equips with fresh clocks");
|
||||||
|
});
|
||||||
|
Test("held fire cannot activate on same invocation that recharge clamps7", () => {
|
||||||
|
var device = new InvisibleGadget(); device.Equip(20,false); var spends=0;
|
||||||
|
while (device.Recharge != 7) device.Step(.5f,true,true,false,20,false,_=>spends++);
|
||||||
|
Check(spends == 0 && device.Targetable && device.MeterReady, "first charge before first activation");
|
||||||
|
device.Step(.5f,true,true,false,20,false,delta=>{Check(delta==-2,"fixed cost");spends++;});
|
||||||
|
Check(spends==1 && device.Remaining==6.5f && device.Recharge==0 && !device.Targetable && device.Opacity==.7f,
|
||||||
|
"activation decrements remaining in same invocation, not a new-frame7");
|
||||||
|
});
|
||||||
|
Test("activation needs strictly more than2; primary with jump does not activate", () => {
|
||||||
|
var device=Ready(2); var spends=0;
|
||||||
|
device.Step(.1f,true,true,false,2,false,_=>spends++);
|
||||||
|
Check(!device.Active && device.Recharge==7 && spends==0,"exact2 rejected");
|
||||||
|
device.Step(.1f,true,true,true,3,false,_=>spends++); Check(!device.Active,"jump blocks activation only");
|
||||||
|
device.Step(.1f,true,true,false,MathF.BitIncrement(2),false,_=>spends++); Check(device.Active && spends==1,"strict threshold");
|
||||||
|
device.Step(.1f,true,false,true,0,false,_=>spends++); Check(device.Remaining<6.9f,"active continues during jump/empty energy");
|
||||||
|
});
|
||||||
|
Test("raw NULL ownership and primary suppressor freeze timers independently", () => {
|
||||||
|
var device=Ready(); device.Step(.1f,true,true,false,20,false,_=>{}); var before=device.Remaining;
|
||||||
|
device.Step(.25f,false,false,false,20,false,_=>{}); Check(device.Remaining==before && !device.MeterVisible && device.Active,"null freezes, no cleanup");
|
||||||
|
device.Step(.25f,true,true,false,20,false,_=>{},suppressed:true); Check(device.Remaining==before && device.MeterVisible,"suppressed primary returns");
|
||||||
|
device.Step(.25f,true,true,true,20,false,_=>{},suppressed:true); Check(device.Remaining<before,"held jump bypasses primary suppressor branch");
|
||||||
|
});
|
||||||
|
Test("last3seconds flashes original material blend; expiry restores opaque and waits to recharge", () => {
|
||||||
|
var device=Ready(); device.Step(0,true,true,false,20,false,_=>{});
|
||||||
|
for(var i=0;i<8;i++) device.Step(.5f,true,false,false,18,false,_=>{});
|
||||||
|
Check(device.Remaining==3 && device.ConventionalBlend,"trunc(3*5) odd conventionalalpha");
|
||||||
|
device.Step(.25f,true,false,false,18,false,_=>{}); Check(device.Remaining==2.75f && device.ConventionalBlend,"odd13");
|
||||||
|
device.Step(.25f,true,false,false,18,false,_=>{}); Check(device.Remaining==2.5f && !device.ConventionalBlend,"even12 additive");
|
||||||
|
for(var i=0;i<5;i++) device.Step(.5f,true,false,false,18,false,_=>{});
|
||||||
|
Check(!device.Active && device.Targetable && device.Opacity==1 && device.Recharge==0 && !device.MeterReady,"expiry invocation does not recharge");
|
||||||
|
device.Step(.1f,true,false,false,18,false,_=>{}); Check(device.Recharge==.1f,"next invocation starts recharge");
|
||||||
|
});
|
||||||
|
Test("held primary reactivates after recharge without adding edge latch", () => {
|
||||||
|
var device=Ready(); var spends=0;
|
||||||
|
for(var i=0;i<35;i++) device.Step(.5f,true,true,false,20,false,_=>spends++);
|
||||||
|
Check(spends==2 && device.Activations==2,"repeat held activation after active+recharge");
|
||||||
|
});
|
||||||
|
Test("release and reset own material/target/meter cleanup", () => {
|
||||||
|
var device=Ready(); device.Step(.1f,true,true,false,20,false,_=>{}); device.Release();
|
||||||
|
Check(!device.Equipped && !device.Active && device.Remaining==7 && device.Recharge==0 && device.Targetable && !device.MeterVisible && device.Opacity==1,
|
||||||
|
"source release stores7, not active restart");
|
||||||
|
device.Reset(); Check(device.Remaining==0 && device.Activations==0,"modern reset starts clean");
|
||||||
|
});
|
||||||
|
Test("original atlas material changes leave geometry and authored visibility intact", () => {
|
||||||
|
var device=Ready(); var draw=new MeshDraw(0,3,1) {Visible=false};
|
||||||
|
device.Step(0,true,true,false,20,false,_=>{}); PlayerGadgetMaterial.Apply(draw,device);
|
||||||
|
Check(draw.Opacity==.7f && draw.Blend==MeshBlend.Additive && !draw.Visible,"source alpha.7, additive branch, no show/hide invention");
|
||||||
|
for(var i=0;i<8;i++)device.Step(.5f,true,false,false,18,false,_=>{});
|
||||||
|
PlayerGadgetMaterial.Apply(draw,device); Check(draw.Blend==MeshBlend.Alpha,"flash routes indexed material alpha");
|
||||||
|
device.Release(); PlayerGadgetMaterial.Apply(draw,device); Check(draw.Opacity==1 && draw.Blend==MeshBlend.Opaque,"cleanup restores opaque");
|
||||||
|
});
|
||||||
|
Test("binding distinguishes another control owner, AI NULL freeze and named camera cleanup", () => {
|
||||||
|
var jim=Entity("3JIM","JIM1"); var dog=Entity("3DOG","C3DGODDARD",("AIState",1));
|
||||||
|
var other=Entity("3AIT","other",("PlayerControlled","C3DGODDARD"));
|
||||||
|
var freeze=Entity("3AIT","freeze",("PlayerControlled","NULL"));
|
||||||
|
var keep=Entity("3CAM","keep",("DeactivateInv",0),("CameraTarget","JIM1"),("SoundIndex",1));
|
||||||
|
var cleanup=Entity("3MCA","cleanup",("CameraTarget0","none"));
|
||||||
|
var director=new SceneDirector(new("LV1B",[jim,dog,other,freeze,keep,cleanup]),new TaskStates([]),(_,_)=>1);
|
||||||
|
var body=Body(); var bag=new SceneInventory(new int[19]); bag.SetState(0,2,1);
|
||||||
|
using var binding=new PlayerSceneBinding(director,body,bag,"JIM1");
|
||||||
|
bag.SelectGadget(2); var companion=director.FindActor("C3DGODDARD")!;
|
||||||
|
Check(!companion.Visible&&!companion.BodyEnabled&&!companion.MovementEnabled&&companion.Active,"equip hides/disables body, not AI activation");
|
||||||
|
var integrations=0;
|
||||||
|
var patrol=new ActorPatrol(companion,director.FindActor,(state,_)=>{integrations++;return state with{Position=state.Position+Vector3.UnitX};});
|
||||||
|
patrol.Step(.1f); Check(integrations==0,"disabled body does not consume provisional integration");
|
||||||
|
Charge(body.Invisible); director.Trigger("other");
|
||||||
|
var controllers=body.ControllerSteps;
|
||||||
|
binding.Step(new(false,false,false,false,false,Fire:true));
|
||||||
|
Check(body.Invisible.Active && body.ControllerSteps==controllers && body.Energy==18,"nonnull other owner permits wrapper activation without Jimmy input");
|
||||||
|
director.Trigger("freeze"); var remaining=body.Invisible.Remaining;
|
||||||
|
binding.Step(new(false,false,false,false,false));
|
||||||
|
Check(body.Invisible.Active && body.Invisible.Remaining==remaining && !body.Invisible.MeterVisible,"AI NULL freezes without cleanup");
|
||||||
|
director.Trigger("keep"); Check(body.Invisible.Active,"explicit DeactivateInv0 and absent raw owner preserve effect");
|
||||||
|
director.Skip(); director.Trigger("cleanup");
|
||||||
|
Check(!body.Invisible.Active && body.GadgetMode==-1 && bag.SelectedGadget==-1 && companion.Visible
|
||||||
|
&& companion.BodyEnabled && companion.MovementEnabled,"default named-Jimmy cleanup even when raw owner NULL/first MCA target none");
|
||||||
|
patrol.Step(.1f); Check(integrations==1,"companion body resumes");
|
||||||
|
});
|
||||||
|
Test("failed ordinary equip retains display2 with raw mode-1", () => {
|
||||||
|
var director=new SceneDirector(new("LV1B",[Entity("3JIM","JIM1")]),new TaskStates([]),(_,_)=>1);
|
||||||
|
var body=Body(); body.Energy=0; var bag=new SceneInventory(new int[19]); bag.SetState(0,2,1);
|
||||||
|
using var binding=new PlayerSceneBinding(director,body,bag,"JIM1"); bag.SelectGadget(2);
|
||||||
|
Check(bag.SelectedGadget==2 && body.GadgetMode==-1 && !body.Invisible.Equipped,"display callback precedes failed equip");
|
||||||
|
});
|
||||||
|
Test("original meter resources stretch and tint with uniform widescreen placement", () => {
|
||||||
|
var world=new Mesh([new(new(1,2,3),Vector2.Zero,Vector3.One)],[0,0,0]){HasCollisionMaterialIds=true};
|
||||||
|
var overlay=new InvisibleMeterOverlay(world,"artifacts/extracted/invisible-meter/meter.json");
|
||||||
|
var device=Ready();
|
||||||
|
foreach(var (width,height) in new[]{(640u,480u),(1920u,1080u),(3440u,1440u)}) {
|
||||||
|
overlay.Update(overlay.Mesh,device,width,height);
|
||||||
|
var a=overlay.Mesh.Vertices[5];var b=overlay.Mesh.Vertices[7];
|
||||||
|
var view=new UiViewport(width,height);
|
||||||
|
Check(MathF.Abs((b.Position.X-a.Position.X)*width/2/view.Scale-27)<.0002f,"source fill width27");
|
||||||
|
Check(device.MeterPercent>=100 && device.MeterPercent<101,"source percentage precedes recharge clamp");
|
||||||
|
Check(Math.Abs((b.Position.Y-a.Position.Y)*height/2/view.Scale-device.MeterPercent*1.04)<.0005,"source fill percent times1.04");
|
||||||
|
Check(a.Color==Vector3.One && a.Uv==Vector2.Zero && b.Uv==new Vector2(.9999f,.9999f),"white ready tint and full image stretch");
|
||||||
|
Check(overlay.Mesh.Vertices[0].Position==new Vector3(1,2,3)&&overlay.Mesh.HasCollisionMaterialIds,"preserve world and collision identities");
|
||||||
|
}
|
||||||
|
device.Release();overlay.Update(overlay.Mesh,device,1920,1080);
|
||||||
|
Check(overlay.Mesh.Draws.Skip(1).All(d=>!d.Visible),"unequip hides both original sprites");
|
||||||
|
});
|
||||||
|
Console.WriteLine($"Invisible/energy:{count} groups passed; full enemy AI, original runtime and native Windows comparison remain separate.");
|
||||||
|
|
||||||
|
LabSimulation Body()
|
||||||
|
{
|
||||||
|
var world=new Mesh([new(new(-1000,0,-1000),Vector2.Zero,Vector3.One),new(new(1000,0,-1000),Vector2.Zero,Vector3.One),
|
||||||
|
new(new(1000,0,1000),Vector2.Zero,Vector3.One),new(new(-1000,0,1000),Vector2.Zero,Vector3.One)],[0,2,1,0,3,2]);
|
||||||
|
return new(new SceneCollision(world),AseMesh.Load("../Original/ASE/jimstop.ase"),new(0,80,0),0);
|
||||||
|
}
|
||||||
|
GamEntity Entity(string kind,string tag,params (string Name,object Value)[] values)
|
||||||
|
{
|
||||||
|
var properties=new Dictionary<string,GamProperty>(StringComparer.Ordinal);
|
||||||
|
foreach(var (name,value) in new[]{("ObjectTag",(object)tag)}.Concat(values)) {
|
||||||
|
if(value is string text)properties[name]=new(name,1,Encoding.Latin1.GetBytes(text));
|
||||||
|
else {var raw=new byte[4];BinaryPrimitives.WriteInt32BigEndian(raw,(int)value);properties[name]=new(name,6,raw);}
|
||||||
|
}
|
||||||
|
return new(kind,properties.Count,properties,[]);
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
<Compile Include="../../src/GamePort/Game/PlayerLevelState.cs"/>
|
<Compile Include="../../src/GamePort/Game/PlayerLevelState.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
<Compile Include="../../src/GamePort/Game/AirSteering.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
<Compile Include="../../src/GamePort/Game/JetpackBurst.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Game/PlayerEnergy.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Game/InvisibleGadget.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
<Compile Include="../../src/GamePort/Game/SceneCollision.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs"/>
|
||||||
<Compile Include="../../src/GamePort/Game/FixedStepClock.cs"/>
|
<Compile Include="../../src/GamePort/Game/FixedStepClock.cs"/>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
"""Guarded original Bubble branches; projections are not gameplay verification."""
|
||||||
|
from dataclasses import replace
|
||||||
|
from pathlib import Path
|
||||||
|
import math
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
ROOT=Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||||
|
from bubble import BubbleVisual, collect, energy_delta, equip_result, f32, start, stop, visual_step
|
||||||
|
|
||||||
|
|
||||||
|
class BubbleSourceTests(unittest.TestCase):
|
||||||
|
def test_original_identity_spans_sites_and_virtuals(self):
|
||||||
|
report=collect(ROOT.parent/'Original')
|
||||||
|
self.assertEqual(len(report['bodies']),12)
|
||||||
|
self.assertGreaterEqual(len(report['sites']),35)
|
||||||
|
self.assertEqual(len(report['vtables']),6)
|
||||||
|
self.assertTrue(all(int(b['va'],16)-int(b['file_offset'],16)==0x400000 for b in report['bodies']))
|
||||||
|
self.assertEqual((report['archive'],report['canvas']),('RetainedSprites.omt',1))
|
||||||
|
self.assertEqual(report['equip']['radius'],160)
|
||||||
|
self.assertEqual(report['equip']['factor'],f32(.415))
|
||||||
|
self.assertEqual(report['cleanup']['max_speed'],650)
|
||||||
|
self.assertEqual(report['cleanup']['factor'],f32(1.265))
|
||||||
|
|
||||||
|
def test_equip_order_and_transition_flags(self):
|
||||||
|
self.assertEqual(equip_result(0,exists=False,practice=True),'no_effect')
|
||||||
|
self.assertEqual(equip_result(0,practice=True),'practice_VR01')
|
||||||
|
self.assertEqual(equip_result(0),'mode_minus1')
|
||||||
|
self.assertEqual(equip_result(-1),'mode_minus1')
|
||||||
|
self.assertEqual(equip_result(0,exempt=True),'equip_mode0_movement2')
|
||||||
|
self.assertEqual(equip_result(.001),'equip_mode0_movement2')
|
||||||
|
for flags in ({'active':True},{'expanding':True},{'collapsing':True}):
|
||||||
|
self.assertEqual(equip_result(1,**flags),'unchanged')
|
||||||
|
with self.assertRaises(ValueError):equip_result(math.nan)
|
||||||
|
|
||||||
|
def test_controlled_movement2_drain_is_half_dt(self):
|
||||||
|
self.assertEqual(energy_delta(2,.25),-.125)
|
||||||
|
self.assertEqual(energy_delta(0,.25),0)
|
||||||
|
self.assertEqual(energy_delta(1,.25),0)
|
||||||
|
self.assertEqual(energy_delta(3,.25),0)
|
||||||
|
for seconds in (-1,1,math.inf,math.nan):
|
||||||
|
with self.assertRaises(ValueError):energy_delta(2,seconds)
|
||||||
|
|
||||||
|
def test_expand_changes_color_not_dimensions_and_crosses_strict_one(self):
|
||||||
|
state=start(BubbleVisual())
|
||||||
|
self.assertFalse(state.hidden)
|
||||||
|
state=visual_step(state,.5)
|
||||||
|
self.assertEqual(state.rgba,(.5,)*4)
|
||||||
|
self.assertEqual((state.width,state.height),(200,200))
|
||||||
|
state=visual_step(state,.5)
|
||||||
|
self.assertEqual(state.rgba,(1.,)*4)
|
||||||
|
self.assertTrue(state.expanding)
|
||||||
|
self.assertFalse(state.active)
|
||||||
|
state=visual_step(state,.125)
|
||||||
|
self.assertFalse(state.expanding)
|
||||||
|
self.assertTrue(state.active)
|
||||||
|
|
||||||
|
def test_active_width_pulse_and_graphics_alpha_branch(self):
|
||||||
|
state=BubbleVisual(active=True,hidden=False,rgba=(.9,)*4)
|
||||||
|
default=visual_step(state,.125)
|
||||||
|
alpha=visual_step(state,.125,graphics_alpha=True)
|
||||||
|
self.assertEqual(default.width,240)
|
||||||
|
self.assertAlmostEqual(default.height,240+math.sin(1.25)*30,places=4)
|
||||||
|
self.assertEqual(default.rgba,(.9,)*4)
|
||||||
|
self.assertEqual(alpha.rgba,(1.,1.,1.,.5))
|
||||||
|
self.assertEqual(alpha.height,default.height)
|
||||||
|
|
||||||
|
def test_cleanup_separately_clears_expand_and_fades_until_strict_negative(self):
|
||||||
|
initial=start(BubbleVisual())
|
||||||
|
direct=stop(initial,through_jimmy_cleanup=False)
|
||||||
|
self.assertTrue(direct.expanding and direct.collapsing)
|
||||||
|
state=stop(initial)
|
||||||
|
self.assertFalse(state.expanding or state.active)
|
||||||
|
self.assertTrue(state.collapsing)
|
||||||
|
state=visual_step(visual_step(state,.5),.5)
|
||||||
|
self.assertEqual(state.rgba,(0.,)*4)
|
||||||
|
self.assertTrue(state.collapsing)
|
||||||
|
self.assertFalse(state.hidden)
|
||||||
|
state=visual_step(state,.125)
|
||||||
|
self.assertTrue(state.hidden)
|
||||||
|
self.assertFalse(state.collapsing)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__=='__main__':unittest.main()
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
ORIGINAL = ROOT.parent/'Original'
|
||||||
|
sys.path.insert(0, str(ROOT/'tools/extractors'))
|
||||||
|
from gadget_followup_assets import export_meter, inspect, write_report
|
||||||
|
from omt import FormatError
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipUnless(ORIGINAL.exists(), 'Original assets are local integration fixtures')
|
||||||
|
class GadgetFollowupAssetTests(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.report = inspect(ORIGINAL)
|
||||||
|
|
||||||
|
def test_existing_jimmy_family_has_opaque_atlas_and_compatible_morph_counts(self):
|
||||||
|
atlas = self.report['jimmyTexture']
|
||||||
|
self.assertEqual((atlas['width'], atlas['height']), (256, 256))
|
||||||
|
self.assertEqual(atlas['alphaCounts'], {255: 65536})
|
||||||
|
for clip in self.report['jimmyClips']:
|
||||||
|
self.assertEqual(len(clip['nodes']), 1)
|
||||||
|
node = clip['nodes'][0]
|
||||||
|
self.assertEqual((node['vertices'], node['faces']), (426, 814))
|
||||||
|
if clip['source'].casefold() == 'jimstop.ase':
|
||||||
|
self.assertEqual((node['uvs'], node['textureFaces']), (3551, 814))
|
||||||
|
self.assertEqual(clip['sha256'], 'b294d090ac5c4ec449d845db6d837f2cbedf5f7b812f5b6ed2bb70f85246f1d0')
|
||||||
|
else:
|
||||||
|
self.assertEqual((node['uvs'], node['textureFaces']), (0, 0))
|
||||||
|
|
||||||
|
def test_vr03_preserves_intro_wire_offsets_and_distinct_duplicate_tag_actors(self):
|
||||||
|
level = next(l for l in self.report['levels'] if l['level'] == 'VR03')
|
||||||
|
self.assertEqual(level['sha256'], '8acc4d3b8c416c41c1900ac0b1f895ab5819781e5dd87d19a1f177414660d5b2')
|
||||||
|
self.assertEqual(level['counts']['3SOL'], 8)
|
||||||
|
soldiers = [e for e in level['entities'] if e['kind'] == '3SOL']
|
||||||
|
self.assertEqual(len({e['offset'] for e in soldiers}), 8)
|
||||||
|
self.assertEqual({e['tag'] for e in soldiers}, {'C3DYOKIANSOLDIER'})
|
||||||
|
intro = next(e for e in level['entities'] if e['offset'] == 0x8EEE)
|
||||||
|
sounds = [p for p in intro['properties'] if p['name'] in ('SoundIndex0', 'SoundIndex1', 'SoundIndex2')]
|
||||||
|
self.assertEqual([(p['offset'], p['value']) for p in sounds], [(0x90F7, 21), (0x9176, 20), (0x91F5, 37)])
|
||||||
|
self.assertEqual((level['meshes'][0]['vertices'], level['meshes'][0]['triangles']), (280, 424))
|
||||||
|
|
||||||
|
def test_bubble_billboard_and_vr01_are_exact_serialized_resources(self):
|
||||||
|
sprite = next(r for r in self.report['resources'] if r['archive'] == 'RetainedSprites.omt')
|
||||||
|
self.assertEqual((sprite['id'], sprite['name'], sprite['offset'], sprite['size']), (1, 'orangebubble', 0x17FCE, 66322))
|
||||||
|
self.assertEqual((sprite['canvas']['width'], sprite['canvas']['height']), (146, 146))
|
||||||
|
self.assertEqual(sprite['rgbaSha256'], 'a3a678c47c1ce94946b1136560a84f3ef86c6884b981256a9fbff62fe8a988e4')
|
||||||
|
self.assertEqual(sprite['alphaCounts'], {0: 5492, 255: 15824})
|
||||||
|
level = next(l for l in self.report['levels'] if l['level'] == 'VR01')
|
||||||
|
self.assertEqual(level['sha256'], '7938214fb62784fcb34245491342a5f33e3615bdc178e4883a9e285e6869904f')
|
||||||
|
self.assertEqual(level['counts'].get('3SOL', 0), 0)
|
||||||
|
self.assertEqual(sum(level['counts'].values()), 16)
|
||||||
|
self.assertEqual((level['meshes'][0]['vertices'], level['meshes'][0]['triangles']), (60, 80))
|
||||||
|
|
||||||
|
def test_report_rejects_original_tree_before_writing(self):
|
||||||
|
for output in (ORIGINAL/'followup.json', ORIGINAL/'ASE/followup.json', ORIGINAL/'omt/followup.json'):
|
||||||
|
with self.subTest(output=output), self.assertRaises(ValueError):
|
||||||
|
write_report(ORIGINAL, output)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output = Path(directory)/'report.json'
|
||||||
|
report = write_report(ORIGINAL, output)
|
||||||
|
self.assertTrue(output.is_file())
|
||||||
|
self.assertEqual(report['schema'], 1)
|
||||||
|
|
||||||
|
def test_meter_export_preserves_exact_source_pixels_and_bounded_resources(self):
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output = Path(directory)/'meter'
|
||||||
|
manifest = export_meter(ORIGINAL, output)
|
||||||
|
self.assertEqual(manifest, json.loads((output/'meter.json').read_text()))
|
||||||
|
self.assertEqual([t['id'] for t in manifest['textures']], [21, 22])
|
||||||
|
self.assertEqual([(t['sourceOffset'], t['sourceBytes']) for t in manifest['textures']],
|
||||||
|
[(0x88E18, 8118), (0x8C5D8, 9138)])
|
||||||
|
for texture in manifest['textures']:
|
||||||
|
expected = next(r for r in self.report['resources'] if r['archive'] == 'screens.omt' and r['id'] == texture['id'])
|
||||||
|
rgba = (output/texture['path']).read_bytes()
|
||||||
|
self.assertEqual(len(rgba), 30*110*4)
|
||||||
|
self.assertEqual(hashlib.sha256(rgba).hexdigest(), expected['rgbaSha256'])
|
||||||
|
self.assertTrue((output/texture['png']).is_file())
|
||||||
|
for output in (ORIGINAL/'generated-meter', ORIGINAL/'ASE/generated-meter', ORIGINAL/'omt/generated-meter'):
|
||||||
|
with self.subTest(output=output), self.assertRaises(ValueError):
|
||||||
|
export_meter(ORIGINAL, output)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output = Path(directory)/'meter'
|
||||||
|
with patch('gadget_followup_assets.read_canvas', return_value=dict(width=1, height=1, rgba=b'\0'*4)):
|
||||||
|
with self.assertRaises(FormatError):
|
||||||
|
export_meter(ORIGINAL, output)
|
||||||
|
self.assertFalse(output.exists())
|
||||||
|
|
||||||
|
def test_rea_meter_code_spans_and_double_height_multiplier_remain_guarded(self):
|
||||||
|
contract = self.report['meterCode']
|
||||||
|
self.assertEqual(len(contract['guardedSpans']), 8)
|
||||||
|
self.assertEqual(contract['heightMultiplier'], 1.04)
|
||||||
|
self.assertEqual((contract['backgroundCanvas'], contract['fillCanvas']), (21, 22))
|
||||||
|
self.assertEqual([s['fileOffset'] for s in contract['guardedSpans'][:4]], [0x174D, 0x2D70, 0x3730, 0x37F0])
|
||||||
|
self.assertEqual(contract['rawBackgroundPosition'], [320, 7])
|
||||||
|
self.assertEqual(contract['rawFillPosition'], [322, 4])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import math
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from dataclasses import replace
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools/binary'))
|
||||||
|
from invisible import State, cleanup, collect, equip, f32, step
|
||||||
|
|
||||||
|
ORIGINAL = Path(__file__).resolve().parents[2] / 'Original'
|
||||||
|
|
||||||
|
|
||||||
|
class InvisibleSourceTests(unittest.TestCase):
|
||||||
|
def test_original_identity_spans_sites_virtuals_and_constants(self):
|
||||||
|
source = collect(ORIGINAL)
|
||||||
|
self.assertEqual(len(source['bodies']), 7)
|
||||||
|
self.assertEqual(len(source['sites']), 50)
|
||||||
|
self.assertEqual(len(source['vtables']), 8)
|
||||||
|
for body in source['bodies']:
|
||||||
|
self.assertEqual(int(body['va'], 16)-0x400000, int(body['file_offset'], 16))
|
||||||
|
|
||||||
|
def test_equip_energy_gate_is_distinct_from_activation_and_display(self):
|
||||||
|
self.assertEqual(equip(State(mode=-1), 0).mode, -1)
|
||||||
|
self.assertEqual(equip(State(mode=-1), .25).mode, 2)
|
||||||
|
self.assertEqual(equip(State(mode=-1), 0, True).mode, 2)
|
||||||
|
self.assertEqual((equip(State(), 20).remaining, equip(State(), 20).recharge), (0, 0))
|
||||||
|
|
||||||
|
def test_first_recharge_clamp_activates_only_on_next_call(self):
|
||||||
|
state = State()
|
||||||
|
for _ in range(14):
|
||||||
|
state, delta = step(state, .5, 20, primary=True)
|
||||||
|
self.assertEqual(delta, 0)
|
||||||
|
self.assertEqual((state.recharge, state.remaining, state.meter_red), (7, 0, False))
|
||||||
|
state, delta = step(state, .5, 20, primary=True)
|
||||||
|
self.assertEqual((delta, state.remaining, state.recharge), (-2, 6.5, 0))
|
||||||
|
self.assertEqual((state.alpha, state.blend, state.targetable), (f32(.7), 'additive', False))
|
||||||
|
|
||||||
|
def test_activation_strict_two_and_jump_exclusion(self):
|
||||||
|
ready = State(recharge=7, meter_red=False)
|
||||||
|
for energy in (0, 1.5, 2):
|
||||||
|
state, delta = step(ready, .25, energy, primary=True)
|
||||||
|
self.assertEqual((state.remaining, delta), (0, 0))
|
||||||
|
state, delta = step(ready, .25, 2.01, primary=True)
|
||||||
|
self.assertEqual((state.remaining, delta), (6.75, -2))
|
||||||
|
state, delta = step(ready, .25, 0, primary=True, override=True)
|
||||||
|
self.assertEqual((state.remaining, delta), (6.75, -2))
|
||||||
|
self.assertEqual(step(ready, .25, 20, primary=True, jump=True)[1], 0)
|
||||||
|
|
||||||
|
def test_control_and_suppressor_freeze_only_the_proven_branches(self):
|
||||||
|
active = State(remaining=5, recharge=0, alpha=f32(.7), blend='additive', targetable=False)
|
||||||
|
state, _ = step(active, .25, 20, control_present=False)
|
||||||
|
self.assertEqual((state.remaining, state.meter_visible), (5, False))
|
||||||
|
state, _ = step(active, .25, 20, primary=True, suppressed=True)
|
||||||
|
self.assertEqual(state.remaining, 5)
|
||||||
|
for primary, jump in [(False, False), (True, True)]:
|
||||||
|
self.assertEqual(step(active, .25, 20, primary=primary, jump=jump, suppressed=True)[0].remaining, 4.75)
|
||||||
|
|
||||||
|
def test_zero_energy_stops_recharge_but_not_active_duration(self):
|
||||||
|
self.assertEqual(step(State(recharge=1), .5, 0)[0].recharge, 1)
|
||||||
|
self.assertEqual(step(State(recharge=1), .5, 0, override=True)[0].recharge, 1.5)
|
||||||
|
self.assertEqual(step(State(remaining=4), .5, 0)[0].remaining, 3.5)
|
||||||
|
|
||||||
|
def test_last_three_flash_and_exact_zero_expiry(self):
|
||||||
|
active = State(remaining=3, alpha=f32(.7), blend='additive', targetable=False)
|
||||||
|
self.assertEqual(step(active, .25, 20)[0].blend, 'alpha') # trunc(2.75*5)=13
|
||||||
|
self.assertEqual(step(active, .5, 20)[0].blend, 'additive') # trunc(2.5*5)=12
|
||||||
|
ended, delta = step(replace(active, remaining=.5), .5, 20, primary=True)
|
||||||
|
self.assertEqual((ended.remaining, ended.recharge, delta), (0, 0, 0))
|
||||||
|
self.assertEqual((ended.alpha, ended.blend, ended.targetable, ended.meter_red), (1, 'opaque', True, True))
|
||||||
|
self.assertEqual(step(ended, .5, 20)[0].recharge, .5)
|
||||||
|
|
||||||
|
def test_cleanup_preserves_source_inactive_timer_value_and_resets_presentation(self):
|
||||||
|
ended = cleanup(State(remaining=4, alpha=f32(.7), blend='additive', targetable=False))
|
||||||
|
self.assertEqual((ended.mode, ended.remaining, ended.recharge), (-1, 7, 0))
|
||||||
|
self.assertEqual((ended.alpha, ended.blend, ended.targetable, ended.meter_visible), (1, 'opaque', True, False))
|
||||||
|
self.assertEqual(step(ended, .5, 20)[0], ended)
|
||||||
|
self.assertEqual((equip(ended, 20).remaining, equip(ended, 20).recharge), (0, 0))
|
||||||
|
|
||||||
|
def test_source_graphics_branch_and_invalid_modern_projection_time(self):
|
||||||
|
self.assertEqual(step(State(recharge=7), .25, 20, primary=True, graphics_alpha=True)[0].blend, 'alpha')
|
||||||
|
for seconds in (-1, 1, math.inf, math.nan):
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
step(State(), seconds, 20)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0, str(ROOT/'tools/binary'))
|
||||||
|
from player_energy import collect
|
||||||
|
|
||||||
|
|
||||||
|
class PlayerEnergySourceTests(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.report = collect(ROOT.parent/'Original')
|
||||||
|
|
||||||
|
def test_exact_shared_body_and_warning_constants(self):
|
||||||
|
self.assertEqual(self.report['body']['size'], 0xF3)
|
||||||
|
self.assertEqual(self.report['constants'], dict(zero=0, maximum=100, low=19, rearm=20))
|
||||||
|
|
||||||
|
def test_sound_and_scalar_order_have_guarded_sites(self):
|
||||||
|
sites = {site['name']: int(site['va'], 16) for site in self.report['sites']}
|
||||||
|
self.assertLess(sites['empty_sound_before_scalar'], sites['scalar_store_before_extended_upper_test'])
|
||||||
|
self.assertLess(sites['low_sound_before_latch'], sites['strict_rearm'])
|
||||||
|
self.assertEqual(self.report['globals']['warning'], '0x4f83dc')
|
||||||
|
|
||||||
|
def test_constructor_and_both_new_consumers_are_bound(self):
|
||||||
|
sites = {site['name'] for site in self.report['sites']}
|
||||||
|
self.assertTrue({'ctor_zero_register', 'ctor_clear_warning', 'ray_adjust_caller',
|
||||||
|
'invisible_adjust_caller'}.issubset(sites))
|
||||||
|
|
||||||
|
def test_every_site_has_pe_mapped_offset(self):
|
||||||
|
for site in self.report['sites']:
|
||||||
|
self.assertEqual(int(site['file_offset'], 16), int(site['va'], 16)-0x400000)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only Bubble gadget contract and bounded source-state projections.
|
||||||
|
|
||||||
|
REA inspected generated EXE copies; these projections are not original execution.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
import argparse
|
||||||
|
from dataclasses import dataclass, replace
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
|
||||||
|
from checkpoint_script_state import EXE_SHA256, find_case, read_va
|
||||||
|
from pe_inspect import PE
|
||||||
|
|
||||||
|
BODIES = (
|
||||||
|
('constructor', 0x410840, 0x410a0f, '60f84d3037031e7bdb4eff676c99b8f14337114086812d90f9cdf6cc512e3c52'),
|
||||||
|
('bind', 0x410a80, 0x410ad1, '568468bd5cbd82fe5f4c3d54919b27c3cf6f4c472467102bcd0aae4f97f33f92'),
|
||||||
|
('animate', 0x410ae0, 0x410c9e, '2d2fce6259a34254dec6b9e6a6302150f58c79d19771861fcadb26e8eda38c60'),
|
||||||
|
('start', 0x410ca0, 0x410cf3, '238c7652a9d6237c6897a74e1c9757b15a063abf017f6e5225d25a75798b0fa3'),
|
||||||
|
('stop', 0x410d00, 0x410d16, 'a551ba8c995dfd11db00c5d25f8502101a7bd05928a22781b0fd9f45e0d799c8'),
|
||||||
|
('equip', 0x428f61, 0x4290b7, '0d56551646c616094d7550de24600475b2593160234111bb76fe2a434893862c'),
|
||||||
|
('cleanup', 0x427ff0, 0x4280cc, 'd81b941f45247d8fc3c7652bc64d06e9c503d699d1a1820c5fab4ffad4e56bf9'),
|
||||||
|
('active_input', 0x426264, 0x4263ef, '77de32b45f3808ccd7ec76304d74c82b09cc7ee831a6b7553e3fe68c72296715'),
|
||||||
|
('ordinary_fire_gate', 0x42668f, 0x4266b9, 'd88cb837b49acc11f3a779f71b3f361ed27c634532aa3808081cf4a2438ee6b3'),
|
||||||
|
('effect_callbacks', 0x42a870, 0x42a91a, 'eb20ec6524bf2a54bf45ea781f0cb0d6bc03f3c729f5dbd4097810d5c9b21fa2'),
|
||||||
|
('supported_radius', 0x42469b, 0x4246e9, '40e025e4bdc8bcdbcb24651e3d81908a5b7a9e2cc8de81d733da7490ea76c1d4'),
|
||||||
|
('movement_dispatch', 0x438b1e, 0x438ba4, 'a18e41a473e0975ae79c2d328ec323d7c87d77722a6a43a785bbc3fe92a58743'),
|
||||||
|
)
|
||||||
|
SITES = (
|
||||||
|
('owned_bubble_ctor', 0x42232c, 5), ('owned_bubble_field', 0x42233c, 6),
|
||||||
|
('sprite_archive', 0x410919, 5), ('sprite_canvas1', 0x41094a, 7),
|
||||||
|
('radius160', 0x429049, 13), ('factor0415', 0x429058, 13),
|
||||||
|
('mode0', 0x429065, 7), ('movement2', 0x429072, 9), ('max1350', 0x42907b, 10),
|
||||||
|
('start_effect', 0x429085, 5), ('loop_sound2', 0x429093, 11),
|
||||||
|
('practice_vr01', 0x428fca, 5), ('energy_gate', 0x428fda, 25),
|
||||||
|
('exempt_flag', 0x428fed, 8), ('active_guard', 0x429013, 14),
|
||||||
|
('collapse_guard', 0x429021, 14), ('expand_guard', 0x42902f, 14),
|
||||||
|
('cleanup_mode0', 0x428030, 7), ('cleanup_timer05', 0x428045, 10),
|
||||||
|
('cleanup_movement0', 0x42804f, 7), ('cleanup_max650', 0x428056, 10),
|
||||||
|
('cleanup_stop', 0x428060, 5), ('cleanup_clear_expand', 0x42806b, 6),
|
||||||
|
('cleanup_stop_loop', 0x42807c, 7), ('cleanup_radius60', 0x42809c, 13),
|
||||||
|
('cleanup_factor1265', 0x4280ab, 13), ('cleanup_mode_minus1', 0x4280bb, 9),
|
||||||
|
('input_mode2', 0x426264, 14), ('input_drain', 0x426272, 19),
|
||||||
|
('input_empty_cleanup', 0x426285, 32), ('position_y100', 0x4262f2, 6),
|
||||||
|
('position_distance80', 0x42637a, 6), ('position_y50', 0x426399, 6),
|
||||||
|
('fire_mode0_reject', 0x4266ac, 13), ('effect_pulse30', 0x410b5a, 6),
|
||||||
|
('expand_strict1', 0x410b95, 29), ('collapse_strict0', 0x410c1e, 13),
|
||||||
|
)
|
||||||
|
VTABLES = ((0x4a3bdc, 0x174, 0x428d50), (0x4a3bdc, 0x178, 0x427ff0),
|
||||||
|
(0x49250c, 0x3c4, 0x410ae0), (0x49250c, 0x110, 0x471240),
|
||||||
|
(0x49250c, 0x100, 0x4711e0), (0x4a3bdc, 0x128, 0x439900))
|
||||||
|
|
||||||
|
|
||||||
|
def collect(original: Path | str):
|
||||||
|
pe = PE(find_case(Path(original), 'Neutron.exe'))
|
||||||
|
digest = hashlib.sha256(pe.data).hexdigest()
|
||||||
|
if digest != EXE_SHA256:
|
||||||
|
raise ValueError('Unexpected original EXE identity')
|
||||||
|
bodies = []
|
||||||
|
for name, start, end, expected in BODIES:
|
||||||
|
actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
|
||||||
|
if actual != expected:
|
||||||
|
raise ValueError(f'Changed source span {name}')
|
||||||
|
bodies.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)),
|
||||||
|
length=end-start, sha256=actual))
|
||||||
|
sites = [dict(name=name, va=hex(va), file_offset=hex(pe.offset(va-pe.base)),
|
||||||
|
bytes=read_va(pe, va, length).hex()) for name, va, length in SITES]
|
||||||
|
for base, slot, expected in VTABLES:
|
||||||
|
if struct.unpack('<I', read_va(pe,base+slot,4))[0] != expected:
|
||||||
|
raise ValueError(f'Changed virtual {base:x}+{slot:x}')
|
||||||
|
if read_va(pe,0x4ed838,len(b'RetainedSprites.omt\0')) != b'RetainedSprites.omt\0':
|
||||||
|
raise ValueError('Changed Bubble archive identity')
|
||||||
|
return dict(sha256=digest,bodies=bodies,sites=sites,
|
||||||
|
vtables=[dict(table=hex(b),slot=hex(s),target=hex(t)) for b,s,t in VTABLES],
|
||||||
|
archive='RetainedSprites.omt',canvas=1,
|
||||||
|
equip=dict(raw_mode=0,movement_mode=2,radius=160,factor=f32(.415),max_speed=1350,loop_sound=2),
|
||||||
|
cleanup=dict(raw_mode=-1,movement_mode=0,radius=60,factor=f32(1.265),max_speed=650))
|
||||||
|
|
||||||
|
|
||||||
|
def f32(value):
|
||||||
|
return struct.unpack('<f',struct.pack('<f',value))[0]
|
||||||
|
|
||||||
|
|
||||||
|
def equip_result(energy: float, *, exists=True, practice=False, exempt=False,
|
||||||
|
active=False, expanding=False, collapsing=False):
|
||||||
|
"""428F61 branch after the panel's eligibility/cleanup caller, not full equip."""
|
||||||
|
if not math.isfinite(energy):
|
||||||
|
raise ValueError('Finite source energy required')
|
||||||
|
if not exists:
|
||||||
|
return 'no_effect'
|
||||||
|
if practice:
|
||||||
|
return 'practice_VR01'
|
||||||
|
if energy <= 0 and not exempt:
|
||||||
|
return 'mode_minus1'
|
||||||
|
if active or expanding or collapsing:
|
||||||
|
return 'unchanged'
|
||||||
|
return 'equip_mode0_movement2'
|
||||||
|
|
||||||
|
|
||||||
|
def energy_delta(movement_mode: int, seconds: float):
|
||||||
|
"""426264..426280; common42A920 owns VR exemptions/clamp/warning audio."""
|
||||||
|
if not math.isfinite(seconds) or not 0 <= seconds < 1:
|
||||||
|
raise ValueError('Bounded finite timestep required')
|
||||||
|
return f32(f32(seconds) * f32(-.5)) if movement_mode == 2 else 0.0
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class BubbleVisual:
|
||||||
|
timer: float = 0.0
|
||||||
|
scalar: float = 0.0
|
||||||
|
active: bool = False
|
||||||
|
expanding: bool = False
|
||||||
|
collapsing: bool = False
|
||||||
|
hidden: bool = True
|
||||||
|
rgba: tuple = (1.0,1.0,1.0,1.0)
|
||||||
|
width: float = 200.0
|
||||||
|
height: float = 200.0
|
||||||
|
|
||||||
|
|
||||||
|
def start(state: BubbleVisual):
|
||||||
|
#410CA0 does not clear active/collapsing; equip explicitly guards those states.
|
||||||
|
return replace(state,timer=0,expanding=True,hidden=False)
|
||||||
|
|
||||||
|
|
||||||
|
def stop(state: BubbleVisual, *, through_jimmy_cleanup=True):
|
||||||
|
#410D00 alone leaves expanding unchanged;427FF0 separately clears it.
|
||||||
|
return replace(state,timer=0,active=False,collapsing=True,
|
||||||
|
expanding=False if through_jimmy_cleanup else state.expanding)
|
||||||
|
|
||||||
|
|
||||||
|
def visual_step(state: BubbleVisual, seconds: float, *, graphics_alpha=False):
|
||||||
|
"""Bounded410AE0 projection, not x87/fsin bit parity or an original runtime probe."""
|
||||||
|
if not math.isfinite(seconds) or not 0 <= seconds < 1:
|
||||||
|
raise ValueError('Bounded finite timestep required')
|
||||||
|
timer=f32(state.timer+f32(seconds))
|
||||||
|
state=replace(state,timer=timer)
|
||||||
|
if state.active:
|
||||||
|
rgba=(1.,1.,1.,.5) if graphics_alpha else state.rgba
|
||||||
|
return replace(state,width=240.,height=f32(240+math.sin(timer*10)*30),rgba=rgba)
|
||||||
|
if state.expanding:
|
||||||
|
scalar=1. if timer>1. else timer
|
||||||
|
return replace(state,scalar=scalar,active=timer>1.,expanding=timer<=1.,rgba=(scalar,)*4)
|
||||||
|
if state.collapsing:
|
||||||
|
scalar=f32(1.-timer)
|
||||||
|
return replace(state,scalar=max(0.,scalar),collapsing=scalar>=0.,
|
||||||
|
hidden=state.hidden or scalar<0.,rgba=(max(0.,scalar),)*4)
|
||||||
|
return state
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cli=argparse.ArgumentParser(description=__doc__)
|
||||||
|
cli.add_argument('original',type=Path)
|
||||||
|
print(json.dumps(collect(cli.parse_args().original),indent=2))
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only Invisible gadget source guards and bounded branch projections.
|
||||||
|
|
||||||
|
These projections are independently transcribed static contracts, not execution
|
||||||
|
of original code or a replacement for the port's runtime checks.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from dataclasses import dataclass, replace
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
|
||||||
|
from checkpoint_script_state import EXE_SHA256, find_case, read_va
|
||||||
|
from pe_inspect import PE
|
||||||
|
|
||||||
|
BODIES = (
|
||||||
|
('invisible_tick', 0x424E80, 0x425114, 'b52f6f643c786206fa5a4089d58b311417439a203e0914a8a0243e319c52ebb3'),
|
||||||
|
('invisible_equip', 0x428E51, 0x428F61, '9abaa12fb4625248564818695c6a7e6d27fccf15216c670e5321a3742aa99bc2'),
|
||||||
|
('invisible_cleanup', 0x42810C, 0x4281B3, '92e9ffe9516cca33159b05d3509dc0e34d839e6c8d3deb7e1cd08adbfbfc2851'),
|
||||||
|
('material_alpha', 0x40E4A0, 0x40E5D9, '741d94d5cf14efd99e5380239d7a1b4be7e7fb5f478590604e8bd76b8e5d1ead'),
|
||||||
|
('indexed_blend', 0x40DD40, 0x40DD5D, 'b14a27765254aba1bb2e420019648ee0f05573567c1d1f79c6d8ab09cc59fdc5'),
|
||||||
|
('meter', 0x4036C0, 0x40385B, '46f35e6db8030b96cd6a0bddaf59cf37d36b41f6b568143856db2184b360ca8b'),
|
||||||
|
('enemy_target_flag', 0x409CC0, 0x409CF7, 'cf6e1c52f5801412ab7012465fd41d0278ddb9aef62002535c829f6e03af9252'),
|
||||||
|
)
|
||||||
|
SITES = (
|
||||||
|
('tick_after_movement', 0x424C31, 20),
|
||||||
|
('tick_control_pointer_not_identity', 0x424E80, 30),
|
||||||
|
('tick_mode_two', 0x424E9E, 12),
|
||||||
|
('tick_show_meter', 0x424EB4, 6),
|
||||||
|
('primary_then_not_jump', 0x424EBA, 26),
|
||||||
|
('primary_suppressor_returns', 0x424ED4, 13),
|
||||||
|
('activation_remaining_exact_zero', 0x424EE1, 19),
|
||||||
|
('activation_recharge_exact_seven_bits', 0x424EF4, 12),
|
||||||
|
('activation_energy_strict_two_or_override', 0x424F00, 33),
|
||||||
|
('activation_fixed_cost_minus_two', 0x424F21, 10),
|
||||||
|
('activation_duration_seven', 0x424F32, 10),
|
||||||
|
('activation_blend_source6_dest1', 0x424F3C, 12),
|
||||||
|
('activation_material_alpha_point7', 0x424F48, 15),
|
||||||
|
('activation_target_flag_false', 0x424F57, 7),
|
||||||
|
('activation_recharge_zero', 0x424F5E, 10),
|
||||||
|
('recharge_only_remaining_zero', 0x424F68, 23),
|
||||||
|
('recharge_energy_positive_or_override', 0x424F7F, 29),
|
||||||
|
('recharge_store_before_meter', 0x424F9C, 54),
|
||||||
|
('recharge_seven_clamp_white', 0x424FD2, 47),
|
||||||
|
('active_strict_positive_before_decrement', 0x425001, 23),
|
||||||
|
('active_decrement_before_meter', 0x425018, 28),
|
||||||
|
('active_expiry_less_or_equal_zero', 0x425064, 19),
|
||||||
|
('expiry_material_reset', 0x425077, 38),
|
||||||
|
('expiry_target_true_red_meter', 0x42509D, 25),
|
||||||
|
('flash_last_three', 0x4250BA, 19),
|
||||||
|
('flash_trunc_remaining_times_five', 0x4250CD, 19),
|
||||||
|
('flash_odd_dest7_even_dest1', 0x4250EA, 38),
|
||||||
|
('equip_energy_positive_or_override', 0x428E51, 40),
|
||||||
|
('equip_mode_two_timers_target_flag', 0x428EB4, 36),
|
||||||
|
('equip_display_before_branch', 0x428D95, 9),
|
||||||
|
('cleanup_target_flag_true_recharge_zero', 0x428125, 21),
|
||||||
|
('cleanup_companion_skip_flag', 0x428144, 20),
|
||||||
|
('cleanup_material_opaque_mode_minus_one', 0x428194, 31),
|
||||||
|
('constructor_timer_zero', 0x4227BE, 15),
|
||||||
|
('constructor_override_false', 0x437650, 6),
|
||||||
|
('postload_override_false', 0x4236C0, 7),
|
||||||
|
('postload_vr_range_override_true', 0x423E44, 45),
|
||||||
|
('enemy_chase_target_flag', 0x40847C, 34),
|
||||||
|
('enemy_acquire_target_flag', 0x40877A, 28),
|
||||||
|
('enemy_lost_target_flag', 0x4087F6, 51),
|
||||||
|
('cam_optional_cleanup_flag', 0x4165B7, 43),
|
||||||
|
('mca_optional_cleanup_flag', 0x43129A, 56),
|
||||||
|
('jimmy438_cleanup', 0x42AE08, 18),
|
||||||
|
('cam_interface_complete_plus_c8', 0x415A60, 6),
|
||||||
|
('cam_property_default_one_register', 0x415C09, 5),
|
||||||
|
('cam_property_default_one_store', 0x415CD5, 6),
|
||||||
|
('cam_deactivateinv_property', 0x415F70, 26),
|
||||||
|
('mca_interface_complete_plus_c8', 0x430930, 6),
|
||||||
|
('mca_property_default_one', 0x430AA0, 10),
|
||||||
|
('mca_deactivateinv_property', 0x430D7E, 26),
|
||||||
|
)
|
||||||
|
VTABLES = (
|
||||||
|
(0x4A3BDC, 0x1C8, 0x424E80), (0x4A3BDC, 0x178, 0x427FF0),
|
||||||
|
(0x4A3BDC, 0xFC, 0x40DD40), (0x4A3BDC, 0x114, 0x40E4A0),
|
||||||
|
(0x48D414, 0x484, 0x4036C0), (0x48D414, 0x488, 0x403700),
|
||||||
|
(0x48D414, 0x48C, 0x403730), (0x48D414, 0x490, 0x4037A0),
|
||||||
|
)
|
||||||
|
CONSTANTS = ((0x48D914, 0.0), (0x48D954, 2.0), (0x48D950, 5.0),
|
||||||
|
(0x48E5A0, 3.0), (0x48E5B8, 7.0), (0x4A3E30, 1/7))
|
||||||
|
|
||||||
|
|
||||||
|
def collect(original: Path | str):
|
||||||
|
pe = PE(find_case(Path(original), 'Neutron.exe'))
|
||||||
|
digest = hashlib.sha256(pe.data).hexdigest()
|
||||||
|
if digest != EXE_SHA256:
|
||||||
|
raise ValueError('Unexpected original EXE identity')
|
||||||
|
bodies = []
|
||||||
|
for name, start, end, expected in BODIES:
|
||||||
|
actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
|
||||||
|
if actual != expected:
|
||||||
|
raise ValueError(f'Changed original span {name}')
|
||||||
|
bodies.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)),
|
||||||
|
length=end-start, sha256=actual))
|
||||||
|
sites = [dict(name=name, va=hex(va), file_offset=hex(pe.offset(va-pe.base)),
|
||||||
|
bytes=read_va(pe, va, length).hex()) for name, va, length in SITES]
|
||||||
|
tables = []
|
||||||
|
for base, slot, expected in VTABLES:
|
||||||
|
actual = struct.unpack('<I', read_va(pe, base+slot, 4))[0]
|
||||||
|
if actual != expected:
|
||||||
|
raise ValueError('Changed original virtual binding')
|
||||||
|
tables.append(dict(table=hex(base), slot=hex(slot), target=hex(actual)))
|
||||||
|
constants = []
|
||||||
|
for va, expected in CONSTANTS:
|
||||||
|
actual = struct.unpack('<f', read_va(pe, va, 4))[0]
|
||||||
|
if abs(actual-expected) > 1e-7:
|
||||||
|
raise ValueError('Changed original float constant')
|
||||||
|
constants.append(dict(va=hex(va), file_offset=hex(pe.offset(va-pe.base)), value=actual))
|
||||||
|
if read_va(pe, 0x4EDF10, 14) != b'DeactivateInv\0':
|
||||||
|
raise ValueError('Changed cleanup property identity')
|
||||||
|
return dict(sha256=digest, bodies=bodies, sites=sites, vtables=tables, constants=constants)
|
||||||
|
|
||||||
|
|
||||||
|
def f32(value):
|
||||||
|
return struct.unpack('<f', struct.pack('<f', value))[0]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class State:
|
||||||
|
mode: int = 2
|
||||||
|
remaining: float = 0
|
||||||
|
recharge: float = 0
|
||||||
|
alpha: float = 1
|
||||||
|
blend: str = 'opaque'
|
||||||
|
targetable: bool = True
|
||||||
|
meter_visible: bool = True
|
||||||
|
meter_red: bool = True
|
||||||
|
|
||||||
|
|
||||||
|
def equip(state: State, energy: float, override: bool = False):
|
||||||
|
"""After caller cleanup/UI display2; failed branch changes only raw mode."""
|
||||||
|
if energy <= 0 and not override:
|
||||||
|
return replace(state, mode=-1)
|
||||||
|
return replace(state, mode=2, remaining=0, recharge=0, targetable=True,
|
||||||
|
meter_visible=True, meter_red=True)
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup(state: State):
|
||||||
|
"""Only Jimmy-owned scalar/material/meter leaves; companion cleanup separate."""
|
||||||
|
return replace(state, mode=-1, remaining=7, recharge=0, alpha=1,
|
||||||
|
blend='opaque', targetable=True, meter_visible=False)
|
||||||
|
|
||||||
|
|
||||||
|
def step(state: State, seconds: float, energy: float, *, primary=False,
|
||||||
|
jump=False, suppressed=False, control_present=True, override=False,
|
||||||
|
graphics_alpha=False):
|
||||||
|
"""Source424E80 partial-order projection; return (state, fixed energy delta).
|
||||||
|
|
||||||
|
Uses float stores but does not claim x87 extended-precision equivalence for
|
||||||
|
every bin boundary or reproduce the UI's transient pre-clamp meter sample.
|
||||||
|
"""
|
||||||
|
if not math.isfinite(seconds) or not 0 <= seconds < 1:
|
||||||
|
raise ValueError('seconds must be finite and bounded')
|
||||||
|
if not control_present:
|
||||||
|
return replace(state, meter_visible=False), 0
|
||||||
|
if state.mode != 2:
|
||||||
|
return state, 0
|
||||||
|
state = replace(state, meter_visible=True)
|
||||||
|
delta = 0
|
||||||
|
if primary and not jump:
|
||||||
|
if suppressed:
|
||||||
|
return state, delta
|
||||||
|
if state.remaining == 0 and struct.pack('<f', state.recharge) == b'\0\0\xe0@':
|
||||||
|
if energy <= 2 and not override:
|
||||||
|
return state, delta
|
||||||
|
delta = -2
|
||||||
|
energy = max(0, min(100, f32(energy-2)))
|
||||||
|
state = replace(state, remaining=7, recharge=0, alpha=f32(.7),
|
||||||
|
blend='alpha' if graphics_alpha else 'additive', targetable=False)
|
||||||
|
if state.remaining == 0 and (energy > 0 or override):
|
||||||
|
recharge = f32(state.recharge+seconds)
|
||||||
|
state = replace(state, recharge=min(recharge, 7),
|
||||||
|
meter_red=False if recharge >= 7 else state.meter_red)
|
||||||
|
if state.remaining > 0:
|
||||||
|
remaining = f32(state.remaining-seconds)
|
||||||
|
if remaining <= 0:
|
||||||
|
return replace(state, remaining=0, alpha=1, blend='opaque',
|
||||||
|
targetable=True, meter_red=True), delta
|
||||||
|
blend = state.blend
|
||||||
|
if remaining <= 3:
|
||||||
|
blend = 'alpha' if int(remaining*5) % 2 else 'additive'
|
||||||
|
state = replace(state, remaining=remaining, blend=blend)
|
||||||
|
return state, delta
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cli = argparse.ArgumentParser(description=__doc__)
|
||||||
|
cli.add_argument('original', type=Path)
|
||||||
|
print(json.dumps(collect(cli.parse_args().original), indent=2))
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only guards for shared42A920 energy/warning state; REA evidence is reused."""
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
|
||||||
|
from checkpoint_script_state import find_case, read_va
|
||||||
|
from pe_inspect import PE
|
||||||
|
|
||||||
|
EXE_SHA256 = 'f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8'
|
||||||
|
SITES = (
|
||||||
|
('ctor_zero_register', 0x42217E, '33db'),
|
||||||
|
('ctor_clear_warning', 0x422980, '881ddc834f00'),
|
||||||
|
('tutorial_numeric_range', 0x42A92B, '3d313052567c0b3d383052560f8ed5000000'),
|
||||||
|
('empty_sound_before_scalar', 0x42A967, '6a006a506affe80ee00200'),
|
||||||
|
('scalar_store_before_extended_upper_test', 0x42A975, 'd905d4834f00d8442404d915d4834f00d81d6cd94800'),
|
||||||
|
('upper_clamp_clears_warning', 0x42A992, 'c705d4834f000000c842c605dc834f0000'),
|
||||||
|
('low_sound_before_latch', 0x42A9DF, '6a0068b60000006affe893df020083c40cc605dc834f0001'),
|
||||||
|
('strict_rearm', 0x42A9F8, 'd905d4834f00d81d24534900dfe0f6c4417507c605dc834f0000'),
|
||||||
|
('ray_adjust_caller', 0x426F5A, 'e8c1390000'),
|
||||||
|
('invisible_adjust_caller', 0x424F26, 'e8f5590000'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def collect(original):
|
||||||
|
pe = PE(find_case(Path(original), 'Neutron.exe'))
|
||||||
|
if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256:
|
||||||
|
raise ValueError('Original EXE identity changed')
|
||||||
|
body = read_va(pe, 0x42A920, 0xF3)
|
||||||
|
digest = hashlib.sha256(body).hexdigest()
|
||||||
|
if digest != '6d6a880fb1b4e39addc588201b7d5bb86c768dbfa3778b35045fc10380c9c5e4':
|
||||||
|
raise ValueError('Changed energy body')
|
||||||
|
sites = []
|
||||||
|
for name, va, expected in SITES:
|
||||||
|
if read_va(pe, va, len(bytes.fromhex(expected))) != bytes.fromhex(expected):
|
||||||
|
raise ValueError('Changed source site: ' + name)
|
||||||
|
sites.append(dict(name=name, va=hex(va), file_offset=hex(pe.offset(va-pe.base)), bytes=expected))
|
||||||
|
constants = {name: struct.unpack('<f', read_va(pe, va, 4))[0] for name, va in
|
||||||
|
(('zero', 0x48D914), ('maximum', 0x48D96C), ('low', 0x4A3E90), ('rearm', 0x495324))}
|
||||||
|
return dict(sha256=EXE_SHA256, body=dict(va='0x42a920', file_offset=hex(pe.offset(0x2A920)),
|
||||||
|
size=len(body), sha256=digest), sites=sites, constants=constants,
|
||||||
|
globals=dict(value='0x4f83d4', warning='0x4f83dc'),
|
||||||
|
rea_evidence='ev_71897af12f4bfa1de946c6f17f3bbed34764fdc84258ce64516c8f1f904b465d')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('original', type=Path)
|
||||||
|
args = parser.parse_args()
|
||||||
|
print(json.dumps(collect(args.original), indent=2))
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only resource/tutorial inventory for Bubble and Invisible follow-up work.
|
||||||
|
|
||||||
|
Reports serialized data and pixel/topology observations, not activation or AI rules.
|
||||||
|
Writes only a caller-selected generated JSON file outside the original tree.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from collections import Counter
|
||||||
|
from dataclasses import asdict
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from ase import read_ase
|
||||||
|
from entities import resolve_asset
|
||||||
|
from gam import parse
|
||||||
|
from omt import Database, FormatError, read_canvas, read_shape, write_png
|
||||||
|
from png import read_png
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]/'binary'))
|
||||||
|
from pe_inspect import PE
|
||||||
|
from checkpoint_script_state import read_va
|
||||||
|
|
||||||
|
|
||||||
|
METER_SPANS = (
|
||||||
|
('Neutron.exe', 'meter_init', 0x40174D, 0x40189C, 'cfeb0003633ab684e0a0bc68faf39414ef946fea6a879e983b3277899286323f'),
|
||||||
|
('Neutron.exe', 'sprite_place', 0x402D70, 0x402E2D, '448b8a739fa730ae9d46f4f952b7086e8fd383d6d4ac8c01f56caf0f82bb2704'),
|
||||||
|
('Neutron.exe', 'meter_tint', 0x403730, 0x4037F0, 'cc3172e68a085d9fd2901e93c620002dfc2f9526d22999bbf05a25cc595057a6'),
|
||||||
|
('Neutron.exe', 'meter_percent', 0x4037F0, 0x40385B, '434216bb132d7e1a69fc74fcfd68c9fe5953d1894098dd65aa1c91424926cd2e'),
|
||||||
|
('OMT2.dll', 'canvas_render', 0x10029430, 0x1002959A, '041ce8342d11d4a3f553cdacc66b33381f1eff686b61311afb48bf3b1396c4bb'),
|
||||||
|
('OMT2.dll', 'canvas_update_align', 0x10029870, 0x1002992A, 'cb833afae3132776df9fd123ccad03f713d73d58058f06698b57d8ffb3df0387'),
|
||||||
|
('OMT2.dll', 'canvas_dimensions', 0x10029930, 0x1002998D, 'fb5be6cee77db2a3988a2b6e979dcc0083d48281686f7b855a2119f18783298a'),
|
||||||
|
('OMT2.dll', 'draw_surface', 0x10037AC0, 0x1003818C, 'c76738fe3dfb7556283654a233071be1d68b08aecff277a46535e3a0913d30e3'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def meter_code_contract(original: Path) -> dict:
|
||||||
|
"""Guard REA-backed original code; no target code is executed."""
|
||||||
|
expected = {'Neutron.exe': 'f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8',
|
||||||
|
'OMT2.dll': '3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943'}
|
||||||
|
images = {name: PE(resolve_asset(original, name)) for name in expected}
|
||||||
|
for name, image in images.items():
|
||||||
|
if digest(image.data) != expected[name]:
|
||||||
|
raise FormatError(f'Unexpected meter source image: {name}')
|
||||||
|
spans = []
|
||||||
|
for name, label, start, end, sha256 in METER_SPANS:
|
||||||
|
image = images[name]
|
||||||
|
if digest(read_va(image, start, end-start)) != sha256:
|
||||||
|
raise FormatError(f'Unexpected source meter span: {label}')
|
||||||
|
spans.append(dict(image=name, label=label, start=hex(start), end=hex(end),
|
||||||
|
fileOffset=image.offset(start-image.base), bytes=end-start, sha256=sha256))
|
||||||
|
exe = images['Neutron.exe']
|
||||||
|
multiplier = struct.unpack('<d', read_va(exe, 0x48D908, 8))[0]
|
||||||
|
if multiplier != 1.04:
|
||||||
|
raise FormatError('Unexpected meter percentage multiplier')
|
||||||
|
return dict(images=expected, guardedSpans=spans, heightMultiplier=multiplier,
|
||||||
|
width=27, backgroundCanvas=21, fillCanvas=22,
|
||||||
|
rawBackgroundPosition=[320, 7], rawFillPosition=[322, 4],
|
||||||
|
layoutPolicy='Modern logical rectangles from source coordinates; cached engine autoalignment scheduling remains open.')
|
||||||
|
|
||||||
|
|
||||||
|
def digest(data: bytes) -> str:
|
||||||
|
return hashlib.sha256(data).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def resource(database: Database, kind: str, identity: int) -> dict:
|
||||||
|
matches = [e for e in database.entries if e.type == kind and e.id == identity]
|
||||||
|
if len(matches) != 1:
|
||||||
|
raise FormatError(f'Expected one {database.path.name}:{kind}:{identity}')
|
||||||
|
entry = matches[0]
|
||||||
|
payload = database.payload(entry)
|
||||||
|
result = dict(archive=database.path.name, archiveSha256=digest(database.data),
|
||||||
|
**asdict(entry), payloadSha256=digest(payload))
|
||||||
|
if kind == 'Canv':
|
||||||
|
canvas = read_canvas(payload)
|
||||||
|
rgba = canvas.pop('rgba')
|
||||||
|
result.update(canvas=canvas, rgbaSha256=digest(rgba),
|
||||||
|
alphaCounts=dict(sorted(Counter(rgba[3::4]).items())))
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def tutorial(original: Path, name: str) -> dict:
|
||||||
|
source = resolve_asset(original, f'gam/{name}.gam')
|
||||||
|
data = source.read_bytes()
|
||||||
|
level = parse(data)
|
||||||
|
database = Database(resolve_asset(original, f'omt/{name}.omt'))
|
||||||
|
meshes = []
|
||||||
|
for entry in database.entries:
|
||||||
|
if entry.type != '3DSh':
|
||||||
|
continue
|
||||||
|
shape = read_shape(database.payload(entry))
|
||||||
|
vertices = shape['vertices']
|
||||||
|
meshes.append(dict(**asdict(entry), vertices=len(vertices),
|
||||||
|
polygons=len(shape['polygons']),
|
||||||
|
triangles=sum(max(0, len(p['corners'])-2) for p in shape['polygons']),
|
||||||
|
bounds=dict(min=[min(v[i] for v in vertices) for i in range(3)],
|
||||||
|
max=[max(v[i] for v in vertices) for i in range(3)])))
|
||||||
|
# Preserve duplicate tags and literal patrol links; do not silently repair
|
||||||
|
# malformed/missing references or identify distinct actors by tag alone.
|
||||||
|
records = [dict(ordinal=index, kind=e.kind, offset=e.offset,
|
||||||
|
tag=e.values().get('ObjectTag', ''),
|
||||||
|
properties=[asdict(p) for p in e.properties])
|
||||||
|
for index, e in enumerate(level.entities)]
|
||||||
|
tags = Counter(str(r['tag']).casefold() for r in records)
|
||||||
|
return dict(level=level.code, source=f'gam/{source.name}', bytes=len(data),
|
||||||
|
sha256=digest(data), counts=dict(sorted(Counter(e.kind for e in level.entities).items())),
|
||||||
|
duplicateTags={tag: count for tag, count in sorted(tags.items()) if count > 1},
|
||||||
|
archive=database.path.name, archiveSha256=digest(database.data), meshes=meshes,
|
||||||
|
entities=records)
|
||||||
|
|
||||||
|
|
||||||
|
def inspect(original: Path) -> dict:
|
||||||
|
original = original.resolve()
|
||||||
|
screens = Database(resolve_asset(original, 'omt/screens.omt'))
|
||||||
|
retained = Database(resolve_asset(original, 'omt/RetainedSprites.omt'))
|
||||||
|
voice = Database(resolve_asset(original, 'omt/voicepractice.omt'))
|
||||||
|
sounds = Database(resolve_asset(original, 'omt/soundeffects.omt'))
|
||||||
|
texture_source = resolve_asset(original, 'png/jimycarl.png')
|
||||||
|
texture = read_png(texture_source)
|
||||||
|
rgba = texture.pop('rgba')
|
||||||
|
clips = []
|
||||||
|
for stem in ('jimstop', 'jimrun', 'jimbackpedal', 'jimjump', 'jimfall', 'jimfly', 'jimshoot'):
|
||||||
|
source = resolve_asset(original, f'ASE/{stem}.ASE')
|
||||||
|
clip = read_ase(source)
|
||||||
|
clips.append({key: value for key, value in clip.items() if key != 'objects'} | dict(
|
||||||
|
nodes=[dict(name=o['name'], samples=len(o['samples']),
|
||||||
|
times=[s['time'] for s in o['samples']],
|
||||||
|
vertices=len(o['samples'][0]['vertices']),
|
||||||
|
faces=len(o['samples'][0]['faces']),
|
||||||
|
uvs=len(o['samples'][0]['uvs']),
|
||||||
|
textureFaces=len(o['samples'][0]['textureFaces'])) for o in clip['objects']]))
|
||||||
|
return dict(schema=1,
|
||||||
|
policy='Serialized source data and decoded pixels/topology only; no gameplay or AI inference.',
|
||||||
|
resources=[resource(screens, 'Canv', i) for i in (11, 13, 21, 22, 47, 52, 88, 94, 109, 111)]
|
||||||
|
+ [resource(retained, 'Canv', 1)]
|
||||||
|
+ [resource(voice, 'Wave', i) for i in (20, 21, 22, 23, 24, 37, 38)]
|
||||||
|
+ [resource(sounds, 'Wave', i) for i in (2, 3, 106)],
|
||||||
|
jimmyTexture=dict(source=f'png/{texture_source.name}', sha256=digest(texture_source.read_bytes()),
|
||||||
|
**texture, rgbaSha256=digest(rgba), alphaCounts=dict(sorted(Counter(rgba[3::4]).items()))),
|
||||||
|
jimmyClips=clips, meterCode=meter_code_contract(original),
|
||||||
|
levels=[tutorial(original, name) for name in ('VR01', 'VR03')])
|
||||||
|
|
||||||
|
|
||||||
|
def write_report(original: Path, output: Path) -> dict:
|
||||||
|
original, output = original.resolve(), output.resolve()
|
||||||
|
if output.is_relative_to(original) or original.is_relative_to(output):
|
||||||
|
raise ValueError('Output must be separate from the original installation')
|
||||||
|
report = inspect(original)
|
||||||
|
output.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
output.write_text(json.dumps(report, indent=2, allow_nan=False)+'\n', encoding='utf-8')
|
||||||
|
return report
|
||||||
|
|
||||||
|
|
||||||
|
def export_meter(original: Path, output: Path) -> dict:
|
||||||
|
"""Export only the two source-bound recharge meter canvases, without tinting.
|
||||||
|
|
||||||
|
Source 401430 binds 4F7CB0/4F8028 to screens.omt21/22. Gameplay controls
|
||||||
|
visibility/percent/tint; output does not bake those changes into the pixels.
|
||||||
|
"""
|
||||||
|
original, output = original.resolve(), output.resolve()
|
||||||
|
if output.is_relative_to(original) or original.is_relative_to(output):
|
||||||
|
raise ValueError('Output must be separate from the original installation')
|
||||||
|
database = Database(resolve_asset(original, 'omt/screens.omt'))
|
||||||
|
recovered = []
|
||||||
|
for identity, expected in ((21, 'meter'), (22, 'metercolor')):
|
||||||
|
record = resource(database, 'Canv', identity)
|
||||||
|
if record['name'] != expected or (record['canvas']['width'], record['canvas']['height']) != (30, 110):
|
||||||
|
raise FormatError(f'Unexpected source meter canvas {identity}')
|
||||||
|
entry = next(e for e in database.entries if e.type == 'Canv' and e.id == identity)
|
||||||
|
canvas = read_canvas(database.payload(entry))
|
||||||
|
recovered.append((record, canvas['rgba']))
|
||||||
|
# Validate both identities before producing any generated files.
|
||||||
|
output.mkdir(parents=True, exist_ok=True)
|
||||||
|
textures = []
|
||||||
|
for record, rgba in recovered:
|
||||||
|
name = f"canvas_{record['id']}"
|
||||||
|
(output/(name+'.rgba')).write_bytes(rgba)
|
||||||
|
write_png(output/(name+'.png'), 30, 110, rgba)
|
||||||
|
textures.append(dict(id=record['id'], name=record['name'], width=30, height=110,
|
||||||
|
path=name+'.rgba', png=name+'.png', sourceOffset=record['offset'],
|
||||||
|
sourceBytes=record['size'], sourceSha256=record['payloadSha256'], rgbaSha256=record['rgbaSha256']))
|
||||||
|
manifest = dict(schema=1, referenceWidth=640, referenceHeight=480,
|
||||||
|
source=database.path.name, sourceSha256=digest(database.data), textures=textures)
|
||||||
|
(output/'meter.json').write_text(json.dumps(manifest, indent=2)+'\n', encoding='utf-8')
|
||||||
|
return manifest
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('original', type=Path)
|
||||||
|
parser.add_argument('--output', type=Path, required=True)
|
||||||
|
parser.add_argument('--meter-output', type=Path, help='Optional separate generated meter texture directory')
|
||||||
|
args = parser.parse_args()
|
||||||
|
report = write_report(args.original, args.output)
|
||||||
|
if args.meter_output:
|
||||||
|
export_meter(args.original, args.meter_output)
|
||||||
|
print(f"{len(report['resources'])} resource identities, {len(report['jimmyClips'])} Jimmy clips, two tutorials: {args.output}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -11,6 +11,7 @@ from entities import prepare_entities
|
|||||||
from models import prepare_models
|
from models import prepare_models
|
||||||
from ui import export_ui
|
from ui import export_ui
|
||||||
from gadget_resources import export_gadget_resources
|
from gadget_resources import export_gadget_resources
|
||||||
|
from gadget_followup_assets import export_meter
|
||||||
from sound_bank import export_sound_bank
|
from sound_bank import export_sound_bank
|
||||||
|
|
||||||
|
|
||||||
@@ -80,6 +81,7 @@ def main():
|
|||||||
(args.output/'scene-catalog.json').write_text(json.dumps(catalog, indent=2)+'\n')
|
(args.output/'scene-catalog.json').write_text(json.dumps(catalog, indent=2)+'\n')
|
||||||
export_ui(Database(find_archive(args.original, 'screens')), args.output / 'ui', Database(args.original / 'alpha.omt'))
|
export_ui(Database(find_archive(args.original, 'screens')), args.output / 'ui', Database(args.original / 'alpha.omt'))
|
||||||
export_gadget_resources(Database(find_archive(args.original, 'screens')), args.output / 'gadgets')
|
export_gadget_resources(Database(find_archive(args.original, 'screens')), args.output / 'gadgets')
|
||||||
|
export_meter(args.original, args.output / 'invisible-meter')
|
||||||
effects = export_sound_bank(args.original, args.output / 'effects')
|
effects = export_sound_bank(args.original, args.output / 'effects')
|
||||||
print(f"SoundEffects.omt: {len(effects['resources'])} original sound identities")
|
print(f"SoundEffects.omt: {len(effects['resources'])} original sound identities")
|
||||||
for name in args.audio:
|
for name in args.audio:
|
||||||
|
|||||||
Reference in new issue
Block a user