summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-08-06 23:32:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-08-06 23:32:19 +0200
commit4ae4bc94c692d9fe5781d36a7be6ab72803f6162 (patch)
treebacd3caa49fb507ff6d4f3b15b89d4bb85348d5d /src/core
parentfixed COMMAND_ADD_BLIP_FOR_COORD_OLD (diff)
downloadre3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar.gz
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar.bz2
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar.lz
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar.xz
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.tar.zst
re3-4ae4bc94c692d9fe5781d36a7be6ab72803f6162.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/IniFile.cpp28
-rw-r--r--src/core/IniFile.h10
-rw-r--r--src/core/common.h2
3 files changed, 39 insertions, 1 deletions
diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp
new file mode 100644
index 00000000..08b30876
--- /dev/null
+++ b/src/core/IniFile.cpp
@@ -0,0 +1,28 @@
+#include "common.h"
+#include "patcher.h"
+#include "IniFile.h"
+
+#include "CarCtrl.h"
+#include "FileMgr.h"
+#include "main.h"
+#include "Population.h"
+
+float &CIniFile::PedNumberMultiplier = *(float*)0x6182F4;
+float &CIniFile::CarNumberMultiplier = *(float*)0x6182F8;
+
+void CIniFile::LoadIniFile()
+{
+ CFileMgr::SetDir("");
+ int f = CFileMgr::OpenFile("gta3.ini", "r");
+ if (f){
+ CFileMgr::ReadLine(f, gString, 200);
+ sscanf(gString, "%f", &PedNumberMultiplier);
+ PedNumberMultiplier = min(3.0f, max(0.5f, PedNumberMultiplier));
+ CFileMgr::ReadLine(f, gString, 200);
+ sscanf(gString, "%f", &CarNumberMultiplier);
+ CarNumberMultiplier = min(3.0f, max(0.5f, CarNumberMultiplier));
+ CFileMgr::CloseFile(f);
+ }
+ CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
+ CCarCtrl::MaxNumberOfCarsInUse = 12.0f * CarNumberMultiplier;
+} \ No newline at end of file
diff --git a/src/core/IniFile.h b/src/core/IniFile.h
new file mode 100644
index 00000000..9a98151b
--- /dev/null
+++ b/src/core/IniFile.h
@@ -0,0 +1,10 @@
+#pragma once
+
+class CIniFile
+{
+public:
+ static void LoadIniFile();
+
+ static float& PedNumberMultiplier;
+ static float& CarNumberMultiplier;
+};
diff --git a/src/core/common.h b/src/core/common.h
index 97a25a3f..2b4c466a 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -179,7 +179,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define ABS(a) (((a) < 0) ? (-a) : (a))
+#define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))