1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-26 13:37:36 +00:00

CExplosion done

This commit is contained in:
Roman Masanin 2020-10-05 16:14:48 +03:00
parent 4867d9949d
commit e3273d7268
2 changed files with 25 additions and 22 deletions

View file

@ -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++;

View file

@ -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];