//
// EditorUI::createRockEdges from 0x9cc2d0 to 0x9cc72c (1116 bytes)
//
// 2 xrefs:
// > EditorUI::createSmartObjectsFromType @ 0x6c13b4
// > ??> @ 0xc93c0
//
// 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 *v3; // x0
cocos2d::CCArray *v4; // x19
unsigned int v5; // w20
int v6; // w22
GameObject *v7; // x24
float v8; // s0
float v9; // s1
unsigned int v10; // w28
__int64 v11; // x0
cocos2d::CCRect *v12; // x0
GameObject *EdgeForObject; // x1
_BOOL4 v14; // w0
GameObject *v15; // x1
cocos2d::CCArray *v16; // x20
cocos2d::ccArray *data; // x1
GameObject **arr; // x19
__int64 v19; // x0
char *v20; // x21
GameObject *v21; // x22
float v23; // s0
float v24; // s1
float v25; // s0
float v26; // s1
GameObject *v27; // x1
GameObject *v28; // x1
GameObject *v29; // x1
int v30; // [xsp+68h] [xbp+68h]
cocos2d::CCArray *v31; // [xsp+70h] [xbp+70h]
int v32; // [xsp+78h] [xbp+78h]
int v33; // [xsp+78h] [xbp+78h]
int v34; // [xsp+84h] [xbp+84h]
int v36; // [xsp+88h] [xbp+88h]
__int64 v37; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v38; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v39; // [xsp+A0h] [xbp+A0h] BYREF
if ( !a2 )
return nullptr;
v3 = (cocos2d::CCArray *)cocos2d::CCArray::count(a2);
if ( !(_DWORD)v3 )
return nullptr;
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3);
v5 = 0;
v31 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
cocos2d::CCArray::addObjectsFromArray(v4, a2);
if ( !(unsigned int)cocos2d::CCArray::count(v4) )
goto LABEL_30;
do
{
v32 = 0;
v6 = 0;
v34 = 0;
v36 = 0;
v7 = (GameObject *)cocos2d::CCArray::objectAtIndex(v4, v5);
v7->getRealPosition((GameObject *)&v37);
do
{
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v38, &stru_1243DD0);
if ( v6 == 2 )
{
cocos2d::CCPoint::CCPoint(&v39, 0.0, -30.0);
cocos2d::CCPoint::operator=(&v38, v25, v26);
}
else if ( v6 == 3 )
{
cocos2d::CCPoint::CCPoint(&v39, -30.0, 0.0);
cocos2d::CCPoint::operator=(&v38, v23, v24);
}
else
{
if ( v6 == 1 )
cocos2d::CCPoint::CCPoint(&v39, 30.0, 0.0);
else
cocos2d::CCPoint::CCPoint(&v39, 0.0, 30.0);
cocos2d::CCPoint::operator=(&v38, v8, v9);
}
v10 = 0;
cocos2d::CCPoint::operator+(&v39, &v37, &v38);
if ( (unsigned int)cocos2d::CCArray::count(v4) )
{
do
{
if ( v10 != v5 )
{
v11 = cocos2d::CCArray::objectAtIndex(v4, v10);
v12 = (cocos2d::CCRect *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
if ( (unsigned __int8)cocos2d::CCRect::containsPoint(v12, &v39) )
goto LABEL_28;
}
}
while ( ++v10 < (unsigned int)cocos2d::CCArray::count(v4) );
}
EdgeForObject = EditorUI::createEdgeForObject(a1, v7, v6);
if ( EdgeForObject )
cocos2d::CCArray::addObject(v31, EdgeForObject);
switch ( v6 )
{
case 1:
v34 = 1;
if ( !v36 )
goto LABEL_28;
v29 = EditorUI::createEdgeForObject(a1, v7, 4);
if ( !v29 )
{
v34 = 1;
goto LABEL_23;
}
cocos2d::CCArray::addObject(v31, v29);
break;
case 2:
v32 = 1;
break;
case 0:
v36 = 1;
break;
}
if ( v34 )
{
if ( v6 == 2 )
{
v28 = EditorUI::createEdgeForObject(a1, v7, 5);
v34 = 1;
if ( v28 )
cocos2d::CCArray::addObject(v31, v28);
}
}
LABEL_23:
v14 = v6 == 3;
if ( (v32 & v14) != 0 )
{
v33 = v32 & v14;
v27 = EditorUI::createEdgeForObject(a1, v7, 6);
if ( v27 )
{
v30 = v33;
v32 = 1;
cocos2d::CCArray::addObject(v31, v27);
v14 = v30;
}
else
{
v14 = v33;
v32 = 1;
}
}
if ( !v36 || !v14 )
goto LABEL_28;
v15 = EditorUI::createEdgeForObject(a1, v7, 7);
if ( !v15 )
break;
v36 = 1;
cocos2d::CCArray::addObject(v31, v15);
LABEL_28:
if ( ++v6 == 4 )
goto LABEL_29;
}
++v6;
v36 = 1;
}
while ( v6 != 4 );
LABEL_29:
++v5;
}
while ( v5 < (unsigned int)cocos2d::CCArray::count(v4) );
LABEL_30:
v16 = v31;
if ( (unsigned int)cocos2d::CCArray::count(v31) )
{
if ( cocos2d::CCArray::objectAtIndex(v4, 0) )
{
if ( v31 )
{
data = v31->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v19 = 8LL * data->num - 8;
v20 = (char *)arr + v19;
if ( arr <= (GameObject **)((char *)arr + v19) )
{
v21 = *arr;
if ( *arr )
{
do
{
++arr;
GameObject::duplicateColorMode(v21);
GameObject::duplicateAttributes(v21);
v21->m_updateParents = 1;
if ( v20 < (char *)arr )
break;
v21 = *arr;
}
while ( *arr );
return v31;
}
}
}
}
}
}
return v16;
}