rodecomp/Source/UI/Shortcuts/ShortcutGrid.cpp
ragnarok-clanker e168b4e4a6 Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
2026-10-25 15:42:21 +00:00

40 lines
822 B
C++

#include "UI/Shortcuts/ShortcutGrid.h"
#include <bit>
#include <cstdint>
// INLINED
ShortcutGrid::ShortcutGrid() : hovered(-1), row(-1), rows(1) {
}
// 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;
}