//
// GJSmartTemplate::smartObjectToType from 0x1000075d8 to 0x1000078a0 (712 bytes)
//
// 11 xrefs:
// > GJSmartTemplate::keyFromNeighbors @ 0x100007168
// > GJSmartTemplate::keyFromNeighbors @ 0x100007198
// > GJSmartTemplate::keyFromNeighbors @ 0x1000071c8
// > GJSmartTemplate::keyFromNeighbors @ 0x1000071f8
// > GJSmartTemplate::keyFromNeighbors @ 0x100007228
// > GJSmartTemplate::keyFromNeighbors @ 0x100007258
// > GJSmartTemplate::keyFromNeighbors @ 0x100007288
// > GJSmartTemplate::keyFromNeighbors @ 0x1000072b8
// > GJSmartTemplate::keyFromNeighbors @ 0x1000072e8
// > GJSmartTemplate::offsetForObject @ 0x1000075a0
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f0ba8
//
// 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 __fastcall GJSmartTemplate::smartObjectToType(SmartGameObject *a1, cocos2d::CCPoint a2)
{
float *v2; // x1
float *v3; // x21
int m_objectID; // w8
int v6; // w9
bool v7; // zf
int v8; // w8
SmartBlockType v9; // w19
__int64 m_slopeDirection; // x8
float v12; // s8
_BOOL4 v13; // w8
int v14; // w9
float v15; // s8
float v16; // s8
float v17; // s8
v3 = v2;
if ( !a1 )
goto LABEL_10;
m_objectID = a1->m_objectID;
if ( m_objectID != 2897 )
{
if ( m_objectID != 2896 )
{
v6 = 48;
v7 = m_objectID == 2895;
v8 = 49;
goto LABEL_5;
}
m_slopeDirection = (unsigned int)a1->m_slopeDirection;
if ( (unsigned int)m_slopeDirection < 8 )
{
v9 = *(_DWORD *)&a2_3[4 * m_slopeDirection];
goto LABEL_11;
}
LABEL_10:
v9 = 48;
goto LABEL_11;
}
a2.x = fabsf(
((float (__fastcall *)(SmartGameObject *, __n128, __n128))a1->getRotation)(
a1,
*(__n128 *)&a2.x,
*(__n128 *)&a2.y));
a2.y = 270.0;
v13 = a2.x == 270.0 || a2.x == 90.0;
v14 = a1->m_slopeDirection;
v9 = 48;
if ( v14 > 3 )
{
if ( v14 > 5 )
{
if ( v14 != 6 )
{
if ( v14 != 7 )
goto LABEL_11;
LABEL_52:
v7 = !v13;
v8 = 54;
v6 = 69;
goto LABEL_5;
}
goto LABEL_54;
}
if ( v14 != 4 )
{
LABEL_47:
v7 = !v13;
v8 = 65;
v6 = 73;
goto LABEL_5;
}
LABEL_53:
v7 = !v13;
v8 = 56;
v6 = 71;
goto LABEL_5;
}
if ( v14 <= 1 )
{
if ( v14 )
{
if ( v14 != 1 )
goto LABEL_11;
goto LABEL_47;
}
goto LABEL_52;
}
if ( v14 == 2 )
goto LABEL_53;
LABEL_54:
v7 = !v13;
v8 = 67;
v6 = 75;
LABEL_5:
if ( v7 )
v9 = v8;
else
v9 = v6;
LABEL_11:
if ( (sub_100022A5C(v3, &unk_10086A2C0, *(__n128 *)&a2.x, *(__n128 *)&a2.y) & 1) != 0 )
return v9;
if ( v9 > WideSlope8 )
{
if ( v9 > WideSlope12 )
{
if ( v9 == WideSlope13 || v9 == WideSlope15 )
{
v16 = v3[1];
if ( v16 > *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) )
{
if ( v9 == WideSlope15 )
return WideSlope16;
else
return WideSlope14;
}
}
}
else if ( v9 == WideSlope9 || v9 == WideSlope11 )
{
v12 = v3[1];
if ( v12 < *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) )
{
if ( v9 == WideSlope11 )
return WideSlope12;
else
return WideSlope10;
}
}
}
else
{
if ( v9 > 64 )
{
if ( v9 != WideSlope5 )
{
if ( v9 != WideSlope7 )
return v9;
goto LABEL_34;
}
}
else if ( v9 != WideSlope1 )
{
if ( v9 != WideSlope3 )
return v9;
LABEL_34:
v15 = *v3;
if ( v15 < *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) )
{
if ( v9 == WideSlope7 )
return WideSlope8;
else
return WideSlope4;
}
return v9;
}
v17 = *v3;
if ( v17 > *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) )
{
if ( v9 == WideSlope5 )
return WideSlope6;
else
return WideSlope2;
}
}
return v9;
}