//
// GJBaseGameLayer::convertToClosestDirection from 0x1001383d0 to 0x10013844b (123 bytes)
//
// 3 xrefs:
// > PlayLayer::updateScreenRotation @ 0x1000b5ef9
// > PlayerObject::redirectDash @ 0x100410b36
// > PlayerObject::redirectPlayerForce @ 0x10041b230
//
// 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
//
// local variable allocation has failed, the output may be wrong!
float __fastcall GJBaseGameLayer::convertToClosestDirection(float a1, float a2)
{
__m128 v2; // xmm2
__m128 v3; // xmm2
__m128 v4; // xmm2
__m128 v5; // xmm2
if ( (float)-a2 <= a1 )
{
if ( a1 > a2 )
{
v4 = _mm_and_ps((__m128)xmmword_100815500, *(__m128 *)&a1);
v4.f32[0] = v4.f32[0] / a2;
v5 = _mm_round_ss(v4, v4, 9);
v5.f32[0] = v5.f32[0] * 0.5;
return a1 - (float)((float)(a2 + a2) * _mm_round_ss(v5, v5, 10).f32[0]);
}
}
else
{
v2 = _mm_and_ps((__m128)xmmword_100815500, *(__m128 *)&a1);
v2.f32[0] = v2.f32[0] / a2;
v3 = _mm_round_ss(v2, v2, 9);
v3.f32[0] = v3.f32[0] * 0.5;
return (float)((float)(a2 + a2) * _mm_round_ss(v3, v3, 10).f32[0]) + a1;
}
return a1;
}