Teleportationstrank: yellow potions open the portal window

- Every yellow potion (potion kind 5, all stages) is a Teleportationstrank:
  drinking it posts the teleporter's event to the busy dialog with the
  hero's known portals; the potion is used up only when the hero teleports
  from that window (closing it keeps the potion)
- Names replaced in every game text (ReplaceInTexts), so item names and the
  bottom bar's quick-select tooltip read Teleportationstrank; GameText reads
  the game's own text
- HeroIndex / HeroInventory moved to skillslots for shared use
- docs/teleport-potion.md; walking animation after loading noted in todo

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-17 04:04:21 +02:00
1 parent 6ca96d54b4
commit 46a08e97e9
13 files changed
+368 -22

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
# 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 names (text 0x428700 of each
type) are replaced in every game text (`game::ReplaceInTexts`): the item
names and the bottom bar's quick-select tooltip ("Trank der Konzentration
[R]", its own text id). The shortest name is replaced, so stage words stay.
- 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.