Decompile fn_11460 (UITabControl::Slot28)

Batch #1787 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_11460 UITabControl::Slot28: logic confirmed by peer review

Peer-reviewed-by: Yommy
Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-28 22:18:48 +00:00
commit 311af56643
3 changed files with 45 additions and 0 deletions

View file

@ -5,6 +5,8 @@
#include "UI/Window/UIWindowMgr.h"
#include "UI/Buttons/UIItemTagButton.h"
#include "UI/Buttons/UITextButton.h"
#include "UI/Lists/UIImgMenu.h"
#include "UI/Lists/UITabControl.h"
#include "UI/Lists/UITreeView.h"
#include "UI/UIStaticItem.h"
@ -276,3 +278,36 @@ void UIINT64BarGraph::Slot28(int, int) {
this->m_controls->services.Tooltip(text, screenX, screenY, -1, false, true);
}
// OFFSET: 0x00891A10
// OFFSET: 0x00891F20
// FUNCTION: fn_11460
void UITabControl::Slot28(int x, int y) {
int index = this->TabAt(x, y);
if (index == -1) {
return;
}
const std::string& tooltip = this->tooltips[index];
if (tooltip.empty() || this->labels[index] == tooltip) {
return;
}
int screenX = 0;
for (int i = 0; i < index; ++i) {
screenX = (screenX - 1 + this->widths[i]);
}
int 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->tooltips[index].c_str(), screenX, screenY, -1, false, true);
}

View file

@ -6,11 +6,13 @@
class UIImgMenu : public UIWindow {
public:
int ItemAt(int x, int y);
void Slot28(int x, int y) override;
/* 0080 */ int count;
/* 0084 */ int itemWidth;
/* 0088 */ int itemHeight;
/* 008C */ int horizontal;
/* 007C */ int hovered;
};
#endif

View file

@ -6,16 +6,24 @@
#include <string>
#include <vector>
struct UIButtonContext;
class UITabControl : public UIWindow {
public:
int TabCount();
int TabAt(int x, int y);
void Slot28(int x, int y) override;
/* 0080 */ int layout;
/* 0084 */ unsigned char unknown_0084[0x30];
/* 00B4 */ std::vector<std::string> labels;
/* 00C0 */ unsigned char unknown_00C0[0xC];
/* 00CC */ std::vector<int> widths;
/* 00D8 */ unsigned char unknown_00D8[0x4];
/* 00DC */ std::vector<std::string> tooltips;
private:
UIButtonContext* m_controls;
};
#endif