From a50c9c5fa4466f5f53aea27626a9feb374508d9d Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 07:13:52 +0000 Subject: [PATCH] Decompile fn_16956 (UIWindow::ToScreen) Batch #5042 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_16956 UIWindow::ToScreen: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Session.h | 3 ++- Source/Contents/CashEmotionMgr.cpp | 13 +++++++++++++ Source/UI/Buttons/UIRadioBtn.cpp | 4 ++++ Source/UI/Buttons/UIRadioBtn.h | 1 + Source/UI/Buttons/UISpriteButton.h | 6 ++++++ Source/UI/Shop/UIMerchantShopTitle.cpp | 7 +++++++ Source/UI/Shop/UIMerchantShopTitle.h | 1 + Source/UI/Text/UIBalloonText.cpp | 11 +++++++++++ Source/UI/Text/UIBalloonText.h | 2 ++ Source/UI/Text/UINameBalloonText.h | 9 +++++++++ Source/UI/Text/UIStaticText.cpp | 2 ++ Source/UI/Text/UIStaticText.h | 5 +++++ Source/UI/UIRefiningWnd.cpp | 7 +++++++ Source/UI/UIRefiningWnd.h | 1 + Source/UI/Window/UIFrameWnd.cpp | 2 +- Source/UI/Window/UIFrameWnd.h | 3 --- Source/UI/Window/UIResizer.cpp | 4 ++++ Source/UI/Window/UIResizer.h | 2 ++ Source/UI/Window/UIWindow.cpp | 2 ++ Source/UI/Window/UIWindow.h | 3 +++ 20 files changed, 83 insertions(+), 5 deletions(-) diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 3fe3d4ec..0007689c 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -271,7 +271,8 @@ public: /* 59D8 */ LuaScript* m_hotkeyScript; /* 59DC */ unsigned char unknown_59DC[0x1E4]; /* 5BC0 */ int unknown_5BC0; - /* 5BC4 */ unsigned char unknown_5BC4[0x30]; + /* 5BC4 */ unsigned char unknown_5BC4[0x2C]; + /* 5BF0 */ std::uint32_t unknown_5BF0; /* 5BF4 */ int m_pairValues[3]; /* 5C00 */ unsigned char unknown_5C00[0x1C]; /* 5C1C */ int unknown_5C1C; diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 38e6615e..38ae020c 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -1,4 +1,13 @@ #include "Contents/CashEmotionMgr.h" +#include "Contents/Configuration/ServiceConfiguration.h" +#include "Render/DeviceContext/DeviceContext.h" +#include "Render/Renderer.h" +#include "Render/Textures/SpriteAtlas.h" +#include "Render/Textures/Texture.h" +#include "Resource/PaletteResource.h" +#include "Resource/Sprites/ActionResource.h" +#include "Resource/Sprites/SpriteResource.h" +#include "UI/Buttons/UISpriteButton.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/SkinPalette.h" @@ -1747,6 +1756,10 @@ UISpriteButton2::~UISpriteButton2() { // FUNCTION: fn_10698 UISpriteButton::~UISpriteButton() = default; +// OFFSET: 0x0085CF90 + +// OFFSET: 0x0085D6C0 + // OFFSET: 0x0085E9B0 // FUNCTION: fn_10834 void UISpriteButton2::Slot26(int x, int y) { diff --git a/Source/UI/Buttons/UIRadioBtn.cpp b/Source/UI/Buttons/UIRadioBtn.cpp index ec2814d3..abe68361 100644 --- a/Source/UI/Buttons/UIRadioBtn.cpp +++ b/Source/UI/Buttons/UIRadioBtn.cpp @@ -1,3 +1,5 @@ +#include "Client/Mode/ModeMgr.h" +#include "Client/Mode/ModeTooltip.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" @@ -55,6 +57,8 @@ void UIRadioBtn::Slot25(int, int) { } } +// OFFSET: 0x0085F400 + // OFFSET: 0x00865180 // FUNCTION: fn_10919 int UIRadioBtn::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { diff --git a/Source/UI/Buttons/UIRadioBtn.h b/Source/UI/Buttons/UIRadioBtn.h index 9783fbc3..4bbbb8e1 100644 --- a/Source/UI/Buttons/UIRadioBtn.h +++ b/Source/UI/Buttons/UIRadioBtn.h @@ -13,6 +13,7 @@ public: ~UIRadioBtn() override; void Paint() override; void Slot25(int x, int y) override; + void Slot28(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; /* 007C */ std::string text; diff --git a/Source/UI/Buttons/UISpriteButton.h b/Source/UI/Buttons/UISpriteButton.h index 1b864529..87b3fd5e 100644 --- a/Source/UI/Buttons/UISpriteButton.h +++ b/Source/UI/Buttons/UISpriteButton.h @@ -9,6 +9,7 @@ class UISpriteButton : public UIButton { public: UISpriteButton(UIWindowContext& windowContext, UIButtonContext& buttonContext); ~UISpriteButton() override; + void Paint() override; void Slot25(int x, int y) override; void Slot26(int x, int y) override; void Slot27(int x, int y) override; @@ -35,6 +36,11 @@ protected: /* 00FC */ std::string unknown_00FC; }; +class UIHeadsprButton : public UISpriteButton { +public: + void Paint() override; +}; + class UISpriteButton2 : public UISpriteButton { public: UISpriteButton2(UIWindowContext& windowContext, UIButtonContext& buttonContext, UIWindow* target); diff --git a/Source/UI/Shop/UIMerchantShopTitle.cpp b/Source/UI/Shop/UIMerchantShopTitle.cpp index d3df8d1b..1cda012d 100644 --- a/Source/UI/Shop/UIMerchantShopTitle.cpp +++ b/Source/UI/Shop/UIMerchantShopTitle.cpp @@ -1,8 +1,15 @@ #include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeMgr.h" +#include "Client/Session.h" #include "Contents/Configuration/ServiceOptions.h" +#include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" #include "UI/Shop/UIMerchantShopTitle.h" #include "UI/Window/UIWindowMgr.h" +#include "UI/Window/WindowBorder.h" + +// OFFSET: 0x0085D150 // OFFSET: 0x0085EC40 // FUNCTION: fn_10843 diff --git a/Source/UI/Shop/UIMerchantShopTitle.h b/Source/UI/Shop/UIMerchantShopTitle.h index 4d3509af..90cd30f7 100644 --- a/Source/UI/Shop/UIMerchantShopTitle.h +++ b/Source/UI/Shop/UIMerchantShopTitle.h @@ -7,6 +7,7 @@ class UIMerchantShopTitle : public UIWindow { public: + void Paint() override; void Slot25(int x, int y) override; void Slot26(int x, int y) override; void ResetCursor(int x, int y) override; diff --git a/Source/UI/Text/UIBalloonText.cpp b/Source/UI/Text/UIBalloonText.cpp index 20aca141..7c10825e 100644 --- a/Source/UI/Text/UIBalloonText.cpp +++ b/Source/UI/Text/UIBalloonText.cpp @@ -1,13 +1,20 @@ +#include "Client/Mode/ModeMgr.h" +#include "Contents/Configuration/ServiceConfiguration.h" #include "Render/DeviceContext/DeviceContext.h" #include "Render/Text/TextContext.h" #include "Resource/EmblemResource.h" #include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" +#include "UI/Text/ColoredText.h" #include "UI/Text/TextWrapping.h" #include "UI/Text/UIBalloonText.h" #include "UI/Text/UINameBalloonText.h" #include +// GLOBAL: gl_24926 +int g_nameBalloonFontHeight = 12; + namespace { // INLINED int Family(unsigned mode) { @@ -132,6 +139,10 @@ void UIBalloonText::Paint() { } } +// OFFSET: 0x0085D1F0 + +// OFFSET: 0x0085E280 + // OFFSET: 0x0085FC90 // FUNCTION: fn_10884 void UINameBalloonText::Slot19() { diff --git a/Source/UI/Text/UIBalloonText.h b/Source/UI/Text/UIBalloonText.h index 770392b3..52181ba2 100644 --- a/Source/UI/Text/UIBalloonText.h +++ b/Source/UI/Text/UIBalloonText.h @@ -42,6 +42,8 @@ protected: BalloonTextContext* m_textContext; }; +extern int g_nameBalloonFontHeight; + #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(UIBalloonText) == 168); #endif diff --git a/Source/UI/Text/UINameBalloonText.h b/Source/UI/Text/UINameBalloonText.h index 12900df5..302c5830 100644 --- a/Source/UI/Text/UINameBalloonText.h +++ b/Source/UI/Text/UINameBalloonText.h @@ -9,8 +9,17 @@ class UINameBalloonText : public UIBalloonText { public: ~UINameBalloonText() override; void Slot19() override; + void Paint() override; /* 00A0 */ std::string iconName; + /* 00B8 */ int unknown_00B8; + /* 00BC */ unsigned char monsterType; + /* 00BD */ unsigned char framed; +}; + +class UIVerticalNameBalloonText : public UINameBalloonText { +public: + void Paint() override; }; #endif diff --git a/Source/UI/Text/UIStaticText.cpp b/Source/UI/Text/UIStaticText.cpp index 3b3cabad..ba4e745a 100644 --- a/Source/UI/Text/UIStaticText.cpp +++ b/Source/UI/Text/UIStaticText.cpp @@ -167,6 +167,8 @@ void UIStaticText::Slot35(int value) { this->parent->Slot35(value); } +// OFFSET: 0x0085DAF0 + // OFFSET: 0x0085DCA0 // FUNCTION: fn_10819 void UIStaticText3::Paint() { diff --git a/Source/UI/Text/UIStaticText.h b/Source/UI/Text/UIStaticText.h index 60cb4633..bd260fd5 100644 --- a/Source/UI/Text/UIStaticText.h +++ b/Source/UI/Text/UIStaticText.h @@ -46,6 +46,11 @@ protected: UIButtonContext* m_controls; }; +class UIStaticText2 : public UIStaticText { +public: + void Paint() override; +}; + class UIStaticText3 : public UIStaticText { public: void Paint() override; diff --git a/Source/UI/UIRefiningWnd.cpp b/Source/UI/UIRefiningWnd.cpp index 1ce4064f..4361fb93 100644 --- a/Source/UI/UIRefiningWnd.cpp +++ b/Source/UI/UIRefiningWnd.cpp @@ -11,6 +11,9 @@ #include "Contents/MessageTable.h" #include "Network/Connection/Connection.h" #include "Network/Packets/PacketLengths.h" +#include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowManagerWindows.h" #include "Utility/Text/FormatString.h" @@ -21,6 +24,8 @@ #include #include +#include +#include #pragma pack(push, 1) struct RefiningSelectPacket { @@ -315,6 +320,8 @@ void UIRefining_BtnReturn::Paint() { ); } +// OFFSET: 0x007F70C0 + // OFFSET: 0x007F72A0 // FUNCTION: fn_09913 void UIRefiningWnd::Slot26(int x, int y) { diff --git a/Source/UI/UIRefiningWnd.h b/Source/UI/UIRefiningWnd.h index 46d8c42c..a04246c4 100644 --- a/Source/UI/UIRefiningWnd.h +++ b/Source/UI/UIRefiningWnd.h @@ -52,6 +52,7 @@ public: class UIRefining_Notice : public UIStaticText { public: void Slot19() override; + void Paint() override; void SetNotice(const char* value, int duration, unsigned char highlight); /* 00D8 */ std::string savedText; diff --git a/Source/UI/Window/UIFrameWnd.cpp b/Source/UI/Window/UIFrameWnd.cpp index ad6e482f..5d89da48 100644 --- a/Source/UI/Window/UIFrameWnd.cpp +++ b/Source/UI/Window/UIFrameWnd.cpp @@ -68,7 +68,7 @@ void UIFrameWnd::Slot13(int dx, int dy) { // OFFSET: 0x00A7D870 // FUNCTION: fn_16956 -void UIFrameWnd::ToScreen(int& x, int& y) const { +void UIWindow::ToScreen(int& x, int& y) const { x += this->geometry.x; y += this->geometry.y; diff --git a/Source/UI/Window/UIFrameWnd.h b/Source/UI/Window/UIFrameWnd.h index ac233233..0d685e59 100644 --- a/Source/UI/Window/UIFrameWnd.h +++ b/Source/UI/Window/UIFrameWnd.h @@ -55,9 +55,6 @@ protected: /* 0090 */ int m_message1; /* 0094 */ FrameTextCache m_textCache; UIFrameContext* m_frameContext; - -protected: - void ToScreen(int& x, int& y) const; }; #if defined(_WIN32) && !defined(_WIN64) diff --git a/Source/UI/Window/UIResizer.cpp b/Source/UI/Window/UIResizer.cpp index 294f78c6..7fed95be 100644 --- a/Source/UI/Window/UIResizer.cpp +++ b/Source/UI/Window/UIResizer.cpp @@ -18,11 +18,15 @@ void UIResizer::Paint() { this->FillRegion(0, 0, this->geometry.width, 2, this->lineColor); } +// OFFSET: 0x0085ECE0 + // OFFSET: 0x0085F470 // FUNCTION: fn_10862 void UIResizer::Slot28(int, int) { } +// OFFSET: 0x0085F6D0 + // OFFSET: 0x0085FA20 // FUNCTION: fn_10879 void UIResizer::ResetCursor(int x, int y) { diff --git a/Source/UI/Window/UIResizer.h b/Source/UI/Window/UIResizer.h index 948caffb..48efb7b6 100644 --- a/Source/UI/Window/UIResizer.h +++ b/Source/UI/Window/UIResizer.h @@ -9,6 +9,8 @@ class UIResizer : public UIWindow { public: void Paint() override; + void Slot25(int x, int y) override; + void Slot27(int x, int y) override; void Slot28(int x, int y) override; void ResetCursor(int x, int y) override; void Slot31(int x, int y) override; diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 879a0df6..8ca068e5 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -1340,6 +1340,8 @@ int UIWindow::FormattedTextWidth(std::string text, int family, int height, unsig return total; } +// OFFSET: 0x00A7E120 + // OFFSET: 0x00A836C0 // FUNCTION: fn_17006 int UIWindow::RestoreEditTexts(const unsigned char* data) { diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index f768e1ea..2d5de630 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -5,6 +5,7 @@ #include "UI/Layout/WindowGeometry.h" #include +#include #include #include #include @@ -116,6 +117,7 @@ public: void InvalidateChildren(); bool Contains(const UIWindow* window) const; bool IsDescendantOf(const UIWindow* ancestor) const; + void ToScreen(int& x, int& y) const; UIWindow* FindUid(std::uint32_t uid); // INLINED std::uint32_t Uid() const { @@ -170,6 +172,7 @@ public: FontCache& fonts, const TextLocale& locale, const char* text, unsigned bytes, int family, int height, unsigned char bold, unsigned char italic ); int FormattedTextWidth(std::string text, int family, int height, unsigned char bold); + std::list WrapFormattedText(std::string text, std::list* lines, int maxWidth, int family, int height, unsigned char bold); int RecordEditTexts(WindowReplayRecorder& recorder); int RestoreEditTexts(const unsigned char* data); void DrawActionSprite(