Decompile 13 functions in Source/UI/Gauges/UIPlayerGage.cpp, Source/UI/UIBarGraph.cpp, ...

Batch #5221 by Yommy: 0 byte-identical, 13 confirmed by peer review.

- fn_11568 UIRechargeGage::SetValues: logic confirmed by peer review
- fn_11569 UIPlayerGage::SetFourthValues: logic confirmed by peer review
- fn_11578 UIPlayerGage::SetFirstValues: logic confirmed by peer review
- fn_11579 UIPlayerGage::SetThirdValues: logic confirmed by peer review
- fn_11580 UIMonsterGage::SetMode: logic confirmed by peer review
- fn_11587 UIPlayerGage::SetSecondValues: logic confirmed by peer review
- fn_11593 UIBarGraphHomun::SetValues: logic confirmed by peer review
- fn_11594 UIBarGraphPlayer::SetValues: logic confirmed by peer review
- fn_11570 UIBmpRadioBtn::SetBitmap: logic confirmed by peer review
- fn_11573 UITextButton::CenterIn: logic confirmed by peer review
- fn_11590 UITVTextButton::SetLabel: logic confirmed by peer review
- fn_11592 UIBmpRadioBtn::AddText: logic confirmed by peer review
- fn_11595 UIItemTagOnMail::SetLines: logic confirmed by peer review

Peer-reviewed-by: eAthena, alisonrag
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/UI/Gauges/UIPlayerGage.cpp
This commit is contained in:
ragnarok-clanker 2026-10-30 09:33:02 +00:00
commit 1d3b73372d
13 changed files with 224 additions and 1 deletions

View file

