//
// GameObject::determineSlopeDirection from 0x645c5c to 0x645ea0 (580 bytes)
//
// 12 xrefs:
// > PlayLayer::addObject @ 0x5cc7d8
// > PlayerObject::rotateGameplayObject @ 0x633b8c
// > PlayerObject::unrotateGameplayObject @ 0x633e54
// > GameObject::getObjectDirection @ 0x645f24
// > LevelEditorLayer::rotationForSlopeNearObject @ 0x65ecf0
// > LevelEditorLayer::onPlaytest @ 0x664534
// > LevelEditorLayer::addSpecial @ 0x670648
// > EditorUI::addObjectsToSmartTemplate @ 0x6b461c
// > EditorUI::createSmartObjectsFromTemplate @ 0x6c2318
// > RotateGameplayGameObject::updateGameplayRotation @ 0x76ef3c
// > GJBaseGameLayer::updateDebugDraw @ 0x854f20
// > ??> @ 0xa33f8
//
// 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
//
void GameObject::determineSlopeDirection(GameObject *a1)
{
unsigned int v2; // w20
unsigned int v3; // w21
float v4; // s0
float v5; // s0
_BOOL4 v6; // w1
_BOOL4 v7; // w0
_BOOL4 v8; // w4
_BOOL4 v9; // w3
_BOOL4 v10; // w4
_BOOL4 v11; // w3
v2 = a1->isFlipX(a1);
v3 = a1->isFlipY(a1);
v4 = a1->getObjectRotation(a1);
a1->m_slopeUphill = 0;
v5 = (float)((int)v4 % 360);
v6 = fabsf(v5) == 180.0;
v7 = v5 == 0.0;
if ( v5 == 0.0 && v2 < (v3 ^ 1) )
goto LABEL_3;
if ( (v3 & v2) == 0 )
{
if ( v5 == 0.0 && v2 < v3 )
goto LABEL_14;
if ( v2 <= v3 )
{
if ( !v6 || v2 >= v3 )
{
v7 = v2 < v3;
goto LABEL_18;
}
}
else
{
if ( v6 )
{
LABEL_14:
a1->m_slopeDirection = 1;
return;
}
if ( v5 != 0.0 )
{
LABEL_18:
v10 = v5 == 90.0 || v5 == -270.0;
v11 = v5 == -90.0 || v5 == 270.0;
if ( v2 >= (v3 ^ 1) )
{
if ( v10 && v2 > v3 )
goto LABEL_39;
}
else
{
if ( v6 )
goto LABEL_26;
if ( v10 )
goto LABEL_29;
if ( v11 )
{
LABEL_22:
a1->m_slopeDirection = 5;
return;
}
}
if ( !v7 )
{
if ( !v11 || v2 <= v3 )
return;
LABEL_33:
a1->m_slopeUphill = 1;
a1->m_slopeDirection = 7;
return;
}
if ( !v11 )
{
if ( !v10 )
return;
goto LABEL_33;
}
LABEL_39:
a1->m_slopeUphill = 1;
a1->m_slopeDirection = 6;
return;
}
}
a1->m_slopeDirection = 2;
return;
}
if ( v6 )
{
LABEL_3:
a1->m_slopeDirection = 0;
a1->m_slopeUphill = 1;
return;
}
v8 = v5 == 90.0 || v5 == -270.0;
v9 = v5 == -90.0 || v5 == 270.0;
if ( v5 == 0.0 )
{
LABEL_26:
a1->m_slopeUphill = 1;
a1->m_slopeDirection = 3;
return;
}
if ( v2 < (v3 ^ 1) )
{
if ( !v8 && !v9 )
return;
LABEL_29:
a1->m_slopeDirection = 4;
return;
}
if ( v9 )
goto LABEL_29;
if ( v8 )
goto LABEL_22;
}