//
// PlayerObject::updateShipRotation from 0x10040c7f0 to 0x10040cba5 (949 bytes)
//
// 1 xrefs:
// > PlayerObject::updateRotation_1 @ 0x10040cc1c
//
// 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::updateShipRotation(PlayerObject *a1, float a2)
{
double *v2; // rsi
bool m_isDart; // r14
float v4; // xmm0_4
float v5; // xmm2_4
float v6; // xmm1_4
__m128 v7; // xmm0
__m128 v8; // xmm0
float v9; // xmm0_4
bool m_isBird; // al
float v11; // xmm2_4
float v12; // xmm1_4
bool m_isCollidingWithSlope; // cl
float v14; // xmm5_4
__m128 v15; // rt1
__int64 v16; // rdx
unsigned int *v17; // rsi
__m128 v18; // xmm2
float v19; // xmm2_4
float v20; // xmm4_4
float v21; // xmm0_4
__int64 v22; // [rsp-24h] [rbp-24h] BYREF
float v23; // [rsp-1Ch] [rbp-1Ch]
if ( !a1->m_isOnSlope && !a1->m_isDashing )
{
v23 = a2;
v2 = (double *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
sub_10028CC60(&v22, v2);
m_isDart = 1;
if ( *(_WORD *)&a1->m_isShip )
{
v4 = v23;
}
else
{
v4 = v23;
if ( !a1->m_isSwing )
m_isDart = a1->m_isDart;
}
v5 = 1.2 * v4;
if ( a1->m_isSideways )
{
v6 = m_isDart && a1->m_isGoingLeft
? fabs(*((float *)&v22 + 1) - a1->m_shipRotation.y)
: *((float *)&v22 + 1) - a1->m_shipRotation.y;
v7 = (__m128)(unsigned int)v22;
v7.f32[0] = *(float *)&v22 - a1->m_shipRotation.x;
}
else
{
v6 = m_isDart && a1->m_isGoingLeft
? fabs(*(float *)&v22 - a1->m_shipRotation.x)
: *(float *)&v22 - a1->m_shipRotation.x;
v8 = (__m128)HIDWORD(v22);
v8.f32[0] = *((float *)&v22 + 1) - a1->m_shipRotation.y;
v7 = _mm_xor_ps(v8, (__m128)xmmword_1008150B0);
}
if ( (float)((float)(v6 * v6) + (float)(v7.f32[0] * v7.f32[0])) >= v5
|| a1->m_isPlatformer && (a1->m_isShip || a1->m_isBird) )
{
v9 = atan2f(v7.f32[0], v6);
((void (__fastcall *)(PlayerObject *))a1->getRotation)(a1);
m_isBird = a1->m_isBird;
if ( m_isBird )
{
v11 = v9;
v12 = -0.40000001 * v9;
m_isCollidingWithSlope = a1->m_isCollidingWithSlope;
v14 = v23;
if ( !m_isCollidingWithSlope )
goto LABEL_27;
}
else
{
v11 = v9;
v12 = v9;
m_isCollidingWithSlope = a1->m_isCollidingWithSlope;
v14 = v23;
if ( !m_isCollidingWithSlope )
goto LABEL_27;
}
if ( m_isBird || a1->m_isShip || a1->m_isDart || (v12 = v11, a1->m_isSwing) )
v12 = 0.0;
LABEL_27:
if ( m_isDart && a1->m_isGoingLeft )
v12 = -v12;
v7.f32[0] = v9 * 0.017453292;
if ( m_isBird )
{
if ( a1->m_isGoingLeft == a1->m_isUpsideDown )
v12 = fmaxf(v12, -0.1);
else
v12 = fminf(v12, 0.1);
v18 = (__m128)0x3D8F5C29u;
if ( a1->m_isPlatformer && (fabs(a1->m_platformerXVelocity) <= 0.5 || a1->m_isOnGround2) )
v12 = 0.0;
goto LABEL_57;
}
if ( a1->m_isDart )
{
v15.i32[0] = LODWORD(a1->m_vehicleSize);
v16 = _mm_cvtsi128_si32((__m128i)_mm_cmpeq_ss((__m128)0x3F800000u, v15)) & 1;
v17 = (unsigned int *)&unk_10081B708;
}
else
{
v18 = (__m128)0x3E19999Au;
if ( !a1->m_isPlatformer || !a1->m_isShip )
goto LABEL_57;
if ( !a1->m_holdingLeft && !a1->m_holdingRight && !a1->m_platformerMovingLeft && !a1->m_platformerMovingRight )
{
v12 = 0.0;
v18 = (__m128)0x3D75C28Fu;
LABEL_57:
if ( m_isCollidingWithSlope && (a1->m_isShip || m_isBird || a1->m_isDart || a1->m_isSwing) )
v18.f32[0] = v18.f32[0] * 0.25;
v18.f32[0] = fminf(v18.f32[0] * v14, v14);
v21 = sub_1002834E0(v7, v12, v18);
((void (__fastcall *)(PlayerObject *, float))a1->setRotation)(a1, v21 * 57.29578);
return;
}
if ( a1->m_isGoingLeft )
v19 = -1.0;
else
v19 = 1.0;
if ( a1->m_isUpsideDown != a1->m_isSideways )
v19 = -v19;
v12 = 0.52359879 * v19;
v20 = fabs(0.52359879 * v19) - fabs(v7.f32[0]);
v16 = v20 < 0.1;
v17 = (unsigned int *)&unk_10081B700;
if ( v20 < 0.1 )
v12 = v19 * 0.78539819;
}
v18 = (__m128)v17[v16];
goto LABEL_57;
}
}
}