From e9b6837e97303f98622b7ce2bb4b47745a5cce32 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 27 Oct 2026 18:04:02 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Buttons/UIBasicButton.cpp, Source/UI/Buttons/UIBitmapButton.cpp, ... Batch #1102 by ragnarok-clanker: 2 byte-identical, 0 confirmed by peer review. - fn_16953 UIWindow::Root: byte-identical - fn_16983 UIWindow::Invalidate: byte-identical (already on main) Merged automatically: every function is byte-identical to the original. --- Source/UI/Buttons/UIBasicButton.cpp | 2 +- Source/UI/Buttons/UIBitmapButton.cpp | 2 +- Source/UI/Buttons/UIBmpTextButton.cpp | 2 +- Source/UI/Buttons/UIButton.cpp | 10 +++---- Source/UI/Buttons/UICheckBox.cpp | 8 +++--- Source/UI/Buttons/UITextButton.cpp | 12 ++++----- Source/UI/Chat/ChatSuggestions.h | 3 +-- Source/UI/Edit/UIEditCtrl.cpp | 10 +++---- Source/UI/Layout/WindowCoordinates.cpp | 4 +-- Source/UI/Lists/UIComboBoxDefWnd.cpp | 10 +++---- Source/UI/Lists/UIComboBoxEx.cpp | 8 +++--- Source/UI/Lists/UIListBox.cpp | 8 +++--- Source/UI/Lists/UIListBoxEx.cpp | 10 +++---- Source/UI/Lists/UIScrollBar.cpp | 14 +++++----- Source/UI/Lists/UIScrollBarNavi.cpp | 2 +- Source/UI/Party/UIPartyInfoWnd.cpp | 2 +- Source/UI/Shortcuts/ShortcutDetails.cpp | 7 +++-- Source/UI/Shortcuts/ShortcutTooltip.cpp | 7 +++-- Source/UI/Text/UIStaticText.cpp | 18 ++++++------- Source/UI/Text/UITextViewer.cpp | 2 +- Source/UI/UIStaticBitmap.cpp | 20 +++++++------- Source/UI/Window/FrameFocus.cpp | 2 +- Source/UI/Window/FrameFocus.h | 4 +-- Source/UI/Window/InputFocus.cpp | 6 ++--- Source/UI/Window/UIControl.cpp | 22 +++++++-------- Source/UI/Window/UIFrameWnd.cpp | 7 +++-- Source/UI/Window/UIWindow.cpp | 17 +++++------- Source/UI/Window/UIWindow.h | 14 +++++----- Source/UI/Window/UIWindowMgr.h | 1 + Source/UI/Window/WindowAncestry.cpp | 36 +++++++++++-------------- Source/UI/Window/WindowDialogs.cpp | 8 +++--- Source/UI/Window/WindowDialogs.h | 5 ++-- Source/UI/Window/WindowMouseHit.cpp | 24 ++++++++--------- Source/UI/Window/WindowMouseHit.h | 5 ++-- Source/UI/Window/WindowRegistration.cpp | 10 +++---- Source/UI/Window/WindowRegistration.h | 8 +++--- Source/UI/Window/WindowRetirement.cpp | 2 +- Source/UI/Window/WindowRetirement.h | 3 +-- 38 files changed, 158 insertions(+), 177 deletions(-) diff --git a/Source/UI/Buttons/UIBasicButton.cpp b/Source/UI/Buttons/UIBasicButton.cpp index 497f6e1..9746ae4 100644 --- a/Source/UI/Buttons/UIBasicButton.cpp +++ b/Source/UI/Buttons/UIBasicButton.cpp @@ -76,6 +76,6 @@ void UIBasicButton::Paint() { } if (this->invalidateParent == 1 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } diff --git a/Source/UI/Buttons/UIBitmapButton.cpp b/Source/UI/Buttons/UIBitmapButton.cpp index 46ffde0..9079364 100644 --- a/Source/UI/Buttons/UIBitmapButton.cpp +++ b/Source/UI/Buttons/UIBitmapButton.cpp @@ -64,6 +64,6 @@ void UIBitmapButton::Paint() { this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); if (this->m_invalidateParent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } diff --git a/Source/UI/Buttons/UIBmpTextButton.cpp b/Source/UI/Buttons/UIBmpTextButton.cpp index 033a366..34711cc 100644 --- a/Source/UI/Buttons/UIBmpTextButton.cpp +++ b/Source/UI/Buttons/UIBmpTextButton.cpp @@ -78,6 +78,6 @@ void UIBmpTextButton::Paint() { } if (this->m_invalidateParent == 1 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } diff --git a/Source/UI/Buttons/UIButton.cpp b/Source/UI/Buttons/UIButton.cpp index 07e03ab..48c3ce2 100644 --- a/Source/UI/Buttons/UIButton.cpp +++ b/Source/UI/Buttons/UIButton.cpp @@ -86,7 +86,7 @@ void UIButton::Slot27(int x, int y) { this->Invalidate(); } - UIWindow* parent = static_cast(this->parent); + UIWindow* parent = this->parent; if (parent == this->m_buttonContext->hoverParent) { parent->SendMsg(this, 6, 271, state != 0, 0, 0); } @@ -95,7 +95,7 @@ void UIButton::Slot27(int x, int y) { // OFFSET: 0x0085F180 // FUNCTION: fn_10858 void UIButton::Slot28(int x, int y) { - UIWindow* parent = static_cast(this->parent); + UIWindow* parent = this->parent; if (parent && (this->geometry.id == 201 || this->geometry.id == 202) && parent->geometry.id != 203) { if (this->geometry.id == 202 && parent->geometry.id != 0) { this->m_tooltip.clear(); @@ -110,7 +110,7 @@ void UIButton::Slot28(int x, int y) { if (!this->m_tooltip.empty()) { int screenX = 0, screenY = -20; - for (const UIWindow* window = this; window; window = static_cast(window->parent)) { + for (const UIWindow* window = this; window; window = window->parent) { screenX = (screenX + window->geometry.x); screenY = (screenY + window->geometry.y); } @@ -161,7 +161,7 @@ void UIButton::Slot31(int x, int y) { this->geometry.unknown_0030 = 0; } else { this->geometry.unknown_0030 = 1; - UIWindow* parent = static_cast(this->parent); + UIWindow* parent = this->parent; if (parent) { if (WindowPolicy(this->m_buttonContext->policy, this->m_buttonContext->restricted, 3, parent->geometry.id) != 0) { int id = this->geometry.id; @@ -174,7 +174,7 @@ void UIButton::Slot31(int x, int y) { if (id == 184 || id == 321) { this->m_buttonContext->services.Submit(parent); id = this->geometry.id; - parent = static_cast(this->parent); + parent = this->parent; } parent->SendMsg(this, 6, id, this->m_argument, 0, 0); diff --git a/Source/UI/Buttons/UICheckBox.cpp b/Source/UI/Buttons/UICheckBox.cpp index 9f3d4bc..7da28cb 100644 --- a/Source/UI/Buttons/UICheckBox.cpp +++ b/Source/UI/Buttons/UICheckBox.cpp @@ -55,12 +55,12 @@ void UICheckBox::Notify() { UIWindow* root = this; while (root->parent) { - root = static_cast(root->parent); + root = root->parent; } root->Invalidate(); if (this->parent) { - static_cast(this->parent)->SendMsg(this, 6, this->geometry.id, this->geometry.unknown_0030, 0, 0); + this->parent->SendMsg(this, 6, this->geometry.id, this->geometry.unknown_0030, 0, 0); } } @@ -85,7 +85,7 @@ void UICheckBox::Slot25(int, int) { this->geometry.unknown_0030 = 1u - this->geometry.unknown_0030; this->Notify(); if (this->m_notify != 0) { - static_cast(this->parent)->SendMsg(this, 2, this->m_message, 0, 0, 0); + this->parent->SendMsg(this, 2, this->m_message, 0, 0, 0); } } @@ -103,7 +103,7 @@ void UICheckBox::Slot28(int x, int y) { int screenX = 0, screenY = -20; - for (const UIWindow* node = this; node; node = static_cast(node->parent)) { + for (const UIWindow* node = this; node; node = node->parent) { screenX = (screenX + node->geometry.x); screenY = (screenY + node->geometry.y); } diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 84752ca..909eefd 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -39,7 +39,7 @@ void UITextButton::Paint() { } if (this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } TextContext context(*this->geometry.surface, this->m_buttonContext->fonts, this->m_buttonContext->locale); @@ -91,7 +91,7 @@ void UITextButton::Slot27(int x, int y) { // FUNCTION: fn_11461 void UITextButton::Slot28(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot28((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot28((x + this->geometry.x), (y + this->geometry.y)); } UIButton::Slot28(x, y); @@ -112,7 +112,7 @@ void UITextButton::Slot31(int x, int y) { this->geometry.unknown_0030 = 1; if (this->parent) { - static_cast(this->parent)->SendMsg(this, 98, this->geometry.id, this->m_value, 0, 0); + this->parent->SendMsg(this, 98, this->geometry.id, this->m_value, 0, 0); focus.Clear(); return; } @@ -127,7 +127,7 @@ void UITextButton::Slot31(int x, int y) { void UITextButton::Slot32(int, int) { if (this->m_disabled == 0) { if (this->parent) { - static_cast(this->parent)->SendMsg(this, 99, this->geometry.id, this->m_value, 0, 0); + this->parent->SendMsg(this, 99, this->geometry.id, this->m_value, 0, 0); } this->Invalidate(); @@ -149,7 +149,7 @@ void UITextButton::Slot33(int x, int y) { this->geometry.unknown_0030 = 1; if (this->parent) { - static_cast(this->parent)->SendMsg(this, 99, this->geometry.id, this->m_value, 0, 0); + this->parent->SendMsg(this, 99, this->geometry.id, this->m_value, 0, 0); } } @@ -161,6 +161,6 @@ void UITextButton::Slot33(int x, int y) { // FUNCTION: fn_11500 void UITextButton::Slot35(int value) { if (this->parent) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } } diff --git a/Source/UI/Chat/ChatSuggestions.h b/Source/UI/Chat/ChatSuggestions.h index 6c3ab61..e4f3202 100644 --- a/Source/UI/Chat/ChatSuggestions.h +++ b/Source/UI/Chat/ChatSuggestions.h @@ -7,7 +7,6 @@ class UIWindow; class WindowManagerWindows; -struct WindowAncestry; class UIEditCtrl; struct InputFocus; struct ItemTagRetirement; @@ -43,7 +42,7 @@ struct ChatRowLayout { ChatInputLayout& input; ChatHeaderLayout& header; WindowManagerWindows& windows; - WindowAncestry* const& capture; + UIWindow* const& capture; UIWindow* const& popup26; const std::vector& rows; const int& selected; diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index ac84bcc..9e7653f 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -282,7 +282,7 @@ void UIEditCtrl::Slot28(int x, int y) { if (!this->tooltip.empty()) { int left = 10, top = -20; - for (const UIWindow* window = this; window; window = static_cast(window->parent)) { + for (const UIWindow* window = this; window; window = window->parent) { left += window->geometry.x; top += window->geometry.y; } @@ -334,7 +334,7 @@ void UIEditCtrl::SetText(const char* value) { this->SelectAll(); if (this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } @@ -368,10 +368,10 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol this->m_edit->buttons.fonts, this->m_edit->buttons.locale }; - UIWindow* parent = static_cast(this->parent); + UIWindow* parent = this->parent; int left = 0, top = 0; - for (const UIWindow* window = this; window; window = static_cast(window->parent)) { + for (const UIWindow* window = this; window; window = window->parent) { left += window->geometry.x; top += window->geometry.y; } @@ -492,6 +492,6 @@ UIEditCtrlWheel::~UIEditCtrlWheel() = default; // FUNCTION: fn_13408 void UIEditCtrlWheel::Slot35(int value) { if (this->parent) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } } diff --git a/Source/UI/Layout/WindowCoordinates.cpp b/Source/UI/Layout/WindowCoordinates.cpp index c489e01..5a65443 100644 --- a/Source/UI/Layout/WindowCoordinates.cpp +++ b/Source/UI/Layout/WindowCoordinates.cpp @@ -9,7 +9,7 @@ void WindowScreenPosition(const UIWindow* window, int& x, int& y) { int horizontal = 0; int vertical = 0; - for (const UIWindow* node = window; node; node = static_cast(node->parent)) { + for (const UIWindow* node = window; node; node = node->parent) { horizontal = (horizontal + node->geometry.x); vertical = (vertical + node->geometry.y); } @@ -29,7 +29,7 @@ void WindowScreenBounds(const UIWindow* window, int& left, int& top, int& right, int horizontal = 0; int vertical = 0; - for (const UIWindow* node = window; node; node = static_cast(node->parent)) { + for (const UIWindow* node = window; node; node = node->parent) { horizontal = (horizontal + node->geometry.x); vertical = (vertical + node->geometry.y); } diff --git a/Source/UI/Lists/UIComboBoxDefWnd.cpp b/Source/UI/Lists/UIComboBoxDefWnd.cpp index dfcbf78..dd54516 100644 --- a/Source/UI/Lists/UIComboBoxDefWnd.cpp +++ b/Source/UI/Lists/UIComboBoxDefWnd.cpp @@ -96,32 +96,32 @@ int UIComboBoxDefWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, st this->Resize( this->geometry.width, this->expanded ? (this->geometry.height + this->list->geometry.height) : (this->geometry.height - this->list->geometry.height) ); - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); this->Invalidate(); this->list->Invalidate(); UIWindow* root = this; while (root->parent) { - root = static_cast(root->parent); + root = root->parent; } root->Invalidate(); if (this->parent) { - static_cast(this->parent)->SendMsg(nullptr, 23, 0, 0, 0, 0); + this->parent->SendMsg(nullptr, 23, 0, 0, 0, 0); } } return 0; case 39: - if (WindowPolicy(this->m_controls->buttons.policy, this->m_controls->buttons.restricted, 3, static_cast(this->parent)->geometry.id) == 0 || + if (WindowPolicy(this->m_controls->buttons.policy, this->m_controls->buttons.restricted, 3, this->parent->geometry.id) == 0 || value < 0) { return 0; } this->label->SetText(this->list->lines[value].text.c_str(), 0); this->SendMsg(nullptr, 6, 273, 0, 0, 0); - static_cast(this->parent)->SendMsg(this, 39, value, 0, 0, 0); + this->parent->SendMsg(this, 39, value, 0, 0, 0); return 0; case 57: if (value >= 0) { diff --git a/Source/UI/Lists/UIComboBoxEx.cpp b/Source/UI/Lists/UIComboBoxEx.cpp index 105a037..3fac03e 100644 --- a/Source/UI/Lists/UIComboBoxEx.cpp +++ b/Source/UI/Lists/UIComboBoxEx.cpp @@ -91,7 +91,7 @@ void UIComboBoxEx::Slot31(int x, int y) { if (UIWindow* target = windows.LookupWindow(this->targetId)) { target->SendMsg(nullptr, 39, this->selected, 0, 0, 0); } else if (this->parent) { - static_cast(this->parent)->SendMsg(nullptr, 39, this->selected, 0, 0, 0); + this->parent->SendMsg(nullptr, 39, this->selected, 0, 0, 0); } windows.CloseWindow(26); @@ -129,7 +129,7 @@ void UIComboBoxEx::Refresh() { UIWindow* root = this; while (root->parent) { - root = static_cast(root->parent); + root = root->parent; } root->Invalidate(); @@ -261,7 +261,7 @@ void UIComboBoxEx::Paint() { this->FillRegion((this->geometry.width - 16), 0, 16, this->geometry.height, Palette(resources, 2, 2)); } - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } // OFFSET: 0x0086CCE0 @@ -330,6 +330,6 @@ void UIComboBoxEx2::Paint() { } if (this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } diff --git a/Source/UI/Lists/UIListBox.cpp b/Source/UI/Lists/UIListBox.cpp index 99f3afc..378e53e 100644 --- a/Source/UI/Lists/UIListBox.cpp +++ b/Source/UI/Lists/UIListBox.cpp @@ -146,7 +146,7 @@ void UIListBox::Slot25(int x, int y) { // FUNCTION: fn_11403 void UIListBox::Slot26(int, int) { if (this->selected != -1) { - static_cast(this->parent)->SendMsg(this, 6, this->geometry.id, this->selected, 0, 0); + this->parent->SendMsg(this, 6, this->geometry.id, this->selected, 0, 0); } } @@ -172,7 +172,7 @@ void UIListBox::Paint() { } if (this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } else if (this->geometry.surface) { const std::uint32_t color = (this->backgroundRed & 255) | ((this->backgroundGreen & 255) << 8) | ((this->backgroundBlue & 255) << 16); @@ -241,7 +241,7 @@ int UIListBox::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, s this->Invalidate(); if (this->transparent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } return (this->topLine - previous); @@ -268,7 +268,7 @@ int UIListBox::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, s this->Invalidate(); if (this->transparent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } return (this->horizontalOffset - previous); diff --git a/Source/UI/Lists/UIListBoxEx.cpp b/Source/UI/Lists/UIListBoxEx.cpp index 7846483..dfe4bca 100644 --- a/Source/UI/Lists/UIListBoxEx.cpp +++ b/Source/UI/Lists/UIListBoxEx.cpp @@ -137,7 +137,7 @@ void UIListBoxEx::Slot25(int x, int y) { // FUNCTION: fn_11404 void UIListBoxEx::Slot26(int, int) { if (this->selected != -1) { - static_cast(this->parent)->SendMsg(this, 6, this->geometry.id, this->selected, 0, 0); + this->parent->SendMsg(this, 6, this->geometry.id, this->selected, 0, 0); } } @@ -156,7 +156,7 @@ void UIListBoxEx::Paint() { this->geometry.surface->Fill(nullptr, 0xFFFF00FFu); if (this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } else { const unsigned color = static_cast(this->backgroundRed) | (static_cast(this->backgroundGreen) << 8) | @@ -209,13 +209,13 @@ int UIListBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in this->Invalidate(); if (this->transparent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } UIWindow* root = this; while (root->parent) { - root = static_cast(root->parent); + root = root->parent; } root->Invalidate(); @@ -238,7 +238,7 @@ int UIListBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in this->Invalidate(); if (this->transparent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } return (this->horizontalOffset - previous); diff --git a/Source/UI/Lists/UIScrollBar.cpp b/Source/UI/Lists/UIScrollBar.cpp index 7bccf21..fc1f1ff 100644 --- a/Source/UI/Lists/UIScrollBar.cpp +++ b/Source/UI/Lists/UIScrollBar.cpp @@ -37,7 +37,7 @@ void UIScrollBar::Resize(int width, int height) { // OFFSET: 0x00882430 // FUNCTION: fn_11303 bool UIScrollBar::Slot08() { - return this->maximum == 0 && this->parent && static_cast(this->parent)->Slot08(); + return this->maximum == 0 && this->parent && this->parent->Slot08(); } // OFFSET: 0x00880C60 @@ -101,7 +101,7 @@ int UIScrollBar::Part(int x, int y) { // OFFSET: 0x00890720 // FUNCTION: fn_11425 void UIScrollBar::Slot25(int x, int y) { - UIWindow* owner = static_cast(this->parent); + UIWindow* owner = this->parent; if (this->maximum == 0) { owner->Slot25((x + this->geometry.x), (y + this->geometry.y)); @@ -150,14 +150,14 @@ void UIScrollBar::Slot26(int x, int y) { this->Slot25(x, y); if (this->maximum == 0) { - static_cast(this->parent)->Slot26((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot26((x + this->geometry.x), (y + this->geometry.y)); } } // OFFSET: 0x008921D0 // FUNCTION: fn_11468 void UIScrollBar::Slot27(int x, int y) { - UIWindow* owner = static_cast(this->parent); + UIWindow* owner = this->parent; if (this->maximum == 0) { owner->Slot27((x + this->geometry.x), (y + this->geometry.y)); @@ -219,7 +219,7 @@ void UIScrollBar::Slot31(int x, int y) { this->m_capture->Clear(); } } else { - static_cast(this->parent)->Slot31((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot31((x + this->geometry.x), (y + this->geometry.y)); } } @@ -227,14 +227,14 @@ void UIScrollBar::Slot31(int x, int y) { // FUNCTION: fn_11491 void UIScrollBar::Slot33(int x, int y) { if (this->maximum == 0) { - static_cast(this->parent)->Slot33((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot33((x + this->geometry.x), (y + this->geometry.y)); } } // OFFSET: 0x00892F20 // FUNCTION: fn_11499 void UIScrollBar::Slot35(int value) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } // OFFSET: 0x0088E310 diff --git a/Source/UI/Lists/UIScrollBarNavi.cpp b/Source/UI/Lists/UIScrollBarNavi.cpp index 885e0d9..fa7b4a7 100644 --- a/Source/UI/Lists/UIScrollBarNavi.cpp +++ b/Source/UI/Lists/UIScrollBarNavi.cpp @@ -53,5 +53,5 @@ void UIScrollBar_Navi::Paint() { } this->minimumThumb = 0; - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } diff --git a/Source/UI/Party/UIPartyInfoWnd.cpp b/Source/UI/Party/UIPartyInfoWnd.cpp index 2a2556c..04ef2e9 100644 --- a/Source/UI/Party/UIPartyInfoWnd.cpp +++ b/Source/UI/Party/UIPartyInfoWnd.cpp @@ -100,7 +100,7 @@ void UIPartyInfoWnd::Paint() { text(315, this->memo.c_str(), static_cast(this->memo.size())); if (this->m_invalidateParent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } } diff --git a/Source/UI/Shortcuts/ShortcutDetails.cpp b/Source/UI/Shortcuts/ShortcutDetails.cpp index 27eaa22..7c2a64c 100644 --- a/Source/UI/Shortcuts/ShortcutDetails.cpp +++ b/Source/UI/Shortcuts/ShortcutDetails.cpp @@ -11,10 +11,9 @@ namespace { x = (x + window.geometry.x); y = (y + window.geometry.y); - for (const WindowAncestry* node = window.parent; node; node = node->parent) { - const UIWindow* owner = static_cast(node); - x = (x + owner->geometry.x); - y = (y + owner->geometry.y); + for (const UIWindow* node = window.parent; node; node = node->parent) { + x = (x + node->geometry.x); + y = (y + node->geometry.y); } } } diff --git a/Source/UI/Shortcuts/ShortcutTooltip.cpp b/Source/UI/Shortcuts/ShortcutTooltip.cpp index 27741eb..4e33580 100644 --- a/Source/UI/Shortcuts/ShortcutTooltip.cpp +++ b/Source/UI/Shortcuts/ShortcutTooltip.cpp @@ -11,10 +11,9 @@ namespace { x = (x + window.geometry.x); y = (y + window.geometry.y); - for (const WindowAncestry* node = window.parent; node; node = node->parent) { - const UIWindow* owner = static_cast(node); - x = (x + owner->geometry.x); - y = (y + owner->geometry.y); + for (const UIWindow* node = window.parent; node; node = node->parent) { + x = (x + node->geometry.x); + y = (y + node->geometry.y); } } } diff --git a/Source/UI/Text/UIStaticText.cpp b/Source/UI/Text/UIStaticText.cpp index b874101..6a123b2 100644 --- a/Source/UI/Text/UIStaticText.cpp +++ b/Source/UI/Text/UIStaticText.cpp @@ -50,20 +50,20 @@ void UIStaticText::Paint() { // OFFSET: 0x0085EE40 // FUNCTION: fn_10850 void UIStaticText::Slot25(int x, int y) { - static_cast(this->parent)->Slot25((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot25((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085EA60 // FUNCTION: fn_10837 void UIStaticText::Slot26(int x, int y) { - static_cast(this->parent)->Slot26((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot26((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F8D0 // FUNCTION: fn_10873 void UIStaticText::Slot27(int x, int y) { this->Slot28(x, y); - static_cast(this->parent)->Slot27((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot27((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F580 @@ -76,7 +76,7 @@ void UIStaticText::Slot28(int, int) { int x = -6; int y = -4; - for (const UIWindow* node = this; node; node = static_cast(node->parent)) { + for (const UIWindow* node = this; node; node = node->parent) { x = (x + node->geometry.x); y = (y + node->geometry.y); } @@ -87,29 +87,29 @@ void UIStaticText::Slot28(int, int) { // OFFSET: 0x0085FAB0 // FUNCTION: fn_10881 void UIStaticText::ResetCursor(int x, int y) { - static_cast(this->parent)->ResetCursor((x + this->geometry.x), (y + this->geometry.y)); + this->parent->ResetCursor((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F030 // FUNCTION: fn_10855 void UIStaticText::Slot31(int x, int y) { - static_cast(this->parent)->Slot31((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot31((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085FED0 // FUNCTION: fn_10889 void UIStaticText::Slot32(int x, int y) { - static_cast(this->parent)->Slot32((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot32((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085FF30 // FUNCTION: fn_10891 void UIStaticText::Slot33(int x, int y) { - static_cast(this->parent)->Slot33((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot33((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x00860020 // FUNCTION: fn_10897 void UIStaticText::Slot35(int value) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } diff --git a/Source/UI/Text/UITextViewer.cpp b/Source/UI/Text/UITextViewer.cpp index e0bea96..e23d36d 100644 --- a/Source/UI/Text/UITextViewer.cpp +++ b/Source/UI/Text/UITextViewer.cpp @@ -125,7 +125,7 @@ void UITextViewer::Paint() { } if (this->transparent != 0 && this->parent) { - static_cast(this->parent)->Invalidate(); + this->parent->Invalidate(); } int divisor = (this->lineHeight - this->bottomMargin); diff --git a/Source/UI/UIStaticBitmap.cpp b/Source/UI/UIStaticBitmap.cpp index 09706c3..da213a9 100644 --- a/Source/UI/UIStaticBitmap.cpp +++ b/Source/UI/UIStaticBitmap.cpp @@ -40,33 +40,33 @@ void UIStaticBitmap::Paint() { // OFFSET: 0x0085EE10 // FUNCTION: fn_10849 void UIStaticBitmap::Slot25(int x, int y) { - static_cast(this->parent)->Slot25((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot25((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085EA30 // FUNCTION: fn_10836 void UIStaticBitmap::Slot26(int x, int y) { - static_cast(this->parent)->Slot26((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot26((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F8A0 // FUNCTION: fn_10872 void UIStaticBitmap::Slot27(int x, int y) { - static_cast(this->parent)->Slot27((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot27((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F500 // FUNCTION: fn_10865 void UIStaticBitmap::Slot28(int x, int y) { if (this->forwardHover != 0) { - static_cast(this->parent)->Slot28(x, y); + this->parent->Slot28(x, y); } if (!this->tooltip.empty()) { int screenX = this->tooltipX; int screenY = this->tooltipY; - for (const UIWindow* window = this; window; window = static_cast(window->parent)) { + for (const UIWindow* window = this; window; window = window->parent) { screenX = (screenX + window->geometry.x); screenY = (screenY + window->geometry.y); } @@ -78,29 +78,29 @@ void UIStaticBitmap::Slot28(int x, int y) { // OFFSET: 0x0085FA80 // FUNCTION: fn_10880 void UIStaticBitmap::ResetCursor(int x, int y) { - static_cast(this->parent)->ResetCursor((x + this->geometry.x), (y + this->geometry.y)); + this->parent->ResetCursor((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085F000 // FUNCTION: fn_10854 void UIStaticBitmap::Slot31(int x, int y) { - static_cast(this->parent)->Slot31((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot31((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085FEA0 // FUNCTION: fn_10888 void UIStaticBitmap::Slot32(int x, int y) { - static_cast(this->parent)->Slot32((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot32((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x0085FF00 // FUNCTION: fn_10890 void UIStaticBitmap::Slot33(int x, int y) { - static_cast(this->parent)->Slot33((x + this->geometry.x), (y + this->geometry.y)); + this->parent->Slot33((x + this->geometry.x), (y + this->geometry.y)); } // OFFSET: 0x00860010 // FUNCTION: fn_10896 void UIStaticBitmap::Slot35(int value) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } diff --git a/Source/UI/Window/FrameFocus.cpp b/Source/UI/Window/FrameFocus.cpp index b545ae1..657e9a2 100644 --- a/Source/UI/Window/FrameFocus.cpp +++ b/Source/UI/Window/FrameFocus.cpp @@ -70,5 +70,5 @@ void FrameFocus::Clear() { // OFFSET: 0x00A913F0 // FUNCTION: fn_17158 UIWindow* FrameFocus::Get() const { - return static_cast(this->focused); + return this->focused; } diff --git a/Source/UI/Window/FrameFocus.h b/Source/UI/Window/FrameFocus.h index 5ebe935..ed8e527 100644 --- a/Source/UI/Window/FrameFocus.h +++ b/Source/UI/Window/FrameFocus.h @@ -1,8 +1,6 @@ #ifndef RAGNAROK_SOURCE_UI_WINDOW_FRAMEFOCUS_H #define RAGNAROK_SOURCE_UI_WINDOW_FRAMEFOCUS_H -#include "UI/Window/WindowAncestry.h" - #include class UIWindow; @@ -10,7 +8,7 @@ class WindowManagerWindows; struct FrameFocus { std::list& order; - WindowAncestry*& focused; + UIWindow*& focused; WindowManagerWindows& windows; bool IsOrderFixed(int id); diff --git a/Source/UI/Window/InputFocus.cpp b/Source/UI/Window/InputFocus.cpp index 02293c8..18a4122 100644 --- a/Source/UI/Window/InputFocus.cpp +++ b/Source/UI/Window/InputFocus.cpp @@ -24,7 +24,7 @@ void InputFocus::Set(UIWindow* value) { // FUNCTION: fn_17257 void InputFocus::First() { if (this->window) { - UIWindow* parent = static_cast(this->window->parent); + UIWindow* parent = this->window->parent; for (UIWindow* child : parent->m_children) { if (!child->Slot05()) { @@ -54,7 +54,7 @@ void InputFocus::Next() { return; } - UIWindow* parent = static_cast(this->window->parent); + UIWindow* parent = this->window->parent; bool found = false; for (UIWindow* child : parent->m_children) { @@ -85,7 +85,7 @@ void InputFocus::Advance() { return; } - UIWindow* parent = static_cast(this->window->parent); + UIWindow* parent = this->window->parent; bool found = false; for (UIWindow* child : parent->m_children) { diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index f39bbb8..c0b3c17 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -17,7 +17,7 @@ bool CUIControl::CanHitTest() { // FUNCTION: fn_14634 void CUIControl::Slot10(int x, int y, std::intptr_t value) { if (this->parent) { - static_cast(this->parent)->Slot10(x + this->geometry.x, y + this->geometry.y, value); + this->parent->Slot10(x + this->geometry.x, y + this->geometry.y, value); } } @@ -25,7 +25,7 @@ void CUIControl::Slot10(int x, int y, std::intptr_t value) { // FUNCTION: fn_14639 void CUIControl::Slot25(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot25(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot25(x + this->geometry.x, y + this->geometry.y); } } @@ -33,7 +33,7 @@ void CUIControl::Slot25(int x, int y) { // FUNCTION: fn_14638 void CUIControl::Slot26(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot26(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot26(x + this->geometry.x, y + this->geometry.y); } } @@ -41,7 +41,7 @@ void CUIControl::Slot26(int x, int y) { // FUNCTION: fn_14642 void CUIControl::Slot27(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot27(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot27(x + this->geometry.x, y + this->geometry.y); } } @@ -49,7 +49,7 @@ void CUIControl::Slot27(int x, int y) { // FUNCTION: fn_14641 void CUIControl::Slot28(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot28(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot28(x + this->geometry.x, y + this->geometry.y); } } @@ -57,7 +57,7 @@ void CUIControl::Slot28(int x, int y) { // FUNCTION: fn_14643 void CUIControl::ResetCursor(int x, int y) { if (this->parent) { - static_cast(this->parent)->ResetCursor(x + this->geometry.x, y + this->geometry.y); + this->parent->ResetCursor(x + this->geometry.x, y + this->geometry.y); } } @@ -65,7 +65,7 @@ void CUIControl::ResetCursor(int x, int y) { // FUNCTION: fn_14640 void CUIControl::Slot31(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot31(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot31(x + this->geometry.x, y + this->geometry.y); } } @@ -73,7 +73,7 @@ void CUIControl::Slot31(int x, int y) { // FUNCTION: fn_14645 void CUIControl::Slot32(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot32(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot32(x + this->geometry.x, y + this->geometry.y); } } @@ -81,7 +81,7 @@ void CUIControl::Slot32(int x, int y) { // FUNCTION: fn_14646 void CUIControl::Slot33(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot33(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot33(x + this->geometry.x, y + this->geometry.y); } } @@ -89,7 +89,7 @@ void CUIControl::Slot33(int x, int y) { // FUNCTION: fn_14644 void CUIControl::Slot34(int x, int y) { if (this->parent) { - static_cast(this->parent)->Slot34(x + this->geometry.x, y + this->geometry.y); + this->parent->Slot34(x + this->geometry.x, y + this->geometry.y); } } @@ -97,7 +97,7 @@ void CUIControl::Slot34(int x, int y) { // FUNCTION: fn_14647 void CUIControl::Slot35(int value) { if (this->parent) { - static_cast(this->parent)->Slot35(value); + this->parent->Slot35(value); } } diff --git a/Source/UI/Window/UIFrameWnd.cpp b/Source/UI/Window/UIFrameWnd.cpp index aff5cfc..d256458 100644 --- a/Source/UI/Window/UIFrameWnd.cpp +++ b/Source/UI/Window/UIFrameWnd.cpp @@ -55,10 +55,9 @@ void UIFrameWnd::ToScreen(int& x, int& y) const { x += this->geometry.x; y += this->geometry.y; - for (const WindowAncestry* node = this->parent; node; node = node->parent) { - const UIWindow* window = static_cast(node); - x += window->geometry.x; - y += window->geometry.y; + for (const UIWindow* node = this->parent; node; node = node->parent) { + x += node->geometry.x; + y += node->geometry.y; } } diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 0c7e0b4..5c4039e 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -8,6 +8,7 @@ #include "Render/Textures/Texture.h" #include "Resource/Bitmap/BitmapImage.h" #include "UI/Window/UIWindow.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowRegistration.h" #include @@ -67,7 +68,7 @@ void UIWindowContext::DestroyDeferredChildren() { // OFFSET: 0x00A79A90 // FUNCTION: fn_16914 UIWindow::UIWindow(UIWindowContext& context, unsigned char cached) - : unknown_0044(0), unknown_0048(0), unknown_004C(4), m_dirty(1), m_uid(++g_windowUid), m_cached(cached), m_clip(0), m_context(&context) { + : parent(nullptr), unknown_0044(0), unknown_0048(0), unknown_004C(4), m_dirty(1), m_uid(++g_windowUid), m_cached(cached), m_clip(0), m_context(&context) { } // OFFSET: 0x00A79E90 @@ -78,15 +79,12 @@ UIWindow::~UIWindow() { this->geometry.surface = nullptr; this->DeleteChildren(); this->m_context->registration.Remove(this); - ForgetWindowReferences( - this, this->m_context->reference_019C, this->m_context->reference_01A0, this->m_context->reference_01B8, this->m_context->reference_0A30, - this->m_context->reference_4F1D4 - ); + this->m_context->windowMgr.ForgetWindowReferences(this); } // INLINED UIWindow* UIWindow::Parent() const { - return static_cast(this->parent); + return this->parent; } // OFFSET: 0x00A82EB0 @@ -557,7 +555,7 @@ UIWindow* UIWindow::Root() { UIWindow* root = this; while (root->parent) { - root = static_cast(root->parent); + root = root->parent; } return root; @@ -590,10 +588,7 @@ void UIWindow::DeferDeletion(UIWindow* window) { return; } - ForgetWindowReferences( - window, this->m_context->reference_019C, this->m_context->reference_01A0, this->m_context->reference_01B8, this->m_context->reference_0A30, - this->m_context->reference_4F1D4 - ); + this->m_context->windowMgr.ForgetWindowReferences(window); this->m_context->deferredDeletion.insert(window); window->Show(0); } diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 9cf72ed..e853832 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -2,9 +2,9 @@ #define RAGNAROK_SOURCE_UI_WINDOW_UIWINDOW_H #include "Render/Primitives/UIRPData.h" -#include "UI/Window/WindowAncestry.h" #include "UI/Layout/WindowGeometry.h" +#include #include #include @@ -15,6 +15,7 @@ class CRenderer; struct ModeCursor; struct WindowRegistration; class UIWindow; +class UIWindowMgr; struct RenderQueues; struct BitmapImage; class FontCache; @@ -28,17 +29,13 @@ struct UIWindowContext { ModeCursor& cursor; std::uint32_t& cursorTick; WindowRegistration& registration; - WindowAncestry*& reference_019C; - WindowAncestry*& reference_01A0; - WindowAncestry*& reference_01B8; - WindowAncestry*& reference_0A30; - WindowAncestry*& reference_4F1D4; + UIWindowMgr& windowMgr; std::unordered_set& deferredDeletion; void DestroyDeferredChildren(); }; -class UIWindow : public UIRPData, public WindowAncestry { +class UIWindow : public UIRPData { friend struct WindowDialogs; friend struct InputFocus; friend class CUIDropDownBox; @@ -107,6 +104,7 @@ public: void InvalidateChildren(); bool Contains(const UIWindow* window) const; + bool IsDescendantOf(const UIWindow* ancestor) const; UIWindow* FindUid(std::uint32_t uid); // INLINED std::uint32_t Uid() const { @@ -133,6 +131,7 @@ public: return this->unknown_0048; } + /* 0010 */ UIWindow* parent; /* 0014 */ WindowGeometry geometry; protected: @@ -160,6 +159,7 @@ extern std::uint32_t g_windowUid; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(UIWindow) == 128); +static_assert(offsetof(UIWindow, parent) == 0x10); #endif #endif diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index b877753..0758dcc 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -422,6 +422,7 @@ public: UIWindow* LookupWindow(int id); void Schedule(UIWindow* window); void Destroy(UIWindow* window); + void ForgetWindowReferences(UIWindow* removed); void DismissTransient(); void RegisterNamedWindow(std::string name, UIWindow* window); void InvalidateAll(); diff --git a/Source/UI/Window/WindowAncestry.cpp b/Source/UI/Window/WindowAncestry.cpp index fc76320..6bbcbee 100644 --- a/Source/UI/Window/WindowAncestry.cpp +++ b/Source/UI/Window/WindowAncestry.cpp @@ -1,13 +1,10 @@ -#include "UI/Window/WindowAncestry.h" - -// INLINED -WindowAncestry::WindowAncestry() : parent(nullptr) { -} +#include "UI/Window/UIWindow.h" +#include "UI/Window/UIWindowMgr.h" // OFFSET: 0x00A81C90 // FUNCTION: fn_16985 -bool WindowAncestry::IsDescendantOf(const WindowAncestry* ancestor) const { - for (const WindowAncestry* node = this->parent; node; node = node->parent) { +bool UIWindow::IsDescendantOf(const UIWindow* ancestor) const { + for (const UIWindow* node = this->parent; node; node = node->parent) { if (node == ancestor) { return true; } @@ -18,27 +15,24 @@ bool WindowAncestry::IsDescendantOf(const WindowAncestry* ancestor) const { // OFFSET: 0x00A8C200 // FUNCTION: fn_17130 -void ForgetWindowReferences( - WindowAncestry* removed, WindowAncestry*& reference_019C, WindowAncestry*& reference_01A0, WindowAncestry*& reference_01B8, WindowAncestry*& reference_0A30, - WindowAncestry*& reference_4F1D4 -) { - if (reference_019C && (reference_019C == removed || reference_019C->IsDescendantOf(removed))) { - reference_019C = nullptr; +void UIWindowMgr::ForgetWindowReferences(UIWindow* removed) { + if (this->inputWindow && (this->inputWindow == removed || this->inputWindow->IsDescendantOf(removed))) { + this->inputWindow = nullptr; } - if (reference_01A0 && (reference_01A0 == removed || reference_01A0->IsDescendantOf(removed))) { - reference_01A0 = nullptr; + if (this->hoverWindow && (this->hoverWindow == removed || this->hoverWindow->IsDescendantOf(removed))) { + this->hoverWindow = nullptr; } - if (reference_01B8 && (reference_01B8 == removed || reference_01B8->IsDescendantOf(removed))) { - reference_01B8 = nullptr; + if (this->window_01B8 && (this->window_01B8 == removed || this->window_01B8->IsDescendantOf(removed))) { + this->window_01B8 = nullptr; } - if (reference_0A30 && reference_0A30 == removed) { - reference_0A30 = nullptr; + if (this->window_0A30 && this->window_0A30 == removed) { + this->window_0A30 = nullptr; } - if (reference_4F1D4 && (reference_4F1D4 == removed || reference_4F1D4->IsDescendantOf(removed))) { - reference_4F1D4 = nullptr; + if (this->window_4F1D4 && (this->window_4F1D4 == removed || this->window_4F1D4->IsDescendantOf(removed))) { + this->window_4F1D4 = nullptr; } } diff --git a/Source/UI/Window/WindowDialogs.cpp b/Source/UI/Window/WindowDialogs.cpp index afd70e1..f699ef4 100644 --- a/Source/UI/Window/WindowDialogs.cpp +++ b/Source/UI/Window/WindowDialogs.cpp @@ -126,13 +126,13 @@ void WindowDialogs::RestoreInput() { } if (this->input) { - static_cast(this->input)->Slot24(child->Slot06() == this->input); + this->input->Slot24(child->Slot06() == this->input); } this->input = child->Slot06(); if (this->input) { - static_cast(this->input)->Slot23(); + this->input->Slot23(); } return; @@ -168,13 +168,13 @@ int WindowDialogs::Confirm( this->dialog.retirement.rendered.push_front(box); if (this->capture) { - this->suspendedRoots.insert(static_cast(this->capture)->Root()); + this->suspendedRoots.insert(this->capture->Root()); } this->capture = nullptr; if (this->input) { - static_cast(this->input)->Slot24(0); + this->input->Slot24(0); } this->input = nullptr; diff --git a/Source/UI/Window/WindowDialogs.h b/Source/UI/Window/WindowDialogs.h index a2fe581..fee8f5a 100644 --- a/Source/UI/Window/WindowDialogs.h +++ b/Source/UI/Window/WindowDialogs.h @@ -10,7 +10,6 @@ class UIMessageBox; struct UIWindowContext; struct UIFrameContext; struct UIMessageBoxContext; -struct WindowAncestry; class ModalFramePump { public: @@ -26,8 +25,8 @@ struct WindowDialogs { UIMessageBoxContext& dialog; int& result; std::set& suspendedRoots; - WindowAncestry*& capture; - WindowAncestry*& input; + UIWindow*& capture; + UIWindow*& input; std::deque& modal; int& alternateResult; UIMessageBox*& latest; diff --git a/Source/UI/Window/WindowMouseHit.cpp b/Source/UI/Window/WindowMouseHit.cpp index 34d3895..f05b930 100644 --- a/Source/UI/Window/WindowMouseHit.cpp +++ b/Source/UI/Window/WindowMouseHit.cpp @@ -68,7 +68,7 @@ bool WindowMouseCapture::Dispatch() { const int y = this->mouse.y; int left; int top; - UIWindow* window = static_cast(this->capture); + UIWindow* window = this->capture; WindowScreenPosition(window, left, top); const int localX = x - left; const int localY = y - top; @@ -79,28 +79,28 @@ bool WindowMouseCapture::Dispatch() { this->ordering.Promote(root); } - static_cast(this->capture)->Slot25(localX, localY); + this->capture->Slot25(localX, localY); } if (this->mouse.buttons[0] == 4 && (this->doubleClickGate == 0 || this->alternateDoubleClickGate == 0)) { - static_cast(this->capture)->Slot25(localX, localY); - static_cast(this->capture)->Slot26(localX, localY); + this->capture->Slot25(localX, localY); + this->capture->Slot26(localX, localY); } - static_cast(this->capture)->ResetCursor(localX, localY); + this->capture->ResetCursor(localX, localY); if (this->previousX == x && this->previousY == y) { - static_cast(this->capture)->Slot28(localX, localY); + this->capture->Slot28(localX, localY); } else { - static_cast(this->capture)->Slot27(localX, localY); + this->capture->Slot27(localX, localY); } if (this->mouse.wheel != 0) { - static_cast(this->capture)->Slot35(this->mouse.wheel); + this->capture->Slot35(this->mouse.wheel); } if (this->mouse.buttons[0] == 3) { - static_cast(this->capture)->Slot31(localX, localY); + this->capture->Slot31(localX, localY); } return true; @@ -208,11 +208,11 @@ int WindowMouseUncaptured::Dispatch() { if (this->hover && this->hover != window) { int left; int top; - WindowScreenPosition(static_cast(this->hover), left, top); + WindowScreenPosition(this->hover, left, top); const int localX = x - left; const int localY = y - top; - static_cast(this->hover)->Slot27(localX, localY); - static_cast(this->hover)->ResetCursor(localX, localY); + this->hover->Slot27(localX, localY); + this->hover->ResetCursor(localX, localY); } this->hover = window; diff --git a/Source/UI/Window/WindowMouseHit.h b/Source/UI/Window/WindowMouseHit.h index 104e558..ce4277f 100644 --- a/Source/UI/Window/WindowMouseHit.h +++ b/Source/UI/Window/WindowMouseHit.h @@ -9,7 +9,6 @@ class UIWindow; class CMouse; -struct WindowAncestry; struct WindowOrdering; class WindowManagerWindows; struct WindowDropDown; @@ -25,7 +24,7 @@ struct WindowMouseHit { }; struct WindowMouseCapture { - WindowAncestry*& capture; + UIWindow*& capture; WindowOrdering& ordering; const CMouse& mouse; const int& previousX; @@ -50,7 +49,7 @@ struct WindowMouseUncaptured { UIWindow*& pressedRoot; UIWindow* const& dismiss26; UIWindow* const& dismiss260; - WindowAncestry*& hover; + UIWindow*& hover; std::array refresh; const int& refreshGate; diff --git a/Source/UI/Window/WindowRegistration.cpp b/Source/UI/Window/WindowRegistration.cpp index 2ccbe12..f8f1468 100644 --- a/Source/UI/Window/WindowRegistration.cpp +++ b/Source/UI/Window/WindowRegistration.cpp @@ -3,8 +3,8 @@ // OFFSET: 0x00A8B060 // FUNCTION: fn_17120 -void WindowRegistration::Add(WindowAncestry* window) { - for (WindowAncestry* existing : this->windows) { +void WindowRegistration::Add(UIWindow* window) { + for (UIWindow* existing : this->windows) { if (existing == window) { return; } @@ -15,7 +15,7 @@ void WindowRegistration::Add(WindowAncestry* window) { // OFFSET: 0x00AA7200 // FUNCTION: fn_17236 -void WindowRegistration::Remove(WindowAncestry* window) { +void WindowRegistration::Remove(UIWindow* window) { for (auto entry = this->windows.begin(); entry != this->windows.end(); ++entry) { if (*entry == window) { this->windows.erase(entry); @@ -27,8 +27,8 @@ void WindowRegistration::Remove(WindowAncestry* window) { // OFFSET: 0x00AA6650 // FUNCTION: fn_17231 void WindowRegistration::InvalidateAll() { - for (WindowAncestry* window : this->windows) { - static_cast(window)->Invalidate(); + for (UIWindow* window : this->windows) { + window->Invalidate(); } this->windows.clear(); diff --git a/Source/UI/Window/WindowRegistration.h b/Source/UI/Window/WindowRegistration.h index f438c02..647af59 100644 --- a/Source/UI/Window/WindowRegistration.h +++ b/Source/UI/Window/WindowRegistration.h @@ -3,13 +3,13 @@ #include -struct WindowAncestry; +class UIWindow; struct WindowRegistration { - /* 018C */ std::list windows; + /* 018C */ std::list windows; - void Add(WindowAncestry* window); - void Remove(WindowAncestry* window); + void Add(UIWindow* window); + void Remove(UIWindow* window); void InvalidateAll(); }; diff --git a/Source/UI/Window/WindowRetirement.cpp b/Source/UI/Window/WindowRetirement.cpp index 2433fcd..c1dc081 100644 --- a/Source/UI/Window/WindowRetirement.cpp +++ b/Source/UI/Window/WindowRetirement.cpp @@ -80,7 +80,7 @@ void UIWindowMgr::DismissTransient() { // INLINED void WindowRetirement::DrainPending( - const std::deque& modal, UIWindow*& reference_4F16C, WindowAncestry*& capture, WindowAncestry*& input, WindowAncestry*& hover + const std::deque& modal, UIWindow*& reference_4F16C, UIWindow*& capture, UIWindow*& input, UIWindow*& hover ) { if (!modal.empty() && modal.back()) { return; diff --git a/Source/UI/Window/WindowRetirement.h b/Source/UI/Window/WindowRetirement.h index 3b56760..57b758b 100644 --- a/Source/UI/Window/WindowRetirement.h +++ b/Source/UI/Window/WindowRetirement.h @@ -5,12 +5,11 @@ class UIWindow; class UIWindowMgr; -struct WindowAncestry; struct WindowRetirement { UIWindowMgr& windows; - void DrainPending(const std::deque& modal, UIWindow*& reference_4F16C, WindowAncestry*& capture, WindowAncestry*& input, WindowAncestry*& hover); + void DrainPending(const std::deque& modal, UIWindow*& reference_4F16C, UIWindow*& capture, UIWindow*& input, UIWindow*& hover); }; #endif