refactor(frame): one wrapper for the layout sub-object's calls

Every region and frame carries a layout sub-object at +0x24 (4.3.4's
CLayoutFrame; OFF_REGION_ANCHOR, OFF_FRAME_LAYOUT_SUBOBJECT for a frame),
and three engine calls on it were wrapped by hand in sixteen files, each
with its own typedef and often its own AnchorOf / LayoutOf / FrameOf
helper:

- CLayoutFrame::GetRect (FUN_REGION_GET_RECT, 0x00768320), the
  {bottom, left, top, right} rect, false before layout;
- IsResizePending (FUN_REGION_LAYOUT_DIRTY, 0x00768310);
- CLayoutFrame::Resize (FUN_LAYOUT_RESIZE, 0x007680E0), 1 to lay out now,
  0 to mark for the layout pass.

frame/Layout.h now holds them, taking the region or frame itself, with
Of and OwnerOf for the sub-object and back, and GetResolvedRect for the
read the edge getters make (Script GetLeft 0x007A1A19: a pending resize
run now, then the rect). Frame::Subclass::FrameOfLayout is replaced by
OwnerOf.
This commit is contained in:
Brues
2026-11-08 11:41:00 -06:00
parent aa3a600e33
commit e2174e1656
17 changed files with 129 additions and 117 deletions
+2 -3
View File
@@ -66,6 +66,7 @@
#include "Game.h"
#include "Offsets.h"
#include "frame/GetPointGuard.h"
#include "frame/Layout.h"
#include "frame/SourceLocation.h"
#include "tooltip/Lines.h"
#include "tooltip/SetEvents.h"
@@ -81,7 +82,6 @@ namespace Tooltip::FrameStack {
namespace {
using GetName_t = const char *(__thiscall *)(void *object);
using GetRect_t = int(__thiscall *)(void *layout, float *rect);
using NDCToDDC_t = void(__fastcall *)(float *outX, float *outY, float x, float y);
using StrataToString_t = const char *(__fastcall *)(int strata);
using PointToString_t = const char *(__fastcall *)(int point);
@@ -159,8 +159,7 @@ void FormatName(void *L, void *object, char *out, size_t size) {
// rect cannot be resolved.
bool UnderCursor(void *object, float x, float y) {
float rect[4]; // {minY, minX, maxY, maxX}
if (reinterpret_cast<GetRect_t>(Offsets::FUN_REGION_GET_RECT)(
static_cast<uint8_t *>(object) + Offsets::OFF_REGION_ANCHOR, rect) == 0)
if (!Frame::Layout::GetRect(object, rect))
return false;
return x >= rect[1] && x <= rect[3] && y <= rect[2] && y >= rect[0];
}