Decompile fn_17225 (UIWindowMgr::CycleWindowVisibility)

Batch #8202 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_17225 UIWindowMgr::CycleWindowVisibility: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, Yommy, gordaoprogramas
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 15:09:41 +00:00
commit a7dd2ac056
3 changed files with 105 additions and 1 deletions

View file

@ -135,7 +135,9 @@ public:
/* 05D0 */ UIWindow* unknown_05D0;
/* 05D4 */ unsigned char unknown_05D4[0x14];
/* 05E8 */ std::uint32_t replayPauseTick;
/* 05EC */ unsigned char unknown_05EC[0x18];
/* 05EC */ unsigned char unknown_05EC[0x10];
/* 05FC */ UIWindow* unknown_05FC;
/* 0600 */ unsigned char unknown_0600[0x4];
/* 0604 */ std::list<UIWindow*> unknown_0604;
/* 060C */ unsigned char unknown_060C[0x10];
/* 061C */ UIBroadcastBalloon* broadcastBalloon;

View file

@ -31,6 +31,9 @@
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include "Client/Mode/CMode.h"
#include "Client/Mode/CGameMode.h"
#include "Contents/Actors/Pc.h"
#include "Contents/World/World.h"
#include "Contents/RouletteMgr.h"
#include "UI/Item/UIItemStoreWnd.h"
#include "UI/Item/UIItemWnd.h"
@ -1158,6 +1161,104 @@ int UIWindowMgr::LoadReplayReserved(const std::vector<unsigned char>& data) {
return static_cast<int>(offset);
}
// OFFSET: 0x00AA5B00
// FUNCTION: fn_17225
void UIWindowMgr::CycleWindowVisibility(int) {
for (std::list<UIWindow*>::iterator it = this->hiddenWindows.begin(); it != this->hiddenWindows.end();) {
std::list<UIWindow*>::iterator next = it;
++next;
if (std::find(this->rendered.begin(), this->rendered.end(), *it) == this->rendered.end()) {
this->hiddenWindows.erase(it);
}
it = next;
}
const int state = this->unknown_0508;
if (state == 0) {
if (this->unknown_01DC) {
this->unknown_01DC->SendMsg(nullptr, 6, 222, 0, 0, 0);
}
if (this->hiddenWindows.size() == 0) {
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
if ((*it)->geometry.visible) {
this->hiddenWindows.push_back(*it);
}
}
}
this->unknown_0508 = 1;
} else if (state == 1) {
bool closed = false;
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
UIWindow* window = *it;
if (window->geometry.visible) {
const int id = window->geometry.id;
if (!this->IsOrderFixed(id)) {
this->CloseWindow(id);
closed = true;
} else if (std::find(this->hiddenWindows.begin(), this->hiddenWindows.end(), window) == this->hiddenWindows.end()) {
this->hiddenWindows.push_back(*it);
}
}
}
if (closed) {
if (this->unknown_01DC) {
this->unknown_01DC->SendMsg(nullptr, 6, 222, 0, 0, 0);
}
return;
}
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
UIWindow* window = *it;
if (window != reinterpret_cast<UIWindow*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->EnsureBroadcastBalloon())) {
window->Show(0);
}
}
this->CloseWindow(14);
CPlayer* player = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player;
if (player) {
player->SendMsg(nullptr, 109, 0, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
player->unknown_0544 = 0;
}
this->unknown_0508 = 2;
} else if (state == 2) {
bool closed = false;
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
if (*it != reinterpret_cast<UIWindow*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->EnsureBroadcastBalloon()) &&
*it != static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05FC && (*it)->geometry.visible) {
UIWindow* window = *it;
if (std::find(this->hiddenWindows.begin(), this->hiddenWindows.end(), window) != this->hiddenWindows.end()) {
window->Show(0);
} else {
this->CloseWindow(window->geometry.id);
}
closed = true;
}
}
if (closed) {
this->ShowWindows189(0);
if (this->unknown_01DC) {
this->unknown_01DC->SendMsg(nullptr, 6, 222, 0, 0, 0);
}
return;
}
for (std::list<UIWindow*>::iterator it = this->hiddenWindows.begin(); it != this->hiddenWindows.end(); ++it) {
(*it)->Show(1);
}
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
if ((*it)->geometry.id == 189) {
(*it)->Show(g_serviceOptions.Get(250) ? 1 : 0);
}
}
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
if (mode && mode->unknown_0254 == 1) {
this->EnsureWindow(14);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->RefreshEffect164();
this->unknown_0508 = 1;
}
}
// OFFSET: 0x00AA8D10
// FUNCTION: fn_17249
int UIWindowMgr::LoadReplayWindows(const std::vector<unsigned char>& data) {

View file

@ -546,6 +546,7 @@ public:
int LoadReplaySettings(const std::vector<unsigned char>& data);
int LoadReplayReserved(const std::vector<unsigned char>& data);
int LoadReplayWindows(const std::vector<unsigned char>& data);
void CycleWindowVisibility(int unused);
void BroadcastMessage21();
bool HasModalWindow();
int TranslateHotkey(int key, int keyData);