From 2814f2e8cf4491adf4bfccb4371ada95243ce5fa Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 23 Jan 2021 12:49:54 +0100 Subject: [PATCH 1/3] wrong path node array --- src/control/PathFind.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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(); From f6fb473cf97b5175263c1b1cc63bc512dc567ac7 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 23 Jan 2021 12:59:52 +0100 Subject: [PATCH 2/3] revert accident --- src/save/GenericGameStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index ee946480..d177aa17 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -345,7 +345,7 @@ GenericLoad() #endif ReadDataFromBufferPointer(buf, CGame::currArea); ReadDataFromBufferPointer(buf, CVehicle::bAllTaxisHaveNitro); - buf += align4bytes(sizeof(CPad::bInvertLook4Pad)); + ReadDataFromBufferPointer(buf, CPad::bInvertLook4Pad); ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour); ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn); ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter); From b5c4866964a281ad9ab18dfd7218e1ef168f15f4 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 23 Jan 2021 15:29:00 +0300 Subject: [PATCH 3/3] added some missing functions --- src/control/Garages.cpp | 40 +++++++++++++++++++++++++++++++++++++++- src/control/Garages.h | 5 +++++ 2 files changed, 44 insertions(+), 1 deletion(-) 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*);