//
// PlayerObject::convertToClosestRotation from 0x14038d100 to 0x14038d214 (276 bytes)
//
// 5 xrefs:
// > PlayerObject::updateMove @ 0x14038b00a
// > PlayerObject::updateSlopeRotation @ 0x140390be5
// > PlayerObject::updateRotation_1 @ 0x14039107d
// > PlayerObject::updateRotation_1 @ 0x14039118c
// > ??> @ 0x1406d60b0
//
// 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 v2; // xmm6_4
float v3; // xmm3_4
float v4; // xmm2_4
v2 = a2;
if ( a1->m_isShip
|| a1->m_isBird
|| a1->m_isDart
|| a1->m_isSwing
|| a1->m_isRobot
|| a1->m_isSpider
|| a1->m_isDashing )
{
return v2;
}
v3 = a2;
v4 = (float)((int)a1->getRotation(a1) % 360);
if ( a2 <= v4 )
{
if ( v4 > a2 )
{
do
{
v3 = v2;
v2 = v2 + 90.0;
}
while ( v4 > v2 );
}
}
else
{
do
{
v3 = v2;
v2 = v2 + -90.0;
}
while ( v2 > v4 );
}
if ( fabs(v4 - v3) > fabs(v4 - v2) )
return v2;
else
return v3;
}