//
// GJBaseGameLayer::convertToClosestDirection from 0x8634c8 to 0x863524 (92 bytes)
//
// 10 xrefs:
// > PlayLayer::updateScreenRotation @ 0x5cc064
// > PlayerObject::redirectPlayerForce @ 0x629248
// > PlayerObject::redirectDash @ 0x62a5b0
// > getRotateCommandAngleDelta @ 0x8636ac
// > GJBaseGameLayer::updateScreenRotation @ 0x87d70c
// > GJBaseGameLayer::updateScreenRotation @ 0x87d71c
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x883e78
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x884168
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x884624
// > ??> @ 0x56f70
//
// 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)
{
if ( (float)-a2 > a1 )
return a1 + (float)(ceilf(floorf(fabsf(a1) / a2) * 0.5) * (float)(a2 + a2));
if ( a2 < a1 )
return a1 - (float)(ceilf(floorf(fabsf(a1) / a2) * 0.5) * (float)(a2 + a2));
return a1;
}