//
// LevelEditorLayer::addObjectsAtPosition from 0x1000b14c0 to 0x1000b167a (442 bytes)
//
// 0 xrefs:
//
// 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:20:20 +0000
//
__int64 __fastcall LevelEditorLayer::addObjectsAtPosition(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 result; // rax
unsigned int v7; // r13d
__int64 v8; // rsi
__int64 v9; // rdi
__int64 v10; // r15
unsigned __int64 v11; // rcx
int v12; // eax
__int16 v13; // dx
bool v14; // si
bool v15; // di
bool v16; // r8
unsigned __int16 v17; // dx
__int64 v18; // rcx
char v19; // al
_BYTE v20[16]; // [rsp+8h] [rbp-48h] BYREF
__int64 v21; // [rsp+18h] [rbp-38h]
__int64 v22; // [rsp+20h] [rbp-30h]
v22 = a4;
v21 = a2;
result = sub_1007FEF90(a3);
if ( (_DWORD)result )
{
v7 = 0;
while ( 1 )
{
v10 = sub_1007FEFE0(a3, v7);
v11 = *(unsigned __int16 *)(v10 + 1202);
v12 = (unsigned __int16)*(_DWORD *)(v10 + 1204) == 0 ? -1 : *(_DWORD *)(v10 + 1204);
v13 = *(_WORD *)(a1 + 14210);
v14 = v13 == -1;
v15 = v13 == (__int16)v11;
v16 = v13 == (__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;
v8 = *(_QWORD *)(a1 + 14528);
v9 = *(_QWORD *)(v8 + (((unsigned int)v11 >> 3) & 0x7F8));
if ( _bittest64(&v9, v11) )
goto LABEL_4;
if ( (v12 & 0x8000u) == 0 )
{
v18 = *(_QWORD *)(v8 + 8 * ((unsigned __int64)v17 >> 6));
if ( _bittest64(&v18, v17) )
goto LABEL_4;
}
LevelEditorLayer::getObjectRect((__int64)v20, a1, (float *)v10, 0, 0);
v19 = *(_BYTE *)(a1 + 14245);
if ( v19 )
goto LABEL_20;
if ( !(unsigned __int8)sub_100278940(v20, v21) )
{
v19 = *(_BYTE *)(a1 + 14245);
LABEL_20:
if ( (v19 & 1) == 0 || !(unsigned __int8)OBB2D::overlaps(*(_QWORD *)(a1 + 14216), *(_QWORD *)(a1 + 2080)) )
goto LABEL_4;
}
sub_1007FEBF0(v22, v10);
}
LABEL_4:
++v7;
result = sub_1007FEF90(a3);
if ( v7 >= (unsigned int)result )
return result;
}
v17 = 9999;
LABEL_7:
if ( v16 || v15 || v14 )
goto LABEL_11;
goto LABEL_4;
}
return result;
}