diff --git a/Source/Contents/Items/ItemNaming.h b/Source/Contents/Items/ItemNaming.h index f647ede4..fadf0bc8 100644 --- a/Source/Contents/Items/ItemNaming.h +++ b/Source/Contents/Items/ItemNaming.h @@ -4,6 +4,7 @@ #include "Contents/Items/ItemDescription.h" #include +#include #include #include @@ -54,6 +55,7 @@ ItemCardName& FindItemCardName(int id); ItemMoveInfo& FindItemMoveInfo(int id, std::map& values); ItemMoveInfo& FindItemMoveInfo(int id); bool IsItemCard(int id); +std::uint32_t __fastcall ItemCardColor(const ITEM_INFO* item); std::string ItemDisplayName(int id); const char* ItemResourcePath(const ITEM_INFO& item); int ItemSlotsCount(const ITEM_INFO& item); diff --git a/Source/UI/Window/UIFrameWnd.h b/Source/UI/Window/UIFrameWnd.h index eb7d54ce..1181ac7f 100644 --- a/Source/UI/Window/UIFrameWnd.h +++ b/Source/UI/Window/UIFrameWnd.h @@ -47,6 +47,7 @@ public: void DrawBorder(int x, int y, int width, int height); void FitLastTextLine(int width, unsigned lineCount, int family, int height, FrameTextLines& lines); void DrawTextLines(int x, int y, int family, int lineHeight, const FrameTextLines& lines); + int DrawItemName(int x, int y, int width, const ITEM_INFO* item, int unused, int family, int height); void SplitHighlightText( const char* text, const char* highlight, const int& highlightColor, const int& color, const std::vector& breaks, std::vector>& segments diff --git a/Source/UI/WindowOverlay.cpp b/Source/UI/WindowOverlay.cpp index b5dbf23b..e7cd109f 100644 --- a/Source/UI/WindowOverlay.cpp +++ b/Source/UI/WindowOverlay.cpp @@ -1,4 +1,6 @@ #include "Client/Session.h" +#include "Contents/Items/ItemInfo.h" +#include "Contents/Items/ItemNaming.h" #include "Render/Primitives/AlphaRectangle.h" #include "Render/Renderer.h" #include "Render/TextureQuad.h" @@ -10,6 +12,10 @@ #include "UI/Skill/UISkillDescribeWnd.h" #include "Utility/Text/FormatString.h" +#include +#include +#include + // OFFSET: 0x008D0D80 // FUNCTION: fn_12090 void UISkillDescribeWnd::Slot43() { @@ -95,3 +101,43 @@ void UIEquipWnd::DrawDamageSkinPage() { ++slot; } } + +namespace { + struct ItemNameTextInfo { + int x; + int y; + int height; + int family; + }; + + using BuildItemNameFn = int(__thiscall*)(UIFrameWnd*, const ITEM_INFO*, int*, std::vector*, char**, std::size_t*, char**, char, char); + using DrawItemNameTextFn = void(__thiscall*)( + UIFrameWnd*, const ItemNameTextInfo*, const char*, const char*, std::uint32_t, std::uint32_t, int, const std::vector* + ); +} + +// OFFSET: 0x008D17C0 +// FUNCTION: fn_12094 +int UIFrameWnd::DrawItemName(int x, int y, int width, const ITEM_INFO* item, int, int family, int height) { + int highlightColor = 0; + std::vector breaks; + char buffer[256] = {}; + char* cursor = buffer; + std::size_t remaining = sizeof(buffer); + char* highlight = nullptr; + reinterpret_cast(0x008DA690)( + this, item, &highlightColor, &breaks, &cursor, &remaining, &highlight, 1, 0 + ); + + std::uint32_t color = ItemCardColor(item); + if (color == 0x00ADFF2F) { + color = 0x00669900; + } + color = (color >> 16 & 0xFF) | (color & 0x0000FF00) | ((color & 0xFF) << 16); + + const ItemNameTextInfo info = {x, y, height, family}; + reinterpret_cast(0x0090A2E0)( + this, &info, buffer, highlight, color, static_cast(highlightColor), width, &breaks + ); + return x; +}