//
// GJSmartTemplate::smartObjectToType from 0x100426540 to 0x100426784 (580 bytes)
//
// 11 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x10004145f
// > GJSmartTemplate::keyFromNeighbors @ 0x100425f97
// > GJSmartTemplate::keyFromNeighbors @ 0x100425ff9
// > GJSmartTemplate::keyFromNeighbors @ 0x100426063
// > GJSmartTemplate::keyFromNeighbors @ 0x1004260ca
// > GJSmartTemplate::keyFromNeighbors @ 0x100426126
// > GJSmartTemplate::keyFromNeighbors @ 0x10042618d
// > GJSmartTemplate::keyFromNeighbors @ 0x1004261ea
// > GJSmartTemplate::keyFromNeighbors @ 0x10042624a
// > GJSmartTemplate::keyFromNeighbors @ 0x1004262aa
// > GJSmartTemplate::offsetForObject @ 0x10042650e
//
// 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; // rsi
SmartBlockType v3; // ebx
int m_objectID; // eax
unsigned __int64 m_slopeDirection; // rax
__m128 v6; // xmm0
__m128 v7; // xmm0
char v8; // cl
float v10; // [rsp+0h] [rbp-1Ch]
float v11; // [rsp+0h] [rbp-1Ch]
float v12; // [rsp+0h] [rbp-1Ch]
float v13; // [rsp+0h] [rbp-1Ch]
v3 = 48;
if ( a1 )
{
m_objectID = a1->m_objectID;
switch ( m_objectID )
{
case 2897:
*(double *)v6.i64 = ((double (__fastcall *)(SmartGameObject *, double))a1->getRotation)(a1, *(double *)&a2);
v7 = _mm_and_ps(v6, (__m128)xmmword_100815500);
v8 = _mm_cvtsi128_si32((__m128i)_mm_or_ps(
_mm_cmpeq_ps((__m128)0x42B40000u, v7),
_mm_cmpeq_ps((__m128)0x43870000u, v7)));
switch ( a1->m_slopeDirection )
{
case 0:
case 7:
v3 = WideSlope1;
if ( (v8 & 1) != 0 )
v3 = WideSlope9;
break;
case 1:
case 5:
v3 = 8 * (v8 & 1) + 65;
break;
case 2:
case 4:
v3 = WideSlope3;
if ( (v8 & 1) != 0 )
v3 = WideSlope11;
break;
case 3:
case 6:
v3 = 8 * (v8 & 1) + 67;
break;
default:
goto LABEL_17;
}
break;
case 2896:
m_slopeDirection = (unsigned int)a1->m_slopeDirection;
if ( m_slopeDirection < 8 )
v3 = *(_DWORD *)&a2_2[4 * m_slopeDirection];
break;
case 2895:
v3 = Block;
break;
}
}
LABEL_17:
if ( !sub_10028CDB0(v2, (float *)&dbl_1009A15B8) )
{
switch ( v3 )
{
case WideSlope1:
case WideSlope5:
v10 = *v2;
if ( v10 > *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) )
{
if ( v3 == WideSlope5 )
{
v3 = WideSlope6;
}
else if ( v3 == WideSlope1 )
{
v3 = WideSlope2;
}
}
break;
case WideSlope3:
case WideSlope7:
v13 = *v2;
if ( *(float *)((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) > v13 )
{
if ( v3 == WideSlope7 )
{
v3 = WideSlope8;
}
else if ( v3 == WideSlope3 )
{
v3 = WideSlope4;
}
}
break;
case WideSlope9:
case WideSlope11:
v12 = v2[1];
if ( *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) > v12 )
{
if ( v3 == WideSlope11 )
{
v3 = WideSlope12;
}
else if ( v3 == WideSlope9 )
{
v3 = WideSlope10;
}
}
break;
case WideSlope13:
case WideSlope15:
v11 = v2[1];
if ( v11 > *(float *)(((__int64 (__fastcall *)(SmartGameObject *))a1->getPosition)(a1) + 4) )
{
if ( v3 == WideSlope15 )
{
v3 = WideSlope16;
}
else if ( v3 == WideSlope13 )
{
v3 = WideSlope14;
}
}
break;
default:
return v3;
}
}
return v3;
}