summaryrefslogtreecommitdiffstats
path: root/src/core/Fire.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/Fire.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index e73ffea1..c4c39b1f 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -46,7 +46,7 @@ CFire::ProcessFire(void)
float fDamagePlayer;
float fDamagePeds;
float fDamageVehicle;
- int8 nRandNumber;
+ int16 nRandNumber;
float fGreen;
float fRed;
CVector lightpos;
@@ -152,11 +152,10 @@ CFire::ProcessFire(void)
CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
}
- fGreen = nRandNumber / 128;
- fRed = nRandNumber / 128;
+ fGreen = nRandNumber / 128.f;
+ fRed = nRandNumber / 128.f;
- CPointLights::AddLight(0, m_vecPos, CVector(0.0f, 0.0f, 0.0f),
- 12.0f, fRed, fGreen, 0, 0, 0);
+ CPointLights::AddLight(CPointLights::LIGHT_POINT, m_vecPos, CVector(0.0f, 0.0f, 0.0f), 12.0f, fRed, fGreen, 0.0f, 0, 0);
} else {
Extinguish();
}
@@ -395,19 +394,16 @@ CFireManager::ExtinguishPoint(CVector point, float range)
bool
CFireManager::ExtinguishPointWithWater(CVector point, float range)
{
- int fireI = 0;
- for (int i = 0; i < NUM_FIRES; i++) {
- if (m_aFires[i].m_bIsOngoing) {
- if ((point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range)) {
- fireI = i;
- break;
- }
- }
- }
- if (fireI == NUM_FIRES)
- return false;
-
- CFire *fireToExtinguish = &m_aFires[fireI];
+ int i;
+ for (i = 0; i < NUM_FIRES;) {
+ if (m_aFires[i].m_bIsOngoing && (point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range)) {
+ break;
+ }
+ if (++i >= NUM_FIRES)
+ return false;
+ }
+
+ CFire *fireToExtinguish = &m_aFires[i];
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
CVector steamPos = fireToExtinguish->m_vecPos +
CVector((CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,