summaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-23 15:29:00 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-23 15:29:00 +0300
commit35258b9b9c731e782e68c63c4969dbc9759f447d (patch)
tree430ecdb5876337a7693d67cfbd0c9fdcb18ac022 /src/control
parent2650fa9a9212f064f4191aee54ac0b65df3f8dc9 (diff)
added some missing functions
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Garages.cpp40
-rw-r--r--src/control/Garages.h5
2 files changed, 45 insertions, 0 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index a8e1f1cb..afbae005 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -111,6 +111,8 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLL
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
};
+const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
+
int32 CGarages::BankVansCollected;
bool CGarages::BombsAreFree;
bool CGarages::RespraysAreFree;
@@ -2424,3 +2426,41 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERBODY ||
id == MI_CRUSHERLID;
}
+
+void CGarages::StopCarFromBlowingUp(CAutomobile* pCar)
+{
+ pCar->m_fFireBlowUpTimer = 0.0f;
+ pCar->m_fHealth = Max(pCar->m_fHealth, 300.0f);
+ pCar->Damage.SetEngineStatus(Max(pCar->Damage.GetEngineStatus(), 275));
+}
+
+bool CGarage::Does60SecondsNeedThisCarAtAll(int mi)
+{
+ for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
+ if (gaCarsToCollectIn60Seconds[i] == mi)
+ return true;
+ }
+ return false;
+}
+
+bool CGarage::Does60SecondsNeedThisCar(int mi)
+{
+ for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
+ if (gaCarsToCollectIn60Seconds[i] == mi)
+ return m_bCollectedCarsState & BIT(i);
+ }
+ return false;
+}
+
+void CGarage::MarkThisCarAsCollectedFor60Seconds(int mi)
+{
+ for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
+ if (gaCarsToCollectIn60Seconds[i] == mi)
+ m_bCollectedCarsState |= BIT(i);
+ }
+}
+
+bool CGarage::IsPlayerEntirelyInsideGarage()
+{
+ return IsEntityEntirelyInside3D(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 0.0f);
+}
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 3a8bc08d..a7dfa462 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -166,6 +166,10 @@ public:
void FindDoorsEntities();
void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied();
+ bool Does60SecondsNeedThisCarAtAll(int mi);
+ bool Does60SecondsNeedThisCar(int mi);
+ void MarkThisCarAsCollectedFor60Seconds(int mi);
+ bool IsPlayerEntirelyInsideGarage();
};
@@ -236,6 +240,7 @@ public:
static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
+ static void StopCarFromBlowingUp(CAutomobile*);
static bool IsCarSprayable(CVehicle*);
static float FindDoorHeightForMI(int32);