//
// PlayerObject::convertToClosestRotation from 0x7511c0 to 0x7512bc (252 bytes)
//
// 4 xrefs:
// > PlayerObject::updateSlopeRotation @ 0x751980
// > PlayerObject::updateRotation @ 0x751b60
// > PlayerObject::updateMove @ 0x7584ac
// > ??> @ 0x9fa18
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:52:55 +0000
//
float __fastcall PlayerObject::convertToClosestRotation(PlayerObject *this, float a2)
{
int v5; // w0
float v6; // s0
float i; // s1
if ( (unsigned __int8)PlayerObject::isFlying(this)
|| *((_BYTE *)this + 2421)
|| *((_BYTE *)this + 2422)
|| *((_BYTE *)this + 2460) )
{
return a2;
}
v5 = (int)(*(float (__fastcall **)(PlayerObject *))(*(_QWORD *)this + 368LL))(this) % 360;
v6 = (float)v5;
if ( a2 <= (float)v5 )
{
i = a2;
if ( a2 < (float)v5 )
{
while ( 1 )
{
a2 = a2 + 90.0;
if ( v6 <= a2 )
break;
i = a2;
}
}
}
else
{
for ( i = a2; ; i = a2 )
{
a2 = a2 - 90.0;
if ( v6 >= a2 )
break;
}
}
if ( vabds_f32(v6, a2) < vabds_f32(v6, i) )
return a2;
else
return i;
}