From 61a1e6bf877ff0b8a78ebfeae734c064d7c6240e Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Wed, 27 May 2026 09:29:35 +0200 Subject: [PATCH] feat(chunk-renderer): wire DrawIcon + icon-dispatch + EmoteCache path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes the ChunkRenderer pipeline. DrawIcon is a 1:1 port of v1.5.6 ChatLogWindow.DrawIcon (GFD-icon font-relative rendering via Plugin.TextureProvider + ImGuiUtil.PostPayload). C2's TODO(C3) stub in DrawChunk's IconChunk branch is replaced with the real dispatch. EmotePayload special-case wired via EmoteCache.GetEmote (static helper per §6.8). Also adds a one-line rationale comment for the surviving _logger discard (C2 code-quality-review polish — discard kept because _logger is not yet consumed; E-task wiring will likely add call-sites later). --- HellionChat/Ui/Components/ChunkRenderer.cs | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/HellionChat/Ui/Components/ChunkRenderer.cs b/HellionChat/Ui/Components/ChunkRenderer.cs index 89a501d..e6ae5e3 100644 --- a/HellionChat/Ui/Components/ChunkRenderer.cs +++ b/HellionChat/Ui/Components/ChunkRenderer.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Numerics; using Dalamud.Bindings.ImGui; using Dalamud.Game.Text.SeStringHandling.Payloads; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using HellionChat.Code; using HellionChat.Themes; @@ -33,6 +34,7 @@ internal sealed class ChunkRenderer // names change every plugin reload to avoid stable cross-session linkage. _salt = new Random().Next().ToString(); + // Not yet consumed in C2/C3; E-task wiring will likely add log call-sites later. _ = _logger; } @@ -82,9 +84,9 @@ internal sealed class ChunkRenderer float lineWidth = 0f ) { - if (chunk is IconChunk) + if (chunk is IconChunk iconChunk) { - // TODO(C3): wire DrawIcon dispatch + EmotePayload image path here. + DrawIcon(chunk, iconChunk, handler); return; } @@ -173,6 +175,30 @@ internal sealed class ChunkRenderer (useCustomItalicFont ? _fonts.ItalicFont! : _fonts.AxisItalic).Pop(); } + internal void DrawIcon(Chunk chunk, IconChunk icon, PayloadHandler? handler) + { + if (!IconUtil.GfdFileView.TryGetEntry((uint)icon.Icon, out var entry)) + return; + + var iconTexture = Plugin + .TextureProvider.GetFromGame("common/font/fonticon_ps5.tex") + .GetWrapOrDefault(); + if (iconTexture == null) + return; + + var texSize = new Vector2(iconTexture.Width, iconTexture.Height); + + var sizeRatio = FontManager.GetFontSize() / entry.Height; + var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale; + + var uv0 = new Vector2(entry.Left, entry.Top + 170) * 2 / texSize; + var uv1 = + new Vector2(entry.Left + entry.Width, entry.Top + entry.Height + 170) * 2 / texSize; + + ImGui.Image(iconTexture.Handle, size, uv0, uv1); + ImGuiUtil.PostPayload(chunk, handler); + } + private string HidePlayerInString(string str, string playerName, uint worldId) { var expected = _gameFunctions.Chat.AbbreviatePlayerName(playerName);