fix: jump-bar 'Height' right-aligned - per-STATE justification (user

gate; the DAT authors it)

The raw-property probe settles it exactly as the user reported: the
powerbar caption's mode STATES author their OWN justification (0x14
Enum=0x3 = Right on JumpMode/MeleeMode/MissileMode) while the element
default stays centered. ElementInfo.HJustify only ever read the
effective DEFAULT state, so the earlier "authored Center" conclusion
measured the wrong state.

The meter's absorbed state-label entry now carries the state's own
authored alignment (state 0x14 wins, element-level HJustify as the
fallback, ElementReader's same enum mapping), and the caption draw
aligns accordingly - 'Height' sits at the bar's right edge, retail's
placement. Live vitals labels keep their centered draw.

App suite 4,987/3 skips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-14 08:22:03 +02:00
parent adf8335675
commit 88cdfdc3c7
4 changed files with 79 additions and 22 deletions

View file

@ -538,11 +538,13 @@ public static class DatWidgetFactory
// The absorbed Type-12 caption child (gmPowerbarUI's 0x10000035)
// authors the per-mode caption on its own states — JumpMode
// 'Height', MeleeMode 'Power', MissileMode 'Accuracy' (HJustify
// Center over the full bar, matching UiMeter's centered label
// draw). Retail shows it through the meter's PassToChildren state
// cascade; the absorbed equivalent is a state-label table
// consulted by TrySetRetailState.
// 'Height', MeleeMode 'Power', MissileMode 'Accuracy'. Each mode
// STATE also authors its own justification (0x14 = 0x3 Right on
// every powerbar mode; the element default is centered —
// installed-DAT probe 2026-08-14, the user's retail gate). Retail
// shows it through the meter's PassToChildren state cascade; the
// absorbed equivalent is a state-label table consulted by
// TrySetRetailState.
foreach (ElementInfo textChild in info.Children.Where(static c => c.Type == 12))
{
foreach (var (stateId, state) in textChild.States)
@ -551,8 +553,27 @@ public static class DatWidgetFactory
|| !state.Properties.Values.TryGetValue(0x17u, out var caption)
|| caption.Kind != UiPropertyKind.StringInfo)
continue;
if (stringResolve?.Invoke(caption.StringInfoValue) is { Length: > 0 } text)
m.ConfigureStateLabel(stateId, text);
if (stringResolve?.Invoke(caption.StringInfoValue) is not { Length: > 0 } text)
continue;
// The state's own 0x14 wins; absent → the element-level
// justification (ElementReader's same enum mapping).
UiMeterLabelAlign align = textChild.HJustify switch
{
HJustify.Left => UiMeterLabelAlign.Left,
HJustify.Right => UiMeterLabelAlign.Right,
_ => UiMeterLabelAlign.Center,
};
if (state.Properties.Values.TryGetValue(0x14u, out var justify)
&& justify.Kind == UiPropertyKind.Enum)
{
align = justify.UnsignedValue switch
{
0u or 2u => UiMeterLabelAlign.Left,
3u or 5u => UiMeterLabelAlign.Right,
_ => UiMeterLabelAlign.Center,
};
}
m.ConfigureStateLabel(stateId, text, align);
}
}
}