//
// getRotateCommandAngleDelta from 0x475088 to 0x4751e2 (346 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::triggerRotateCommand @ 0x481f3e
// > GJBaseGameLayer::processDynamicObjectActions @ 0x483470
//
// 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
//
float __fastcall getRotateCommandAngleDelta(
int a1,
int a2,
int a3,
int a4,
GameObject *a5,
GameObject *a6,
GameObject *a7,
GameObject *a8)
{
int v12; // r0
float v13; // s16
float v14; // s15
_BYTE v16[8]; // [sp+24h] [bp-28h] BYREF
cocos2d::CCPoint v17; // [sp+2Ch] [bp-20h] BYREF
_BYTE v18[8]; // [sp+34h] [bp-18h] BYREF
cocos2d::CCPoint v19; // [sp+3Ch] [bp-10h] BYREF
(*(void (__fastcall **)(_BYTE *))(*(_DWORD *)a2 + 672))(v16);
(*(void (__fastcall **)(cocos2d::CCPoint *, int))(*(_DWORD *)a4 + 672))(&v17, a4);
(*(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)a3 + 672))(v18, a3);
if ( a2 == a3 )
{
v12 = (*(int (__fastcall **)(int))(*(_DWORD *)a2 + 176))(a2);
}
else
{
cocos2d::CCPoint::operator-(&v19, v18, v16);
if ( cocos2d::CCPoint::getLength(&v19) >= 0.01 )
{
v13 = 90.0 - (float)(cocos2d::CCPoint::getAngle(&v19) * 57.296);
goto LABEL_7;
}
v12 = (*(int (__fastcall **)(int))(*(_DWORD *)a3 + 176))(a3);
}
v13 = *(float *)&v12;
LABEL_7:
if ( a2 == a4 )
goto LABEL_12;
if ( !*(_BYTE *)(a1 + 1320) )
{
v14 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)a4 + 176))(a4));
return GJBaseGameLayer::convertToClosestDirection((float)(v14 - v13) + *(float *)(a1 + 1372), 180.0);
}
applyPositionLimits(&v17, a5, a6, a7, a8);
cocos2d::CCPoint::operator-(&v19, &v17, v16);
if ( cocos2d::CCPoint::getLength(&v19) < 0.01 )
{
LABEL_12:
v14 = 0.0;
return GJBaseGameLayer::convertToClosestDirection((float)(v14 - v13) + *(float *)(a1 + 1372), 180.0);
}
v14 = 90.0 - (float)(cocos2d::CCPoint::getAngle(&v19) * 57.296);
return GJBaseGameLayer::convertToClosestDirection((float)(v14 - v13) + *(float *)(a1 + 1372), 180.0);
}