summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-09-15 01:28:07 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-09-15 01:28:07 +0200
commit368ce0d4e5607b2c7e442efe73da71b266c8727b (patch)
tree6e3b9e8bb1f43b4952ed5f4910e3d7f05d47037f /src/core
parentfix debug (diff)
downloadre3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar.gz
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar.bz2
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar.lz
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar.xz
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.tar.zst
re3-368ce0d4e5607b2c7e442efe73da71b266c8727b.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Fire.cpp25
-rw-r--r--src/core/Fire.h11
-rw-r--r--src/core/config.h3
3 files changed, 37 insertions, 2 deletions
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index a2894d43..2181f91c 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -6,5 +6,30 @@ CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
+CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance)
+{
+ for (int i = 0; i < MAX_FIREMEN_ATTENDING; i++) {
+ int fireId = -1;
+ float minDistance = 999999;
+ for (int j = 0; j < NUM_FIRES; j++) {
+ if (!m_aFires[j].m_bIsOngoing)
+ continue;
+ if (m_aFires[j].m_bIsScriptFire)
+ continue;
+ if (m_aFires[j].m_nFiremenPuttingOut != i)
+ continue;
+ float distance = (m_aFires[j].m_vecPos - vecPos).Magnitude2D();
+ if (distance < minDistance) {
+ minDistance = distance;
+ fireId = j;
+ }
+ }
+ *pDistance = minDistance;
+ if (fireId != -1)
+ return &m_aFires[fireId];
+ }
+ return nil;
+}
+
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }
diff --git a/src/core/Fire.h b/src/core/Fire.h
index 040e9a25..5080fd89 100644
--- a/src/core/Fire.h
+++ b/src/core/Fire.h
@@ -6,7 +6,7 @@ class CFire
{
public:
bool m_bIsOngoing;
- bool m_bExists;
+ bool m_bIsScriptFire;
bool m_bPropogationFlag;
bool m_bAudioSet;
CVector m_vecPos;
@@ -16,7 +16,7 @@ public:
int m_nStartTime;
int field_20;
int field_24;
- int field_28;
+ uint32 m_nFiremenPuttingOut;
float field_2C;
void Extinguish(void);
@@ -24,8 +24,15 @@ public:
class CFireManager
{
+ enum {
+ MAX_FIREMEN_ATTENDING = 2,
+ };
+ uint32 m_nTotalFires;
+ CFire m_aFires[NUM_FIRES];
public:
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float);
+ CFire *FindNearestFire(CVector, float*);
+ uint32 GetTotalActiveFires() const { return m_nTotalFires; }
};
extern CFireManager &gFireManager;
diff --git a/src/core/config.h b/src/core/config.h
index ddd22ed2..81e2f2fb 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -75,6 +75,9 @@ enum Config {
NUM_CARGENS = 160,
NUM_PATH_NODES_IN_AUTOPILOT = 8,
+
+ NUM_ACCIDENTS = 20,
+ NUM_FIRES = 40
};
// We'll use this once we're ready to become independent of the game