//
// EditorUI::onDelete from 0x10002dc20 to 0x10002e159 (1337 bytes)
//
// 1 xrefs:
// > EditorUI::clickOnPosition @ 0x10002dae3
//
// 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 __fastcall EditorUI::onDelete(EditorUI *a1, cocos2d::CCObject *a2)
{
EditorUI *v2; // r12
LevelEditorLayer *m_editorLayer; // rbx
cocos2d::CCPoint v4; // xmm0_8
__int64 m_uIndexInArray; // rsi
cocos2d::CCArray *v6; // r15
bool m_swipeEnabled; // zf
cocos2d::CCDirector *v8; // rax
unsigned int v9; // ebx
unsigned int v10; // ebx
__int64 v11; // r13
__int64 v12; // r12
__int64 v13; // rax
GameManager *v14; // rax
GameManager *v15; // rax
GameManager *v16; // rax
GameManager *v17; // rax
unsigned int IntGameVariable; // eax
GameManager *v19; // rax
int v20; // eax
int v21; // r14d
bool v22; // r13
cocos2d::CCArray *m_deleteObjects; // rdi
cocos2d::ccArray *v24; // rax
__int64 *v25; // r14
unsigned __int64 v26; // r15
int v27; // r13d
unsigned int v28; // r14d
GameObject *v29; // rbx
__int64 v30; // rax
cocos2d::CCDictionary *v31; // rbx
cocos2d::CCArray *v32; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCObject **arr; // r15
unsigned __int64 v35; // r12
cocos2d::CCObject *v36; // r14
cocos2d::CCArray *v37; // rbx
unsigned int v38; // r14d
unsigned int v39; // eax
cocos2d::CCArray *StickyGroup; // rax
cocos2d::CCArray *v41; // r15
unsigned int v42; // r12d
__int64 v43; // r13
char v44[8]; // [rsp+Ch] [rbp-44h] BYREF
int v45; // [rsp+14h] [rbp-3Ch]
EditorUI *v46; // [rsp+18h] [rbp-38h]
int v47; // [rsp+24h] [rbp-2Ch]
v2 = a1;
m_editorLayer = a1->m_editorLayer;
*(double *)&v4 = sub_10028CC60(v44, &a1->m_clickAtPosition);
m_uIndexInArray = (__int64)v44;
v6 = LevelEditorLayer::objectsAtPosition(m_editorLayer, v4);
m_swipeEnabled = a1->m_swipeEnabled;
v46 = a1;
if ( m_swipeEnabled
&& (v8 = cocos2d::CCDirector::sharedDirector(),
!*(_BYTE *)(((__int64 (__fastcall *)(cocos2d::CCDirector *, char *))v8->getKeyboardDispatcher)(v8, v44) + 88)) )
{
v9 = 0;
if ( (unsigned int)sub_100720070(v6) )
{
v47 = 0;
v27 = 0;
do
{
v28 = v9;
v29 = (GameObject *)sub_1007200C0(v6, v9);
m_uIndexInArray = (__int64)v29;
if ( EditorUI::shouldDeleteObject((EditorUI *)v6, v29) )
{
LOBYTE(v2) = 1;
if ( (v27 & 1) == 0 )
{
if ( v29->m_objectID == 747 )
EditorUI::deselectTargetPortals(v46);
else
LODWORD(v2) = 0;
}
m_uIndexInArray = (__int64)v29;
v30 = sub_10071FCD0(v46->m_deleteObjects, v29);
if ( (v47 & 1) == 0 )
{
LOBYTE(v30) = v29->m_linkedGroup > 0;
v47 = v30;
}
}
else
{
LODWORD(v2) = v27;
}
v9 = v28 + 1;
v27 = (int)v2;
}
while ( v28 + 1 < (unsigned int)sub_100720070(v6) );
LOBYTE(v9) = v47;
LABEL_46:
v2 = v46;
}
}
else
{
v9 = 0;
v45 = sub_100720070(v6);
if ( v45 > 0 )
{
while ( 1 )
{
v47 = v9;
v10 = 0;
if ( !(unsigned int)sub_100720070(v6) )
{
LABEL_22:
LOBYTE(v9) = 0;
if ( v2->m_stickyControlsEnabled )
goto LABEL_48;
goto LABEL_23;
}
v11 = 0;
do
{
v12 = v11;
m_uIndexInArray = v10;
v13 = sub_1007200C0(v6, v10);
v11 = v13;
if ( v12 && *(_DWORD *)(v13 + 1136) >= *(_DWORD *)(v12 + 1136) )
goto LABEL_6;
v14 = GameManager::sharedState();
if ( GameManager::getGameVariable(v14, "0064") )
{
v15 = GameManager::sharedState();
if ( GameManager::getIntGameVariable(v15, "0005") == 3 )
{
v16 = GameManager::sharedState();
m_uIndexInArray = (__int64)"0006";
if ( *(_DWORD *)(v11 + 1028) != GameManager::getIntGameVariable(v16, "0006") )
goto LABEL_6;
}
}
if ( (v17 = GameManager::sharedState(), (IntGameVariable = GameManager::getIntGameVariable(v17, "0133")) != 0)
&& (m_uIndexInArray = IntGameVariable, !GameObject::belongsToGroup((GameObject *)v11, IntGameVariable))
|| (v19 = GameManager::sharedState(),
m_uIndexInArray = (__int64)"0139",
(v20 = GameManager::getIntGameVariable(v19, "0139")) != 0)
&& (v21 = v20, GameObject::getMainColorMode((GameObject *)v11) != v20)
&& GameObject::getSecondaryColorMode((GameObject *)v11) != v21 )
{
LABEL_6:
v11 = v12;
}
++v10;
}
while ( v10 < (unsigned int)sub_100720070(v6) );
if ( !v11 )
{
LOBYTE(v9) = 0;
goto LABEL_46;
}
v2 = v46;
*(_DWORD *)(v11 + 1136) = v46->m_cycledObjectIndex;
m_uIndexInArray = v11;
if ( EditorUI::shouldDeleteObject((EditorUI *)v6, (GameObject *)v11) )
break;
v9 = v47 + 1;
if ( v47 + 1 == v45 )
goto LABEL_22;
}
if ( *(_DWORD *)(v11 + 1028) == 747 )
EditorUI::deselectTargetPortals(v2);
m_uIndexInArray = v11;
sub_10071FCD0(v2->m_deleteObjects, v11);
LOBYTE(v9) = *(_DWORD *)(v11 + 872) > 0;
if ( v2->m_stickyControlsEnabled )
goto LABEL_48;
goto LABEL_23;
}
}
if ( !v2->m_stickyControlsEnabled )
{
LABEL_23:
v22 = 0;
goto LABEL_24;
}
LABEL_48:
v22 = 0;
if ( v2->m_linkControlsDisabled || (((unsigned __int8)v9 ^ 1) & 1) != 0 )
{
LABEL_24:
m_deleteObjects = v2->m_deleteObjects;
if ( m_deleteObjects )
goto LABEL_25;
LABEL_68:
m_deleteObjects = nullptr;
if ( !v22 )
goto LABEL_32;
goto LABEL_31;
}
v31 = cocos2d::CCDictionary::create();
v32 = v2->m_deleteObjects;
if ( v32 )
{
data = v32->data;
if ( data->num )
{
arr = data->arr;
v35 = (unsigned __int64)&arr[data->num - 1];
do
{
v36 = *arr;
if ( !*arr )
break;
m_uIndexInArray = v36[15].m_uIndexInArray;
if ( m_uIndexInArray > 0 && !cocos2d::CCDictionary::objectForKey(v31, m_uIndexInArray) )
{
m_uIndexInArray = (__int64)v36;
cocos2d::CCDictionary::setObject(v31, v36, v36[15].m_uIndexInArray);
}
++arr;
}
while ( (unsigned __int64)arr <= v35 );
}
}
v37 = cocos2d::CCDictionary::allKeys(v31);
v22 = 1;
if ( (unsigned int)sub_100720070(v37) )
{
v38 = 0;
v2 = v46;
do
{
m_uIndexInArray = *(unsigned int *)(sub_1007200C0(v37, v38) + 56);
StickyGroup = GJBaseGameLayer::getStickyGroup(v2->m_editorLayer, m_uIndexInArray);
if ( StickyGroup )
{
v41 = StickyGroup;
if ( (unsigned int)sub_100720070(StickyGroup) )
{
v42 = 0;
do
{
v43 = sub_1007200C0(v41, v42);
m_uIndexInArray = v43;
if ( !(unsigned __int8)sub_100720160(v46->m_deleteObjects, v43) )
{
m_uIndexInArray = v43;
sub_10071FCD0(v46->m_deleteObjects, v43);
}
++v42;
}
while ( v42 < (unsigned int)sub_100720070(v41) );
}
}
++v38;
v39 = sub_100720070(v37);
v2 = v46;
}
while ( v38 < v39 );
v22 = 1;
m_deleteObjects = v46->m_deleteObjects;
if ( !m_deleteObjects )
goto LABEL_68;
}
else
{
v2 = v46;
m_deleteObjects = v46->m_deleteObjects;
if ( !m_deleteObjects )
goto LABEL_68;
}
LABEL_25:
v24 = m_deleteObjects->data;
if ( v24->num )
{
v25 = (__int64 *)v24->arr;
v26 = (unsigned __int64)&v25[v24->num - 1];
do
{
m_uIndexInArray = *v25;
if ( !*v25 )
break;
EditorUI::deleteObject(v2, (GameObject *)m_uIndexInArray, v22);
++v25;
}
while ( (unsigned __int64)v25 <= v26 );
m_deleteObjects = v2->m_deleteObjects;
}
if ( v22 )
{
LABEL_31:
m_uIndexInArray = (__int64)UndoObject::createWithArray(m_deleteObjects, DeleteMulti);
LevelEditorLayer::addToUndoList(v2->m_editorLayer, (UndoObject *)m_uIndexInArray, 0);
m_deleteObjects = v2->m_deleteObjects;
}
LABEL_32:
sub_100720270(m_deleteObjects, m_uIndexInArray);
EditorUI::updateObjectInfoLabel(v2);
((void (__fastcall *)(EditorUI *))v2->updateScaleControl)(v2);
}