//
// LevelEditorLayer::objectsAtPosition from 0x1403f15a0 to 0x1403f195d (957 bytes)
//
// 7 xrefs:
// > EditorUI::onDelete @ 0x1401affd0
// > EditorUI::startFreeMoveTouch @ 0x1401bfc29
// > EditorUI::ccTouchEnded @ 0x1401c14f7
// > EditorUI::ccTouchEnded @ 0x1401c171a
// > ??> @ 0x1408c5a58
// > ??> @ 0x1408c5a68
// > ??> @ 0x14092537c
//
// 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 11:31:48 +0000
//
cocos2d::CCArray *__fastcall LevelEditorLayer::objectsAtPosition(__int64 a1, float *a2)
{
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rax
float v7; // xmm6_4
__int64 v8; // r8
__int64 v9; // r9
__int64 v10; // rcx
__int64 v11; // rax
float v12; // xmm1_4
cocos2d::CCArray *v13; // r12
float v14; // xmm0_4
float v15; // xmm0_4
float v16; // xmm3_4
float v17; // xmm1_4
float v18; // xmm1_4
__int64 v19; // rdx
__int64 v20; // r8
unsigned __int64 v21; // r10
int v22; // esi
int v23; // ecx
int v24; // eax
__int64 v25; // r8
int v26; // eax
__int64 v27; // r9
_QWORD *v28; // rdx
int v29; // ecx
__int64 v30; // r14
_QWORD *v31; // r15
__int64 v32; // rbx
__int64 v33; // rbp
__int16 *v34; // rsi
int v35; // eax
int v36; // edx
int v37; // ecx
char v38; // r9
unsigned __int64 v39; // rdx
int v40; // r8d
__int64 v41; // r9
int v42; // eax
int v43; // eax
__int64 v44; // r8
float *v45; // r9
__int64 v47; // [rsp+30h] [rbp-78h]
_BYTE v48[24]; // [rsp+38h] [rbp-70h] BYREF
int v49; // [rsp+B0h] [rbp+8h] BYREF
__int64 v50; // [rsp+B8h] [rbp+10h] BYREF
__int64 v51; // [rsp+C0h] [rbp+18h]
__int64 v52; // [rsp+C8h] [rbp+20h]
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v48, *a2, a2[1], 1.0, 1.0);
v5 = v4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, *(float *)(v4 + 8) * 0.5, *(float *)(v4 + 12) * 0.5);
cocos2d::CCPoint::operator+(v5, &v49, v6);
v7 = 0.0;
OBB2D::calculateWithCenter(*(_QWORD *)(a1 + 2312), (__int64)&v49, v8, v9, 0.0);
v11 = cocos2d::CCArray::create(v10);
v12 = *a2;
v13 = (cocos2d::CCArray *)v11;
if ( *a2 > 0.0 )
{
v15 = *(float *)(a1 + 14240);
if ( v12 < 10000000.0 )
v14 = v15 * v12;
else
v14 = v15 * 10000000.0;
}
else
{
v14 = 0.0;
}
v16 = a2[1];
if ( v16 > 0.0 )
{
v17 = *(float *)(a1 + 14244);
if ( v16 < 10000000.0 )
v18 = v17 * v16;
else
v18 = v17 * 10000000.0;
v7 = v18;
}
v19 = *(_QWORD *)(a1 + 13984);
v20 = *(_QWORD *)(a1 + 13976);
v21 = ((v19 - v20) >> 3) - 1;
v22 = (int)v7 + 1;
v49 = v22;
v23 = (int)v14 + 1;
if ( v20 != v19 )
{
v24 = 0;
if ( (int)v14 - 1 >= 0 )
v24 = (int)v14 - 1;
v25 = v24;
if ( v23 >= v21 )
v23 = v21;
v50 = v24;
v47 = v23;
if ( v24 <= (__int64)v23 )
{
v26 = 0;
if ( (int)v7 - 1 >= 0 )
v26 = (int)v7 - 1;
v27 = v26;
v52 = v26;
do
{
v28 = *(_QWORD **)(*(_QWORD *)(a1 + 13976) + 8 * v25);
if ( v28 )
{
v29 = v22;
if ( v22 >= (unsigned __int64)(((__int64)(v28[1] - *v28) >> 3) - 1) )
v29 = ((__int64)(v28[1] - *v28) >> 3) - 1;
}
else
{
v29 = -1;
}
v30 = v27;
v51 = v29;
if ( v27 <= v29 )
{
do
{
v31 = *(_QWORD **)(**(_QWORD **)(*(_QWORD *)(a1 + 13976) + 8 * v25) + 8 * v30);
if ( v31 )
{
v32 = 0;
v33 = *(int *)(**(_QWORD **)(*(_QWORD *)(a1 + 14144) + 8 * v25) + 4 * v30);
if ( v33 > 0 )
{
while ( 1 )
{
v34 = *(__int16 **)(*v31 + 8 * v32);
v35 = v34[606];
if ( !v34[606] )
v35 = -1;
if ( *(_WORD *)(a1 + 14866) == 0xFFFF
|| (v36 = *(__int16 *)(a1 + 14866), v37 = v34[605], v36 == v37)
|| v36 == v35 )
{
v38 = 1;
v37 = v34[605];
}
else
{
v38 = 0;
}
v39 = 9999;
v40 = 9999;
if ( v37 < 9999 )
v39 = (unsigned int)v37;
if ( (v39 & 0x80000000) != 0LL )
v39 = 0;
if ( v35 < 9999 )
v40 = v35;
if ( v40 < -1 )
v40 = -1;
if ( !v38 )
goto LABEL_53;
v41 = *(_QWORD *)(a1 + 15208);
v42 = *(_DWORD *)(v41 + 4 * (v39 >> 5));
if ( _bittest(&v42, v39 & 0x1F) )
goto LABEL_53;
if ( v40 != -1 )
{
v43 = *(_DWORD *)(v41 + 4 * ((unsigned __int64)v40 >> 5));
if ( _bittest(&v43, v40 & 0x1F) )
goto LABEL_53;
}
LevelEditorLayer::getObjectRect(a1, v48, *(_QWORD *)(*v31 + 8 * v32));
if ( *(_BYTE *)(a1 + 14901) )
break;
if ( cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v48, (const struct cocos2d::CCPoint *)a2) )
goto LABEL_52;
if ( *(_BYTE *)(a1 + 14901) )
break;
LABEL_53:
if ( ++v32 >= v33 )
{
v25 = v50;
goto LABEL_55;
}
}
if ( !OBB2D::overlaps1Way(*(_QWORD *)(a1 + 14872), *(float **)(a1 + 2312))
|| !OBB2D::overlaps1Way(v44, v45) )
{
goto LABEL_53;
}
LABEL_52:
cocos2d::CCArray::addObject(v13, (struct cocos2d::CCObject *)v34);
goto LABEL_53;
}
}
LABEL_55:
++v30;
}
while ( v30 <= v51 );
v27 = v52;
v22 = v49;
}
v50 = ++v25;
}
while ( v25 <= v47 );
}
}
return v13;
}