✨ feat(UIRoulletteWnd): add UIRoulletteWnd class and integrate with UIWindowMgr

This commit is contained in:
ragnarok-clanker 2026-10-27 16:29:07 +01:00
commit ada7c13f42
3 changed files with 126 additions and 5 deletions

View file

@ -0,0 +1,18 @@
#ifndef RAGNAROK_SOURCE_UI_WINDOW_UIROULLETTEWND_H
#define RAGNAROK_SOURCE_UI_WINDOW_UIROULLETTEWND_H
#include "UI/Window/UIFrameWnd.h"
class UIRoulletteWnd : public UIFrameWnd {
public:
/* 00BC */ std::uint32_t unknown_00BC;
/* 00C0 */ std::uint32_t unknown_00C0;
/* 00C4 */ std::uint32_t unknown_00C4;
/* 00C8 */ unsigned char m_enabled;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(offsetof(UIRoulletteWnd, m_enabled) == 0xC8);
#endif
#endif

View file

@ -39,6 +39,8 @@ struct WindowPolicyEntry {
/* 0000 */ int actions[8];
};
class UIRoulletteWnd;
class UIWindowMgr {
public:
/* 0004 */ int activeWindowId;
@ -232,11 +234,11 @@ public:
/* 031C */ std::uint32_t unknown_031C;
/* 0320 */ UIWindow* window_0320;
/* 0324 */ UIWindow* window_0324;
/* 0328 */ std::uint32_t unknown_0328;
/* 0328 */ UIWindow* unknown_0328;
/* 032C */ UIWindow* window_032C;
/* 0330 */ std::uint32_t unknown_0330;
/* 0334 */ std::uint32_t unknown_0334;
/* 0338 */ std::uint32_t unknown_0338;
/* 0330 */ UIWindow* unknown_0330;
/* 0334 */ UIWindow* unknown_0334;
/* 0338 */ UIWindow* unknown_0338;
/* 033C */ std::uint32_t unknown_033C;
/* 0340 */ std::uint32_t unknown_0340;
/* 0344 */ std::uint32_t unknown_0344;
@ -313,7 +315,7 @@ public:
/* 0458 */ std::uint32_t unknown_0458;
/* 045C */ std::uint32_t unknown_045C;
/* 0460 */ std::uint32_t unknown_0460;
/* 0464 */ std::uint32_t unknown_0464;
/* 0464 */ UIRoulletteWnd* unknown_0464;
/* 0468 */ UIWindow* window_0468;
/* 046C */ int unknown_046C;
/* 0470 */ int unknown_0470;
@ -422,6 +424,12 @@ public:
void Destroy(UIWindow* window);
void DismissTransient();
void RegisterNamedWindow(std::string name, UIWindow* window);
void InvalidateAll();
void RefreshClanWnd();
void RefreshGuildWindows();
void RefreshRouletteWnd();
void EnableRouletteWnd();
char UpdateSnapRectangles();
};
extern UIWindowMgr g_windowMgr;

View file

@ -1,9 +1,104 @@
#include "UI/Window/UIRoulletteWnd.h"
#include "Contents/Configuration/ServiceOptions.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/WindowOrdering.h"
#include <algorithm>
// OFFSET: 0x00A966E0
// FUNCTION: fn_17184
void UIWindowMgr::InvalidateAll() {
for (UIWindow* window : this->rendered) {
window->InvalidateChildren();
}
}
// OFFSET: 0x00A96710
// FUNCTION: fn_17185
void UIWindowMgr::RefreshClanWnd() {
if (this->window_0444) {
this->window_0444->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
}
// OFFSET: 0x00A96730
// FUNCTION: fn_17186
void UIWindowMgr::RefreshGuildWindows() {
if (this->window_0320) {
this->window_0320->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->window_0324) {
this->window_0324->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->unknown_0328) {
this->unknown_0328->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->window_032C) {
this->window_032C->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->unknown_0330) {
this->unknown_0330->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->unknown_0334) {
this->unknown_0334->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
if (this->unknown_0338) {
this->unknown_0338->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
}
// OFFSET: 0x00A96810
// FUNCTION: fn_17187
void UIWindowMgr::RefreshRouletteWnd() {
if (this->unknown_0464) {
this->unknown_0464->SendMsg(nullptr, 60, 0, 0, 0, 0);
}
}
// OFFSET: 0x00A96830
// FUNCTION: fn_17188
void UIWindowMgr::EnableRouletteWnd() {
if (this->unknown_0464) {
this->unknown_0464->m_enabled = 1;
}
}
// OFFSET: 0x00A96850
// FUNCTION: fn_17189
char UIWindowMgr::UpdateSnapRectangles() {
this->snapRectangles.clear();
const ServiceOptions* options = reinterpret_cast<const ServiceOptions*>(this);
if (options->Get(141) == 0) {
return 0;
}
for (UIWindow* window : this->rendered) {
if (window->geometry.visible == 0) {
continue;
}
bool excluded = false;
for (UIWindow* ex : this->snapExcluded) {
if (ex == window) {
excluded = true;
break;
}
}
if (excluded) {
continue;
}
if (options->Get(141) != 0 && window) {
this->snapRectangles[window].Set(window->geometry.x, window->geometry.y, window->geometry.width, window->geometry.height);
}
}
return 1;
}
// OFFSET: 0x00A976C0
// FUNCTION: fn_17206
void WindowOrdering::Promote(UIWindow* window) {