summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-03-28 13:24:13 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-03-28 13:24:13 +0100
commit268f92bfbe5330149be341855fa52f53ea501c62 (patch)
treee4ec5d4cc96e2bdc1fd153fc605d20e1a410f592 /src/vehicles
parentMerge pull request #353 from Sergeanur/Debug (diff)
downloadre3-268f92bfbe5330149be341855fa52f53ea501c62.tar
re3-268f92bfbe5330149be341855fa52f53ea501c62.tar.gz
re3-268f92bfbe5330149be341855fa52f53ea501c62.tar.bz2
re3-268f92bfbe5330149be341855fa52f53ea501c62.tar.lz
re3-268f92bfbe5330149be341855fa52f53ea501c62.tar.xz
re3-268f92bfbe5330149be341855fa52f53ea501c62.tar.zst
re3-268f92bfbe5330149be341855fa52f53ea501c62.zip
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Vehicle.cpp24
-rw-r--r--src/vehicles/Vehicle.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 90848d6c..63c9519f 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -16,6 +16,7 @@
#include "Renderer.h"
#include "DMAudio.h"
#include "Radar.h"
+#include "Darkel.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@@ -763,6 +764,29 @@ CVehicle::IsSphereTouchingVehicle(float sx, float sy, float sz, float radius)
return true;
}
+void
+DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle)
+{
+ if (pVehicle->pDriver) {
+#ifndef FIX_BUGS
+ // this just isn't fair
+ CDarkel::RegisterKillByPlayer(pVehicle->pDriver, WEAPONTYPE_UNIDENTIFIED);
+#endif
+ pVehicle->pDriver->FlagToDestroyWhenNextProcessed();
+ }
+ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
+ if (pVehicle->pPassengers[i]) {
+#ifndef FIX_BUGS
+ // this just isn't fair
+ CDarkel::RegisterKillByPlayer(pVehicle->pPassengers[i], WEAPONTYPE_UNIDENTIFIED);
+#endif
+ pVehicle->pPassengers[i]->FlagToDestroyWhenNextProcessed();
+ }
+ }
+ CWorld::Remove(pVehicle);
+ delete pVehicle;
+}
+
class CVehicle_ : public CVehicle
{
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index bd8df694..8c0825cf 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -300,3 +300,5 @@ public:
};
static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error");
+
+void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);