summaryrefslogtreecommitdiffstats
path: root/src/entities/Vehicle.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-06-30 16:55:16 +0200
committereray orçunus <erayorcunus@gmail.com>2019-06-30 16:55:16 +0200
commite650c06acd17d6440fbc31bd9dc150d6dd17c45b (patch)
tree15ccabed4c8c5d7c5c2f7a636035876cbd183e4d /src/entities/Vehicle.cpp
parentMerge branch 'master' of git://github.com/GTAmodding/re3 into erorcun (diff)
parentMerge pull request #79 from Nick007J/master (diff)
downloadre3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar.gz
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar.bz2
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar.lz
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar.xz
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.tar.zst
re3-e650c06acd17d6440fbc31bd9dc150d6dd17c45b.zip
Diffstat (limited to 'src/entities/Vehicle.cpp')
-rw-r--r--src/entities/Vehicle.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/entities/Vehicle.cpp b/src/entities/Vehicle.cpp
index ced504a3..8c1ef515 100644
--- a/src/entities/Vehicle.cpp
+++ b/src/entities/Vehicle.cpp
@@ -4,6 +4,8 @@
#include "Pools.h"
#include "CarCtrl.h"
#include "ModelIndices.h"
+#include "DMAudio.h"
+#include "Radar.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@@ -12,7 +14,36 @@ bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
+void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+
+CVehicle::~CVehicle()
+{
+ m_nAlarmState = 0;
+ if (m_audioEntityId >= 0){
+ DMAudio.DestroyEntity(m_audioEntityId);
+ m_audioEntityId = -5;
+ }
+ CRadar::ClearBlipForEntity(BLIP_CAR, CPools::GetVehiclePool()->GetIndex(this));
+ if (pDriver)
+ pDriver->FlagToDestroyWhenNextProcessed();
+ for (int i = 0; i < m_nNumMaxPassengers; i++){
+ if (pPassengers[i])
+ pPassengers[i]->FlagToDestroyWhenNextProcessed();
+ }
+ if (m_pCarFire)
+ m_pCarFire->Extinguish();
+ CCarCtrl::UpdateCarCount(this, true);
+ if (bIsAmbulanceOnDuty){
+ CCarCtrl::NumAmbulancesOnDuty--;
+ bIsAmbulanceOnDuty = false;
+ }
+ if (bIsFiretruckOnDuty){
+ CCarCtrl::NumFiretrucksOnDuty--;
+ bIsFiretruckOnDuty = false;
+ }
+}
bool
CVehicle::IsLawEnforcementVehicle(void)
@@ -47,6 +78,28 @@ CVehicle::ChangeLawEnforcerState(bool enable)
}
void
+CVehicle::RemovePassenger(CPed *p)
+{
+ if (IsTrain()){
+ for (int i = 0; i < 8; i++){
+ if (pPassengers[i] == p) {
+ pPassengers[i] = nil;
+ m_nNumPassengers--;
+ return;
+ }
+ }
+ return;
+ }
+ for (int i = 0; i < m_nNumMaxPassengers; i++){
+ if (pPassengers[i] == p){
+ pPassengers[i] = nil;
+ m_nNumPassengers--;
+ return;
+ }
+ }
+}
+
+void
CVehicle::RemoveDriver(void)
{
m_status = STATUS_ABANDONED;