//
// EditorUI::alignObjects from 0x10015f43c to 0x10015f88c (1104 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0x100162f70
// > EditorUI::handleEditorAction @ 0x100163414
// > EditorCommandsPopup::onCommand @ 0x1004c5bc0
//
// This function is hookable on this platform (idp: arm, 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 10:59:45 +0000
//
void __fastcall EditorUI::alignObjects(__int64 a1, __int64 a2, int a3)
{
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x22
__int64 v11; // x23
__int64 v12; // x0
__int64 v13; // x24
__int64 v14; // x0
__int64 v15; // x22
__int64 v16; // x23
__int64 v17; // x25
__int64 StickyGroup; // x0
_DWORD *v19; // x26
double v20; // d0
int (__cdecl *v21)(const void *, const void *); // x3
unsigned int *v22; // x9
__int64 v23; // x8
_QWORD *v24; // x22
unsigned __int64 v25; // x23
char v26; // w24
double *v27; // x0
int v28; // w0
__int64 v29; // x22
unsigned int *v30; // x23
double *v31; // x0
float v32; // s0
float v33; // s1
__int64 v34; // x0
__int64 v35; // x23
__int64 v36; // x24
__int64 v37; // x25
float32x2_t v38; // [xsp+0h] [xbp-90h] BYREF
float32x2_t v39; // [xsp+8h] [xbp-88h] BYREF
float32x2_t v40; // [xsp+10h] [xbp-80h] BYREF
float32x2_t v41; // [xsp+18h] [xbp-78h] BYREF
float32x2_t v42; // [xsp+20h] [xbp-70h] BYREF
float32x2_t v43; // [xsp+28h] [xbp-68h] BYREF
float32x2_t v44; // [xsp+30h] [xbp-60h] BYREF
float32x2_t v45; // [xsp+38h] [xbp-58h] BYREF
if ( a2 && (unsigned int)sub_1002E757C(a2) >= 3 )
{
v6 = sub_1002E757C(a2);
v7 = sub_1002E7510(v6);
v8 = sub_1002E7570(v7, a2);
v9 = cocos2d::CCDictionary::create(v8);
if ( *(_BYTE *)(a1 + 867) == 1 && (*(_BYTE *)(a1 + 868) & 1) == 0 )
{
v10 = v9;
if ( (unsigned int)sub_1002E757C(a2) )
{
v11 = 0;
do
{
v12 = sub_1002E75A0(a2, v11);
if ( *(int *)(v12 + 872) < 1 )
{
v11 = (unsigned int)(v11 + 1);
}
else
{
v13 = v12;
sub_1002E7664(a2, v11, 1);
if ( !cocos2d::CCDictionary::objectForKey_1(v10, *(int *)(v13 + 872)) )
{
v14 = cocos2d::CCNode::create(0);
cocos2d::CCDictionary::setObject_1(v10, v14, *(int *)(v13 + 872));
}
}
}
while ( (unsigned int)v11 < (unsigned int)sub_1002E757C(a2) );
}
v15 = cocos2d::CCDictionary::allKeys(v10);
if ( (unsigned int)sub_1002E757C(v15) )
{
v16 = 0;
do
{
v17 = *(unsigned int *)(sub_1002E75A0(v15, v16) + 56);
StickyGroup = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(a1 + 1440), v17);
if ( StickyGroup )
{
EditorUI::getGroupCenter(StickyGroup, 1, (float *)&v45);
v19 = (_DWORD *)GameObject::createWithFrame("checkpoint_01_001.png");
v19[257] = 44;
v19[218] = v17;
v20 = sub_1000262F4(&v44, (double *)&v45);
(*(void (__fastcall **)(_DWORD *, float32x2_t *, double))(*(_QWORD *)v19 + 1368LL))(v19, &v44, v20);
sub_1002E74E0(a2, v19);
}
v16 = (unsigned int)(v16 + 1);
}
while ( (unsigned int)v16 < (unsigned int)sub_1002E757C(v15) );
}
}
if ( a3 )
v21 = (int (__cdecl *)(const void *, const void *))sub_1001A8A3C;
else
v21 = (int (__cdecl *)(const void *, const void *))sub_1001A89D8;
qsort(*(void **)(*(_QWORD *)(a2 + 56) + 16LL), **(unsigned int **)(a2 + 56), 8u, v21);
sub_1000262EC(&v45);
sub_1000262EC(&v44);
v22 = *(unsigned int **)(a2 + 56);
v23 = *v22;
if ( (_DWORD)v23 )
{
v24 = *((_QWORD **)v22 + 2);
v25 = (unsigned __int64)&v24[v23 - 1];
v26 = 1;
do
{
if ( !*v24 )
break;
v27 = (double *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*v24 + 192LL))(*v24);
sub_1000262F4(&v43, v27);
if ( (v26 & 1) != 0 )
{
sub_10002630C(&v45, (double *)&v43);
sub_10002630C(&v44, (double *)&v43);
}
else
{
if ( v43.f32[0] < v45.f32[0] )
v45.i32[0] = v43.i32[0];
if ( v43.f32[0] > v44.f32[0] )
v44.i32[0] = v43.i32[0];
if ( v43.f32[1] < v45.f32[1] )
v45.i32[1] = v43.i32[1];
if ( v43.f32[1] > v44.f32[1] )
v44.i32[1] = v43.i32[1];
}
v26 = 0;
++v24;
}
while ( (unsigned __int64)v24 <= v25 );
}
if ( v45.f32[0] != v44.f32[0] || v45.f32[1] != v44.f32[1] )
{
EditorUI::createUndoObject(a1, 5, 0);
sub_10002632C(&v44, &v45, &v43);
v28 = sub_1002E757C(a2);
sub_100026350(&v43, &v42, 1.0 / (float)(unsigned int)(v28 - 1));
if ( (unsigned int)sub_1002E757C(a2) - 3 <= 0xFFFFFFFD )
{
v29 = 1;
do
{
v30 = (unsigned int *)sub_1002E75A0(a2, v29);
v31 = (double *)(*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)v30 + 192LL))(v30);
sub_1000262F4(&v41, v31);
sub_1000262EC(&v40);
if ( a3 )
{
v32 = v41.f32[0];
v33 = v45.f32[1] + (float)((float)(unsigned int)v29 * v42.f32[1]);
}
else
{
v32 = v45.f32[0] + (float)((float)(unsigned int)v29 * v42.f32[0]);
v33 = v41.f32[1];
}
sub_1000262BC((float *)&v39, v32, v33);
sub_10002630C(&v40, (double *)&v39);
sub_10002632C(&v40, &v41, &v39);
if ( v30[257] == 44 )
{
v34 = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(a1 + 1440), v30[218]);
if ( v34 )
{
v35 = v34;
if ( (unsigned int)sub_1002E757C(v34) )
{
v36 = 0;
do
{
v37 = sub_1002E75A0(v35, v36);
sub_1000262F4(&v38, (double *)&v39);
EditorUI::moveObject(a1, v37, &v38);
v36 = (unsigned int)(v36 + 1);
}
while ( (unsigned int)v36 < (unsigned int)sub_1002E757C(v35) );
}
}
}
else
{
sub_10002632C(&v40, &v41, &v38);
EditorUI::moveObject(a1, (__int64)v30, &v38);
}
v29 = (unsigned int)(v29 + 1);
}
while ( (unsigned int)v29 < (unsigned int)sub_1002E757C(a2) - 1 );
}
EditorUI::updateControlsAfterAlign(a1);
}
}
}