From 8bfebeaa17f7c62ccbfe11f4632903aea6dbda87 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 16:01:02 +0000 Subject: [PATCH] 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). --- Source/Contents/UserData/NormalItemSlots.cpp | 10 +++++----- Source/Contents/UserData/NormalItemSlots.h | 2 +- Source/UI/Shortcuts/UIShortCutWnd.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Contents/UserData/NormalItemSlots.cpp b/Source/Contents/UserData/NormalItemSlots.cpp index 1f47a308..441c90d7 100644 --- a/Source/Contents/UserData/NormalItemSlots.cpp +++ b/Source/Contents/UserData/NormalItemSlots.cpp @@ -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; } diff --git a/Source/Contents/UserData/NormalItemSlots.h b/Source/Contents/UserData/NormalItemSlots.h index e303d72a..dad8817c 100644 --- a/Source/Contents/UserData/NormalItemSlots.h +++ b/Source/Contents/UserData/NormalItemSlots.h @@ -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) diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index fe1f50e0..6712d29e 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -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(); }