[saco] Implement/match CPlayerPed::GetTargetRotation()

This commit is contained in:
RD42 2024-08-05 18:11:12 +08:00
parent caed517670
commit 195f63f62e
2 changed files with 20 additions and 0 deletions

View File

@ -260,6 +260,25 @@ BOOL CPlayerPed::IsInVehicle()
return FALSE;
}
//-----------------------------------------------------------
float CPlayerPed::GetTargetRotation()
{
if(!m_pPed) return 0.0f;
if(GamePool_Ped_GetAt(m_dwGTAId) == 0) return 0.0f;
MATRIX4X4 mat;
GetMatrix(&mat);
float fZAngle = atan2(-mat.up.X, mat.up.Y) * 180.0f / PI;
// Bound it to [0, 360)
if ( fZAngle < 0.0f )
fZAngle += 360.0f;
else if ( fZAngle >= 360.0f )
fZAngle -= 360.0f;
return fZAngle;
}
//-----------------------------------------------------------
void CPlayerPed::GiveWeapon(int iWeaponID, int iAmmo)

View File

@ -41,6 +41,7 @@ public:
WORD GetAmmo();
float GetTargetRotation();
void GiveWeapon(int iWeaponID, int iAmmo);
void SetArmedWeapon(int iWeaponType, bool bUnk);
WEAPON_SLOT_TYPE * GetCurrentWeaponSlot();