diff options
Diffstat (limited to '')
-rw-r--r-- | src/control/CarCtrl.cpp | 8 | ||||
-rw-r--r-- | src/control/Script.cpp | 66 | ||||
-rw-r--r-- | src/control/ScriptCommands.h | 3 |
3 files changed, 39 insertions, 38 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index ae38b68f..f347b2c9 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -1868,6 +1868,9 @@ void CCarCtrl::Init(void) NumFiretrucksOnDuty = 0; LastTimeFireTruckCreated = 0; LastTimeAmbulanceCreated = 0; +#ifdef FIX_BUGS + LastTimeLawEnforcerCreated = 0; +#endif bCarsGeneratedAroundCamera = false; CountDownToCarsAtStart = 2; CarDensityMultiplier = 1.0f; @@ -1890,6 +1893,11 @@ void CCarCtrl::ReInit(void) NumPermanentCars = 0; NumAmbulancesOnDuty = 0; NumFiretrucksOnDuty = 0; +#ifdef FIX_BUGS + LastTimeFireTruckCreated = 0; + LastTimeAmbulanceCreated = 0; + LastTimeLawEnforcerCreated = 0; +#endif CountDownToCarsAtStart = 2; CarDensityMultiplier = 1.0f; for (int i = 0; i < MAX_CARS_TO_KEEP; i++) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 7ab40847..1f65ce6e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -256,10 +256,6 @@ void CUpsideDownCarCheck::UpdateTimers() { uint32 timeStep = CTimer::GetTimeStepInMilliseconds(); for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ -#ifdef FIX_BUGS - if (m_sCars[i].m_nVehicleIndex == -1) - continue; -#endif CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex); if (v){ if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex)) @@ -1674,13 +1670,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) return 0; } case COMMAND_GENERATE_RANDOM_INT: -#ifdef FIX_BUGS - // Not a very good fix but before switching to PS2 rand, it sort of works - *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumberInRange(0, 65535); -#else - /* On PC between 0 and 32767, even though script expects values between 0 and 65536 */ *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumber(); -#endif return 0; case COMMAND_CREATE_CHAR: { @@ -2314,20 +2304,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) assert(pCurrent); // GetIndex(0) doesn't look good int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){ -#ifdef FIX_BUGS - if (CTheScripts::StoreVehicleIndex != -1) -#endif - { - CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); - if (pOld){ - CCarCtrl::RemoveFromInterestingVehicleList(pOld); - if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){ - pOld->VehicleCreatedBy = RANDOM_VEHICLE; - pOld->bIsLocked = false; - CCarCtrl::NumRandomCars++; - CCarCtrl::NumMissionCars--; - CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); - } + CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); + if (pOld){ + CCarCtrl::RemoveFromInterestingVehicleList(pOld); + if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){ + pOld->VehicleCreatedBy = RANDOM_VEHICLE; + pOld->bIsLocked = false; + CCarCtrl::NumRandomCars++; + CCarCtrl::NumMissionCars--; + CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); } } @@ -2370,20 +2355,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) assert(pCurrent); // Here pCurrent shouldn't be NULL anyway int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) { -#ifdef FIX_BUGS - if (CTheScripts::StoreVehicleIndex != -1) -#endif - { - CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); - if (pOld){ - CCarCtrl::RemoveFromInterestingVehicleList(pOld); - if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){ - pOld->VehicleCreatedBy = RANDOM_VEHICLE; - pOld->bIsLocked = false; - CCarCtrl::NumRandomCars++; - CCarCtrl::NumMissionCars--; - CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); - } + CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); + if (pOld){ + CCarCtrl::RemoveFromInterestingVehicleList(pOld); + if (pOld->VehicleCreatedBy == MISSION_VEHICLE && CTheScripts::StoreVehicleWasRandom){ + pOld->VehicleCreatedBy = RANDOM_VEHICLE; + pOld->bIsLocked = false; + CCarCtrl::NumRandomCars++; + CCarCtrl::NumMissionCars--; + CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); } } @@ -9652,6 +9632,16 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) #endif return 0; #endif +#ifndef GTA3_1_1_PATCH + case COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER: + CollectParameters(&m_nIp, 1); +#ifdef FIX_BUGS + CPed::nThreatReactionRangeMultiplier = *(float*)&ScriptParams[0]; +#else + CPed::nThreatReactionRangeMultiplier = (float)ScriptParams[0]; +#endif + return 0; +#endif default: assert(0); } diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h index dafe2418..77cf3f0f 100644 --- a/src/control/ScriptCommands.h +++ b/src/control/ScriptCommands.h @@ -1156,5 +1156,8 @@ enum { COMMAND_IS_CHAR_LYING_DOWN, COMMAND_CAN_CHAR_SEE_DEAD_CHAR, COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, +#ifndef GTA3_1_1_PATCH + COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER +#endif #endif };
\ No newline at end of file |