Batch #14926 by Toshiro: 0 byte-identical, 1 confirmed by peer review. - fn_17269 UIWindowMgr::ShowWindowById: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, codeplay, raiken, Stingor Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
161 lines
3.5 KiB
C++
161 lines
3.5 KiB
C++
#include "Client/Replay.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.window_4F174 != window) || g_windowMgr.LookupWindow(278) || g_windowMgr.LookupWindow(4) ||
|
|
g_windowMgr.LookupWindow(199) || g_windowMgr.LookupWindow(200)) {
|
|
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 1: {
|
|
if (g_replayAnimationScaling && !Replay::Instance().header.options.recordRestricted) {
|
|
return false;
|
|
}
|
|
|
|
this->unknown_003C = visible;
|
|
|
|
if (!this->window_01C8) {
|
|
g_windowMgr.EnsureWindow(1);
|
|
}
|
|
|
|
this->window_01C8->Show(visible);
|
|
UIWindow* window = this->window_01C8;
|
|
|
|
if (visible == 0) {
|
|
window->StoreInfo();
|
|
return true;
|
|
}
|
|
|
|
PromoteWindow(window);
|
|
return true;
|
|
}
|
|
|
|
case 15:
|
|
g_windowMgr.EnsureWindow(15);
|
|
|
|
if (this->window_01EC->geometry.visible != visible) {
|
|
this->window_01EC->Show(visible);
|
|
}
|
|
|
|
if (visible != 0) {
|
|
PromoteWindow(this->window_01EC);
|
|
}
|
|
|
|
return false;
|
|
|
|
case 36:
|
|
if (g_replayAnimationScaling && !Replay::Instance().header.options.unknown_0007) {
|
|
return false;
|
|
}
|
|
|
|
this->m_normalItemSlotWindow.show = visible;
|
|
g_windowMgr.EnsureWindow(36);
|
|
this->window_01E8->Show(visible);
|
|
|
|
if (visible != 0) {
|
|
PromoteWindow(this->window_01E8);
|
|
}
|
|
|
|
if (g_serviceOptions.Get(0x10E)) {
|
|
g_windowMgr.EnsureWindow(159);
|
|
}
|
|
|
|
if (UIWindow* companion = g_windowMgr.LookupWindow(159)) {
|
|
companion->Show(visible);
|
|
|
|
if (visible != 0) {
|
|
PromoteWindow(companion);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
|
|
case 46: {
|
|
this->unknown_0048 = visible;
|
|
|
|
if (!this->window_0230) {
|
|
if (visible == 0) {
|
|
return true;
|
|
}
|
|
|
|
g_windowMgr.EnsureWindow(46);
|
|
|
|
if (!this->window_0230) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
this->window_0230->Show(visible);
|
|
UIWindow* window = this->window_0230;
|
|
|
|
if (visible == 0) {
|
|
window->StoreInfo();
|
|
return true;
|
|
}
|
|
|
|
PromoteWindow(window);
|
|
return true;
|
|
}
|
|
|
|
case 273:
|
|
g_windowMgr.LookupWindow(273)->Show(visible);
|
|
return true;
|
|
|
|
case 276:
|
|
this->visible_276 = visible;
|
|
|
|
if (!this->window_4F1E4) {
|
|
if (visible == 0) {
|
|
return true;
|
|
}
|
|
|
|
g_windowMgr.EnsureWindow(276);
|
|
|
|
if (!this->window_4F1E4) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
this->window_4F1E4->Show(visible);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|