summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-06-07 14:23:52 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-06-07 14:23:52 +0200
commit0b156f1d26abd336cdfff540a753741359dfb3ef (patch)
tree47122f2fdec07fbf72961980ef5e6dc3ba40ab50
parentfixed some arithmetic (diff)
downloadre3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar.gz
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar.bz2
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar.lz
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar.xz
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.tar.zst
re3-0b156f1d26abd336cdfff540a753741359dfb3ef.zip
Diffstat (limited to '')
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/core/Stats.cpp11
-rw-r--r--src/core/Stats.h7
3 files changed, 17 insertions, 3 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 66aa825d..d7a0486a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11956,7 +11956,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
return 0;
case COMMAND_REGISTER_BEST_POSITION:
CollectParameters(&m_nIp, 2);
- debug("REGISTER_BEST_POSITION not implemented\n");
+ CStats::RegisterBestPosition(ScriptParams[0], ScriptParams[1]);
return 0;
case COMMAND_IS_PLAYER_IN_INFO_ZONE:
{
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 91f583bd..bc69105b 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -60,6 +60,7 @@ int32 CStats::mmRain;
int32 CStats::CarsCrushed;
int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES];
int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
+int32 CStats::BestPositions[CStats::TOTAL_BEST_POSITIONS];
int32 CStats::PropertyDestroyed;
int32 CStats::Sprayings;
@@ -119,6 +120,8 @@ void CStats::Init()
FastestTimes[i] = 0;
for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++)
HighestScores[i] = 0;
+ for (int i = 0; i < TOTAL_BEST_POSITIONS; i++)
+ BestPositions[i] = INT_MAX;
for (int i = 0; i < NUM_PEDTYPES; i++)
PedsKilledOfThisType[i] = 0;
IndustrialPassed = 0;
@@ -146,6 +149,12 @@ void CStats::RegisterHighestScore(int32 index, int32 score)
HighestScores[index] = Max(HighestScores[index], score);
}
+void CStats::RegisterBestPosition(int32 index, int32 position)
+{
+ assert(index >= 0 && index < TOTAL_BEST_POSITIONS);
+ BestPositions[index] = Min(BestPositions[index], position);
+}
+
void CStats::RegisterElBurroTime(int32 time)
{
ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time;
@@ -377,6 +386,7 @@ void CStats::SaveStats(uint8 *buf, uint32 *size)
CopyToBuf(buf, TotalNumberMissions);
CopyToBuf(buf, FastestTimes);
CopyToBuf(buf, HighestScores);
+ CopyToBuf(buf, BestPositions);
CopyToBuf(buf, KillsSinceLastCheckpoint);
CopyToBuf(buf, TotalLegitimateKills);
CopyToBuf(buf, LastMissionPassedName);
@@ -440,6 +450,7 @@ void CStats::LoadStats(uint8 *buf, uint32 size)
CopyFromBuf(buf, TotalNumberMissions);
CopyFromBuf(buf, FastestTimes);
CopyFromBuf(buf, HighestScores);
+ CopyFromBuf(buf, BestPositions);
CopyFromBuf(buf, KillsSinceLastCheckpoint);
CopyFromBuf(buf, TotalLegitimateKills);
CopyFromBuf(buf, LastMissionPassedName);
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 33d4ef72..8588fef1 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -6,8 +6,9 @@ class CStats
{
public:
enum {
- TOTAL_FASTEST_TIMES = 16,
- TOTAL_HIGHEST_SCORES = 16
+ TOTAL_FASTEST_TIMES = 23,
+ TOTAL_HIGHEST_SCORES = 5,
+ TOTAL_BEST_POSITIONS = 1
};
//TODO
static int32 SeagullsKilled;
@@ -65,6 +66,7 @@ public:
static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
+ static int32 BestPositions[TOTAL_BEST_POSITIONS];
static int32 PropertyDestroyed;
static int32 Sprayings;
static float AutoPaintingBudget;
@@ -77,6 +79,7 @@ public:
static void Init(void);
static void RegisterFastestTime(int32, int32);
static void RegisterHighestScore(int32, int32);
+ static void RegisterBestPosition(int32, int32);
static void RegisterElBurroTime(int32);
static void Register4x4OneTime(int32);
static void Register4x4TwoTime(int32);