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 6b54d04bfc79141c4f751875641dec61da18f3f7 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 23 Jan 2021 02:51:26 +0200 Subject: LCS model indices --- src/control/Garages.cpp | 83 +++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 41 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index de536918..db920fed 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1825,7 +1825,7 @@ void CGarage::FindDoorsEntities() } } if (m_pDoor1 && m_pDoor2) { - if (m_pDoor1->GetModelIndex() != MI_LCS_GARAGEDOOR39 && m_pDoor1->GetModelIndex() != MI_LCS_GARAGEDOOR40) { + if (m_pDoor1->GetModelIndex() != MI_CRUSHERBODY && m_pDoor1->GetModelIndex() != MI_CRUSHERLID) { CVector2D vecDoor1ToGarage(m_pDoor1->GetPosition().x - GetGarageCenterX(), m_pDoor1->GetPosition().y - GetGarageCenterY()); CVector2D vecDoor2ToGarage(m_pDoor2->GetPosition().x - GetGarageCenterX(), m_pDoor2->GetPosition().y - GetGarageCenterY()); if (DotProduct2D(vecDoor1ToGarage, vecDoor2ToGarage) > 0.0f) { @@ -2409,44 +2409,45 @@ void CGarages::Load(uint8* buf, uint32 size) bool CGarages::IsModelIndexADoor(uint32 id) { - return id == MI_LCS_GARAGEDOOR01 || - id == MI_LCS_GARAGEDOOR02 || - id == MI_LCS_GARAGEDOOR03 || - id == MI_LCS_GARAGEDOOR04 || - id == MI_LCS_GARAGEDOOR05 || - id == MI_LCS_GARAGEDOOR06 || - id == MI_LCS_GARAGEDOOR07 || - id == MI_LCS_GARAGEDOOR08 || - id == MI_LCS_GARAGEDOOR09 || - id == MI_LCS_GARAGEDOOR10 || - id == MI_LCS_GARAGEDOOR11 || - id == MI_LCS_GARAGEDOOR12 || - id == MI_LCS_GARAGEDOOR13 || - id == MI_LCS_GARAGEDOOR14 || - id == MI_LCS_GARAGEDOOR15 || - id == MI_LCS_GARAGEDOOR16 || - id == MI_LCS_GARAGEDOOR17 || - id == MI_LCS_GARAGEDOOR18 || - id == MI_LCS_GARAGEDOOR19 || - id == MI_LCS_GARAGEDOOR20 || - id == MI_LCS_GARAGEDOOR21 || - id == MI_LCS_GARAGEDOOR22 || - id == MI_LCS_GARAGEDOOR23 || - id == MI_LCS_GARAGEDOOR24 || - id == MI_LCS_GARAGEDOOR25 || - id == MI_LCS_GARAGEDOOR26 || - id == MI_LCS_GARAGEDOOR27 || - id == MI_LCS_GARAGEDOOR28 || - id == MI_LCS_GARAGEDOOR29 || - id == MI_LCS_GARAGEDOOR30 || - id == MI_LCS_GARAGEDOOR31 || - id == MI_LCS_GARAGEDOOR32 || - id == MI_LCS_GARAGEDOOR33 || - id == MI_LCS_GARAGEDOOR34 || - id == MI_LCS_GARAGEDOOR35 || - id == MI_LCS_GARAGEDOOR36 || - id == MI_LCS_GARAGEDOOR37 || - id == MI_LCS_GARAGEDOOR38 || - id == MI_LCS_GARAGEDOOR39 || - id == MI_LCS_GARAGEDOOR40; + return id == MI_GARAGEDOOR1 || + id == MI_GARAGEDOOR17 || + id == MI_GARAGEDOOR27 || + id == MI_GARAGEDOOR28 || + id == MI_GARAGEDOOR29 || + id == MI_GARAGEDOOR30 || + id == MI_GARAGEDOOR31 || + id == MI_GARAGEDOOR32 || + id == MI_GARAGEDOOR33 || + id == MI_GARAGEDOOR34 || + id == MI_GARAGEDOOR35 || + id == MI_GARAGEDOOR36 || + id == MI_GARAGEDOOR37 || + id == MI_GARAGEDOOR38 || + id == MI_GARAGEDOOR39 || + id == MI_CRUSHERBODY || + id == MI_CRUSHERLID || + id == MI_GARAGEDOOR2 || + id == MI_GARAGEDOOR3 || + id == MI_GARAGEDOOR4 || + id == MI_GARAGEDOOR5 || + id == MI_GARAGEDOOR6 || + id == MI_GARAGEDOOR7 || + id == MI_GARAGEDOOR9 || + id == MI_GARAGEDOOR10 || + id == MI_GARAGEDOOR11 || + id == MI_GARAGEDOOR12 || + id == MI_GARAGEDOOR13 || + id == MI_GARAGEDOOR14 || + id == MI_GARAGEDOOR15 || + id == MI_GARAGEDOOR16 || + id == MI_GARAGEDOOR18 || + id == MI_GARAGEDOOR19 || + id == MI_GARAGEDOOR20 || + id == MI_GARAGEDOOR21 || + id == MI_GARAGEDOOR22 || + id == MI_GARAGEDOOR23 || + id == MI_GARAGEDOOR24 || + id == MI_GARAGEDOOR25 || + id == MI_GARAGEDOOR26 || + id == MI_DOOR2_SJL; } -- cgit v1.2.3 From b35b0c598d183e2ba73c73ad82a03f833556dc27 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 23 Jan 2021 03:09:15 +0200 Subject: Enable GTA_BRIDGE --- src/control/Bridge.cpp | 20 ++++++++++++++++++++ src/control/Bridge.h | 1 + 2 files changed, 21 insertions(+) (limited to 'src/control') diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index 1e63cf30..e7c76a9c 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -161,3 +161,23 @@ bool CBridge::ThisIsABridgeObjectMovingUp(int index) return false; #endif } + +void CBridge::ForceBridgeState(uint8 state) +{ +#ifdef GTA_BRIDGE + State = state; + switch (state) + { + case STATE_BRIDGE_LOCKED: + case STATE_LIFT_PART_MOVING_DOWN: + case STATE_LIFT_PART_ABOUT_TO_MOVE_UP: + ThePaths.SetLinksBridgeLights(-330.0f, -230.0f, -700.0f, -588.0f, true); + break; + case STATE_BRIDGE_ALWAYS_UNLOCKED: + ThePaths.SetLinksBridgeLights(-330.0f, -230.0f, -700.0f, -588.0f, false); + break; + default: + break; + } +#endif +} \ No newline at end of file diff --git a/src/control/Bridge.h b/src/control/Bridge.h index dd781a9a..e639d4c1 100644 --- a/src/control/Bridge.h +++ b/src/control/Bridge.h @@ -26,4 +26,5 @@ public: static bool ShouldLightsBeFlashing(); static void FindBridgeEntities(); static bool ThisIsABridgeObjectMovingUp(int); + static void ForceBridgeState(uint8 state); }; -- 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