//
// PlayerObject::convertToClosestRotation from 0x6253e0 to 0x6254dc (252 bytes)
//
// 4 xrefs:
// > PlayerObject::updateSlopeRotation @ 0x625bb8
// > PlayerObject::updateRotation @ 0x625d98
// > PlayerObject::updateMove @ 0x62bf0c
// > ??> @ 0x77388
//
// 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)
{
float v5; // s0
float i; // s1
if ( PlayerObject::isFlying(a1) || a1->m_isRobot || a1->m_isSpider || a1->m_isDashing )
return a2;
v5 = (float)((int)a1->getRotation(a1) % 360);
if ( a2 <= v5 )
{
i = a2;
if ( a2 < v5 )
{
while ( 1 )
{
a2 = a2 + 90.0;
if ( v5 <= a2 )
break;
i = a2;
}
}
}
else
{
for ( i = a2; ; i = a2 )
{
a2 = a2 - 90.0;
if ( v5 >= a2 )
break;
}
}
if ( vabds_f32(v5, a2) < vabds_f32(v5, i) )
return a2;
else
return i;
}