From f85b5e99edfb2e1b9a4563cacc96892195eee379 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 16 Jan 2021 16:44:59 +0300 Subject: Includes overhaul, fix some compiler warnings --- src/control/Garages.h | 3 +-- src/control/Script.h | 4 ++-- src/control/Script3.cpp | 1 + src/control/Script4.cpp | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.h b/src/control/Garages.h index 3d12d4a2..39327e4e 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 { diff --git a/src/control/Script.h b/src/control/Script.h index ae984c59..a45e11cf 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -1,7 +1,5 @@ #pragma once -#include "common.h" #include "Font.h" -#include "Ped.h" #include "PedType.h" #include "Text.h" #include "Sprite2d.h" @@ -38,9 +36,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 aba06d03..1ac18fa8 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -34,6 +34,7 @@ #include "Zones.h" #include "GameLogic.h" #include "Bike.h" +#include "Wanted.h" int8 CRunningScript::ProcessCommands500To599(int32 command) { diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 51dc14d3..9830f0dc 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" #ifdef FIX_BUGS static bool IsSlideObjectUsedWrongByScript(const CVector& posTarget, const CVector& slideBy) -- cgit v1.2.3 From 2814f2e8cf4491adf4bfccb4371ada95243ce5fa Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 23 Jan 2021 12:49:54 +0100 Subject: wrong path node array --- src/control/PathFind.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/control') diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index cbc29db4..2d3972f6 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -338,17 +338,17 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, InfoForTileCars[i].x = x/16.0f; InfoForTileCars[i].y = y/16.0f; InfoForTileCars[i].z = z/16.0f; - InfoForTilePeds[i].width = 8.0f*Min(width, 15.0f); + InfoForTileCars[i].width = 8.0f*Min(width, 15.0f); InfoForTileCars[i].numLeftLanes = numLeft; InfoForTileCars[i].numRightLanes = numRight; - InfoForTilePeds[i].crossing = false; - InfoForTilePeds[i].speedLimit = 0; - InfoForTilePeds[i].roadBlock = false; - InfoForTilePeds[i].disabled = false; - InfoForTilePeds[i].waterPath = false; - InfoForTilePeds[i].onlySmallBoats = false; - InfoForTilePeds[i].betweenLevels = false; - InfoForTilePeds[i].spawnRate = Min(spawnRate, 15); + InfoForTileCars[i].crossing = false; + InfoForTileCars[i].speedLimit = 0; + InfoForTileCars[i].roadBlock = false; + InfoForTileCars[i].disabled = false; + InfoForTileCars[i].waterPath = false; + InfoForTileCars[i].onlySmallBoats = false; + InfoForTileCars[i].betweenLevels = false; + InfoForTileCars[i].spawnRate = Min(spawnRate, 15); if(node == 11) InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound(); -- cgit v1.2.3 From b5c4866964a281ad9ab18dfd7218e1ef168f15f4 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 23 Jan 2021 15:29:00 +0300 Subject: added some missing functions --- src/control/Garages.cpp | 40 +++++++++++++++++++++++++++++++++++++++- src/control/Garages.h | 5 +++++ 2 files changed, 44 insertions(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 39fa5c94..e3b5aa8c 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; @@ -2357,3 +2357,41 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_GARAGEDOOR25 || id == MI_GARAGEDOOR26; } + +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 39327e4e..07d5f712 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -182,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); @@ -254,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*); -- cgit v1.2.3