summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-10-05 15:14:48 +0200
committerRoman Masanin <36927roma@gmail.com>2020-10-05 15:14:48 +0200
commite3273d72682eac555bcc945c89019f0a7a15e8ec (patch)
tree3b28358fb3fbf566ea357d03f823659664f16ede
parentsome audio and part of CExplosion (diff)
downloadre3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar.gz
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar.bz2
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar.lz
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar.xz
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.tar.zst
re3-e3273d72682eac555bcc945c89019f0a7a15e8ec.zip
-rw-r--r--src/weapons/Explosion.cpp25
-rw-r--r--src/weapons/Explosion.h22
2 files changed, 25 insertions, 22 deletions
diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp
index 5b03eb93..189dc57a 100644
--- a/src/weapons/Explosion.cpp
+++ b/src/weapons/Explosion.cpp
@@ -53,6 +53,7 @@ CExplosion::ClearAllExplosions()
gaExplosion[i].m_nIteration = 0;
gaExplosion[i].m_fStartTime = 0.0f;
gaExplosion[i].m_bIsBoat = false;
+ gaExplosion[i].m_bIsMakeSound = true;
}
}
@@ -365,6 +366,7 @@ CExplosion::Update()
case EXPLOSION_GRENADE:
case EXPLOSION_ROCKET:
case EXPLOSION_HELI:
+ case EXPLOSION_HELI2:
case EXPLOSION_MINE:
case EXPLOSION_BARREL:
if (CTimer::GetFrameCounter() & 1) {
@@ -383,8 +385,10 @@ CExplosion::Update()
point1.z += 5.0f;
CColPoint colPoint;
CEntity *pEntity;
- CWorld::ProcessVerticalLine(point1, -1000.0f, colPoint, pEntity, true, false, false, false, true, false, nil);
- explosion.m_fZshift = colPoint.point.z;
+ if (CWorld::ProcessVerticalLine(point1, -1000.0f, colPoint, pEntity, true, false, false, false, true, false, nil))
+ explosion.m_fZshift = colPoint.point.z;
+ else
+ explosion.m_fZshift = explosion.m_vecPosition.z;
}
float ff = ((float)explosion.m_nIteration * 0.55f);
for (int i = 0; i < 5 * ff; i++) {
@@ -393,8 +397,6 @@ CExplosion::Update()
CVector pos = explosion.m_vecPosition;
pos.x += ff * Sin(angle);
pos.y += ff * Cos(angle);
- pos.z += 5.0f; // what is the point of this?
-
pos.z = explosion.m_fZshift + 0.5f;
CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, CGeneral::GetRandomNumberInRange(-3.0f, 3.0f), CGeneral::GetRandomNumberInRange(-180.0f, 180.0f));
}
@@ -402,9 +404,10 @@ CExplosion::Update()
break;
case EXPLOSION_CAR:
case EXPLOSION_CAR_QUICK:
+ case EXPLOSION_BOAT:
if (someTime >= 3500) {
- if (explosion.m_pVictimEntity != nil && !explosion.m_bIsBoat) {
- if ((CGeneral::GetRandomNumber() & 0xF) == 0) {
+ if (explosion.m_pVictimEntity != nil) {
+ if ((CGeneral::GetRandomNumber() & 0xF) == 0 && !explosion.m_bIsBoat) {
CVehicle *veh = (CVehicle*)explosion.m_pVictimEntity;
uint8 component = CAR_WING_LR;
@@ -415,16 +418,14 @@ CExplosion::Update()
if (veh->IsComponentPresent(component)) {
CVector componentPos;
veh->GetComponentWorldPosition(component, componentPos);
- CParticle::AddJetExplosion(componentPos, 1.5f, 0.0f);
+ CParticle::AddJetExplosion(componentPos, 0.5f, 0.0f);
}
}
if (CTimer::GetTimeInMilliseconds() > explosion.m_fStartTime) {
explosion.m_fStartTime = CTimer::GetTimeInMilliseconds() + 125 + (CGeneral::GetRandomNumber() & 0x7F);
CVector pos = explosion.m_pVictimEntity->GetPosition();
- for (int i = 0; i < (CGeneral::GetRandomNumber() & 1) + 1; i++) {
+ for (int i = 0; i < (CGeneral::GetRandomNumber() & 1) + 1; i++)
CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, CVector(0.0f, 0.0f, 0.0f), nil, 3.5f, color);
- CParticle::AddParticle(PARTICLE_EXPLOSION_LARGE, pos, CVector(0.0f, 0.0f, 0.0f), nil, 5.5f, color);
- }
}
}
if (CTimer::GetFrameCounter() & 1) {
@@ -451,13 +452,15 @@ CExplosion::Update()
CVector pos(x - 128, y - 128, (z % 128) + 1);
pos.Normalise();
- pos *= ff / 5.0f;
+ pos *= (explosion.m_nIteration + 1) * ff / 5.0f;
pos += explosion.m_vecPosition;
pos.z += 0.5f;
CParticle::AddParticle(PARTICLE_EXPLOSION_LARGE, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, CGeneral::GetRandomNumberInRange(-3.0f, 3.0f), CGeneral::GetRandomNumberInRange(-180.0f, 180.0f));
}
}
break;
+ default:
+ break;
}
if (someTime > 0)
explosion.m_nIteration++;
diff --git a/src/weapons/Explosion.h b/src/weapons/Explosion.h
index 66e89a17..f99cb670 100644
--- a/src/weapons/Explosion.h
+++ b/src/weapons/Explosion.h
@@ -37,18 +37,18 @@ class CExplosion
float m_fPower;
float m_fZshift;
public:
- static void Initialise();
- static void ClearAllExplosions();
- static void Shutdown();
- static int8 GetExplosionActiveCounter(uint8 id);
- static void ResetExplosionActiveCounter(uint8 id);
- static uint8 GetExplosionType(uint8 id);
- static CVector *GetExplosionPosition(uint8 id);
- static bool DoesExplosionMakeSound(uint8 id); //done
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool isMakeSound = true); //done(new parametr in android ver is fix for one mission)
- static void Update();
- static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2);
- static void RemoveAllExplosionsInArea(CVector pos, float radius);
+ static void ClearAllExplosions(); //done
+ static bool DoesExplosionMakeSound(uint8 id); //done
+ static int8 GetExplosionActiveCounter(uint8 id); //done
+ static CVector *GetExplosionPosition(uint8 id); //done
+ static uint8 GetExplosionType(uint8 id); //done, mb need change type to tExplosionType
+ static void Initialise(); //done
+ static void RemoveAllExplosionsInArea(CVector pos, float radius); //done
+ static void ResetExplosionActiveCounter(uint8 id); //done
+ static void Shutdown(); //done
+ static void Update(); //done
+ static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2); //done, not used
};
extern CExplosion gaExplosion[NUM_EXPLOSIONS]; \ No newline at end of file