Decompile 2 functions in Source/UI/Buttons/UITextButton.cpp, Source/UI/Buttons/UIBmpRadioBtn.h, ...

Batch #1737 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review.

- fn_11447 UIBarGraph4::Slot28: logic confirmed by peer review
- fn_11452 UIINT64BarGraph::Slot28: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-28 21:57:43 +00:00
commit ecdb364faa
3 changed files with 143 additions and 0 deletions

View file

@ -0,0 +1,33 @@
#ifndef RAGNAROK_SOURCE_UI_BUTTONS_UIBMPRADIOBTN_H
#define RAGNAROK_SOURCE_UI_BUTTONS_UIBMPRADIOBTN_H
#include "UI/Window/UIWindow.h"
#include <string>
struct UIButtonContext;
class UIBmpRadioBtn : public UIWindow {
public:
void Slot28(int x, int y) override;
protected:
/* 007C */ unsigned char unknown_007C[0x64];
/* 00E0 */ std::string m_tooltip;
UIButtonContext* m_controls;
};
class UIBmpRadioBtn2 : public UIBmpRadioBtn {
};
class UICaptchaImage : public UIWindow {
public:
void Slot28(int x, int y) override;
protected:
/* 007C */ unsigned char unknown_007C[0x124];
/* 01A0 */ std::string m_tooltip;
UIButtonContext* m_controls;
};
#endif

View file

@ -1,4 +1,6 @@
#include "Render/DeviceContext/DeviceContext.h"
#include "UI/UIBarGraph.h"
#include "UI/Buttons/UIBmpRadioBtn.h"
#include "Render/Text/TextContext.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Buttons/UIItemTagButton.h"
@ -6,6 +8,7 @@
#include "UI/Lists/UITreeView.h"
#include "UI/UIStaticItem.h"
#include <cstdio>
#include <cstring>
#include <string>
@ -200,3 +203,76 @@ void UIItemTagButton::Slot28(int x, int y) {
// FUNCTION: fn_11459
void UIStaticItem_Illust::Slot28(int, int) {
}
// OFFSET: 0x00891810
// FUNCTION: fn_11450
void UIBmpRadioBtn::Slot28(int, int) {
if (!this->m_tooltip.empty()) {
int screenX = 0, screenY = -20;
for (const UIWindow* window = this; window; window = window->parent) {
screenX = (screenX + window->geometry.x);
screenY = (screenY + window->geometry.y);
}
this->m_controls->services.Tooltip(this->m_tooltip.c_str(), screenX, screenY, -1, false, true);
}
}
// OFFSET: 0x00891870
// FUNCTION: fn_11451
void UICaptchaImage::Slot28(int, int) {
if (!this->m_tooltip.empty()) {
int screenX = 0, screenY = -20;
for (const UIWindow* window = this; window; window = window->parent) {
screenX = (screenX + window->geometry.x);
screenY = (screenY + window->geometry.y);
}
this->m_controls->services.Tooltip(this->m_tooltip.c_str(), screenX, screenY, -1, false, true);
}
}
// OFFSET: 0x00891240
// FUNCTION: fn_11447
void UIBarGraph4::Slot28(int, int) {
if (!this->m_current || !this->m_maximum || *this->m_maximum < *this->m_current || *this->m_maximum == 0) {
return;
}
int screenX = 0, screenY = -16;
for (const UIWindow* window = this; window; window = window->parent) {
screenX = (screenX + window->geometry.x);
screenY = (screenY + window->geometry.y);
}
char text[260];
std::memset(text, 0, sizeof(text));
const int permille = static_cast<int>(static_cast<float>(*this->m_current) / static_cast<float>(*this->m_maximum) * 1000.0f);
std::sprintf(text, "%.1f %%", static_cast<float>(permille) * 0.1f);
this->m_controls->services.Tooltip(text, screenX, screenY, -1, false, true);
}
// OFFSET: 0x008918D0
// FUNCTION: fn_11452
void UIINT64BarGraph::Slot28(int, int) {
if (this->m_maximum < this->m_current || this->m_maximum == 0 || this->m_maximum == 99999999) {
return;
}
int screenX = 0, screenY = -16;
for (const UIWindow* window = this; window; window = window->parent) {
screenX = (screenX + window->geometry.x);
screenY = (screenY + window->geometry.y);
}
char text[260];
std::memset(text, 0, sizeof(text));
const int permille = static_cast<int>(static_cast<double>(this->m_current) / static_cast<double>(this->m_maximum) * 1000.0);
std::sprintf(text, "%.1f %%", static_cast<float>(permille) * 0.1f);
this->m_controls->services.Tooltip(text, screenX, screenY, -1, false, true);
}

34
Source/UI/UIBarGraph.h Normal file
View file

@ -0,0 +1,34 @@
#ifndef RAGNAROK_SOURCE_UI_UIBARGRAPH_H
#define RAGNAROK_SOURCE_UI_UIBARGRAPH_H
#include "UI/Window/UIWindow.h"
#include <cstdint>
struct UIButtonContext;
class UIBarGraph3 : public UIWindow {
};
class UIBarGraph4 : public UIBarGraph3 {
public:
void Slot28(int x, int y) override;
protected:
/* 007C */ const int* m_current;
/* 0080 */ const int* m_maximum;
UIButtonContext* m_controls;
};
class UIINT64BarGraph : public UIWindow {
public:
void Slot28(int x, int y) override;
protected:
/* 007C */ int unknown_007C;
/* 0080 */ std::int64_t m_current;
/* 0088 */ std::int64_t m_maximum;
UIButtonContext* m_controls;
};
#endif