feat(render): Campaign V slice V4a - port TextRenderer/BitmapFont/DebugLineRenderer/TextureCache onto IGpuDevice
TextRenderer, BitmapFont, DebugLineRenderer, and TextureCache's UI-texture
upload path (GetOrUploadRenderSurface/UploadRgba8) now issue every draw and
resource creation through the pinned IGpuDevice/IGpuFrame/IGpuPassEncoder
RHI contract instead of raw GL. This is the RHI's first real production
consumer - V0-V3 only established the contract, GL backend skeleton, and a
shader-dialect migration with no live GL exercise. TextRenderer owns one
IGpuPipeline (ui_text shader, straight-alpha blend, depth disabled) and
allocates a per-bucket ring each Flush; BitmapFont's atlas texture is
created and uploaded via device.CreateTexture/.Upload; DebugLineRenderer
mirrors the same one-pipeline-per-Flush shape for its line-list draws.
World-path TextureCache methods (GetOrUpload, the raw-GL layer-array
upload) are untouched - still legacy GL, still out of scope.
Frame lifecycle: GpuDeviceFrameLifetime (RenderFrameOrchestrator.cs) wraps
IGpuDevice.BeginFrame()/IGpuFrame.End() inside the existing
IRenderFrameLifetime bracket HostInputCameraCompositionPhase already opens
per callback, additively - no frame-graph restructuring. Ported renderers
reach the frame via ICurrentGpuFrameSource, a plain interface (not a
delegate field) so WorldSceneDiagnosticsController keeps passing its
existing "no stored window/delegate" architectural-conformance test.
Two real bugs surfaced by actually exercising the RHI against a live GL
context (nothing here was previously reachable before this slice):
- GlGpuDevice.BeginFrame() now resets the render-state cache every frame.
The cache assumes it is the sole writer of GL program/blend/depth/cull
state, which was true while it had zero real consumers, but every
still-legacy renderer (WbDrawDispatcher, terrain, particles, EnvCells)
mutates that same GL state directly and never informs the cache. Once a
legacy renderer ran between two RHI binds, the cache's belief about the
current GL program went stale, so a later BindPipeline(text shader)
skipped re-issuing glUseProgram and the following push-constant upload
threw GL_INVALID_OPERATION against whatever program was actually bound.
Reset() at the frame boundary is the same defensive move BeginPass
already makes after a forced clear (see its comment); it costs one
redundant state application on the frame's first bind.
- GL_MULTISAMPLE has no representation in the pinned contract. Added a
GL-backend-internal Multisample field to GlRenderStateSnapshot/Changes,
computed from GpuPipelineDescription.SampleCount at BindPipeline time -
mirrors how Vulkan bakes MSAA into the pipeline instead of a separate
toggle.
Collateral, scoped to keep the port real rather than a stub:
- GpuTextureSlot (Unassigned = uint.MaxValue, NOT 0) now flows through
every consumer of TextureCache.GetOrUploadRenderSurface/UploadRgba8 and
TextRenderer.DrawSprite - the entire retained UI layer, since a pervasive
Func<uint,(uint,int,int)> sprite-resolve delegate threads through nearly
every UI element/controller. Every prior `== 0` / `!= 0` "no texture"
check became `.IsAssigned` / `!.IsAssigned`; slot 0 is a real assigned
slot (the device's default white texture), so the old sentinel would
have produced live visual regressions if left in place.
- GpuTextureSlot/IGpuDevice/IGpuFrame are internal, so ~270 previously
public AcDream.App types that touched them (directly or transitively)
are now internal too - safe, since AcDream.App is an exe with no
external project references; only the two test projects consume it, via
InternalsVisibleTo. A handful of unrelated types the sweep caught
(ElementInfo/ImportedLayout's property-bag hierarchy, several enums used
as public [Theory] parameters, CursorFeedbackSnapshot's DragAcceptState)
were reverted back to public where making them internal would have
either cascaded into unrelated files or broken xUnit's public-member
discovery.
- ExternalViewportTextureBridge (new) registers the still-raw-GL FBO
color textures PrivateEntityViewportRenderer/PaperdollViewportRenderer
produce (V4g's scope) into the device's texture table for
UiViewport.TextureHandle, via a temporary
GlGpuDevice.RegisterExternalColorTexture escape hatch (internal, not
part of IGpuDevice) deleted when V4g ports those viewports.
- TextRenderGlStateScope.cs and its test deleted: the pipeline description
now bakes what it used to restore by hand.
- ResourceCleanupGroupTests/GlTextureOwnershipTests: the two source-text
conformance tests keyed to TextRenderer's old multi-resource
construction shape (Shader + per-flight FrameBufferSet array + white
texture + tracked VAO/VBO, all via ResourceCleanupGroup) no longer apply
- that shape is gone, replaced by one IGpuPipeline created through
IGpuDevice. The construction-order test is deleted; the checked-commit
texture-creation check now targets GlGpuTexture (which already used
the same GlResourceCommand.CreateName primitive before this slice).
Gates:
- dotnet build -c Release: 0 warnings, 0 errors (AcDream.App has
TreatWarningsAsErrors).
- dotnet test tests/AcDream.App.Tests -c Release: 3,840 passed / 3
skipped (was 3,843/3 entering this slice - net 3 fewer tests:
TextRendererFailureSafetyTests.cs deleted (2, tested the now-deleted
TextRenderGlStateScope) plus the one retired ResourceCleanupGroupTests
method). Full solution: 8,908 passed / 5 skipped across all nine test
projects.
- Offline pixel gate (tools/run-offline-pixel-gate.ps1, parent ec414d60
vs this commit): differing fraction 0.318% (1,791/563,200 compared
pixels), above the 0.001 threshold. Investigated pixel-by-pixel rather
than waved through: a diff heatmap plus 4x crops at the differing
clusters show zero differences anywhere in the retained UI, terrain,
scenery, or static meshes - every differing pixel sits on continuously-
animated ambient content (flying-insect sprites over the swamp, foliage
sparkle/dew glints) whose exact phase depends on elapsed wall-clock
time, the same category the gate's own sky-masking rationale already
documents and the campaign doc's coverage table explicitly excludes
("Not covered - particles"). Confirming evidence: two same-commit
captures at HEAD compare clean against each other (0.0025%), and two
same-commit captures at the parent compare clean against each other
(0.0044%) - only base-vs-head is consistently elevated, which is what
frame-pacing drift from genuinely new per-frame RHI work (BeginFrame,
ring resets, the render-state reset above) would produce against a
fixed wall-clock capture deadline, not a rendering defect. Recommend a
quick user visual check of this capture pair alongside the automated
result, matching how V2c's particle work was already handled in this
campaign (flagged for user visual confirmation rather than blocked on
an automated gate that cannot cover animated content).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
ec414d60cd
commit
ceec3bc440
334 changed files with 3660 additions and 3840 deletions
|
|
@ -1,16 +1,24 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using AcDream.Core.Items;
|
||||
|
||||
namespace AcDream.App.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Accept/reject overlay state while a drag hovers an item slot cell. Top-level
|
||||
/// (not nested in <see cref="UiItemSlot"/>, which is internal) because
|
||||
/// <c>CursorFeedbackSnapshot</c> is a public test-visible type that carries this
|
||||
/// value.
|
||||
/// </summary>
|
||||
public enum DragAcceptState { None, Accept, Reject }
|
||||
|
||||
/// <summary>
|
||||
/// One item-in-a-slot cell (port of retail UIElement_UIItem, class 0x10000032).
|
||||
/// A behavioral LEAF: it draws the empty-slot sprite when unbound, else a
|
||||
/// pre-composited icon texture (set by the controller). Holds the bound weenie
|
||||
/// guid (retail UIElement_UIItem::itemID, +0x5FC).
|
||||
/// </summary>
|
||||
public class UiItemSlot : UiElement
|
||||
internal class UiItemSlot : UiElement
|
||||
{
|
||||
public UiItemSlot() { ClickThrough = false; }
|
||||
|
||||
|
|
@ -19,15 +27,15 @@ public class UiItemSlot : UiElement
|
|||
/// <summary>Bound weenie guid (0 = empty). Retail UIElement_UIItem::itemID.</summary>
|
||||
public uint ItemId { get; private set; }
|
||||
|
||||
/// <summary>Pre-composited icon GL texture for the bound item (0 = none).</summary>
|
||||
public uint IconTexture { get; private set; }
|
||||
/// <summary>Pre-composited icon texture-table slot for the bound item (Unassigned = none).</summary>
|
||||
public GpuTextureSlot IconTexture { get; private set; } = GpuTextureSlot.Unassigned;
|
||||
|
||||
/// <summary>
|
||||
/// Underlay-free cursor graphic for the bound item (retail <c>IconData::m_pDragIcon</c>).
|
||||
/// Falls back to <see cref="IconTexture"/> only for callers that have not supplied the
|
||||
/// dedicated composite.
|
||||
/// </summary>
|
||||
public uint DragIconTexture { get; private set; }
|
||||
public GpuTextureSlot DragIconTexture { get; private set; } = GpuTextureSlot.Unassigned;
|
||||
|
||||
/// <summary>
|
||||
/// Lossless shortcut record when this cell belongs to the toolbar. Physical item
|
||||
|
|
@ -36,7 +44,7 @@ public class UiItemSlot : UiElement
|
|||
public ShortcutEntry? Shortcut { get; private set; }
|
||||
|
||||
/// <summary>This cell's own index within its panel (0..17 toolbar; container slot
|
||||
/// for inventory). Distinct from <see cref="ShortcutNum"/> (the 1–9 label, -1 on the
|
||||
/// for inventory). Distinct from <see cref="ShortcutNum"/> (the 1–9 label, -1 on the
|
||||
/// bottom row). Set by the controller; used as the drag payload's SourceSlot and to
|
||||
/// identify the drop TARGET slot.</summary>
|
||||
public int SlotIndex { get; set; } = -1;
|
||||
|
|
@ -54,24 +62,24 @@ public class UiItemSlot : UiElement
|
|||
|
||||
/// <summary>True when this cell is the OPEN container (its contents fill the grid). Draws the
|
||||
/// open-container triangle. Port of UIElement_ItemList::UpdateOpenContainerIndicator
|
||||
/// (0x004e3070) → SetOpenContainerState (0x004e1200): shown when item.itemID == openContainerId.</summary>
|
||||
/// (0x004e3070) → SetOpenContainerState (0x004e1200): shown when item.itemID == openContainerId.</summary>
|
||||
public bool IsOpenContainer { get; set; }
|
||||
/// <summary>Open-container triangle sprite (element 0x10000450 on the container prototype
|
||||
/// 0x1000033F). Configurable; guard id != 0 before resolving.</summary>
|
||||
public uint OpenContainerSprite { get; set; } = 0x06005D9Cu;
|
||||
|
||||
/// <summary>True when this cell is the SELECTED item. Draws the green/yellow selection square.
|
||||
/// Port of UIElement_ItemList::ItemList_SetSelectedItem (0x004e2fe0) → SetSelectedState
|
||||
/// Port of UIElement_ItemList::ItemList_SetSelectedItem (0x004e2fe0) → SetSelectedState
|
||||
/// (0x004e1240): shown when item.itemID == selectedItemId. Uniform across item + container cells.</summary>
|
||||
public bool Selected { get; set; }
|
||||
/// <summary>Selected-item square sprite (element 0x10000342 on the 32×32 item prototype
|
||||
/// <summary>Selected-item square sprite (element 0x10000342 on the 32×32 item prototype
|
||||
/// 0x10000341; pixel-confirmed green/yellow frame). Drawn as a procedural overlay so it renders
|
||||
/// on the 36×36 container cell too (whose prototype lacks the square child).</summary>
|
||||
/// on the 36×36 container cell too (whose prototype lacks the square child).</summary>
|
||||
public uint SelectedSprite { get; set; } = 0x06004D21u;
|
||||
|
||||
/// <summary>Container fullness [0..1], or -1 = hidden (the cell is not a container, or its
|
||||
/// itemsCapacity is unknown/0). Port of UIElement_UIItem::UpdateCapacityDisplay (0x004e16e0): a
|
||||
/// per-cell vertical UIElement_Meter (element 0x10000347, 5×30 at x=26,y=1) shown only when
|
||||
/// per-cell vertical UIElement_Meter (element 0x10000347, 5×30 at x=26,y=1) shown only when
|
||||
/// isContainer && itemsCapacity > 0, fill = numContainedItems / itemsCapacity (meter attr 0x69).</summary>
|
||||
public float CapacityFill { get; set; } = -1f;
|
||||
/// <summary>Capacity-bar track sprite (meter 0x10000347 DirectState).</summary>
|
||||
|
|
@ -79,10 +87,8 @@ public class UiItemSlot : UiElement
|
|||
/// <summary>Capacity-bar fill sprite (meter 0x10000347 front child 0x00000002 DirectState).</summary>
|
||||
public uint CapacityFrontSprite { get; set; } = 0x06004D23u;
|
||||
|
||||
/// <summary>Accept/reject overlay state while a drag hovers this cell.</summary>
|
||||
public enum DragAcceptState { None, Accept, Reject }
|
||||
private DragAcceptState _dragAccept = DragAcceptState.None;
|
||||
/// <summary>Current overlay state — internal so unit tests can assert it (InternalsVisibleTo).</summary>
|
||||
/// <summary>Current overlay state — internal so unit tests can assert it (InternalsVisibleTo).</summary>
|
||||
internal DragAcceptState DragAcceptVisual => _dragAccept;
|
||||
|
||||
/// <summary>Empty-slot sprite. Default = the generic toolbar empty-slot border
|
||||
|
|
@ -102,7 +108,7 @@ public class UiItemSlot : UiElement
|
|||
private bool _primaryPressConsumed;
|
||||
|
||||
/// <summary>RenderSurface id -> (GL texture, w, h). Set by the factory/controller.</summary>
|
||||
public Func<uint, (uint tex, int w, int h)>? SpriteResolve { get; set; }
|
||||
public Func<uint, (GpuTextureSlot tex, int w, int h)>? SpriteResolve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DAT-authored 10%..100% radial cooldown overlays from element ids
|
||||
|
|
@ -118,21 +124,21 @@ public class UiItemSlot : UiElement
|
|||
|
||||
public void SetItem(
|
||||
uint itemId,
|
||||
uint iconTexture,
|
||||
GpuTextureSlot iconTexture,
|
||||
ShortcutEntry? shortcut = null,
|
||||
uint dragIconTexture = 0)
|
||||
GpuTextureSlot? dragIconTexture = null)
|
||||
{
|
||||
ItemId = itemId;
|
||||
IconTexture = iconTexture;
|
||||
DragIconTexture = dragIconTexture;
|
||||
DragIconTexture = dragIconTexture ?? GpuTextureSlot.Unassigned;
|
||||
Shortcut = shortcut;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
ItemId = 0;
|
||||
IconTexture = 0;
|
||||
DragIconTexture = 0;
|
||||
IconTexture = GpuTextureSlot.Unassigned;
|
||||
DragIconTexture = GpuTextureSlot.Unassigned;
|
||||
Shortcut = null;
|
||||
_waiting = false;
|
||||
_primaryPressConsumed = false;
|
||||
|
|
@ -145,13 +151,13 @@ public class UiItemSlot : UiElement
|
|||
: null;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override (uint tex, int w, int h)? GetDragGhost()
|
||||
public override (GpuTextureSlot tex, int w, int h)? GetDragGhost()
|
||||
{
|
||||
if (ItemId == 0) return null;
|
||||
// RenderIcons creates m_pDragIcon on a fixed 0x20 × 0x20 surface, even when its
|
||||
// containing bag cell is 36 × 36. The cursor hotspot is correspondingly (16,16).
|
||||
if (DragIconTexture != 0) return (DragIconTexture, 32, 32);
|
||||
return IconTexture != 0 ? (IconTexture, (int)Width, (int)Height) : null;
|
||||
// RenderIcons creates m_pDragIcon on a fixed 0x20 × 0x20 surface, even when its
|
||||
// containing bag cell is 36 × 36. The cursor hotspot is correspondingly (16,16).
|
||||
if (DragIconTexture.IsAssigned) return (DragIconTexture, 32, 32);
|
||||
return IconTexture.IsAssigned ? (IconTexture, (int)Width, (int)Height) : null;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -171,7 +177,7 @@ public class UiItemSlot : UiElement
|
|||
internal void SetWaitingState(bool waiting)
|
||||
=> _waiting = waiting && ItemId != 0;
|
||||
|
||||
/// <summary>An OCCUPIED slot is a drag source — a press-and-move picks up the item
|
||||
/// <summary>An OCCUPIED slot is a drag source — a press-and-move picks up the item
|
||||
/// rather than moving the toolbar window. An EMPTY slot is NOT a drag source, so a
|
||||
/// press-and-move there falls through to the IA-12 whole-window-drag, keeping the bar
|
||||
/// movable by its empty cells / chrome. Drives <see cref="UiRoot"/>'s mousedown
|
||||
|
|
@ -187,23 +193,23 @@ public class UiItemSlot : UiElement
|
|||
return null;
|
||||
}
|
||||
|
||||
// ── Shortcut number (slot label) ─────────────────────────────────────────
|
||||
// ── Shortcut number (slot label) ─────────────────────────────────────────
|
||||
// Port of UIElement_UIItem::SetShortcutNum (acclient_2013_pseudo_c.txt:229465).
|
||||
// Retail draws the digit on the cell's ShortcutNum sub-element, picking the
|
||||
// digit image from a DID-array property: 0x10000042 (regular) / 0x10000043 (ghosted),
|
||||
// indexed by slot position. Each digit is a 32×32 PFID_A8R8G8B8 RenderSurface
|
||||
// indexed by slot position. Each digit is a 32×32 PFID_A8R8G8B8 RenderSurface
|
||||
// with the digit baked into the top-left corner (rest alpha=0), drawn Alphablend.
|
||||
|
||||
/// <summary>Slot position in the shortcut bar (0-indexed). -1 = no number (retail
|
||||
/// SetVisible(0) when edi < 0). Top row: 0..8 → digits 1..9. Bottom row: -1.</summary>
|
||||
/// SetVisible(0) when edi < 0). Top row: 0..8 → digits 1..9. Bottom row: -1.</summary>
|
||||
public int ShortcutNum { get; private set; } = -1;
|
||||
|
||||
/// <summary>True when retail marks the physical-item shortcut as ghosted.</summary>
|
||||
public bool ShortcutGhosted { get; private set; }
|
||||
|
||||
/// <summary>Regular digit DID array. Index i → digit (i+1) sprite RenderSurface id.
|
||||
/// <summary>Regular digit DID array. Index i → digit (i+1) sprite RenderSurface id.
|
||||
/// Injected by the controller after reading LayoutDesc 0x21000037.
|
||||
/// Retail ref: UIElement_UIItem::SetShortcutNum (decomp 229481) — occupied slot picks
|
||||
/// Retail ref: UIElement_UIItem::SetShortcutNum (decomp 229481) — occupied slot picks
|
||||
/// property 0x10000042 when the shortcut is not ghosted.</summary>
|
||||
public uint[]? RegularDigits { get; set; }
|
||||
|
||||
|
|
@ -213,7 +219,7 @@ public class UiItemSlot : UiElement
|
|||
|
||||
/// <summary>Empty-slot digit DID array (property 0x1000005e, stance-independent).
|
||||
/// Used when the slot is EMPTY (ItemId == 0). Retail ref: UIElement_UIItem::SetShortcutNum
|
||||
/// (decomp 229481) — else branch when m_elem_Icon->m_state == 0x1000001c (empty).</summary>
|
||||
/// (decomp 229481) — else branch when m_elem_Icon->m_state == 0x1000001c (empty).</summary>
|
||||
public uint[]? EmptyDigits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -241,8 +247,8 @@ public class UiItemSlot : UiElement
|
|||
/// <summary>
|
||||
/// Returns the digit DID array that OnDraw will use, following the retail occupancy
|
||||
/// branch in UIElement_UIItem::SetShortcutNum (decomp 229481):
|
||||
/// occupied (ItemId != 0) → ShortcutGhosted ? GhostedDigits : RegularDigits (0x10000043/42)
|
||||
/// empty (ItemId == 0) → EmptyDigits (0x1000005e, stance-independent)
|
||||
/// occupied (ItemId != 0) → ShortcutGhosted ? GhostedDigits : RegularDigits (0x10000043/42)
|
||||
/// empty (ItemId == 0) → EmptyDigits (0x1000005e, stance-independent)
|
||||
/// Exposed as an internal method so unit tests can assert array selection without
|
||||
/// needing a real render context.
|
||||
/// </summary>
|
||||
|
|
@ -253,7 +259,7 @@ public class UiItemSlot : UiElement
|
|||
: EmptyDigits;
|
||||
}
|
||||
|
||||
// ── Events / draw ─────────────────────────────────────────────────────────
|
||||
// ── Events / draw ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Invoked by <see cref="OnEvent"/> when a completed left click lands
|
||||
/// on a bound slot. Selection already occurred on MouseDown through the owning
|
||||
|
|
@ -269,7 +275,7 @@ public class UiItemSlot : UiElement
|
|||
{
|
||||
switch (e.Type)
|
||||
{
|
||||
// Use fires on CLICK (mouse-up over the same cell), not MouseDown — so a
|
||||
// Use fires on CLICK (mouse-up over the same cell), not MouseDown — so a
|
||||
// drag (press + >3px move) does NOT also use the item. UiRoot suppresses the
|
||||
// post-drag Click (UiRoot.cs FinishDrag returns before the Click emit).
|
||||
case UiEventType.MouseDown:
|
||||
|
|
@ -296,13 +302,13 @@ public class UiItemSlot : UiElement
|
|||
return true;
|
||||
|
||||
case UiEventType.DragBegin:
|
||||
// Notify the source list's handler so it can lift (remove + wire) — retail
|
||||
// RecvNotice_ItemListBeginDrag → RemoveShortcut. UiRoot snapshotted the ghost first.
|
||||
// Notify the source list's handler so it can lift (remove + wire) — retail
|
||||
// RecvNotice_ItemListBeginDrag → RemoveShortcut. UiRoot snapshotted the ghost first.
|
||||
if (FindList() is { DragHandler: { } lh } liftList && e.Payload is ItemDragPayload lp)
|
||||
lh.OnDragLift(liftList, this, lp);
|
||||
return true;
|
||||
|
||||
case UiEventType.DragEnter: // pointer entered me mid-drag → ask the list's handler
|
||||
case UiEventType.DragEnter: // pointer entered me mid-drag → ask the list's handler
|
||||
_dragAccept = FindList() is { DragHandler: { } h } list
|
||||
&& e.Payload is ItemDragPayload p
|
||||
? h.OnDragOver(list, this, p) switch
|
||||
|
|
@ -314,7 +320,7 @@ public class UiItemSlot : UiElement
|
|||
: DragAcceptState.Reject;
|
||||
return true;
|
||||
|
||||
case UiEventType.DragOver: // UiRoot fires this on LEAVE → neutral
|
||||
case UiEventType.DragOver: // UiRoot fires this on LEAVE → neutral
|
||||
_dragAccept = DragAcceptState.None;
|
||||
return true;
|
||||
|
||||
|
|
@ -331,43 +337,43 @@ public class UiItemSlot : UiElement
|
|||
{
|
||||
// Draw the icon (filled slot) or the empty-slot border. Both paths fall through
|
||||
// to the digit draw below; the slot label always shows on top-row slots.
|
||||
if (ItemId != 0 && IconTexture != 0)
|
||||
if (ItemId != 0 && IconTexture.IsAssigned)
|
||||
{
|
||||
ctx.DrawSprite(IconTexture, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
else if (SpriteResolve is not null && EmptySprite != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(EmptySprite);
|
||||
if (tex != 0)
|
||||
if (tex.IsAssigned)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
|
||||
// Digit overlay: UIElement_UIItem::SetShortcutNum (acclient_2013_pseudo_c.txt:229465).
|
||||
// Occupancy branch (decomp 229481):
|
||||
// occupied (ItemId != 0) → regular/ghosted digit set 0x10000042/43
|
||||
// empty (ItemId == 0) → background digit set 0x1000005e, stance-independent
|
||||
// occupied (ItemId != 0) → regular/ghosted digit set 0x10000042/43
|
||||
// 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.
|
||||
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
|
||||
// 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
|
||||
// (CapacityFill >= 0). Track drawn full; fill clipped to the fraction from the BOTTOM (the
|
||||
// "how full" direction). Procedural — UiItemSlot is a behavioral leaf. Guard id != 0 first.
|
||||
// "how full" direction). Procedural — UiItemSlot is a behavioral leaf. Guard id != 0 first.
|
||||
if (CapacityFill >= 0f && SpriteResolve is not null)
|
||||
{
|
||||
const float by = 1f, bw = 5f, bh = 30f; // element 0x10000347 size (dat 5×30 at y=1)
|
||||
const float by = 1f, bw = 5f, bh = 30f; // element 0x10000347 size (dat 5×30 at y=1)
|
||||
float bx = Width - bw; // flush to the cell's right edge (visual gate: the dat X=26 sat ~5px off the edge)
|
||||
if (CapacityBackSprite != 0)
|
||||
{
|
||||
var (bt, _, _) = SpriteResolve(CapacityBackSprite);
|
||||
if (bt != 0) ctx.DrawSprite(bt, bx, by, bw, bh, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
if (bt.IsAssigned) ctx.DrawSprite(bt, bx, by, bw, bh, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
float f = Math.Clamp(CapacityFill, 0f, 1f);
|
||||
if (f > 0f && CapacityFrontSprite != 0)
|
||||
{
|
||||
var (ft, _, _) = SpriteResolve(CapacityFrontSprite);
|
||||
if (ft != 0)
|
||||
if (ft.IsAssigned)
|
||||
{
|
||||
// Bottom-up fill: draw the bottom f-fraction of the bar, sampling the matching
|
||||
// bottom slice of the front sprite (UV v from 1-f to 1).
|
||||
|
|
@ -377,7 +383,7 @@ public class UiItemSlot : UiElement
|
|||
}
|
||||
}
|
||||
|
||||
// Pending/drag-source mesh — retail UIElement_UIItem::SetWaitingState (0x004e11b0)
|
||||
// Pending/drag-source mesh — retail UIElement_UIItem::SetWaitingState (0x004e11b0)
|
||||
// reveals m_elem_Icon_Ghosted (0x10000349). ItemList_BeginDrag (0x004e32d0)
|
||||
// sets it for physical inventory/equipment cells while leaving their icon in place.
|
||||
// Draw it before the persistent selected/open indicators: retail keeps selection visible
|
||||
|
|
@ -385,7 +391,7 @@ public class UiItemSlot : UiElement
|
|||
if (_waiting && SpriteResolve is not null && WaitingSprite != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(WaitingSprite);
|
||||
if (tex != 0)
|
||||
if (tex.IsAssigned)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
|
||||
|
|
@ -396,18 +402,18 @@ public class UiItemSlot : UiElement
|
|||
if (IsOpenContainer && SpriteResolve is not null && OpenContainerSprite != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(OpenContainerSprite);
|
||||
if (tex != 0)
|
||||
if (tex.IsAssigned)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
if (Selected && SpriteResolve is not null && SelectedSprite != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(SelectedSprite);
|
||||
if (tex != 0)
|
||||
if (tex.IsAssigned)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
|
||||
// Drag-rollover accept/reject frame (retail SetDragAcceptState 0x10000041/40).
|
||||
// Guard id != 0 BEFORE resolving — resolve(0) returns the 1×1 magenta placeholder
|
||||
// Guard id != 0 BEFORE resolving — resolve(0) returns the 1×1 magenta placeholder
|
||||
// with a non-zero GL handle (feedback_ui_resolve_zero_magenta).
|
||||
if (_dragAccept != DragAcceptState.None && SpriteResolve is not null)
|
||||
{
|
||||
|
|
@ -415,7 +421,7 @@ public class UiItemSlot : UiElement
|
|||
if (id != 0)
|
||||
{
|
||||
var (tex, _, _) = SpriteResolve(id);
|
||||
if (tex != 0)
|
||||
if (tex.IsAssigned)
|
||||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
}
|
||||
|
|
@ -428,7 +434,7 @@ public class UiItemSlot : UiElement
|
|||
if (cooldownSprite != 0u && SpriteResolve is not null)
|
||||
{
|
||||
var (texture, _, _) = SpriteResolve(cooldownSprite);
|
||||
if (texture != 0u)
|
||||
if (texture.IsAssigned)
|
||||
ctx.DrawSprite(
|
||||
texture,
|
||||
0f,
|
||||
|
|
@ -460,7 +466,7 @@ public class UiItemSlot : UiElement
|
|||
return;
|
||||
|
||||
var (texture, _, _) = SpriteResolve(did);
|
||||
if (texture != 0)
|
||||
if (texture.IsAssigned)
|
||||
ctx.DrawSprite(texture, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue