summaryrefslogtreecommitdiffstats
path: root/src/core/Wanted.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-07 21:09:40 +0200
committerGitHub <noreply@github.com>2019-07-07 21:09:40 +0200
commit6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3 (patch)
tree726feb5b5fdc365ffdaa44208380e738d69ad2ff /src/core/Wanted.cpp
parentMerge pull request #120 from ShFil119/audio4 (diff)
parentDarkel is bored. (diff)
downloadre3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar.gz
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar.bz2
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar.lz
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar.xz
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.tar.zst
re3-6ec421fe7bc683e0d056d2a1b9d0bd0d159cf8e3.zip
Diffstat (limited to 'src/core/Wanted.cpp')
-rw-r--r--src/core/Wanted.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index ece68e64..21853308 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -2,6 +2,8 @@
#include "patcher.h"
#include "Wanted.h"
+int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714;
+
bool CWanted::AreSwatRequired()
{
return m_nWantedLevel >= 4;
@@ -33,4 +35,95 @@ int CWanted::NumOfHelisRequired()
default:
return 0;
};
+}
+
+void CWanted::SetWantedLevel(int32 level)
+{
+ ClearQdCrimes();
+ switch (level) {
+ case NOTWANTED:
+ m_nChaos = 0;
+ break;
+ case WANTEDLEVEL_1:
+ m_nChaos = 60;
+ break;
+ case WANTEDLEVEL_2:
+ m_nChaos = 220;
+ break;
+ case WANTEDLEVEL_3:
+ m_nChaos = 420;
+ break;
+ case WANTEDLEVEL_4:
+ m_nChaos = 820;
+ break;
+ case WANTEDLEVEL_5:
+ m_nChaos = 1620;
+ break;
+ case WANTEDLEVEL_6:
+ m_nChaos = 3220;
+ break;
+ default:
+ if (level > MaximumWantedLevel)
+ m_nChaos = MaximumWantedLevel;
+ break;
+ }
+ UpdateWantedLevel();
+}
+
+void CWanted::ClearQdCrimes()
+{
+ for (int i = 0; i < 16; i++) {
+ m_sCrimes[i].m_eCrimeType = CRIME_NONE;
+ };
+}
+
+void CWanted::UpdateWantedLevel()
+{
+ int32 CurrWantedLevel = m_nWantedLevel;
+
+ if (m_nChaos >= 0 && m_nChaos < 40) {
+ m_nWantedLevel = NOTWANTED;
+ m_MaximumLawEnforcerVehicles = 0;
+ m_MaxCops = 0;
+ m_RoadblockDensity = 0;
+ }
+ else if (m_nChaos >= 40 && m_nChaos < 200) {
+ m_nWantedLevel = WANTEDLEVEL_1;
+ m_MaximumLawEnforcerVehicles = 1;
+ m_MaxCops = 1;
+ m_RoadblockDensity = 0;
+ }
+ else if (m_nChaos >= 200 && m_nChaos < 400) {
+ m_nWantedLevel = WANTEDLEVEL_2;
+ m_MaximumLawEnforcerVehicles = 2;
+ m_MaxCops = 3;
+ m_RoadblockDensity = 0;
+ }
+ else if (m_nChaos >= 400 && m_nChaos < 800) {
+ m_nWantedLevel = WANTEDLEVEL_3;
+ m_MaximumLawEnforcerVehicles = 2;
+ m_MaxCops = 4;
+ m_RoadblockDensity = 4;
+ }
+ else if (m_nChaos >= 800 && m_nChaos < 1600) {
+ m_nWantedLevel = WANTEDLEVEL_4;
+ m_MaximumLawEnforcerVehicles = 2;
+ m_MaxCops = 6;
+ m_RoadblockDensity = 8;
+ }
+ else if (m_nChaos >= 1600 && m_nChaos < 3200) {
+ m_nWantedLevel = WANTEDLEVEL_5;
+ m_MaximumLawEnforcerVehicles = 3;
+ m_MaxCops = 8;
+ m_RoadblockDensity = 10;
+ }
+ else if (m_nChaos >= 3200) {
+ m_nWantedLevel = WANTEDLEVEL_6;
+ m_MaximumLawEnforcerVehicles = 3;
+ m_MaxCops = 10;
+ m_RoadblockDensity = 12;
+ }
+
+ if (CurrWantedLevel != m_nWantedLevel)
+ m_nLastWantedLevelChange = CTimer::GetTimeInMilliseconds();
} \ No newline at end of file