Files
khallaandClaude Opus 5.5 037fc73158 Character panel: minus buttons take back attribute and skill points
- respec: the panel's unused second button array becomes − buttons between
  name and value; attributes give back invested points, skills give back
  skill points, a level-1 skill is removed and can be chosen anew; all
  through the game's own point functions (protected copy stays in sync)
- the − is the + icon with its vertical arm covered (no minus image exists)
- hud: RenderCentred / HandleCentred for mods hooking centred windows;
  mouse event helpers shared in game/ui/events.h

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 01:44:20 +02:00

55 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Taking back attribute and skill points (mods/respec.cpp)
Request of 2026-10-16: a − button on each row of the character panel
(inventory, Attribute / Fertigkeiten) gives back one invested point. A skill
at level 1 is removed and a new one can be chosen in its place.
## Data (cCreatureArts, hero +0x3a8, measured 2026-10-16)
| Offset | What |
|---|---|
| +0x1c[6] | attribute points invested, in panel order (Stärke, Widerstand, Geschick, Physische Reg., Mentale Reg., Charisma); the shown values add class and level growth |
| +0x23 | free attribute points (index 7 of the same array) |
| +0x24[8] | skill id per row (0: empty) |
| +0x2c[8] | bought skill level per row (a chosen skill starts at 1) |
| +0x34[8] | skill levels from items |
| +0x42 | free skill points |
| +0x44 | new skills still to choose |
| +0x56 | highest skill level allowed |
Game functions (all on cCreatureArts):
- `0x5a03a0 (index, delta)` adds to an attribute byte; the + does (row, 1)
then (7, −1), then `0x579560 (0, 1)` recalculates the hero (0x580d50).
- `0x582360 (row, delta, spend)` adds skill levels; with `spend` it takes them
from the free skill points (a negative delta gives them back).
- `0x580fe0 (skill)` puts a chosen skill into the first empty row at level 1
and uses up one choice; `0x580f30` lists the skills still choosable.
Each of them also writes the hero's +0x3b0.. block, xor-ed, into a protected
page (0x182cddc / 0x182cde0). Changing the fields directly without that made
the hero's life show 0. The mod therefore only changes fields through these
functions; after removing a skill it calls `0x582360 (row, 0, 1)` to refresh
the copy.
## Panel (cUI_StatisticsChar, vtable 0x8942d8)
- +0x164 bit 0x10: attributes shown (else skills); +0xf84: choosing a new
skill.
- +0x2cc: the 8 + buttons (cUI_Button, 0xbc bytes each, laid out by 0x6ac120:
x 232, rows 19 px apart from y 72, 16×16).
- +0x8ac: a second array of 8 buttons that the game constructs and destroys
but never lays out or uses. These are the − buttons now.
- The panel renders while hidden (inventory closed); the − buttons check its
visible flag.
cUI_Button images (render 0x72af90): normal at +0x64 (u0, u1, v0, v1) with
texture +0x84, pressed at +0x54 / +0x80. Image descriptors are static, 0x54
bytes each (texture +0x28, pixel rect +0x2c..+0x38, converted to UVs at
start-up). The + uses 0x9ed2d0 (pressed 0x9ed324) in UI atlas 0x26a. The
names UI_BUTT_MINUS_UP/DW are registered, but neither UI atlas (0x26a, 0x289;
both drawn whole once and looked at) has a minus image. The − is therefore
the + with the vertical arm of its cross covered by two grey patches,
measured from a screenshot: arm x 6.5..8.8, y 4.0..6.9 and 9.0..11.5 in icon
pixels.