summaryrefslogtreecommitdiffstats
path: root/src/entities/Vehicle.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-24 23:11:56 +0200
committerGitHub <noreply@github.com>2019-06-24 23:11:56 +0200
commitf07f411629b686338df10fdce217b2d258f38c92 (patch)
treecd07798b2daf33ea3a152e54cd18809da2cc9b2f /src/entities/Vehicle.cpp
parentreplaced some ctors; made PreRender call game function (diff)
parentCPed, CVehicle, mostly entering/exiting car (diff)
downloadre3-f07f411629b686338df10fdce217b2d258f38c92.tar
re3-f07f411629b686338df10fdce217b2d258f38c92.tar.gz
re3-f07f411629b686338df10fdce217b2d258f38c92.tar.bz2
re3-f07f411629b686338df10fdce217b2d258f38c92.tar.lz
re3-f07f411629b686338df10fdce217b2d258f38c92.tar.xz
re3-f07f411629b686338df10fdce217b2d258f38c92.tar.zst
re3-f07f411629b686338df10fdce217b2d258f38c92.zip
Diffstat (limited to '')
-rw-r--r--src/entities/Vehicle.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/entities/Vehicle.cpp b/src/entities/Vehicle.cpp
index bac05f7b..ced504a3 100644
--- a/src/entities/Vehicle.cpp
+++ b/src/entities/Vehicle.cpp
@@ -2,6 +2,8 @@
#include "patcher.h"
#include "Vehicle.h"
#include "Pools.h"
+#include "CarCtrl.h"
+#include "ModelIndices.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@@ -11,3 +13,53 @@ bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
+
+bool
+CVehicle::IsLawEnforcementVehicle(void)
+{
+ switch (m_modelIndex) {
+ case MI_FBICAR:
+ case MI_POLICE:
+ case MI_ENFORCER:
+ case MI_PREDATOR:
+ case MI_RHINO:
+ case MI_BARRACKS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void
+CVehicle::ChangeLawEnforcerState(bool enable)
+{
+ if (enable) {
+ if (!bIsLawEnforcer) {
+ bIsLawEnforcer = true;
+ CCarCtrl::NumLawEnforcerCars++;
+ }
+ } else {
+ if (bIsLawEnforcer) {
+ bIsLawEnforcer = false;
+ CCarCtrl::NumLawEnforcerCars--;
+ }
+ }
+}
+
+void
+CVehicle::RemoveDriver(void)
+{
+ m_status = STATUS_ABANDONED;
+ pDriver = nil;
+}
+
+bool
+CVehicle::IsUpsideDown(void)
+{
+ return GetUp().z <= -0.9f;
+}
+
+STARTPATCHES
+ InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP);
+ InjectHook(0x5520A0, &CVehicle::RemoveDriver, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file