[gui] The K1 combat HUD text scale is absolute, not compounded - #339
Merged
modawan merged 1 commit intoAug 28, 2026
Merged
Conversation
The combat sequence HUD's text grows with every level load, doubling each
time, until it wraps and clips.
onGUILoaded scales by reading the control's own scale back:
control->setScale(control->scale() * kK1CombatTextScale);
That is a read-modify-write on state this wrapper does not own. The HUD
wrapper is reconstructed on loadgame, reset and new-session, but the control
tree it binds lives in the GUI cache and survives, so each reconstruction
multiplies the previous result again. An ordinary warp preserves the wrapper
and shows nothing, which is why it presents as a level-load bug rather than a
HUD one.
Derive it from the live layout and text inputs instead, so applying it to an
already-scaled tree is idempotent. The wrapper and the tree have different
lifetimes; the operation should not care which one it is looking at.
Measured over three loadgame cycles, glyph region: 1203 px at 314x14, then
22770 px and clipped by the third. After: 1203 px at 314x14 on loads one, two
and three, with the first and third regions pixel-identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
The K1 combat sequence HUD's text grows with every level load, doubling each
time, until it wraps and clips.
Cause
HUD::onGUILoadedscales by reading the control's own scale back:That is a read-modify-write on state the wrapper does not own. The HUD wrapper
is reconstructed on loadgame, reset and new-session, but the control tree it
binds lives in the GUI cache and survives — so each reconstruction multiplies
the previous result again.
An ordinary
warppreserves the wrapper and shows nothing, which is why thispresents as a level-load bug rather than a HUD one, and why it is easy to miss
when testing by warping.
Fix
Derive the value from the live layout and text inputs, so applying it to an
already-scaled tree is idempotent. The wrapper and the control tree have
different lifetimes; the operation should not care which one it is looking at.
Measurement
Three
loadgamecycles, glyph region of the combat text:After the fix the first and third regions are pixel-identical.
Note on verification
The measurements above were taken on a downstream branch that carries this file
unchanged from
master— the block is byte-identical here, and the patchapplies to
masteras-is. I have not builtmasteritself, so a CI run isworth having before merge.