Add extensive tests for animation, input handling, and map rendering
- Enhanced animation archive tests to validate frame metadata and start frame selection logic. - Introduced new tests for entity dispatch entry handling, including key event queuing and processing. - Added tests for fixed map item interactions, including glob egg hatching and item movement. - Expanded flex archive tests to cover teleport egg spawning and usecode event selection. - Implemented isometric controls tests to verify directional key handling and animation state changes. - Improved map renderer tests to ensure correct rendering of map previews and collision detection.
This commit is contained in:
parent
2e16b2d524
commit
e757bb33d0
20 changed files with 1247 additions and 142 deletions
|
|
@ -16,6 +16,25 @@ The exported files are evidence, not directly compilable game source. Keep them
|
|||
- At each milestone, count original functions translated and exercised in the Windows build, platform calls replaced, and parity checks passed. A rendered scene or a controllable stand-in actor alone does not pass a game-code milestone.
|
||||
- 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-controlled sprite over a frozen map does **not** count. 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.
|
||||
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.
|
||||
|
||||
Progress: the map-1 fixed-map test identifies one family-8/frame-1 item with low quality byte `0x1e` (the teleporter's item-search predicate); startup centers on that egg instead of the map-bounds midpoint. The live item owner reserves avatar item `1` with defaults from `NPC_Init` (`10e8:000c`) and applies the coordinate/map write from `NPC_Teleport` (`10e8:29f2`). Win32 directional events now pass through the kernel keyboard queue to a registered controller entry; an owned `AnimPrimitiveProcess` advances the avatar item on 40 Hz host ticks. A cached map renderer redraws snapshots of mutable map items in source sorter order on a worker thread, while the avatar pose is still drawn in a separate screen overlay. Fast-area GLOB eggs now hatch into numbered live children using the `1098:039c` placement/status rules; the renderer replaces a hatched egg's preview expansion with those items. The interpreter's initial stack and 31-entry code-address stack are compiled and tested against exported `1418:00e8/0244/0000`; opcode execution is not implemented. These are partial translations of steps 1-4, **not completed steps**: `Game_Start` (`1020:0000`), teleporter scheduling, complete item cache, controller actions beyond directional movement, original camera/draw-list integration, and USECODE execution remain open. Collision is approximate; no visible scripted world mutation or deterministic end-to-end interaction acceptance exists. Steps 5-6 remain open.
|
||||
|
||||
Retail map-1 probing at the starting egg found four children after fast-area GLOB hatching and no eligible `use` script on those children; no direct fixed-map item within 1,024 staged units has an eligible event body. The nearest direct `use` items are panel/card objects roughly 8,800 staged units away. Their event bodies delegate to `TRIGGER.slot_20` or `SWITCH.slot_21`, which require additional VM, timer, selector, and world-state services. A renderer regression confirms that moving hatched children changes live scene pixels, but this is not script execution or proof that those distant interactions are reachable through the current collision path.
|
||||
|
||||
Control-path evidence for step 3: live `CRUSADER.EXE` disassembly at `1130:224b-226a` compares event selectors against the five words at `1130:273b` (`1, 2, 4, 0x10, 0x100`); the matching CS jump-table words at `1130:274f` target `226e, 2276, 22b6, 22bd, 22b6`. The gameplay-key case at `1130:22bd` copies all 12 bytes of the incoming key event. The exported `Controller_HandleKeyEvent` pseudo-C contains an invalid branch after this table and must not be compiled verbatim. The 32-slot, 12-byte pending-key ring (`11d0:3533/3ad4/3a74/3aad`) and a registered-subscriber dispatch (`11d0:3c4d`) are ported in `ProcessKernel`; tests cover order, full/overflow, wrap, and delivery to a controller entry rather than the excluded keyboard process. The 0x40-byte controller entry mirrors the keyboard registration and daemon/update flags of `ControllerProcess_CreateProcess` (`1130:00e3`), **but the window does not create it or feed its queue**. `Controller_PickNextAnimByKeyevent` (`1130:12d6`) reads two keyboard state arrays through `Keyboard_GetKeyState` (`11d0:39b9`, DS offsets `3652` and `3352`) and selects animation through NPC state and services. `Kernel_11d0_39fb` installs the DOS interrupt-9 keyboard path through `FUN_1218_059b`; exported C exposes the arrays' reads/resets but not their hardware writer. Recover the key-state update semantics from the interrupt path and port the controller's reachable movement branches before replacing host polling; do not guess their edge/held meaning.
|
||||
|
||||
Animation dependency for step 3: live disassembly at `1130:1eda-1ef0` supplies `NPC_DoAnim` (`10e8:0252`) with the controlled NPC item pointer, animation number, direction, and two zero arguments that the exported controller pseudo-C omits. The unarmed walk/run cases allocate `AnimPrimitiveProcess` (`1150:0000`, size `0x5b`); live disassembly at `1150:0033-009c` confirms its normal vtable offset `0x2a57`, event type `0xf0`, and linear-capable setup. A kernel-owned constructor with this layout, item/type registration, direction, and clip metadata now has a byte-level test. `AnimPrimitive_SetStartFrame` (`1150:17b2`) is ported and tested for two-step/looping and controlled-avatar frame-skip branches. Its tick (`1150:1906`) still needs NPC animation-frame state, fast-area/collision behavior, item updates, transitions, and teardown. The Windows host frame counter is not this process. Finish the tick and collision result before swapping the default control path.
|
||||
|
||||
## 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.
|
||||
|
|
@ -348,6 +367,8 @@ Next source-port checks, in call-chain order:
|
|||
|
||||
`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.
|
||||
|
||||
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.
|
||||
|
||||
From the repository root:
|
||||
|
||||
```powershell
|
||||
|
|
@ -355,7 +376,7 @@ rebuild\remorse\build_msvc.cmd Debug
|
|||
.\rebuild\remorse\out\build-nmake\remorse_game.exe 1
|
||||
```
|
||||
|
||||
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 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 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.
|
||||
The diagnostic kernel also registers a partial KeyboardProcess and KeyDaemon at startup. Text-capable Win32 key messages exercise the recovered keyboard filter/copy callback and update the key-event count on the HUD. The daemon does not receive timer events yet. The visible WASD/keypad controls still use host polling; these processes do not yet deliver player input.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue