//
// GameObject::determineSlopeDirection from 0x1005be080 to 0x1005be29d (541 bytes)
//
// 13 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x1000413c5
// > EditorUI::createSmartObjectsFromTemplate @ 0x100042b0a
// > EditorUI::createSmartObjectsFromTemplate @ 0x100042c7c
// > PlayLayer::addObject @ 0x1000b1fd4
// > LevelEditorLayer::addSpecial @ 0x1000e0063
// > LevelEditorLayer::rotationForSlopeNearObject @ 0x1000e0baf
// > LevelEditorLayer::onPlaytest @ 0x1000f2483
// > GJBaseGameLayer::updateDebugDraw @ 0x100121cb6
// > RotateGameplayGameObject::updateGameplayRotation @ 0x1001f3939
// > RotateGameplayGameObject::updateStartValues @ 0x1001f3991
// > PlayerObject::rotateGameplayObject @ 0x100406ed9
// > PlayerObject::unrotateGameplayObject @ 0x10040b5d7
// > GameObject::getObjectDirection @ 0x1005be2e9
//
// 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 __fastcall GameObject::determineSlopeDirection(GameObject *a1)
{
unsigned __int8 v2; // r14
unsigned __int8 v3; // r15
int v4; // eax
int v5; // ecx
float v6; // xmm0_4
unsigned __int8 v7; // r9
char v8; // di
unsigned __int8 v9; // r10
char v10; // dl
char v11; // si
char v12; // r14
v2 = ((__int64 (__fastcall *)(GameObject *))a1->isFlipX)(a1);
v3 = ((__int64 (__fastcall *)(GameObject *))a1->isFlipY)(a1);
v4 = (int)((float (__fastcall *)(GameObject *))a1->getObjectRotation)(a1) % 360;
a1->m_slopeUphill = 0;
v5 = 0;
if ( !v2 && !(v3 | (v4 != 0)) )
goto LABEL_5;
v6 = fabs((float)v4);
v7 = v2 ^ 1;
v8 = v3 ^ 1 | v2 ^ 1;
if ( (v8 & 1) == 0 && v6 == 180.0 )
goto LABEL_5;
v9 = v3 & (v4 == 0);
v5 = 1;
if ( (v9 & v7) != 0 )
goto LABEL_6;
v10 = v3 | v7;
if ( ((v3 | v7) & 1) == 0 && v6 == 180.0 )
goto LABEL_6;
v5 = 2;
if ( !(v3 & 1 | (v4 != 0) | v7 & 1) )
goto LABEL_6;
v11 = v2 | v3 ^ 1;
if ( (v11 & 1) == 0 && v6 == 180.0 )
goto LABEL_6;
v5 = 3;
if ( (v9 & v2) != 0 )
goto LABEL_5;
v12 = v3 | v2;
if ( (v12 & 1) == 0 && v6 == 180.0 )
goto LABEL_5;
if ( (v12 & 1) == 0 )
{
v5 = 4;
if ( v4 == -270 || v4 == 90 )
goto LABEL_6;
}
if ( (v8 & 1) == 0 )
{
v5 = 4;
if ( v4 == -90 || v4 == 270 )
goto LABEL_6;
}
if ( (v12 & 1) == 0 )
{
v5 = 5;
if ( v4 == -90 || v4 == 270 )
goto LABEL_6;
}
if ( (v8 & 1) == 0 )
{
v5 = 5;
if ( v4 == -270 || v4 == 90 )
goto LABEL_6;
}
if ( (v10 & 1) == 0 )
{
v5 = 6;
if ( v4 == -270 || v4 == 90 )
goto LABEL_5;
}
if ( (v11 & 1) == 0 )
{
v5 = 6;
if ( v4 > 89 )
{
if ( v4 != 90 )
{
if ( v4 != 270 )
goto LABEL_33;
goto LABEL_5;
}
}
else if ( v4 != -270 )
{
if ( v4 != -90 )
goto LABEL_33;
LABEL_5:
a1->m_slopeUphill = 1;
LABEL_6:
a1->m_slopeDirection = v5;
return;
}
LABEL_44:
v5 = 7;
goto LABEL_5;
}
LABEL_33:
if ( (v10 & 1) == 0 && (v4 == 270 || v4 == -90) )
goto LABEL_44;
}