//
// EditorUI::createRockEdges from 0x100614110 to 0x100614488 (888 bytes)
//
// 1 xrefs:
// > EditorUI::createSmartObjectsFromType @ 0x1000440ec
//
// 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 v2; // r15
unsigned int v3; // r12d
GameObject *v4; // rsi
GameObject_vtbl *v5; // rax
unsigned int v6; // r14d
float v7; // xmm0_4
__int64 v8; // xmm1_8
double v9; // xmm0_8
unsigned int v10; // ebx
__int64 v11; // rax
float *v12; // rax
GameObject *EdgeForObject; // rax
int v14; // eax
GameObject *v15; // rax
GameObject *v16; // rax
int v17; // ecx
GameObject *v18; // rax
GameObject *v19; // rax
cocos2d::CCArray *v20; // r14
cocos2d::ccArray *data; // rax
GameObject **arr; // r15
unsigned __int64 v24; // r12
GameObject *v25; // r14
double v26; // [rsp+0h] [rbp-70h] BYREF
unsigned __int64 v27; // [rsp+8h] [rbp-68h] BYREF
__int64 v28; // [rsp+10h] [rbp-60h]
unsigned __int64 v29; // [rsp+18h] [rbp-58h] BYREF
GameObject *v30; // [rsp+20h] [rbp-50h]
EditorUI *v31; // [rsp+28h] [rbp-48h]
int v32; // [rsp+30h] [rbp-40h]
int v33; // [rsp+34h] [rbp-3Ch]
cocos2d::CCArray *v34; // [rsp+38h] [rbp-38h]
int v35; // [rsp+44h] [rbp-2Ch]
v31 = a1;
if ( !a2 || !(unsigned int)sub_100720070(a2) )
return nullptr;
v2 = sub_10071F9E0(a2, a2);
v34 = (cocos2d::CCArray *)sub_10071F9E0(a2, a2);
sub_100720050(v2, a2);
if ( (unsigned int)sub_100720070(v2) )
{
v3 = 0;
do
{
v4 = (GameObject *)sub_1007200C0(v2, v3);
v5 = v4->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v30 = v4;
((void (__fastcall *)(unsigned __int64 *))v5->getRealPosition)(&v27);
v32 = 0;
v35 = 0;
v33 = 0;
v6 = 0;
while ( 1 )
{
sub_10028CC60(&v29, &dbl_1009A3570);
v28 = v6;
switch ( v6 )
{
case 0u:
v7 = 0.0;
v8 = 1106247680;
break;
case 1u:
v8 = 0;
v7 = 30.0;
break;
case 2u:
v7 = 0.0;
v8 = 3253731328LL;
break;
case 3u:
v8 = 0;
v7 = -30.0;
break;
}
sub_10028CBE0((float *)&v26, v7, *(float *)&v8);
v9 = sub_10028CC90(&v29, &v26);
sub_10028CCE0(&v26, &v27, &v29);
if ( !(unsigned int)sub_100720070(v2) )
break;
v10 = 0;
while ( 1 )
{
if ( v3 != v10 )
{
v11 = sub_1007200C0(v2, v10);
v12 = (float *)(*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v11 + 1312LL))(v11, v9);
if ( sub_10028D2D0(v12, v9, *(double *)&v8, (float *)&v26) )
break;
}
if ( ++v10 >= (unsigned int)sub_100720070(v2) )
goto LABEL_20;
}
LABEL_8:
if ( ++v6 == 4 )
goto LABEL_5;
}
LABEL_20:
EdgeForObject = EditorUI::createEdgeForObject(v31, v30, v6);
if ( EdgeForObject )
sub_10071FCD0(v34, EdgeForObject);
v14 = v28;
switch ( v28 )
{
case 0LL:
LOBYTE(v14) = 1;
v32 = v14;
goto LABEL_8;
case 1LL:
LOBYTE(v14) = 1;
v35 = v14;
if ( (v32 & 1) != 0 )
{
v15 = EditorUI::createEdgeForObject(v31, v30, 4);
if ( v15 )
sub_10071FCD0(v34, v15);
}
goto LABEL_8;
case 2LL:
if ( (v35 & 1) != 0 )
{
v16 = EditorUI::createEdgeForObject(v31, v30, 5);
LOBYTE(v17) = 1;
v33 = v17;
if ( v16 )
v16 = (GameObject *)sub_10071FCD0(v34, v16);
LOBYTE(v16) = 1;
v35 = (int)v16;
}
else
{
LOBYTE(v14) = 1;
v33 = v14;
v35 = 0;
}
goto LABEL_8;
case 3LL:
if ( (v33 & 1) != 0 )
{
v18 = EditorUI::createEdgeForObject(v31, v30, 6);
if ( v18 )
sub_10071FCD0(v34, v18);
}
if ( (v32 & 1) != 0 )
{
v19 = EditorUI::createEdgeForObject(v31, v30, 7);
if ( v19 )
sub_10071FCD0(v34, v19);
}
break;
default:
goto LABEL_8;
}
LABEL_5:
++v3;
}
while ( v3 < (unsigned int)sub_100720070(v2) );
}
v20 = v34;
if ( (unsigned int)sub_100720070(v34) )
{
if ( sub_1007200C0(v2, 0) != 0 && v20 != nullptr )
{
data = v20->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v24 = (unsigned __int64)&arr[data->num - 1];
do
{
v25 = *arr;
if ( !*arr )
break;
GameObject::duplicateColorMode(*arr);
GameObject::duplicateAttributes(v25);
v25->m_updateParents = 1;
++arr;
}
while ( (unsigned __int64)arr <= v24 );
return v34;
}
}
}
return v20;
}