//
// PlayerObject::updateShipRotation from 0x33f1b0 to 0x33f4b8 (776 bytes)
//
// 1 xrefs:
// > PlayerObject::updateRotation @ 0x33f6ae
//
// 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; // r0
_BOOL4 v5; // r5
cocos2d::CCPoint *p_m_shipRotation; // r3
float *p_y; // r2
float v8; // s16
float v9; // s17
float v10; // s16
float v11; // s17
float v12; // s19
float v13; // s17
float v14; // s17
int v15; // r0
float v16; // s14
float v17; // s17
float v18; // s17
float v19; // r2
float v20; // r0
cocos2d::CCPoint v21; // [sp+4h] [bp-Ch] BYREF
if ( a1->m_isOnSlope || a1->m_isDashing )
return;
v4 = a1->getPosition(a1);
cocos2d::CCPoint::CCPoint(&v21, v4);
v5 = a1->m_isBird || a1->m_isShip || a1->m_isSwing || a1->m_isDart;
p_m_shipRotation = &a1->m_shipRotation;
p_y = &a1->m_shipRotation.y;
if ( a1->m_isSideways )
{
v8 = v5 && a1->m_isGoingLeft ? fabsf(v21.y - *p_y) : v21.y - *p_y;
v9 = v21.x - p_m_shipRotation->x;
}
else
{
v8 = v5 && a1->m_isGoingLeft ? fabsf(v21.x - p_m_shipRotation->x) : v21.x - p_m_shipRotation->x;
v9 = -(float)(v21.y - *p_y);
}
if ( SquareDistance(0.0, 0.0, v8, v9) < (float)(a2 * 1.2) && (!a1->m_isPlatformer || !a1->m_isShip && !a1->m_isBird) )
return;
v10 = atan2(v9, v8);
v11 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a1->getRotation)(a1));
if ( a1->m_isBird )
v10 = v10 * -0.4;
if ( a1->m_isCollidingWithSlope && PlayerObject::isFlying(a1) )
v10 = 0.0;
if ( v5 && a1->m_isGoingLeft )
v10 = -v10;
v12 = v11 * 0.017453;
if ( a1->m_isBird )
{
if ( a1->m_isGoingLeft == a1->m_isUpsideDown )
{
if ( v10 <= -0.1 )
v10 = -0.1;
}
else if ( v10 >= 0.1 )
{
v10 = 0.1;
}
if ( a1->m_isPlatformer )
{
if ( fabs(a1->m_platformerXVelocity) > 0.5 )
{
v13 = 0.07;
if ( a1->m_isOnGround2 )
v10 = 0.0;
goto LABEL_62;
}
v13 = 0.07;
goto LABEL_60;
}
}
else
{
if ( a1->m_isDart )
{
v13 = 0.25;
if ( a1->m_vehicleSize != 1.0 )
v13 = 0.4;
goto LABEL_62;
}
if ( !a1->m_isPlatformer || !a1->m_isShip )
{
v13 = 0.15;
goto LABEL_62;
}
if ( !a1->m_holdingLeft && !a1->m_holdingRight && !a1->m_platformerMovingLeft && !a1->m_platformerMovingRight )
{
v13 = 0.06;
LABEL_60:
v10 = 0.0;
goto LABEL_62;
}
v14 = -1.0;
v15 = PlayerObject::reverseMod(a1);
v16 = fabsf(v12);
if ( a1->m_isUpsideDown == a1->m_isSideways )
v14 = 1.0;
v17 = (float)v15 * v14;
v10 = v17 * 0.5236;
if ( fabsf(v17 * 0.5236) - v16 < 0.100000001 )
{
v10 = v17 * 0.7854;
v13 = 0.015;
goto LABEL_62;
}
}
v13 = 0.07;
LABEL_62:
if ( a1->m_isCollidingWithSlope && PlayerObject::isFlying(a1) )
v13 = v13 * 0.25;
v18 = v13 * a2;
if ( a2 > v18 )
v19 = v18;
else
v19 = a2;
v20 = COERCE_FLOAT(Slerp2D(v12, v10, v19));
((void (__fastcall *)(PlayerObject *, _DWORD))a1->setRotation)(a1, v20 * 57.296);
}