rodecomp/Source/UI/Window/UIMiniBtnWnd.cpp
ragnarok-clanker 8cbbea0552 Decompile fn_12516 (UIMiniBtnWnd::UIMiniBtnWnd)
Batch #7694 by secret: 0 byte-identical, 1 confirmed by peer review.

- fn_12516 UIMiniBtnWnd::UIMiniBtnWnd: logic confirmed by peer review

Peer-reviewed-by: eAthena, Tanke
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-31 11:15:03 +00:00

67 lines
1.8 KiB
C++

#include "UI/Window/UIMiniBtnWnd.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowManagerWindows.h"
// OFFSET: 0x0092CE50
// FUNCTION: fn_12666
void UIMiniBtnWnd::Paint() {
if (this->geometry.id < 0) {
return;
}
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window && window->geometry.visible != 0) {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->m_activeImage.c_str())));
this->DrawBitmap(0, 0, &bitmap->image, false);
} else {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(this->m_inactiveImage.c_str())));
this->DrawBitmap(0, 0, &bitmap->image, false);
}
}
// OFFSET: 0x00930CD0
// FUNCTION: fn_12694
void UIMiniBtnWnd::Slot25(int, int) {
bool visible;
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window) {
visible = window->geometry.visible == 0;
} else {
window = this->m_frameContext->windows.EnsureWindow(this->m_windowId);
visible = true;
}
if (window) {
window->Show(visible);
window->SendMsg(this, 6, 271, visible, 0, 0);
}
this->Invalidate();
}
// OFFSET: 0x00941120
// FUNCTION: fn_12789
void UIMiniBtnWnd::Toggle() {
bool visible;
UIWindow* window = g_windowMgr.LookupWindow(this->m_windowId);
if (window) {
visible = window->geometry.visible == 0;
} else {
window = this->m_frameContext->windows.EnsureWindow(this->m_windowId);
visible = true;
}
if (window) {
window->Show(visible);
window->SendMsg(this, 6, 271, visible, 0, 0);
}
this->Invalidate();
}
// OFFSET: 0x009114F0
// FUNCTION: fn_12516
UIMiniBtnWnd::UIMiniBtnWnd(UIWindowContext& windows, UIFrameContext& frames) : UIFrameWnd(windows, frames, 0), m_windowId(-1) {
}