//
// LevelEditorLayer::addObjectsInRect from 0x1000b16c0 to 0x1000b191a (602 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::addObjectsInRect(__int64 a1, __int64 a2, char a3, __int64 a4, __int64 a5)
{
__int64 result; // rax
unsigned int v9; // ebx
float *v10; // r15
char v11; // al
unsigned int v12; // r13d
__int64 v13; // rsi
__int64 v14; // rdi
__int64 v15; // rbx
unsigned __int64 v16; // rcx
int v17; // eax
__int16 v18; // dx
bool v19; // si
bool v20; // di
bool v21; // r8
unsigned __int16 v22; // dx
__int64 v23; // rcx
char v24; // al
_BYTE v25[16]; // [rsp+8h] [rbp-48h] BYREF
__int64 v26; // [rsp+18h] [rbp-38h]
__int64 v27; // [rsp+20h] [rbp-30h]
v27 = a5;
v26 = a2;
result = sub_1007FEF90(a4);
if ( (_DWORD)result )
{
if ( a3 )
{
v9 = 0;
while ( 1 )
{
v10 = (float *)sub_1007FEFE0(a4, v9);
LevelEditorLayer::getObjectRect((__int64)v25, a1, v10, 0, 0);
v11 = *(_BYTE *)(a1 + 14245);
if ( v11 )
goto LABEL_9;
if ( !(unsigned __int8)sub_100278990(v26, v25) )
break;
LABEL_4:
sub_1007FEBF0(v27, v10);
LABEL_5:
++v9;
result = sub_1007FEF90(a4);
if ( v9 >= (unsigned int)result )
return result;
}
v11 = *(_BYTE *)(a1 + 14245);
LABEL_9:
if ( (v11 & 1) == 0 || !(unsigned __int8)OBB2D::overlaps(*(_QWORD *)(a1 + 14216), *(_QWORD *)(a1 + 2080)) )
goto LABEL_5;
goto LABEL_4;
}
v12 = 0;
while ( 1 )
{
v15 = sub_1007FEFE0(a4, v12);
v16 = *(unsigned __int16 *)(v15 + 1202);
v17 = (unsigned __int16)*(_DWORD *)(v15 + 1204) == 0 ? -1 : *(_DWORD *)(v15 + 1204);
v18 = *(_WORD *)(a1 + 14210);
v19 = v18 == -1;
v20 = v18 == (__int16)v16;
v21 = v18 == (__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;
v13 = *(_QWORD *)(a1 + 14528);
v14 = *(_QWORD *)(v13 + (((unsigned int)v16 >> 3) & 0x7F8));
if ( _bittest64(&v14, v16) )
goto LABEL_14;
if ( (v17 & 0x8000u) == 0 )
{
v23 = *(_QWORD *)(v13 + 8 * ((unsigned __int64)v22 >> 6));
if ( _bittest64(&v23, v22) )
goto LABEL_14;
}
LevelEditorLayer::getObjectRect((__int64)v25, a1, (float *)v15, 0, 0);
v24 = *(_BYTE *)(a1 + 14245);
if ( v24 )
goto LABEL_30;
if ( !(unsigned __int8)sub_100278990(v26, v25) )
{
v24 = *(_BYTE *)(a1 + 14245);
LABEL_30:
if ( (v24 & 1) == 0 || !(unsigned __int8)OBB2D::overlaps(*(_QWORD *)(a1 + 14216), *(_QWORD *)(a1 + 2080)) )
goto LABEL_14;
}
sub_1007FEBF0(v27, v15);
}
LABEL_14:
++v12;
result = sub_1007FEF90(a4);
if ( v12 >= (unsigned int)result )
return result;
}
v22 = 9999;
LABEL_17:
if ( v21 || v20 || v19 )
goto LABEL_21;
goto LABEL_14;
}
return result;
}