//
// EditorUI::cycleCustomGridPreset from 0x1401ae5d0 to 0x1401ae6ef (287 bytes)
//
// 5 xrefs:
// > EditorUI::handleEditorAction @ 0x1401c29a6
// > EditorUI::handleEditorAction @ 0x1401c29bd
// > GridSettingsLayer::onCycleUp @ 0x1402c95a7
// > GridSettingsLayer::onCycleDown @ 0x1402c9617
// > ??> @ 0x140919e08
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:54 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall EditorUI::cycleCustomGridPreset(__int64 a1, char a2, __int64 a3)
{
__int64 v4; // rcx
float v6; // xmm0_4
float *v7; // rax
float v8; // xmm0_4
float v9; // xmm1_4
float v10; // xmm0_4
float *v11; // rcx
void *v12; // [rsp+30h] [rbp+8h]
if ( *(_BYTE *)(a1 + 704) )
{
v6 = *(float *)(a1 + 700);
v7 = flt_1407517A8;
if ( a2 )
{
v8 = v6 + 0.001;
while ( 1 )
{
v9 = *v7;
if ( *v7 > v8 )
break;
if ( (__int64)++v7 >= (__int64)&flt_1407517BC )
return EditorUI::setCustomGridNodeSize(a1, 120.0);
}
}
else
{
v10 = v6 - 0.001;
v11 = (float *)&unk_1407517B8;
while ( 1 )
{
v9 = *v11;
if ( v10 > *v11 )
break;
if ( (__int64)--v11 < (__int64)flt_1407517A8 )
return EditorUI::setCustomGridNodeSize(a1, 7.5);
}
}
return EditorUI::setCustomGridNodeSize(a1, v9);
}
else
{
*(_BYTE *)(a1 + 704) = 1;
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v12 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
LOBYTE(a3) = 1;
GameManager::setGameVariable(v4, "0194", a3);
return EditorUI::setCustomGridNodeSize(a1, 30.0);
}
}