diff options
author | aap <aap@papnet.eu> | 2019-09-15 09:36:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-15 09:36:38 +0200 |
commit | ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3 (patch) | |
tree | 6e3b9e8bb1f43b4952ed5f4910e3d7f05d47037f /src/core | |
parent | Merge pull request #207 from Nick007J/master (diff) | |
parent | Merge branch 'carctrl_dev' (diff) | |
download | re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.gz re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.bz2 re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.lz re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.xz re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.zst re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Fire.cpp | 25 | ||||
-rw-r--r-- | src/core/Fire.h | 11 | ||||
-rw-r--r-- | src/core/config.h | 3 |
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 |