//
// LevelEditorLayer::objectsAtPosition from 0x65e350 to 0x65e6f8 (936 bytes)
//
// 5 xrefs:
// > EditorUI::onDelete @ 0x6c0a98
// > EditorUI::ccTouchEnded @ 0x6c2d00
// > EditorUI::ccTouchEnded @ 0x6c2f84
// > EditorUI::ccTouchBegan @ 0x6c5428
// > ??> @ 0x33618
//
// 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
//
cocos2d::CCArray *LevelEditorLayer::objectsAtPosition(LevelEditorLayer *a1, cocos2d::CCPoint a2)
{
float *v2; // x1
float *v4; // x19
cocos2d::CCArray *v5; // x0
float v6; // s0
int v7; // w19
float y; // s0
int v9; // w21
unsigned __int64 v10; // x24
int v11; // w22
int v12; // w0
std::vector *, std::allocator *>> **m_start; // x21
std::vector *, std::allocator *>> **m_finish; // x1
__int64 v15; // x0
unsigned __int64 v16; // x2
int v17; // w0
std::vector *, std::allocator *>> **v18; // x19
bool *p_m_nonSquareRotation; // x27
std::vector *, std::allocator *>> *v20; // x19
int v21; // w24
__int64 v22; // x0
unsigned __int64 v23; // x1
int v24; // w0
__int64 v25; // x26
__int64 v26; // x25
std::vector *v27; // x22
int v28; // w21
unsigned __int64 v29; // x28
__int64 v30; // x21
GameObject *v31; // x19
int v33; // [xsp+84h] [xbp+84h]
int v34; // [xsp+88h] [xbp+88h]
int v35; // [xsp+8Ch] [xbp+8Ch]
int v36; // [xsp+8Ch] [xbp+8Ch]
cocos2d::CCPoint *v37; // [xsp+90h] [xbp+90h]
int v38; // [xsp+98h] [xbp+98h]
int v39; // [xsp+9Ch] [xbp+9Ch]
cocos2d::CCArray *v40; // [xsp+A0h] [xbp+A0h]
__int64 v41; // [xsp+A8h] [xbp+A8h]
cocos2d::CCRect v42; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCRect v43; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = v2;
v37 = (cocos2d::CCPoint *)v2;
cocos2d::CCRect::CCRect(&v42, *v2, v2[1], 1.0, 1.0);
GJBaseGameLayer::updateOBB2(a1, v43);
v40 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v6 = *v4;
if ( *v4 > 0.0 )
{
if ( v6 < 10000000.0 )
{
v7 = (int)(float)(v6 * a1->m_sectionXFactor);
y = v37->y;
v9 = v7 + 1;
v10 = v7 + 1;
if ( y > 0.0 )
goto LABEL_4;
LABEL_31:
v12 = 1;
v11 = 0;
v10 = v9;
if ( v7 > 1 )
{
LABEL_7:
v34 = v12;
v38 = v7 - 1;
v35 = v9;
goto LABEL_8;
}
goto LABEL_32;
}
v7 = (int)(float)(a1->m_sectionXFactor * 10000000.0);
y = v37->y;
v9 = v7 + 1;
v10 = v7 + 1;
if ( y <= 0.0 )
goto LABEL_31;
LABEL_4:
if ( y < 10000000.0 )
v11 = (int)(float)(y * a1->m_sectionYFactor);
else
v11 = (int)(float)(a1->m_sectionYFactor * 10000000.0);
v12 = v11 + 1;
if ( v7 > 1 )
goto LABEL_7;
LABEL_32:
v34 = v12;
v35 = v9;
v38 = 0;
goto LABEL_8;
}
v10 = 1;
y = v37->y;
if ( y > 0.0 )
{
v7 = 0;
v9 = 1;
goto LABEL_4;
}
v35 = 1;
v34 = 1;
v11 = 0;
v38 = 0;
LABEL_8:
m_start = a1->m_sections.m_start;
m_finish = a1->m_sections.m_finish;
v15 = m_finish - m_start;
v16 = v15 - 1;
v17 = v15 - 1;
if ( v16 >= v10 )
v17 = v35;
v36 = v17;
if ( v11 <= 1 )
v33 = 0;
else
v33 = v11 - 1;
if ( m_start != m_finish && v38 <= v17 )
{
v41 = v38;
v18 = a1->m_sections.m_start;
p_m_nonSquareRotation = &a1->m_nonSquareRotation;
while ( 1 )
{
v20 = v18[v41];
if ( v20 )
{
v21 = v33;
v22 = v20->m_finish - v20->m_start;
v23 = v22 - 1;
v24 = v22 - 1;
if ( v34 <= v23 )
v24 = v34;
v39 = v24;
if ( v33 <= v24 )
break;
}
LABEL_36:
++v41;
if ( v36 < ++v38 )
return v40;
v18 = a1->m_sections.m_start;
}
v25 = v33;
v26 = v33;
while ( 1 )
{
v27 = v20->m_start[v26];
if ( v27 )
{
v28 = a1->m_sectionSizes.m_start[v41]->m_start[v25];
if ( v28 > 0 )
break;
}
LABEL_28:
++v21;
++v26;
++v25;
if ( v39 < v21 )
goto LABEL_36;
v20 = a1->m_sections.m_start[v41];
}
v29 = 0;
v30 = 8 * ((unsigned int)(v28 - 1) + 1LL);
while ( 1 )
{
v31 = v27->m_start[v29 / 8];
if ( !LevelEditorLayer::validGroup(a1, v31, 1) )
goto LABEL_23;
LevelEditorLayer::getObjectRect(a1, v31, 0, 0);
if ( !*p_m_nonSquareRotation )
{
if ( (unsigned __int8)cocos2d::CCRect::containsPoint(&v42, v37) )
goto LABEL_27;
if ( !*p_m_nonSquareRotation )
goto LABEL_23;
}
if ( OBB2D::overlaps(a1->m_currentOBB2D) )
{
LABEL_27:
v29 += 8LL;
cocos2d::CCArray::addObject(v40, v31);
if ( v29 == v30 )
goto LABEL_28;
}
else
{
LABEL_23:
v29 += 8LL;
if ( v29 == v30 )
goto LABEL_28;
}
}
}
return v40;
}