//
// EditorUI::onDelete from 0x10000c910 to 0x10000ce2a (1306 bytes)
//
// 1 xrefs:
// > EditorUI::clickOnPosition @ 0x10000c743
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:18:50 +0000
//
__int64 __fastcall EditorUI::onDelete(__int64 a1)
{
__int64 v2; // r14
__int64 v3; // r15
__int64 v4; // rax
unsigned int v5; // r12d
unsigned int v6; // r12d
_DWORD *v7; // r13
__int64 v8; // rax
_DWORD *v9; // r14
__int64 v10; // r14
int v11; // r13d
__int64 v12; // r12
__int64 v13; // rax
__int64 v14; // rax
unsigned int *v15; // rax
__int64 *v16; // r12
unsigned __int64 v17; // r13
__int64 v18; // r15
__int64 v19; // r12
unsigned int v20; // r15d
__int64 v21; // rax
__int64 StickyGroup; // rax
__int64 v23; // r12
unsigned int v24; // r13d
__int64 v25; // rdi
__int64 v26; // rax
__int64 v27; // rdi
unsigned int *v28; // rax
__int64 *v29; // r12
unsigned __int64 v30; // r13
__int64 v31; // r15
__int64 v32; // rsi
_BYTE v34[8]; // [rsp+0h] [rbp-40h] BYREF
__int64 v35; // [rsp+8h] [rbp-38h]
int v36; // [rsp+14h] [rbp-2Ch]
v2 = *(_QWORD *)(a1 + 1440);
sub_1002782D0(v34, a1 + 1488);
v3 = LevelEditorLayer::objectsAtPosition(v2, v34);
if ( *(_BYTE *)(a1 + 860) == 1
&& (v4 = cocos2d::CCDirector::sharedDirector(v2, v34),
!*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 192LL))(v4) + 128)) )
{
v5 = 0;
if ( (unsigned int)sub_1007FEF90(v3) )
{
v36 = 0;
v11 = 0;
do
{
LODWORD(v35) = v5;
v12 = sub_1007FEFE0(v3, v5);
if ( (unsigned __int8)EditorUI::shouldDeleteObject(v3) )
{
LOBYTE(v2) = 1;
if ( (v11 & 1) == 0 )
{
if ( *(_DWORD *)(v12 + 1028) == 747 )
sub_1005B94E0(a1);
else
LODWORD(v2) = 0;
}
v13 = sub_1007FEBF0(*(_QWORD *)(a1 + 1368), v12);
if ( (v36 & 1) == 0 )
{
LOBYTE(v13) = *(_DWORD *)(v12 + 872) > 0;
v36 = v13;
}
}
else
{
LODWORD(v2) = v11;
}
v5 = v35 + 1;
v11 = v2;
}
while ( v5 < (unsigned int)sub_1007FEF90(v3) );
LOBYTE(v5) = v36;
if ( *(_BYTE *)(a1 + 867) == 1 )
goto LABEL_32;
LABEL_16:
LODWORD(v10) = 0;
goto LABEL_52;
}
}
else
{
v5 = 0;
v36 = sub_1007FEF90(v3);
if ( v36 > 0 )
{
while ( 1 )
{
LODWORD(v35) = v5;
v6 = 0;
if ( !(unsigned int)sub_1007FEF90(v3) )
{
LABEL_15:
LOBYTE(v5) = 0;
if ( *(_BYTE *)(a1 + 867) == 1 )
goto LABEL_32;
goto LABEL_16;
}
v7 = nullptr;
do
{
v8 = sub_1007FEFE0(v3, v6);
v9 = (_DWORD *)v8;
if ( (!v7 || *(_DWORD *)(v8 + 1136) < v7[284]) && (unsigned __int8)EditorUI::canSelectObject(a1, v8) )
v7 = v9;
++v6;
}
while ( v6 < (unsigned int)sub_1007FEF90(v3) );
if ( !v7 )
{
LOBYTE(v5) = 0;
goto LABEL_31;
}
v7[284] = *(_DWORD *)(a1 + 1540);
if ( (unsigned __int8)EditorUI::shouldDeleteObject(v3) )
break;
v5 = v35 + 1;
if ( (_DWORD)v35 + 1 == v36 )
goto LABEL_15;
}
if ( v7[257] == 747 )
sub_1005B94E0(a1);
sub_1007FEBF0(*(_QWORD *)(a1 + 1368), v7);
LOBYTE(v5) = v7[218] > 0;
if ( *(_BYTE *)(a1 + 867) == 1 )
goto LABEL_32;
goto LABEL_16;
}
}
LABEL_31:
if ( *(_BYTE *)(a1 + 867) != 1 )
goto LABEL_16;
LABEL_32:
LODWORD(v10) = 0;
if ( !*(_BYTE *)(a1 + 868) && (((unsigned __int8)v5 ^ 1) & 1) == 0 )
{
v10 = cocos2d::CCDictionary::create();
v14 = *(_QWORD *)(a1 + 1368);
if ( v14 )
{
v15 = *(unsigned int **)(v14 + 56);
if ( *v15 )
{
v16 = *((__int64 **)v15 + 2);
v17 = (unsigned __int64)&v16[*v15 - 1];
do
{
v18 = *v16;
if ( !*v16 )
break;
if ( *(int *)(v18 + 872) > 0LL && !cocos2d::CCDictionary::objectForKey_1(v10) )
cocos2d::CCDictionary::setObject_1(v10, v18, *(int *)(v18 + 872));
++v16;
}
while ( (unsigned __int64)v16 <= v17 );
}
}
v19 = cocos2d::CCDictionary::allKeys(v10);
LOBYTE(v10) = 1;
if ( (unsigned int)sub_1007FEF90(v19) )
{
v20 = 0;
v35 = v19;
do
{
v21 = sub_1007FEFE0(v19, v20);
StickyGroup = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(a1 + 1440), *(unsigned int *)(v21 + 56));
if ( StickyGroup )
{
v23 = StickyGroup;
if ( (unsigned int)sub_1007FEF90(StickyGroup) )
{
v24 = 0;
do
{
v10 = sub_1007FEFE0(v23, v24);
if ( !(unsigned __int8)sub_1007FF080(*(_QWORD *)(a1 + 1368), v10) )
sub_1007FEBF0(*(_QWORD *)(a1 + 1368), v10);
++v24;
}
while ( v24 < (unsigned int)sub_1007FEF90(v23) );
}
}
++v20;
v19 = v35;
}
while ( v20 < (unsigned int)sub_1007FEF90(v35) );
LOBYTE(v10) = 1;
}
}
LABEL_52:
v25 = *(_QWORD *)(a1 + 1368);
if ( (unsigned int)sub_1007FEF90(v25) )
{
v26 = EditorSFXManager::sharedState(v25);
EditorSFXManager::playAction_1(v26, 101);
if ( !*(_BYTE *)(a1 + 708) )
EditorBuildStats::noteAction(*(_QWORD *)(a1 + 1440) + 14704LL);
*(_BYTE *)(a1 + 708) = 1;
}
v27 = *(_QWORD *)(a1 + 1368);
if ( !v27 )
{
v27 = 0;
if ( !(_BYTE)v10 )
goto LABEL_64;
goto LABEL_63;
}
v28 = *(unsigned int **)(v27 + 56);
if ( *v28 )
{
v29 = *((__int64 **)v28 + 2);
v30 = (unsigned __int64)&v29[*v28 - 1];
LODWORD(v35) = v10;
do
{
v31 = *v29;
if ( !*v29 )
break;
*(_BYTE *)(v31 + 1132) = *(_BYTE *)(v31 + 1133);
EditorUI::deselectObject(a1, v31);
LevelEditorLayer::removeObject(*(_QWORD *)(a1 + 1440), v31, (unsigned __int8)v10);
EditorUI::deactivateRotationControl(a1);
EditorUI::deactivateScaleControl(a1);
sub_100611790(a1);
++v29;
}
while ( (unsigned __int64)v29 <= v30 );
v27 = *(_QWORD *)(a1 + 1368);
LOBYTE(v10) = v35;
}
if ( (_BYTE)v10 )
{
LABEL_63:
*(_DWORD *)(*(_QWORD *)(a1 + 1440) + 14712LL) += sub_1007FEF90(v27);
v32 = UndoObject::createWithArray(*(_QWORD *)(a1 + 1368), 4);
LevelEditorLayer::addToUndoList(*(_QWORD *)(a1 + 1440), v32, 0);
v27 = *(_QWORD *)(a1 + 1368);
}
LABEL_64:
sub_1007FF190(v27);
if ( !*(_QWORD *)(a1 + 1496) && !(unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
{
EditorUI::deactivateRotationControl(a1);
EditorUI::deactivateScaleControl(a1);
sub_100611790(a1);
}
EditorUI::updateObjectInfoLabel(a1);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 1352LL))(a1);
}