fix(ui): restore retail magic shortcut bar
Port the retail horizontal ItemList empty-slot padding and share UIItem shortcut-number graphics with the status toolbar. Preserve all authored face children on compound DAT buttons so the three-piece Cast control reflows and renders as one complete button. Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
0527325b25
commit
e3605672bb
12 changed files with 466 additions and 62 deletions
|
|
@ -192,6 +192,17 @@ public class UiItemSlot : UiElement
|
|||
/// (decomp 229481) — else branch when m_elem_Icon->m_state == 0x1000001c (empty).</summary>
|
||||
public uint[]? EmptyDigits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this retained cell represents an occupied UIItem for shortcut-number
|
||||
/// presentation. Physical item cells use their weenie id; non-weenie catalog
|
||||
/// cells override this with their own identity instead of forging an item GUID.
|
||||
/// </summary>
|
||||
protected virtual bool IsShortcutOccupied => ItemId != 0;
|
||||
|
||||
/// <summary>True when this cell is an empty slot that a retail item list may
|
||||
/// add/remove while maintaining its visible empty-cell tail.</summary>
|
||||
public virtual bool IsEmptySlot => ItemId == 0;
|
||||
|
||||
/// <summary>Set the slot's shortcut position and ghosted state so the correct digit
|
||||
/// is drawn. Call with index 0..8 for the top row.</summary>
|
||||
public void SetShortcutNum(int index, bool ghosted)
|
||||
|
|
@ -213,8 +224,9 @@ public class UiItemSlot : UiElement
|
|||
/// </summary>
|
||||
internal uint[]? ActiveDigitArray()
|
||||
{
|
||||
bool occupied = ItemId != 0;
|
||||
return occupied ? (ShortcutGhosted ? GhostedDigits : RegularDigits) : EmptyDigits;
|
||||
return IsShortcutOccupied
|
||||
? (ShortcutGhosted ? GhostedDigits : RegularDigits)
|
||||
: EmptyDigits;
|
||||
}
|
||||
|
||||
// ── Events / draw ─────────────────────────────────────────────────────────
|
||||
|
|
@ -296,20 +308,7 @@ public class UiItemSlot : UiElement
|
|||
// empty (ItemId == 0) → background digit set 0x1000005e, stance-independent
|
||||
// Each digit image is corner-baked (glyph in top-left, rest alpha=0); drawn
|
||||
// full-cell Alphablend so the transparent region is invisible.
|
||||
if (ShortcutNum >= 0 && SpriteResolve is not null)
|
||||
{
|
||||
var arr = ActiveDigitArray();
|
||||
if (arr is not null && ShortcutNum < arr.Length)
|
||||
{
|
||||
uint did = arr[ShortcutNum];
|
||||
if (did != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(did);
|
||||
if (tex != 0)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
}
|
||||
}
|
||||
DrawShortcutOverlay(ctx);
|
||||
|
||||
// Container capacity bar — UIElement_UIItem::UpdateCapacityDisplay (0x004e16e0): a vertical
|
||||
// UIElement_Meter (element 0x10000347, 5×30 at x=26,y=1) shown only for container cells
|
||||
|
|
@ -381,4 +380,25 @@ public class UiItemSlot : UiElement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Draws the shared retail shortcut-number layer. Catalog spell cells
|
||||
/// call this after their icon layer so magic favorites and physical shortcuts
|
||||
/// use the same UIItem presentation path.</summary>
|
||||
protected void DrawShortcutOverlay(UiRenderContext ctx)
|
||||
{
|
||||
if (ShortcutNum < 0 || SpriteResolve is null)
|
||||
return;
|
||||
|
||||
uint[]? digits = ActiveDigitArray();
|
||||
if (digits is null || ShortcutNum >= digits.Length)
|
||||
return;
|
||||
|
||||
uint did = digits[ShortcutNum];
|
||||
if (did == 0)
|
||||
return;
|
||||
|
||||
var (texture, _, _) = SpriteResolve(did);
|
||||
if (texture != 0)
|
||||
ctx.DrawSprite(texture, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue