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).
This commit is contained in:
ragnarok-clanker 2026-10-31 10:16:42 +00:00
commit b295776576
4 changed files with 61 additions and 1 deletions

View file

@ -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<UIScrollBar*>(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<UIScrollBar*>(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) {

View file

@ -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();

View file

@ -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;

View file

@ -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;