From c65eb11529fa254a7eca7d6bf099d5f27426595b Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 9 Nov 2026 18:57:42 +0000 Subject: [PATCH] Decompile 6 functions in Source/UI/Buttons/UITextButton.cpp Batch #15260 by Yommy: 0 byte-identical, 6 confirmed by peer review. - fn_11289 UIComboBoxV2Wnd::SelectedText: logic confirmed by peer review - fn_11343 UIBasicItemCtrl::Paint: logic confirmed by peer review - fn_11371 UIMemberListBox::Paint: logic confirmed by peer review - fn_11456 UIMemberListBox::OnMouseHover: logic confirmed by peer review - fn_11460 UITabControl::OnMouseHover: logic confirmed by peer review - fn_11514 UIListBoxID::Refresh: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, kyoshi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Buttons/UITextButton.cpp | 47 +++++++----------------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 8ef410c4b..322b23fc8 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -484,20 +484,10 @@ void UITabControl::OnMouseHover(int x, int y) { return; } - int screenX = 0; - - for (int i = 0; i < index; ++i) { - screenX = (screenX - 1 + this->widths[i]); - } - - int screenY = -20; - - this->ToScreen(screenX, screenY); - - - - - g_modeMgr.gameMode->ShowTooltip(this->tooltips[index].c_str(), screenX, screenY, -1, false, true); + x = TabOffset(*this, index); + y = -20; + this->ToScreen(x, y); + g_modeMgr.gameMode->ShowTooltip(this->tooltips[index].c_str(), x, y, -1, false, true); } // OFFSET: 0x00822660 @@ -617,16 +607,13 @@ void UIServerListBox::OnMouseHover(int x, int y) { // OFFSET: 0x00891BC0 // FUNCTION: fn_11456 void UIMemberListBox::OnMouseHover(int, int y) { + const unsigned visible = + std::min(static_cast(this->geometry.height / this->lineHeight - this->bottomMargin + this->topLine), static_cast(this->lines.size())); const int line = this->topLine + y / this->lineHeight; if (line < this->topLine) { return; } - unsigned visible = static_cast(this->geometry.height / this->lineHeight - this->bottomMargin + this->topLine); - if (this->lines.size() < visible) { - visible = static_cast(this->lines.size()); - } - if (line >= static_cast(visible)) { return; } @@ -1362,12 +1349,7 @@ void UIComboBoxID::Resize(int width, int height) { void UIListBoxID::Refresh() { const int visible = this->geometry.height / this->lineHeight; const int count = static_cast(this->lines.size()); - int overflow = count - visible; - - if (overflow < 0) { - overflow = 0; - } - + const int overflow = std::max(count - visible, 0); this->verticalOverflow = overflow != 0; auto* bar = this->verticalBar; @@ -2276,10 +2258,7 @@ void UIMemberListBox::Paint() { this->ClearSurface((this->backgroundRed & 255) | ((this->backgroundGreen & 255) << 8) | ((this->backgroundBlue & 255) << 16)); const int first = this->topLine; - unsigned end = static_cast(this->geometry.height / this->lineHeight - this->bottomMargin + first); - if (this->lines.size() < end) { - end = static_cast(this->lines.size()); - } + const unsigned end = std::min(static_cast(this->geometry.height / this->lineHeight - this->bottomMargin + first), static_cast(this->lines.size())); for (int index = first, row = 0; index < static_cast(end); ++index, ++row) { if (index == this->selected) { @@ -2295,11 +2274,8 @@ void UIMemberListBox::Paint() { // FUNCTION: fn_11343 void UIBasicItemCtrl::Paint() { this->ClearSurface(0xFFFF00FF); - const char* name = "유저인터페이스\\basic_interface\\itemwin_mid.bmp"; - if (std::atoi(this->m_item.itemId.c_str()) > 0 && this->m_item.identity[1] == 0) { - name = "유저인터페이스\\ExMacro\\no_item.bmp"; - } - + const char* name = std::atoi(this->m_item.itemId.c_str()) <= 0 || this->m_item.identity[1] > 0 ? "유저인터페이스\\basic_interface\\itemwin_mid.bmp" + : "유저인터페이스\\ExMacro\\no_item.bmp"; this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve(name))), false); this->DrawItemIcon(4, 0, 0, false); } @@ -2615,8 +2591,7 @@ std::string UIComboBoxV2Wnd::SelectedText() { return std::string(); } - const std::string& text = this->list->lines[index].text; - return std::string(text.c_str(), text.size()); + return this->list->lines[index].text; } // OFFSET: 0x00880FF0