//
// EditorUI::createRockEdges from 0x100078378 to 0x1000786a0 (808 bytes)
//
// 1 xrefs:
// > EditorUI::createSmartObjectsFromType @ 0x1003f27f8
//
// 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 *__fastcall EditorUI::createRockEdges(EditorUI *a1, cocos2d::CCArray *a2)
{
__int64 v4; // x0
__int64 v5; // x21
cocos2d::CCArray *v6; // x19
__int64 v7; // x22
GameObject *v8; // x24
int v9; // w28
char v10; // w27
int i; // w25
__n128 v12; // q0
__n128 v13; // q1
__int64 v14; // x26
__int64 v15; // x0
float *v16; // x0
GameObject *EdgeForObject; // x0
GameObject *v18; // x0
GameObject *v19; // x1
GameObject *v20; // x0
_BOOL4 v21; // w8
GameObject *v22; // x0
GameObject *v23; // x0
cocos2d::ccArray *data; // x9
__int64 num; // x8
GameObject **arr; // x22
unsigned __int64 v27; // x23
GameObject *v28; // x21
int v30; // [xsp+4h] [xbp-6Ch]
float32x2_t v31; // [xsp+8h] [xbp-68h] BYREF
float32x2_t v32; // [xsp+10h] [xbp-60h] BYREF
float32x2_t v33; // [xsp+18h] [xbp-58h] BYREF
if ( !a2 )
return nullptr;
v4 = sub_10024A36C(a2);
if ( !(_DWORD)v4 )
return nullptr;
v5 = sub_10024A15C(v4);
v6 = (cocos2d::CCArray *)sub_10024A15C(v5);
sub_10024A360(v5, a2);
if ( !(unsigned int)sub_10024A36C(v5) )
goto LABEL_45;
v7 = 0;
do
{
v8 = (GameObject *)sub_10024A388(v5, v7);
((void (__fastcall *)(float32x2_t *__return_ptr))v8->getRealPosition)(&v33);
v9 = 0;
v10 = 0;
v30 = 0;
for ( i = 0; i != 4; ++i )
{
sub_1000229B8((__int64 *)&v32, &qword_10086ABF0);
if ( i > 1 )
{
if ( i == 2 )
{
v12.n128_u32[0] = 0;
v13.n128_u32[0] = -30.0;
goto LABEL_14;
}
v12.n128_u32[0] = -30.0;
}
else
{
if ( !i )
{
v12.n128_u32[0] = 0;
v13.n128_u32[0] = 30.0;
goto LABEL_14;
}
v12.n128_u32[0] = 30.0;
}
v13.n128_u32[0] = 0;
LABEL_14:
sub_100022980(v12, v13, &v31);
sub_1000229D0(&v32, (double *)&v31);
sub_1000229DC(&v33, &v32, &v31);
if ( (unsigned int)sub_10024A36C(v5) )
{
v14 = 0;
while ( 1 )
{
if ( (_DWORD)v7 != (_DWORD)v14 )
{
v15 = sub_10024A388(v5, v14);
v16 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 1312LL))(v15);
if ( sub_100022C60(v16, (float *)&v31) )
break;
}
v14 = (unsigned int)(v14 + 1);
if ( (unsigned int)v14 >= (unsigned int)sub_10024A36C(v5) )
goto LABEL_19;
}
}
else
{
LABEL_19:
EdgeForObject = EditorUI::createEdgeForObject(a1, v8, i);
if ( EdgeForObject )
sub_10024A2D0(v6, EdgeForObject);
switch ( i )
{
case 0:
LABEL_27:
v9 = 1;
continue;
case 2:
if ( (v10 & 1) == 0 )
{
v10 = 0;
v30 = 1;
continue;
}
v20 = EditorUI::createEdgeForObject(a1, v8, 5);
v30 = 1;
if ( v20 )
{
v19 = v20;
v10 = 1;
LABEL_39:
sub_10024A2D0(v6, v19);
continue;
}
goto LABEL_42;
case 1:
if ( (v9 & 1) != 0 )
{
v18 = EditorUI::createEdgeForObject(a1, v8, 4);
v10 = 1;
if ( !v18 )
goto LABEL_27;
v19 = v18;
v9 = 1;
goto LABEL_39;
}
v9 = 0;
LABEL_42:
v10 = 1;
continue;
}
v21 = i != 3;
if ( i == 3 && ((v30 ^ 1) & 1) == 0 )
{
v22 = EditorUI::createEdgeForObject(a1, v8, 6);
if ( v22 )
sub_10024A2D0(v6, v22);
v21 = 0;
}
if ( ((v21 | v9 ^ 1) & 1) == 0 )
{
v23 = EditorUI::createEdgeForObject(a1, v8, 7);
if ( v23 )
{
v19 = v23;
goto LABEL_39;
}
}
}
}
v7 = (unsigned int)(v7 + 1);
}
while ( (unsigned int)v7 < (unsigned int)sub_10024A36C(v5) );
LABEL_45:
if ( (unsigned int)sub_10024A36C(v6) )
{
if ( sub_10024A388(v5, 0) )
{
if ( v6 )
{
data = v6->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
v27 = (unsigned __int64)&arr[num - 1];
do
{
v28 = *arr;
if ( !*arr )
break;
GameObject::duplicateColorMode(*arr);
GameObject::duplicateAttributes(v28);
v28->m_updateParents = 1;
++arr;
}
while ( (unsigned __int64)arr <= v27 );
}
}
}
}
return v6;
}