//
// LevelEditorLayer::typeExistsAtPosition from 0x460448 to 0x46071a (722 bytes)
//
// 1 xrefs:
// > EditorUI::onCreateObject @ 0x4873d0
//
// 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
//
int __fastcall LevelEditorLayer::typeExistsAtPosition(int a1, int a2, float *a3, int a4, unsigned __int8 a5, float a6)
{
int v8; // r6
float v9; // s15
float v10; // s14
float v11; // s14
int v12; // r2
float v13; // s15
float v14; // s14
float *v15; // r3
int v16; // r3
_DWORD *v17; // r8
int v18; // r1
int v19; // r0
int v20; // r4
int v21; // r2
int result; // r0
int v23; // r7
_DWORD *v24; // r2
unsigned int v25; // r3
int v26; // r10
int v27; // r9
float *v28; // r4
float v29; // s17
int v30; // r0
float v31; // s16
float v32; // s15
float v33; // r0
float *v34; // r0
float v35; // s16
int v36; // r0
const cocos2d::CCPoint *v37; // r0
signed int i; // [sp+Ch] [bp-78h]
int v39; // [sp+10h] [bp-74h]
int v40; // [sp+14h] [bp-70h]
signed int v41; // [sp+1Ch] [bp-68h]
_DWORD *v42; // [sp+20h] [bp-64h]
unsigned int v43; // [sp+24h] [bp-60h]
int v44; // [sp+28h] [bp-5Ch]
int v45; // [sp+2Ch] [bp-58h]
float v48[2]; // [sp+4Ch] [bp-38h] BYREF
float v49; // [sp+54h] [bp-30h] BYREF
float v50; // [sp+58h] [bp-2Ch]
float v51[2]; // [sp+5Ch] [bp-28h] BYREF
float v52[2]; // [sp+64h] [bp-20h] BYREF
float v53[4]; // [sp+6Ch] [bp-18h] BYREF
v8 = (int)v53;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, (const cocos2d::CCPoint *)a3);
LevelEditorLayer::getGridPos((cocos2d::CCPoint *)v48, a1, v53);
v9 = *a3;
if ( *a3 <= 0.0 )
{
v12 = 0;
}
else
{
v10 = *(float *)(a1 + 11424);
if ( v9 < 10000000.0 )
v11 = v9 * v10;
else
v11 = v10 * 10000000.0;
v12 = (int)v11;
}
v13 = a3[1];
if ( v13 <= 0.0 )
{
v16 = 0;
}
else
{
v14 = 10000000.0;
v15 = (float *)(a1 + 11428);
if ( v13 < 10000000.0 )
v14 = *v15;
else
v13 = *v15;
v16 = (int)(float)(v13 * v14);
}
v17 = (_DWORD *)(a1 + 11292);
if ( v12 > 1 )
v8 = v12 - 1;
v18 = *(_DWORD *)(a1 + 11296);
v19 = *(_DWORD *)(a1 + 11292);
if ( v12 <= 1 )
v8 = 0;
v20 = v12 + 1;
if ( v12 + 1 >= (unsigned int)(((v18 - v19) >> 2) - 1) )
v20 = ((v18 - v19) >> 2) - 1;
if ( v16 <= 1 )
v21 = 0;
else
v21 = v16 - 1;
v39 = v20;
v40 = v21;
v43 = v16 + 1;
if ( v19 != v18 )
{
v23 = 4 * v8;
v45 = 4 * v21;
while ( v8 <= v39 )
{
v24 = *(_DWORD **)(*v17 + v23);
if ( v24 )
{
v25 = ((v24[1] - *v24) >> 2) - 1;
if ( v25 >= v43 )
v25 = v43;
}
else
{
v25 = -1;
}
v41 = v25;
v26 = v45;
for ( i = v40; i <= v41; ++i )
{
v42 = *(_DWORD **)(**(_DWORD **)(*v17 + v23) + v26);
if ( v42 )
{
v27 = 0;
v44 = *(_DWORD *)(**(_DWORD **)(*(_DWORD *)(a1 + 11376) + v23) + v26);
while ( v27 < v44 )
{
v28 = *(float **)(*v42 + 4 * v27);
if ( LevelEditorLayer::validGroup((LevelEditorLayer *)a1, (GameObject *)v28, 0)
&& a2 == *((_DWORD *)v28 + 223)
&& (*(float (__fastcall **)(float *))(*(_DWORD *)v28 + 184))(v28) == a6
&& (*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 712))(v28) == a4
&& (*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 716))(v28) == a5 )
{
v29 = v28[86];
v30 = (*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 732))(v28);
v31 = v28[87];
v32 = *(float *)&v30;
v33 = (*(float (__fastcall **)(float *))(*(_DWORD *)v28 + 736))(v28);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v49, v29 * v32, v31 * v33);
v34 = (float *)(*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 96))(v28);
v35 = *v34 - (float)(v49 * 0.5);
v36 = (*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v53, v35, *(float *)(v36 + 4) - (float)(v50 * 0.5), v49, v50);
v37 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(float *))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v37);
LevelEditorLayer::getGridPos((cocos2d::CCPoint *)v51, a1, v52);
result = cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v53, (const cocos2d::CCPoint *)a3);
if ( result )
{
if ( v48[0] == v51[0] && v48[1] == v51[1] )
return result;
}
}
++v27;
}
}
v26 += 4;
}
++v8;
v23 += 4;
}
}
return 0;
}