//
// EditorUI::createRockEdges from 0x536aa4 to 0x536c8a (486 bytes)
//
// 1 xrefs:
// > EditorUI::createSmartObjectsFromType @ 0x3a495a
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
cocos2d::CCArray *EditorUI::createRockEdges(EditorUI *a1, cocos2d::CCArray *a2)
{
cocos2d::CCArray *v4; // r0
unsigned int v6; // r9
cocos2d::CCArray *v7; // r7
cocos2d::CCArray *v8; // r4
int v9; // r5
GameObject *v10; // r6
float v11; // r1
float v12; // r2
int v13; // r2
bool v14; // r3
unsigned int i; // r3
unsigned int v16; // r0
unsigned int v17; // r3
int v18; // r0
cocos2d::CCRect *v19; // r0
int v20; // r0
GameObject *EdgeForObject; // r1
cocos2d::ccArray *data; // r2
cocos2d::CCObject **arr; // r6
cocos2d::CCObject **v24; // r5
GameObject *v25; // r7
GameObject *v26; // t1
EditorUI *v27; // r0
GameObject *v28; // r1
int v29; // r2
GameObject *v30; // r1
GameObject *v31; // r1
int v32; // [sp+0h] [bp-3Ch]
int v33; // [sp+4h] [bp-38h]
int v34; // [sp+8h] [bp-34h]
unsigned int v35; // [sp+14h] [bp-28h]
cocos2d::CCPoint v36; // [sp+1Ch] [bp-20h] BYREF
cocos2d::CCPoint v37; // [sp+24h] [bp-18h] BYREF
cocos2d::CCPoint v38; // [sp+2Ch] [bp-10h] BYREF
if ( !a2 )
return nullptr;
v4 = (cocos2d::CCArray *)cocos2d::CCArray::count(a2);
if ( !v4 )
return nullptr;
v6 = 0;
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
cocos2d::CCArray::addObjectsFromArray(v7, a2);
LABEL_5:
if ( v6 < cocos2d::CCArray::count(v7) )
{
v9 = 0;
v10 = (GameObject *)cocos2d::CCArray::objectAtIndex(v7, v6);
v10->getRealPosition(&v36, v10);
v34 = 0;
v33 = 0;
v32 = 0;
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v37, &stru_AC77D0);
switch ( v9 )
{
case 2:
v11 = 0.0;
v12 = -30.0;
break;
case 3:
v11 = -30.0;
goto LABEL_14;
case 1:
v11 = 30.0;
LABEL_14:
v12 = 0.0;
break;
default:
v11 = 0.0;
v12 = 30.0;
break;
}
cocos2d::CCPoint::CCPoint(&v38, v11, v12);
cocos2d::CCPoint::operator=((PlayerObject *)&v37, COERCE_FLOAT(&v38), v13, v14);
cocos2d::CCPoint::operator+(&v38, &v36, &v37);
for ( i = 0; ; i = v17 + 1 )
{
v35 = i;
v16 = cocos2d::CCArray::count(v7);
v17 = v35;
if ( v35 >= v16 )
break;
if ( v35 != v6 )
{
v18 = cocos2d::CCArray::objectAtIndex(v7, v35);
v19 = (cocos2d::CCRect *)(*(int (__fastcall **)(int))(*(_DWORD *)v18 + 656))(v18);
v20 = cocos2d::CCRect::containsPoint(v19, &v38);
v17 = v35;
if ( v20 )
goto LABEL_26;
}
}
EdgeForObject = EditorUI::createEdgeForObject(a1, v10, v9);
if ( EdgeForObject )
cocos2d::CCArray::addObject(v8, EdgeForObject);
if ( v9 == 1 )
{
v33 = 1;
if ( v32 )
{
v27 = a1;
v28 = v10;
v29 = 4;
goto LABEL_45;
}
}
else if ( v9 == 2 )
{
v34 = 1;
if ( v33 )
{
v27 = a1;
v28 = v10;
v29 = 5;
LABEL_45:
v31 = EditorUI::createEdgeForObject(v27, v28, v29);
if ( v31 )
cocos2d::CCArray::addObject(v8, v31);
}
}
else
{
if ( v9 )
{
if ( v9 != 3 )
goto LABEL_26;
if ( v34 )
{
v30 = EditorUI::createEdgeForObject(a1, v10, 6);
if ( v30 )
cocos2d::CCArray::addObject(v8, v30);
}
if ( !v32 )
goto LABEL_26;
v27 = a1;
v28 = v10;
v29 = 7;
goto LABEL_45;
}
v32 = 1;
}
LABEL_26:
if ( ++v9 == 4 )
{
++v6;
goto LABEL_5;
}
}
}
if ( cocos2d::CCArray::count(v8) )
{
if ( cocos2d::CCArray::objectAtIndex(v7, 0) )
{
if ( v8 )
{
data = v8->data;
if ( data->num )
{
arr = data->arr;
v24 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v24 )
{
v26 = (GameObject *)*arr++;
v25 = v26;
if ( !v26 )
break;
GameObject::duplicateColorMode(v25);
GameObject::duplicateAttributes(v25);
v25->m_updateParents = 1;
}
}
}
}
}
return v8;
}