//
// LevelEditorLayer::addObjectsAtPosition from 0x1000e1cc0 to 0x1000e1e7a (442 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
//
void __fastcall LevelEditorLayer::addObjectsAtPosition(
LevelEditorLayer *a1,
cocos2d::CCPoint a2,
cocos2d::CCArray *a3,
cocos2d::CCArray *a4)
{
__int64 v4; // rcx
unsigned int v7; // r13d
std::__vector_base::pointer begin; // rsi
__int64 v9; // rdi
__int64 v10; // r15
unsigned __int64 v11; // rcx
int v12; // eax
__int16 m_currentLayer; // dx
bool v14; // si
bool v15; // di
bool v16; // r8
unsigned __int16 v17; // dx
__int64 v18; // rcx
bool m_nonSquareRotation; // al
_BYTE v20[16]; // [rsp+8h] [rbp-48h] BYREF
cocos2d::CCArray *v21; // [rsp+18h] [rbp-38h]
__int64 v22; // [rsp+20h] [rbp-30h]
cocos2d::CCRect ObjectRect; // 0:kr00_16.16
v22 = v4;
v21 = a3;
if ( (unsigned int)sub_100720070(a4) )
{
v7 = 0;
while ( 1 )
{
v10 = sub_1007200C0(a4, v7);
v11 = *(unsigned __int16 *)(v10 + 1202);
v12 = (unsigned __int16)*(_DWORD *)(v10 + 1204) == 0 ? -1 : *(_DWORD *)(v10 + 1204);
m_currentLayer = a1->m_currentLayer;
v14 = m_currentLayer == -1;
v15 = m_currentLayer == (__int16)v11;
v16 = m_currentLayer == (__int16)v12;
v17 = (unsigned __int16)*(_DWORD *)(v10 + 1204) == 0 ? -1 : *(_WORD *)(v10 + 1204);
if ( (__int16)v12 >= 9999 )
break;
if ( (v17 & 0x8000u) == 0 )
goto LABEL_7;
v17 = -1;
if ( v16 || v15 || v14 )
{
LABEL_11:
if ( (__int16)v11 >= 9999 )
v11 = 9999;
if ( (__int16)v11 <= 0 )
v11 = 0;
begin = a1->m_lockedLayers.__begin_;
v9 = *(_QWORD *)&begin[((unsigned int)v11 >> 3) & 0x7F8];
if ( _bittest64(&v9, v11) )
goto LABEL_4;
if ( (v12 & 0x8000u) == 0 )
{
v18 = *(_QWORD *)&begin[8 * ((unsigned __int64)v17 >> 6)];
if ( _bittest64(&v18, v17) )
goto LABEL_4;
}
ObjectRect = LevelEditorLayer::getObjectRect((LevelEditorLayer *)v20, (GameObject *)a1, v10, 0);
m_nonSquareRotation = a1->m_nonSquareRotation;
if ( m_nonSquareRotation )
goto LABEL_20;
if ( !(unsigned __int8)sub_10028D2D0(v20, v21, COERCE_DOUBLE(ObjectRect.origin), COERCE_DOUBLE(ObjectRect.size)) )
{
m_nonSquareRotation = a1->m_nonSquareRotation;
LABEL_20:
if ( !m_nonSquareRotation || !OBB2D::overlaps(a1->m_currentOBB2D) )
goto LABEL_4;
}
sub_10071FCD0(v22, v10);
}
LABEL_4:
if ( ++v7 >= (unsigned int)sub_100720070(a4) )
return;
}
v17 = 9999;
LABEL_7:
if ( v16 || v15 || v14 )
goto LABEL_11;
goto LABEL_4;
}
}