Files
sacred_k/docs/escape.md
T
khallaandClaude Opus 5.5 6ca96d54b4 Shared chest tabs, rune stacks and rune master, Q pickup, Kettenblitz tooltip and range
- Shared chest: tabs "Truhe"/"Gemeinsam" as a column left of the grid
  (game tab sheet), grids placed every tick, persistent across heroes
- Inventory tab texts capitalized (RegisterText / CapitalizeText)
- Combat-art runes stack like potions (itemstack, renamed from potionstack)
- Rune master: any rune for any number of runes, price by rune count
  (4 runes = 1,000, x10 per missing rune), bought rune goes into the
  backpack, Buy disabled without runes, gold or room, last rune remembered
  per hero (saved), the chosen rune's name below its icon, dropping a
  stack gives up one rune
- Keys: the old key handling no longer takes over after the save screen
  (text field focus only counts while its dialog is shown)
- Esc crash: tooltips forgotten when the game destroys them
- Pick up (Q) sends the pickup order directly; search reach doubled
- Kettenblitz: tooltip shows hits per chain, chains, cast and jump range;
  cast range 900 (longer ray segments), jumps half of that

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 03:40:42 +02:00

47 lines
2.4 KiB
Markdown

# Esc closes windows first (`src/mods/escape.cpp`)
Asked 2026-10-15: with a dialog open, Esc should close it instead of opening
the game menu.
## The game (`cUI_Manager::HandleEsc` 0x756ba0, measured 2026-10-15)
On an Esc key event the UI manager (`0x757544`) calls HandleEsc. It knows its
windows by slot (cUI_Manager dwords): 0x20 taskbar, 0x21 inventory, 0x22
equipment, 0x23 blacksmith, 0x24 merchant, 0x25 megamap, 0x26 overview map,
0x27 mercenary (party panel), 0x28 stats, 0x29 console, 0x2a diary (quest
book), 0x2b savegame, 0x2c ESC menu, 0x2d purchase, 0x2e master, 0x2f options,
0x30 chest, 0x31 horse, 0x32 network info, 0x33 net portrait, 0x34
character, 0x35 cube. It closes the ESC menu, the megamap, the quest book, or
(with 0x21/0x23/0x24/0x2e/0x30 open) the inventory; hides 0x2b / 0x2f;
otherwise opens the ESC menu. With a trader open only the inventory closed,
and the trader opened it again.
Closing a window: a cEventUI2 (vtable 0x88edd0, 0x80 bytes: +4 code 0x12,
+8 subtype 5 = hide, names via 0x5904e0: sender at +0x28, window at +0x48 as
measured in the commands the game sends when a window is closed by its
button or hotkey; a string at +0x68, 0x423920 / 0x416660) sent to the UI
manager's event handler (vf00, 0x757120), which routes it by name. Sent to
the window's own vf10 it was not understood (first version).
## The mod
HandleEsc is hooked: unless the ESC menu is open, every visible window of a
table (slot, name) gets that hide command, and Esc does nothing else. If none
is open, the game handles Esc as before.
Quest dialogs are tooltips (docs/hud.md) that block all input until answered.
A click on one of their entries (cUI_Tooltip::HandleEvent 0x6e71e2) hides the
tooltip (0x731ee0, flag 1), calls cDialogManager::Answer (0x49a090 on
0xaaaf00, (owner = tooltip +0x21cc, answer)) and clears 0xab5314. Answer sends
every player hero a cEvent_creature 0x10c (ends the input lock) and passes
answers below 100000 to the quest script (0x46bd80). Esc does the same with
answer 0xffffffff: the dialog closes, nothing is chosen. (Hiding the tooltip
alone left the input lock; measured with a write watch on its flags.)
## Crash fix (2026-10-17)
Esc crashed in `CloseDialog` on a tooltip pointer whose object had been
destroyed (its vtable was already the base class's; the hide call jumped to
garbage). The HUD layer's tooltip list (`g_tooltips`, hud.cpp) kept destroyed
tooltips; `cUI_Tooltip::~cUI_Tooltip` (`0x6e6560`) is hooked now and drops them.