//
// PlayerObject::updateShipRotation from 0x437164 to 0x437456 (754 bytes)
//
// 1 xrefs:
// > PlayerObject::updateRotation @ 0x437646
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:48:19 +0000
//
float __fastcall PlayerObject::updateShipRotation(float this, float a2)
{
float *v2; // r4
const cocos2d::CCPoint *v4; // r0
int v5; // r5
float *v6; // r3
float *v7; // 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
float v21; // [sp+4h] [bp-Ch] BYREF
float v22; // [sp+8h] [bp-8h]
v2 = (float *)LODWORD(this);
if ( *(_BYTE *)(LODWORD(this) + 1944) || *(_BYTE *)(LODWORD(this) + 1996) )
return this;
v4 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(float))(*(_DWORD *)LODWORD(this) + 96))(COERCE_FLOAT(LODWORD(this)));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v21, v4);
if ( *((_BYTE *)v2 + 1954) || *((_BYTE *)v2 + 1953) || *((_BYTE *)v2 + 1964) )
v5 = 1;
else
v5 = *((unsigned __int8 *)v2 + 1956);
v6 = v2 + 504;
v7 = v2 + 505;
if ( *((_BYTE *)v2 + 1963) )
{
v8 = v5 && *((_BYTE *)v2 + 1962) ? fabsf(v22 - *v7) : v22 - *v7;
v9 = v21 - *v6;
}
else
{
v8 = v5 && *((_BYTE *)v2 + 1962) ? fabsf(v21 - *v6) : v21 - *v6;
v9 = -(float)(v22 - *v7);
}
this = SquareDistance(0.0, 0.0, v8, v9);
if ( this < (float)(a2 * 1.2) && (!*((_BYTE *)v2 + 2320) || !*((_BYTE *)v2 + 1953) && !*((_BYTE *)v2 + 1954)) )
return this;
v10 = atan2f(v9, v8);
v11 = COERCE_FLOAT((*(int (__fastcall **)(float *))(*(_DWORD *)v2 + 184))(v2));
if ( *((_BYTE *)v2 + 1954) )
v10 = v10 * -0.4;
if ( *((_BYTE *)v2 + 1384) && PlayerObject::isFlying((PlayerObject *)v2) )
v10 = 0.0;
if ( v5 && *((_BYTE *)v2 + 1962) )
v10 = -v10;
v12 = v11 * 0.017453;
if ( *((_BYTE *)v2 + 1954) )
{
if ( *((unsigned __int8 *)v2 + 1962) == *((unsigned __int8 *)v2 + 1959) )
{
if ( v10 <= -0.1 )
v10 = -0.1;
}
else if ( v10 >= 0.1 )
{
v10 = 0.1;
}
if ( *((_BYTE *)v2 + 2320) )
{
if ( fabs(*((double *)v2 + 275)) > 0.5 )
{
v13 = 0.07;
if ( *((_BYTE *)v2 + 2036) )
v10 = 0.0;
goto LABEL_62;
}
v13 = 0.07;
goto LABEL_60;
}
}
else
{
if ( *((_BYTE *)v2 + 1956) )
{
v13 = 0.25;
if ( v2[502] != 1.0 )
v13 = 0.4;
goto LABEL_62;
}
if ( !*((_BYTE *)v2 + 2320) || !*((_BYTE *)v2 + 1953) )
{
v13 = 0.15;
goto LABEL_62;
}
if ( !*((_BYTE *)v2 + 2209) && !*((_BYTE *)v2 + 2208) && !*((_BYTE *)v2 + 2297) && !*((_BYTE *)v2 + 2298) )
{
v13 = 0.06;
LABEL_60:
v10 = 0.0;
goto LABEL_62;
}
v14 = -1.0;
v15 = PlayerObject::reverseMod((PlayerObject *)v2);
v16 = fabsf(v12);
if ( *((unsigned __int8 *)v2 + 1959) == *((unsigned __int8 *)v2 + 1963) )
v14 = 1.0;
v17 = (float)v15 * v14;
v10 = v17 * 0.5236;
if ( (float)(fabsf(v17 * 0.5236) - v16) < 0.1 )
{
v10 = v17 * 0.7854;
v13 = 0.015;
goto LABEL_62;
}
}
v13 = 0.07;
LABEL_62:
if ( *((_BYTE *)v2 + 1384) && PlayerObject::isFlying((PlayerObject *)v2) )
v13 = v13 * 0.25;
v18 = v13 * a2;
if ( a2 > v18 )
v19 = v18;
else
v19 = a2;
v20 = Slerp2D(v12, v10, v19);
return COERCE_FLOAT((*(int (__fastcall **)(float *, _DWORD))(*(_DWORD *)v2 + 180))(v2, v20 * 57.296));
}