//
// LevelEditorLayer::objectsInRect from 0x78af48 to 0x78b44c (1284 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::rotationForSlopeNearObject @ 0x78b4c8
// > EditorUI::createSmartObjectsFromTemplate @ 0x7cb784
// > EditorUI::addObjectsToSmartTemplate @ 0x7cc0e8
// > EditorUI::selectObjectsInRect @ 0xbdd1d8
// > ??> @ 0x96dd8
//
// This function is hookable on this platform (idp: arm, 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:53:26 +0000
//
cocos2d::CCArray *__fastcall LevelEditorLayer::objectsInRect(__int64 a1, float *a2, unsigned __int8 a3)
{
int v3; // w23
cocos2d::CCArray *updated; // x0
float v7; // s2
float v8; // s0
_BOOL4 v9; // w0
float v10; // s2
__int64 v11; // x20
__int64 v12; // x26
float v13; // s1
float v14; // s0
float v15; // s0
float v17; // s0
float v18; // s1
_BOOL4 v19; // w0
_BYTE *v20; // x25
_QWORD *v21; // x20
__int64 v22; // x0
unsigned __int64 v23; // x1
int v24; // w0
int v25; // w26
__int64 v26; // x27
_QWORD *v27; // x22
int v28; // w21
__int64 v29; // x28
__int64 v30; // x21
GameObject *v31; // x20
int v32; // [xsp+7Ch] [xbp+7Ch]
int v33; // [xsp+80h] [xbp+80h]
int v34; // [xsp+84h] [xbp+84h]
int v36; // [xsp+90h] [xbp+90h]
int i; // [xsp+94h] [xbp+94h]
cocos2d::CCArray *v38; // [xsp+98h] [xbp+98h]
__int64 v39; // [xsp+A0h] [xbp+A0h]
__int64 v40; // [xsp+A8h] [xbp+A8h]
_BYTE v41[16]; // [xsp+B8h] [xbp+B8h] BYREF
v3 = a3;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v41, (const cocos2d::CCRect *)a2);
updated = (cocos2d::CCArray *)GJBaseGameLayer::updateOBB2(a1, v41);
v38 = (cocos2d::CCArray *)cocos2d::CCArray::create(updated);
v7 = *a2;
if ( *a2 > 0.0
&& ((v8 = *(float *)(a1 + 13632), v7 < 10000000.0)
? (v9 = (float)((float)(v7 * v8) + -1.0) > 0.0)
: (v9 = (float)((float)(v8 * 10000000.0) + -1.0) > 0.0),
v9) )
{
if ( v7 <= 0.0 )
{
v36 = -1;
}
else
{
if ( v7 >= 10000000.0 )
{
v36 = (int)(float)((float)(v8 * 10000000.0) + -1.0);
v10 = v7 + a2[2];
if ( v10 <= 0.0 )
goto LABEL_8;
goto LABEL_15;
}
v36 = (int)(float)((float)(v7 * v8) + -1.0);
}
}
else
{
v36 = 0;
}
v10 = v7 + a2[2];
if ( v10 <= 0.0 )
{
LABEL_8:
v11 = *(_QWORD *)(a1 + 13368);
v12 = *(_QWORD *)(a1 + 13376);
v13 = (float)(unsigned __int64)(((v12 - v11) >> 3) - 1);
if ( v13 >= 1.0 )
goto LABEL_9;
goto LABEL_17;
}
LABEL_15:
v17 = *(float *)(a1 + 13632);
if ( v10 >= 10000000.0 )
{
v11 = *(_QWORD *)(a1 + 13368);
v12 = *(_QWORD *)(a1 + 13376);
v13 = (float)(unsigned __int64)(((v12 - v11) >> 3) - 1);
if ( (float)((float)(v17 * 10000000.0) + 1.0) > v13 )
goto LABEL_17;
}
else
{
v11 = *(_QWORD *)(a1 + 13368);
v12 = *(_QWORD *)(a1 + 13376);
v13 = (float)(unsigned __int64)(((v12 - v11) >> 3) - 1);
if ( (float)((float)(v10 * v17) + 1.0) > v13 )
{
LABEL_17:
v34 = (int)v13;
goto LABEL_18;
}
}
if ( v10 <= 0.0 )
{
LABEL_9:
v34 = 1;
v14 = a2[1];
if ( v14 <= 0.0 )
goto LABEL_10;
goto LABEL_19;
}
if ( v10 < 10000000.0 )
v34 = (int)(float)((float)(v10 * v17) + 1.0);
else
v34 = (int)(float)((float)(v17 * 10000000.0) + 1.0);
LABEL_18:
v14 = a2[1];
if ( v14 <= 0.0 )
goto LABEL_10;
LABEL_19:
v18 = *(float *)(a1 + 13636);
if ( v14 < 10000000.0 )
v19 = (float)((float)(v14 * v18) + -1.0) > 0.0;
else
v19 = (float)((float)(v18 * 10000000.0) + -1.0) > 0.0;
if ( !v19 )
{
LABEL_10:
v33 = 0;
v15 = v14 + a2[3];
if ( v15 <= 0.0 )
goto LABEL_11;
goto LABEL_26;
}
if ( v14 <= 0.0 )
{
v33 = -1;
}
else if ( v14 < 10000000.0 )
{
v33 = (int)(float)((float)(v14 * v18) + -1.0);
}
else
{
v33 = (int)(float)((float)(v18 * 10000000.0) + -1.0);
}
v15 = v14 + a2[3];
if ( v15 <= 0.0 )
{
LABEL_11:
v32 = 1;
if ( v11 == v12 )
return v38;
goto LABEL_29;
}
LABEL_26:
if ( v15 < 10000000.0 )
v32 = (int)(float)((float)(v15 * *(float *)(a1 + 13636)) + 1.0);
else
v32 = (int)(float)((float)(*(float *)(a1 + 13636) * 10000000.0) + 1.0);
if ( v11 != v12 )
{
LABEL_29:
if ( v36 > v34 )
return v38;
v39 = 8LL * v36;
v20 = (_BYTE *)(a1 + 14245);
v21 = *(_QWORD **)(v11 + v39);
if ( !v21 )
goto LABEL_58;
LABEL_31:
v22 = (__int64)(v21[1] - *v21) >> 3;
v23 = v22 - 1;
v24 = v22 - 1;
if ( v32 <= v23 )
v24 = v32;
for ( i = v24; v33 > i; i = -1 )
{
LABEL_56:
v39 += 8;
if ( v34 < ++v36 )
return v38;
v21 = *(_QWORD **)(*(_QWORD *)(a1 + 13368) + v39);
if ( v21 )
goto LABEL_31;
LABEL_58:
;
}
v25 = v33;
v26 = 8LL * v33;
v40 = 4LL * v33;
while ( 1 )
{
v27 = *(_QWORD **)(*v21 + v26);
if ( v27 )
{
v28 = *(_DWORD *)(**(_QWORD **)(*(_QWORD *)(a1 + 13536) + v39) + v40);
if ( v28 > 0 )
break;
}
LABEL_54:
++v25;
v26 += 8;
v40 += 4;
if ( i < v25 )
goto LABEL_56;
v21 = *(_QWORD **)(*(_QWORD *)(a1 + 13368) + v39);
}
v29 = 0;
v30 = 8 * ((unsigned int)(v28 - 1) + 1LL);
while ( 1 )
{
v31 = *(GameObject **)(*v27 + v29);
if ( v3 )
{
LevelEditorLayer::getObjectRect(
(LevelEditorLayer *)a1,
*(GameObject **)(*v27 + v29),
0,
0,
(cocos2d::CCRect *)v41);
if ( *v20 )
goto LABEL_40;
}
else
{
if ( !LevelEditorLayer::validGroup((LevelEditorLayer *)a1, *(GameObject **)(*v27 + v29), 1) )
goto LABEL_42;
LevelEditorLayer::getObjectRect((LevelEditorLayer *)a1, v31, 0, 0, (cocos2d::CCRect *)v41);
if ( *v20 )
goto LABEL_40;
}
if ( (unsigned __int8)cocos2d::CCRect::intersectsRect((cocos2d::CCRect *)a2, (const cocos2d::CCRect *)v41) )
{
LABEL_41:
cocos2d::CCArray::addObject(v38, v31);
goto LABEL_42;
}
if ( !*v20 )
goto LABEL_42;
LABEL_40:
if ( OBB2D::overlaps(*(float **)(a1 + 14216), *(float **)(a1 + 2080)) )
goto LABEL_41;
LABEL_42:
v29 += 8;
if ( v29 == v30 )
goto LABEL_54;
}
}
return v38;
}