//
// GJSmartTemplate::smartObjectToType from 0x1402b3880 to 0x1402b3b0e (654 bytes)
//
// 13 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x140115ddc
// > EditorUI::createSmartObjectsFromTemplate @ 0x140116f6e
// > EditorUI::createSmartObjectsFromTemplate @ 0x1401170e6
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3da6
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3db6
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dc5
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dd4
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3de3
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3df2
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e00
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e0f
// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e2b
// > ??> @ 0x1406d23d8
//
// 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
//
SmartBlockType GJSmartTemplate::smartObjectToType(SmartGameObject *a1, cocos2d::CCPoint a2)
{
SmartBlockType v4; // ebx
int v5; // ecx
int v6; // ecx
float v7; // xmm0_4
bool v8; // dl
v4 = 48;
if ( a1 )
{
v5 = a1->m_objectID - 2895;
if ( v5 )
{
v6 = v5 - 1;
if ( v6 )
{
if ( v6 == 1 )
{
v7 = fabs(COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(SmartGameObject *))a1->getRotation)(a1))));
v8 = v7 == 90.0 || v7 == 270.0;
switch ( a1->m_slopeDirection )
{
case 0:
case 7:
v4 = WideSlope1;
if ( v8 )
v4 = WideSlope9;
break;
case 1:
case 5:
v4 = 8 * v8 + 65;
break;
case 2:
case 4:
v4 = WideSlope3;
if ( v8 )
v4 = WideSlope11;
break;
case 3:
case 6:
v4 = 8 * v8 + 67;
break;
default:
break;
}
}
}
else
{
switch ( a1->m_slopeDirection )
{
case 0:
case 7:
v4 = NormalSlope1;
break;
case 1:
case 5:
v4 = NormalSlope3;
break;
case 2:
case 4:
v4 = NormalSlope2;
break;
case 3:
case 6:
v4 = NormalSlope4;
break;
default:
break;
}
}
}
else
{
v4 = Block;
}
}
if ( !cocos2d::CCPoint::equals(*(const struct cocos2d::CCPoint **)&a2) )
{
switch ( v4 )
{
case WideSlope1:
case WideSlope5:
if ( **(float **)&a2 > a1->getPosition_0(a1)->x )
{
if ( v4 == WideSlope1 )
{
v4 = WideSlope2;
}
else if ( v4 == WideSlope5 )
{
v4 = WideSlope6;
}
}
break;
case WideSlope3:
case WideSlope7:
if ( a1->getPosition_0(a1)->x > **(float **)&a2 )
{
if ( v4 == WideSlope3 )
{
v4 = WideSlope4;
}
else if ( v4 == WideSlope7 )
{
v4 = WideSlope8;
}
}
break;
case WideSlope9:
case WideSlope11:
if ( a1->getPosition_0(a1)->y > *(float *)(*(_QWORD *)&a2 + 4LL) )
{
if ( v4 == WideSlope9 )
{
v4 = WideSlope10;
}
else if ( v4 == WideSlope11 )
{
v4 = WideSlope12;
}
}
break;
case WideSlope13:
case WideSlope15:
if ( *(float *)(*(_QWORD *)&a2 + 4LL) > a1->getPosition_0(a1)->y )
{
if ( v4 == WideSlope13 )
{
v4 = WideSlope14;
}
else if ( v4 == WideSlope15 )
{
v4 = WideSlope16;
}
}
break;
default:
return v4;
}
}
return v4;
}