summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Stats.cpp70
-rw-r--r--src/core/Stats.h18
-rw-r--r--src/core/config.h4
4 files changed, 83 insertions, 11 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index b9e8e94e..5b7a53e9 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -627,7 +627,7 @@ CCam::LookBehind(void)
DeltaBeta = TargetOrientation - Beta;
while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
while(DeltaBeta < -PI) DeltaBeta += 2*PI;
- if(DirectionWasLooking == LOOKING_BEHIND)
+ if(DirectionWasLooking != LOOKING_BEHIND)
LookBehindCamWasInFront = DeltaBeta <= -HALFPI || DeltaBeta >= HALFPI;
if(LookBehindCamWasInFront)
TargetOrientation += PI;
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 9478479b..aeb7afe5 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -12,7 +12,7 @@ bool& CStats::SuburbanPassed = *(bool*)0x8F2740;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
-int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
+int32(&CStats::PedsKilledOfThisType)[NUM_PEDTYPES] = *(int32(*)[NUM_PEDTYPES]) * (uintptr*)0x880DBC;
int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
@@ -48,11 +48,73 @@ int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4;
int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24;
int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884;
int32& CStats::TotalNumberMissions = *(int32*)0x8E2820;
-int32& CStats::KgOfExplosivesUsed = *(int32*)0x8F2510;
+int32& CStats::ShotsMade = *(int32*)0x8E2BE8;
+int32& CStats::KgsOfExplosivesUsed = *(int32*)0x8F2510;
+int32& CStats::InstantHitsFiredByPlayer = *(int32*)0x943070;
+int32& CStats::InstantHitsHitByPlayer = *(int32*)0x95CB8C;
+int32& CStats::BestTimeBombDefusal = *(int32*)0x880E24;
+int32& CStats::mmRain = *(int32*)0x8F2C98;
int32& CStats::CarsCrushed = *(int32*)0x943050;
int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128;
int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0;
+void CStats::Init()
+{
+ PeopleKilledByOthers = 0;
+ PeopleKilledByPlayer = 0;
+ ShotsMade = 0;
+ CarsExploded = 0;
+ HelisDestroyed = 0;
+ ProgressMade = 0;
+ KgsOfExplosivesUsed = 0;
+ InstantHitsFiredByPlayer = 0;
+ InstantHitsHitByPlayer = 0;
+ CarsCrushed = 0;
+ HeadsPopped = 0;
+ TimesArrested = 0;
+ TimesDied = 0;
+ DaysPassed = 0;
+ NumberOfUniqueJumpsFound = 0;
+ mmRain = 0;
+ MaximumJumpFlips = 0;
+ MaximumJumpSpins = 0;
+ MaximumJumpDistance = 0;
+ MaximumJumpHeight = 0;
+ BestStuntJump = 0;
+ TotalNumberOfUniqueJumps = 0;
+ Record4x4One = 0;
+ LongestFlightInDodo = 0;
+ Record4x4Two = 0;
+ PassengersDroppedOffWithTaxi = 0;
+ Record4x4Three = 0;
+ MoneyMadeWithTaxi = 0;
+ Record4x4Mayhem = 0;
+ LivesSavedWithAmbulance = 0;
+ ElBurroTime = 0;
+ CriminalsCaught = 0;
+ MissionsGiven = 0;
+ HighestLevelAmbulanceMission = 0;
+ MissionsPassed = 0;
+ FiresExtinguished = 0;
+ DistanceTravelledOnFoot = 0;
+ TimeTakenDefuseMission = 0;
+ NumberKillFrenziesPassed = 0;
+ DistanceTravelledInVehicle = 0;
+ TotalNumberKillFrenzies = 0;
+ TotalNumberMissions = 0;
+ KillsSinceLastCheckpoint = 0;
+ TotalLegitimateKills = 0;
+ for (int i = 0; i < TOTAL_FASTEST_TIMES; i++)
+ FastestTimes[i] = 0;
+ for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++)
+ HighestScores[i] = 0;
+ for (int i = 0; i < NUM_PEDTYPES; i++)
+ PedsKilledOfThisType[i] = 0;
+ IndustrialPassed = 0;
+ CommercialPassed = 0;
+ SuburbanPassed = 0;
+}
+
void CStats::RegisterFastestTime(int32 index, int32 time)
{
assert(index >= 0 && index < TOTAL_FASTEST_TIMES);
@@ -138,4 +200,6 @@ void CStats::SetTotalNumberMissions(int32 total)
TotalNumberMissions = total;
}
-WRAPPER void CStats::Init() { EAXJMP(0x4AAC60); } \ No newline at end of file
+STARTPATCHES
+ InjectHook(0x48C5A3, CStats::Init, PATCH_JUMP); // CGame::ReInitGameObjectVariables
+ENDPATCHES \ No newline at end of file
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 1d220905..029b2307 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -1,5 +1,7 @@
#pragma once
+#include "PedType.h"
+
class CStats
{
public:
@@ -8,14 +10,14 @@ public:
TOTAL_HIGHEST_SCORES = 16
};
static int32 &DaysPassed;
- static int32 &HeadsPopped;
+ static int32 &HeadsPopped;
static bool& CommercialPassed;
static bool& IndustrialPassed;
static bool& SuburbanPassed;
static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers;
static int32 &HelisDestroyed;
- static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
+ static int32(&PedsKilledOfThisType)[ePedType::NUM_PEDTYPES];
static int32 &TimesDied;
static int32 &TimesArrested;
static int32 &KillsSinceLastCheckpoint;
@@ -50,11 +52,16 @@ public:
static int32 &LongestFlightInDodo;
static int32 &TimeTakenDefuseMission;
static int32 &TotalNumberKillFrenzies;
- static int32 &TotalNumberMissions;
+ static int32 &TotalNumberMissions;
+ static int32 &ShotsMade;
+ static int32 &KgsOfExplosivesUsed;
+ static int32 &InstantHitsFiredByPlayer;
+ static int32 &InstantHitsHitByPlayer;
+ static int32 &BestTimeBombDefusal;
+ static int32 &mmRain;
+ static int32 &CarsCrushed;
static int32(&FastestTimes)[TOTAL_FASTEST_TIMES];
static int32(&HighestScores)[TOTAL_HIGHEST_SCORES];
- static int32 &KgOfExplosivesUsed;
- static int32 &CarsCrushed;
public:
static void RegisterFastestTime(int32, int32);
@@ -76,6 +83,5 @@ public:
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
static void RegisterElBurroTime(int32);
static void SaveStats(uint8 *buf, uint32 *size);
-
static void Init(void);
};
diff --git a/src/core/config.h b/src/core/config.h
index 373fca2f..cb2b9f1d 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -120,7 +120,9 @@ enum Config {
NUM_AUDIO_REFLECTIONS = 5,
NUM_SCRIPT_MAX_ENTITIES = 40,
- NUM_GARAGE_STORED_CARS = 6
+ NUM_GARAGE_STORED_CARS = 6,
+
+ NUM_CRANES = 8
};
// We'll use this once we're ready to become independent of the game