From 70f3e36c88987f21fc9df9fa51caebb39b6f7409 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 3 Nov 2026 10:07:55 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Family G19: remove WindowOrdering, WindowDropDown, WindowMouseHit and the dead WindowMouseCaptur Batch #10231 by ragnarok-clanker: forced by an admin (5 lower score(s), 39 changed function(s)); checked with 495 compiled unit(s), including every includer of Source/Client/Mode/ModeTooltip.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Lists/UIDropDownBox.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/UI/Window/WindowMouseHit.h, Source/UI/Window/WindowOrdering.h. Deletes: Source/UI/Window/WindowOrdering.h --- Source/Client/Mode/ModeTooltip.cpp | 2 +- Source/Client/Mode/ModeTooltip.h | 4 +- Source/Client/Session.cpp | 3 +- Source/Contents/ClientItemLists.cpp | 9 +- Source/Contents/Messenger/ClientMessenger.cpp | 3 +- Source/Contents/NavigationRoute.cpp | 3 +- Source/Contents/Party/PartyInfoCompletion.cpp | 3 +- Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 23 +-- Source/UI/AdventureGuide/UIAdventureGuide.cpp | 2 +- Source/UI/AdventureGuide/UIAdventureGuide.h | 1 - Source/UI/Edit/UIEditCtrl.cpp | 3 +- Source/UI/GameSettings/GameSettingsUI.cpp | 21 +- Source/UI/Lists/UIDropDownBox.cpp | 38 ++-- Source/UI/Lists/UIDropDownBox.h | 9 - Source/UI/MiniPartyManager.cpp | 6 +- Source/UI/Party/UIAdvenPartyBoardWnd.cpp | 9 +- Source/UI/Shortcuts/ShortcutVisibility.cpp | 7 +- Source/UI/UIItemReformWnd.cpp | 3 +- Source/UI/UIRoundBoxTooltipWnd.cpp | 3 +- Source/UI/Window/UIBasicInfoWnd.cpp | 3 +- Source/UI/Window/UIHotKeyWnd.cpp | 3 +- Source/UI/Window/UINewSelectCharWnd.cpp | 3 +- Source/UI/Window/UIWindowMgr.h | 6 + Source/UI/Window/UIWindowMgr.inl | 5 +- Source/UI/Window/WindowMgrState.cpp | 2 +- Source/UI/Window/WindowMouseHit.cpp | 194 ++---------------- Source/UI/Window/WindowMouseHit.h | 47 ----- Source/UI/Window/WindowOrdering.cpp | 13 +- Source/UI/Window/WindowOrdering.h | 20 -- 29 files changed, 95 insertions(+), 353 deletions(-) delete mode 100644 Source/UI/Window/WindowOrdering.h diff --git a/Source/Client/Mode/ModeTooltip.cpp b/Source/Client/Mode/ModeTooltip.cpp index af682579..5a244b64 100644 --- a/Source/Client/Mode/ModeTooltip.cpp +++ b/Source/Client/Mode/ModeTooltip.cpp @@ -2,7 +2,7 @@ #include "Client/Mode/CMode.h" #include "Client/Mode/ModeTooltip.h" #include "UI/Text/UITransBalloonText.h" -#include "UI/Window/WindowOrdering.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIWindowMgr.h" #include diff --git a/Source/Client/Mode/ModeTooltip.h b/Source/Client/Mode/ModeTooltip.h index d867a8ca..4a428145 100644 --- a/Source/Client/Mode/ModeTooltip.h +++ b/Source/Client/Mode/ModeTooltip.h @@ -6,14 +6,14 @@ class UITransBalloonText; class UIWindow; -struct WindowOrdering; +class UIWindowMgr; class UIWindowMgr; struct ModeTooltip { UITransBalloonText*& window; std::uint32_t& tick; std::list& rendered; - WindowOrdering& ordering; + UIWindowMgr& ordering; const int& screenWidth; const int& screenHeight; diff --git a/Source/Client/Session.cpp b/Source/Client/Session.cpp index 938ff129..b63ee486 100644 --- a/Source/Client/Session.cpp +++ b/Source/Client/Session.cpp @@ -24,7 +24,6 @@ #include "UI/Window/UIBasicInfoWnd.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIWindow.h" -#include "UI/Window/WindowOrdering.h" #include "Contents/Configuration/ServiceOptions.h" #include "Contents/Configuration/ServiceConfiguration.h" #include "Client/Application/ErrorDialog.h" @@ -2606,7 +2605,7 @@ void CSession::RefreshSkillTree() { // OFFSET: 0x00DF9500 // FUNCTION: fn_23518 void CSession::InvalidateWindowFrames() { - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); } // OFFSET: 0x00DE3670 diff --git a/Source/Contents/ClientItemLists.cpp b/Source/Contents/ClientItemLists.cpp index 1beea84e..ad42be0b 100644 --- a/Source/Contents/ClientItemLists.cpp +++ b/Source/Contents/ClientItemLists.cpp @@ -17,7 +17,6 @@ #include "UI/Items/UIEquipWnd.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include #include @@ -1189,7 +1188,7 @@ bool CSession::EquipUnknown17F0(const ITEM_INFO& item, const char* name) { g_equipmentPropertiesMgr = new (std::nothrow) EquipmentProperties::CEquipmentPropertiesMgr; } g_equipmentPropertiesMgr->EquipWearable(&item, *name == '\0'); - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); return true; } @@ -1222,7 +1221,7 @@ bool CSession::OnItemEquipped(ITEM_INFO& item) { g_equipmentPropertiesMgr = new (std::nothrow) EquipmentProperties::CEquipmentPropertiesMgr; } g_equipmentPropertiesMgr->EquipWearable(&item, true); - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); } if (item.unknown_0000[3] != 0x8000) { @@ -1262,7 +1261,7 @@ bool CSession::UnequipItem(int location, std::uint32_t identity) { g_windowMgr.SendNotice(1, reinterpret_cast(FormatOwnedString("%s%s", item.DisplayName(0).c_str(), LookupMessage(0xAB)).c_str()), 0xFF, 7, 0, 0); } this->unknown_16EC = 0; - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); if (mode != nullptr) { @@ -1319,7 +1318,7 @@ bool CSession::UnequipItem(int location, std::uint32_t identity) { g_equipmentPropertiesMgr = new (std::nothrow) EquipmentProperties::CEquipmentPropertiesMgr; } g_equipmentPropertiesMgr->UnequipWearable(location); - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); if (UIWindow* window = g_windowMgr.unknown_022C) { window->SendMsg(nullptr, 60, 0, 0, 0, 0); } diff --git a/Source/Contents/Messenger/ClientMessenger.cpp b/Source/Contents/Messenger/ClientMessenger.cpp index 3fe8df28..7bea0922 100644 --- a/Source/Contents/Messenger/ClientMessenger.cpp +++ b/Source/Contents/Messenger/ClientMessenger.cpp @@ -11,7 +11,6 @@ #include "Script/LuaInstance.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include "Resource/World/TerrainResource.h" #include "Contents/Actors/Pc.h" #include "Client/Application/ErrorDialog.h" @@ -5597,7 +5596,7 @@ void SessionMessengerContext::ResetEquipment() { } RequestBasicInfoRefresh(); EquipmentProperties::CEquipmentPropertiesMgr::GetInstance()->Clear(); - reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + g_windowMgr.InvalidateFrames(); } // OFFSET: 0x00DD8660 diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index 42744817..84dd7be3 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -17,7 +17,6 @@ #include "UI/Navigation/UINavigationV4Wnd.h" #include "UI/Window/UINavigationWnd.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include "UI/Window/UIPayConfirmWnd.h" #include "UI/Window/WindowDialogs.h" #include "Utility/RegistryKey.h" @@ -756,7 +755,7 @@ bool CNavigationManager::sub_B995D0(std::string name, int type, bool flag) { } } - reinterpret_cast(g_windowMgr).Promote(g_navigationWindow); + g_windowMgr.Promote(g_navigationWindow); } return true; diff --git a/Source/Contents/Party/PartyInfoCompletion.cpp b/Source/Contents/Party/PartyInfoCompletion.cpp index 513f1ed8..8a7e8938 100644 --- a/Source/Contents/Party/PartyInfoCompletion.cpp +++ b/Source/Contents/Party/PartyInfoCompletion.cpp @@ -7,7 +7,6 @@ #include "UI/Party/UIApplyForPartyWnd.h" #include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include #include @@ -71,7 +70,7 @@ void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::st if (application) { application->SetInfo(info); - reinterpret_cast(g_windowMgr).Promote(application); + g_windowMgr.Promote(application); } if (info.minimumLevel > g_session.m_level || info.maximumLevel < g_session.m_level) { diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index f42a7b8b..089545b7 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -124,7 +124,6 @@ #include "UI/Window/FuncDrawWNDChar.h" #include "UI/Lists/UITabControl.h" #include "UI/Window/WindowManagerWindows.h" -#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include "Utility/Text/TextTokens.h" #include "Contents/PlayerNameDictionary.h" @@ -2175,7 +2174,7 @@ int UIMenuWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intp void UITipboxWnd::ShowTip(int id) { g_itemTagOwner->SelectTip(id); this->SendMsg(this, 6, 543, 0, 0, 0); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); } // OFFSET: 0x008F5AF0 @@ -3075,7 +3074,7 @@ int UIEquipWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int this->Resize(this->geometry.width, 17); } g_windowMgr.StoreSnapRectangle(this); - WindowOrdering{g_windowMgr.rendered, g_windowMgr, reinterpret_cast(g_windowMgr.modal), g_windowMgr.window_4F174}.Promote(this); + g_windowMgr.Promote(this); const int delta = this->geometry.height - height; if (delta != 0) { g_snapMgr.MoveEdge(this, 0, delta, 3); @@ -3499,7 +3498,7 @@ int UIBookWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intp } } this->Invalidate(); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); break; } @@ -5353,7 +5352,7 @@ int UIMonsterDisplayWnd::SendMsg(UIWindow* sender, int message, std::intptr_t ar if (message == 62) { this->m_name = reinterpret_cast(argument1); this->Invalidate(); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); return 0; } @@ -5367,7 +5366,7 @@ int UINotifyJobLevelUpWnd::SendMsg(UIWindow* sender, int message, std::intptr_t return UIWindow::SendMsg(sender, message, a, b, c, d); } if (a == 192) { - reinterpret_cast(g_windowMgr).Promote(g_windowMgr.EnsureWindow(37)); + g_windowMgr.Promote(g_windowMgr.EnsureWindow(37)); } return 0; } @@ -5673,7 +5672,7 @@ int UINotifyQuestWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, st } if (a == 192) { if (UIWindow* window = g_windowMgr.EnsureWindow(0x2718)) { - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } } return 0; @@ -5765,7 +5764,7 @@ int UINotifyLevelUpWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (window->geometry.height == 17) { window->SendMsg(nullptr, 6, 0xCA, 0, 0, 0); } - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } return 0; } @@ -6985,7 +6984,7 @@ int UISkillDescribeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (window) { static_cast(window)->SetSkill(this->m_skillId); window->PlaceBeside(this); - WindowOrdering{g_windowMgr.rendered, *reinterpret_cast(&g_windowMgr), reinterpret_cast(g_windowMgr.modal), g_windowMgr.window_4F174}.Promote(window); + g_windowMgr.Promote(window); } } return 0; @@ -7067,7 +7066,7 @@ int UISkillDescribeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, this->m_viewer->Resize(this->m_viewer->geometry.width, viewerHeight); this->Resize(this->geometry.width, total + 6); this->Invalidate(); - WindowOrdering{g_windowMgr.rendered, *reinterpret_cast(&g_windowMgr), reinterpret_cast(g_windowMgr.modal), g_windowMgr.window_4F174}.Promote(this); + g_windowMgr.Promote(this); return 0; } @@ -7306,7 +7305,7 @@ int UIStatusWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in this->Resize(this->geometry.width, 17); } g_windowMgr.StoreSnapRectangle(this); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); const int delta = this->geometry.height - height; if (delta != 0) { g_snapMgr.MoveEdge(this, 0, delta, 3); @@ -8172,7 +8171,7 @@ int UICardItemIllustWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, this->m_bitmapPath += name; this->m_bitmapPath += ".bmp"; this->Invalidate(); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); return 0; } } diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index eaac10a1..e36068a2 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -2687,7 +2687,7 @@ void CUIMonster::SearchNavigation() { g_navigationManager.ClearSavedTarget(); g_windowMgr.CloseWindow(314); static_cast(g_navigationWindow)->RefreshLayout(); - reinterpret_cast(g_windowMgr).Promote(g_windowMgr.LookupWindow(203)); + g_windowMgr.Promote(g_windowMgr.LookupWindow(203)); } else { g_windowMgr.EnsureWindow(203); } diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index b939ab93..38338bf6 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -6,7 +6,6 @@ #include "UI/Navigation/UINavigationV4Wnd.h" #include "UI/Window/UIControl.h" #include "UI/Window/UINavigationWnd.h" -#include "UI/Window/WindowOrdering.h" #include diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 82010114..f2ae6ce4 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -10,7 +10,6 @@ #include "Resource/SkinPalette.h" #include "Contents/Configuration/GameSettingsMgr.h" #include "UI/Layout/SnapMgr.h" -#include "UI/Window/WindowOrdering.h" #include "Contents/SkinMgr.h" #include "Resource/TextureNames.h" #include "Resource/Bitmap/BitmapImage.h" @@ -7727,7 +7726,7 @@ int UIItemWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intp this->Resize(this->geometry.width, 17); } g_windowMgr.StoreSnapRectangle(this); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); const int delta = this->geometry.height - height; if (delta != 0) { g_snapMgr.MoveEdge(this, 0, delta, 3); diff --git a/Source/UI/GameSettings/GameSettingsUI.cpp b/Source/UI/GameSettings/GameSettingsUI.cpp index c70f0357..20a9d79f 100644 --- a/Source/UI/GameSettings/GameSettingsUI.cpp +++ b/Source/UI/GameSettings/GameSettingsUI.cpp @@ -28,7 +28,6 @@ #include "UI/Window/UIRoulletteWnd.h" #include "UI/Lists/UIDropDownBox.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include "UI/Window/WindowBorder.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/StringUtil.h" @@ -195,12 +194,11 @@ void GameSettingsUI::CUIGroupSkin::Slot15(int width, int height) { combo->unknown_0088->Move(combo->geometry.width - 18, 0); combo->unknown_0088->SetImages(normalName, hoverName, pressedName, disabledName); combo->unknown_0088->SetOnClick([combo]() { - WindowDropDown dropDown{reinterpret_cast(g_windowMgr), reinterpret_cast(g_windowMgr.window_0A30)}; - if (!dropDown.Close()) { + if (!g_windowMgr.CloseDropDown()) { int x = 0; int y = combo->geometry.height - 1; combo->ToScreen(x, y); - dropDown.Show(combo, combo->listBox, x, y); + g_windowMgr.ShowDropDown(combo, combo->listBox, x, y); } }); combo->AddChild(combo->unknown_0088); @@ -308,13 +306,11 @@ template void CUIComboBox::Create(int width, int itemHe this->button->SetSize(display->geometry.width, display->geometry.height); this->button->Move(display->geometry.x, display->geometry.y); this->button->SetOnClick([this]() { - WindowOrdering ordering{g_windowMgr.rendered, *reinterpret_cast(&g_windowMgr), reinterpret_cast(g_windowMgr.modal), g_windowMgr.window_4F174}; - WindowDropDown dropDown{ordering, reinterpret_cast(g_windowMgr.window_0A30)}; - if (!dropDown.Close()) { + if (!g_windowMgr.CloseDropDown()) { int x = 0; int y = this->geometry.height - 1; this->ToScreen(x, y); - dropDown.Show(this, this->listBox, x, y); + g_windowMgr.ShowDropDown(this, this->listBox, x, y); } }); this->AddChild(this->button); @@ -325,9 +321,7 @@ template void CUIComboBox::Create(int width, int itemHe this->listBox->SetSize(this->width + 13, this->itemHeight); this->listBox->Move(1, 1); this->listBox->SetOnSelect([this, display](T* item, const D& value) { - WindowOrdering ordering{g_windowMgr.rendered, *reinterpret_cast(&g_windowMgr), reinterpret_cast(g_windowMgr.modal), g_windowMgr.window_4F174}; - WindowDropDown dropDown{ordering, reinterpret_cast(g_windowMgr.window_0A30)}; - dropDown.Close(); + g_windowMgr.CloseDropDown(); if (this->onChange) { this->onChange(display, value); } @@ -387,12 +381,11 @@ void CUIComboBox::SetButton(const std::string& normal, const std::string& this->unknown_0088->Move(this->geometry.width - 18, 0); this->unknown_0088->SetImages(normal, hover, pressed, disabled); this->unknown_0088->SetOnClick([this]() { - WindowDropDown dropDown{reinterpret_cast(g_windowMgr), reinterpret_cast(g_windowMgr.window_0A30)}; - if (!dropDown.Close()) { + if (!g_windowMgr.CloseDropDown()) { int x = 0; int y = this->geometry.height - 1; this->ToScreen(x, y); - dropDown.Show(this, this->listBox, x, y); + g_windowMgr.ShowDropDown(this, this->listBox, x, y); } }); this->AddChild(this->unknown_0088); diff --git a/Source/UI/Lists/UIDropDownBox.cpp b/Source/UI/Lists/UIDropDownBox.cpp index fb1122c2..60c7fb4e 100644 --- a/Source/UI/Lists/UIDropDownBox.cpp +++ b/Source/UI/Lists/UIDropDownBox.cpp @@ -1,7 +1,7 @@ #include "Render/DeviceContext/DeviceContext.h" #include "UI/Lists/UIDropDownBox.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowBorder.h" -#include "UI/Window/WindowOrdering.h" #include @@ -63,37 +63,39 @@ void CUIDropDownBox::Paint() { // OFFSET: 0x00AA27B0 // FUNCTION: fn_17217 -void WindowDropDown::Show(UIWindow* owner, UIWindow* child, int x, int y) { - if (this->popup && this->popup->geometry.visible != 0) { - this->popup->Detach(); - this->popup->Show(0); +void UIWindowMgr::ShowDropDown(UIWindow* owner, UIWindow* child, int x, int y) { + CUIDropDownBox*& popup = popup; + if (popup && popup->geometry.visible != 0) { + popup->Detach(); + popup->Show(0); } - if (!this->popup) { - this->popup = new CUIDropDownBox(); + if (!popup) { + popup = new CUIDropDownBox(); } - this->popup->Attach(owner, child); - this->popup->Move(x, y); + popup->Attach(owner, child); + popup->Move(x, y); - auto& rendered = this->ordering.rendered; - if (std::find(rendered.begin(), rendered.end(), this->popup) == rendered.end()) { - rendered.push_back(this->popup); + auto& rendered = this->rendered; + if (std::find(rendered.begin(), rendered.end(), popup) == rendered.end()) { + rendered.push_back(popup); } else { - this->ordering.Promote(this->popup); + this->Promote(popup); } - this->popup->Show(1); + popup->Show(1); } // OFFSET: 0x00A8C750 // FUNCTION: fn_17133 -bool WindowDropDown::Close() { - if (!this->popup || this->popup->geometry.visible == 0) { +bool UIWindowMgr::CloseDropDown() { + CUIDropDownBox* popup = static_cast(this->window_0A30); + if (!popup || popup->geometry.visible == 0) { return false; } - this->popup->Detach(); - this->popup->Show(0); + popup->Detach(); + popup->Show(0); return true; } diff --git a/Source/UI/Lists/UIDropDownBox.h b/Source/UI/Lists/UIDropDownBox.h index 02a83d24..ebfb4eec 100644 --- a/Source/UI/Lists/UIDropDownBox.h +++ b/Source/UI/Lists/UIDropDownBox.h @@ -3,7 +3,6 @@ #include "UI/Window/UIControl.h" -struct WindowOrdering; class CUIDropDownBox : public CUIControl { public: @@ -18,14 +17,6 @@ public: /* 0080 */ UIWindow* owner; }; -struct WindowDropDown { - WindowOrdering& ordering; - CUIDropDownBox*& popup; - - void Show(UIWindow* owner, UIWindow* child, int x, int y); - bool Close(); -}; - #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(CUIDropDownBox) == 136); #endif diff --git a/Source/UI/MiniPartyManager.cpp b/Source/UI/MiniPartyManager.cpp index 1f5d0947..843d7a44 100644 --- a/Source/UI/MiniPartyManager.cpp +++ b/Source/UI/MiniPartyManager.cpp @@ -10,7 +10,6 @@ #include "UI/Window/UIWindow.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/WindowManagerWindows.h" -#include "UI/Window/WindowOrdering.h" #include // OFFSET: 0x007435C0 @@ -154,10 +153,9 @@ void UIWindowMgr::RebuildMiniPartyWindows() { } } - WindowOrdering ordering{this->rendered, *this, reinterpret_cast(this->modal), this->window_4F174}; if (this->Window4F250Ready()) { - ordering.Promote(this->window_4F250); + this->Promote(this->window_4F250); } - ordering.Promote(this->unknown_0210); + this->Promote(this->unknown_0210); } diff --git a/Source/UI/Party/UIAdvenPartyBoardWnd.cpp b/Source/UI/Party/UIAdvenPartyBoardWnd.cpp index 7e0449e1..d9135375 100644 --- a/Source/UI/Party/UIAdvenPartyBoardWnd.cpp +++ b/Source/UI/Party/UIAdvenPartyBoardWnd.cpp @@ -18,7 +18,6 @@ #include "UI/Text/UIStaticText.h" #include "Render/Renderer.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include #include @@ -474,7 +473,7 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (window) { window->SetInfo(info); - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } } else { g_windowMgr.CloseWindow(323); @@ -482,7 +481,7 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (window) { window->SetInfo(info); - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } } @@ -502,7 +501,7 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (window) { window->SetInfo(this->ownParty->info); - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } break; @@ -512,7 +511,7 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a UIWindow* window = g_windowMgr.EnsureWindow(323); if (window) { - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); } break; diff --git a/Source/UI/Shortcuts/ShortcutVisibility.cpp b/Source/UI/Shortcuts/ShortcutVisibility.cpp index 195d2e96..98410f70 100644 --- a/Source/UI/Shortcuts/ShortcutVisibility.cpp +++ b/Source/UI/Shortcuts/ShortcutVisibility.cpp @@ -3,7 +3,6 @@ #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIWindowMgr.inl" -#include "UI/Window/WindowOrdering.h" // OFFSET: 0x00AAA310 // FUNCTION: fn_17269 @@ -28,7 +27,7 @@ bool UIWindowMgr::ShowWindowById(int id, int visible) { return true; } - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); return true; } @@ -40,7 +39,7 @@ bool UIWindowMgr::ShowWindowById(int id, int visible) { } if (visible != 0) { - reinterpret_cast(g_windowMgr).Promote(this->window_01EC); + g_windowMgr.Promote(this->window_01EC); } return false; @@ -71,7 +70,7 @@ bool UIWindowMgr::ShowWindowById(int id, int visible) { return true; } - reinterpret_cast(g_windowMgr).Promote(window); + g_windowMgr.Promote(window); return true; } diff --git a/Source/UI/UIItemReformWnd.cpp b/Source/UI/UIItemReformWnd.cpp index 4f4421a1..34e47749 100644 --- a/Source/UI/UIItemReformWnd.cpp +++ b/Source/UI/UIItemReformWnd.cpp @@ -24,7 +24,6 @@ #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowBorder.h" #include "UI/Window/WindowManagerWindows.h" -#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include @@ -285,7 +284,7 @@ void UIItemReformWnd_DetailBtn::Slot48() { // FUNCTION: fn_04123 void UIItemReformWnd::Slot19() { if (this->detailMsg) { - reinterpret_cast(g_windowMgr).Promote(this->detailMsg); + g_windowMgr.Promote(this->detailMsg); this->detailMsg->Move(g_mouse.x + 5, g_mouse.y + 5); } } diff --git a/Source/UI/UIRoundBoxTooltipWnd.cpp b/Source/UI/UIRoundBoxTooltipWnd.cpp index f1ae5550..b5a6ce91 100644 --- a/Source/UI/UIRoundBoxTooltipWnd.cpp +++ b/Source/UI/UIRoundBoxTooltipWnd.cpp @@ -11,7 +11,6 @@ #include "UI/Window/WindowBorder.h" #include "UI/Window/WindowManagerWindows.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include #include @@ -199,6 +198,6 @@ int UIRoundBoxTooltipWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a } this->Invalidate(); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); return 0; } diff --git a/Source/UI/Window/UIBasicInfoWnd.cpp b/Source/UI/Window/UIBasicInfoWnd.cpp index 0dc22d49..791b6d3a 100644 --- a/Source/UI/Window/UIBasicInfoWnd.cpp +++ b/Source/UI/Window/UIBasicInfoWnd.cpp @@ -20,7 +20,6 @@ #include "UI/Layout/SnapMgr.h" #include "UI/Lists/UITabControl.h" #include "UI/Window/WindowDialogs.h" -#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include "Utility/Text/GroupedInteger.h" @@ -269,7 +268,7 @@ int UIBasicInfoWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argumen const int height = this->geometry.height; this->SetHeight(height == this->collapsedHeight ? this->expandedHeight : this->collapsedHeight); g_windowMgr.StoreSnapRectangle(this); - reinterpret_cast(g_windowMgr).Promote(this); + g_windowMgr.Promote(this); const int delta = this->geometry.height - height; if (delta != 0) { g_snapMgr.MoveEdge(this, 0, delta, 3); diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index 36590c6e..d20a46eb 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -24,7 +24,6 @@ #include "UI/Window/WindowBorder.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/WindowManagerWindows.h" -#include "UI/Window/WindowOrdering.h" #include "Utility/Text/FormatString.h" #include @@ -328,7 +327,7 @@ void UIHotKeyWnd::Slot25(int x, int y) { (this->m_selectedRow % this->m_rowsPerPage - 1) * this->unknown_00D0 + this->unknown_00CC + this->unknown_00C4 + screenY + this->unknown_00BC ); this->m_balloon->Show(1); - reinterpret_cast(g_windowMgr).Promote(this->m_balloon); + g_windowMgr.Promote(this->m_balloon); } if (previous == this->m_selectedRow) { diff --git a/Source/UI/Window/UINewSelectCharWnd.cpp b/Source/UI/Window/UINewSelectCharWnd.cpp index fc909555..8af106f6 100644 --- a/Source/UI/Window/UINewSelectCharWnd.cpp +++ b/Source/UI/Window/UINewSelectCharWnd.cpp @@ -7,7 +7,6 @@ #include "UI/Text/UIStaticText.h" #include "UI/Window/UIControl.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" #include "UI/Window/FuncDrawWNDChar.h" #include "Client/Registry.h" #include "Client/Mode/ModeMgr.h" @@ -592,7 +591,7 @@ void UINewSelectCharWnd::Slot19() { UIWindow* wnd = g_windowMgr.LookupWindow(93); if (wnd) { - reinterpret_cast(g_windowMgr).Promote(wnd); + g_windowMgr.Promote(wnd); } if (this->m_pageSlot >= 0 && this->m_pageSlot < static_cast(this->m_slotButtons2.size())) { diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 1107f031..4591bfce 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -460,6 +460,12 @@ public: void SaveUIRectInfo(); void ResetUIRectInfo(); UIWindow* LookupWindow(int id); + void Promote(UIWindow* window); + void InvalidateFrames(); + UIWindow* FindRenderedUid(std::uint32_t uid); + UIWindow* HitTestWindows(int x, int y); + void ShowDropDown(UIWindow* owner, UIWindow* child, int x, int y); + bool CloseDropDown(); void sub_AAB070(int option); void sub_AAB090(); void sub_AAB0B0(); diff --git a/Source/UI/Window/UIWindowMgr.inl b/Source/UI/Window/UIWindowMgr.inl index 037cc24b..2d4ea8a3 100644 --- a/Source/UI/Window/UIWindowMgr.inl +++ b/Source/UI/Window/UIWindowMgr.inl @@ -5,7 +5,6 @@ #include "Contents/Configuration/ServiceOptions.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowOrdering.h" // INLINED inline bool UIWindowMgr::ShowShortcutWindow(int value) { @@ -18,7 +17,7 @@ inline bool UIWindowMgr::ShowShortcutWindow(int value) { this->window_01E8->Show(value); if (value != 0) { - reinterpret_cast(g_windowMgr).Promote(this->window_01E8); + g_windowMgr.Promote(this->window_01E8); } if (g_serviceOptions.Get(0x10E)) { @@ -31,7 +30,7 @@ inline bool UIWindowMgr::ShowShortcutWindow(int value) { companion->Show(value); if (value != 0) { - reinterpret_cast(g_windowMgr).Promote(companion); + g_windowMgr.Promote(companion); } } diff --git a/Source/UI/Window/WindowMgrState.cpp b/Source/UI/Window/WindowMgrState.cpp index 90cbf07e..cbb08b0c 100644 --- a/Source/UI/Window/WindowMgrState.cpp +++ b/Source/UI/Window/WindowMgrState.cpp @@ -1081,7 +1081,7 @@ void UIWindowMgr::SendFlagEffect(int message) { // OFFSET: 0x00A8FCA0 // FUNCTION: fn_17149 bool UIWindowMgr::DropAt(int x, int y, ModeDragState* drag) { - UIWindow* window = reinterpret_cast(this)->HitTest(x, y); + UIWindow* window = this->HitTestWindows(x, y); if (!window) { return false; } diff --git a/Source/UI/Window/WindowMouseHit.cpp b/Source/UI/Window/WindowMouseHit.cpp index 8fed0491..fdd2199c 100644 --- a/Source/UI/Window/WindowMouseHit.cpp +++ b/Source/UI/Window/WindowMouseHit.cpp @@ -12,7 +12,6 @@ #include "UI/Layout/WindowCoordinates.h" #include "UI/Window/WindowManagerWindows.h" #include "UI/Window/WindowMouseHit.h" -#include "UI/Window/WindowOrdering.h" // GLOBAL: gl_24656 int g_alternateDoubleClickGate; @@ -55,7 +54,7 @@ static void PromoteWindow(UIWindowMgr& mgr, UIWindow* window) { } // INLINED -static void CloseDropDown(UIWindowMgr& mgr) { +static void HideDropDown(UIWindowMgr& mgr) { CUIDropDownBox* popup = static_cast(mgr.window_0A30); if (popup && popup->geometry.visible != 0) { popup->Detach(); @@ -65,7 +64,7 @@ static void CloseDropDown(UIWindowMgr& mgr) { // OFFSET: 0x00A91B30 // FUNCTION: fn_17168 -UIWindow* WindowMouseHit::FindUid(std::uint32_t uid) { +UIWindow* UIWindowMgr::FindRenderedUid(std::uint32_t uid) { for (UIWindow* window : this->rendered) { if (UIWindow* found = window->FindUid(uid)) { return found; @@ -77,17 +76,17 @@ UIWindow* WindowMouseHit::FindUid(std::uint32_t uid) { // OFFSET: 0x00A91C70 // FUNCTION: fn_17171 -UIWindow* WindowMouseHit::HitTest(int x, int y) { +UIWindow* UIWindowMgr::HitTestWindows(int x, int y) { while (!this->rendered.empty()) { UIWindow* hit = this->rendered.back()->HitTest(x, y); y = static_cast(static_cast(reinterpret_cast(hit))); if (hit && hit->geometry.visible != 0) { - this->previous = this->current; - this->current = hit->Uid(); - if (this->previous != this->current) { + this->previousHitUid = this->currentHitUid; + this->currentHitUid = hit->Uid(); + if (this->previousHitUid != this->currentHitUid) { hit->Slot47(); - if (UIWindow* old = this->FindUid(this->previous)) { + if (UIWindow* old = this->FindRenderedUid(this->previousHitUid)) { old->Slot48(); } } @@ -103,10 +102,10 @@ UIWindow* WindowMouseHit::HitTest(int x, int y) { } } - this->previous = this->current; - this->current = 0; - if (this->previous != 0) { - if (UIWindow* old = this->FindUid(this->previous)) { + this->previousHitUid = this->currentHitUid; + this->currentHitUid = 0; + if (this->previousHitUid != 0) { + if (UIWindow* old = this->FindRenderedUid(this->previousHitUid)) { old->Slot48(); } } @@ -114,169 +113,6 @@ UIWindow* WindowMouseHit::HitTest(int x, int y) { return nullptr; } -// INLINED -bool WindowMouseCapture::Dispatch() { - if (!this->capture) { - return false; - } - - const int x = this->mouse.x; - const int y = this->mouse.y; - int left; - int top; - UIWindow* window = this->capture; - WindowScreenPosition(window, left, top); - const int localX = x - left; - const int localY = y - top; - - if (this->mouse.buttons[0] == 1) { - UIWindow* root = window->Root(); - if (root && root->Slot02()) { - this->ordering.Promote(root); - } - - this->capture->Slot25(localX, localY); - } - - if (this->mouse.buttons[0] == 4 && (this->doubleClickGate == 0 || this->alternateDoubleClickGate == 0)) { - this->capture->Slot25(localX, localY); - this->capture->Slot26(localX, localY); - } - - this->capture->ResetCursor(localX, localY); - - if (this->previousX == x && this->previousY == y) { - this->capture->Slot28(localX, localY); - } else { - this->capture->Slot27(localX, localY); - } - - if (this->mouse.wheel != 0) { - this->capture->Slot35(this->mouse.wheel); - } - - if (this->mouse.buttons[0] == 3) { - this->capture->Slot31(localX, localY); - } - - return true; -} - -// INLINED -int WindowMouseUncaptured::Dispatch() { - const int x = this->mouse.x; - const int y = this->mouse.y; - UIWindow* window = this->hit.HitTest(x, y); - - if (!this->modal.empty() && this->modal.back() && window && window != this->modal.back() && !window->IsDescendantOf(this->modal.back())) { - window = nullptr; - } - - if (this->mouse.buttons[0] == 1) { - SetPressedWindowRoot(this->pressedRoot, window); - } - - int handled = 0; - if (window) { - handled = window->Slot08() ? 2 : 1; - int left; - int top; - WindowScreenPosition(window, left, top); - const int localX = x - left; - const int localY = y - top; - - if (this->mouse.buttons[0] == 4 && (this->doubleClickGate == 0 || this->alternateDoubleClickGate == 0)) { - window->Slot26(localX, localY); - } - - if (this->mouse.buttons[1] == 4) { - window->Slot34(localX, localY); - } - - if (this->mouse.buttons[0] == 1) { - UIWindow* root = window->Root(); - if (root && root->Slot02()) { - this->ordering.Promote(root); - } - - CUIDropDownBox* popup = this->dropdown.popup; - if (popup && window != popup && root != popup && !popup->HasOwnerChild(window)) { - this->dropdown.Close(); - } - - window->Slot25(localX, localY); - } - - if (this->mouse.buttons[1] == 1) { - UIWindow* root = window->Root(); - if (root && root->Slot02()) { - this->ordering.Promote(root); - } - - window->Slot32(localX, localY); - } - - window->ResetCursor(localX, localY); - if (this->previousX == x && this->previousY == y) { - window->Slot28(localX, localY); - } else { - window->Slot27(localX, localY); - } - - if (this->mouse.wheel != 0) { - window->Slot35(this->mouse.wheel); - } - - if (this->mouse.buttons[1] == 3) { - window->Slot33(localX, localY); - } - - if (this->mouse.buttons[0] == 3) { - window->Slot31(localX, localY); - } - } - - if (this->mouse.buttons[0] == 1) { - if (this->dismiss26 && (!window || (window != this->dismiss26 && !window->IsDescendantOf(this->dismiss26)))) { - this->windows.CloseWindow(26); - } - - if (this->dismiss260) { - if (!window || (window != this->dismiss260 && !window->IsDescendantOf(this->dismiss260))) { - this->windows.CloseWindow(260); - if (!window) { - this->dropdown.Close(); - } - } - } else if (!window) { - this->dropdown.Close(); - } - } - - for (unsigned index = 0; index < this->refresh.size(); ++index) { - UIWindow* refreshed = *this->refresh[index]; - if (refreshed && (index != 5 || this->refreshGate == 0)) { - refreshed->Invalidate(); - } - } - - if (window) { - if (this->hover && this->hover != window) { - int left; - int top; - WindowScreenPosition(this->hover, left, top); - const int localX = x - left; - const int localY = y - top; - this->hover->Slot27(localX, localY); - this->hover->ResetCursor(localX, localY); - } - - this->hover = window; - } - - return handled; -} - // OFFSET: 0x00AA4730 // FUNCTION: fn_17222 int UIWindowMgr::ProcessMouse() { @@ -381,7 +217,7 @@ int UIWindowMgr::ProcessMouse() { this->inputWindow->Slot31(localX, localY); } } else { - UIWindow* window = reinterpret_cast(this)->HitTest(x, y); + UIWindow* window = this->HitTestWindows(x, y); if (!this->modalWindows.empty() && this->modalWindows.back() && window) { UIWindow* modalWindow = this->modalWindows.back(); @@ -418,7 +254,7 @@ int UIWindowMgr::ProcessMouse() { CUIDropDownBox* popup = static_cast(this->window_0A30); if (popup && window != popup && root != popup && !popup->HasOwnerChild(window)) { - CloseDropDown(*this); + HideDropDown(*this); } window->Slot25(localX, localY); @@ -461,12 +297,12 @@ int UIWindowMgr::ProcessMouse() { if (this->unknown_021C) { if (!window) { this->CloseWindow(260); - CloseDropDown(*this); + HideDropDown(*this); } else if (window != this->unknown_021C && !window->IsDescendantOf(this->unknown_021C)) { this->CloseWindow(260); } } else if (!window) { - CloseDropDown(*this); + HideDropDown(*this); } } diff --git a/Source/UI/Window/WindowMouseHit.h b/Source/UI/Window/WindowMouseHit.h index deb00d93..1c4654ee 100644 --- a/Source/UI/Window/WindowMouseHit.h +++ b/Source/UI/Window/WindowMouseHit.h @@ -8,54 +8,7 @@ #include class UIWindow; -class CMouse; -struct WindowOrdering; #include "UI/Window/WindowManagerWindows.h" -struct WindowDropDown; - -struct WindowMouseHit { - std::list& rendered; - std::map& overlays; - std::uint32_t& previous; - std::uint32_t& current; - - UIWindow* FindUid(std::uint32_t uid); - UIWindow* HitTest(int x, int y); -}; - -struct WindowMouseCapture { - UIWindow*& capture; - WindowOrdering& ordering; - const CMouse& mouse; - const int& previousX; - const int& previousY; - const int& doubleClickGate; - const int& alternateDoubleClickGate; - - bool Dispatch(); -}; - -struct WindowMouseUncaptured { - WindowMouseHit& hit; - WindowOrdering& ordering; - WindowDropDown& dropdown; - WindowManagerWindows& windows; - const std::deque& modal; - const CMouse& mouse; - const int& previousX; - const int& previousY; - const int& doubleClickGate; - const int& alternateDoubleClickGate; - UIWindow*& pressedRoot; - UIWindow* const& dismiss26; - UIWindow* const& dismiss260; - UIWindow*& hover; - - std::array refresh; - const int& refreshGate; - - int Dispatch(); -}; extern int g_alternateDoubleClickGate; extern int g_mouseRefreshGate; diff --git a/Source/UI/Window/WindowOrdering.cpp b/Source/UI/Window/WindowOrdering.cpp index f021aef3..2cc90c54 100644 --- a/Source/UI/Window/WindowOrdering.cpp +++ b/Source/UI/Window/WindowOrdering.cpp @@ -3,7 +3,6 @@ #include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIWindow.h" #include "UI/Window/WindowManagerWindows.h" -#include "UI/Window/WindowOrdering.h" #include @@ -101,12 +100,12 @@ char UIWindowMgr::UpdateSnapRectangles() { // OFFSET: 0x00A976C0 // FUNCTION: fn_17206 -void WindowOrdering::Promote(UIWindow* window) { - if (!window || (this->modal != 0 && this->modalWindow != window)) { +void UIWindowMgr::Promote(UIWindow* window) { + if (!window || (this->modal != nullptr && this->window_4F174 != window)) { return; } - if (this->windows.LookupWindow(278) || this->windows.LookupWindow(4) || this->windows.LookupWindow(199) || this->windows.LookupWindow(200)) { + if (this->LookupWindow(278) || this->LookupWindow(4) || this->LookupWindow(199) || this->LookupWindow(200)) { return; } @@ -138,12 +137,12 @@ void WindowOrdering::Promote(UIWindow* window) { // OFFSET: 0x00A969D0 // FUNCTION: fn_17190 -void WindowOrdering::InvalidateFrames(int& latch) { - if (latch != 0) { +void UIWindowMgr::InvalidateFrames() { + if (this->unknown_04FC != 0) { return; } - latch = 1; + this->unknown_04FC = 1; for (UIWindow* window : this->rendered) { if (window->Slot03()) { diff --git a/Source/UI/Window/WindowOrdering.h b/Source/UI/Window/WindowOrdering.h deleted file mode 100644 index 9f993491..00000000 --- a/Source/UI/Window/WindowOrdering.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef RAGNAROK_SOURCE_UI_WINDOW_WINDOWORDERING_H -#define RAGNAROK_SOURCE_UI_WINDOW_WINDOWORDERING_H - -#include - -class UIWindow; -#include "UI/Window/WindowManagerWindows.h" - -struct WindowOrdering { - std::list& rendered; - WindowManagerWindows& windows; - const int& modal; - UIWindow* const& modalWindow; - - void Promote(UIWindow* window); - - void InvalidateFrames(int& latch); -}; - -#endif