summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Pad.cpp24
-rw-r--r--src/Wanted.cpp33
-rw-r--r--src/Wanted.h82
-rw-r--r--src/entities/CopPed.h63
4 files changed, 124 insertions, 78 deletions
diff --git a/src/Pad.cpp b/src/Pad.cpp
index 61b7ed06..2e3f1c53 100644
--- a/src/Pad.cpp
+++ b/src/Pad.cpp
@@ -1674,30 +1674,26 @@ int16 CPad::SniperModeLookUpDown(void)
int16 CPad::LookAroundLeftRight(void)
{
- float axis = GetPad(0)->NewState.RightStickX;
+ int16 axis = NewState.RightStickX;
- if ( fabs(axis) > 85 && !GetLookBehindForPed() )
- return (int16) ( (axis + ( axis > 0 ) ? -85 : 85)
- * (127.0f / 32.0f) ); // 3.96875f
+ if ( fabs(axis) > 65 && !GetLookBehindForPed() )
+ return ((axis > 0 ? axis - 65 : axis + 65) * ((255 - 65) / (127 - 32)));
- else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && fabs(axis) > 10 )
- return (int16) ( (axis + ( axis > 0 ) ? -10 : 10)
- * (127.0f / 64.0f) ); // 1.984375f
+ else if (TheCamera.Cams[0].Using3rdPersonMouseCam() && fabs(axis) > 10)
+ return (axis);
return 0;
}
int16 CPad::LookAroundUpDown(void)
{
- int16 axis = GetPad(0)->NewState.RightStickY;
+ int16 axis = NewState.RightStickY;
- if ( abs(axis) > 85 && !GetLookBehindForPed() )
- return (int16) ( (axis + ( axis > 0 ) ? -85 : 85)
- * (127.0f / 32.0f) ); // 3.96875f
+ if (fabs(axis) > 65 && !GetLookBehindForPed())
+ return ((axis > 0 ? axis - 65 : axis + 65) * ((255 - 65) / (127 - 32)));
- else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && abs(axis) > 40 )
- return (int16) ( (axis + ( axis > 0 ) ? -40 : 40)
- * (127.0f / 64.0f) ); // 1.984375f
+ else if (TheCamera.Cams[0].Using3rdPersonMouseCam() && fabs(axis) > 10)
+ return (axis);
return 0;
}
diff --git a/src/Wanted.cpp b/src/Wanted.cpp
index 36bc4f03..ece68e64 100644
--- a/src/Wanted.cpp
+++ b/src/Wanted.cpp
@@ -1,3 +1,36 @@
#include "common.h"
#include "patcher.h"
#include "Wanted.h"
+
+bool CWanted::AreSwatRequired()
+{
+ return m_nWantedLevel >= 4;
+}
+
+bool CWanted::AreFbiRequired()
+{
+ return m_nWantedLevel >= 5;
+}
+
+bool CWanted::AreArmyRequired()
+{
+ return m_nWantedLevel >= 6;
+}
+
+int CWanted::NumOfHelisRequired()
+{
+ if (m_IsIgnoredByCops)
+ return 0;
+
+ // Return value is number of helicopters, no need to name them.
+ switch (m_nWantedLevel) {
+ case WANTEDLEVEL_3:
+ case WANTEDLEVEL_4:
+ return 1;
+ case WANTEDLEVEL_5:
+ case WANTEDLEVEL_6:
+ return 2;
+ default:
+ return 0;
+ };
+} \ No newline at end of file
diff --git a/src/Wanted.h b/src/Wanted.h
index 60af7d8b..aafa9ac0 100644
--- a/src/Wanted.h
+++ b/src/Wanted.h
@@ -1,70 +1,20 @@
#pragma once
#include "Entity.h"
#include "math/Vector.h"
+#include "CopPed.h"
-enum eCrimeType
-{
- CRIME_NONE,
- CRIME_SHOT_FIRED,
- CRIME_PED_FIGHT,
- CRIME_COP_FIGHT,
- CRIME_DAMAGED_PED,
- CRIME_DAMAGED_COP,
- CRIME_CAR_THEFT,
- CRIME_CRIME7,
- CRIME_COP_EVASIVE_DIVE,
- CRIME_COP_EVASIVE_DIVE2,
- CRIME_PED_RUN_OVER,
- CRIME_COP_RUN_OVER,
- CRIME_DESTROYED_HELI,
- CRIME_PED_BURNED,
- CRIME_COP_BURNED,
- CRIME_VEHICLE_BURNED,
- CRIME_DESTROYED_CESSNA,
+enum eWantedLevel {
+ NOTWANTED,
+ WANTEDLEVEL_1,
+ WANTEDLEVEL_2,
+ WANTEDLEVEL_3,
+ WANTEDLEVEL_4,
+ WANTEDLEVEL_5,
+ WANTEDLEVEL_6,
};
-enum eCopType
+class CWanted
{
- COP_STREET = 0,
- COP_FBI = 1,
- COP_SWAT = 2,
- COP_ARMY = 3,
-};
-
-class CCrime {
-public:
- eCrimeType m_eCrimeType;
- CEntity *m_pVictim;
- int32 m_nCrimeTime;
- CVector m_vecCrimePos;
- int8 m_bReported;
- int8 m_bMultiplier;
- int8 pad_20[2];
-};
-
-class CCopPed {
-public:
- int16 m_wRoadblockNode;
- int8 field_1342;
- int8 field_1343;
- float m_fDistanceToTarget;
- int8 m_bIsInPursuit;
- int8 m_bIsDisabledCop;
- int8 field_1350;
- int8 field_1351;
- int8 m_bZoneDisabledButClose;
- int8 m_bZoneDisabled;
- int8 field_1354;
- int8 field_1355;
- int32 field_1356;
- eCopType m_nCopType;
- int8 field_1364;
- int8 field_1365;
- int8 field_1366;
- int8 field_1367;
-};
-
-class CWanted {
public:
int32 m_nChaos;
int32 m_nLastUpdateTime;
@@ -75,11 +25,21 @@ public:
uint8 m_bMaximumLawEnforcerVehicles;
int8 field_19;
int16 m_wRoadblockDensity;
- uint8 m_bFlags;
+ uint8 m_IsIgnoredByCops : 1;
+ uint8 m_IsIgnoredByEveryOne : 1;
+ uint8 m_IsSwatRequired : 1;
+ uint8 m_IsFbiRequired : 1;
+ uint8 m_IdArmyRequired : 1;
int8 field_23;
int32 m_nWantedLevel;
CCrime m_sCrimes[16];
CCopPed *m_pCops[10];
+
+public:
+ bool AreSwatRequired();
+ bool AreFbiRequired();
+ bool AreArmyRequired();
+ int NumOfHelisRequired();
};
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
diff --git a/src/entities/CopPed.h b/src/entities/CopPed.h
index 2658a386..d41c2e9e 100644
--- a/src/entities/CopPed.h
+++ b/src/entities/CopPed.h
@@ -1,11 +1,68 @@
#pragma once
-
#include "Ped.h"
+enum eCrimeType
+{
+ CRIME_NONE,
+ CRIME_SHOT_FIRED,
+ CRIME_PED_FIGHT,
+ CRIME_COP_FIGHT,
+ CRIME_DAMAGED_PED,
+ CRIME_DAMAGED_COP,
+ CRIME_CAR_THEFT,
+ CRIME_CRIME7,
+ CRIME_COP_EVASIVE_DIVE,
+ CRIME_COP_EVASIVE_DIVE2,
+ CRIME_PED_RUN_OVER,
+ CRIME_COP_RUN_OVER,
+ CRIME_DESTROYED_HELI,
+ CRIME_PED_BURNED,
+ CRIME_COP_BURNED,
+ CRIME_VEHICLE_BURNED,
+ CRIME_DESTROYED_CESSNA,
+};
+
+enum eCopType
+{
+ COP_STREET = 0,
+ COP_FBI = 1,
+ COP_SWAT = 2,
+ COP_ARMY = 3,
+};
+
+class CCrime
+{
+public:
+ eCrimeType m_eCrimeType;
+ CEntity *m_pVictim;
+ int32 m_nCrimeTime;
+ CVector m_vecCrimePos;
+ int8 m_bReported;
+ int8 m_bMultiplier;
+ int8 pad_20[2];
+};
+
class CCopPed : public CPed
{
public:
- // 0x53C
- uint8 stuff[28];
+ int16 m_wRoadblockNode;
+ int8 field_1342;
+ int8 field_1343;
+ float m_fDistanceToTarget;
+ int8 m_bIsInPursuit;
+ int8 m_bIsDisabledCop;
+ int8 field_1350;
+ int8 field_1351;
+ int8 m_bZoneDisabledButClose;
+ int8 m_bZoneDisabled;
+ int8 field_1354;
+ int8 field_1355;
+ int32 field_1356;
+ eCopType m_nCopType;
+ int8 field_1364;
+ int8 field_1365;
+ int8 field_1366;
+ int8 field_1367;
};
+
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");