//
// LevelEditorLayer::typeExistsAtPosition from 0x10035a2dc to 0x10035a68c (944 bytes)
//
// 1 xrefs:
// > EditorUI::onCreateObject @ 0x1003eb4a8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool __fastcall LevelEditorLayer::typeExistsAtPosition(
LevelEditorLayer *a1,
int a2,
cocos2d::CCPoint a3,
bool a4,
bool a5,
float a6)
{
int v6; // w4
float x; // s8
float *v8; // x19
__n128 v11; // q0
__n128 v12; // q1
float v13; // s1
float v14; // s0
float v15; // s2
float m_sectionXFactor; // s2
int v17; // w8
float v18; // s1
float m_sectionYFactor; // s0
bool result; // w0
int v21; // w10
__int64 v22; // 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 v25; // x14
int v26; // w8
__int64 v27; // x11
__int64 v28; // x25
std::vector *, std::allocator *>> *v29; // x8
__int64 v30; // x8
unsigned __int64 v31; // x9
int v32; // w8
__int64 v33; // x21
std::vector *v34; // x19
__int64 v35; // x8
unsigned __int64 v36; // x27
__int64 v37; // x20
GameObject *v38; // x24
int m_editorLayer2; // w9
int m_currentLayer; // w10
bool v41; // zf
float width; // s9
float v44; // s9
float height; // s12
float v46; // s0
float *v47; // x0
float v48; // s9
__int64 v49; // x0
__int64 *v50; // x0
__n128 v51; // q0
__n128 v52; // q1
__int64 v53; // [xsp+0h] [xbp-100h]
int v54; // [xsp+10h] [xbp-F0h]
int v55; // [xsp+1Ch] [xbp-E4h]
__int64 v56; // [xsp+20h] [xbp-E0h]
float *v57; // [xsp+28h] [xbp-D8h]
int v58; // [xsp+34h] [xbp-CCh]
__int64 v59; // [xsp+38h] [xbp-C8h]
int v60; // [xsp+44h] [xbp-BCh]
__int64 v61; // [xsp+48h] [xbp-B8h] BYREF
float v62[2]; // [xsp+50h] [xbp-B0h] BYREF
__int64 v63[2]; // [xsp+58h] [xbp-A8h] BYREF
float v64; // [xsp+68h] [xbp-98h] BYREF
float v65; // [xsp+6Ch] [xbp-94h]
float v66[4]; // [xsp+70h] [xbp-90h] BYREF
x = a3.x;
v58 = v6;
v60 = a5;
v8 = (float *)a4;
sub_1000229B8(v63, (__int64 *)a4);
v11.n128_f32[0] = *(float *)v63 / 30.0;
v12.n128_f32[0] = *((float *)v63 + 1) / 30.0;
sub_100022980(v11, v12, v66);
v57 = v8;
v13 = *v8;
v14 = 0.0;
v15 = 0.0;
if ( *v8 > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
if ( v13 >= 10000000.0 )
v15 = m_sectionXFactor * 10000000.0;
else
v15 = v13 * m_sectionXFactor;
}
v17 = (int)v15;
v18 = v8[1];
if ( v18 > 0.0 )
{
m_sectionYFactor = a1->m_sectionYFactor;
if ( v18 >= 10000000.0 )
v14 = m_sectionYFactor * 10000000.0;
else
v14 = v18 * m_sectionYFactor;
}
result = 0;
v21 = (int)v14;
if ( v17 <= 1 )
v22 = 1;
else
v22 = (unsigned int)v17;
end = a1->m_sections.__end_;
begin = a1->m_sections.__begin_;
v25 = end - begin;
if ( v25 - 1 >= (unsigned __int64)(v17 + 1) )
v26 = v17 + 1;
else
v26 = v25 - 1;
if ( v21 <= 1 )
v27 = 1;
else
v27 = (unsigned int)v21;
if ( end != begin && (int)v22 - 1 <= v26 )
{
v55 = v27 - 1;
v54 = v21 + 1;
v53 = v27 - 1;
v28 = v22 - 1;
v56 = (unsigned int)(v26 + 1);
while ( 1 )
{
v29 = a1->m_sections.__begin_[v28];
if ( v29 )
{
v30 = v29->__end_ - v29->__begin_;
v31 = v30 - 1;
v32 = v30 - 1;
if ( v31 >= v54 )
v32 = v54;
if ( v55 <= v32 )
break;
}
LABEL_48:
if ( ++v28 == v56 )
return 0;
}
v59 = (unsigned int)(v32 + 1);
v33 = v53;
while ( 1 )
{
v34 = a1->m_sections.__begin_[v28]->__begin_[v33];
if ( v34 )
{
v35 = (unsigned int)a1->m_sectionSizes.__begin_[v28]->__begin_[v33];
if ( (int)v35 >= 1 )
break;
}
LABEL_47:
if ( ++v33 == v59 )
goto LABEL_48;
}
v36 = 0;
v37 = 8 * v35;
while ( 1 )
{
v38 = v34->__begin_[v36 / 8];
m_editorLayer2 = (unsigned __int16)v38->m_editorLayer2;
if ( !v38->m_editorLayer2 )
m_editorLayer2 = 0xFFFF;
m_currentLayer = (unsigned __int16)a1->m_currentLayer;
v41 = m_currentLayer == 0xFFFF || m_currentLayer == (unsigned __int16)v38->m_editorLayer;
if ( (v41 || m_currentLayer == m_editorLayer2)
&& v38->m_objectID == a2
&& ((float (__fastcall *)(GameObject *))v38->getRotation)(v34->__begin_[v36 / 8]) == x
&& ((unsigned int (__fastcall *)(GameObject *))v38->isFlipX)(v38) == v60
&& ((unsigned int (__fastcall *)(GameObject *))v38->isFlipY)(v38) == v58 )
{
width = v38->m_obRect.size.width;
v44 = width * ((float (__fastcall *)(GameObject *))v38->getRScaleX)(v38);
height = v38->m_obRect.size.height;
v46 = ((float (__fastcall *)(GameObject *))v38->getRScaleY)(v38);
sub_100022988(&v64, v44, height * v46);
v47 = (float *)((__int64 (__fastcall *)(GameObject *))v38->getPosition)(v38);
v48 = *v47 - (float)(v64 * 0.5);
v49 = ((__int64 (__fastcall *)(GameObject *))v38->getPosition)(v38);
sub_100022990((float *)v63, v48, *(float *)(v49 + 4) - (float)(v65 * 0.5), v64, v65);
v50 = (__int64 *)((__int64 (__fastcall *)(GameObject *))v38->getPosition)(v38);
sub_1000229B8(&v61, v50);
v51.n128_f32[0] = *(float *)&v61 / 30.0;
v52.n128_f32[0] = *((float *)&v61 + 1) / 30.0;
sub_100022980(v51, v52, v62);
if ( sub_100022C60((float *)v63, v57) && v66[0] == v62[0] && v66[1] == v62[1] )
return 1;
}
v36 += 8LL;
if ( v37 == v36 )
goto LABEL_47;
}
}
return result;
}