//
// LevelEditorLayer::typeExistsAtPosition from 0x1402d4a50 to 0x1402d4ebe (1134 bytes)
//
// 3 xrefs:
// > EditorUI::onCreateObject @ 0x14010f87b
// > ??> @ 0x14068e0d4
// > ??> @ 0x1406d2fa8
//
// 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
//
bool LevelEditorLayer::typeExistsAtPosition(
LevelEditorLayer *a1,
int a2,
cocos2d::CCPoint a3,
bool a4,
bool a5,
float a6)
{
double v9; // xmm0_8
float *v10; // rax
float v11; // xmm2_4
float v12; // xmm1_4
float v13; // xmm0_4
float m_sectionXFactor; // xmm0_4
float v15; // xmm2_4
int v16; // r8d
float m_sectionYFactor; // xmm0_4
std::_Vector_val *, std::allocator *>> *>>::pointer Mylast; // r11
std::_Vector_val *, std::allocator *>> *>>::pointer Myfirst; // rbx
__int64 v20; // r9
int v21; // r10d
__int64 v22; // rdx
int v23; // r8d
int v24; // ecx
float x; // r10d
float v26; // xmm8_4
char v27; // r13
__int64 v28; // r8
std::_Simple_types *, std::allocator *>> *>::value_type v29; // rcx
__int64 v30; // rdx
int v31; // edx
__int64 v32; // r15
std::_Simple_types *>::value_type v33; // r14
__int64 v34; // rdi
__int64 v35; // rsi
int m_currentLayer; // ecx
_DWORD *v37; // rbx
int v38; // eax
__int64 v39; // rdx
char v40; // al
double v41; // xmm0_8
float v42; // xmm6_4
double v43; // xmm0_8
__int64 v44; // rax
float v45; // xmm6_4
float v46; // xmm7_4
float *v47; // rax
double v48; // xmm0_8
float *v49; // rax
cocos2d::CCSize v51; // [rsp+30h] [rbp-D8h] BYREF
float v52; // [rsp+38h] [rbp-D0h]
float v53; // [rsp+3Ch] [rbp-CCh]
float v54; // [rsp+40h] [rbp-C8h]
float v55; // [rsp+44h] [rbp-C4h]
__int64 v56; // [rsp+48h] [rbp-C0h]
__int64 v57; // [rsp+50h] [rbp-B8h]
__int64 v58; // [rsp+58h] [rbp-B0h]
__int64 v59; // [rsp+60h] [rbp-A8h]
cocos2d::CCPoint v60; // [rsp+68h] [rbp-A0h] BYREF
cocos2d::CCRect v61; // [rsp+70h] [rbp-98h] BYREF
cocos2d::CCPoint v62; // [rsp+110h] [rbp+8h] BYREF
const struct cocos2d::CCPoint *v63; // [rsp+120h] [rbp+18h]
char v64; // [rsp+128h] [rbp+20h]
v64 = a4;
v63 = (const struct cocos2d::CCPoint *)a3;
v9 = cocos2d::CCPoint::CCPoint(&v62);
cocos2d::CCPoint::CCPoint(*(float *)&v9, *v10 / 30.0);
v11 = **(float **)&a3;
v12 = 0.0;
if ( **(float **)&a3 > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
if ( v11 < 10000000.0 )
v13 = v11 * m_sectionXFactor;
else
v13 = m_sectionXFactor * 10000000.0;
}
else
{
v13 = 0.0;
}
v15 = *(float *)(*(_QWORD *)&a3 + 4LL);
v16 = (int)v13;
if ( v15 > 0.0 )
{
m_sectionYFactor = a1->m_sectionYFactor;
if ( v15 < 10000000.0 )
v12 = v15 * m_sectionYFactor;
else
v12 = m_sectionYFactor * 10000000.0;
}
Mylast = a1->m_sections._Mypair._Myval2._Mylast;
Myfirst = a1->m_sections._Mypair._Myval2._Myfirst;
LODWORD(v20) = 0;
v21 = (int)v12;
if ( v16 - 1 >= 0 )
LODWORD(v20) = v16 - 1;
v22 = a1->m_sections._Mypair._Myval2._Mylast - Myfirst;
v23 = v16 + 1;
if ( v23 >= (unsigned __int64)(v22 - 1) )
v23 = v22 - 1;
v24 = 0;
if ( v21 - 1 >= 0 )
v24 = v21 - 1;
LODWORD(x) = v21 + 1;
v62.x = x;
if ( Myfirst == Mylast )
return 0;
v20 = (int)v20;
v56 = v20;
v59 = v23;
if ( (int)v20 > (__int64)v23 )
return 0;
v26 = a6;
v27 = a5;
v28 = v24;
v58 = v24;
while ( 1 )
{
v29 = a1->m_sections._Mypair._Myval2._Myfirst[v20];
if ( v29 )
{
v30 = v29->_Mypair._Myval2._Mylast - v29->_Mypair._Myval2._Myfirst;
v31 = SLODWORD(x) >= (unsigned __int64)(v30 - 1) ? v30 - 1 : LODWORD(x);
}
else
{
v31 = -1;
}
v32 = v28;
v57 = v31;
if ( v28 <= v31 )
break;
LABEL_43:
v56 = ++v20;
if ( v20 > v59 )
return 0;
}
while ( 1 )
{
v33 = a1->m_sections._Mypair._Myval2._Myfirst[v20]->_Mypair._Myval2._Myfirst[v32];
if ( v33 )
{
v34 = 0;
v35 = a1->m_sectionSizes._Mypair._Myval2._Myfirst[v20]->_Mypair._Myval2._Myfirst[v32];
if ( v35 > 0 )
break;
}
LABEL_41:
if ( ++v32 > v57 )
{
v28 = v58;
x = v62.x;
goto LABEL_43;
}
}
while ( 1 )
{
m_currentLayer = a1->m_currentLayer;
v37 = v33->_Mypair._Myval2._Myfirst[v34];
v38 = *((__int16 *)v37 + 606);
v39 = (unsigned int)*((__int16 *)v37 + 605);
if ( !*((_WORD *)v37 + 606) )
v38 = -1;
if ( ((_WORD)m_currentLayer == 0xFFFF || m_currentLayer == (_DWORD)v39 || m_currentLayer == v38)
&& a2 == v37[259]
&& (*(float (__fastcall **)(std::_Simple_types::value_type, __int64))(*(_QWORD *)v37 + 344LL))(
v33->_Mypair._Myval2._Myfirst[v34],
v39) == v26 )
{
v40 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 1256LL))(v37);
if ( v40 == v64 && (*(unsigned __int8 (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 1264LL))(v37) == v27 )
{
v41 = (*(double (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 1304LL))(v37);
v42 = *(float *)&v41 * *((float *)v37 + 109);
v43 = (*(double (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 1296LL))(v37);
cocos2d::CCSize::CCSize(&v51, *(float *)&v43 * *((float *)v37 + 108), v42);
v44 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 200LL))(v37);
v45 = v51.height * 0.5;
v46 = *(float *)(v44 + 4);
v47 = (float *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 200LL))(v37);
cocos2d::CCRect::CCRect(&v61, *v47 - (float)(v51.width * 0.5), v46 - v45, v51.width, v51.height);
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 200LL))(v37);
v48 = cocos2d::CCPoint::CCPoint(&v60);
cocos2d::CCPoint::CCPoint(*(float *)&v48, *v49 / 30.0);
if ( cocos2d::CCRect::containsPoint(&v61, v63) && v52 == v54 && v53 == v55 )
return 1;
}
}
if ( ++v34 >= v35 )
{
v20 = v56;
goto LABEL_41;
}
}
}