//
// GJBaseGameLayer::convertToClosestDirection from 0x594aa0 to 0x594b32 (146 bytes)
//
// 9 xrefs:
// > PlayLayer::updateScreenRotation @ 0x3fff26
// > PlayerObject::redirectPlayerForce @ 0x438c2c
// > PlayerObject::redirectDash @ 0x43a0b0
// > getRotateCommandAngleDelta @ 0x594c78
// > GJBaseGameLayer::updateScreenRotation @ 0x5b6904
// > GJBaseGameLayer::updateScreenRotation @ 0x5b6912
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bbef2
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bc37e
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bc3f0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:53:08 +0000
//
int __fastcall GJBaseGameLayer::convertToClosestDirection(GJBaseGameLayer *this, float a2, float a3)
{
float v4; // s17
float v5; // r0
float v6; // r0
v4 = *(float *)&this;
if ( *(float *)&this >= (float)-a2 )
{
if ( *(float *)&this > a2 )
{
v6 = floorf(fabsf(*(float *)&this) / a2);
v4 = v4 - (float)(ceilf(v6 * 0.5) * (float)(a2 + a2));
}
}
else
{
v5 = floorf(fabsf(*(float *)&this) / a2);
v4 = v4 + (float)(ceilf(v5 * 0.5) * (float)(a2 + a2));
}
return LODWORD(v4);
}