WASD movement for the player

While W/A/S/D are held, the controlled creature gets a plain walk order every
engine tick toward its position plus the pressed screen direction, as the
mouse does while its button is held (every mouse event re-sends a walk to the
cursor point); releasing sends the target-less stop order of a released mouse
button. W/A/S/D key events are swallowed before the hotkeys see them; their
old actions move to G (action slot 3), V (pick up nearby) and K (save game
window) for now, configurable in [wasd].

docs/wasd.md: order format, measured mouse behaviour, hotkey map.
docs/todo.md: better pathfinder; final bindings for the moved hotkeys.
re::ConfigString for string settings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-14 09:08:53 +02:00
1 parent 52db0f79f9
commit aa7d49409c
6 files changed
+425

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
# To do
## Better pathfinder (mouse clicks and monsters)
Replace the game's pathfinding with a more reliable and efficient one, for
click-to-move and for monster AI. What we know so far:
- Walk orders are `cEvent_creature` command 4 with a ground target (+0x18/+0x1c),
sent through `cEngine::SendCreatureOrder` (`0x6170d0`), which snaps the
target to a walkable point (`0x616b70`) and hands it to
`cCreature::ReceiveOrder` (`0x52e400`, vf18, ~6400 decompiled lines).
- Far targets (~2000 world units) are rejected or followed badly.
- Still to map: the path search itself, the sector/tile collision data it
reads, and how monster AI issues its moves.
## Key bindings moved for WASD movement (temporary)
W, A and S were game hotkeys. With WASD movement (`src/mods/wasd.cpp`) their
actions moved to other keys for now; choose final bindings (and update the
in-game texts/tooltips that name the old keys):
| Key | Action | Temporary key (`[wasd]` in sacred_re.ini) |
|---|---|---|
| W | action slot 3 (`cEngine::UseActionSlot`, like Q/E/R/B/Space) | G (`ActionKeyW`) |
| A | pick up items nearby (creature event 0x113) | V (`ActionKeyA`) |
| S | save game window (`UI_WND_SAVEGAME`) | K (`ActionKeyS`) |
| D | unbound | - |
Globally bound letters (engine `0x618130`, UI manager `0x757120`): A B C E F
H I L M N O P Q R S T W, Space, ^, digits. Individual windows may use more.