//
// LevelEditorLayer::objectsAtPosition from 0x10035b26c to 0x10035b4e0 (628 bytes)
//
// 4 xrefs:
// > EditorUI::onDelete @ 0x1003e6888
// > EditorUI::ccTouchBegan @ 0x1003f8b3c
// > EditorUI::ccTouchEnded @ 0x1003f94a8
// > EditorUI::ccTouchEnded @ 0x1003f9568
//
// 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 *__fastcall LevelEditorLayer::objectsAtPosition(LevelEditorLayer *a1, cocos2d::CCPoint a2)
{
float *v2; // x1
float *v3; // x19
cocos2d::CCArray *v5; // x21
float v6; // s1
float v7; // s0
float v8; // s2
float m_sectionXFactor; // s2
int v10; // w8
float v11; // s1
float m_sectionYFactor; // s0
int v13; // w10
__int64 v14; // x9
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // x12
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // x13
__int64 v17; // x14
unsigned __int64 v18; // x15
int v19; // w14
int v20; // w8
__int64 v21; // x11
__int64 v22; // x28
std::vector *, std::allocator *>> *v23; // x8
__int64 v24; // x8
unsigned __int64 v25; // x9
int v26; // w8
__int64 v27; // x25
std::vector *v28; // x24
__int64 v29; // x8
unsigned __int64 v30; // x27
__int64 v31; // x23
GameObject *v32; // x22
__int64 v34; // [xsp+0h] [xbp-90h]
int v35; // [xsp+10h] [xbp-80h]
int v36; // [xsp+1Ch] [xbp-74h]
__int64 v37; // [xsp+20h] [xbp-70h]
__int64 v38; // [xsp+28h] [xbp-68h]
float v39[4]; // [xsp+30h] [xbp-60h] BYREF
cocos2d::CCRect v40; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v3 = v2;
sub_100022990(v39, *v2, v2[1], 1.0, 1.0);
GJBaseGameLayer::updateOBB2(a1, v40);
v5 = (cocos2d::CCArray *)sub_10024A15C();
v6 = *v3;
v7 = 0.0;
v8 = 0.0;
if ( *v3 > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
if ( v6 >= 10000000.0 )
v8 = m_sectionXFactor * 10000000.0;
else
v8 = v6 * m_sectionXFactor;
}
v10 = (int)v8;
v11 = v3[1];
if ( v11 > 0.0 )
{
m_sectionYFactor = a1->m_sectionYFactor;
if ( v11 >= 10000000.0 )
v7 = m_sectionYFactor * 10000000.0;
else
v7 = v11 * m_sectionYFactor;
}
v13 = (int)v7;
if ( v10 <= 1 )
v14 = 1;
else
v14 = (unsigned int)v10;
end = a1->m_sections.__end_;
begin = a1->m_sections.__begin_;
v17 = end - begin;
v18 = v17 - 1;
v19 = v17 - 1;
if ( v18 >= v10 + 1 )
v20 = v10 + 1;
else
v20 = v19;
if ( v13 <= 1 )
v21 = 1;
else
v21 = (unsigned int)v13;
if ( end != begin && (int)v14 - 1 <= v20 )
{
v36 = v21 - 1;
v35 = v13 + 1;
v34 = v21 - 1;
v22 = v14 - 1;
v37 = (unsigned int)(v20 + 1);
while ( 1 )
{
v23 = a1->m_sections.__begin_[v22];
if ( v23 )
{
v24 = v23->__end_ - v23->__begin_;
v25 = v24 - 1;
v26 = v24 - 1;
if ( v25 >= v35 )
v26 = v35;
if ( v36 <= v26 )
break;
}
LABEL_40:
if ( ++v22 == v37 )
return v5;
}
v38 = (unsigned int)(v26 + 1);
v27 = v34;
while ( 1 )
{
v28 = a1->m_sections.__begin_[v22]->__begin_[v27];
if ( v28 )
{
v29 = (unsigned int)a1->m_sectionSizes.__begin_[v22]->__begin_[v27];
if ( (int)v29 >= 1 )
break;
}
LABEL_39:
if ( ++v27 == v38 )
goto LABEL_40;
}
v30 = 0;
v31 = 8 * v29;
while ( 1 )
{
v32 = v28->__begin_[v30 / 8];
if ( LevelEditorLayer::validGroup(a1, v32, 1) )
break;
LABEL_35:
v30 += 8LL;
if ( v31 == v30 )
goto LABEL_39;
}
LevelEditorLayer::getObjectRect(a1, v32, 0, 0);
if ( !a1->m_nonSquareRotation )
{
if ( sub_100022C60(v39, v3) )
{
LABEL_34:
sub_10024A2D0((__int64)v5);
goto LABEL_35;
}
if ( !a1->m_nonSquareRotation )
goto LABEL_35;
}
if ( !OBB2D::overlaps(a1->m_currentOBB2D) )
goto LABEL_35;
goto LABEL_34;
}
return v5;
}