//
// PlayerObject::convertToClosestRotation from 0x1003efbf0 to 0x1003efd07 (279 bytes)
//
// 1 xrefs:
// > PlayerObject::updateRotation_1 @ 0x1003f9e75
//
// 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:29:53 +0000
//
__m128 __fastcall PlayerObject::convertToClosestRotation(_BYTE *a1, __m128 result)
{
int v2; // eax
__m128 v3; // xmm4
signed int v4; // eax
__m128 v5; // xmm0
__m128 v6; // xmm1
__m128 v7; // xmm2
__m128 v8; // xmm2
__m128 v9; // [rsp-18h] [rbp-18h]
if ( !a1[2417] && !a1[2418] && !a1[2420] && !a1[2428] && !a1[2421] && !a1[2422] && !a1[2460] )
{
v9 = result;
v2 = (int)(*(float (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 368LL))(a1);
if ( v2 < 0 )
v4 = 360 * (-v2 / 0x168u) + v2;
else
v4 = v2 % 0x168u;
v5 = v9;
v3.f32[0] = (float)v4;
if ( v9.f32[0] <= (float)v4 )
{
if ( v3.f32[0] <= v9.f32[0] )
{
v6 = v9;
}
else
{
do
{
v6 = v5;
v5.f32[0] = v5.f32[0] + 90.0;
}
while ( v3.f32[0] > v5.f32[0] );
}
}
else
{
do
{
v6 = v5;
v5.f32[0] = v5.f32[0] + -90.0;
}
while ( v5.f32[0] > v3.f32[0] );
}
v7 = v3;
v7.f32[0] = v3.f32[0] - v5.f32[0];
v3.f32[0] = v3.f32[0] - v6.f32[0];
v8 = _mm_cmplt_ss(_mm_and_ps(v7, (__m128)xmmword_100A038A0), _mm_and_ps(v3, (__m128)xmmword_100A038A0));
return _mm_or_ps(_mm_and_ps(v5, v8), _mm_andnot_ps(v8, v6));
}
return result;
}