//
// LevelEditorLayer::removeAllObjectsOfType from 0x1000e27e0 to 0x1000e29e3 (515 bytes)
//
// 2 xrefs:
// > EditorUI::onDeleteStartPos @ 0x100031d10
// > EditorUI::onDeleteSelectedType @ 0x100031d4a
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall LevelEditorLayer::removeAllObjectsOfType(LevelEditorLayer *a1, int a2)
{
LevelEditorLayer *v3; // r14
cocos2d::CCArray *v4; // r13
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // rcx
unsigned __int64 v7; // rsi
std::vector *, std::allocator *>> *v8; // rdx
unsigned __int64 v9; // rdi
__int64 v10; // rbx
std::vector *v11; // r13
__int64 v12; // r12
__int64 i; // r14
GameObject *v14; // rsi
UndoObject *v15; // r15
unsigned int v16; // ebx
unsigned int v17; // r15d
__int64 v18; // rax
GameObject *v19; // r12
cocos2d::CCArray *v20; // [rsp-48h] [rbp-48h]
unsigned __int64 v21; // [rsp-40h] [rbp-40h]
if ( a2 != 749 )
{
v3 = a1;
v4 = (cocos2d::CCArray *)sub_10071F9E0(a1, *(_QWORD *)&a2);
begin = a1->m_sections.__begin_;
end = a1->m_sections.__end_;
if ( begin != end )
{
v7 = 0;
v20 = v4;
do
{
v8 = begin[v7];
if ( v8 )
{
v9 = (unsigned __int64)((char *)v8->__end_ - (char *)v8->__begin_) >> 3;
if ( (int)v9 > 0 )
{
v10 = 0;
v21 = v7;
do
{
v11 = v3->m_sections.__begin_[v7]->__begin_[v10];
if ( v11 )
{
v12 = a1->m_sectionSizes.__begin_[v21]->__begin_[v10];
if ( v12 > 0 )
{
for ( i = 0; i != v12; ++i )
{
v14 = v11->__begin_[i];
if ( v14->m_objectID == a2 )
sub_10071FCD0(v20, v14);
}
}
}
++v10;
v3 = a1;
v7 = v21;
}
while ( v10 != (v9 & 0x7FFFFFFF) );
begin = a1->m_sections.__begin_;
end = a1->m_sections.__end_;
v4 = v20;
}
}
++v7;
}
while ( end - begin > v7 );
}
v15 = UndoObject::createWithArray(v4, DeleteMulti);
sub_100720270(v3->m_redoObjects);
v16 = 200;
if ( v3->m_increaseMaxUndoRedo )
v16 = 1000;
if ( (unsigned int)sub_100720070(v3->m_undoObjects) >= v16 )
sub_100720230(v3->m_undoObjects, 0, 1);
sub_10071FCD0(v3->m_undoObjects, v15);
if ( (unsigned int)sub_100720070(v4) )
{
v17 = 0;
do
{
v18 = sub_1007200C0(v4, v17);
if ( v18 )
{
v19 = (GameObject *)v18;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v18 + 1296LL))(v18, 1);
GJBaseGameLayer::removeObjectFromSection(v3, v19);
LevelEditorLayer::removeSpecial(v3, v19);
v3->m_unk3b22 = 1;
}
++v17;
}
while ( v17 < (unsigned int)sub_100720070(v4) );
}
}
}