2024-08-13 23:29:34 +08:00
|
|
|
|
|
|
|
#include "../main.h"
|
2024-08-20 22:44:22 +08:00
|
|
|
#include "util.h"
|
2024-08-13 23:29:34 +08:00
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
// CONSTRUCTOR
|
|
|
|
|
|
|
|
CVehicle::CVehicle(int iType, float fPosX, float fPosY,
|
|
|
|
float fPosZ, float fRotation, BOOL bKeepModelLoaded,
|
|
|
|
int a8)
|
|
|
|
{
|
2024-08-20 22:44:22 +08:00
|
|
|
// TODO: CVehicle::CVehicle .text:100B88F0
|
2024-08-13 23:29:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 22:44:22 +08:00
|
|
|
void CVehicle::LinkToInterior(int iInterior)
|
|
|
|
{
|
|
|
|
if(GamePool_Vehicle_GetAt(m_dwGTAId)) {
|
|
|
|
ScriptCommand(&link_vehicle_to_interior, m_dwGTAId, iInterior);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
2024-08-20 22:48:22 +08:00
|
|
|
// If the game has internally destroyed the vehicle
|
|
|
|
// during this frame, the vehicle pointer should become 0
|
|
|
|
|
|
|
|
void CVehicle::ResetPointers()
|
|
|
|
{
|
|
|
|
if(!m_pVehicle) return;
|
|
|
|
|
|
|
|
m_pVehicle = GamePool_Vehicle_GetAt(m_dwGTAId);
|
|
|
|
m_pEntity = (ENTITY_TYPE *)m_pVehicle;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 22:51:36 +08:00
|
|
|
BOOL CVehicle::HasADriver()
|
|
|
|
{
|
|
|
|
if(!m_pVehicle) return FALSE;
|
|
|
|
if(!GamePool_Vehicle_GetAt(m_dwGTAId)) return FALSE;
|
|
|
|
|
|
|
|
if(m_pVehicle) {
|
|
|
|
if(m_pVehicle->pDriver && IN_VEHICLE(m_pVehicle->pDriver) && m_pVehicle->pDriver->dwPedType == 0)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 22:52:44 +08:00
|
|
|
BOOL CVehicle::IsOccupied()
|
|
|
|
{
|
|
|
|
if(m_pVehicle) {
|
|
|
|
if(m_pVehicle->pDriver) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[0]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[1]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[2]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[3]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[4]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[5]) return TRUE;
|
|
|
|
if(m_pVehicle->pPassengers[6]) return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 22:55:12 +08:00
|
|
|
void CVehicle::SetLockedState(int iLocked)
|
|
|
|
{
|
|
|
|
if(!m_pVehicle) return;
|
|
|
|
|
|
|
|
if(iLocked) {
|
|
|
|
ScriptCommand(&lock_car,m_dwGTAId,1);
|
|
|
|
} else {
|
|
|
|
ScriptCommand(&lock_car,m_dwGTAId,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 22:58:42 +08:00
|
|
|
void CVehicle::SetEngineState(BOOL bState)
|
|
|
|
{
|
|
|
|
if(!m_pVehicle) return;
|
|
|
|
|
|
|
|
if(!bState) {
|
|
|
|
m_pVehicle->byteFlags &= 0xDF;
|
|
|
|
} else {
|
|
|
|
m_pVehicle->byteFlags |= 0x20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 23:00:33 +08:00
|
|
|
float CVehicle::GetHealth()
|
|
|
|
{
|
|
|
|
if(m_pVehicle) return m_pVehicle->fHealth;
|
|
|
|
else return 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 23:01:30 +08:00
|
|
|
void CVehicle::SetHealth(float fHealth)
|
|
|
|
{
|
|
|
|
if(m_pVehicle) {
|
|
|
|
m_pVehicle->fHealth = fHealth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|
2024-08-20 23:03:15 +08:00
|
|
|
BOOL CVehicle::HasSunk()
|
|
|
|
{
|
|
|
|
if(!m_pVehicle) return FALSE;
|
|
|
|
|
|
|
|
return ScriptCommand(&has_car_sunk,m_dwGTAId);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------
|
|
|
|
|