//
// GJBaseGameLayer::convertToClosestDirection from 0x100115da0 to 0x100115e1b (123 bytes)
//
// 3 xrefs:
// > PlayLayer::updateScreenRotation @ 0x1000837b9
// > PlayerObject::redirectDash @ 0x1003fdc56
// > PlayerObject::redirectPlayerForce @ 0x100408010
//
// This function is hookable on this platform (idp: pc, 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 12:24:33 +0000
//
float __fastcall GJBaseGameLayer::convertToClosestDirection(__m128 a1, float a2)
{
__m128 v2; // xmm2
__m128 v3; // xmm2
__m128 v4; // xmm2
__m128 v5; // xmm2
if ( (float)-a2 <= a1.f32[0] )
{
if ( a1.f32[0] > a2 )
{
v4 = _mm_and_ps((__m128)xmmword_100A038A0, a1);
v4.f32[0] = v4.f32[0] / a2;
v5 = _mm_round_ss(v4, v4, 9);
v5.f32[0] = v5.f32[0] * 0.5;
a1.f32[0] = a1.f32[0] - (float)((float)(a2 + a2) * _mm_round_ss(v5, v5, 10).f32[0]);
}
}
else
{
v2 = _mm_and_ps((__m128)xmmword_100A038A0, a1);
v2.f32[0] = v2.f32[0] / a2;
v3 = _mm_round_ss(v2, v2, 9);
v3.f32[0] = v3.f32[0] * 0.5;
a1.f32[0] = (float)((float)(a2 + a2) * _mm_round_ss(v3, v3, 10).f32[0]) + a1.f32[0];
}
return a1.f32[0];
}