summaryrefslogtreecommitdiffstats
path: root/src/core/Wanted.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/Wanted.cpp')
-rw-r--r--src/core/Wanted.cpp146
1 files changed, 82 insertions, 64 deletions
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 909674d0..65bc84d8 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -10,16 +10,19 @@
#include "CopPed.h"
#include "Wanted.h"
#include "General.h"
+#include "Stats.h"
int32 CWanted::MaximumWantedLevel = 6;
-int32 CWanted::nMaximumWantedLevel = 6400;
+int32 CWanted::nMaximumWantedLevel = 9600;
void
CWanted::Initialise()
{
m_nChaos = 0;
+ m_nMinChaos = 0;
m_nLastUpdateTime = 0;
m_nLastWantedLevelChange = 0;
+ m_nLastTimeSuspended = 0;
m_CurrentCops = 0;
m_MaxCops = 0;
m_MaximumLawEnforcerVehicles = 0;
@@ -31,6 +34,7 @@ CWanted::Initialise()
m_bArmyRequired = false;
m_fCrimeSensitivity = 1.0f;
m_nWantedLevel = 0;
+ m_nMinWantedLevel = 0;
m_CopsBeatingSuspect = 0;
for (int i = 0; i < ARRAY_SIZE(m_pCops); i++)
@@ -40,6 +44,12 @@ CWanted::Initialise()
}
bool
+CWanted::AreMiamiViceRequired()
+{
+ return m_nWantedLevel >= 3;
+}
+
+bool
CWanted::AreSwatRequired()
{
return m_nWantedLevel == 4 || m_bSwatRequired;
@@ -69,7 +79,7 @@ CWanted::NumOfHelisRequired()
return 1;
case 5:
case 6:
- return 2;
+ return 1;
default:
return 0;
}
@@ -87,22 +97,22 @@ CWanted::SetWantedLevel(int32 level)
m_nChaos = 0;
break;
case 1:
- m_nChaos = 60;
+ m_nChaos = 70;
break;
case 2:
- m_nChaos = 220;
+ m_nChaos = 200;
break;
case 3:
- m_nChaos = 420;
+ m_nChaos = 570;
break;
case 4:
- m_nChaos = 820;
+ m_nChaos = 1220;
break;
case 5:
- m_nChaos = 1620;
+ m_nChaos = 2420;
break;
case 6:
- m_nChaos = 3220;
+ m_nChaos = 4820;
break;
default:
break;
@@ -113,11 +123,21 @@ CWanted::SetWantedLevel(int32 level)
void
CWanted::SetWantedLevelNoDrop(int32 level)
{
+ if (m_nWantedLevel < m_nMinWantedLevel)
+ SetWantedLevel(m_nMinWantedLevel);
+
if (level > m_nWantedLevel)
SetWantedLevel(level);
}
void
+CWanted::CheatWantedLevel(int32 level)
+{
+ SetWantedLevel(level);
+ UpdateWantedLevel();
+}
+
+void
CWanted::SetMaximumWantedLevel(int32 level)
{
switch(level){
@@ -126,27 +146,27 @@ CWanted::SetMaximumWantedLevel(int32 level)
MaximumWantedLevel = 0;
break;
case 1:
- nMaximumWantedLevel = 120;
+ nMaximumWantedLevel = 115;
MaximumWantedLevel = 1;
break;
case 2:
- nMaximumWantedLevel = 300;
+ nMaximumWantedLevel = 365;
MaximumWantedLevel = 2;
break;
case 3:
- nMaximumWantedLevel = 600;
+ nMaximumWantedLevel = 875;
MaximumWantedLevel = 3;
break;
case 4:
- nMaximumWantedLevel = 1200;
+ nMaximumWantedLevel = 1800;
MaximumWantedLevel = 4;
break;
case 5:
- nMaximumWantedLevel = 2400;
+ nMaximumWantedLevel = 3600;
MaximumWantedLevel = 5;
break;
case 6:
- nMaximumWantedLevel = 4800;
+ nMaximumWantedLevel = 7200;
MaximumWantedLevel = 6;
break;
}
@@ -161,10 +181,10 @@ CWanted::RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool po
void
CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
{
-#if defined FIX_SIGNIFICANT_BUGS || defined PEDS_REPORT_CRIMES_ON_PHONE
- if (!AddCrimeToQ(type, id, coors, true, policeDoesntCare))
+#ifdef FIX_SIGNIFICANT_BUGS
+ if(!AddCrimeToQ(type, id, coors, true, policeDoesntCare))
#else
- if (!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
+ if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
#endif
ReportCrimeNow(type, coors, policeDoesntCare);
}
@@ -223,9 +243,6 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
chaos *= 0.333f;
switch(type){
case CRIME_POSSESSION_GUN:
-#ifdef PEDS_REPORT_CRIMES_ON_PHONE
- m_nChaos += 5.0f*chaos;
-#endif
break;
case CRIME_HIT_PED:
m_nChaos += 5.0f*chaos;
@@ -272,10 +289,20 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
case CRIME_DESTROYED_CESSNA:
m_nChaos += 500.0f*chaos;
break;
+ case CRIME_EXPLOSION:
+ m_nChaos += 25.0f * chaos;
+ break;
+ case CRIME_HIT_PED_NASTYWEAPON:
+ m_nChaos += 35.0f * chaos;
+ break;
+ case CRIME_HIT_COP_NASTYWEAPON:
+ m_nChaos += 100.0f * chaos;
+ break;
default:
// Error("Undefined crime type, RegisterCrime, Crime.cpp"); // different file for some reason
Error("Undefined crime type, RegisterCrime, Wanted.cpp");
}
+ m_nChaos = Max(m_nChaos, m_nMinChaos);
DMAudio.ReportCrime(type, coors);
UpdateWantedLevel();
}
@@ -288,47 +315,49 @@ CWanted::UpdateWantedLevel()
if (m_nChaos > nMaximumWantedLevel)
m_nChaos = nMaximumWantedLevel;
- if (m_nChaos >= 0 && m_nChaos < 40) {
+ if (m_nChaos >= 0 && m_nChaos < 50) {
+ if (m_nWantedLevel == 1)
+ ++CStats::WantedStarsEvaded;
m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0;
m_MaxCops = 0;
m_RoadblockDensity = 0;
- }
- else if (m_nChaos >= 40 && m_nChaos < 200) {
+ } else if (m_nChaos >= 50 && m_nChaos < 180) {
+ CStats::WantedStarsAttained += 1 - m_nWantedLevel;
m_nWantedLevel = 1;
m_MaximumLawEnforcerVehicles = 1;
m_MaxCops = 1;
m_RoadblockDensity = 0;
- }
- else if (m_nChaos >= 200 && m_nChaos < 400) {
+ } else if (m_nChaos >= 180 && m_nChaos < 550) {
+ CStats::WantedStarsAttained += 2 - m_nWantedLevel;
m_nWantedLevel = 2;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 3;
m_RoadblockDensity = 0;
- }
- else if (m_nChaos >= 400 && m_nChaos < 800) {
+ } else if (m_nChaos >= 550 && m_nChaos < 1200) {
+ CStats::WantedStarsAttained += 3 - m_nWantedLevel;
m_nWantedLevel = 3;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 4;
- m_RoadblockDensity = 4;
- }
- else if (m_nChaos >= 800 && m_nChaos < 1600) {
+ m_RoadblockDensity = 12;
+ } else if (m_nChaos >= 1200 && m_nChaos < 2400) {
+ CStats::WantedStarsAttained += 4 - m_nWantedLevel;
m_nWantedLevel = 4;
m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 6;
- m_RoadblockDensity = 8;
- }
- else if (m_nChaos >= 1600 && m_nChaos < 3200) {
+ m_RoadblockDensity = 18;
+ } else if (m_nChaos >= 2400 && m_nChaos < 4800) {
+ CStats::WantedStarsAttained += 5 - m_nWantedLevel;
m_nWantedLevel = 5;
m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 8;
- m_RoadblockDensity = 10;
- }
- else if (m_nChaos >= 3200) {
+ m_RoadblockDensity = 24;
+ } else if (m_nChaos >= 4800) {
+ CStats::WantedStarsAttained += 6 - m_nWantedLevel;
m_nWantedLevel = 6;
m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 10;
- m_RoadblockDensity = 12;
+ m_RoadblockDensity = 30;
}
if (CurrWantedLevel != m_nWantedLevel)
@@ -370,6 +399,10 @@ CWanted::WorkOutPolicePresence(CVector posn, float radius)
void
CWanted::Update(void)
{
+ if (CTimer::GetTimeInMilliseconds() > m_nLastTimeSuspended + 20000) {
+ m_nMinChaos = 0;
+ m_nMinWantedLevel = 0;
+ }
if (CTimer::GetTimeInMilliseconds() - m_nLastUpdateTime > 1000) {
if (m_nWantedLevel > 1) {
m_nLastUpdateTime = CTimer::GetTimeInMilliseconds();
@@ -447,30 +480,6 @@ CWanted::Reset(void)
Initialise();
}
-#ifdef PEDS_REPORT_CRIMES_ON_PHONE
-bool
-CrimeShouldBeReportedOnPhone(eCrimeType crime)
-{
- switch (crime) {
- case CRIME_POSSESSION_GUN:
- case CRIME_HIT_PED:
- case CRIME_HIT_COP:
- case CRIME_SHOOT_PED:
- case CRIME_SHOOT_COP:
- case CRIME_STEAL_CAR:
- case CRIME_RECKLESS_DRIVING:
- case CRIME_RUNOVER_PED:
- case CRIME_RUNOVER_COP:
- case CRIME_PED_BURNED:
- case CRIME_COP_BURNED:
- case CRIME_VEHICLE_BURNED:
- return true;
- default:
- return false;
- }
-}
-#endif
-
void
CWanted::UpdateCrimesQ(void)
{
@@ -478,9 +487,6 @@ CWanted::UpdateCrimesQ(void)
CCrimeBeingQd &crime = m_aCrimes[i];
if (crime.m_nType != CRIME_NONE) {
-#ifdef PEDS_REPORT_CRIMES_ON_PHONE
- if (!CrimeShouldBeReportedOnPhone(crime.m_nType))
-#endif
if (CTimer::GetTimeInMilliseconds() > crime.m_nTime + 500 && !crime.m_bReported) {
ReportCrimeNow(crime.m_nType, crime.m_vecPosn, crime.m_bPoliceDoesntCare);
crime.m_bReported = true;
@@ -490,3 +496,15 @@ CWanted::UpdateCrimesQ(void)
}
}
}
+
+void
+CWanted::Suspend(void)
+{
+ CStats::WantedStarsEvaded += m_nWantedLevel;
+ m_nMinChaos = m_nChaos;
+ m_nMinWantedLevel = m_nWantedLevel;
+ m_nLastTimeSuspended = CTimer::GetTimeInMilliseconds();
+ m_nChaos = 0;
+ m_nWantedLevel = 0;
+ ResetPolicePursuit();
+}