//
// LevelEditorLayer::removeAllObjectsOfType from 0x1403f22f0 to 0x1403f257a (650 bytes)
//
// 3 xrefs:
// > EditorUI::onDeleteSelectedType @ 0x1401b0ea2
// > EditorUI::onDeleteStartPos @ 0x1401b0f5a
// > ??> @ 0x140925424
//
// 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 11:31:48 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall LevelEditorLayer::removeAllObjectsOfType(__int64 a1, int a2)
{
cocos2d::CCArray *v4; // rbp
__int64 v5; // r8
__int64 v6; // rdx
unsigned int v7; // r12d
int v8; // r9d
__int64 v9; // rdx
_QWORD *v10; // rcx
__int64 v11; // rax
__int64 v12; // rsi
_QWORD *v13; // r14
__int64 v14; // rbx
__int64 v15; // rdi
struct cocos2d::CCObject *v16; // rdx
cocos2d::CCObject **v17; // rdi
__int64 v18; // rcx
cocos2d::CCArray *v19; // rax
unsigned int v20; // ebx
struct cocos2d::CCObject *v21; // rax
__int64 v22; // rdx
__int64 v23; // rbx
int v24; // [rsp+68h] [rbp+10h]
__int64 v25; // [rsp+70h] [rbp+18h]
__int64 v26; // [rsp+78h] [rbp+20h]
if ( a2 != 749 )
{
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v5 = *(_QWORD *)(a1 + 13976);
v6 = *(_QWORD *)(a1 + 13984);
v7 = 0;
if ( v5 != v6 )
{
v8 = 0;
v24 = 0;
if ( (v6 - v5) >> 3 )
{
v9 = 0;
v25 = 0;
do
{
v10 = *(_QWORD **)(v9 + v5);
if ( v10 )
v11 = (__int64)(v10[1] - *v10) >> 3;
else
LODWORD(v11) = -1;
v12 = 0;
v26 = (int)v11;
if ( (int)v11 > 0 )
{
do
{
v13 = *(_QWORD **)(**(_QWORD **)(v9 + *(_QWORD *)(a1 + 13976)) + 8 * v12);
if ( v13 )
{
v14 = 0;
v15 = *(int *)(**(_QWORD **)(v9 + *(_QWORD *)(a1 + 14144)) + 4 * v12);
if ( v15 > 0 )
{
do
{
v16 = *(struct cocos2d::CCObject **)(*v13 + 8 * v14);
if ( *((_DWORD *)v16 + 259) == a2 )
cocos2d::CCArray::addObject(v4, v16);
++v14;
}
while ( v14 < v15 );
v9 = v25;
}
}
++v12;
}
while ( v12 < v26 );
v8 = v24;
}
v24 = ++v8;
v9 += 8;
v25 = v9;
v5 = *(_QWORD *)(a1 + 13976);
}
while ( v8 < (unsigned __int64)((*(_QWORD *)(a1 + 13984) - v5) >> 3) );
}
}
v17 = (cocos2d::CCObject **)operator new(0xA0u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v17);
*v17 = (cocos2d::CCObject *)&UndoObject::`vftable';
v17[7] = nullptr;
*((_DWORD *)v17 + 16) = 0;
v17[9] = nullptr;
*((_WORD *)v17 + 40) = 0;
GJTransformState::GJTransformState((__int64)v17 + 84);
if ( v4 )
{
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
v17[9] = v19;
cocos2d::CCArray::addObjectsFromArray(v19, v4);
cocos2d::CCObject::retain(v17[9]);
}
*((_DWORD *)v17 + 16) = 4;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v17);
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 14920));
v20 = 1000;
if ( !*(_BYTE *)(a1 + 14663) )
v20 = 200;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14912)) >= v20 )
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(a1 + 14912), 0, 1);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14912), (struct cocos2d::CCObject *)v17);
if ( cocos2d::CCArray::count(v4) )
{
do
{
v21 = cocos2d::CCArray::objectAtIndex(v4, v7);
v23 = (__int64)v21;
if ( v21 )
{
LOBYTE(v22) = 1;
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v21 + 1160LL))(v21, v22);
GJBaseGameLayer::removeObjectFromSection(a1, v23);
LevelEditorLayer::removeSpecial(a1, v23);
*(_BYTE *)(a1 + 15666) = 1;
}
++v7;
}
while ( v7 < cocos2d::CCArray::count(v4) );
}
}
}