From b295776576ff7a4fc848dddfe23fdbaa8bcaccc2 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 10:16:42 +0000 Subject: [PATCH] Decompile fn_13416 (UISkillListWnd::UpdateScrollBar) Batch #7551 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_13416 UISkillListWnd::UpdateScrollBar: 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/Edit/UIEditCtrl.cpp | 51 ++++++++++++++++++++++++++++++ Source/UI/Item/UIItemStoreSubWnd.h | 4 +++ Source/UI/Shop/UIMerchantItemWnd.h | 1 + Source/UI/Skill/UISkillListWnd.h | 6 +++- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index ca4bb78b..7b3d56a9 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -995,6 +995,8 @@ void UIItemStoreFindWnd::Slot10(int x, int y, std::intptr_t value) { g_modeMgr.GetGameMode()->SendMsg(18, 0, 0, 0, 0); } +// OFFSET: 0x00972570 + // OFFSET: 0x009727F0 // FUNCTION: fn_13275 void UIItemWnd::Slot10(int x, int y, std::intptr_t value) { @@ -2217,6 +2219,12 @@ bool UIItemStoreSubWnd::Sort3() { return true; } +// OFFSET: 0x00995CF0 + +// OFFSET: 0x00995D50 + +// OFFSET: 0x00995DB0 + // OFFSET: 0x00996940 // FUNCTION: fn_13473 void UIItemStoreSubWnd::SetTabIndex(int index) { @@ -2498,6 +2506,8 @@ void UIMerchantItemShopWnd::Slot10(int x, int y, std::intptr_t value) { g_windowMgr.window_01EC->SendMsg(nullptr, 13, 11, 0, 0, 0); } +// OFFSET: 0x00972C00 + // OFFSET: 0x0089CAE0 // FUNCTION: fn_11591 void UIEditCtrl_Custom::Trim() { @@ -2867,6 +2877,47 @@ void UIItemBaseWnd::Slot35(int value) { } } +// OFFSET: 0x0098A3A0 + +// OFFSET: 0x0098A6F0 +// FUNCTION: fn_13416 +void UISkillListWnd::UpdateScrollBar() { + UIScrollBar* bar = static_cast(this->scrollBar); + if (!bar) { + return; + } + + const int visible = this->visibleRows; + const int rows = (this->skills.size() % this->columns != 0) + this->skills.size() / this->columns; + int overflow = rows - visible; + if (overflow < 0) { + overflow = 0; + } + + this->unknown_0128 = overflow != 0; + if (overflow != 0) { + bar->SetRange(overflow, visible, rows); + int position = this->scroll; + if (position < 0) { + this->scroll = 0; + position = 0; + } + + const int last = rows - this->visibleRows; + if (position > last) { + this->scroll = last; + position = last; + } + + static_cast(this->scrollBar)->SetPosition(position); + } else { + this->scroll = 0; + bar->SetRange(0, visible, rows); + } + + this->scrollBar->Invalidate(); +} + // OFFSET: 0x0098A2B0 // FUNCTION: fn_13410 void UIItemStoreFindWnd::Slot35(int value) { diff --git a/Source/UI/Item/UIItemStoreSubWnd.h b/Source/UI/Item/UIItemStoreSubWnd.h index 1bf3752c..5bbe1cf4 100644 --- a/Source/UI/Item/UIItemStoreSubWnd.h +++ b/Source/UI/Item/UIItemStoreSubWnd.h @@ -10,6 +10,7 @@ class UIItemStoreSubWnd : public UIItemBaseWnd { public: void Slot28(int x, int y) override; void Slot32(int x, int y) override; + void Slot10(int x, int y, std::intptr_t value) override; void Slot11() override; void Slot25(int x, int y) override; void Slot26(int x, int y) override; @@ -20,6 +21,9 @@ public: bool Sort1(); bool Sort2(); bool Sort3(); + bool SortReversed1(); + bool SortReversed2(); + bool SortReversed3(); bool sub_996950(); bool sub_996AF0(); bool sub_996C90(); diff --git a/Source/UI/Shop/UIMerchantItemWnd.h b/Source/UI/Shop/UIMerchantItemWnd.h index 9a1cbc07..54567b54 100644 --- a/Source/UI/Shop/UIMerchantItemWnd.h +++ b/Source/UI/Shop/UIMerchantItemWnd.h @@ -8,6 +8,7 @@ class UIMerchantItemWnd : public UIItemBaseWnd { public: + void Slot10(int x, int y, std::intptr_t value) override; void Slot11() override; void Paint() override; void Slot28(int x, int y) override; diff --git a/Source/UI/Skill/UISkillListWnd.h b/Source/UI/Skill/UISkillListWnd.h index 13454990..e5df2568 100644 --- a/Source/UI/Skill/UISkillListWnd.h +++ b/Source/UI/Skill/UISkillListWnd.h @@ -15,13 +15,17 @@ public: void Slot26(int x, int y) override; void Slot32(int x, int y) override; void Slot33(int x, int y) override; + void Slot35(int value) override; __declspec(noinline) int SkillAt(int x, int y); __declspec(noinline) CSkillInfo GetSkillByIndex(int index); CSkillInfo GetSkillAt(int x, int y); CSkillInfo GetVisibleSkill(int row); + void UpdateScrollBar(); - /* 00BC */ unsigned char unknown_00BC[0x5C]; + /* 00B4 */ int unknown_00B4; + /* 00B8 */ UIWindow* scrollBar; + /* 00BC */ unsigned char unknown_00BC[0x54]; /* 0118 */ int hovered; /* 011C */ int scroll; /* 0120 */ int columns;