//
// EditorUI::createSmartObjectsFromType from 0x3a47c0 to 0x3a4a08 (584 bytes)
//
// 1 xrefs:
// > SetupSmartBlockLayer::onCreate @ 0x53d55e
//
// 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 v7; // r7
cocos2d::CCArray *v8; // r0
cocos2d::CCArray *v9; // r5
int v10; // r0
int v11; // r2
ObjectToolbox *v12; // r0
float v13; // r0
cocos2d::CCArray *v14; // r10
int v15; // r8
cocos2d::CCNode *v16; // r11
float v17; // r1
float v18; // r2
int v19; // r2
bool v20; // r3
int v21; // r0
cocos2d::CCArray *v22; // r8
cocos2d::CCArray *v23; // r0
cocos2d::CCArray *v24; // r9
cocos2d::CCArray *v25; // r0
unsigned int v26; // r9
cocos2d::CCArray *v27; // r7
int v28; // r0
cocos2d::CCArray *RockEdges; // r1
cocos2d::CCArray *RockBases; // r1
cocos2d::CCArray *Outlines; // r1
cocos2d::CCArray *Extras; // r1
unsigned int i; // r7
GameObject *v34; // r0
EditorUI *v35; // r0
cocos2d::CCArray *v36; // r1
cocos2d::CCArray *v37; // [sp+0h] [bp-4Ch]
unsigned int v38; // [sp+Ch] [bp-40h]
int v39; // [sp+10h] [bp-3Ch]
int v41; // [sp+18h] [bp-34h]
_BOOL4 v42; // [sp+20h] [bp-2Ch]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+2Ch] [bp-20h]
cocos2d::CCPoint v44; // [sp+34h] [bp-18h] BYREF
cocos2d::CCPoint v45; // [sp+3Ch] [bp-10h] BYREF
v42 = a4;
if ( a3 && cocos2d::CCArray::count(a3) )
{
v7 = 0;
EditorUI::deselectAll(a1);
v39 = 0;
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
while ( v7 < cocos2d::CCArray::count(a3) )
{
v10 = cocos2d::CCArray::objectAtIndex(a3, v7);
v11 = v39;
++v7;
if ( v39 < *(__int16 *)(v10 + 1030) )
v11 = *(__int16 *)(v10 + 1030);
v39 = v11;
}
v12 = ObjectToolbox::sharedState();
v13 = ObjectToolbox::gridNodeSizeForKey(v12, a2);
if ( v13 == 15.0 )
{
v38 = 0;
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)LODWORD(v13));
while ( 1 )
{
v13 = COERCE_FLOAT(cocos2d::CCArray::count(a3));
if ( v38 >= LODWORD(v13) )
goto LABEL_23;
v15 = 0;
v41 = cocos2d::CCArray::objectAtIndex(a3, v38);
do
{
v16 = cocos2d::CCNode::create();
cocos2d::CCPoint::CCPoint(&v44, (const cocos2d::CCPoint *)&flt_AC5D38);
if ( v15 == 2 )
{
v17 = -7.5;
LABEL_18:
v18 = v17;
goto LABEL_20;
}
if ( v15 != 3 )
{
if ( v15 != 1 )
{
v17 = -7.5;
v18 = 7.5;
goto LABEL_20;
}
v17 = 7.5;
goto LABEL_18;
}
v17 = 7.5;
v18 = -7.5;
LABEL_20:
cocos2d::CCPoint::CCPoint(&v45, v17, v18);
++v15;
cocos2d::CCPoint::operator=((PlayerObject *)&v44, COERCE_FLOAT(&v45), v19, v20);
setPosition = v16->setPosition;
v21 = (*(int (__fastcall **)(int))(*(_DWORD *)v41 + 96))(v41);
cocos2d::CCPoint::operator+(&v45, &v44, v21);
setPosition(v16, &v45);
cocos2d::CCArray::addObject(v14, v16);
}
while ( v15 != 4 );
++v38;
}
}
v14 = a3;
LABEL_23:
v22 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)LODWORD(v13));
v23 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v22, v14);
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v23);
v25 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
v37 = v24;
v26 = 0;
v27 = v25;
EditorUI::processSmartObjectsFromType(a1, a2, v14, v22, v37, v25);
while ( v26 < cocos2d::CCArray::count(v27) )
{
v28 = cocos2d::CCArray::objectAtIndex(v27, v26++);
*(_WORD *)(v28 + 1032) = v39 + 1;
}
cocos2d::CCArray::addObjectsFromArray(v9, v27);
if ( cocos2d::CCArray::count(v9) )
{
RockEdges = EditorUI::createRockEdges(a1, v9);
if ( RockEdges )
cocos2d::CCArray::addObjectsFromArray(v9, RockEdges);
RockBases = EditorUI::createRockBases(a1, v9);
if ( RockBases )
cocos2d::CCArray::addObjectsFromArray(v9, RockBases);
Outlines = EditorUI::createOutlines(a1, v9);
if ( Outlines )
cocos2d::CCArray::addObjectsFromArray(v9, Outlines);
if ( v42 && (unsigned int)(a2 - 2703) <= 1 )
{
Extras = EditorUI::createExtras(a1, v9);
if ( Extras )
cocos2d::CCArray::addObjectsFromArray(v9, Extras);
}
EditorUI::deselectAll(a1);
if ( a5 )
{
v35 = a1;
v36 = a3;
}
else
{
for ( i = 0; i < cocos2d::CCArray::count(a3); ++i )
{
v34 = (GameObject *)cocos2d::CCArray::objectAtIndex(a3, i);
EditorUI::deleteObject(a1, v34, 1);
}
v35 = a1;
v36 = v9;
}
EditorUI::selectObjects(v35, v36, 1);
EditorUI::updateButtons(a1);
EditorUI::updateSpecialUIElements(a1);
}
}
}