//
// GJSmartTemplate::smartObjectToType from 0x9d1618 to 0x9d18bc (676 bytes)
//
// 12 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x6b3cd0
// > GJSmartTemplate::offsetForObject @ 0x9d190c
// > GJSmartTemplate::keyFromNeighbors @ 0x9d444c
// > GJSmartTemplate::keyFromNeighbors @ 0x9d44c4
// > GJSmartTemplate::keyFromNeighbors @ 0x9d4510
// > GJSmartTemplate::keyFromNeighbors @ 0x9d4560
// > GJSmartTemplate::keyFromNeighbors @ 0x9d45b0
// > GJSmartTemplate::keyFromNeighbors @ 0x9d45f4
// > GJSmartTemplate::keyFromNeighbors @ 0x9d462c
// > GJSmartTemplate::keyFromNeighbors @ 0x9d4664
// > GJSmartTemplate::keyFromNeighbors @ 0x9d469c
// > ??> @ 0xb12d0
//
// 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!
SmartBlockType GJSmartTemplate::smartObjectToType(SmartGameObject *a1, cocos2d::CCPoint a2)
{
cocos2d::CCPoint *v2; // x1
cocos2d::CCPoint *v4; // x21
int m_objectID; // w1
SmartBlockType v6; // w20
float v8; // s0
_BOOL4 v9; // w0
float y; // s8
float v11; // s8
float v12; // s8
float x; // s8
v4 = v2;
if ( !a1 )
{
LABEL_10:
v6 = 48;
LABEL_7:
cocos2d::CCPoint::equals(v4, &stru_1243E08);
return v6;
}
m_objectID = a1->m_objectID;
if ( m_objectID == 2896 )
{
v6 = 48;
switch ( a1->m_slopeDirection )
{
case 0:
case 7:
v6 = NormalSlope1;
break;
case 1:
case 5:
v6 = NormalSlope3;
break;
case 2:
case 4:
v6 = NormalSlope2;
break;
case 3:
case 6:
v6 = NormalSlope4;
break;
default:
goto LABEL_7;
}
goto LABEL_7;
}
if ( m_objectID != 2897 )
{
if ( m_objectID == 2895 )
v6 = Block;
else
v6 = 48;
goto LABEL_7;
}
v8 = fabsf(
((float (__fastcall *)(SmartGameObject *, long double, long double))a1->getRotation)(
a1,
*(long double *)&a2.x,
*(long double *)&a2.y));
v9 = v8 == 270.0 || v8 == 90.0;
switch ( a1->m_slopeDirection )
{
case 0:
case 7:
v6 = WideSlope1;
if ( !v9 )
goto LABEL_37;
v6 = WideSlope9;
goto LABEL_19;
case 1:
case 5:
v6 = WideSlope5;
if ( v9 )
{
v6 = WideSlope13;
goto LABEL_25;
}
LABEL_37:
if ( !(unsigned __int8)cocos2d::CCPoint::equals(v4, &stru_1243E08) )
{
x = v4->x;
if ( x > a1->getPosition(a1)->x )
{
if ( v6 == WideSlope1 )
v6 = WideSlope2;
else
v6 = WideSlope6;
}
}
break;
case 2:
case 4:
v6 = WideSlope3;
if ( !v9 )
goto LABEL_33;
v6 = WideSlope11;
LABEL_19:
if ( !(unsigned __int8)cocos2d::CCPoint::equals(v4, &stru_1243E08) )
{
y = v4->y;
if ( y < a1->getPosition(a1)->y )
{
if ( v6 == WideSlope9 )
return WideSlope10;
else
return WideSlope12;
}
}
return v6;
case 3:
case 6:
v6 = WideSlope7;
if ( v9 )
{
v6 = WideSlope15;
LABEL_25:
if ( !(unsigned __int8)cocos2d::CCPoint::equals(v4, &stru_1243E08) )
{
v11 = v4->y;
if ( v11 > a1->getPosition(a1)->y )
{
if ( v6 == WideSlope13 )
v6 = WideSlope14;
else
v6 = WideSlope16;
}
}
}
else
{
LABEL_33:
if ( !(unsigned __int8)cocos2d::CCPoint::equals(v4, &stru_1243E08) )
{
v12 = v4->x;
if ( v12 < a1->getPosition(a1)->x )
{
if ( v6 == WideSlope3 )
v6 = WideSlope4;
else
v6 = WideSlope8;
}
}
}
break;
default:
goto LABEL_10;
}
return v6;
}