rodecomp/Source/UI/Shortcuts/ShortcutDetails.cpp
ragnarok-clanker 9aea62bd9b Decompile 47 functions in Source/Client/ClientOptions.cpp, Source/Client/Session.h, ...
Batch #1675 by ragnarok-clanker: 2 byte-identical, 45 confirmed by peer review.

- fn_10839 UIButton::Slot25: logic confirmed by peer review
- fn_10852 UIButton::Slot31: logic confirmed by peer review
- fn_10868 UIButton::Slot27: logic confirmed by peer review
- fn_10930 UIStaticBitmap::SetBitmap: logic confirmed by peer review
- fn_10931 UIBitmapButton::SetBitmap: logic confirmed by peer review
- fn_11320 UIComboBoxEx2::Slot15: logic confirmed by peer review
- fn_11326 UIListBox::Slot15: logic confirmed by peer review
- fn_11327 UIListBoxEx::Slot15: logic confirmed by peer review
- fn_11381 UIScrollBar::Paint: logic confirmed by peer review
- fn_11383 UIScrollBar_Navi::Paint: logic confirmed by peer review
- fn_11425 UIScrollBar::Slot25: logic confirmed by peer review
- fn_11440 UIScrollBar::Slot31: logic confirmed by peer review
- fn_11445 UITextButton::Slot31: logic confirmed by peer review
- fn_11468 UIScrollBar::Slot27: logic confirmed by peer review
- fn_11471 UITextButton::Slot27: logic confirmed by peer review
- fn_11494 UITextButton::Slot33: logic confirmed by peer review
- fn_11779 UIFrameWnd::Slot25: logic confirmed by peer review
- fn_11781 UIFrameWnd::Slot31: logic confirmed by peer review
- fn_11786 UIFrameWnd::Slot27: logic confirmed by peer review
- fn_12610 CSession::GetOption: logic confirmed by peer review
- fn_12689 ActivateShortcut: logic confirmed by peer review
- fn_12711 ShortcutTooltip::Hover: logic confirmed by peer review
- fn_12724 ShortcutDetails::Open: logic confirmed by peer review (already on main)
- fn_12760 UIShortCutWnd::SendMsg: logic confirmed by peer review
- fn_17144 UIWindowMgr::RemoveOrder: logic confirmed by peer review
- fn_17158 UIWindowMgr::Capture: byte-identical
- fn_17180 UIWindowMgr::BringToFront: logic confirmed by peer review
- fn_17192 UIWindowMgr::IsOrderFixed: logic confirmed by peer review
- fn_17232 UIWindowMgr::ReleaseCapture: byte-identical
- fn_17255 UIWindowMgr::SetCapture: logic confirmed by peer review
- fn_20382 CConnection::CConnection: logic confirmed by peer review
- fn_20383 CRagConnection::CRagConnection: logic confirmed by peer review
- fn_20384 CConnection::~CConnection: logic confirmed by peer review (already on main)
- fn_20389 CConnection::Connect: logic confirmed by peer review
- fn_20390 CConnection::Close: logic confirmed by peer review
- fn_20409 GetRagConnection: logic confirmed by peer review
- fn_21406 AutomaticSkills::Complete: logic confirmed by peer review
- fn_03927 CCharacterLinkedUserDataMgr::CompleteLoad: logic confirmed by peer review
- fn_03933 CCharacterLinkedUserDataMgr::Save: logic confirmed by peer review
- fn_03937 CSession::SetOption: logic confirmed by peer review
- fn_11073 UIScrollBar::UIScrollBar: logic confirmed by peer review
- fn_11102 UIComboBoxEx2::~UIComboBoxEx2: logic confirmed by peer review (already on main)
- fn_09150 AutomaticSkills::DisableAll: logic confirmed by peer review
- fn_09153 AutomaticSkills::Use: logic confirmed by peer review
- fn_10689 UIBitmapButton::~UIBitmapButton: logic confirmed by peer review (already on main)
- fn_10795 UIBitmapButton::Paint: logic confirmed by peer review
- fn_10817 UIStaticBitmap::Paint: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
2026-10-28 20:01:00 +00:00

121 lines
3 KiB
C++

#include "UI/Shortcuts/ShortcutDetails.h"
#include "UI/Shortcuts/SkillDetailClose.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/UIWindowMgr.h"
namespace {
// INLINED
void ToScreen(const UIWindow& window, int& x, int& y) {
x = (x + window.geometry.x);
y = (y + window.geometry.y);
for (const UIWindow* node = window.parent; node; node = node->parent) {
x = (x + node->geometry.x);
y = (y + node->geometry.y);
}
}
}
// INLINED
inline bool SkillDetailClose::Close() {
if (this->window) {
this->saved[46] = {this->window->geometry.x, this->window->geometry.y, this->window->geometry.width, this->window->geometry.height};
}
if (!this->modalStack.empty() && this->modalStack.back() != 0) {
return false;
}
if (this->window == this->reference_4F1D4) {
this->reference_4F1D4 = nullptr;
}
bool removed = false;
if (this->window) {
this->retirement.Schedule(this->window);
this->window = nullptr;
this->visible = 0;
removed = true;
}
this->windowsById.erase(46);
if (removed) {
g_windowMgr.RemoveOrder(46);
}
return removed;
}
// OFFSET: 0x009332D0
// FUNCTION: fn_12724
void ShortcutDetails::Open(UIWindow& window, ShortcutGrid& grid, int x, int y, const NormalItemSlot* const* slots, const NormalItemSlot* const* itemSlots) {
const int column = grid.HitTest(x, y, this->itemSlotActive, this->currentRow);
if (column == -1) {
return;
}
const int index = 9 * this->currentRow + column;
const int limit = 9 * grid.rows;
const NormalItemSlot* slot;
if (limit <= index) {
if (!this->itemSlotActive) {
return;
}
slot = itemSlots[column];
} else {
slot = slots[index];
if (slot->itemId == 0) {
return;
}
}
if (limit <= index || slot->unknown_0000 == 0) {
ItemInfo item = LookupClientItem(this->inventory, static_cast<int>(slot->itemId), 1);
if (item.unknown_0000[1] != 0) {
UIWindow* detail = this->windows.EnsureWindow(12);
detail->SendMsg(nullptr, 24, reinterpret_cast<std::intptr_t>(&item), 0, 0, 0);
}
return;
}
CSkillInfo skill = this->skills.Lookup(slot->itemId);
if (!skill.MatchesShortcut(slot)) {
return;
}
UIWindow* detail = this->windows.EnsureWindow(46);
if (detail) {
if (this->describedSkill == skill.id) {
this->skillClose.Close();
} else {
detail->SendMsg(nullptr, 61, skill.id, 0, 0, 0);
}
}
int originX = 0;
int originY = 0;
ToScreen(window, originX, originY);
const int targetX = (originX + x);
int adjustment = 0;
if (this->screenWidth - static_cast<unsigned>(targetX) < static_cast<unsigned>(detail->geometry.width)) {
adjustment = targetX + detail->geometry.width - static_cast<int>(this->screenWidth);
}
const int rowY = 33 * (y / 33);
const int targetY =
static_cast<float>(originY) <= static_cast<float>(this->screenHeight) * 0.5f ? ((originY + rowY) + 33) : ((originY + rowY) - detail->geometry.height);
detail->Move(targetX - adjustment, targetY);
}