- Updated the USECODE Tool Improvement Plan to focus on the map-viewer decompiler/editor, emphasizing its role as the primary development target for USECODE editing and recompilation. - Revised the tooling comparison document to include the newer map-viewer decompiler, clarifying its purpose and distinguishing it from the Python parser. - Introduced a new ClearAvatarInStasisProcessEntry structure in the entity dispatch entry header, along with related process creation and execution logic in the ProcessKernel. - Implemented the setItemShape method in LiveFixedMapItems to allow dynamic shape updates for items. - Enhanced the teleporter process to handle avatar stasis and integrated it into the game main loop, ensuring proper process management and state handling. - Added tests for the new functionality, including shape setting and teleporter process behavior, to ensure correctness and stability.
26 KiB
Crusader USECODE Event Slot Catalog
Status: Evidence-backed working catalog; event names and signatures remain hints unless corroborated below.
Scope: Main local Remorse and Regret owner-loaded EUSECODE.FLX corpora. Demo, Japanese, and 1.01 variants are excluded from the counts.
Last consolidated: 2026-10-05
This companion expands the event-slot summary in the USECODE format specification. It records the common event names, local body coverage, known native callers and source-port behavior, class-local higher slots, and targeted open questions. It complements the per-ordinal intrinsic catalog: an event slot selects a class callback; an intrinsic ordinal selects a native function from bytecode.
Reading the Evidence
- Body count is the number of non-empty, derived class/slot body windows in the named local corpus. It is not a count of runtime executions, reachable objects, or call sites.
- Zero bodies means the scanned corpus has no non-empty body at that slot. It does not mean the executable cannot dispatch that slot.
- Source label means a converter/disassembler name. It is a navigation hint, not proof of one universal behavior.
- Native route means a direct caller of
Usecode_ItemCallEventwas identified in the live RemorseCRUSADER.EXEGhidra session. This is direct evidence for Remorse only; Regret's per-slot values below are corpus evidence, not a separate native-binary audit. - Class-local means the same numeric slot can do different work in different classes. This is especially important above
0x1F. - Body byte ranges are inclusive sizes from
derived_body_lengthin the extracted event index. They are useful for prioritization, not semantic evidence.
Dispatch Model
The event ordinal is resolved in the selected class's event table. Bytecode class/event calls (0x11) and spawned class/event processes (0x57, 0x58) carry a class id and slot; they do not call a globally named event function. A body can therefore be reached by a script even when there is no engine-native wrapper with that name.
In the Remorse executable, Usecode_ItemCallEvent (1420:0e3a) checks a per-class event capability mask and passes the class id and UC_* event ordinal into the runtime context-creation path. The common native wrappers use bit masks corresponding to the low event ordinals (1 << slot). For example, the verified masks for equip, unequip, combine, cast, and unhatch are 0x0400, 0x0800, 0x1000, 0x20000, and 0x200000. The dispatcher is shared machinery; an event-specific native caller and a non-empty class body are separate facts.
The local extractor derives body windows from owner-loaded class records; its event-count/base-offset disagreement with ScummVM and Pentagram remains open. See the format specification and round-trip IR notes.
Corpus Coverage
| Variant | Non-empty bodies | Common slots with bodies | Higher populated slots | Highest observed body slot |
|---|---|---|---|---|
| Remorse | 977 | 15 of 32 | Every slot 0x20..0x4B (44 slots) |
0x4B |
| Regret | 1,152 | 14 of 32 | Every slot 0x20..0x51 (50 slots) |
0x51 |
The common-slot counts below come from the extracted class_event_index.tsv files under USECODE/EUSECODE_extracted/ and USECODE/REGRET/REGRET_USECODE_extracted/. The higher-slot table adds per-slot body counts and byte-length ranges. Every common slot 0x00..0x1F is listed, including zero-body slots; higher rows cover every slot with at least one body in either main corpus.
Common Slots 0x00..0x1F
The labels in the second column follow ScummVM's Crusader converter table where available. Pentagram's older Crusader converter retains func* placeholders for some names that can be corroborated by the native binary. Source-level argument lists are not assumed to be the exact USECODE body ABI.
| Slot | Converter label / variant note | Remorse / Regret bodies | Evidence, current interpretation, and next investigation |
|---|---|---|---|
0x00 |
look() |
1 / 0 | Remorse has one body; Regret has none. The native Item_Look route and ScummVM item-selection path identify this as inspection/looking. Inspect the sole body and its selected-item context; do not infer that all look interactions are script-backed. |
0x01 |
use() |
66 / 80 | Main item-use/activation callback. Native Item_Use has two dispatcher call sites; ScummVM also invokes it from item selection and actor-use paths. This is the best-covered public interaction slot, but class behavior is intentionally heterogeneous. Trace selected examples from input through class selection and note any caller-supplied state. |
0x02 |
anim() |
0 / 0 | Native DList_AnimateShapes calls Item_Anim for animation type 5; that branch invokes the event and performs no separate frame step. Both corpora lack bodies, so no script animation behavior is available there. ScummVM shares this path; Pentagram disables non-use Crusader callbacks. Find type-5 authored objects and check omitted builds. |
0x03 |
setActivity() |
0 / 0 | Native NPC_SetActivity offers UC_SetActivity before NPC_StartNextNPCActivityBehaviorProcess; if dispatch is not handled, ordinary NPC activity behavior is started. The original Crusader route is real despite zero bodies. The name is inherited from the U8 event table, but no U8 event-0x03 producer was found in the inspected source ports. Recover its argument layout and check the original U8 caller before claiming runtime inheritance. |
0x04 |
cachein() |
22 / 35 | Native Item_Cachein dispatches only when a current map array exists. ScummVM's map-load path calls cache-in on items and actors. Best current meaning is map/cache-in initialization. Determine exact ordering relative to item registration and whether nested loads can re-enter it. |
0x05 |
hit(uword, word) |
13 / 12 | Outgoing hit/attack callback. Collision handling calls hit on the mover/attacker with the other item id and hit-force value; Item_Hit is the native wrapper. Compare this with slot 0x06 to settle directionality and the hit-force calculation for each collision path. |
0x06 |
gotHit(uword, word) |
197 / 248 | Incoming damage/collision reaction; it is the most widespread common handler. Item_GetDamaged is the native route, and ScummVM also calls it from collision and damage code. Separate collision notification from actual health damage; inspect callers that pass zero or packed damage-type values. |
0x07 |
hatch() |
28 / 26 | Egg/spawn appearance callback. ScummVM's Egg::hatch is one-shot and returns the callback process id; native Item_CallHatchEvent is a direct route. Identify which class families are hatchable eggs versus other spawn initialization and record whether the event is synchronous or process-backed. |
0x08 |
schedule() |
0 / 0 | Native NPC_Schedule checks liveness, may clear combat state outside the fast area, and dispatches UC_Schedule with a 32-bit time value (mask 0x0100). The converter label omits that payload. With no body, the wrapper returns no usecode process. Resolve time units and determine whether other builds contain schedule scripts. |
0x09 |
release() |
9 / 10 | Native Item_Release dispatches with no explicit event payload. ScummVM also calls release during movement/collision cleanup. The broad read is release/removal cleanup; trace all retail call sites to distinguish uncache, collision exit, and ownership transitions. |
0x0A |
equip(); Pentagram Crusader table says func0A(sint16) |
77 / 125 | Native Item_Equip dispatch is verified with mask 0x0400. In Crusader it is generalized into mode application, arming, setup, and actor initialization, not just wearable equipment. See the equipment-system analysis. Next, classify parameterized versus no-parameter call sites and avoid translating every use as literal equipment. |
0x0B |
unequip(); Pentagram Crusader table says func0B(sint16) |
50 / 47 | Native Item_Unequip dispatch is verified with mask 0x0800; scripts commonly disable, disarm, or reverse slot-0x0A behavior. See the equipment-system analysis. Compare matching class pairs and determine which native callers pass a related object id or mode. |
0x0C |
combine() |
0 / 0 | Native Item_Combine dispatch exists, but neither corpus has a slot body or direct .combine() class-event call. Remorse intrinsic 0x00CF (Item::I_setQAndCombine) is used twice in MISS1EGG::cachein: it writes item quality, then attempts this event. The callback process id is discarded, so the event cannot gate that write. This is a notification hook, not the merge algorithm. See the combine/cast/fast-area analysis. |
0x0D |
func0D |
0 / 0 | No semantics or direct native dispatcher caller have been established. Preserve the raw slot. Search alternate corpora and native callsites, then inspect any class row before assigning a name. |
0x0E |
calledFromAnim() |
27 / 43 | ScummVM's animation tracker invokes this callback; it is an animation-originated event lane, not the same thing as anim (0x02). Determine the animation condition and payload at the original native call site and compare representative class bodies. |
0x0F |
enterFastArea() |
108 / 107 | Native item movement enters this path when crossing into a fast area. Corpus evidence points to authored proximity/activation regions for spawners, timers, and controllers, not a movement-speed modifier. See the fast-area analysis. Future work: establish exact boundary/flag behavior and per-class state transitions. |
0x10 |
leaveFastArea() |
52 / 52 | Exit counterpart to enterFastArea; used by timers and controller classes to disarm or advance phase logic. It can be bypassed for camera-followed items, so do not assume every geometric exit fires the callback. Compare enter/leave pairs class by class. |
0x11 |
cast(uword); Pentagram Crusader table says func11(sint16) |
1 / 8 | Native Item_Cast dispatch is verified with mask 0x20000. Crusader usecode uses this for scripted activation/dispatch, not a general spell system: Remorse's sole body is an avatar map/music hook; Regret has controller/keypad examples. See the combine/cast/fast-area analysis. Resolve the apparent argument-width/name difference against real callers. |
0x12 |
justMoved() |
0 / 0 | Native Item_JustMoved dispatch exists. ScummVM calls it after an item is moved in the world or moved into a container. No local body is present, so the known paths have no authored callback in these corpora. Check whether this is a retained compatibility hook or used in omitted builds. |
0x13 |
avatarStoleSomething(uword) |
23 / 18 | In Crusader, a moved-item notification used mainly by environmental classes: handlers tag process metadata with 0x022E and the item id; MDOOR starts door-piece cleanup and SLIDEFLR synchronizes animation/audio. The native wrapper skips dead NPC receivers before dispatch. See the detailed analysis. |
0x14 |
animGetHit() |
0 / 0 | Native Item_AnimGetHit exists and accepts a word-sized native parameter, while the converter label shows no argument. Distinct from the general incoming-hit slot 0x06; neither corpus has a body. Recover callers and determine whether the word identifies a hit animation, attacker, or mode. |
0x15 |
Crusader unhatch(word); U8 guardianBark(word); Pentagram Crusader table says func15 |
5 / 6 | Native Item_CallUnhatchEvent dispatch exists; ScummVM invokes it from Crusader egg unhatching. The local name unhatch is supported for Crusader, but the converter's word argument conflicts with the wrapper path that exposes no explicit event argument. Keep the U8 guardianBark label separate and recover the exact payload before documenting a signature. |
0x16 |
func16 |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x17 |
func17 |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x18 |
func18 |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x19 |
func19 |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1A |
func1A |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1B |
func1B |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1C |
func1C |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1D |
func1D |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1E |
func1E |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
0x1F |
func1F |
0 / 0 | Unknown placeholder. No direct native dispatcher caller identified in the Remorse caller scan. Search the complete class tables and alternate builds; retain the numeric id unless a body or call path supplies evidence. |
Native Event Routes Confirmed in Remorse
The live Ghidra caller scan found direct Usecode_ItemCallEvent callers for every named common event except 0x0D and 0x16..0x1F. These are the direct dispatcher callsite addresses, not necessarily the containing function entry addresses:
| Slot | Native caller | Dispatcher callsite(s) |
|---|---|---|
0x00 |
Item_Look |
10a0:25bb |
0x01 |
Item_Use |
10a0:26d9, 10a0:26ff |
0x02 |
Item_Anim |
10a0:28f9 |
0x03 |
NPC_SetActivity |
10e8:2bbc |
0x04 |
Item_Cachein |
10a0:2abd |
0x05 |
Item_Hit |
10a0:274a |
0x06 |
Item_GetDamaged |
10a0:287f |
0x07 |
Item_CallHatchEvent |
1090:0647 |
0x08 |
NPC_Schedule |
10e8:30e7 |
0x09 |
Item_Release |
10a0:2a20 |
0x0A |
Item_Equip |
10a0:2a53 |
0x0B |
Item_Unequip |
10a0:2a86 |
0x0C |
Item_Combine |
10a0:2aec |
0x0E |
Item_CalledFromAnim |
10a0:2b1b |
0x0F |
Item_EnterFastArea |
10a0:2d96 |
0x10 |
Item_LeaveFastArea |
10a0:2f29 |
0x11 |
Item_Cast |
10a0:2f5c |
0x12 |
Item_JustMoved |
10a0:2f8b |
0x13 |
Item_AvatarStoleSomething |
10a0:302d |
0x14 |
Item_AnimGetHit |
10a0:2fbe |
0x15 |
Item_CallUnhatchEvent |
1090:0676 |
Absence from this direct caller scan is not proof of impossibility: scripts can dispatch class/slot pairs through bytecode, and generic VM paths may not have event-specific native wrapper names. The native caller scan was performed against Remorse only.
Higher Class-Local Slots
No common event-name table provides stable semantics for these ordinals. The examples below are deliberately local to the named class; they do not name the slot globally. For rows without a specific example, the next step is to enumerate owning classes, trace bytecode call/spawn edges, then compare representative bodies within and across variants.
| Slot | Remorse bodies (byte range) | Regret bodies (byte range) | Known class-local evidence / next investigation |
|---|---|---|---|
0x20 |
67 (44-9919) | 70 (19-8200) | TRIGGER.slot_20 is a widely reused controller fan-out entry; TIMER, SPECIAL, and other classes also use high slots as workers. TRIGGER.slot_20 still has unresolved branches. Do not equate every slot-0x20 body. |
0x21 |
38 (49-9901) | 35 (11-4943) | SPECIAL.slot_21 is a phase/delay worker; environmental families also use it. Compare owner class and caller arguments before describing other bodies. |
0x22 |
18 (49-2581) | 18 (17-1134) | SURCAMNS / SURCAMEW slot 0x22 bodies are a repeated callback-family near-template. Compare exact bodies and x/y variants; do not promote the template label to a shared event meaning. |
0x23 |
14 (45-8823) | 15 (26-12307) | DOOR.slot_23 is used in a destroyable-door helper path; TRIGGER.slot_23 also has class-local phase cases. Separate same-ordinal bodies by class and callsite. |
0x24 |
12 (61-1626) | 12 (14-1136) | TRIGGER.slot_24 appears in the movable-wall trigger family; its case-2 branch is currently a match scan. Inspect other owners independently. |
0x25 |
11 (55-1439) | 10 (15-995) | Class-local only in current evidence. Enumerate owners and caller tuples; preserve raw ids. |
0x26 |
9 (106-1743) | 8 (34-1141) | TRIGGER.slot_26 has a documented match-scan branch. Other class bodies remain unclassified. |
0x27 |
8 (223-1560) | 7 (193-1088) | Class-local only in current evidence. Compare body families and caller arguments before assigning a name. |
0x28 |
8 (44-4328) | 7 (12-947) | Class-local only in current evidence. The broad body-size spread makes a single shared interpretation especially unsafe. |
0x29 |
8 (83-1716) | 7 (23-1199) | TRIGGER.slot_29 participates in actor-key updates, including writes to mutable actor field 0x63. Trace each subcommand and its matched-actor filters. |
0x2A |
8 (96-1425) | 7 (49-997) | Class-local only in current evidence. Enumerate owners and distinguish direct calls from spawned worker processes. |
0x2B |
8 (73-1785) | 7 (46-1292) | TRIGGER.slot_2B also participates in actor-key updates. Compare against slot 0x29 and identify exactly which branch mutates field 0x63. |
0x2C |
5 (79-278) | 6 (112-875) | Class-local only in current evidence; inspect the small owner set and caller payloads. |
0x2D |
5 (264-764) | 6 (217-537) | ITEM.slot_2D checks nearby shape 0x04D0 objects and compares QLo; MONSTER also uses a high-slot worker. These are separate class semantics. |
0x2E |
5 (106-392) | 6 (30-302) | Class-local only in current evidence; inspect owners and call chains. |
0x2F |
3 (285-314) | 6 (168-818) | Class-local only in current evidence; inspect owners and call chains. |
0x30 |
3 (142-553) | 6 (53-303) | Class-local only in current evidence; inspect owners and call chains. |
0x31 |
3 (398-1048) | 4 (205-508) | Class-local only in current evidence; inspect owners and call chains. |
0x32 |
3 (181-767) | 4 (31-421) | Class-local only in current evidence; inspect owners and call chains. |
0x33 |
3 (49-1097) | 4 (98-424) | Class-local only in current evidence; inspect owners and call chains. |
0x34 |
3 (136-588) | 4 (29-325) | Class-local only in current evidence; inspect owners and call chains. |
0x35 |
3 (97-741) | 4 (32-328) | Class-local only in current evidence; inspect owners and call chains. |
0x36 |
3 (91-703) | 4 (150-386) | Class-local only in current evidence; inspect owners and call chains. |
0x37 |
3 (89-731) | 4 (174-389) | Class-local only in current evidence; inspect owners and call chains. |
0x38 |
3 (78-728) | 4 (168-397) | Class-local only in current evidence; inspect owners and call chains. |
0x39 |
3 (106-728) | 4 (144-397) | Class-local only in current evidence; inspect owners and call chains. |
0x3A |
3 (96-804) | 4 (215-443) | Class-local only in current evidence; inspect owners and call chains. |
0x3B |
3 (221-1087) | 4 (75-449) | Class-local only in current evidence; inspect owners and call chains. |
0x3C |
3 (426-695) | 4 (14-389) | Class-local only in current evidence; inspect owners and call chains. |
0x3D |
3 (67-333) | 4 (93-267) | Class-local only in current evidence; inspect owners and call chains. |
0x3E |
3 (77-2359) | 4 (36-2204) | Class-local only in current evidence; inspect owners and call chains. |
0x3F |
3 (61-2379) | 4 (36-2070) | Class-local only in current evidence; inspect owners and call chains. |
0x40 |
3 (174-430) | 4 (33-340) | Class-local only in current evidence; inspect owners and call chains. |
0x41 |
3 (89-386) | 4 (35-542) | Class-local only in current evidence; inspect owners and call chains. |
0x42 |
2 (231-386) | 4 (47-553) | Class-local only in current evidence; inspect owners and call chains. |
0x43 |
2 (87-244) | 4 (35-275) | Class-local only in current evidence; inspect owners and call chains. |
0x44 |
2 (109-231) | 4 (190-814) | Class-local only in current evidence; inspect owners and call chains. |
0x45 |
2 (301-1557) | 3 (205-1025) | Class-local only in current evidence; inspect owners and call chains. |
0x46 |
2 (280-1553) | 3 (31-1015) | Class-local only in current evidence; inspect owners and call chains. |
0x47 |
2 (301-426) | 3 (55-474) | Class-local only in current evidence; inspect owners and call chains. |
0x48 |
2 (280-534) | 2 (27-178) | Class-local only in current evidence; inspect owners and call chains. |
0x49 |
1 (1953-1953) | 2 (158-164) | Only one Remorse body and two short Regret bodies. Identify owners before comparing; a long Remorse body is not evidence of shared meaning. |
0x4A |
1 (1553-1553) | 2 (49-274) | Only one Remorse body and two Regret bodies. Inspect the single-owner scripts and whether they are called from another high-slot worker. |
0x4B |
1 (426-426) | 1 (450-450) | One body in each corpus; no shared semantic label. Compare exact class identity and callsites. |
0x4C |
0 | 1 (274-274) | Regret-only body in the scanned corpora. Determine whether this is title-specific logic or a build/content difference. |
0x4D |
0 | 1 (450-450) | Regret-only body in the scanned corpora. Determine whether this is title-specific logic or a build/content difference. |
0x4E |
0 | 1 (296-296) | Regret-only body in the scanned corpora. Determine whether this is title-specific logic or a build/content difference. |
0x4F |
0 | 1 (300-300) | Regret-only body in the scanned corpora. Determine whether this is title-specific logic or a build/content difference. |
0x50 |
0 | 1 (313-313) | Regret-only body in the scanned corpora. Determine whether this is title-specific logic or a build/content difference. |
0x51 |
0 | 1 (300-300) | Highest observed non-empty slot in Regret. Determine whether this is title-specific logic or a build/content difference. |
The higher-slot examples above are backed by the generated pseudocode and event indexes, not by globally meaningful event names. Useful starting points include map-viewer trigger links, the movable-wall investigation, the map spawner investigation, and the FLICTEST investigation. TRIGGER.slot_20, for example, is a class-specific worker reached by scripts; it is not a universal VM event callback.
Investigation Queue
- Audit the omitted demo, Japanese, and 1.01 archives for zero-body common slots, especially
0x02,0x03,0x08,0x0C,0x12, and0x14. - Recover original native callers and parameter layouts for
setActivity,schedule,animGetHit, andunhatch; keep converter prototypes separate from observed stack arguments. - Search the Remorse binary and available Regret builds for direct native routes to
0x0Dand0x16..0x1F; lack of a current xref is not proof that generic bytecode dispatch rejects them. - Run the same native event-wrapper/caller audit against a live Regret executable. Current Ghidra caller evidence in this catalog is Remorse-only.
- Generate a class-owner and bytecode call/spawn index for every high slot. Prioritize
0x20..0x2B, where existing notes already show controller, timer, camera, door, and actor-key families. - For each high slot with only one or two bodies, inspect the complete body and its callers before deciding whether the slot is private helper code, a title-specific callback, or dead content.
- Resolve the event-table count/base-offset conflict independently of event semantics; preserve raw rows and offsets while it remains open.
Source and Related Notes
- Central format specification
- Detailed intrinsic catalog
- Equipment events
- Combine, cast, and fast-area events
- ScummVM Crusader converter event labels
- ScummVM item event dispatch and callers
- ScummVM egg callbacks
- ScummVM scheduler callback
- Pentagram comparison sources:
misc/pentagram/convert/crusader/ConvertUsecodeCrusader.h,misc/pentagram/convert/u8/ConvertUsecodeU8.h, andmisc/pentagram/world/Item.cpp. Pentagram'sItem::callUsecodeEventexplicitly suppresses Crusader event execution except foruse; treat that as a port limitation, not as original executable evidence.