//
// LevelEditorLayer::typeExistsAtPosition from 0x78a1e4 to 0x78a6cc (1256 bytes)
//
// 2 xrefs:
// > EditorUI::onCreateObject @ 0x7ca124
// > ??> @ 0x74d10
//
// This function is hookable on this platform (idp: arm, 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 12:53:26 +0000
//
__int64 __fastcall LevelEditorLayer::typeExistsAtPosition(
__int64 a1,
int a2,
float *a3,
unsigned __int8 a4,
unsigned __int8 a5,
float a6)
{
float v9; // s0
int v10; // w20
float v11; // s0
int v12; // w0
unsigned __int64 v13; // x25
int v14; // w21
int v15; // w1
__int64 v16; // x20
__int64 v17; // x0
__int64 v18; // x24
unsigned __int64 v19; // x1
int v20; // w24
bool v21; // cf
int v22; // w1
_QWORD *v23; // x20
__int64 v24; // x0
unsigned __int64 v25; // x1
int v26; // w0
_QWORD *v27; // x22
int v28; // w20
__int64 v29; // x28
__int64 v30; // x20
float *v31; // x27
float v32; // s11
float v33; // s0
float v34; // s8
float v35; // s11
float v36; // s0
__int64 v37; // x0
const cocos2d::CCPoint *v38; // x0
__int64 result; // x0
int v40; // [xsp+8Ch] [xbp+8Ch]
int v41; // [xsp+A8h] [xbp+A8h]
int v42; // [xsp+ACh] [xbp+ACh]
int v43; // [xsp+B0h] [xbp+B0h]
int v44; // [xsp+B4h] [xbp+B4h]
int v45; // [xsp+B8h] [xbp+B8h]
int v46; // [xsp+B8h] [xbp+B8h]
int v47; // [xsp+BCh] [xbp+BCh]
__int64 i; // [xsp+C0h] [xbp+C0h]
__int64 v49; // [xsp+C8h] [xbp+C8h]
__int64 v50; // [xsp+D0h] [xbp+D0h]
int v52; // [xsp+E8h] [xbp+E8h]
float v54; // [xsp+F0h] [xbp+F0h]
float v55[2]; // [xsp+108h] [xbp+108h] BYREF
float v56; // [xsp+110h] [xbp+110h] BYREF
float v57; // [xsp+114h] [xbp+114h]
float v58[2]; // [xsp+118h] [xbp+118h] BYREF
float v59; // [xsp+120h] [xbp+120h] BYREF
float v60[4]; // [xsp+128h] [xbp+128h] BYREF
v41 = a4;
v40 = a5;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, (const cocos2d::CCPoint *)a3);
LevelEditorLayer::getGridPos(v60, (cocos2d::CCPoint *)v55);
v9 = *a3;
if ( *a3 > 0.0 )
{
if ( v9 < 10000000.0 )
{
v10 = (int)(float)(v9 * *(float *)(a1 + 13632));
v11 = a3[1];
v12 = v10 + 1;
v13 = v10 + 1;
if ( v11 > 0.0 )
goto LABEL_4;
LABEL_33:
v15 = 1;
v14 = 0;
v13 = v12;
if ( v10 > 1 )
{
LABEL_7:
v44 = v15;
v42 = v10 - 1;
v45 = v12;
goto LABEL_8;
}
goto LABEL_34;
}
v10 = (int)(float)(*(float *)(a1 + 13632) * 10000000.0);
v11 = a3[1];
v12 = v10 + 1;
v13 = v10 + 1;
if ( v11 <= 0.0 )
goto LABEL_33;
LABEL_4:
if ( v11 < 10000000.0 )
v14 = (int)(float)(v11 * *(float *)(a1 + 13636));
else
v14 = (int)(float)(*(float *)(a1 + 13636) * 10000000.0);
v15 = v14 + 1;
if ( v10 > 1 )
goto LABEL_7;
LABEL_34:
v44 = v15;
v45 = v12;
v42 = 0;
goto LABEL_8;
}
v13 = 1;
v11 = a3[1];
if ( v11 > 0.0 )
{
v10 = 0;
v12 = 1;
goto LABEL_4;
}
v45 = 1;
v44 = 1;
v14 = 0;
v42 = 0;
LABEL_8:
v16 = *(_QWORD *)(a1 + 13368);
v17 = *(_QWORD *)(a1 + 13376);
v18 = (v17 - v16) >> 3;
v19 = v18 - 1;
v20 = v18 - 1;
v21 = v19 >= v13;
v22 = v45;
if ( !v21 )
v22 = v20;
v46 = v22;
if ( v14 <= 1 )
{
v43 = 0;
if ( v16 == v17 )
return 0;
}
else
{
v43 = v14 - 1;
if ( v16 == v17 )
return 0;
}
if ( v42 > v22 )
return 0;
for ( i = 8LL * v42; ; i += 8 )
{
v23 = *(_QWORD **)(v16 + i);
if ( v23 )
{
v24 = (__int64)(v23[1] - *v23) >> 3;
v25 = v24 - 1;
v26 = v24 - 1;
if ( v44 <= v25 )
v26 = v44;
v47 = v26;
if ( v43 <= v26 )
break;
}
LABEL_42:
if ( v46 < ++v42 )
return 0;
v16 = *(_QWORD *)(a1 + 13368);
}
v49 = 4LL * v43;
v50 = 8LL * v43;
v52 = v43;
while ( 1 )
{
v27 = *(_QWORD **)(*v23 + v50);
if ( v27 )
{
v28 = *(_DWORD *)(**(_QWORD **)(*(_QWORD *)(a1 + 13536) + i) + v49);
if ( v28 > 0 )
break;
}
LABEL_35:
v50 += 8;
++v52;
v49 += 4;
if ( v47 < v52 )
goto LABEL_42;
v23 = *(_QWORD **)(*(_QWORD *)(a1 + 13368) + i);
}
v29 = 0;
v30 = 8 * ((unsigned int)(v28 - 1) + 1LL);
while ( 1 )
{
v31 = *(float **)(*v27 + v29);
if ( LevelEditorLayer::validGroup((LevelEditorLayer *)a1, (GameObject *)v31, 0)
&& *((_DWORD *)v31 + 257) == a2
&& (*(float (__fastcall **)(float *))(*(_QWORD *)v31 + 368LL))(v31) == a6
&& v41 == (*(unsigned __int8 (__fastcall **)(float *))(*(_QWORD *)v31 + 1424LL))(v31)
&& v40 == (*(unsigned __int8 (__fastcall **)(float *))(*(_QWORD *)v31 + 1432LL))(v31) )
{
v32 = v31[108];
v33 = (*(float (__fastcall **)(float *))(*(_QWORD *)v31 + 1464LL))(v31);
v34 = v31[109];
v35 = v32 * v33;
v36 = (*(float (__fastcall **)(float *))(*(_QWORD *)v31 + 1472LL))(v31);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v56, v35, v34 * v36);
v54 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v31 + 192LL))(v31) - (float)(v56 * 0.5);
v37 = (*(__int64 (__fastcall **)(float *))(*(_QWORD *)v31 + 192LL))(v31);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v60, v54, *(float *)(v37 + 4) - (float)(v57 * 0.5), v56, v57);
v38 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v31 + 192LL))(v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v38);
LevelEditorLayer::getGridPos(&v59, (cocos2d::CCPoint *)v58);
result = (unsigned __int8)cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v60, (const cocos2d::CCPoint *)a3);
if ( (_BYTE)result )
{
if ( v55[0] == v58[0] && v55[1] == v58[1] )
return result;
}
}
v29 += 8;
if ( v29 == v30 )
goto LABEL_35;
}
}