//
// EditorUI::onDelete from 0x48c490 to 0x48c71a (650 bytes)
//
// 1 xrefs:
// > EditorUI::clickOnPosition @ 0x48c76e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:49:31 +0000
//
int __fastcall EditorUI::onDelete(EditorUI *this, cocos2d::CCObject *a2)
{
int v2; // r6
cocos2d::CCArray *v4; // r0
cocos2d::CCArray *v5; // r8
int v6; // r0
int v7; // r0
unsigned int v8; // r6
int v9; // r10
int v10; // r5
GameObject *CycledObject; // r0
cocos2d::CCObject *v12; // r9
int v13; // r6
cocos2d::CCObject *v14; // r5
cocos2d::CCDictionary *v15; // r0
int v16; // r3
cocos2d::CCDictionary *v17; // r9
unsigned int v18; // r10
cocos2d::CCArray *v19; // r11
_DWORD *v20; // r2
int **v21; // r6
int **v22; // r8
int *v23; // r10
int *v24; // t1
cocos2d::CCObject *v25; // r9
unsigned int i; // r6
int v27; // r0
cocos2d::CCArray *StickyGroup; // r8
EditorSFXManager *v29; // r0
EditorSFXManager *v30; // r0
int v31; // r3
UndoObject *v32; // r0
_DWORD *v33; // r3
int v34; // r6
GameObject **v35; // r3
unsigned int v36; // r6
GameObject **v37; // r8
GameObject *v38; // r1
GameObject *v39; // t1
GameObject *v41; // r9
int v42; // r1
float v43[2]; // [sp+4h] [bp-10h] BYREF
v2 = *((_DWORD *)this + 236);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, (EditorUI *)((char *)this + 988));
v4 = LevelEditorLayer::objectsAtPosition(v2, v43);
v5 = v4;
if ( !*((_BYTE *)this + 636)
|| (v6 = cocos2d::CCDirector::sharedDirector(v4),
v7 = (*(int (__fastcall **)(int))(*(_DWORD *)v6 + 96))(v6),
v8 = *(unsigned __int8 *)(v7 + 88),
*(_BYTE *)(v7 + 88)) )
{
v13 = 0;
CycledObject = (GameObject *)cocos2d::CCArray::count(v5);
v41 = CycledObject;
while ( 1 )
{
if ( v13 >= (int)v41
|| (CycledObject = (GameObject *)EditorUI::getCycledObject(this, v5, 1), (v14 = CycledObject) == nullptr) )
{
v10 = 0;
goto LABEL_17;
}
CycledObject = (GameObject *)EditorUI::shouldDeleteObject(this, CycledObject);
if ( CycledObject )
break;
++v13;
}
if ( *((_DWORD *)v14 + 223) == 747 )
EditorUI::deselectTargetPortals(this);
CycledObject = (GameObject *)cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 226), v14);
v10 = *((_DWORD *)v14 + 185) > 0;
}
else
{
v9 = *(unsigned __int8 *)(v7 + 88);
v10 = v9;
while ( 1 )
{
CycledObject = (GameObject *)cocos2d::CCArray::count(v5);
if ( v8 >= (unsigned int)CycledObject )
break;
v12 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v5, v8);
if ( EditorUI::shouldDeleteObject(this, v12) )
{
if ( !v9 && *((_DWORD *)v12 + 223) == 747 )
{
v9 = 1;
EditorUI::deselectTargetPortals(this);
}
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 226), v12);
if ( !v10 )
v10 = *((_DWORD *)v12 + 185) > 0;
}
++v8;
}
}
LABEL_17:
if ( *((_BYTE *)this + 643) )
{
if ( *((_BYTE *)this + 644) )
{
v10 = 0;
}
else if ( v10 )
{
v15 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(CycledObject);
v16 = *((_DWORD *)this + 226);
v17 = v15;
if ( v16 )
{
v20 = *(_DWORD **)(v16 + 52);
if ( *v20 )
{
v21 = (int **)v20[3];
v22 = &(&v21[*v20])[-1];
while ( v21 <= v22 )
{
v24 = *v21++;
v23 = v24;
if ( !v24 )
break;
v42 = v23[185];
if ( v42 > 0 && !cocos2d::CCDictionary::objectForKey(v17, v42) )
cocos2d::CCDictionary::setObject(v17, (cocos2d::CCObject *)v23, v23[185]);
}
}
}
v18 = 0;
v19 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v17);
while ( v18 < cocos2d::CCArray::count(v19) )
{
v27 = cocos2d::CCArray::objectAtIndex(v19, v18);
StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(
*((GJBaseGameLayer **)this + 236),
*(_DWORD *)(v27 + 52));
if ( StickyGroup )
{
for ( i = 0; i < cocos2d::CCArray::count(StickyGroup); ++i )
{
v25 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(StickyGroup, i);
if ( !cocos2d::CCArray::containsObject(*((cocos2d::CCArray **)this + 226), v25) )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 226), v25);
}
}
++v18;
}
}
}
else
{
v10 = *((unsigned __int8 *)this + 643);
}
v29 = (EditorSFXManager *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 226));
if ( v29 )
{
v30 = (EditorSFXManager *)EditorSFXManager::sharedState(v29);
EditorSFXManager::playAction(v30, 101);
if ( !*((_BYTE *)this + 528) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_DWORD *)this + 236) + 12104));
*((_BYTE *)this + 528) = 1;
}
v31 = *((_DWORD *)this + 226);
if ( v31 )
{
v33 = *(_DWORD **)(v31 + 52);
if ( *v33 )
{
v34 = *v33 + 0x40000000;
v35 = (GameObject **)v33[3];
v36 = (unsigned int)&v35[v34 - 1];
v37 = v35;
while ( (unsigned int)v37 <= v36 )
{
v39 = *v37++;
v38 = v39;
if ( !v39 )
break;
EditorUI::deleteObject(this, v38, v10);
}
}
}
if ( v10 )
{
*(_DWORD *)(*((_DWORD *)this + 236) + 12112) += cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 226));
v32 = UndoObject::createWithArray(*((cocos2d::CCArray **)this + 226), 4);
LevelEditorLayer::addToUndoList(*((cocos2d::CCArray ***)this + 236), v32, 0);
}
cocos2d::CCArray::removeAllObjects(*((cocos2d::CCArray **)this + 226));
return EditorUI::updateSpecialUIElements((cocos2d::CCArray **)this);
}