//
// PlayerObject::updateShipRotation from 0x75143c to 0x7517c0 (900 bytes)
//
// 2 xrefs:
// > PlayerObject::updateRotation @ 0x751af8
// > ??> @ 0x6a4b0
//
// This function is hookable on this platform (idp: arm, 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 12:52:55 +0000
//
__int64 __fastcall PlayerObject::updateShipRotation(PlayerObject *this, float a2)
{
const cocos2d::CCPoint *v5; // x0
int v6; // w21
float v7; // s10
float v8; // s9
float v9; // s10
float v10; // s0
int v11; // w0
float v12; // s0
float v13; // s9
float v14; // s2
float v15; // s0
int v16; // s1
char isFlying; // w0
char v18; // w0
int v19; // w0
float v20; // s2
float v21; // s1
float v22; // [xsp+50h] [xbp+50h]
float v23; // [xsp+50h] [xbp+50h]
float v24; // [xsp+50h] [xbp+50h]
float v25; // [xsp+60h] [xbp+60h] BYREF
float v26; // [xsp+64h] [xbp+64h]
if ( *((_BYTE *)this + 2408) || *((_BYTE *)this + 2460) )
return _stack_chk_guard;
v5 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)this + 192LL))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, v5);
if ( !*((_BYTE *)this + 2418) && !*((_BYTE *)this + 2417) && !*((_BYTE *)this + 2428) && !*((_BYTE *)this + 2420) )
{
v6 = 0;
if ( !*((_BYTE *)this + 2427) )
goto LABEL_9;
goto LABEL_33;
}
if ( *((_BYTE *)this + 2427) )
{
v6 = 1;
if ( *((_BYTE *)this + 2426) )
{
v7 = vabds_f32(v26, *((float *)this + 621));
goto LABEL_34;
}
LABEL_33:
v7 = v26 - *((float *)this + 621);
LABEL_34:
v8 = v25 - *((float *)this + 620);
goto LABEL_11;
}
v6 = 1;
if ( *((_BYTE *)this + 2426) )
{
v7 = vabds_f32(v25, *((float *)this + 620));
goto LABEL_10;
}
LABEL_9:
v7 = v25 - *((float *)this + 620);
LABEL_10:
v8 = -(float)(v26 - *((float *)this + 621));
LABEL_11:
if ( (float)(a2 * 1.2) > SquareDistance(0.0, 0.0, v7, v8)
&& (!*((_BYTE *)this + 2832) || !*((_BYTE *)this + 2417) && !*((_BYTE *)this + 2418)) )
{
return _stack_chk_guard;
}
v9 = atan2f(v8, v7);
(*(void (__fastcall **)(PlayerObject *))(*(_QWORD *)this + 368LL))(this);
v11 = *((unsigned __int8 *)this + 2418);
if ( *((_BYTE *)this + 2418) )
v9 = v9 * -0.4;
if ( !*((_BYTE *)this + 1624) )
{
if ( !v6 )
goto LABEL_21;
goto LABEL_19;
}
v22 = v10;
isFlying = PlayerObject::isFlying(this);
v10 = v22;
if ( isFlying )
v9 = 0.0;
v11 = *((unsigned __int8 *)this + 2418);
if ( v6 )
{
LABEL_19:
if ( *((_BYTE *)this + 2426) )
v9 = -v9;
}
LABEL_21:
v12 = v10 * 0.017453;
if ( v11 )
{
if ( *((unsigned __int8 *)this + 2426) == *((unsigned __int8 *)this + 2423) )
{
*(float *)&v16 = -0.1;
if ( v9 > -0.1 )
goto LABEL_38;
}
else
{
*(float *)&v16 = 0.1;
if ( v9 < 0.1 )
goto LABEL_38;
}
v9 = *(float *)&v16;
LABEL_38:
if ( *((_BYTE *)this + 2832) )
{
if ( fabs(*((double *)this + 339)) <= 0.5 )
{
v13 = 0.07;
v9 = 0.0;
}
else
{
v13 = 0.07;
if ( *((_BYTE *)this + 2500) )
v9 = 0.0;
}
goto LABEL_25;
}
goto LABEL_50;
}
if ( *((_BYTE *)this + 2420) )
{
if ( *((float *)this + 618) == 1.0 )
v13 = 0.25;
else
v13 = 0.4;
goto LABEL_25;
}
if ( !*((_BYTE *)this + 2832) || !*((_BYTE *)this + 2417) )
{
v13 = 0.15;
goto LABEL_25;
}
if ( !*((_BYTE *)this + 2721) && !*((_BYTE *)this + 2720) && !*((_BYTE *)this + 2809) && !*((_BYTE *)this + 2810) )
{
v13 = 0.06;
v9 = 0.0;
goto LABEL_25;
}
v24 = v12;
v19 = PlayerObject::reverseMod(this);
v12 = v24;
if ( *((unsigned __int8 *)this + 2423) == *((unsigned __int8 *)this + 2427) )
v20 = 1.0;
else
v20 = -1.0;
v21 = (float)v19 * v20;
v9 = v21 * 0.5236;
if ( (float)(fabsf(v21 * 0.5236) - fabsf(v24)) >= 0.1 )
{
LABEL_50:
v13 = 0.07;
goto LABEL_25;
}
v13 = 0.015;
v9 = v21 * 0.7854;
LABEL_25:
if ( *((_BYTE *)this + 1624) )
{
v23 = v12;
v18 = PlayerObject::isFlying(this);
v12 = v23;
if ( v18 )
v13 = v13 * 0.25;
}
v14 = a2 * v13;
if ( a2 <= (float)(a2 * v13) )
v14 = a2;
v15 = Slerp2D(v12, v9, v14);
(*(void (__fastcall **)(PlayerObject *, float))(*(_QWORD *)this + 360LL))(this, v15 * 57.296);
return _stack_chk_guard;
}