rodecomp/Source/UI/Shortcuts/ShortcutVisibility.cpp
ragnarok-clanker c932ad6499 Maintenance: Resubmission of 15134 without the 12 struct/type renames (their new names changed mangled symbols in 17 functions). Rena
Batch #15141 by ragnarok-clanker: no function's compiled code changes; checked with 537 compiled unit(s), including every includer of Source/Client/Input/LanguageTC.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Contents/AchievementMgr.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/EnchantMgr.h, Source/Contents/GuildInfo.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/Schedule/TimeScheduler.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/TableMng.h, Source/Contents/World/SkyBox.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl.
2026-11-09 12:21:09 +00:00

163 lines
3.9 KiB
C++

#include "UI/Window/WindowId.h"
#include "Client/Replay.h"
#include "UI/Window/WindowId.h"
#include "Contents/Configuration/ServiceOptions.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/UIWindowMgr.inl"
#include <algorithm>
namespace {
// INLINED
__forceinline void PromoteWindow(UIWindow* window) {
if ((g_windowMgr.modal != nullptr && g_windowMgr.navigationWnd != window) || g_windowMgr.LookupWindow(WID_NEWMAKECHARWND) || g_windowMgr.LookupWindow(WID_MAKECHARWND) ||
g_windowMgr.LookupWindow(WID_SECONDPASSWORDINPUTWND) || g_windowMgr.LookupWindow(WID_SECONDPASSWORDEDITWND)) {
return;
}
int companion = -1;
if (window->geometry.id == 12) {
companion = 234;
} else if (window->geometry.id == 82) {
companion = 250;
}
if (companion != -1) {
const auto found = std::find_if(g_windowMgr.rendered.begin(), g_windowMgr.rendered.end(), [&](const UIWindow* value) {
return value->geometry.id == companion;
});
if (found != g_windowMgr.rendered.end()) {
UIWindow* value = *found;
g_windowMgr.rendered.erase(found);
g_windowMgr.rendered.push_back(value);
}
}
const auto found = std::find(g_windowMgr.rendered.begin(), g_windowMgr.rendered.end(), window);
if (found != g_windowMgr.rendered.end()) {
g_windowMgr.rendered.erase(found);
g_windowMgr.rendered.push_back(window);
}
}
}
// OFFSET: 0x00AAA310
// FUNCTION: fn_17269
bool UIWindowMgr::ShowWindowById(int id, int visible) {
switch (id) {
case WID_CHATWND: {
if (g_replayAnimationScaling && !Replay::Instance().header.options.recordRestricted) {
return false;
}
this->chatWndVisible = visible;
if (!this->chatWnd) {
g_windowMgr.EnsureWindow(WID_CHATWND);
}
this->chatWnd->Show(visible);
UIWindow* window = this->chatWnd;
if (visible == 0) {
window->StoreInfo();
return true;
}
PromoteWindow(window);
return true;
}
case WID_ITEMDROPCNTWND:
g_windowMgr.EnsureWindow(WID_ITEMDROPCNTWND);
if (this->itemDropCntWnd->geometry.visible != visible) {
this->itemDropCntWnd->Show(visible);
}
if (visible != 0) {
PromoteWindow(this->itemDropCntWnd);
}
return false;
case WID_SHORTCUTWND:
if (g_replayAnimationScaling && !Replay::Instance().header.options.showItemSlots) {
return false;
}
this->m_normalItemSlotWindow.show = visible;
g_windowMgr.EnsureWindow(WID_SHORTCUTWND);
this->shortCutWnd->Show(visible);
if (visible != 0) {
PromoteWindow(this->shortCutWnd);
}
if (g_serviceOptions.Get(0x10E)) {
g_windowMgr.EnsureWindow(WID_QUIKSLOTWND);
}
if (UIWindow* companion = g_windowMgr.LookupWindow(WID_QUIKSLOTWND)) {
companion->Show(visible);
if (visible != 0) {
PromoteWindow(companion);
}
}
return true;
case WID_SKILLDESCRIBEWND: {
this->skillDescriptionVisible = visible;
if (!this->skillDescribeWnd) {
if (visible == 0) {
return true;
}
g_windowMgr.EnsureWindow(WID_SKILLDESCRIBEWND);
if (!this->skillDescribeWnd) {
return true;
}
}
this->skillDescribeWnd->Show(visible);
UIWindow* window = this->skillDescribeWnd;
if (visible == 0) {
window->StoreInfo();
return true;
}
PromoteWindow(window);
return true;
}
case WID_MINIMAPWND:
g_windowMgr.LookupWindow(WID_MINIMAPWND)->Show(visible);
return true;
case WID_ROUNDBOXTOOLTIPWND:
this->visible_276 = visible;
if (!this->roundBoxTooltipWnd) {
if (visible == 0) {
return true;
}
g_windowMgr.EnsureWindow(WID_ROUNDBOXTOOLTIPWND);
if (!this->roundBoxTooltipWnd) {
return true;
}
}
this->roundBoxTooltipWnd->Show(visible);
return true;
}
return false;
}