//
// PlayerObject::convertToClosestRotation from 0x1404eb3b0 to 0x1404eb4c4 (276 bytes)
//
// 6 xrefs:
// > PlayerObject::updateMove @ 0x1404e924d
// > PlayerObject::updateSlopeRotation @ 0x1404eef45
// > PlayerObject::updateRotation_1 @ 0x1404ef3f3
// > PlayerObject::updateRotation_1 @ 0x1404ef4db
// > ??> @ 0x140929d5c
// > ??> @ 0x140929d68
//
// 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 11:33:13 +0000
//
// local variable allocation has failed, the output may be wrong!
__m128 __fastcall PlayerObject::convertToClosestRotation(_BYTE *a1, double a2)
{
__int128 v2; // xmm6
__int128 v3; // xmm3
float v4; // xmm2_4
v2 = *(_OWORD *)&a2;
if ( a1[2497] || a1[2498] || a1[2500] || a1[2508] || a1[2501] || a1[2502] || a1[2540] )
return (__m128)v2;
v3 = *(_OWORD *)&a2;
v4 = (float)((int)(*(float (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 360LL))(a1) % 360);
if ( *(float *)&a2 <= v4 )
{
if ( v4 > *(float *)&a2 )
{
do
{
v3 = v2;
*(float *)&v2 = *(float *)&v2 + 90.0;
}
while ( v4 > *(float *)&v2 );
}
}
else
{
do
{
v3 = v2;
*(float *)&v2 = *(float *)&v2 + -90.0;
}
while ( *(float *)&v2 > v4 );
}
if ( fabs(v4 - *(float *)&v3) > fabs(v4 - *(float *)&v2) )
return (__m128)v2;
else
return (__m128)v3;
}