feat(chunk-renderer): wire DrawIcon + icon-dispatch + EmoteCache path
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).
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using HellionChat.Code;
|
using HellionChat.Code;
|
||||||
using HellionChat.Themes;
|
using HellionChat.Themes;
|
||||||
@@ -33,6 +34,7 @@ internal sealed class ChunkRenderer
|
|||||||
// names change every plugin reload to avoid stable cross-session linkage.
|
// names change every plugin reload to avoid stable cross-session linkage.
|
||||||
_salt = new Random().Next().ToString();
|
_salt = new Random().Next().ToString();
|
||||||
|
|
||||||
|
// Not yet consumed in C2/C3; E-task wiring will likely add log call-sites later.
|
||||||
_ = _logger;
|
_ = _logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,9 +84,9 @@ internal sealed class ChunkRenderer
|
|||||||
float lineWidth = 0f
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +175,30 @@ internal sealed class ChunkRenderer
|
|||||||
(useCustomItalicFont ? _fonts.ItalicFont! : _fonts.AxisItalic).Pop();
|
(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)
|
private string HidePlayerInString(string str, string playerName, uint worldId)
|
||||||
{
|
{
|
||||||
var expected = _gameFunctions.Chat.AbbreviatePlayerName(playerName);
|
var expected = _gameFunctions.Chat.AbbreviatePlayerName(playerName);
|
||||||
|
|||||||
Reference in New Issue
Block a user