//
// EditorUI::alignObjectsOnAxis from 0x100610cc0 to 0x100611198 (1240 bytes)
//
// 4 xrefs:
// > EditorUI::handleEditorAction @ 0x10060c46e
// > EditorUI::handleEditorAction @ 0x10060c6df
// > EditorCommandsPopup::onCommand @ 0x1008ded91
// > EditorCommandsPopup::onCommand @ 0x1008dee09
//
// 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 12:34:34 +0000
//
void __fastcall EditorUI::alignObjectsOnAxis(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
unsigned int v5; // eax
__int64 v6; // rax
_QWORD *v7; // rax
bool v8; // zf
__int64 v9; // r14
unsigned int v10; // r12d
__int64 v11; // rax
__int64 v12; // r13
void *v13; // rsi
__int64 v14; // r14
unsigned int v15; // r12d
__int64 v16; // r13
__int64 StickyGroup; // rax
_DWORD *v18; // rbx
_DWORD *v19; // rsi
unsigned int *v20; // rax
__int64 v21; // r14
_QWORD *v22; // r12
_QWORD *v23; // rax
__int64 v24; // rbx
unsigned int *v25; // rax
_QWORD *v26; // r13
__int64 v27; // r14
_DWORD *v28; // r12
_QWORD *v29; // rax
__int64 v30; // rax
__int64 v31; // r12
unsigned int v32; // r15d
__int64 v33; // rbx
unsigned __int64 v34; // rbx
_QWORD *i; // r12
_QWORD *v36; // rsi
float v37; // xmm0_4
unsigned __int64 v38; // [rsp+8h] [rbp-78h] BYREF
double v39; // [rsp+10h] [rbp-70h] BYREF
__int64 v40; // [rsp+18h] [rbp-68h] BYREF
unsigned __int64 v41; // [rsp+20h] [rbp-60h] BYREF
unsigned __int64 v42; // [rsp+28h] [rbp-58h]
_QWORD *v43; // [rsp+30h] [rbp-50h]
int v44; // [rsp+3Ch] [rbp-44h]
unsigned __int64 v45; // [rsp+40h] [rbp-40h] BYREF
unsigned __int64 v46; // [rsp+48h] [rbp-38h] BYREF
unsigned __int64 v47[6]; // [rsp+50h] [rbp-30h] BYREF
v44 = a3;
if ( !a2 )
return;
v4 = a1;
if ( (unsigned int)sub_1007FEF90(a2) < 2 )
return;
v5 = sub_1007FEF90(a2);
v6 = sub_1007FEC20(v5);
sub_1007FEF70(v6, a2);
v7 = cocos2d::CCDictionary::create();
v8 = *(_BYTE *)(a1 + 867) == 1;
v43 = (_QWORD *)a1;
if ( v8 && !*(_BYTE *)(a1 + 868) )
{
v9 = (__int64)v7;
if ( (unsigned int)sub_1007FEF90(a2) )
{
v10 = 0;
do
{
v11 = sub_1007FEFE0(a2, v10);
if ( *(int *)(v11 + 872) <= 0 )
{
++v10;
}
else
{
v12 = v11;
sub_1007FF150(a2, v10, 1);
if ( !cocos2d::CCDictionary::objectForKey_1(v9, *(int *)(v12 + 872)) )
{
v13 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject_1(v9, (__int64)v13, *(int *)(v12 + 872));
}
}
}
while ( v10 < (unsigned int)sub_1007FEF90(a2) );
}
v14 = cocos2d::CCDictionary::allKeys(v9);
if ( (unsigned int)sub_1007FEF90(v14) )
{
v15 = 0;
v42 = v14;
do
{
v16 = *(unsigned int *)(sub_1007FEFE0(v14, v15) + 56);
StickyGroup = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(v4 + 1440));
if ( StickyGroup )
{
EditorUI::getGroupCenter((float *)&v45, v16, StickyGroup, 1);
v18 = (_DWORD *)GameObject::createWithFrame("checkpoint_01_001.png");
v18[257] = 44;
v18[218] = v16;
v14 = v42;
sub_1002782D0(v47, &v45);
(*(void (__fastcall **)(_DWORD *, unsigned __int64 *))(*(_QWORD *)v18 + 1368LL))(v18, v47);
v19 = v18;
v4 = (__int64)v43;
sub_1007FEBF0(a2, v19);
}
++v15;
}
while ( v15 < (unsigned int)sub_1007FEF90(v14) );
}
}
if ( (unsigned int)sub_1007FEF90(a2) < 2 )
return;
sub_1002782A0(v47);
sub_1002782A0(&v46);
v20 = *(unsigned int **)(a2 + 56);
v21 = *v20;
if ( *v20 )
{
v22 = *((_QWORD **)v20 + 2);
if ( *v22 )
{
v23 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*v22 + 192LL))(*v22);
sub_1002782D0(&v45, v23);
sub_100278300(v47, &v45);
sub_100278300(&v46, &v45);
if ( (_DWORD)v21 != 1 )
{
v34 = (unsigned __int64)&v22[v21 - 1];
for ( i = v22 + 1; (unsigned __int64)i <= v34; ++i )
{
if ( !*i )
break;
v36 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*i + 192LL))(*i);
sub_1002782D0(&v45, v36);
if ( *(float *)v47 > *(float *)&v45 )
{
LODWORD(v47[0]) = v45;
if ( *(float *)&v45 <= *(float *)&v46 )
{
LABEL_46:
v37 = *((float *)&v45 + 1);
if ( *((float *)v47 + 1) <= *((float *)&v45 + 1) )
goto LABEL_47;
goto LABEL_51;
}
}
else if ( *(float *)&v45 <= *(float *)&v46 )
{
goto LABEL_46;
}
LODWORD(v46) = v45;
v37 = *((float *)&v45 + 1);
if ( *((float *)v47 + 1) <= *((float *)&v45 + 1) )
{
LABEL_47:
if ( v37 > *((float *)&v46 + 1) )
goto LABEL_52;
continue;
}
LABEL_51:
*((float *)v47 + 1) = v37;
if ( v37 > *((float *)&v46 + 1) )
LABEL_52:
*((float *)&v46 + 1) = v37;
}
}
}
}
if ( (_BYTE)v44 )
{
if ( *((float *)v47 + 1) == *((float *)&v46 + 1) )
return;
}
else if ( *(float *)v47 == *(float *)&v46 )
{
return;
}
sub_100278350((double *)&v45, v47, &v46);
sub_1002783D0(&v39, &v45, (__m128)0x40000000u);
v24 = (__int64)v43;
EditorUI::createUndoObject((__int64)v43, 5u, 0);
v25 = *(unsigned int **)(a2 + 56);
if ( *v25 )
{
v26 = *((_QWORD **)v25 + 2);
v42 = (unsigned __int64)&v26[*v25 - 1];
do
{
v28 = (_DWORD *)*v26;
if ( !*v26 )
break;
v29 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v28 + 192LL))(*v26);
sub_1002782D0(&v45, v29);
sub_1002782D0(&v41, &v45);
v43 = v26;
if ( (_BYTE)v44 )
HIDWORD(v41) = HIDWORD(v39);
else
LODWORD(v41) = LODWORD(v39);
sub_100278370((double *)&v40, &v41, &v45);
if ( v28[257] == 44 )
{
v30 = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(v24 + 1440));
v27 = v24;
if ( v30 )
{
v31 = v30;
if ( (unsigned int)sub_1007FEF90(v30) )
{
v32 = 0;
do
{
v33 = sub_1007FEFE0(v31, v32);
sub_1002782D0(&v38, &v40);
EditorUI::moveObject(v27, v33, &v38);
++v32;
}
while ( v32 < (unsigned int)sub_1007FEF90(v31) );
}
}
}
else
{
sub_1002782D0(&v38, &v40);
EditorUI::moveObject(v24, (__int64)v28, &v38);
v27 = v24;
}
v26 = v43 + 1;
v24 = v27;
}
while ( (unsigned __int64)(v43 + 1) <= v42 );
}
EditorUI::deactivateTransformControl(v24);
}