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