Enhance teleporter and map rendering tests

- Added initialization of startup processes in flex_archive_tests to ensure proper setup before teleporter operations.
- Updated assertions to verify the correct allocation and state of processes during teleporter execution.
- Introduced new tests in map_renderer_tests to validate shape rendering, including isolated shape rendering and player sprite integration.
- Enhanced map_sorter_tests with additional checks for occlusion handling and boundary conditions in render order resolution.
This commit is contained in:
Maddo 2026-10-06 21:07:35 +02:00
commit e00f9f3186
16 changed files with 954 additions and 398 deletions

View file

@ -0,0 +1,124 @@
# Hypothetical Player-Usable Grenade Family
**Status:** Design sketch, not recovered retail code and not ready to compile
**Targets:** No Remorse shapes `0x034E` (`CONCUSSION GRENADE`), `0x034F` (`NERVE GAS GRENADE`), and `0x0350` (`EMP GRENADE`)
**Design basis:** The surviving Remorse `GRENADE` class (`0x0343`), not `BLASTPAC` or `FUSPAC`
## Goal
Give all three removed grenade shapes separate player `use` paths while keeping the surviving old `GRENADE` behavior intact. Give each shape its own class record selected by the runtime shape selector, based on the surviving `GRENADE` callbacks, and add event-slot `0x01` handlers. Do not change the existing `0x0343` class until the new paths have been tested.
This separates three things that otherwise look deceptively similar:
- The retail name table preserves all three labels: `CONCUSSION GRENADE`, `NERVE GAS GRENADE`, and `EMP GRENADE`.
- Current map metadata marks all three as terrain and `invitem: false`; the labels do not make them ordinary inventory objects.
- The local Remorse USECODE indexes have a `GRENADE` class for `0x0343`, but no separate class/body for these three shapes.
## Verified Base Behavior
The extracted Remorse `GRENADE` class is class id `0x0343` (entry `184`). It has two non-empty common event bodies and no `use` body:
```c
function grenade_hit()
{
set_info(0x020B, *(arg_06));
process_exclude();
return;
}
function grenade_gotHit()
{
set_info(0x020C, *(arg_06));
process_exclude();
return;
}
```
These bodies assign process-info values and exclude their current process. Preserve them byte-for-byte in the first copied-class experiment. Their downstream meaning is not fully established here; do not treat `0x020B` or `0x020C` as explosion-type constants.
The vending-machine evidence is creation, not player-use behavior. `PEPSINS::use` and `PEPSIEW::use` each have a random branch that attempts `Item.legalCreateAtPoint(..., 0x0343, item)`; the scripts do not add a `GRENADE::use` event. The supplied enemy-use observation is consistent with a non-player producer, but the specific enemy creation path still needs an independently traced callsite before being treated as closed evidence.
References: [removed-item investigation](./removed_items.md), [GRENADE hit body](../USECODE/EUSECODE_extracted/pseudocode/GRENADE/slot_05_hit.txt), [GRENADE gotHit body](../USECODE/EUSECODE_extracted/pseudocode/GRENADE/slot_06_gotHit.txt), [PEPSINS use body](../USECODE/EUSECODE_extracted/pseudocode/PEPSINS/slot_01_use.txt), and [PEPSIEW use body](../USECODE/EUSECODE_extracted/pseudocode/PEPSIEW/slot_01_use.txt).
## Proposed Class/Event Shape
Use the executable's regular-shape class selector to determine each shape's class id; do not assume an archive class id solely from the shape number. Each new class record should contain:
| Event slot | Proposed content |
|---:|---|
| `0x01` (`use`) | Variant-specific player-use wrapper described below. |
| `0x05` (`hit`) | Copy the current `GRENADE::hit` body unchanged for the initial test. |
| `0x06` (`gotHit`) | Copy the current `GRENADE::gotHit` body unchanged for the initial test. |
Create independent rows for `0x034E`, `0x034F`, and `0x0350`; do not point all three selectors at one mutable class record. All other rows can remain absent unless testing shows a native caller requires them. Each class/event row is six bytes: retain its unknown leading word and write a valid code offset for each new body. The archive's class object index is derived from the class id; rebuild the class/event offsets and FLEX directory consistently.
`Item_Use` requests event `0x01`. The native dispatcher first resolves the item's class selector, then checks the owner-row event capability bits before creating an event process. A body without the corresponding `use` capability will not run. The current [format specification](./usecode-format-specification.md) describes this dispatch model.
## Specific Player-Use Handlers
These are source-level usecode sketches, not recovered or compilable retail bodies. Each is a distinct slot-`0x01` event. They call a proposed `GrenadeFx.playerUse` native helper because the local corpus does not establish a complete script-level throw, fuse, area-target, and actor-status API. The helper and its ordinal do not exist yet; do not encode these calls as intrinsic `0x0017`.
```c
function concussion_grenade_use()
{
GrenadeFx.playerUse(this, GRENADE_KIND_CONCUSSION);
return;
}
function nerve_grenade_use()
{
GrenadeFx.playerUse(this, GRENADE_KIND_NERVE);
return;
}
function emp_grenade_use()
{
GrenadeFx.playerUse(this, GRENADE_KIND_EMP);
return;
}
```
`GRENADE_KIND_*` are proposed dispatch tags, not the `exptype` argument to `Item::I_explode`. Keep the kind-to-effect mapping out of the explosion-type field: the converter calls `Item::I_explode(Item *, exptype, destroy_item)` a hint, and the compatibility implementation uses that field for ordinary explosion presentation/damage scaling, not nerve or EMP semantics.
### Shared Launch Contract
The proposed `GrenadeFx.playerUse(item, kind)` must:
1. Resolve the controlled actor from the native `Item_Use` event context and confirm this exact item is in that actor's inventory.
2. Compute a facing/aim-based landing point and reject an illegal launch without consuming the item.
3. Remove only this item from inventory, create one world projectile, and attach the existing-style fuse/impact lifecycle. Never call `Item::I_explode` on the inventory-resident item: the explosion must use the projectile's world position.
4. On impact or fuse expiry, dispatch exactly one variant effect below, then destroy the projectile. Failed launch leaves the inventory item untouched.
The launch/fuse routine is shared behavior; the target filters and detonation effects remain variant-specific. Usecode alone may be able to orchestrate part of this, but no verified Remorse implementation for the complete contract has been identified.
### Variant Effects
| Shape | First-playtest behavior | Target policy |
|---|---|---|
| `0x034E` Concussion | Standard grenade blast damage, retaining the engine's ordinary hit reaction rather than adding a custom status. Use the normal Crusader explosion path (`Item::explode(projectile, 0, true)` in the compatibility implementation). | Ordinary blast radius; affects any damageable actor in range, including the player. |
| `0x034F` Nerve gas | On impact, create a gas cloud for 6 seconds, pulsing once per second. Each pulse deals 2 damage and interrupts eligible actors. These are starting balance values, not recovered values. | Hostile human actors only. Exclude androids, the player, allies, and neutral humans. |
| `0x0350` EMP | On impact, emit one pulse: 20 damage plus an 8-second inhibitor-like lock that interrupts attacks and prevents movement/attacks. These are starting balance values, not recovered values. | Hostile android actors only. Organic actors receive no EMP damage or lock. |
Nerve and EMP need target enumeration, hostility/species classification, and timed status effects. Implement those operations in a new native helper/process or prove an existing retail process can do them before assigning USECODE opcodes. Do not emulate a timed lock by setting an actor's activity once; that does not establish a persistent stun or a reliable recovery timer.
There is a useful but limited compatibility-runtime clue for EMP: ScummVM's Crusader `Actor::receiveHitCru` has a special interruption branch for hit types `0x0F` and `7`; it includes shape `899` (commented as Android), `0x338`, `0x385`, and `0x4E6`, and can pause an attack process for a randomized 8-17 seconds. This supports testing an Android interruption effect, but it does **not** prove those values are the original retail inhibitor mechanic or cover every Android variant. Prefer a deterministic, explicitly reversible EMP lock for the first custom implementation, then compare its behavior with the original inhibitor if that executable path is recovered.
The standard `Item::explode` compatibility path applies ordinary splash damage through FireType `4`; it has no Nerve-vs-EMP target filter. Thus only the concussion variant should use it unchanged. Reusing it for Nerve or EMP would also damage non-targets and would not create the requested status effects.
## Work Required To Make It Usable In-Game
1. **Enable normal inventory treatment.** Update the actual item/shape definitions so `0x034E`, `0x034F`, and `0x0350` are carryable inventory bombs, not just terrain-shaped map objects. Check each inventory family, icon/frame, weight/stack behavior, and pickup flags. Update map metadata separately if the viewer should present them as inventory-capable.
2. **Add three class records.** Resolve the runtime-selected class id for each shape and create an independent record for each, preserving the existing `0x0343` `GRENADE` record. Copy the known `hit` and `gotHit` rows as the first compatibility baseline.
3. **Add event `0x01` to each class.** Write the three variant-specific wrapper bodies, fix each class-local code offset/body bound, and ensure every loaded owner row advertises the `use` capability bit. Preserve each unknown event-row word unless its meaning is established.
4. **Implement the shared native launch helper.** Add and register `GrenadeFx.playerUse(item, kind)` or prove an existing helper has the required contract. Verify event actor context, inventory transfer, legal launch, projectile ownership, fuse timing, single consumption, and cancellation behavior. Assign an intrinsic ordinal only after checking the target build's table and ABI.
5. **Implement and tune the three effects.** Keep concussion on the normal blast path. Add human-hostile filtering and timed gas damage for Nerve, and android-hostile filtering plus a reversible inhibitor-like lock for EMP. Validate the actor taxonomy against the complete target executable; the trial damage values/durations above are gameplay knobs.
6. **Expose each item to the player.** Add all three through a legitimate inventory/loadout/map source and test ordinary pickup. Forced pickup alone does not test the `invitem`/inventory configuration.
7. **Rebuild and validate a disposable game copy.** Check pickup, inventory rendering/name, one-use behavior, each target filter, player/friendly/neutral exclusions, damage/status expiry, collision callbacks, blocked launch, save/load, and that legacy vending/enemy uses of `0x0343` remain unchanged.
The repository's current USECODE tooling does not yet provide a complete compiler and archive writer. The source-level handler and class-record sketches cannot be installed by editing pseudocode alone; implementing the new native helper also requires rebuilding the native executable. A lossless USECODE assembler/rebuilder and a carefully validated executable patch workflow are required. See the [round-trip roadmap](./usecode-roundtrip-ir.md).
## Confidence Summary
- **Verified:** `GRENADE` is class `0x0343`; only `hit` and `gotHit` have bodies; both set process info and exclude the process; Pepsi vending scripts create shape `0x0343` on a branch; the retail name table preserves the three removed grenade names; current map metadata marks all three as non-inventory terrain.
- **Supported design choice, not proven:** separate class records with copied `hit`/`gotHit` and new `use` events are the least invasive way to preserve the old `0x0343` behavior while adding three player items.
- **Hypothetical:** the `GrenadeFx.playerUse` API, launch/fuse path, Nerve target filter and gas status, EMP Android classifier and inhibitor-like lock, and all first-playtest balance values. Normal `Item::I_explode` is a candidate only for the concussion variant; verify its exact behavior against the target retail build before installing.

