diff --git a/Source/UI/Window/WindowDialogs.h b/Source/UI/Window/WindowDialogs.h index 516cda5f..c3558427 100644 --- a/Source/UI/Window/WindowDialogs.h +++ b/Source/UI/Window/WindowDialogs.h @@ -42,6 +42,7 @@ struct WindowDialogs { const char* text, int type, bool defaultAccept, int unused, int timeout, const char* caption, int width, int height, const char* icon, bool track ); int RunModal(UIWindow* window); + int RunEmailAddress(); }; extern int g_dialogKeyboardEnabled; diff --git a/Source/UI/Window/WindowMgrState.cpp b/Source/UI/Window/WindowMgrState.cpp index 1d88aeda..bd59553f 100644 --- a/Source/UI/Window/WindowMgrState.cpp +++ b/Source/UI/Window/WindowMgrState.cpp @@ -6,7 +6,9 @@ #include "Client/Registry.h" #include "Client/Session.h" #include "Contents/Configuration/ServiceConfiguration.h" +#include "UI/Dialogs/UIEmailAddressWnd.h" #include "UI/Dialogs/UIMemorialDunWnd.h" +#include "UI/Window/UIMessageBox.h" #include "UI/GameSettings/GameSettingsUI.h" #include "UI/Navigation/UINavigationV4Wnd.h" #include "UI/Window/UINavigationWnd.h" @@ -1157,3 +1159,87 @@ void UIWindowMgr::CycleWindowVisibilityTwice() { this->CycleWindowVisibility(4); this->CycleWindowVisibility(4); } + +// OFFSET: 0x00A8FDB0 +// FUNCTION: fn_17151 +int WindowDialogs::RunEmailAddress() { + if (this->Top()) { + return 185; + } + + auto* window = new UIEmailAddressWnd( + this->windows, this->frames, *reinterpret_cast(nullptr), *reinterpret_cast(nullptr) + ); + window->SetSize(280, 48); + window->Move((g_renderer->viewport.width - 640) / 2 + 185, (g_renderer->viewport.height - 480) / 2 + 180); + this->dialog.retirement.rendered.push_front(window); + + if (this->capture) { + this->suspendedRoots.insert(this->capture->Root()); + } + + this->capture = nullptr; + this->alternateResult = 0; + this->modal.push_back(window); + int response = 184; + + if (this->immediate == 0) { + ModalFramePump* pump = this->mode; + + for (;;) { + if (this->result != 0) { + if (UIWindow* active = this->Top()) { + active->Show(0); + this->dialog.retirement.Schedule(active); + this->modal.pop_back(); + } + + response = this->result; + + if (this->modal.empty()) { + this->result = 0; + } + + break; + } + + if (this->alternateResult != 0) { + if (UIWindow* active = this->Top()) { + active->Show(0); + this->dialog.retirement.Schedule(active); + this->modal.pop_back(); + } + + response = this->alternateResult; + this->alternateResult = 0; + break; + } + + if (pump) { + pump->Frame(); + pump = this->mode; + } + + const auto option = this->frameOptions.find(20); + + if (option != this->frameOptions.end() && option->second > 0) { + this->result = 0; + this->alternateResult = 0; + + while (!this->modal.empty()) { + this->dialog.retirement.Schedule(this->modal.back()); + this->modal.pop_back(); + } + + break; + } + + if (this->immediate != 0) { + break; + } + } + } + + this->RestoreInput(); + return response; +}