//
// LevelEditorLayer::typeExistsAtPosition from 0x65dad0 to 0x65dfb8 (1256 bytes)
//
// 2 xrefs:
// > EditorUI::onCreateObject @ 0x6bfdd4
// > ??> @ 0x544c8
//
// 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 LevelEditorLayer::typeExistsAtPosition(
LevelEditorLayer *a1,
int a2,
cocos2d::CCPoint a3,
bool a4,
bool a5,
float a6)
{
unsigned __int8 v6; // w4
float *v7; // x20
float x; // s10
float v10; // s0
int v11; // w20
float y; // s0
int v13; // w0
unsigned __int64 v14; // x25
int v15; // w21
int v16; // w1
std::vector *, std::allocator *>> **m_start; // x20
std::vector *, std::allocator *>> **m_finish; // x0
__int64 v19; // x24
unsigned __int64 v20; // x1
int v21; // w24
bool v22; // cf
int v23; // w1
std::vector *, std::allocator *>> *v24; // x20
__int64 v25; // x0
unsigned __int64 v26; // x1
int v27; // w0
std::vector *v28; // x22
int v29; // w20
unsigned __int64 v30; // x28
__int64 v31; // x20
GameObject *v32; // x27
float width; // s11
float v34; // s0
float height; // s8
float v36; // s11
float v37; // s0
__int64 v38; // x0
const cocos2d::CCPoint *v39; // x0
bool result; // w0
int v41; // [xsp+8Ch] [xbp+8Ch]
_BOOL4 v42; // [xsp+A8h] [xbp+A8h]
int v43; // [xsp+ACh] [xbp+ACh]
int v44; // [xsp+B0h] [xbp+B0h]
int v45; // [xsp+B4h] [xbp+B4h]
int v46; // [xsp+B8h] [xbp+B8h]
int v47; // [xsp+B8h] [xbp+B8h]
int v48; // [xsp+BCh] [xbp+BCh]
__int64 i; // [xsp+C0h] [xbp+C0h]
__int64 v50; // [xsp+C8h] [xbp+C8h]
__int64 v51; // [xsp+D0h] [xbp+D0h]
cocos2d::CCPoint *v52; // [xsp+E0h] [xbp+E0h]
int v53; // [xsp+E8h] [xbp+E8h]
float v55; // [xsp+F0h] [xbp+F0h]
float v56; // [xsp+108h] [xbp+108h]
float v57; // [xsp+10Ch] [xbp+10Ch]
cocos2d::CCSize v58; // [xsp+110h] [xbp+110h] BYREF
float v59; // [xsp+118h] [xbp+118h]
float v60; // [xsp+11Ch] [xbp+11Ch]
cocos2d::CCPoint v61; // [xsp+120h] [xbp+120h] BYREF
cocos2d::CCRect v62; // [xsp+128h] [xbp+128h] BYREF
cocos2d::CCPoint v63; // 0:s0.4,4:s1.4
cocos2d::CCPoint v64; // 0:s0.4,4:s1.4
v7 = (float *)a4;
v52 = (cocos2d::CCPoint *)a4;
x = a3.x;
v42 = a5;
v41 = v6;
cocos2d::CCPoint::CCPoint(&v62.origin, (const cocos2d::CCPoint *)a4);
LevelEditorLayer::getGridPos(a1, v63);
v10 = *v7;
if ( *v7 > 0.0 )
{
if ( v10 < 10000000.0 )
{
v11 = (int)(float)(v10 * a1->m_sectionXFactor);
y = v52->y;
v13 = v11 + 1;
v14 = v11 + 1;
if ( y > 0.0 )
goto LABEL_4;
LABEL_33:
v16 = 1;
v15 = 0;
v14 = v13;
if ( v11 > 1 )
{
LABEL_7:
v45 = v16;
v43 = v11 - 1;
v46 = v13;
goto LABEL_8;
}
goto LABEL_34;
}
v11 = (int)(float)(a1->m_sectionXFactor * 10000000.0);
y = v52->y;
v13 = v11 + 1;
v14 = v11 + 1;
if ( y <= 0.0 )
goto LABEL_33;
LABEL_4:
if ( y < 10000000.0 )
v15 = (int)(float)(y * a1->m_sectionYFactor);
else
v15 = (int)(float)(a1->m_sectionYFactor * 10000000.0);
v16 = v15 + 1;
if ( v11 > 1 )
goto LABEL_7;
LABEL_34:
v45 = v16;
v46 = v13;
v43 = 0;
goto LABEL_8;
}
v14 = 1;
y = v52->y;
if ( y > 0.0 )
{
v11 = 0;
v13 = 1;
goto LABEL_4;
}
v46 = 1;
v45 = 1;
v15 = 0;
v43 = 0;
LABEL_8:
m_start = a1->m_sections.m_start;
m_finish = a1->m_sections.m_finish;
v19 = m_finish - m_start;
v20 = v19 - 1;
v21 = v19 - 1;
v22 = v20 >= v14;
v23 = v46;
if ( !v22 )
v23 = v21;
v47 = v23;
if ( v15 <= 1 )
{
v44 = 0;
if ( m_start == m_finish )
return 0;
}
else
{
v44 = v15 - 1;
if ( m_start == m_finish )
return 0;
}
if ( v43 > v23 )
return 0;
for ( i = v43; ; ++i )
{
v24 = m_start[i];
if ( v24 )
{
v25 = v24->m_finish - v24->m_start;
v26 = v25 - 1;
v27 = v25 - 1;
if ( v45 <= v26 )
v27 = v45;
v48 = v27;
if ( v44 <= v27 )
break;
}
LABEL_42:
if ( v47 < ++v43 )
return 0;
m_start = a1->m_sections.m_start;
}
v50 = v44;
v51 = v44;
v53 = v44;
while ( 1 )
{
v28 = v24->m_start[v51];
if ( v28 )
{
v29 = a1->m_sectionSizes.m_start[i]->m_start[v50];
if ( v29 > 0 )
break;
}
LABEL_35:
++v51;
++v53;
++v50;
if ( v48 < v53 )
goto LABEL_42;
v24 = a1->m_sections.m_start[i];
}
v30 = 0;
v31 = 8 * ((unsigned int)(v29 - 1) + 1LL);
while ( 1 )
{
v32 = v28->m_start[v30 / 8];
if ( LevelEditorLayer::validGroup(a1, v32, 0)
&& v32->m_objectID == a2
&& v32->getRotation(v32) == x
&& v42 == v32->isFlipX(v32)
&& v41 == v32->isFlipY(v32) )
{
width = v32->m_obRect.size.width;
v34 = v32->getRScaleX(v32);
height = v32->m_obRect.size.height;
v36 = width * v34;
v37 = v32->getRScaleY(v32);
cocos2d::CCSize::CCSize(&v58, v36, height * v37);
v55 = v32->getPosition(v32)->x - (float)(v58.width * 0.5);
v38 = (__int64)v32->getPosition(v32);
cocos2d::CCRect::CCRect(&v62, v55, *(float *)(v38 + 4) - (float)(v58.height * 0.5), v58.width, v58.height);
v39 = v32->getPosition(v32);
cocos2d::CCPoint::CCPoint(&v61, v39);
LevelEditorLayer::getGridPos(a1, v64);
result = cocos2d::CCRect::containsPoint(&v62, v52);
if ( result && v56 == v59 && v57 == v60 )
return result;
}
v30 += 8LL;
if ( v30 == v31 )
goto LABEL_35;
}
}