Skip to content

Track the active character with the battle name highlight - #35

Merged
manz merged 1 commit into
fix/rolling-inventory-field-menusfrom
fix/battle-name-highlight
Sep 10, 2026
Merged

manz merged 1 commit into
fix/rolling-inventory-field-menusfrom
fix/battle-name-highlight

Conversation

@manz

@manz manz commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Stacked on #34.

The highlight is a tilemap palette flip — ~300 cycles, not a re-render — and it stopped following the active character. Two defects, both measured on a Palom / Cecil / Porom party.

Wrong source for row to character. It read the slot from CharOrderTbl and wrote one tilemap row per display index. DrawCharNames ($02:A20C) uses neither: both come from $02:A1CD, the table of battle-struct pointers it indexes by display position. A first byte of zero is the empty slot it skips, and it skips without taking a row, so names compact upward. The two tables disagree — the order table calls display 0 slot 1 while its pointer reads $2080, slot 2 — which is what lit the wrong name.

Applied before the engine was ready. It ran once from the writer shim at the sta $1822 instant and never revisited. Measured there, four of five slots report hidden; the same bytes read clear once the battle runs. The shim now invalidates a key and a per-frame refresh re-applies whenever the active character or the drawn-name set moves: a compare on an idle frame, the flip when it fires. Self-healing, so it cannot get wedged on stale state again.

Verified by forcing $1822 and reading ink colour off the framebuffer: Cecil highlights Cecil's row, Palom highlights Palom's. A natural ATB rotation could not be driven in either savestate I have — one has Cecil at agility 55 against 8, so the queue only ever holds him.

Two defects, both measured against a Palom / Cecil / Porom party.

The walk read which character a row shows out of CharOrderTbl and wrote
a tilemap row per display index. Neither holds. `DrawCharNames`
($02:A20C) takes both from `$02:A1CD`, the table of battle-struct
pointers it indexes by display position: a first byte of zero is the
empty slot it skips, and it skips without taking a row, so the names
compact upward. The order table disagrees with those pointers - it
calls display 0 slot 1 while the pointer reads $2080, slot 2 - which is
what lit the wrong name. Slot now comes from the pointer,
(base - $2000) / $40, and rows count only the names actually drawn.

It also ran from the writer shim, at the instant the engine stores
$1822. That is too early to ask what is on screen, and it never came
back to check: measured there, four of five slots report hidden, while
the same bytes read clear once the battle is running. The shim now just
invalidates a key and a per-frame refresh re-applies when the active
character or the drawn-name set moves - a compare on an idle frame,
still a ~300-cycle palette flip when it fires, never a re-render.

Verified by forcing $1822 and reading the ink colour off the
framebuffer: Cecil highlights Cecil's row, Palom highlights Palom's.
@manz
manz merged commit f9f094e into fix/rolling-inventory-field-menus Sep 10, 2026
@manz
manz deleted the fix/battle-name-highlight branch September 10, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant