//
// PlayerObject::updateSlopeRotation from 0x10040c660 to 0x10040c7d4 (372 bytes)
//
// 2 xrefs:
// > PlayerObject::collidedWithSlopeInternal @ 0x100408578
// > PlayerObject::updateRotation_1 @ 0x10040cbea
//
// 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
//
void __fastcall PlayerObject::updateSlopeRotation(PlayerObject *a1, float a2)
{
__m128 v2; // xmm1
int v3; // eax
signed int v4; // eax
__m128 v5; // xmm0
__m128 v6; // xmm4
__m128 v7; // xmm2
__m128 v8; // xmm0
__m128 v9; // xmm2
float v10; // [rsp+14h] [rbp-Ch]
v2 = (__m128)*(unsigned __int64 *)&a1->m_slopeRotation;
*(double *)v2.i64 = *(double *)v2.i64 * 57.29578018188477;
v2.f32[0] = *(double *)v2.i64;
if ( !a1->m_isShip
&& !a1->m_isBird
&& !a1->m_isDart
&& !a1->m_isSwing
&& !a1->m_isRobot
&& !a1->m_isSpider
&& !a1->m_isDashing )
{
v10 = a2;
v3 = (int)((float (*)(void))a1->getRotation)();
if ( v3 < 0 )
v4 = 360 * (-v3 / 0x168u) + v3;
else
v4 = v3 % 0x168u;
v5 = 0;
v5.f32[0] = (float)v4;
if ( v2.f32[0] <= (float)v4 )
{
if ( v5.f32[0] <= v2.f32[0] )
{
v6 = v2;
}
else
{
do
{
v6 = v2;
v2.f32[0] = v2.f32[0] + 90.0;
}
while ( v5.f32[0] > v2.f32[0] );
}
}
else
{
do
{
v6 = v2;
v2.f32[0] = v2.f32[0] + -90.0;
}
while ( v2.f32[0] > v5.f32[0] );
}
v7 = v5;
v7.f32[0] = v5.f32[0] - v2.f32[0];
v8.i32[0] = fabs(v5.f32[0] - v6.f32[0]);
v9 = _mm_cmplt_ss(_mm_and_ps(v7, (__m128)xmmword_100815500), v8);
v2.i32[0] = v2.i32[0] & v9.i32[0] | _mm_andnot_ps(v9, v6).u32[0];
a2 = v10;
}
if ( a1->m_isPlatformer
&& a1->m_maybeChangedDirectionAngle > 80.0
&& (a1->m_platformerMovingLeft || a1->m_platformerMovingRight) )
{
v2.i32[0] = 0;
}
PlayerObject::updateRotation(a1, a2, v2.f32[0]);
}