//
// LevelEditorLayer::objectAtPosition from 0x460724 to 0x460914 (496 bytes)
//
// 2 xrefs:
// > EditorUI::clickOnPosition @ 0x48c79c
// > EditorUI::clickOnPosition @ 0x48c7da
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:48:52 +0000
//
const cocos2d::CCPoint *__fastcall LevelEditorLayer::objectAtPosition(int a1, float *a2)
{
int v2; // r6
float v5; // s15
float v6; // s14
float v7; // s14
int v8; // r2
float v9; // s15
float v10; // s14
float *v11; // r3
int v12; // r3
_DWORD *v13; // r9
int v14; // r1
int v15; // r0
int v16; // r5
int v17; // r2
int v19; // r7
_BYTE *v20; // r11
_DWORD *v21; // r2
unsigned int v22; // r3
int v23; // r5
int v24; // r10
signed int i; // [sp+8h] [bp-4Ch]
int v26; // [sp+Ch] [bp-48h]
int v27; // [sp+10h] [bp-44h]
const cocos2d::CCPoint *v28; // [sp+14h] [bp-40h]
signed int v29; // [sp+1Ch] [bp-38h]
_DWORD *v30; // [sp+20h] [bp-34h]
unsigned int v31; // [sp+24h] [bp-30h]
int v32; // [sp+28h] [bp-2Ch]
int v33; // [sp+2Ch] [bp-28h]
_BYTE v34[16]; // [sp+3Ch] [bp-18h] BYREF
v2 = (int)v34;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v34, *a2, a2[1], 1.0, 1.0);
GJBaseGameLayer::updateOBB2(a1, v34);
v5 = *a2;
if ( *a2 <= 0.0 )
{
v8 = 0;
}
else
{
v6 = *(float *)(a1 + 11424);
if ( v5 < 10000000.0 )
v7 = v5 * v6;
else
v7 = v6 * 10000000.0;
v8 = (int)v7;
}
v9 = a2[1];
if ( v9 <= 0.0 )
{
v12 = 0;
}
else
{
v10 = 10000000.0;
v11 = (float *)(a1 + 11428);
if ( v9 < 10000000.0 )
v10 = *v11;
else
v9 = *v11;
v12 = (int)(float)(v9 * v10);
}
v13 = (_DWORD *)(a1 + 11292);
if ( v8 > 1 )
v2 = v8 - 1;
v14 = *(_DWORD *)(a1 + 11296);
v15 = *(_DWORD *)(a1 + 11292);
if ( v8 <= 1 )
v2 = 0;
v16 = v8 + 1;
if ( v8 + 1 >= (unsigned int)(((v14 - v15) >> 2) - 1) )
v16 = ((v14 - v15) >> 2) - 1;
if ( v12 <= 1 )
v17 = 0;
else
v17 = v12 - 1;
v26 = v16;
v27 = v17;
v31 = v12 + 1;
if ( v15 != v14 )
{
v19 = 4 * v2;
v20 = (_BYTE *)(a1 + 11853);
v33 = 4 * v17;
while ( v2 <= v26 )
{
v21 = *(_DWORD **)(*v13 + v19);
if ( v21 )
{
v22 = ((v21[1] - *v21) >> 2) - 1;
if ( v22 >= v31 )
v22 = v31;
}
else
{
v22 = -1;
}
v29 = v22;
v23 = v33;
for ( i = v27; i <= v29; ++i )
{
v30 = *(_DWORD **)(**(_DWORD **)(*v13 + v19) + v23);
if ( v30 )
{
v24 = 0;
v32 = *(_DWORD *)(**(_DWORD **)(*(_DWORD *)(a1 + 11376) + v19) + v23);
while ( v24 < v32 )
{
v28 = *(const cocos2d::CCPoint **)(*v30 + 4 * v24);
if ( LevelEditorLayer::validGroup((LevelEditorLayer *)a1, v28, 1) )
{
LevelEditorLayer::getObjectRect((LevelEditorLayer *)v34, (GameObject *)a1, v28, 0, 0);
if ( !*v20 )
{
if ( cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v34, (const cocos2d::CCPoint *)a2) )
return v28;
}
if ( *v20 && OBB2D::overlaps(*(float **)(a1 + 11832), *(float **)(a1 + 1488)) )
return v28;
}
++v24;
}
}
v23 += 4;
}
++v2;
v19 += 4;
}
}
return nullptr;
}