@ -4,23 +4,40 @@
#include "Resource/Bitmap/BitmapResource.h"
#include "UI/Window/UIWindow.h"
#include <cstdint>
#include <string>
#include <vector>
struct UIButtonContext;
struct UIBmpRadioBtnText {
/* 0000 */ int id;
/* 0004 */ int x;
/* 0008 */ int y;
/* 000C */ int height;
/* 0010 */ bool bold;
/* 0014 */ std::uint32_t color;
/* 0018 */ bool unknown_0018;
};
class UIBmpRadioBtn : public UIWindow {
public:
void Slot25(int x, int y) override;
void Slot28(int x, int y) override;
int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;
bool SetBitmap(const char* name, int state);
void AddText(int id, int height, std::uint32_t color, bool bold, bool unknown, int x, int y);
protected:
/* 007C */ unsigned char unknown_007C[0x60];
/* 007C */ std::string m_names[4];
/* 00DC */ bool m_hovered;
/* 00DD */ unsigned char unknown_00DD[3];
/* 00E0 */ std::string m_tooltip;
UIButtonContext* m_controls;
/* 00FC */ int m_value;
/* 0100 */ std::vector<UIBmpRadioBtnText> m_texts;
/* 010C */ std::string m_label;
};
class UIBmpRadioBtn2 : public UIBmpRadioBtn {

View file

@ -17,6 +17,7 @@ public:
void Slot32(int x, int y) override;
void Slot33(int x, int y) override;
void ResizeToText();
void SetLabel(std::string text);
protected:
/* 00B4 */ unsigned char unknown_00B4;

View file

@ -261,6 +261,95 @@ void UIBmpRadioBtn::Slot28(int, int) {
}
}
// OFFSET: 0x0089B640
// FUNCTION: fn_11570
bool UIBmpRadioBtn::SetBitmap(const char* name, int state) {
const auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve(name)));
if (!bitmap) {
return false;
}
if (bitmap->image.width > this->geometry.width) {
this->geometry.width = bitmap->image.width;
}
if (bitmap->image.height > this->geometry.height) {
this->geometry.height = bitmap->image.height;
}
this->Resize(this->geometry.width, this->geometry.height);
switch (state) {
case 0:
this->m_names[0] = name;
break;
case 1:
this->m_names[1] = name;
break;
case 2:
this->m_names[2] = name;
break;
case 3:
this->m_names[3] = name;
break;
}
return true;
}
// OFFSET: 0x0089BA00
// FUNCTION: fn_11573
void UITextButton::CenterIn(int width, int height) {
UIWindow::Move(
static_cast<int>((width - this->geometry.width) * 0.5 + this->geometry.x), static_cast<int>((height - this->geometry.height) * 0.5 + this->geometry.y)
);
}
// OFFSET: 0x0089CA70
// FUNCTION: fn_11590
void UITVTextButton::SetLabel(std::string text) {
this->label = text;
this->ResizeToText();
}
// OFFSET: 0x0089CC30
// FUNCTION: fn_11592
void UIBmpRadioBtn::AddText(int id, int height, std::uint32_t color, bool bold, bool unknown, int x, int y) {
UIBmpRadioBtnText text;
text.id = id;
text.x = x;
text.y = y;
text.height = height;
text.bold = bold;
text.color = color;
text.unknown_0018 = unknown;
if (x == -1000) {
const int textWidth =
this->TextWidth(this->m_controls->fonts, this->m_controls->locale, this->m_label.c_str(), static_cast<unsigned>(this->m_label.size()), 0, height, bold, 0);
text.x = static_cast<int>((this->geometry.width - textWidth) * 0.5);
}
if (y == -1000) {
const int textHeight =
this->TextHeight(this->m_controls->fonts, this->m_controls->locale, this->m_label.c_str(), static_cast<unsigned>(this->m_label.size()), 0, height, bold, 0);
text.y = static_cast<int>((this->geometry.height - textHeight) * 0.5);
}
auto it = this->m_texts.begin();
for (; it != this->m_texts.end(); ++it) {
if (it->id == id) {
break;
}
}
if (it != this->m_texts.end()) {
*it = text;
}
this->m_texts.push_back(text);
}
// OFFSET: 0x007C7CA0
// FUNCTION: fn_09408
void UIBmpRadioBtn2::Slot47() {

View file

@ -23,6 +23,7 @@ public:
void Slot35(int value) override;
void Configure(const char* text, std::uint32_t color, int family, int height, unsigned char outline, unsigned char underline);
void ResizeToText();
void CenterIn(int width, int height);
const std::string& GetLine(std::size_t index) const;
protected:

View file

@ -40,3 +40,13 @@ std::string UIItemTagCtrl::AppendTag(const std::string& name) {
this->taggedText += tag;
return this->taggedText;
}
// OFFSET: 0x0089CF10
// FUNCTION: fn_11595
void UIItemTagOnMail::SetLines(const std::vector<std::string>& lines) {
this->m_lines.clear();
for (std::size_t index = 0; index < lines.size(); ++index) {
this->m_lines.push_back(lines[index]);
}
}

View file

@ -6,6 +6,7 @@
#include <list>
#include <string>
#include <vector>
class UIItemTagCtrl : public UIEditCtrl {
public:
@ -20,4 +21,11 @@ public:
/* 0158 */ int tagWidth;
};
class UIItemTagOnMail : public UIItemTagCtrl {
public:
void SetLines(const std::vector<std::string>& lines);
/* 015C */ std::vector<std::string> m_lines;
};
#endif

View file

@ -5,6 +5,7 @@
#include <cstddef>
#include <cstdint>
#include <functional>
class UIGage : public UIWindow {
public:
@ -27,6 +28,37 @@ public:
/* 00AC */ int unknown_00AC;
};
class UIRechargeGage : public UIGage {
public:
void SetValues(int current, int maximum);
/* 009C */ int current;
/* 00A0 */ int maximum;
};
class UIPlayerGage : public UIGage {
public:
void SetFirstValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
void SetSecondValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
void SetThirdValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
void SetFourthValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
/* 009C */ int unknown_009C;
/* 00A0 */ std::function<std::int64_t()> m_firstCurrent;
/* 00C8 */ std::function<std::int64_t()> m_firstMaximum;
/* 00F0 */ std::function<std::int64_t()> m_secondCurrent;
/* 0118 */ std::function<std::int64_t()> m_secondMaximum;
/* 0140 */ std::function<std::int64_t()> m_thirdCurrent;
/* 0168 */ std::function<std::int64_t()> m_thirdMaximum;
/* 0190 */ std::function<std::int64_t()> m_fourthCurrent;
/* 01B8 */ std::function<std::int64_t()> m_fourthMaximum;
};
class UIMonsterGage : public UIPcGage {
public:
void SetMode(int mode);
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(offsetof(UIGage, colors) == 0x80);
static_assert(offsetof(UIPcGage, current) == 0xA0);

View file

@ -0,0 +1,43 @@
#include "UI/Gauges/UIPcGage.h"
// OFFSET: 0x0089B560
// FUNCTION: fn_11568
void UIRechargeGage::SetValues(int current, int maximum) {
this->current = current;
this->maximum = maximum;
this->Invalidate();
}
// OFFSET: 0x0089B590
// FUNCTION: fn_11569
void UIPlayerGage::SetFourthValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_fourthCurrent = current;
this->m_fourthMaximum = maximum;
}
// OFFSET: 0x0089BCF0
// FUNCTION: fn_11578
void UIPlayerGage::SetFirstValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_firstCurrent = current;
this->m_firstMaximum = maximum;
}
// OFFSET: 0x0089BDA0
// FUNCTION: fn_11579
void UIPlayerGage::SetThirdValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_thirdCurrent = current;
this->m_thirdMaximum = maximum;
}
// OFFSET: 0x0089C070
// FUNCTION: fn_11580
void UIMonsterGage::SetMode(int mode) {
this->unknown_009C = mode;
}
// OFFSET: 0x0089C390
// FUNCTION: fn_11587
void UIPlayerGage::SetSecondValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_secondCurrent = current;
this->m_secondMaximum = maximum;
}

