From 999e6562705860bf47359d9d7b76b2dcecd4673e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 11 Nov 2026 10:18:21 +0000 Subject: [PATCH] Decompile 3 functions in Source/UI/Dialogs/UIMessageBox.cpp, Source/UI/Text/UITextViewer.h Batch #16862 by eAthena: 1 byte-identical, 2 confirmed by peer review. - fn_11733 UIMakeCharWnd::InitHairControls: logic confirmed by peer review - fn_11739 UICntWnd::OnCreate: byte-identical - fn_11767 UIMerInfoWnd::Paint: 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/UI/Dialogs/UIMessageBox.cpp | 101 ++++++++++++++++------------- Source/UI/Text/UITextViewer.h | 5 ++ 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/Source/UI/Dialogs/UIMessageBox.cpp b/Source/UI/Dialogs/UIMessageBox.cpp index a08c47d53..18f154c5a 100644 --- a/Source/UI/Dialogs/UIMessageBox.cpp +++ b/Source/UI/Dialogs/UIMessageBox.cpp @@ -101,6 +101,8 @@ #include "Utility/Cipher/LocalEncryptedName.h" #include "Resource/MSGSTRINGID.h" + +extern template bool std::_Traits_equal>(const char*, std::size_t, const char*, std::size_t) noexcept; // GLOBAL: gl_25153 static const std::string s_messageBoxItemLinkOpening = ""; @@ -355,43 +357,48 @@ void UIMerInfoWnd::Paint() { this->DrawTextAt(100, 135, LookupMessage(MSI_MER_FRIENDLY), 0, 0, 12, 0, 0, 0); this->DrawTextAt(100, 159, LookupMessage(MSI_MER_CALLCOUNT), 0, 0, 12, 0, 0, 0); this->DrawTextAt(230, 133, LookupMessage(MSI_MER_KILL), 0, 0, 12, 0, 0, 0); - char number[24] = {}; - int bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[0]); - this->DrawRightAlignedText(79, 24, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[1]); - this->DrawRightAlignedText(79, 42, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[2]); - this->DrawRightAlignedText(79, 60, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[3]); - this->DrawRightAlignedText(79, 78, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[4]); - this->DrawRightAlignedText(79, 96, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[5]); - this->DrawRightAlignedText(79, 114, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[6]); - this->DrawRightAlignedText(79, 132, number, bytes, 1, 14, 0, 0); - bytes = std::sprintf(number, "%d", (2000 - g_session.m_mercenaryStats[7]) / 10); - this->DrawRightAlignedText(79, 150, number, bytes, 1, 14, 0, 0); + { + char number[24] = {}; + int bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[0]); + this->DrawRightAlignedText(79, 24, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[1]); + this->DrawRightAlignedText(79, 42, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[2]); + this->DrawRightAlignedText(79, 60, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[3]); + this->DrawRightAlignedText(79, 78, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[4]); + this->DrawRightAlignedText(79, 96, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[5]); + this->DrawRightAlignedText(79, 114, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", g_session.m_mercenaryStats[6]); + this->DrawRightAlignedText(79, 132, number, bytes, 1, 14, 0, 0); + bytes = std::sprintf(number, "%d", (2000 - g_session.m_mercenaryStats[7]) / 10); + this->DrawRightAlignedText(79, 150, number, bytes, 1, 14, 0, 0); + } this->DrawTextAt(136, 24, g_session.m_mercenaryName, 0, 0, 12, 0x646464, 0, 0); this->DrawTextAt(135, 24, g_session.m_mercenaryName, 0, 0, 12, 0, 0, 0); - char level[12] = {}; - _itoa(g_session.m_mercenaryLevel, level, 10); - this->DrawTextAt(135, 47, level, 0, 0, 12, 0, 0, 0); - if (g_session.m_mercenaryClass != -1) { - char text[32] = {}; - bytes = std::sprintf(text, "%d / %d", g_session.m_mercenaryHp, g_session.m_mercenaryMaxHp); - this->DrawTextAt(218, 70, text, bytes, 1, 14, 0, 0, 0); - bytes = std::sprintf(text, "%d / %d", g_session.m_mercenarySp, g_session.m_mercenaryMaxSp); - this->DrawTextAt(218, 85, text, bytes, 1, 14, 0, 0, 0); - std::strftime(text, 128, LookupMessage(MSI_TIME_TYPE2), _localtime32(&g_session.m_mercenaryExpiration)); - this->DrawTextAt(155, 111, text, static_cast(std::strlen(text)), 0, 12, 255, 0, 0); - bytes = std::sprintf(text, "%d", g_session.m_mercenaryLoyalty); - this->DrawTextAt(170, 133, text, bytes, 1, 14, 0, 0, 0); - bytes = std::sprintf(text, "%d", g_session.m_mercenarySummons); - this->DrawTextAt(170, 157, text, bytes, 1, 14, 0, 0, 0); - bytes = std::sprintf(text, "%d", g_session.m_mercenaryKills); - this->DrawTextAt(245, 157, text, bytes, 1, 14, 0, 0, 0); + { + char level[12] = {}; + _itoa(g_session.m_mercenaryLevel, level, 10); + this->DrawTextAt(135, 47, level, 0, 0, 12, 0, 0, 0); } + if (g_session.m_mercenaryClass == -1) { + return; + } + char text[32] = {}; + int bytes = std::sprintf(text, "%d / %d", g_session.m_mercenaryHp, g_session.m_mercenaryMaxHp); + this->DrawTextAt(218, 70, text, bytes, 1, 14, 0, 0, 0); + bytes = std::sprintf(text, "%d / %d", g_session.m_mercenarySp, g_session.m_mercenaryMaxSp); + this->DrawTextAt(218, 85, text, bytes, 1, 14, 0, 0, 0); + std::strftime(text, 128, LookupMessage(MSI_TIME_TYPE2), _localtime32(&g_session.m_mercenaryExpiration)); + this->DrawTextAt(155, 111, text, static_cast(std::strlen(text)), 0, 12, 255, 0, 0); + bytes = std::sprintf(text, "%d", g_session.m_mercenaryLoyalty); + this->DrawTextAt(170, 133, text, bytes, 1, 14, 0, 0, 0); + bytes = std::sprintf(text, "%d", g_session.m_mercenarySummons); + this->DrawTextAt(170, 157, text, bytes, 1, 14, 0, 0, 0); + bytes = std::sprintf(text, "%d", g_session.m_mercenaryKills); + this->DrawTextAt(245, 157, text, bytes, 1, 14, 0, 0, 0); } // OFFSET: 0x008A6E20 @@ -1554,7 +1561,7 @@ void UIMakeCharWnd::InitHairControls() { if (this->m_hairStyle < 0) { this->m_hairStyle = 0; } - this->m_hairColor = this->m_view.headPalette < 0 ? 0 : this->m_view.headPalette; + this->m_hairColor = this->m_view.headPalette >= 0 ? this->m_view.headPalette : 0; this->m_hairStyleBar = new UIScrollBar(); this->m_hairStyleBar->Configure(10, 190, 0, 130); @@ -2707,17 +2714,19 @@ void UICntWnd::OnCreate(int, int) { this->m_text->Move(15, 6); this->AddChild(this->m_text); - const std::string prefix("유저인터페이스\\"); - const int width = this->geometry.width; - const int height = this->geometry.height; - UIBitmapButton* button = new UIBitmapButton(); - button->SetBitmap((prefix + "btn_ok" + ".bmp").c_str(), 0, 0); - button->SetBitmap((prefix + "btn_ok_a" + ".bmp").c_str(), 1, 0); - button->SetBitmap((prefix + "btn_ok_b" + ".bmp").c_str(), 2, 0); - button->SetSize(button->BitmapWidth(), button->BitmapHeight()); - button->Move(width - 55, height - 32); - button->SetId(184); - this->AddChild(button); + { + const std::string prefix("유저인터페이스\\"); + const int x = this->geometry.width - 55; + const int y = this->geometry.height - 32; + UIBitmapButton* button = new UIBitmapButton(); + button->SetBitmap((prefix + "btn_ok" + ".bmp").c_str(), 0, 0); + button->SetBitmap((prefix + "btn_ok_a" + ".bmp").c_str(), 1, 0); + button->SetBitmap((prefix + "btn_ok_b" + ".bmp").c_str(), 2, 0); + button->SetSize(button->BitmapWidth(), button->BitmapHeight()); + button->Move(x, y); + button->SetId(184); + this->AddChild(button); + } this->m_message0 = 184; } diff --git a/Source/UI/Text/UITextViewer.h b/Source/UI/Text/UITextViewer.h index 3da6dcb35..144675923 100644 --- a/Source/UI/Text/UITextViewer.h +++ b/Source/UI/Text/UITextViewer.h @@ -25,6 +25,11 @@ public: void Clear() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; std::string ItemLinkNumberText(int value); + // INLINED + void SetBackgroundColor(std::uint32_t color) { + this->backgroundColor = color; + this->Invalidate(); + } /* 00D4 */ std::vector links; /* 00E0 */ std::uint32_t backgroundColor;