rodecomp/Source/UI/Window/WindowDialogs.cpp
ragnarok-clanker 2b755e795a Maintenance: [forced, user-approved] Family F6 (closes family F): delete the four headers left empty or orphaned by F1-F5. WindowDial
Batch #10239 by ragnarok-clanker: forced by an admin (0 lower score(s), 0 changed function(s)); checked with 494 compiled unit(s), including every includer of Source/UI/GameSettings/GameSettingsUI.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h.
Deletes: Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h
2026-11-03 11:10:29 +00:00

358 lines
8.5 KiB
C++

#include "Client/Application/ApplicationWindow.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/CLoginMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Client/Session.h"
#include "UI/Window/UIMessageBox.h"
#include "UI/Window/UINewSelectCharWnd.h"
#include "UI/Window/UIWindowMgr.h"
// GLOBAL: gl_24604
int g_dialogKeyboardEnabled;
// GLOBAL: gl_24605
int g_dialogKeyboardBlocked;
// OFFSET: 0x00A90950
// FUNCTION: fn_17154
bool UIWindowMgr::ProcessDialogKey(int, int key) {
if (g_dialogKeyboardEnabled == 0 || g_dialogKeyboardBlocked != 0) {
return false;
}
if (!this->window_01E8) {
return false;
}
switch (key) {
case 0x100001:
this->window_01E8->SendMsg(nullptr, 41, 0, 1, 0, 0);
return false;
case 0x110001:
this->window_01E8->SendMsg(nullptr, 41, 1, 1, 0, 0);
return false;
case 0x120001:
this->window_01E8->SendMsg(nullptr, 41, 2, 1, 0, 0);
return false;
case 0x130001:
this->window_01E8->SendMsg(nullptr, 41, 3, 1, 0, 0);
return false;
case 0x140001:
this->window_01E8->SendMsg(nullptr, 41, 4, 1, 0, 0);
return false;
case 0x150001:
this->window_01E8->SendMsg(nullptr, 41, 5, 1, 0, 0);
return false;
case 0x160001:
this->window_01E8->SendMsg(nullptr, 41, 6, 1, 0, 0);
return false;
case 0x170001:
this->window_01E8->SendMsg(nullptr, 41, 7, 1, 0, 0);
return false;
case 0x180001:
this->window_01E8->SendMsg(nullptr, 41, 8, 1, 0, 0);
return false;
case 0x1E0001:
this->window_01E8->SendMsg(nullptr, 41, 0, 2, 0, 0);
return false;
case 0x1F0001:
this->window_01E8->SendMsg(nullptr, 41, 1, 2, 0, 0);
return false;
case 0x200001:
this->window_01E8->SendMsg(nullptr, 41, 2, 2, 0, 0);
return false;
case 0x210001:
this->window_01E8->SendMsg(nullptr, 41, 3, 2, 0, 0);
return false;
case 0x220001:
this->window_01E8->SendMsg(nullptr, 41, 4, 2, 0, 0);
return false;
case 0x230001:
this->window_01E8->SendMsg(nullptr, 41, 5, 2, 0, 0);
return false;
case 0x240001:
this->window_01E8->SendMsg(nullptr, 41, 6, 2, 0, 0);
return false;
case 0x250001:
this->window_01E8->SendMsg(nullptr, 41, 7, 2, 0, 0);
return false;
case 0x260001:
this->window_01E8->SendMsg(nullptr, 41, 8, 2, 0, 0);
return false;
case 0x2C0001:
this->window_01E8->SendMsg(nullptr, 41, 0, 0, 0, 0);
return false;
case 0x2D0001:
this->window_01E8->SendMsg(nullptr, 41, 1, 0, 0, 0);
return false;
case 0x2E0001:
this->window_01E8->SendMsg(nullptr, 41, 2, 0, 0, 0);
return false;
case 0x2F0001:
this->window_01E8->SendMsg(nullptr, 41, 3, 0, 0, 0);
return false;
case 0x300001:
this->window_01E8->SendMsg(nullptr, 41, 4, 0, 0, 0);
return false;
case 0x310001:
this->window_01E8->SendMsg(nullptr, 41, 5, 0, 0, 0);
return false;
case 0x320001:
this->window_01E8->SendMsg(nullptr, 41, 6, 0, 0, 0);
return false;
case 0x330001:
this->window_01E8->SendMsg(nullptr, 41, 7, 0, 0, 0);
return false;
case 0x340001:
this->window_01E8->SendMsg(nullptr, 41, 8, 0, 0, 0);
return false;
default:
return false;
}
}
// OFFSET: 0x00A91450
// FUNCTION: fn_17160
UIWindow* UIWindowMgr::Top() const {
return this->modalWindows.empty() ? nullptr : this->modalWindows.back();
}
// OFFSET: 0x00A91120
// FUNCTION: fn_17155
void UIWindowMgr::RestoreInput() {
for (UIWindow* window : this->rendered) {
if (window->geometry.visible == 0) {
continue;
}
for (UIWindow* child : window->m_children) {
if (!child->Slot05() || child->geometry.x <= 0 || child->geometry.y <= 0) {
continue;
}
if (this->hoverWindow) {
this->hoverWindow->Slot24(child->Slot06() == this->hoverWindow);
}
this->hoverWindow = child->Slot06();
if (this->hoverWindow) {
this->hoverWindow->Slot23();
}
return;
}
}
}
// OFFSET: 0x00A901E0
// FUNCTION: fn_17153
int UIWindowMgr::Confirm(
const char* text, int type, bool defaultAccept, bool replace, int timeout, const char* caption, int width, int height, unsigned char protect
) {
CMode* gameMode = g_modeMgr.GetGameMode();
if (gameMode && static_cast<CGameMode*>(gameMode)->unknown_0624[0] == 1) {
return 185;
}
if (UIWindow* active = this->Top()) {
if (active->SendMsg(nullptr, 158, 0, 0, 0, 0) == 0 && replace) {
active->SendMsg(nullptr, 57, reinterpret_cast<std::intptr_t>(text), 0, 0, 0);
}
return 185;
}
auto* box = new UIMessageBox();
this->window_4F16C = box;
box->Configure(text, type, defaultAccept, timeout, caption, width, height, 1, nullptr);
if (protect == 1) {
box->SendMsg(nullptr, 157, 1, 0, 0, 0);
}
this->rendered.push_front(box);
if (this->inputWindow) {
this->persistentWindows.insert(this->inputWindow->Root());
}
this->inputWindow = nullptr;
if (this->hoverWindow) {
this->hoverWindow->Slot24(0);
}
this->hoverWindow = nullptr;
this->unknown_0474 = 0;
this->modalWindows.push_back(box);
int response = 184;
if (g_modalImmediate == 0) {
CMode* pump = static_cast<CMode*>(g_charViewMode);
for (;;) {
if (this->activeWindowId != 0) {
if (UIWindow* active = this->Top()) {
active->Show(0);
this->Schedule(active);
this->modalWindows.pop_back();
}
response = this->activeWindowId;
if (this->modalWindows.empty()) {
this->activeWindowId = 0;
}
break;
}
if (this->unknown_0474 != 0) {
if (UIWindow* active = this->Top()) {
active->Show(0);
this->Schedule(active);
this->modalWindows.pop_back();
}
response = this->unknown_0474;
this->unknown_0474 = 0;
break;
}
if (pump) {
pump->Update();
pump = static_cast<CMode*>(g_charViewMode);
}
if (g_session.GetOption(20) > 0) {
this->activeWindowId = 0;
this->unknown_0474 = 0;
while (!this->modalWindows.empty()) {
this->Schedule(this->modalWindows.back());
this->modalWindows.pop_back();
}
break;
}
if (g_modalImmediate != 0) {
break;
}
}
}
this->RestoreInput();
return response;
}
// OFFSET: 0x00AA20F0
// FUNCTION: fn_17211
void UIWindowMgr::AddMessageBox(
const char* text, int type, bool defaultAccept, int, int timeout, const char* caption, int width, int height, const char* icon, bool track
) {
std::vector<UIWindow*>& boxes = this->messageBoxes;
if (boxes.size() > 5) {
MessageBoxA(hWnd, "Max MessageBox Count", "ERROR", 0);
return;
}
auto* box = new UIMessageBox();
box->Configure(text, type, defaultAccept, timeout, caption, width, height, 0, icon);
this->rendered.push_back(box);
if (track) {
boxes.push_back(box);
}
this->inputWindow = nullptr;
if (this->hoverWindow) {
this->hoverWindow->Slot24(0);
}
this->hoverWindow = nullptr;
}
// OFFSET: 0x00AA2230
// FUNCTION: fn_17212
int UIWindowMgr::RunModal(UIWindow* window) {
if (!window) {
return 185;
}
if (this->inputWindow) {
this->persistentWindows.insert(this->inputWindow->Root());
}
this->inputWindow = nullptr;
if (this->hoverWindow) {
this->hoverWindow->Slot24(0);
}
this->hoverWindow = nullptr;
this->unknown_0474 = 0;
this->modalWindows.push_back(window);
int response = 184;
if (g_modalImmediate == 0) {
CMode* pump = static_cast<CMode*>(g_charViewMode);
for (;;) {
if (this->activeWindowId != 0) {
if (UIWindow* active = this->Top()) {
active->Show(0);
this->Schedule(active);
this->modalWindows.pop_back();
}
response = this->activeWindowId;
if (this->modalWindows.empty()) {
this->activeWindowId = 0;
}
break;
}
if (this->unknown_0474 != 0) {
if (UIWindow* active = this->Top()) {
active->Show(0);
this->Schedule(active);
this->modalWindows.pop_back();
}
response = this->unknown_0474;
this->unknown_0474 = 0;
break;
}
if (pump) {
pump->Update();
pump = static_cast<CMode*>(g_charViewMode);
}
if (g_session.GetOption(20) > 0) {
this->activeWindowId = 0;
this->unknown_0474 = 0;
while (!this->modalWindows.empty()) {
this->Schedule(this->modalWindows.back());
this->modalWindows.pop_back();
}
break;
}
if (g_modalImmediate != 0) {
break;
}
}
}
this->RestoreInput();
return response;
}