rodecomp/Source/UI/Shortcuts/ShortcutGrid.cpp
ragnarok-clanker 8c6850f436 Decompile 4 functions in Source/UI/Shortcuts/UIShortCutWnd.cpp, Source/UI/Shortcuts/ShortcutGrid.cpp, ...
Batch #11887 by Yommy: 4 byte-identical, 0 confirmed by peer review.

- fn_12632 UIShortCutWnd::Move: byte-identical
- fn_12762 UISubChatMiniWnd::SendMsg: byte-identical
- fn_12766 UIShortCutWnd::Show: byte-identical
- fn_12528 UIShortCutWnd::UIShortCutWnd: byte-identical (already on main)

Merged automatically: every function is byte-identical to the original.
2026-11-05 05:17:20 +00:00

36 lines
745 B
C++

#include "UI/Shortcuts/ShortcutGrid.h"
#include <bit>
#include <cstdint>
// OFFSET: 0x0091C540
// FUNCTION: fn_12616
int ShortcutGrid::HitTest(int x, int y, bool itemSlotActive, unsigned char& currentRow) {
this->row = -1;
int extent = 33 * this->rows;
if (itemSlotActive) {
extent += 33;
}
if (y <= 3 || y >= extent) {
return -1;
}
const std::uint32_t columnOffset = static_cast<std::uint32_t>(x) - 15;
if (columnOffset > 260) {
return -1;
}
this->row = (y - 4) / 33;
currentRow = static_cast<unsigned char>(this->row);
if (y > this->row * 33 + 30) {
this->row = -1;
}
const int column = static_cast<int>(columnOffset) / 29;
if (x > column * 29 + 41) {
return -1;
}
return column;
}