//
// LevelEditorLayer::addObjectsInRect from 0x1000e1ec0 to 0x1000e211a (602 bytes)
//
// 0 xrefs:
//
// 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::addObjectsInRect(
LevelEditorLayer *a1,
cocos2d::CCRect a2,
bool a3,
cocos2d::CCArray *a4,
cocos2d::CCArray *a5)
{
__int64 v5; // r8
char v7; // bl
unsigned int v9; // ebx
__int64 v10; // r15
bool m_nonSquareRotation; // al
unsigned int v12; // r13d
std::__vector_base::pointer begin; // rsi
__int64 v14; // rdi
__int64 v15; // rbx
unsigned __int64 v16; // rcx
int v17; // eax
__int16 m_currentLayer; // dx
bool v19; // si
bool v20; // di
bool v21; // r8
unsigned __int16 v22; // dx
__int64 v23; // rcx
bool v24; // al
double v25; // xmm0_8
double v26; // xmm0_8
_BYTE v27[16]; // [rsp+8h] [rbp-48h] BYREF
_BOOL8 v28; // [rsp+18h] [rbp-38h]
__int64 v29; // [rsp+20h] [rbp-30h]
v29 = v5;
v7 = (char)a4;
v28 = a3;
if ( (unsigned int)sub_100720070(a5) )
{
if ( v7 )
{
v9 = 0;
while ( 1 )
{
v10 = sub_1007200C0(a5, v9);
*(_QWORD *)&v25 = (unsigned __int64)LevelEditorLayer::getObjectRect(
(LevelEditorLayer *)v27,
(GameObject *)a1,
v10,
0).origin;
m_nonSquareRotation = a1->m_nonSquareRotation;
if ( m_nonSquareRotation )
goto LABEL_9;
if ( !(unsigned __int8)sub_10028D320(v28, v27, v25) )
break;
LABEL_4:
sub_10071FCD0(v29, v10);
LABEL_5:
if ( ++v9 >= (unsigned int)sub_100720070(a5) )
return;
}
m_nonSquareRotation = a1->m_nonSquareRotation;
LABEL_9:
if ( !m_nonSquareRotation || !OBB2D::overlaps(a1->m_currentOBB2D) )
goto LABEL_5;
goto LABEL_4;
}
v12 = 0;
while ( 1 )
{
v15 = sub_1007200C0(a5, v12);
v16 = *(unsigned __int16 *)(v15 + 1202);
v17 = (unsigned __int16)*(_DWORD *)(v15 + 1204) == 0 ? -1 : *(_DWORD *)(v15 + 1204);
m_currentLayer = a1->m_currentLayer;
v19 = m_currentLayer == -1;
v20 = m_currentLayer == (__int16)v16;
v21 = m_currentLayer == (__int16)v17;
v22 = (unsigned __int16)*(_DWORD *)(v15 + 1204) == 0 ? -1 : *(_WORD *)(v15 + 1204);
if ( (__int16)v17 >= 9999 )
break;
if ( (v22 & 0x8000u) == 0 )
goto LABEL_17;
v22 = -1;
if ( v21 || v20 || v19 )
{
LABEL_21:
if ( (__int16)v16 >= 9999 )
v16 = 9999;
if ( (__int16)v16 <= 0 )
v16 = 0;
begin = a1->m_lockedLayers.__begin_;
v14 = *(_QWORD *)&begin[((unsigned int)v16 >> 3) & 0x7F8];
if ( _bittest64(&v14, v16) )
goto LABEL_14;
if ( (v17 & 0x8000u) == 0 )
{
v23 = *(_QWORD *)&begin[8 * ((unsigned __int64)v22 >> 6)];
if ( _bittest64(&v23, v22) )
goto LABEL_14;
}
*(_QWORD *)&v26 = (unsigned __int64)LevelEditorLayer::getObjectRect(
(LevelEditorLayer *)v27,
(GameObject *)a1,
v15,
0).origin;
v24 = a1->m_nonSquareRotation;
if ( v24 )
goto LABEL_30;
if ( !(unsigned __int8)sub_10028D320(v28, v27, v26) )
{
v24 = a1->m_nonSquareRotation;
LABEL_30:
if ( !v24 || !OBB2D::overlaps(a1->m_currentOBB2D) )
goto LABEL_14;
}
sub_10071FCD0(v29, v15);
}
LABEL_14:
if ( ++v12 >= (unsigned int)sub_100720070(a5) )
return;
}
v22 = 9999;
LABEL_17:
if ( v21 || v20 || v19 )
goto LABEL_21;
goto LABEL_14;
}
}