View file

@ -17,17 +17,31 @@ The exported files are evidence, not directly compilable game source. Keep them
- Do not claim whole-game recompilation until startup, game ticks, interactions, mission flow, save/load, and presentation are driven by ported game code and playable on modern Windows using the original data.
## Source-Backed In-Game Vertical Slice
The immediate target is a fresh game on retail map 1 at the original starting teleporter, with an avatar owned by the ported item/NPC runtime, a tick and input path that actually drive that avatar, a changing world image, and at least one original-script-backed interaction. The current host item/process movement and live-item rendering are useful verified steps, but do **not** count as the original loop or interaction. Keep the diagnostic traversal view separate while replacing its behavior; no DOSBox parity gate is required for this Windows milestone.
The immediate target is a fresh game on retail map 1 that follows the original start sequence from the staging teleporter to the level-start pad, with an avatar owned by the ported item/NPC runtime, a tick and input path that actually drive that avatar, a changing world image, and at least one original-script-backed interaction. The current host item/process movement and live-item rendering are useful verified steps, but do **not** count as the original loop or interaction. Keep the diagnostic traversal view separate while replacing its behavior; no DOSBox parity gate is required for this Windows milestone.
1. **Startup and spawn:** port the fresh-game branch of `Game_Start` (`1020:0000`) through `Teleporter_CreateProcessDirect(1, 0x1e, 1)` and its placement callee. Resolve egg `0x1e` from original map data, not from the map bounds, and prove its coordinates and the spawned avatar/item ID in a retail-data test. Do not implement intro movies, main menu, save loading, or warp overrides for this slice.
1. **Startup and spawn:** port the fresh-game branch of `Game_Start` (`1020:0000`) through `Teleporter_CreateProcessDirect(1, 0x1e, 1)` and its placement callee. Resolve egg `0x1e` from original map data, then follow the nearby active `0x63` teleporter to destination egg item 6812 at `(30328, 29656, 16)`. The host path and retail test now verify item 1 reaches that pad; the original `Game_Start` call chain remains unported. Do not implement intro movies, main menu, save loading, or warp overrides for this slice.
2. **Live world ownership:** initialize the original item cache and NPC/avatar state for that map. The displayed avatar must be the same numbered, mutable item advanced by the process runtime; reject a separately drawn or separately positioned stand-in.
3. **Tick and input:** port the minimal recovered cycle/scheduler and keyboard queue/control chain that moves that avatar. Route Win32 key/timer events through the host boundary into those routines; test deterministic state changes with recorded inputs, including idle and blocked movement.
4. **Gameplay presentation:** render the live item/sprite state in source draw order each tick and follow the recovered camera state. Verify that movement, facing, and at least one changed world item appear on screen, without relying on a single prepainted fixed-map image.
5. **Real interaction:** implement one reachable map-1 usecode event through the original item find/grab, VM dispatch, and resulting world-state mutation. Demonstrate a repeatable before/input/after trace and visible effect; a script lookup or release-request counter is not an interaction.
6. **Acceptance:** launch the normal Windows executable with retail data, start map 1 at egg `0x1e`, move and interact without a diagnostic shortcut, and verify on-screen state plus a deterministic integration test. Keep absent combat, audio, menus, persistence, and broader missions listed as limitations, not silently simulated features.
6. **Acceptance:** launch the normal Windows executable with retail data, follow map 1's fresh-start sequence from egg `0x1e` through the active `0x63` trigger to the level-start pad, then move and interact without a diagnostic shortcut. Verify on-screen state plus a deterministic integration test. Keep absent combat, audio, menus, persistence, and broader missions listed as limitations, not silently simulated features.
### Progress Update (2026-10-06)
The normal map-1 host startup now follows the two-hop placement: start egg item 1597 (`0x1e`) reaches active trigger item 1598 (shape `0x0194`, frame 0, ID `0x63`), which places item 1 at destination egg item 6812 (`30328, 29656, 16`). The retail regression verifies the trigger, destination, avatar coordinates, and preservation of the timer, keyboard, and controller processes. The renderer centers on the destination, and the player sprite now uses the same frame-anchor convention as map objects. The MSVC gate passed all 15 CTests and the retail harness; the user confirms the avatar now appears at the correct location.
This remains a host-modeled startup, not execution through `Game_Start`, `Teleporter_CreateProcessDirect`, or the original scheduler. A destination-area eligible-use scan, reachable original-script mutation, and original loop/render parity remain open.
### Historical Staging-Point Snapshot
The following blocker details were recorded before the second hop was implemented. In particular, the no-eligible-use result and candidate distances refer to the old staging coordinate near `(6399, 6399, 0)`; they do not establish which interactions are reachable from the current destination `(30328, 29656, 16)`.
Current blocker: the normal host window resolves egg `0x1e` from map 1 and places host item 1 at that retail record, then routes queued input through host controller and animation processes that mutate the same live item. Startup now models the constructor's clear-stasis waiter and schedules the same-map teleporter over two kernel scans, but these remain host models, not calls through `Game_Start`, `Teleporter_CreateProcessDirect`, or the original scheduler. The ordinary host tick now also scans ready `Gravity` processes through the live-item collision sweep and requests a redraw when a falling item moves, including while the avatar is idle; this is not original scheduler parity. Idle ticks also consume pending usecode frame mutations and wake the renderer, rather than waiting for another movement input. The production-equivalent item search at the egg spawn still finds one candidate and no eligible `use` event. A retail scan finds 218 map-1 use-eligible items; the nearest is `PANELNS` item 288 at `(2919, 1061, 48)`, frame 0, quality 6, map-array 134, at horizontal Manhattan distance 8,818 staged-coordinate units from spawn `(6399, 6399, 0)`. Its recovered handler exits on frame 0 and nonzero map-array. A nearby `CARD_NS` at staged `(2783, 1055, 40)` has frame 0 and `QLo=6`; its `SWITCH::ordinal21` path needs keycard 6 to authorize the visible frame-4 state, and the fresh-game host keycard set is empty. The nearest chest candidate is `CHEST_EW` map-source record 151 at staged `(1087, 2559, 0)`, frame 0, `QLo=5`, 9,152 horizontal units from spawn. Its handler calls `FREE.slot_2d` to test a same-family legal swap to shape `0x054b`, then animates frames 0 through 4 and dispatches `TRIGGER` if the swap succeeds. The host currently lacks that shape-swap service, and no collision route from spawn to this chest has been verified. The nearest frame-0 `BOX_NS` is 18,048 staged-coordinate units away. The BOX_NS effect test remains fixture-origin coverage; no reachable retail interaction or original item/event dispatch is established.
### Current Blocker
Recompute `Item_Grab` candidates and eligible usecode events from item 1 at the destination pad, then prove reachability and implement one visible, original-script-backed mutation. The staging-point scan below is historical. The original startup call chain, game scheduler, and full source draw/camera behavior also remain incomplete.
## Current Inputs
- `exports/src_remorse/export_manifest.json` reports `CRUSADER.EXE`, 2,984 exported function files, 9 fallback function files, 57 global buckets, and 15,403 global definitions.
@ -227,9 +241,9 @@ The standalone `AreaSearch_SweepTestPt` bounds stage (`10e0:0b39`) clamps X/Y to
## First Interactive Windows Game Shell
`rebuild/remorse/out/build-nmake/remorse_game.exe` is the first windowed application target. It locates the game data root from its own executable path (or the current directory), defaults to map 1, and accepts an optional fixed-map index from 0 through 255.
`rebuild/remorse/out/build-nmake/remorse_game.exe` is the first windowed application target. It locates the game data root from its own executable path (or the current directory), defaults to map 1, and accepts either an optional fixed-map index from 0 through 255 or the original-style direct warp options.
The default window now opens directly onto the retail-map traversal test with no diagnostic HUD, synthetic Stand/keyboard processes, or `F` release shortcut. Pass `--diagnostics` (before or after the map number) to restore the diagnostic harness and its HUD. The map-1 startup midpoint is checked against the same collision bodies as the window, with at least one legal neighboring move. This is a **retail-data movement test**, not yet the real game: the player is host-created, rendering uses a static map preview, movement uses host polling/step policy, and neither the original startup/game loop nor item USECODE/mission interactions are running. Do not use this mode split as the roadmap's playable-game exit criterion.
The default window now opens directly onto the retail-map traversal test with no diagnostic HUD, synthetic Stand/keyboard processes, or `F` release shortcut. Its map-1 host startup follows the staging egg `0x1e` through active trigger `0x63` to destination egg item 6812 at `(30328, 29656, 16)` before rendering. Pass `--diagnostics` (before or after the map number) to restore the diagnostic harness and its HUD. The map-1 startup midpoint is checked against the same collision bodies as the window, with at least one legal neighboring move. This is a **retail-data movement test**, not yet the real game: the player is host-created, rendering uses a static map preview, movement uses host polling/step policy, and neither the original startup/game loop nor item USECODE/mission interactions are running. Do not use this mode split as the roadmap's playable-game exit criterion.
From the repository root:
@ -238,6 +252,14 @@ rebuild\remorse\build_msvc.cmd Debug
.\rebuild\remorse\out\build-nmake\remorse_game.exe 1
```
For a direct coordinate warp, use `-warp <mission> <x> <y> <z> [-mapoff <delta>]`. The target map is the retail mission-table base plus the offset; the coordinates are staged world coordinates, and the normal map-1 teleporter startup is bypassed. This verified command starts on map 1 at the chest/computer test area:
```powershell
.\rebuild\remorse\out\build-nmake\remorse_game.exe -warp 0 30463 29951 0 -mapoff 1
```
The window title reports the resolved map and direct coordinates. Coordinates must be X/Y `0..32767` and Z `0..255`.
The application builds the selected retail map scene and player assets on a worker thread, then displays a resizable Win32 window with the game palette and dependency-sorted map art. Shape 1 uses `ANIM.DAT` actions 0 (stand), 1 (walk), and 3 (unarmed run); frame metadata selects the `SHAPES.FLX` pose, horizontal flip, and movement delta. The original keypad direction mapping is supported alongside WASD/arrows and diagonal combinations. Shift and Caps Lock select walk/run using the controller's same-state rule. A 40 Hz host simulation tick advances frame steps against fixed-map and expanded-glob solid volumes; it now catches up after long paints instead of discarding all elapsed time beyond 50 ms. The retail signed displacement decoder is unchanged. The prototype's forward-only host movement step skips the small backward stride on walk frames 4 and 12 of directions 6/7/10/11, which had made both actor and following camera reverse mid-stride. This comfort policy and host tick rate are not recovered controller behavior. The persistent GDI back buffer avoids painting each moving frame directly to the window. The opt-in diagnostic HUD shows map, world position, facing, and locomotion state. Collision is an axis-aligned TYPEFLAG approximation; it does not reproduce original AreaSearch shape sweeps or step-up behavior, and the fixed-map record bounds remain the outer movement limit.
The second HUD row is an observable, separate process-runtime diagnostic: the host 40 Hz step delivers a registered SystemTimer event, advances the recovered scheduler scan, and runs an owned Stand entry through its verified off-screen sleep branch. Tick, remaining sleep ticks, and wake count update while the window is active. Three base entries reserve the low process IDs; the Stand entry and NPC number are diagnostic fixtures, not map NPCs or the player process. Host tick frequency is not the original DOS timer interrupt rate.
@ -515,9 +537,9 @@ After the first source-backed interaction, complete the original player/item loo
## Near-Term Next Actions
1. **Close the event path:** identify and reach an eligible retail `use` target from the original map-1 spawn. The exact production-equivalent search at egg `0x1e` still returns one candidate and no eligible event. Map-wide evidence includes the inactive/map-array `PANELNS`, a `CARD_NS` whose authorized state requires keycard 6, and a frame-0 `CHEST_EW` at staged `(1087, 2559, 0)` whose recovered handler attempts a legal shape swap to `0x054b` before animating. The host implements `Item.setShape` (`0x24`), but `FREE.slot_2d`'s family check, `Item.legal_create`, and temporary-item lifecycle are still missing; the chest's collision route is unverified. Next prove reachability and implement only the required recovered services, then exercise owner selection, context creation, VM execution, and a process/world-state effect. The BOX_NS regression still verifies candidate-driven selection and visible frame output from a fixture origin only; it does not close this action or establish `Usecode_ItemCallEvent` parity.
2. **Integrate the map-1 loop:** port `Game_Start` (`1020:0000`) and replace host initialization; the window now models the clear-stasis waiter and same-map teleporter over two scheduler scans, but does not implement the original wait lists or call chain. Next port the original target-map transition and item search, collision/fall, then move input and animation onto the recovered kernel loop. The current tests cover same-map egg resolution and the host stasis ordering, shared item-1 mutation, and host input/scheduler behavior, not binary lifecycle parity or source draw-order/camera behavior. Keep the normal window on the original path before calling the vertical slice accepted.
1. **Close the event path:** identify and reach an eligible retail `use` target from the actual level-start pad at `(30328, 29656, 16)`. The exact production-equivalent search at egg `0x1e` still returns one candidate and no eligible event, but that is the intermediate staging point, not the current avatar location; rerun the search from the destination. Map-wide evidence includes the inactive/map-array `PANELNS`, a `CARD_NS` whose authorized state requires keycard 6, and a frame-0 `CHEST_EW` at staged `(1087, 2559, 0)` whose recovered handler attempts a legal shape swap to `0x054b` before animating. The host implements `Item.setShape` (`0x24`), but `FREE.slot_2d`'s family check, `Item.legal_create`, and temporary-item lifecycle are still missing; the chest's collision route is unverified. Next prove reachability and implement only the required recovered services, then exercise owner selection, context creation, VM execution, and a process/world-state effect. The BOX_NS regression still verifies candidate-driven selection and visible frame output from a fixture origin only; it does not close this action or establish `Usecode_ItemCallEvent` parity.
2. **Integrate the map-1 loop:** port `Game_Start` (`1020:0000`) and replace host initialization; the window now models the clear-stasis waiter and both same-map teleports to the level-start pad, but does not implement the original wait lists or call chain. Next port the original target-map transition and item search, collision/fall, then move input and animation onto the recovered kernel loop. The current tests cover egg resolution and host stasis ordering, shared item-1 mutation, and host input/scheduler behavior, not binary lifecycle parity or source draw-order/camera behavior. Keep the normal window on the original path before calling the vertical slice accepted.
## Current Bottom Line
The host now materializes archive-backed USECODE chunks and builds tested 0x124-byte contexts with bounded source pointers and an initialized 0x82-byte call stack. Its window routes use-request candidates through owner-row selection into a context-backed task; the BOX_NS regression verifies VM-driven frame changes, rendered output, and cleanup, while a separate retail test confirms no eligible event at the original spawn and identifies only guarded/far map-wide candidates so far. Retail egg selection and placement of item 1 are covered, and the typed `TeleporterProcess` now runs after the host-modelled clear-stasis wait in a scheduler-driven two-pass test. A deterministic host input/tick test still verifies that the item-owned animation process moves item 1. Original `Game_Start`, full `Process_WaitFor` parity, cross-map teleporter lifecycle, `Usecode_ItemCallEvent`/context-dispatch, owner-resource callback parity, a reachable retail interaction, and original loop/render parity remain incomplete. Whole-game and playable-game acceptance remain unmet.
The host now materializes archive-backed USECODE chunks and builds tested 0x124-byte contexts with bounded source pointers and an initialized 0x82-byte call stack. Its window routes use-request candidates through owner-row selection into a context-backed task; the BOX_NS regression verifies VM-driven frame changes, rendered output, and cleanup. Retail tests now verify the complete map-1 startup placement from egg `0x1e` through active trigger item 1598/ID `0x63` to destination egg item 6812 at `(30328, 29656, 16)`, with item 1 and persistent runtime processes intact. The normal window has been confirmed at that destination, and the player sprite anchor was aligned with map-object rendering. The no-eligible-event result at egg `0x1e` describes only the former staging point; destination candidates still need to be scanned. A deterministic host input/tick test verifies that the item-owned animation process moves item 1. Original `Game_Start`, full `Process_WaitFor` parity, cross-map teleporter lifecycle, `Usecode_ItemCallEvent`/context-dispatch, owner-resource callback parity, a reachable retail interaction, and original loop/render parity remain incomplete. Whole-game and playable-game acceptance remain unmet.

View file

@ -1,236 +1,84 @@
# JELYHACK USECODE Analysis
# JELYHACK: What It Does and What We Know
## Scope
## Short answer
This note focuses on the currently exported pseudocode and byte-level decode for `JELYHACK` class `277` / class id `0x04D3`, especially its only non-zero event body: slot `0x01` (`use`).
In the Remorse USECODE archive, `JELYHACK` has one active event: `use`. If the player uses an object running this class, the handler sets process info `0x0207`, excludes the current process, and returns. It does not directly display text, play a sound, open a camera, change an item, or call a puzzle/event script.
Current generated pseudocode lives at:
Think of `JELYHACK` more as an **internal handle** than as the gadget that runs a puzzle. Its descriptor exposes one field, `referent`: an identity/reference the runtime can use to associate this record with other data. Newer VM analysis suggests referent-only records can own or connect a payload chain. Richer camera and trigger behavior exists in nearby classes such as `SURCAMNS` and `SURCAMEW`, but the evidence does not show that using `JELYHACK` directly launches those handlers.
- `USECODE/EUSECODE_extracted/pseudocode/JELYHACK/slot_01_use.txt`
- `USECODE/EUSECODE_extracted/pseudocode/JELYH2/slot_01_use.txt`
We also do not yet have a verified mission/map placement for a `JELYHACK` instance. The extracted scene files show map items and trigger eggs, but do not identify those items by USECODE class name. “Island” is therefore a useful label for this descriptor cluster, not a confirmed in-game location for this class.
## Plain-language answer
## What happens when it is used
If you want the short version first:
- `JELYHACK` does not look like the object that contains the real island gameplay script.
- It looks more like a small anchor object that gives the engine a `referent` identity and a tiny shared `use` stub.
- When the player uses it, the stub appears to register a generic interaction/info value (`0x0207`) and then immediately exits.
- The richer gameplay behavior is more likely carried by nearby event-bearing records such as `REE_BOOT`, `SURCAMEW`, or `SFXTRIG`.
So in easy words: `JELYHACK` currently looks less like "the script that does the JELYHACK puzzle" and more like "the map object or anchor that other real trigger objects point at or work beside."
That also answers "what uses it" in the safest current sense:
- the referent/owner side of the runtime uses it as an anchor-like record
- the player can still `use` it, but that `use` body is tiny and generic
- the surrounding event-bearing attachment records are the more likely carriers of the actual gameplay logic
## Direct decompilation result
Current readable decompilation for `JELYHACK::use`:
The Remorse event table gives `JELYHACK` (entry 277, class id `0x04D3`) a body only in slot `0x01` (`use`). The same is true of its sibling `JELYH2` (entry 280, class id `0x04D6`). The exported handler is:
```text
function jelyhack_use() /* entry=277 class_id=0x04D3 slot=0x01 */
{
entry:
set_info(0x0207, *(arg_06));
process_exclude();
return;
}
```
Byte-faithful decode of the same body:
```text
00D4: 5A init local_bytes=0x0
00D6: 5C symbol_info symbol=JELYHACK
00E2: 0B push_word_immediate value_u16=0x0207
00E5: 40 push_local_dword [BP+06h]
00E7: 4C push_indirect size=0x2
00E9: 77 set_info
00EA: 78 process_exclude
00EB: 5B line_number line_number=0x00DB
00EE: 50 ret
```
That readable pseudocode is currently hiding one important detail: there is a small trailer after `ret`.
Pentagram's older disassembly shows the body like this:
```text
Func_1 (Event 1) JELYHACK::use():
0001: 5A init 00
0003: 5C symbol info offset 001Ch = "JELYHACK"
000F: 0B push 0207h
0012: 40 push dword [BP+06h]
0014: 4C push indirect 02h bytes
0016: 77 set info
0017: 78 process exclude
0018: 5B line number 219 (00DBh)
001B: 50 ret
00: 01 type=69 (i) [BP+00h] (00) 00 referent
002A: 7A end
```
So the extra bytes are not currently best read as hidden live code. The strongest reading is:
- executable body ends at `ret`
- one post-return debug/local-symbol record follows
- that record names one slot/argument as `referent`
- then the body terminates with `0x7A end`
That matters because it argues against the dramatic interpretation that we found a chopped-off second script. Right now the evidence fits "metadata trailer" much better than "cut content."
## What the trailer most likely represents
Current best explanation of the bytes after `ret`:
- they are post-return symbol/debug metadata, not a second reachable instruction stream
- they preserve the name `referent`, which matches the descriptor-side picture where `JELYHACK` only exposes a `referent` field
- they reinforce the idea that this class is an anchor/owner record, not a rich event script
In practical terms, the trailer is telling us something like: "this body knows about one meaningful value here, and that value is called `referent`."
That is useful evidence, but it is not new gameplay logic.
## Suggested readable pseudocode form
For human reading, the most honest pseudocode form is probably this:
```text
function jelyhack_use() /* entry=277 class_id=0x04D3 slot=0x01 */
function jelyhack_use()
{
set_info(0x0207, *(arg_06));
process_exclude();
return;
/* post-return metadata (not executable):
debug_symbol referent [BP+00h] type=0x69
*/
}
```
That presentation keeps the important distinction visible:
The native VM confirms that these are process-control operations, not display commands. Opcode `0x77` stores two values on the running process: the used item's id as its source item, and `0x0207` as its process/event type. Opcode `0x78` then checks for another live process with the same item id and type. The final `0x50 ret` returns normally if execution continues. There is no branch, spawn, class/event call, text-file call, sound call, or item mutation in this handler.
- the function really returns where it looks like it returns
- there is still meaningful trailer data after that return
- the trailer is metadata, not currently credible as reachable lost code
**Likely player-visible result:** nothing obvious happens from this handler alone. Its practical job is bookkeeping and duplicate suppression: associate the running process with this item under type `0x0207`, then let the first matching process proceed while a duplicate takes the interpreter's early-completion path. The item is also marked in the engine's process-presence bitmap while it has a process; native termination refreshes that flag and clears it when no process remains for the item. The script itself does not show text, play audio, animate a screen, or change the world.
## What is directly supported
The number `0x0207` is not identified as a named gameplay action. In the native process entry, it occupies the process-type field; the duplicate check compares that field together with the item id. The exact English label or wider purpose of this tag remains unknown. It is common rather than JELYHACK-specific: the same `set_info(0x0207, item)` pattern appears in 117 exported Remorse event bodies. Do not interpret it as a message number, a camera command, or a special JELYHACK action. `process_exclude` does not hide or delete the object; it ends a competing process for the same item/type pair.
1. `JELYHACK` is not an active event hub in the same sense as `EVENT`, `NPCTRIG`, or `_BOOT` classes.
2. Its only non-zero slot is `0x01` (`use`), with `raw_event_entry_word = 0x002A`, `raw_code_offset = 0x00000001`, and body range `0x00D4..0x00FE` (`42` bytes).
3. The actual executable body is tiny: one `set_info(0x0207, *(arg_06))`, one `process_exclude()`, then return.
4. `JELYH2` is the same script body for practical purposes. The only pre-return differences are the symbol label string and line-number metadata; control flow and active ops are otherwise the same.
5. A post-return trailer still preserves `referent` metadata, which lines up with the descriptor-side fact that `JELYHACK` only exposes `referent`.
6. `JELYHACK` still exposes only the `referent` field on the descriptor side, which keeps it in the `referent-anchor` category rather than the event-bearing category.
This is backed by live Remorse Ghidra analysis: `Interpreter_NextUsecodeOp` opcode `0x77` calls `EntityDispatchEntry::SetEventTypeChecked` and `SetSourceType`; opcode `0x78` calls `Kernel_GetNumProcesses(itemno, proctype)` and exits when the count exceeds one. `SetSourceType` marks the item-process-presence bitmap. The type-specific item-process bits are only updated for `0xF0..0xF7`, so `0x0207` does not set one of those special flags.
## Comparison against the exported pseudocode corpus
The Remorse body window is `0x00D4..0x00FE` (42 bytes). The executable instructions return before the trailing symbol record naming `referent`, followed by the `0x7A end` marker. That trailer is metadata, not a second gameplay routine.
The `JELYHACK::use` body is not unique. Normalizing away only the function header, the exact same readable body currently appears in these seven exports:
## What the referent evidence means
- `AVATAR/slot_01_use.txt`
- `GRAVITON/slot_01_use.txt`
- `IONIC/slot_01_use.txt`
- `JELYHACK/slot_01_use.txt`
- `JELYH2/slot_01_use.txt`
- `PLASMA/slot_01_use.txt`
- `WEA_BOOT/slot_01_use.txt`
The Remorse descriptor for `JELYHACK` contains only `referent`; `JELYH2` has the same descriptor shape and the same active `use` behavior. Newer VM analysis identifies referent-only records as likely owners/identities in a runtime payload chain. This is a better explanation than treating the class as a complete puzzle script.
That matters because it argues against a special-purpose `JELYHACK` event implementation. The more defensible reading is that this is one small generic `use` stub reused across several classes.
The extracted descriptor neighborhood places `JELYHACK` near `SURCAMNS`, `REE_BOOT`, `SURCAMEW`, and `SFXTRIG`, alongside other records with `referent` fields. Some of those records also expose `event` or `eventTrigger` fields. This supports a model in which referent records and event-bearing records participate in a shared data-driven group.
There is also a second useful comparison: other classes often start with the same `set_info(...); process_exclude();` prologue and then continue into much richer logic. `DATALINK::use` is a good example: it begins with the same opening but then expands into a larger branch-heavy routine. So the `set_info/process_exclude` pair is best treated as a common preamble, not the whole semantic payload of a class family.
Important limit: these are descriptor-table relationships and runtime-family evidence. They do not prove the records are physically adjacent in a level, that each one points to this particular JELYHACK instance, or that a direct call runs from JELYHACK to any neighbor. A search of the exported pseudocode found no direct class/event call to class ids `0x04D3` or `0x04D6`.
## What `JELYHACK::use` most likely does
## Where the richer behavior lives
Current safest reading:
The closest concrete gameplay logic is in the camera callback classes, not in `JELYHACK::use`:
- It performs a small generic `use`-entry setup using info id `0x0207` and the dereferenced word at `arg_06`.
- It then marks the current process or handler for exclusion/suppression through `process_exclude()`.
- It does not itself implement the richer trigger logic one would expect from an active gameplay event script.
- `SURCAMNS::use` checks status bit `0x1000`; when set, it starts the class's high-slot handler `0x20`.
- `SURCAMNS::slot_20` follows link/quality values, checks nearby monitor/value-box objects, can request text-file handling, and starts trigger and camera-related handlers.
- `SURCAMNS::slot_21` creates a screen-related item and searches for matching camera eggs and mechanical actors, with waits and input checks.
- `SURCAMEW` contains a parallel callback family, with related screen and camera-object handling.
The unresolved part is the exact gameplay meaning of `set_info(0x0207, *(arg_06))`. The exported corpus shows this exact pattern in multiple unrelated classes, so `0x0207` currently looks more like a shared UI/message/interaction setup code than a JELYHACK-specific action.
These field names and operations make the surrounding cluster look like a security-monitor/camera interaction system. That is a useful gameplay interpretation of `SURCAMNS`/`SURCAMEW`; it is **not** proof that clicking a `JELYHACK` object opens that system. The missing link is an instance-level referent or map-data connection.
That leads to the simplest current gameplay explanation:
## Where it is used, and what remains unknown
- the object can be "used"
- the engine records a generic interaction fact about that use
- the object then gets out of the way
- anything interesting that happens next probably belongs to a neighboring event-bearing attachment, not to `JELYHACK` itself
What the current evidence establishes:
## What it probably does not do
- `JELYHACK` and `JELYH2` are present as separate classes in the Remorse USECODE archive.
- Both have only the small `use` handler in their common event slots, and their Remorse descriptors expose only `referent`.
- Their likely role is to provide a referent identity for the surrounding data-driven behavior group.
- The camera/trigger classes contain substantial behavior, but no direct call from JELYHACK to them has been recovered.
The current evidence argues against several stronger claims:
What it does **not** establish:
- It is probably not the main script that drives the JELYHACK gameplay behavior by itself.
- It is probably not the actual event-bearing payload that reaches the richer runtime opcode lanes recovered around `000d:208b`, `000d:21ed`, and `000d:22bc`.
- It is probably not a unique script template specialized only for the JELYHACK object.
- The bytes after `ret` are probably not a hidden reachable second branch or a simple "return was moved upward" cut-content remnant.
- the exact level, map coordinates, or visible object that uses class `JELYHACK`;
- the player-visible meaning of `set_info(0x0207, ...)`;
- which concrete event-bearing record shares a referent with a particular JELYHACK instance;
- that JELYHACK itself is a puzzle switch, camera terminal, key, or island controller.
If this were cut executable content, we would want to see stronger signs such as:
To answer those questions, the next useful evidence is an instance-level link: a map/object record bound to this class plus its referent value, cross-checked against the corresponding event-bearing records. Class-table proximity alone cannot supply that link.
- a branch target that lands in the trailer
- a sensible opcode stream after `ret`
- different trailers between `JELYHACK` and `JELYH2` that might hint at divergent behavior
## Variant note
At the moment we have the opposite pattern: a small named metadata record, a clean `end`, and strong similarity across the twin classes.
This conclusion about the `referent` descriptor is for the current Remorse extraction. Regret also contains classes named `JELYHACK` and `JELYH2`, and their readable `use` pseudocode has the same short operations, but their records are not interchangeable: the Regret `JELYHACK` event window is 13 bytes rather than Remorse's 42-byte window, and its descriptor decode does not expose the same `referent` field. Keep the class names and visible handler separate from the variant-specific descriptor evidence.
## Relationship to JELYH2 and the surrounding island
## Evidence files
`JELYHACK` and `JELYH2` remain the clearest referent-anchor twins in the extracted USECODE data:
- same lone live slot `0x01`
- same event-table row shape (`0x002A / 0x00000001`)
- same `42`-byte body length
- same readable `use` body before return
- same descriptor-side role: `referent-anchor`
This fits the broader neighborhood evidence already captured elsewhere:
- `JELYHACK` / `JELYH2` sit beside event-bearing neighbors such as `REE_BOOT`, `SURCAMEW`, and `SFXTRIG`
- those neighbors expose `event` or `eventTrigger` fields and carry materially richer behavior bodies
- the current best model is therefore still `referent anchor + neighboring event-bearing attachment`, not `JELYHACK as a standalone active event core`
## Comparison with nearby event-bearing neighbors
The generated pseudocode reinforces that split.
`REE_BOOT` slot `0x0A` and `SFXTRIG` slot `0x0A` diverge immediately from the JELYHACK body:
- they use `set_info(0x0211, *(arg_06))` instead of `0x0207`
- they perform status checks, helper calls, spawns, waits/suspends, and other active logic
- they therefore look like genuine event-bearing routines rather than passive anchor stubs
`DATALINK` slot `0x01` is also instructive in the other direction:
- it starts with the same `set_info/process_exclude` preamble
- but it then continues into a much larger routine
- so the shared opening is not enough to classify a body as anchor-only or event-bearing by itself
## Current best conclusion
The decompiled `JELYHACK::use` body is important mainly because it supports a negative result cleanly:
- `JELYHACK` is not hiding a large active event script in its only live slot
- its visible `use` handler is a minimal generic stub shared with several other classes
- the bytes after `ret` look like a metadata trailer naming `referent`, not like secret live code
- the interesting gameplay semantics around the JELYHACK island are still more likely to live in neighboring event-bearing descriptors attached to the same referent context
So the current best human-readable model remains:
```text
anchor JELYHACK(referent)
anchor JELYH2(referent)
use:
set_info(shared_use_code_0x0207, deref(arg_06))
process_exclude()
return
actual island behavior:
likely carried by neighboring event-bearing attachments such as REE_BOOT / SURCAMEW / SFXTRIG
```
That is a stronger and cleaner claim than the older vague label `referent anchor`: the exported pseudocode now shows that the anchor really does have code, but the code is a tiny shared interaction stub, not the island's main behavior engine.
- [Remorse JELYHACK use pseudocode](../USECODE/EUSECODE_extracted/pseudocode/JELYHACK/slot_01_use.txt)
- [Remorse JELYH2 use pseudocode](../USECODE/EUSECODE_extracted/pseudocode/JELYH2/slot_01_use.txt)
- [Remorse class/event index](../USECODE/EUSECODE_extracted/class_event_index.tsv)
- [Descriptor neighborhood graph](../USECODE/EUSECODE_extracted/jelyhack_island_graph.md)
- [Readable descriptor templates](../USECODE/EUSECODE_extracted/readable_descriptor_templates.md)
- [Runtime/readable script analysis](../USECODE/EUSECODE_extracted/readable_script_ir.md)
- [Descriptor-family runtime evidence](../USECODE/EUSECODE_extracted/runtime_descriptor_family_rankings.md)
- [USECODE opcode and runtime caveats](usecode-format-specification.md)

View file

@ -0,0 +1,105 @@
# Crusader USECODE Unreferenced-Body Candidates
**Status:** Static reference scan with a separately identified debug-only class
**Scope:** Main local Remorse and Regret `EUSECODE.FLX` corpora
**Scanned:** 2026-10-06
## Result
The current bytecode scan found **20 Remorse** and **24 Regret** non-empty high-slot event bodies with no incoming explicit class/event call or spawn reference from any decoded body in the same corpus. The `FLICTEST` slot-`0x21` bodies are identified below as debug movie-player code, confirmed unused as ordinary retail gameplay; the other **19 Remorse** and **23 Regret** entries remain unclassified candidates.
| Variant | Bodies scanned | Decoded call/spawn references | No-incoming bodies | Confirmed debug-only | Unclassified candidates |
|---|---:|---:|---:|---:|---:|
| Remorse | 977 | 2,878 | 20 | 1 | 19 |
| Regret | 1,152 | 3,415 | 24 | 1 | 23 |
## Candidate Lists
A candidate is identified by its class id and event slot. Body size is in bytes. The names are the extracted class-name hints.
### Remorse
| Class ID | Class | Slot | Body bytes |
|---:|---|---:|---:|
| `0x0A1E` | `ITEM` | `0x20` | 86 |
| `0x0A1E` | `ITEM` | `0x21` | 159 |
| `0x0A20` | `FLICTEST` | `0x21` | 9,901 |
| `0x0A17` | `TEXTFILE` | `0x22` | 229 |
| `0x0A1E` | `ITEM` | `0x22` | 101 |
| `0x0A09` | `ELEVAT` | `0x25` | 524 |
| `0x0A11` | `NPC` | `0x25` | 203 |
| `0x0A1E` | `ITEM` | `0x25` | 1,093 |
| `0x0A11` | `NPC` | `0x26` | 494 |
| `0x0A1E` | `ITEM` | `0x26` | 968 |
| `0x0A0C` | `FREE` | `0x27` | 223 |
| `0x0A11` | `NPC` | `0x27` | 329 |
| `0x0A0C` | `FREE` | `0x2A` | 224 |
| `0x0A1E` | `ITEM` | `0x2C` | 139 |
| `0x0A0C` | `FREE` | `0x34` | 136 |
| `0x0A0C` | `FREE` | `0x35` | 97 |
| `0x0A0C` | `FREE` | `0x36` | 91 |
| `0x0A0C` | `FREE` | `0x37` | 89 |
| `0x0A0C` | `FREE` | `0x38` | 78 |
| `0x0A0C` | `FREE` | `0x39` | 106 |
### Regret
| Class ID | Class | Slot | Body bytes |
|---:|---|---:|---:|
| `0x05D8` | `TRAMFLOR` | `0x20` | 645 |
| `0x0A0A` | `FLICTEST` | `0x21` | 11 |
| `0x0A0C` | `ITEM` | `0x22` | 68 |
| `0x0A16` | `TEXTFILE` | `0x22` | 142 |
| `0x0A0C` | `ITEM` | `0x23` | 43 |
| `0x0A08` | `ELEVAT` | `0x25` | 324 |
| `0x0A0F` | `NPC` | `0x25` | 105 |
| `0x0A0F` | `NPC` | `0x26` | 267 |
| `0x0A0C` | `ITEM` | `0x27` | 655 |
| `0x0A0F` | `NPC` | `0x27` | 193 |
| `0x0A0C` | `ITEM` | `0x28` | 579 |
| `0x0A1D` | `FREE` | `0x28` | 170 |
| `0x0A0F` | `NPC` | `0x2B` | 169 |
| `0x0A0C` | `ITEM` | `0x2E` | 80 |
| `0x0A1D` | `FREE` | `0x2F` | 197 |
| `0x0A1D` | `FREE` | `0x30` | 127 |
| `0x0A1D` | `FREE` | `0x33` | 98 |
| `0x0A1D` | `FREE` | `0x3D` | 93 |
| `0x0A1D` | `FREE` | `0x3E` | 36 |
| `0x0A1D` | `FREE` | `0x3F` | 36 |
| `0x0A1D` | `FREE` | `0x40` | 33 |
| `0x0A1D` | `FREE` | `0x41` | 35 |
| `0x0A1D` | `FREE` | `0x42` | 47 |
| `0x0A1D` | `FREE` | `0x43` | 35 |
## Confirmed Debug-Only Code
The `FLICTEST` class is a debug movie-player/helper, not normal retail gameplay content. Its unreferenced slot-`0x21` body appears in each candidate table above:
- Remorse: class `0x0A20`, `FLICTEST::0x21`, 9,901 bytes.
- Regret: class `0x0A0A`, `FLICTEST::0x21`, 11 bytes.
This classification is about the feature's retail gameplay status, not whether the code or class exists in the shipped archive. In both variants, `FLICTEST::0x20` has explicit script references and is therefore not in the no-incoming list. The longer class-specific investigation documents the debug movie-browser behavior and the remaining routes/evidence: [FLICTEST usecode investigation](./usecode/flictest-investigation.md).
## Cross-Reference: Removed Shapes
The removed-item note describes shapes, while this scan lists non-empty USECODE class/event bodies. A removed shape with no corresponding class is absent from this list by construction; it is not an unreferenced body.
- **`0x034E` concussion grenade:** not in the candidate list. The Remorse and Regret class/event indexes contain no class with class id `0x034E`; the removed-item investigation also found no separate Remorse USECODE class. The surviving name/map data does not establish a script body.
- **`0x034F` nerve gas grenade and `0x0350` EMP grenade:** likewise, no class/event bodies with those class ids were found in either index. In Regret, `0x0350` is still a resolved bomb display-name entry, but that does not make it a USECODE class.
- **`0x0343` old grenade:** not an unreferenced candidate. It is the separate `GRENADE` class (id `0x0343`), with non-empty `hit` and `gotHit` handlers; the removed-item note also records Pepsi dispenser scripts attempting to create this shape.
- **`0x0548`, `0x0110`, and `0x0112`:** these are suspicious/unmapped shapes in the removed-item note, not class/event ids identified by this body scan. Their absence here says nothing by itself about native item behavior.
See [removed item shapes](./removed_items.md) for the source evidence and qualifications.
## Method
- Scanned every non-empty body in the Remorse [`class_event_index.tsv`](../USECODE/EUSECODE_extracted/class_event_index.tsv) and Regret [`class_event_index.tsv`](../USECODE/REGRET/REGRET_USECODE_extracted/class_event_index.tsv).
- Parsed bodies with the existing [`poc_crusader_usecode_parser.py`](../tools/poc_crusader_usecode_parser.py), collecting explicit targets from bytecodes `0x11` (class/event call), `0x57` (spawn), and `0x58` (inline spawn).
- Counted incoming references by `(class id, event slot)`. Candidates are non-empty bodies at slots `0x20` and above with no incoming reference in that graph. The scan completed with zero parser errors, unknown-opcode bodies, or targets lacking a non-empty indexed body.
- Limited the candidate list to high slots because the common low event slots have engine/native dispatch paths; a body at one of those slots may be an entry point without any bytecode caller.
## Limits and Interpretation
"No incoming bytecode reference" is not equivalent to "unused in the final game." The scan cannot rule out native code dispatching a high slot dynamically, references encoded in game data or outside these two archives, behavior reached through unmodeled runtime paths, or content/version differences. It also does not measure whether an explicit call site is actually reachable or executed. The `FLICTEST` classification is based on the separate debug-player investigation and should not be generalized to its explicitly referenced slot-`0x20` body.
The common event catalog documents native entry points and explains why an empty slot, an unreferenced body, and a confirmed dead body are different claims: [usecode-event-slots-catalog.md](./usecode-event-slots-catalog.md). This list should be upgraded only after checking candidate callers in the executable and references in the corresponding final-game data.