[saco] Implement/match CPlayerPed::GetDistanceFromVehicle(...)

* Add CVehicle constructor stub
This commit is contained in:
RD42 2024-08-13 23:29:34 +08:00
parent db28736d81
commit 2c418701fd
4 changed files with 51 additions and 0 deletions

View File

@ -438,6 +438,23 @@ BOOL CPlayerPed::HasAmmoForCurrentWeapon()
}
return TRUE;
}
//-----------------------------------------------------------
float CPlayerPed::GetDistanceFromVehicle(CVehicle *pVehicle)
{
MATRIX4X4 matFromPlayer;
MATRIX4X4 matThis;
float fSX,fSY,fSZ;
GetMatrix(&matThis);
pVehicle->GetMatrix(&matFromPlayer);
fSX = (matThis.pos.X - matFromPlayer.pos.X) * (matThis.pos.X - matFromPlayer.pos.X);
fSY = (matThis.pos.Y - matFromPlayer.pos.Y) * (matThis.pos.Y - matFromPlayer.pos.Y);
fSZ = (matThis.pos.Z - matFromPlayer.pos.Z) * (matThis.pos.Z - matFromPlayer.pos.Z);
return (float)sqrt(fSX + fSY + fSZ);
}
//-----------------------------------------------------------

View File

@ -59,6 +59,8 @@ public:
VEHICLE_TYPE * GetGtaVehicle();
float GetDistanceFromVehicle(CVehicle *pVehicle);
void StartJetpack();
void StopJetpack();
BOOL IsInJetpackMode();

15
saco/game/vehicle.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "../main.h"
//-----------------------------------------------------------
// CONSTRUCTOR
CVehicle::CVehicle(int iType, float fPosX, float fPosY,
float fPosZ, float fRotation, BOOL bKeepModelLoaded,
int a8)
{
// TODO: CVehicle::CVehicle
}
//-----------------------------------------------------------

17
saco/game/vehicle.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#include "game.h"
#include "entity.h"
//-----------------------------------------------------------
class CVehicle : public CEntity
{
public:
CVehicle( int iType, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f, BOOL bKeepModelLoaded = FALSE, int a8 = 0);
};
//-----------------------------------------------------------