diff --git a/Source/UI/Shortcuts/ShortcutVisibility.cpp b/Source/UI/Shortcuts/ShortcutVisibility.cpp new file mode 100644 index 0000000..6d1e145 --- /dev/null +++ b/Source/UI/Shortcuts/ShortcutVisibility.cpp @@ -0,0 +1,97 @@ +#include "UI/Shortcuts/ShortcutVisibility.h" + +// OFFSET: 0x00AAA310 +// FUNCTION: fn_17269 +bool WindowVisibility::Show(int id, int visible) { + switch (id) { + case 1: { + if (this->restricted && !this->replayAllowsBasicInfo) { + return false; + } + + this->basicInfoVisible = visible; + + if (!this->basicInfo) { + this->windows.EnsureWindow(1); + } + + this->basicInfo->Show(visible); + UIWindow* window = this->basicInfo; + + if (visible == 0) { + window->Slot11(); + return true; + } + + this->ordering.Promote(window); + return true; + } + + case 15: + this->windows.EnsureWindow(15); + + if (this->window15->geometry.visible != visible) { + this->window15->Show(visible); + } + + if (visible != 0) { + this->ordering.Promote(this->window15); + } + + return false; + + case 36: + return this->shortcut.Show(visible); + + case 46: { + this->window46Visible = visible; + + if (!this->window46) { + if (visible == 0) { + return true; + } + + this->windows.EnsureWindow(46); + + if (!this->window46) { + return true; + } + } + + this->window46->Show(visible); + UIWindow* window = this->window46; + + if (visible == 0) { + window->Slot11(); + return true; + } + + this->ordering.Promote(window); + return true; + } + + case 273: + this->windows.LookupWindow(273)->Show(visible); + return true; + + case 276: + this->window276Visible = visible; + + if (!this->window276) { + if (visible == 0) { + return true; + } + + this->windows.EnsureWindow(276); + + if (!this->window276) { + return true; + } + } + + this->window276->Show(visible); + return true; + } + + return false; +} diff --git a/Source/UI/Shortcuts/ShortcutVisibility.h b/Source/UI/Shortcuts/ShortcutVisibility.h index 892c146..bba4373 100644 --- a/Source/UI/Shortcuts/ShortcutVisibility.h +++ b/Source/UI/Shortcuts/ShortcutVisibility.h @@ -48,4 +48,21 @@ inline bool ShortcutVisibility::Show(int value) { return true; } +struct WindowVisibility { + WindowManagerWindows& windows; + WindowOrdering& ordering; + ShortcutVisibility& shortcut; + int& basicInfoVisible; + UIWindow*& basicInfo; + UIWindow*& window15; + int& window46Visible; + UIWindow*& window46; + int& window276Visible; + UIWindow*& window276; + const bool& restricted; + const bool& replayAllowsBasicInfo; + + bool Show(int id, int visible); +}; + #endif diff --git a/data/compile.json b/data/compile.json index 032233d..007b14e 100644 --- a/data/compile.json +++ b/data/compile.json @@ -661,6 +661,7 @@ "Source/UI/Shortcuts/ShortcutPainting.cpp": 2, "Source/UI/Shortcuts/ShortcutPress.cpp": 2, "Source/UI/Shortcuts/ShortcutTooltip.cpp": 2, + "Source/UI/Shortcuts/ShortcutVisibility.cpp": 2, "Source/UI/Shortcuts/UIShortCutWnd.cpp": 2, "Source/UI/Text/ColoredText.cpp": 2, "Source/UI/Text/ItemLinkDisplay.cpp": 2,