summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-01-23 14:14:15 +0100
committerSergeanur <s.anureev@yandex.ua>2021-01-23 14:14:15 +0100
commit904090cbb6cf7978e2e093da1ea1d7245dcb02c8 (patch)
treeb48af2798ab8faea3fcfe16d1ed8629dc025b8ab /src/control
parentRemove restrictions in CGame::Process (diff)
parentadded some missing functions (diff)
downloadre3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar.gz
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar.bz2
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar.lz
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar.xz
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.tar.zst
re3-904090cbb6cf7978e2e093da1ea1d7245dcb02c8.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Garages.cpp40
-rw-r--r--src/control/Garages.h8
-rw-r--r--src/control/Script.h5
-rw-r--r--src/control/Script3.cpp1
-rw-r--r--src/control/Script4.cpp1
5 files changed, 50 insertions, 5 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index de536918..e8c2f2a6 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -106,7 +106,7 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLL
{ MI_VOODOO, MI_CUBAN, MI_CADDY, MI_BAGGAGE, MI_MRWHOOP, MI_PIZZABOY }
};
-const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }; // what is this?
+const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
int32 CGarages::BankVansCollected;
bool CGarages::BombsAreFree;
@@ -2450,3 +2450,41 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_LCS_GARAGEDOOR39 ||
id == MI_LCS_GARAGEDOOR40;
}
+
+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 47de898f..c3542d27 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -1,11 +1,10 @@
#pragma once
-#include "Automobile.h"
#include "audio_enums.h"
#include "Camera.h"
#include "config.h"
+#include "Lists.h"
class CVehicle;
-class CCamera;
enum eGarageState
{
@@ -183,6 +182,10 @@ public:
void FindDoorsEntities();
void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied();
+ bool Does60SecondsNeedThisCarAtAll(int mi);
+ bool Does60SecondsNeedThisCar(int mi);
+ void MarkThisCarAsCollectedFor60Seconds(int mi);
+ bool IsPlayerEntirelyInsideGarage();
bool IsPointInsideGarage(CVector);
bool IsPointInsideGarage(CVector, float);
@@ -255,6 +258,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 void SetMaxNumStoredCarsForGarage(int16 garage, uint8 num) { aGarages[garage].m_nMaxStoredCars = num; }
static bool IsCarSprayable(CVehicle*);
diff --git a/src/control/Script.h b/src/control/Script.h
index fa8a64cd..11c1b185 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -1,6 +1,5 @@
#pragma once
-#include "common.h"
-#include "Font.h"
+#include "Font.h"
#include "Ped.h"
#include "PedType.h"
#include "Text.h"
@@ -39,9 +38,11 @@ void FlushLog();
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
+#define MILES_IN_METER (0.000621371192f)
#define METERS_IN_FOOT (0.3048f)
#define FEET_IN_METER (3.28084f)
#else
+#define MILES_IN_METER (1 / 1670.f)
#define METERS_IN_FOOT (0.3f)
#define FEET_IN_METER (3.33f)
#endif
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 1e4d5b6f..7acfdfc8 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -35,6 +35,7 @@
#include "Zones.h"
#include "GameLogic.h"
#include "Bike.h"
+#include "Wanted.h"
// LCS: file done except TODOs
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index c3eb2e89..bb6edf6e 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -39,6 +39,7 @@
#include "World.h"
#include "Zones.h"
#include "Bike.h"
+#include "Wanted.h"
// LCS: file done except TODOs