//
// PlayerObject::updateShipRotation from 0x625660 to 0x6259ec (908 bytes)
//
// 2 xrefs:
// > PlayerObject::updateRotation @ 0x625d30
// > ??> @ 0x4ba68
//
// 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 PlayerObject::updateShipRotation(PlayerObject *a1, float a2)
{
const cocos2d::CCPoint *v4; // x0
int v5; // w21
float v6; // s10
float v7; // s9
float v8; // s10
float v9; // s0
_BOOL4 m_isBird; // w0
float v11; // s0
float v12; // s9
float v13; // s2
float v14; // s0
int v15; // s1
bool isFlying; // w0
bool v17; // w0
int v18; // w0
float v19; // s3
float v20; // s3
float v21; // [xsp+50h] [xbp+50h]
float v22; // [xsp+50h] [xbp+50h]
float v23; // [xsp+50h] [xbp+50h]
cocos2d::CCPoint v24; // [xsp+60h] [xbp+60h] BYREF
if ( a1->m_isOnSlope || a1->m_isDashing )
return;
v4 = a1->getPosition(a1);
cocos2d::CCPoint::CCPoint(&v24, v4);
if ( !a1->m_isBird && !a1->m_isShip && !a1->m_isSwing && !a1->m_isDart )
{
v5 = 0;
if ( !a1->m_isSideways )
goto LABEL_9;
goto LABEL_33;
}
if ( a1->m_isSideways )
{
v5 = 1;
if ( a1->m_isGoingLeft )
{
v6 = vabds_f32(v24.y, a1->m_shipRotation.y);
goto LABEL_34;
}
LABEL_33:
v6 = v24.y - a1->m_shipRotation.y;
LABEL_34:
v7 = v24.x - a1->m_shipRotation.x;
goto LABEL_11;
}
v5 = 1;
if ( a1->m_isGoingLeft )
{
v6 = vabds_f32(v24.x, a1->m_shipRotation.x);
goto LABEL_10;
}
LABEL_9:
v6 = v24.x - a1->m_shipRotation.x;
LABEL_10:
v7 = -(float)(v24.y - a1->m_shipRotation.y);
LABEL_11:
if ( (float)(a2 * 1.2) > SquareDistance(0.0, 0.0, v6, v7) && (!a1->m_isPlatformer || !a1->m_isShip && !a1->m_isBird) )
return;
v8 = atan2(v7, v6);
a1->getRotation(a1);
m_isBird = a1->m_isBird;
if ( a1->m_isBird )
v8 = v8 * -0.4;
if ( !a1->m_isCollidingWithSlope )
{
if ( !v5 )
goto LABEL_21;
goto LABEL_19;
}
v21 = v9;
isFlying = PlayerObject::isFlying(a1);
v9 = v21;
if ( isFlying )
v8 = 0.0;
m_isBird = a1->m_isBird;
if ( v5 )
{
LABEL_19:
if ( a1->m_isGoingLeft )
v8 = -v8;
}
LABEL_21:
v11 = v9 * 0.017453;
if ( m_isBird )
{
if ( a1->m_isGoingLeft == a1->m_isUpsideDown )
{
*(float *)&v15 = -0.1;
if ( v8 > -0.1 )
goto LABEL_38;
}
else
{
*(float *)&v15 = 0.1;
if ( v8 < 0.1 )
goto LABEL_38;
}
v8 = *(float *)&v15;
LABEL_38:
if ( a1->m_isPlatformer )
{
if ( fabs(a1->m_platformerXVelocity) <= 0.5 )
{
v12 = 0.07;
v8 = 0.0;
}
else
{
v12 = 0.07;
if ( a1->m_isOnGround2 )
v8 = 0.0;
}
goto LABEL_25;
}
goto LABEL_50;
}
if ( a1->m_isDart )
{
if ( a1->m_vehicleSize == 1.0 )
v12 = 0.25;
else
v12 = 0.4;
goto LABEL_25;
}
if ( !a1->m_isPlatformer || !a1->m_isShip )
{
v12 = 0.15;
goto LABEL_25;
}
if ( !a1->m_holdingLeft && !a1->m_holdingRight && !a1->m_platformerMovingLeft && !a1->m_platformerMovingRight )
{
v12 = 0.06;
v8 = 0.0;
goto LABEL_25;
}
v23 = v11;
v18 = PlayerObject::reverseMod(a1);
v11 = v23;
if ( a1->m_isUpsideDown == a1->m_isSideways )
v19 = 1.0;
else
v19 = -1.0;
v20 = (float)v18 * v19;
v8 = v20 * 0.5236;
if ( fabsf(v20 * 0.5236) - fabsf(v23) >= 0.100000001 )
{
LABEL_50:
v12 = 0.07;
goto LABEL_25;
}
v12 = 0.015;
v8 = v20 * 0.7854;
LABEL_25:
if ( a1->m_isCollidingWithSlope )
{
v22 = v11;
v17 = PlayerObject::isFlying(a1);
v11 = v22;
if ( v17 )
v12 = v12 * 0.25;
}
v13 = a2 * v12;
if ( a2 <= (float)(a2 * v12) )
v13 = a2;
v14 = Slerp2D(v11, v8, v13);
a1->setRotation(a1, v14 * 57.296);
}