//
// PlayerObject::convertToClosestRotation from 0x33efd8 to 0x33f096 (190 bytes)
//
// 3 xrefs:
// > PlayerObject::updateSlopeRotation @ 0x33f60e
// > PlayerObject::updateRotation @ 0x33f768
// > PlayerObject::updateMove @ 0x343be4
//
// 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
//
float PlayerObject::convertToClosestRotation(PlayerObject *a1, float a2)
{
int v4; // r1
float v5; // s15
float i; // s14
if ( !PlayerObject::isFlying(a1) && !a1->m_isRobot && !a1->m_isSpider && !a1->m_isDashing )
{
v4 = (int)a1->getRotation(a1) % 360;
v5 = (float)v4;
if ( a2 <= (float)v4 )
{
i = a2;
if ( a2 < (float)v4 )
{
while ( 1 )
{
a2 = a2 + 90.0;
if ( a2 >= v5 )
break;
i = a2;
}
}
}
else
{
for ( i = a2; ; i = a2 )
{
a2 = a2 - 90.0;
if ( a2 <= v5 )
break;
}
}
if ( fabsf(v5 - a2) >= fabsf(v5 - i) )
return i;
}
return a2;
}