View file

@ -425,6 +425,8 @@ void UITabControl::ClearTabs() {
this->FitToTabs();
}
// OFFSET: 0x0089C1B0
// OFFSET: 0x00880B20
// FUNCTION: fn_11283
int UITabControl::TabCount() {

View file

@ -23,6 +23,7 @@ public:
void SelectTab(int index);
void RemoveTab(int index);
void ClearTabs();
void SetFlag(int index, bool value);
void Slot10(int argument1, int argument2, std::intptr_t argument3) override;
void Slot25(int x, int y) override;
void Slot27(int x, int y) override;

View file

@ -17,3 +17,17 @@ UIBarGraph3::~UIBarGraph3() = default;
// OFFSET: 0x008700F0
// FUNCTION: fn_11098
UIBarGraphPlayer::~UIBarGraphPlayer() = default;
// OFFSET: 0x0089CDB0
// FUNCTION: fn_11593
void UIBarGraphHomun::SetValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_current = current;
this->m_maximum = maximum;
}
// OFFSET: 0x0089CE60
// FUNCTION: fn_11594
void UIBarGraphPlayer::SetValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum) {
this->m_current = current;
this->m_maximum = maximum;
}

View file

@ -58,6 +58,8 @@ class UIBarGraphHomun : public UIWindow {
public:
explicit UIBarGraphHomun(UIWindowContext& context);
void SetValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
protected:
/* 0080 */ std::function<std::int64_t()> m_current;
/* 00A8 */ std::function<std::int64_t()> m_maximum;
@ -68,6 +70,8 @@ public:
explicit UIBarGraphPlayer(UIWindowContext& context);
~UIBarGraphPlayer() override;
void SetValues(std::function<std::int64_t()> current, std::function<std::int64_t()> maximum);
protected:
/* 0080 */ std::function<std::int64_t()> m_current;
/* 00A8 */ std::function<std::int64_t()> m_maximum;

View file

@ -835,6 +835,7 @@
"Source/UI/FrameSkin.cpp": 2,
"Source/UI/GameSettings/GameSettingsUI.cpp": 2,
"Source/UI/Gauges/UIPetInfoBarGraph.cpp": 2,
"Source/UI/Gauges/UIPlayerGage.cpp": 2,
"Source/UI/Guild/UIAgitWnd.cpp": 2,
"Source/UI/Guild/UIGuildHelperWnd.cpp": 2,
"Source/UI/Guild/UIGuildWnd.cpp": 2,