rodecomp/Source/UI/Window/UIWindowFactory.cpp
ragnarok-clanker 858265cc69 Maintenance: Second pass: name remaining numeric switch case labels (identifier-only; no code change). ~3,500 more labels across 150
Batch #14936 by ragnarok-clanker: no function's compiled code changes; checked with 158 compiled unit(s), including every includer of Source/Client/Mode/GameModeEnums.h, Source/Client/Mode/ModeMessage.h, Source/Contents/Actors/ActorEnums.h, Source/Contents/Actors/PetEnums.h, Source/Contents/Combat/CombatTypes.h, Source/Contents/Configuration/ServiceEnums.h, Source/Contents/Effects/EffectPrimId.h, Source/Contents/Hotkeys/InterfaceHotkey.h, Source/Contents/Items/ItemId.h, Source/Contents/Items/ItemType.h, Source/Network/Packets/ModeResultEnums.h, Source/Network/Packets/NoticeEnums.h, Source/Network/Packets/PacketId.h, Source/UI/Window/UIEnums.h, Source/UI/Window/WindowId.h.
2026-11-08 12:37:46 +00:00

90 lines
2.7 KiB
C++

#include "UI/Window/UIWindowFactory.h"
#include "Client/Session.h"
#include "Render/Renderer.h"
#include "Script/LuaScript.h"
#include "UI/EntryQueue/UIEntryQueueWnd.h"
#include "UI/Shortcuts/UIQuickSlotWnd.h"
#include "UI/Window/UIHotKeyWnd.h"
#include "UI/Window/UISerachStoreInfoWnd.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowId.h"
#include <string>
extern template std::_List_node<UIWindow*, void*>* std::list<UIWindow*>::_Emplace<UIWindow* const&>(std::_List_node<UIWindow*, void*>* const, UIWindow* const&);
// GLOBAL: gl_25184
bool g_searchStoreInfoCreated;
// OFFSET: 0x00AA1350
// FUNCTION: fn_17208
UIWindow* UIWindowMgr::CreateLayoutWindow(int id) {
int width = 0;
int height = 0;
int x = 0;
int y = 0;
if (!g_session.m_hotkeyScript->Call("GetWindowInfo", "d>dddd", id, &width, &height, &x, &y)) {
return nullptr;
}
x = g_renderer->viewport.width * x / 1024;
y = g_renderer->viewport.height * y / 768;
UIWindow* window = this->LookupWindow(id);
std::string yKey;
std::string xKey;
if (window == nullptr) {
switch (id) {
case WID_HOTKEYWND:
window = new UIHotKeyWnd();
this->unknown_0404 = window;
break;
case WID_JOINTO_BATTLEFIELDWND:
window = new UIEntryQueueWnd();
break;
case WID_QUIKSLOTWND:
window = new UIQuickSlotWnd();
break;
case WID_SEARCH_STORE_INFO:
window = new UISerachStoreInfoWnd();
g_searchStoreInfoCreated = true;
break;
case WID_ENTRYQUEUESTANDBYWND:
window = new UIEntryQueueStandByWnd();
break;
}
int savedX;
int savedY;
auto saved = this->savedRectangles.find(id);
if (saved != this->savedRectangles.end() && saved->second != nullptr) {
savedX = saved->second->x;
savedY = saved->second->y;
} else {
savedX = g_session.GetOptionInteger(xKey.c_str(), x);
savedY = g_session.GetOptionInteger(yKey.c_str(), y);
}
window->SetId(id);
window->SetSize(width, height);
if (savedX >= 0 && savedX <= g_renderer->viewport.width - window->geometry.width && savedY >= 0 &&
savedY <= g_renderer->viewport.height - window->geometry.height) {
x = savedX;
y = savedY;
}
window->Move(x, y);
this->rendered.push_back(window);
if (id == 0x9F) {
window->SendMsg(nullptr, 0x22, reinterpret_cast<std::intptr_t>(this->unknown_0934), 0, 0, 0);
} else if (id == 0x9D) {
window->SendMsg(nullptr, 0x22, reinterpret_cast<std::intptr_t>(this->unknown_0944), 0, 0, 0);
} else if (id == 0xD4) {
window->SendMsg(nullptr, 0x22, reinterpret_cast<std::intptr_t>(this->unknown_09D4), 0, 0, 0);
}
}
return window;
}