//
// GJBaseGameLayer::convertToClosestDirection from 0x10028abe0 to 0x10028ac3c (92 bytes)
//
// 2 xrefs:
// > sub_1002C2774 @ 0x1002c27d4
// > sub_1002C9D20 @ 0x1002c9d80
//
// 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 11:02:00 +0000
//
float __fastcall GJBaseGameLayer::convertToClosestDirection(float result, float a2)
{
if ( (float)-a2 > result )
return result + (float)(ceilf(floorf(fabsf(result) / a2) * 0.5) * (float)(a2 + a2));
if ( result > a2 )
return result - (float)(ceilf(floorf(fabsf(result) / a2) * 0.5) * (float)(a2 + a2));
return result;
}