Files
sacred_k/docs/teleport-potion.md
T
khallaandClaude Opus 5.5 838b1aa491 Options: tabs Allgemein / Beute / Tastenbelegung with key bindings
- Options window in three tabs; the auto-pickup settings move to Beute;
  sliders move with their page; black sides like the save game screen.
- Tastenbelegung: every binding settable (click, press key; Esc cancels,
  Backspace unbinds), "Alle zurücksetzen" as a game button, saved on OK.
- Potions bindable (default unbound), named by the game's potion texts; the
  game's own potion hotkeys are off; bar tooltips show the bound key.
- Map (M), overview map (Tab, held) and labels (Alt, held) bindable; the
  game's own M / Tab / Alt handling is switched off.
- Save game key calls the game's save window code instead of a posted key.
- Teleportationstrank: fixed text replacement from startup (also the
  Ausdauertrank items, potion kind 5 as well).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 00:38:34 +02:00

35 lines
1.8 KiB
Markdown

# Teleportationstrank
Request (2026-10-17): the yellow potion becomes "Teleportationstrank";
drinking it opens the window of known portals and the hero can teleport to
one of them.
## Measured
- The yellow potions come in stages (small / medium / large; seen types
0x1434 and 0x141a), all potion kind 5 (logged in
cCreature::UseItem 0x54a8f0).
- Touching a teleporter logs `cInterpretSQW::Teleporter(hex=N)` (0x4ae330):
it sets bit N in the hero's known portals (hero +0x578) and posts a UI event
(constructor 0x553080) of type 0x39 to `DEFAULT_BUSYDLG` with +8 = 2,
+0xc = 5 (mode: portals; 6 for underworld portals above 0xd) and +0x10 = the
mask. cUI_BusyDlg::HandleEvent (0x720c10) calls SetMode (0x720180).
- Choosing a portal: the engine's portal case (0x619671, log `EE_USEPORTAL`)
teleports the hero with cCreature::Teleport (0x54d840), returning to 0x6197c8.
## Mod (src/mods/teleportpotion.cpp)
- Every item type of potion kind 5 counts. Their name, "Trank der
Konzentration", is replaced in every game text from the DLL's start
(`game::ReplaceInTexts`, applied where the game fetches a text): the item
names (stage words in front stay) and the bottom bar's quick-select tooltip
("Trank der Konzentration [R]", its own text id). Before (until
2026-10-19) the names were collected from the item types at game start, so
the main menu (options' key bindings) still had the old name.
- cCreature::UseItem (hooked in itemstack.cpp) asks `teleportpotion::UseItem`
first: for the hero's Teleportationstrank it posts the teleporter's event
with the hero's mask instead of the drink.
- The potion is used up (flag, RemoveItem, DestroyObject as UseItem does; a
stack loses one) only when cCreature::Teleport is called from the portal
case while it is pending; closing the window keeps it.