Decompile fn_13667 (NormalItemSlotWindow::IsValid)

Batch #12260 by cremane: 0 byte-identical, 1 confirmed by peer review.

- fn_13667 NormalItemSlotWindow::IsValid: logic confirmed by peer review

Peer-reviewed-by: Yommy, dori, codeplay
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-11-05 16:01:02 +00:00
commit 8bfebeaa17
3 changed files with 7 additions and 7 deletions

View file

@ -25,13 +25,13 @@ void NormalItemSlotWindow::Reset() {
// OFFSET: 0x009A6000
// FUNCTION: fn_13667
bool NormalItemSlotWindow::IsValid(int screenWidth, int screenHeight, bool active) const {
if (this->width != 290 || this->height < 43 || this->height > 175 || (this->height - 10) % 33 != 0 || (this->height == 175 && !active)) {
return false;
int NormalItemSlotWindow::IsValid() const {
if (this->width != 290 || this->height > 175 || this->height < 43 || (this->height - 10) % 33 != 0 || (this->height == 175 && !g_session.ItemSlotActive())) {
return 0;
}
const int maxX = screenWidth - 290;
const int maxY = screenHeight - this->height;
const int maxX = g_renderer->viewport.width - 290;
const int maxY = g_renderer->viewport.height - this->height;
return this->x >= 0 && this->x <= maxX && this->y >= 0 && this->y <= maxY;
}

View file

@ -26,7 +26,7 @@ struct NormalItemSlotWindow {
/* 000C */ int height;
/* 0010 */ int show;
void Reset();
bool IsValid(int screenWidth, int screenHeight, bool active) const;
int IsValid() const;
};
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -263,7 +263,7 @@ inline void UIShortCutWnd::ResizeRows() {
// INLINED
inline void UIShortCutWnd::RestoreLayout(NormalItemSlotWindow* value) {
this->m_saved = value;
if (!value->IsValid(g_windowMgr.unknown_047C, g_windowMgr.unknown_0480, g_session.ItemSlotActive())) {
if (!value->IsValid()) {
value->Reset();
}