//
// EditorUI::alignObjectsOnAxis from 0x70f058 to 0x70f344 (748 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0x6f1f86
// > EditorUI::handleEditorAction @ 0x6f1f9e
// > EditorCommandsPopup::onCommand @ 0x77a7a2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:57:43 +0000
//
unsigned int __fastcall EditorUI::alignObjectsOnAxis(unsigned int this, int **a2, int a3)
{
int v3; // r5
cocos2d::CCArray *v5; // r0
unsigned int v6; // r1
cocos2d::CCArray *v7; // r0
cocos2d::CCDictionary *v8; // r0
cocos2d::CCDictionary *v9; // r7
unsigned int v10; // r6
int v11; // r8
cocos2d::CCObject *v12; // r0
unsigned int v13; // r6
cocos2d::CCArray *v14; // r7
int v15; // r10
cocos2d::CCArray *StickyGroup; // r2
const char *v17; // r1
GameObject *v18; // r0
cocos2d::CCObject *v19; // r9
int v20; // r3
int *v21; // r2
int v22; // r3
float v23; // s15
float v24; // s14
unsigned int *v25; // r2
unsigned int v26; // r7
unsigned int *v27; // r11
int i; // r2
unsigned int v29; // t1
int *v30; // r3
int **v31; // r6
int *v32; // r4
int *v33; // t1
const cocos2d::CCPoint *v34; // r0
const cocos2d::CCPoint *v35; // r0
cocos2d::CCArray *v36; // r9
unsigned int v37; // r4
GameObject *v38; // r0
void (__fastcall *v40)(cocos2d::CCObject *, float *); // [sp+4h] [bp-50h]
int **v41; // [sp+4h] [bp-50h]
int v42; // [sp+4h] [bp-50h]
GameObject *v43; // [sp+Ch] [bp-48h]
float v44; // [sp+14h] [bp-40h] BYREF
float v45; // [sp+18h] [bp-3Ch]
float v46; // [sp+1Ch] [bp-38h] BYREF
float v47; // [sp+20h] [bp-34h]
_DWORD v48[2]; // [sp+24h] [bp-30h] BYREF
_BYTE v49[8]; // [sp+2Ch] [bp-28h] BYREF
_DWORD v50[2]; // [sp+34h] [bp-20h] BYREF
_BYTE v51[8]; // [sp+3Ch] [bp-18h] BYREF
float v52; // [sp+44h] [bp-10h] BYREF
float v53; // [sp+48h] [bp-Ch]
v3 = this;
if ( a2 )
{
this = cocos2d::CCArray::count((cocos2d::CCArray *)a2);
if ( this > 1 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::count((cocos2d::CCArray *)a2);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::createWithCapacity(v5, v6);
v8 = (cocos2d::CCDictionary *)cocos2d::CCArray::addObjectsFromArray(v7, (cocos2d::CCArray *)a2);
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v8);
if ( *(_BYTE *)(v3 + 643) )
{
v10 = *(unsigned __int8 *)(v3 + 644);
if ( !*(_BYTE *)(v3 + 644) )
{
while ( v10 < cocos2d::CCArray::count((cocos2d::CCArray *)a2) )
{
v11 = cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)a2, v10);
if ( *(int *)(v11 + 740) <= 0 )
{
++v10;
}
else
{
cocos2d::CCArray::removeObjectAtIndex((cocos2d::CCArray *)a2, v10, 1);
if ( !cocos2d::CCDictionary::objectForKey(v9, *(_DWORD *)(v11 + 740)) )
{
v12 = (cocos2d::CCObject *)cocos2d::CCNode::create(nullptr);
cocos2d::CCDictionary::setObject(v9, v12, *(_DWORD *)(v11 + 740));
}
}
}
v13 = 0;
v14 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v9);
while ( v13 < cocos2d::CCArray::count(v14) )
{
v15 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v14, v13) + 52);
StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(
*(cocos2d::CCDictionary ***)(v3 + 944),
v15);
if ( StickyGroup )
{
EditorUI::getGroupCenter((EditorUI *)v51, (cocos2d::CCArray *)v3, StickyGroup, 1);
v18 = GameObject::createWithFrame((GameObject *)"checkpoint_01_001.png", v17);
*((_DWORD *)v18 + 223) = 44;
v19 = v18;
v20 = *(_DWORD *)v18;
*((_DWORD *)v18 + 185) = v15;
v40 = *(void (__fastcall **)(cocos2d::CCObject *, float *))(v20 + 684);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, (const cocos2d::CCPoint *)v51);
v40(v19, &v52);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a2, v19);
}
++v13;
}
}
}
this = cocos2d::CCArray::count((cocos2d::CCArray *)a2);
if ( this > 1 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44);
this = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v46);
v21 = a2[13];
v22 = *v21;
if ( *v21 )
{
v25 = (unsigned int *)v21[3];
v26 = (unsigned int)&v25[v22 - 1];
v27 = v25;
for ( i = 1; (unsigned int)v27 <= v26; i = 0 )
{
v29 = *v27++;
this = v29;
if ( !v29 )
break;
v42 = i;
v34 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(unsigned int))(*(_DWORD *)this + 96))(this);
this = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v34);
if ( v42 )
{
cocos2d::CCPoint::operator=(&v44, &v52);
this = cocos2d::CCPoint::operator=(&v46, &v52);
}
else
{
if ( v52 < v44 )
v44 = v52;
if ( v52 > v46 )
v46 = v52;
if ( v53 < v45 )
v45 = v53;
if ( v53 > v47 )
v47 = v53;
}
}
}
if ( a3 )
{
v23 = v47;
v24 = v45;
}
else
{
v23 = v46;
v24 = v44;
}
if ( v24 != v23 )
{
cocos2d::CCPoint::operator+(&v52, &v44, &v46);
cocos2d::CCPoint::operator/(v48, &v52, 0x40000000);
EditorUI::createUndoObject(v3, 5, 0);
v30 = a2[13];
if ( *v30 )
{
v31 = (int **)v30[3];
v41 = &(&v31[*v30])[-1];
while ( v31 <= v41 )
{
v33 = *v31++;
v32 = v33;
if ( !v33 )
break;
v35 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int *))(*v32 + 96))(v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const cocos2d::CCPoint *)v49);
if ( a3 )
v50[1] = v48[1];
else
v50[0] = v48[0];
cocos2d::CCPoint::operator-(v51, v50, v49);
if ( v32[223] == 44 )
{
v36 = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(
*(cocos2d::CCDictionary ***)(v3 + 944),
v32[185]);
if ( v36 )
{
v37 = 0;
while ( v37 < cocos2d::CCArray::count(v36) )
{
v38 = (GameObject *)cocos2d::CCArray::objectAtIndex(v36, v37++);
v43 = v38;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, (const cocos2d::CCPoint *)v51);
EditorUI::moveObject(v3, v43, (int)&v52);
}
}
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, (const cocos2d::CCPoint *)v51);
EditorUI::moveObject(v3, (GameObject *)v32, (int)&v52);
}
}
}
return EditorUI::updateControlsAfterAlign((EditorUI *)v3);
}
}
}
}
return this;
}