//
// EditorUI::createRockEdges from 0x14012e320 to 0x14012e690 (880 bytes)
//
// 5 xrefs:
// > EditorUI::createSmartObjectsFromType @ 0x1401181f5
// > ??> @ 0x140670da8
// > ??> @ 0x140670e08
// > ??> @ 0x140670e18
// > ??> @ 0x1406c9d74
//
// 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)
{
__int64 v4; // rcx
cocos2d::CCArray *v5; // rsi
__int64 v6; // rcx
cocos2d::CCArray *v7; // r14
unsigned int i; // ebp
GameObject *v9; // r15
char v10; // r13
int j; // edi
float v12; // xmm2_4
cocos2d::CCPoint *v13; // rcx
float v14; // xmm1_4
__int64 v15; // rax
unsigned int v16; // ebx
struct cocos2d::CCObject *v17; // rax
cocos2d::CCRect *v18; // rax
GameObject *EdgeForObject; // rax
GameObject *v20; // rax
int v21; // r8d
GameObject *v22; // rax
cocos2d::ccArray *data; // rdi
__int64 num; // rax
GameObject **arr; // rdi
GameObject **k; // rbp
GameObject *v27; // rbx
_BYTE v29[8]; // [rsp+20h] [rbp-88h] BYREF
struct cocos2d::CCPoint v30; // [rsp+28h] [rbp-80h] BYREF
char v31; // [rsp+30h] [rbp-78h] BYREF
char v32; // [rsp+38h] [rbp-70h] BYREF
char v33; // [rsp+40h] [rbp-68h] BYREF
char v34; // [rsp+48h] [rbp-60h] BYREF
char v35; // [rsp+B8h] [rbp+10h]
char v36; // [rsp+C0h] [rbp+18h]
cocos2d::CCPoint v37; // [rsp+C8h] [rbp+20h] BYREF
if ( !a2 || !cocos2d::CCArray::count(a2) )
return nullptr;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
cocos2d::CCArray::addObjectsFromArray(v5, a2);
for ( i = 0; i < cocos2d::CCArray::count(v5); ++i )
{
v9 = (GameObject *)cocos2d::CCArray::objectAtIndex(v5, i);
((void (__fastcall *)(GameObject *, _BYTE *))v9->getRealPosition)(v9, v29);
v10 = 0;
v36 = 0;
v35 = 0;
for ( j = 0; j < 4; ++j )
{
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v37);
switch ( j )
{
case 0:
v12 = 30.0;
v13 = (cocos2d::CCPoint *)&v34;
goto LABEL_13;
case 1:
v12 = 0.0;
v13 = (cocos2d::CCPoint *)&v33;
v14 = 30.0;
break;
case 2:
v12 = -30.0;
v13 = (cocos2d::CCPoint *)&v32;
LABEL_13:
v14 = 0.0;
break;
case 3:
v12 = 0.0;
v13 = (cocos2d::CCPoint *)&v31;
v14 = -30.0;
break;
default:
goto LABEL_15;
}
cocos2d::CCPoint::CCPoint(v13, v14, v12);
cocos2d::CCPoint::operator=(&v37, v15);
LABEL_15:
cocos2d::CCPoint::operator+(v29, &v30);
v16 = 0;
if ( cocos2d::CCArray::count(v5) )
{
do
{
if ( v16 != i )
{
v17 = cocos2d::CCArray::objectAtIndex(v5, v16);
v18 = (cocos2d::CCRect *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v17->__vftable[16].isEqual)(v17);
if ( cocos2d::CCRect::containsPoint(v18, &v30) )
goto LABEL_36;
}
}
while ( ++v16 < cocos2d::CCArray::count(v5) );
}
EdgeForObject = EditorUI::createEdgeForObject(a1, v9, j);
if ( EdgeForObject )
cocos2d::CCArray::addObject(v7, EdgeForObject);
if ( j )
break;
v10 = 1;
j = 1;
}
switch ( j )
{
case 1:
v36 = 1;
if ( !v10 )
continue;
v21 = 4;
goto LABEL_34;
case 2:
v35 = 1;
if ( !v36 )
continue;
v21 = 5;
goto LABEL_34;
case 3:
if ( v35 )
{
v20 = EditorUI::createEdgeForObject(a1, v9, 6);
if ( v20 )
cocos2d::CCArray::addObject(v7, v20);
}
if ( v10 )
{
v21 = 7;
LABEL_34:
v22 = EditorUI::createEdgeForObject(a1, v9, v21);
if ( v22 )
cocos2d::CCArray::addObject(v7, v22);
continue;
}
break;
}
LABEL_36:
;
}
}
if ( cocos2d::CCArray::count(v7) )
{
if ( cocos2d::CCArray::objectAtIndex(v5, 0) )
{
if ( v7 )
{
data = v7->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
for ( k = &arr[num - 1]; arr <= k; v27->m_updateParents = 1 )
{
v27 = *arr;
if ( !*arr )
break;
GameObject::duplicateColorMode(*arr);
GameObject::duplicateAttributes(v27);
++arr;
}
}
}
}
}
return v7;
}