//
// EditorUI::createSmartObjectsFromType from 0x6c1230 to 0x6c16a8 (1144 bytes)
//
// 2 xrefs:
// > SetupSmartBlockLayer::onCreate @ 0x9dbfd4
// > ??> @ 0x711a8
//
// 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
//
void EditorUI::createSmartObjectsFromType(EditorUI *a1, int a2, cocos2d::CCArray *a3, bool a4, bool a5)
{
unsigned int v6; // w19
int v7; // w22
cocos2d::CCArray *v8; // x0
unsigned int v9; // w1
int v10; // w0
ObjectToolbox *v11; // x0
cocos2d::CCArray *v12; // x26
cocos2d::CCArray *v13; // x0
unsigned int v14; // w19
__int16 v15; // w22
cocos2d::CCArray *v16; // x0
cocos2d::CCArray *v17; // x20
unsigned int v18; // w1
cocos2d::CCArray *RockEdges; // x1
cocos2d::CCArray *RockBases; // x1
cocos2d::CCArray *Outlines; // x1
unsigned int k; // w19
unsigned int v23; // w1
GameObject *v24; // x0
unsigned int i; // w27
int v26; // w19
__int64 v27; // x25
cocos2d::CCNode *v28; // x20
int v29; // w28
float v30; // s0
float v31; // s1
__int64 v32; // x0
float j; // s0
float v34; // s0
float v35; // s1
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
__int64 v37; // x0
float v38; // s0
float v39; // s1
__int64 v40; // x0
cocos2d::CCArray *Extras; // x1
_BOOL4 v42; // [xsp+64h] [xbp+64h]
cocos2d::CCArray *v43; // [xsp+68h] [xbp+68h]
_BOOL4 v44; // [xsp+70h] [xbp+70h]
cocos2d::CCArray *v46; // [xsp+78h] [xbp+78h]
cocos2d::CCArray *v47; // [xsp+78h] [xbp+78h]
cocos2d::CCArray *v48; // [xsp+78h] [xbp+78h]
cocos2d::CCPoint *v50; // [xsp+88h] [xbp+88h]
cocos2d::CCPoint v51; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v52; // [xsp+A0h] [xbp+A0h] BYREF
v44 = a4;
v42 = a5;
if ( a3 && (unsigned int)cocos2d::CCArray::count(a3) )
{
v6 = 0;
v7 = 0;
EditorUI::deselectAll(a1);
v43 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
while ( v6 < (unsigned int)cocos2d::CCArray::count(a3) )
{
v9 = v6++;
v10 = *(__int16 *)(cocos2d::CCArray::objectAtIndex(a3, v9) + 1186);
if ( v7 < v10 )
v7 = v10;
}
v11 = ObjectToolbox::sharedState();
v12 = a3;
if ( ObjectToolbox::gridNodeSizeForKey(v11, a2) == 15.0 )
{
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(v13);
for ( i = 0; ; ++i )
{
v13 = (cocos2d::CCArray *)cocos2d::CCArray::count(a3);
if ( i >= (unsigned int)v13 )
break;
v26 = 1;
v27 = cocos2d::CCArray::objectAtIndex(a3, i);
v28 = cocos2d::CCNode::create();
v29 = 0;
cocos2d::CCPoint::CCPoint(&v51, (const cocos2d::CCPoint *)&dword_1242110);
while ( 1 )
{
if ( v29 == 3 )
{
cocos2d::CCPoint::CCPoint(&v52, 7.5, -7.5);
cocos2d::CCPoint::operator=(&v51, v34, v35);
setPosition = v28->setPosition;
v37 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 192LL))(v27);
cocos2d::CCPoint::operator+(&v52, &v51, v37);
setPosition(v28, &v52);
cocos2d::CCArray::addObject(v12, v28);
goto LABEL_37;
}
if ( v29 != 1 )
break;
for ( j = 7.5; ; j = -7.5 )
{
++v26;
cocos2d::CCPoint::CCPoint(&v52, j, j);
cocos2d::CCPoint::operator=(&v51, v38, v39);
v48 = (cocos2d::CCArray *)v28->setPosition;
v40 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 192LL))(v27);
cocos2d::CCPoint::operator+(&v52, &v51, v40);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *))v48)(v28, &v52);
cocos2d::CCArray::addObject(v12, v28);
LABEL_34:
v28 = cocos2d::CCNode::create();
v29 = v26 - 1;
cocos2d::CCPoint::CCPoint(&v51, (const cocos2d::CCPoint *)&dword_1242110);
if ( v26 != 3 )
break;
}
}
cocos2d::CCPoint::CCPoint(&v52, -7.5, 7.5);
cocos2d::CCPoint::operator=(&v51, v30, v31);
v47 = (cocos2d::CCArray *)v28->setPosition;
v32 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 192LL))(v27);
cocos2d::CCPoint::operator+(&v52, &v51, v32);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *))v47)(v28, &v52);
cocos2d::CCArray::addObject(v12, v28);
if ( v26 != 4 )
{
++v26;
goto LABEL_34;
}
LABEL_37:
;
}
}
v46 = (cocos2d::CCArray *)cocos2d::CCArray::create(v13);
v14 = 0;
v15 = v7 + 1;
v16 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v46, v12);
v50 = (cocos2d::CCPoint *)cocos2d::CCArray::create(v16);
v17 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v50);
EditorUI::processSmartObjectsFromType(a1, a2, v12, v46, (cocos2d::CCArray *)v50, v17);
while ( v14 < (unsigned int)cocos2d::CCArray::count(v17) )
{
v18 = v14++;
*(_WORD *)(cocos2d::CCArray::objectAtIndex(v17, v18) + 1188) = v15;
}
cocos2d::CCArray::addObjectsFromArray(v43, v17);
if ( (unsigned int)cocos2d::CCArray::count(v43) )
{
RockEdges = EditorUI::createRockEdges(a1, v43);
if ( RockEdges )
cocos2d::CCArray::addObjectsFromArray(v43, RockEdges);
RockBases = EditorUI::createRockBases(a1, v43);
if ( RockBases )
cocos2d::CCArray::addObjectsFromArray(v43, RockBases);
Outlines = EditorUI::createOutlines(a1, v43);
if ( Outlines )
cocos2d::CCArray::addObjectsFromArray(v43, Outlines);
if ( v44 && (unsigned int)(a2 - 2703) <= 1 )
{
Extras = EditorUI::createExtras(a1, v43);
if ( Extras )
cocos2d::CCArray::addObjectsFromArray(v43, Extras);
}
EditorUI::deselectAll(a1);
if ( v42 )
{
EditorUI::selectObjects(a1, a3, 1);
}
else
{
for ( k = 0; k < (unsigned int)cocos2d::CCArray::count(a3); ++k )
{
v23 = k;
v24 = (GameObject *)cocos2d::CCArray::objectAtIndex(a3, v23);
EditorUI::deleteObject(a1, v24, 1);
}
EditorUI::selectObjects(a1, v43, 1);
}
EditorUI::updateButtons(a1);
EditorUI::updateSpecialUIElements(a1);
}
}
}