Decompile 2 functions in Source/UI/Items/MergeItemWnd.cpp, Source/UI/Items/MergeItemWnd.h

Batch #5300 by eAthena: 0 byte-identical, 2 confirmed by peer review.

- fn_09672 CMergeItemWnd::UpdateScroll: logic confirmed by peer review
- fn_09673 CMergeItemWnd::Resize: logic confirmed by peer review

Peer-reviewed-by: meitogi, alisonrag, sherollyner
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-30 10:19:34 +00:00
commit 59d5f15bdf
2 changed files with 46 additions and 5 deletions

View file

@ -5,10 +5,10 @@
#include "Contents/MessageTable.h"
#include "Network/Connection/Connection.h"
#include "UI/Buttons/UICheckBox.h"
#include "UI/Lists/UIScrollBar.h"
#include "UI/Layout/WindowSnapping.h"
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Math/AffineMatrix.h"
#include <cstdlib>
#include <windows.h>
@ -112,6 +112,44 @@ int CMergeItemWnd::ItemAt(int x, int y) {
return -1;
}
// OFFSET: 0x007DFF10
// FUNCTION: fn_09672
void CMergeItemWnd::UpdateScroll() {
if (this->m_scrollBar == nullptr) {
return;
}
const int columns = (this->geometry.width - this->m_marginRight - this->m_gridLeft) / this->m_cellSize;
const int rows = this->m_itemCount / columns;
const int total = rows > 0 ? rows + 1 : rows;
int maximum = total - this->m_rows;
if (maximum <= 0) {
maximum = 0;
this->m_scrollRow = 0;
} else if (this->m_scrollRow < 0) {
this->m_scrollRow = 0;
} else if (this->m_scrollRow > maximum) {
this->m_scrollRow = maximum;
}
this->m_scrollable = maximum;
this->m_scrollBar->SetRange(maximum, this->m_rows, total);
this->m_scrollBar->SetPosition(this->m_scrollRow);
this->m_scrollBar->Invalidate();
}
// OFFSET: 0x007DFFC0
// FUNCTION: fn_09673
void CMergeItemWnd::Resize(int width, int height) {
UIWindow::Resize(width, height);
this->m_mergeButton->Move(width - 110, height - 25);
this->m_cancelButton->Move(width - 60, height - 25);
this->m_closeButton->Move(width - 14, 3);
this->unknown_00F8->Move(width - 15, height - 15);
this->m_scrollBar->Move(width - 15, 17);
this->m_scrollBar->Resize(this->m_scrollBar->geometry.width, this->geometry.height - 38);
this->UpdateScroll();
}
// OFFSET: 0x007E0060
// FUNCTION: fn_09674
void CMergeItemWnd::FitToGrid(int width, int height) {

View file

@ -7,10 +7,12 @@
#include <vector>
class UICheckBox;
class UIScrollBar;
class CMergeItemWnd : public UIFrameWnd {
public:
~CMergeItemWnd() override;
void Resize(int width, int height) override;
void Slot19() override;
void Slot25(int x, int y) override;
void Slot35(int delta) override;
@ -19,6 +21,7 @@ public:
__declspec(noinline) int ItemAt(int x, int y);
void FitToGrid(int width, int height);
bool RequestMerge();
__declspec(noinline) void UpdateScroll();
/* 00B4 */ int m_cellSize;
/* 00B8 */ int m_gridTop;
@ -31,12 +34,12 @@ public:
/* 00D4 */ int unknown_00D4;
/* 00D8 */ int m_slotRadius;
/* 00DC */ unsigned int m_minSelection;
/* 00E0 */ int unknown_00E0;
/* 00E4 */ int unknown_00E4;
/* 00E8 */ int unknown_00E8;
/* 00E0 */ UIWindow* m_mergeButton;
/* 00E4 */ UIWindow* m_cancelButton;
/* 00E8 */ UIWindow* m_closeButton;
/* 00EC */ std::vector<UICheckBox*> m_items;
/* 00F8 */ UIWindow* unknown_00F8;
/* 00FC */ UIWindow* m_scrollBar;
/* 00FC */ UIScrollBar* m_scrollBar;
/* 0100 */ int m_itemCount;
/* 0104 */ int m_columns;
/* 0108 */ int m_rows;