//
// GJBaseGameLayer::convertToClosestDirection from 0x474ff4 to 0x475086 (146 bytes)
//
// 9 xrefs:
// > PlayLayer::updateScreenRotation @ 0x3109fe
// > PlayerObject::redirectPlayerForce @ 0x3419fc
// > PlayerObject::redirectDash @ 0x342630
// > getRotateCommandAngleDelta @ 0x4751c8
// > GJBaseGameLayer::updateScreenRotation @ 0x485f64
// > GJBaseGameLayer::updateScreenRotation @ 0x485f72
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48a732
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48abba
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x48ac2c
//
// 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 GJBaseGameLayer::convertToClosestDirection(float a1, float a2)
{
float v3; // s17
float v4; // r0
float v5; // r0
v3 = a1;
if ( a1 >= (float)-a2 )
{
if ( a1 > a2 )
{
v5 = floorf(fabsf(a1) / a2);
return v3 - (float)(ceilf(v5 * 0.5) * (float)(a2 + a2));
}
}
else
{
v4 = floorf(fabsf(a1) / a2);
return v3 + (float)(ceilf(v4 * 0.5) * (float)(a2 + a2));
}
return v3;
}