mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 11:34:14 +01:00
some audio and part of CExplosion
This commit is contained in:
parent
9d53b738cc
commit
4867d9949d
@ -4784,11 +4784,10 @@ void
|
|||||||
cAudioManager::ProcessExplosions(int32 explosion)
|
cAudioManager::ProcessExplosions(int32 explosion)
|
||||||
{
|
{
|
||||||
uint8 type;
|
uint8 type;
|
||||||
CVector *pos;
|
|
||||||
float distSquared;
|
float distSquared;
|
||||||
|
|
||||||
for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
|
for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
|
||||||
if (CExplosion::GetExplosionActiveCounter(i) == 1) {
|
if (CExplosion::DoesExplosionMakeSound(i) && CExplosion::GetExplosionActiveCounter(i) == 1) {
|
||||||
CExplosion::ResetExplosionActiveCounter(i);
|
CExplosion::ResetExplosionActiveCounter(i);
|
||||||
type = CExplosion::GetExplosionType(i);
|
type = CExplosion::GetExplosionType(i);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -4796,42 +4795,44 @@ cAudioManager::ProcessExplosions(int32 explosion)
|
|||||||
case EXPLOSION_ROCKET:
|
case EXPLOSION_ROCKET:
|
||||||
case EXPLOSION_BARREL:
|
case EXPLOSION_BARREL:
|
||||||
case EXPLOSION_TANK_GRENADE:
|
case EXPLOSION_TANK_GRENADE:
|
||||||
m_sQueueSample.m_fSoundIntensity = 400.0f;
|
m_sQueueSample.m_fSoundIntensity = 200.0f;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
|
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
|
||||||
m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
|
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
m_sQueueSample.m_bRequireReflection = true;
|
||||||
break;
|
break;
|
||||||
case EXPLOSION_MOLOTOV:
|
case EXPLOSION_MOLOTOV:
|
||||||
m_sQueueSample.m_fSoundIntensity = 200.0f;
|
m_sQueueSample.m_fSoundIntensity = 150.0f;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3;
|
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3;
|
||||||
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
|
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
m_sQueueSample.m_bRequireReflection = false;
|
||||||
break;
|
break;
|
||||||
case EXPLOSION_MINE:
|
case EXPLOSION_MINE:
|
||||||
case EXPLOSION_HELI_BOMB:
|
case EXPLOSION_HELI_BOMB:
|
||||||
m_sQueueSample.m_fSoundIntensity = 300.0f;
|
m_sQueueSample.m_fSoundIntensity = 200.0f;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
|
m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
|
||||||
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347;
|
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
m_sQueueSample.m_bRequireReflection = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_sQueueSample.m_fSoundIntensity = 400.0f;
|
m_sQueueSample.m_fSoundIntensity = 200.0f;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
|
m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
|
||||||
m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
|
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19500;
|
||||||
if (type == EXPLOSION_HELI)
|
if (type == EXPLOSION_HELI)
|
||||||
m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10;
|
m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; //same *= 8 / 10;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
m_sQueueSample.m_nReleasingVolumeModificator = 0;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos = CExplosion::GetExplosionPosition(i);
|
m_sQueueSample.m_vecPos = *CExplosion::GetExplosionPosition(i);
|
||||||
m_sQueueSample.m_vecPos = *pos;
|
|
||||||
distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||||
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
|
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
|
||||||
m_sQueueSample.m_fDistance = Sqrt(distSquared);
|
m_sQueueSample.m_fDistance = distSquared <= 0.0f ? 0.0f : Sqrt(distSquared);
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
if (m_sQueueSample.m_nVolume != 0) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = i;
|
m_sQueueSample.m_nCounter = i;
|
||||||
@ -4839,12 +4840,10 @@ cAudioManager::ProcessExplosions(int32 explosion)
|
|||||||
m_sQueueSample.m_bIs2D = false;
|
m_sQueueSample.m_bIs2D = false;
|
||||||
m_sQueueSample.m_nLoopCount = 1;
|
m_sQueueSample.m_nLoopCount = 1;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
m_sQueueSample.m_bReleasingSoundFlag = true;
|
||||||
m_sQueueSample.m_bReverbFlag = true;
|
|
||||||
m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
|
m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
|
||||||
m_sQueueSample.m_nLoopStart = 0;
|
m_sQueueSample.m_nLoopStart = 0;
|
||||||
m_sQueueSample.m_nLoopEnd = -1;
|
m_sQueueSample.m_nLoopEnd = -1;
|
||||||
m_sQueueSample.m_bReverbFlag = true;
|
m_sQueueSample.m_bReverbFlag = true;
|
||||||
m_sQueueSample.m_bRequireReflection = true;
|
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5933,15 +5932,15 @@ cAudioManager::ProcessGarages()
|
|||||||
void
|
void
|
||||||
cAudioManager::ProcessFireHydrant()
|
cAudioManager::ProcessFireHydrant()
|
||||||
{
|
{
|
||||||
|
static const int SOUND_INTENSITY = 35;
|
||||||
|
|
||||||
float distSquared;
|
float distSquared;
|
||||||
bool distCalculated = false;
|
|
||||||
static const int intensity = 35;
|
|
||||||
|
|
||||||
m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
|
m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
|
||||||
distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||||
if (distSquared < SQR(intensity)) {
|
if (distSquared < SQR(SOUND_INTENSITY)) {
|
||||||
CalculateDistance(distCalculated, distSquared);
|
m_sQueueSample.m_fDistance = distSquared <= 0.0f ? 0.0f : Sqrt(distSquared);
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(40, 35.0f, m_sQueueSample.m_fDistance);
|
||||||
if (m_sQueueSample.m_nVolume != 0) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
m_sQueueSample.m_nCounter = 0;
|
m_sQueueSample.m_nCounter = 0;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
||||||
@ -5954,7 +5953,7 @@ cAudioManager::ProcessFireHydrant()
|
|||||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
||||||
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
|
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
|
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
|
||||||
m_sQueueSample.m_fSoundIntensity = intensity;
|
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
m_sQueueSample.m_bReleasingSoundFlag = false;
|
||||||
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
||||||
m_sQueueSample.m_bReverbFlag = true;
|
m_sQueueSample.m_bReverbFlag = true;
|
||||||
|
@ -257,9 +257,9 @@ public:
|
|||||||
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; // done
|
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; // done
|
||||||
int32 CreateEntity(eAudioType type, void *entity); // done
|
int32 CreateEntity(eAudioType type, void *entity); // done
|
||||||
|
|
||||||
void DestroyAllGameCreatedEntities();
|
void DestroyAllGameCreatedEntities(); // done ? I don't seed pEntity = nil;
|
||||||
void DestroyEntity(int32 id); //done (inlined in vc)
|
void DestroyEntity(int32 id); // done (inlined in vc) ? I not seen id checks
|
||||||
void DoPoliceRadioCrackle();
|
void DoPoliceRadioCrackle(); // done
|
||||||
|
|
||||||
// functions returning talk sfx,
|
// functions returning talk sfx,
|
||||||
// order from GetPedCommentSfx
|
// order from GetPedCommentSfx
|
||||||
@ -296,12 +296,12 @@ public:
|
|||||||
|
|
||||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
||||||
|
|
||||||
void PlayLoadedMissionAudio(uint8 slot); // done
|
void PlayLoadedMissionAudio(uint8 slot); // done
|
||||||
void PlayOneShot(int32 index, int16 sound, float vol); // done
|
void PlayOneShot(int32 index, int16 sound, float vol); // done
|
||||||
void PlaySuspectLastSeen(float x, float y, float z);
|
void PlaySuspectLastSeen(float x, float y, float z); //
|
||||||
void PlayerJustGotInCar() const; // done
|
void PlayerJustGotInCar() const; // done
|
||||||
void PlayerJustLeftCar() const; // done
|
void PlayerJustLeftCar() const; // done
|
||||||
void PostInitialiseGameSpecificSetup();
|
void PostInitialiseGameSpecificSetup(); //
|
||||||
void PostTerminateGameSpecificShutdown(); // done
|
void PostTerminateGameSpecificShutdown(); // done
|
||||||
void PreInitialiseGameSpecificSetup() const; // done
|
void PreInitialiseGameSpecificSetup() const; // done
|
||||||
void PreloadMissionAudio(uint8 slot, Const char *name); // done
|
void PreloadMissionAudio(uint8 slot, Const char *name); // done
|
||||||
@ -317,40 +317,40 @@ public:
|
|||||||
void ProcessBridgeOneShots();
|
void ProcessBridgeOneShots();
|
||||||
void ProcessBridgeWarning();
|
void ProcessBridgeWarning();
|
||||||
#endif
|
#endif
|
||||||
bool ProcessCarBombTick(cVehicleParams *params); //done
|
bool ProcessCarBombTick(cVehicleParams *params); // done
|
||||||
void ProcessCesna(cVehicleParams *params);
|
void ProcessCesna(cVehicleParams *params); //
|
||||||
//void ProcessCrane();
|
//void ProcessCrane(); //
|
||||||
bool ProcessEngineDamage(cVehicleParams *params); //done
|
bool ProcessEngineDamage(cVehicleParams *params); // done
|
||||||
void ProcessEntity(int32 sound); //done
|
void ProcessEntity(int32 sound); // done
|
||||||
void ProcessExplosions(int32 explosion);
|
void ProcessExplosions(int32 explosion); // done
|
||||||
void ProcessFireHydrant();
|
void ProcessFireHydrant(); // done
|
||||||
void ProcessFires(int32 entity);
|
void ProcessFires(int32 entity); //
|
||||||
void ProcessFrontEnd();
|
void ProcessFrontEnd(); //
|
||||||
void ProcessGarages();
|
void ProcessGarages(); //
|
||||||
void ProcessCarHeli(cVehicleParams* params); //done
|
void ProcessCarHeli(cVehicleParams* params); // done
|
||||||
void ProcessVehicleFlatTyre(cVehicleParams* params); //done
|
void ProcessVehicleFlatTyre(cVehicleParams* params); // done
|
||||||
void ProcessJumbo(cVehicleParams *);
|
void ProcessJumbo(cVehicleParams *); //
|
||||||
void ProcessJumboAccel(CPlane *plane);
|
void ProcessJumboAccel(CPlane *plane); //
|
||||||
void ProcessJumboDecel(CPlane *plane);
|
void ProcessJumboDecel(CPlane *plane); //
|
||||||
void ProcessJumboFlying();
|
void ProcessJumboFlying(); //
|
||||||
void ProcessJumboLanding(CPlane *plane);
|
void ProcessJumboLanding(CPlane *plane); //
|
||||||
void ProcessJumboTakeOff(CPlane *plane);
|
void ProcessJumboTakeOff(CPlane *plane); //
|
||||||
void ProcessJumboTaxi();
|
void ProcessJumboTaxi(); //
|
||||||
void ProcessLoopingScriptObject(uint8 sound);
|
void ProcessLoopingScriptObject(uint8 sound); //
|
||||||
void ProcessMissionAudio();
|
void ProcessMissionAudio(); //
|
||||||
void ProcessMissionAudioSlot(uint8 slot);
|
void ProcessMissionAudioSlot(uint8 slot); //
|
||||||
void ProcessModelCarEngine(cVehicleParams *params);
|
void ProcessModelCarEngine(cVehicleParams *params); //
|
||||||
void ProcessOneShotScriptObject(uint8 sound);
|
void ProcessOneShotScriptObject(uint8 sound); //
|
||||||
void ProcessPed(CPhysical *ped);
|
void ProcessPed(CPhysical *ped); //
|
||||||
void ProcessPedOneShots(cPedParams *params);
|
void ProcessPedOneShots(cPedParams *params); //
|
||||||
void ProcessPhysical(int32 id); //done
|
void ProcessPhysical(int32 id); // done
|
||||||
void ProcessPlane(cVehicleParams *params); //done
|
void ProcessPlane(cVehicleParams *params); // done
|
||||||
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); //done
|
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); // done
|
||||||
void ProcessProjectiles();
|
void ProcessProjectiles(); //
|
||||||
void ProcessRainOnVehicle(cVehicleParams *params);
|
void ProcessRainOnVehicle(cVehicleParams *params); //
|
||||||
void ProcessReverb() const;
|
void ProcessReverb() const; //
|
||||||
bool ProcessReverseGear(cVehicleParams *params); //done
|
bool ProcessReverseGear(cVehicleParams *params); // done
|
||||||
void ProcessScriptObject(int32 id); //done
|
void ProcessScriptObject(int32 id); // done
|
||||||
void ProcessSpecial();
|
void ProcessSpecial();
|
||||||
#ifdef GTA_TRAIN
|
#ifdef GTA_TRAIN
|
||||||
bool ProcessTrainNoise(cVehicleParams *params);
|
bool ProcessTrainNoise(cVehicleParams *params);
|
||||||
|
@ -85,6 +85,12 @@ CExplosion::GetExplosionType(uint8 id)
|
|||||||
return gaExplosion[id].m_ExplosionType;
|
return gaExplosion[id].m_ExplosionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CExplosion::DoesExplosionMakeSound(uint8 id)
|
||||||
|
{
|
||||||
|
return gaExplosion[id].m_bIsMakeSound;
|
||||||
|
};
|
||||||
|
|
||||||
CVector *
|
CVector *
|
||||||
CExplosion::GetExplosionPosition(uint8 id)
|
CExplosion::GetExplosionPosition(uint8 id)
|
||||||
{
|
{
|
||||||
@ -92,14 +98,16 @@ CExplosion::GetExplosionPosition(uint8 id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk)
|
CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool isMakeSound)
|
||||||
{
|
{
|
||||||
|
const RwRGBA color = { 160, 160, 160, 255 };
|
||||||
|
const RwRGBA colorGrenade = { 96, 96, 96, 255 };
|
||||||
|
|
||||||
CVector pPosn;
|
CVector pPosn;
|
||||||
CVector posGround;
|
CVector posGround;
|
||||||
|
|
||||||
RwRGBA colorMedium = colMedExpl;
|
RwRGBA colorMedium = colMedExpl;
|
||||||
bool bDontExplode = false;
|
bool bDontExplode = false;
|
||||||
const RwRGBA color = { 160, 160, 160, 255 };
|
|
||||||
pPosn = pos;
|
pPosn = pos;
|
||||||
pPosn.z += 5.0f;
|
pPosn.z += 5.0f;
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
@ -129,6 +137,7 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
explosion.m_nIteration = 1;
|
explosion.m_nIteration = 1;
|
||||||
explosion.m_nActiveCounter = 1;
|
explosion.m_nActiveCounter = 1;
|
||||||
explosion.m_bIsBoat = false;
|
explosion.m_bIsBoat = false;
|
||||||
|
explosion.m_bIsMakeSound = true;
|
||||||
explosion.m_nParticlesExpireTime = lifetime != 0 ? CTimer::GetTimeInMilliseconds() + lifetime : 0;
|
explosion.m_nParticlesExpireTime = lifetime != 0 ? CTimer::GetTimeInMilliseconds() + lifetime : 0;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -140,8 +149,13 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
posGround = pos;
|
posGround = pos;
|
||||||
posGround.z = CWorld::FindGroundZFor3DCoord(posGround.x, posGround.y, posGround.z + 3.0f, nil);
|
posGround.z = CWorld::FindGroundZFor3DCoord(posGround.x, posGround.y, posGround.z + 3.0f, nil);
|
||||||
CEventList::RegisterEvent(EVENT_EXPLOSION, posGround, 250);
|
CEventList::RegisterEvent(EVENT_EXPLOSION, posGround, 250);
|
||||||
if (Distance(explosion.m_vecPosition, TheCamera.GetPosition()) < 40.0f)
|
if (Distance(explosion.m_vecPosition, TheCamera.GetPosition()) < 40.0f) {
|
||||||
CParticle::AddParticle(PARTICLE_EXPLOSION_LFAST, explosion.m_vecPosition, CVector(0.0f, 0.0f, 0.0f), nil, 5.5f, color);
|
uint8 tmp = CGeneral::GetRandomNumberInRange(0, 64) - 64;
|
||||||
|
RwRGBA tmpColor = colorGrenade;
|
||||||
|
tmpColor.green += tmp;
|
||||||
|
tmpColor.blue += tmp;
|
||||||
|
CParticle::AddParticle(PARTICLE_EXPLOSION_LFAST, explosion.m_vecPosition, CVector(0.0f, 0.0f, 0.0f), nil, 4.5f, tmpColor);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EXPLOSION_MOLOTOV:
|
case EXPLOSION_MOLOTOV:
|
||||||
{
|
{
|
||||||
@ -151,18 +165,17 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
explosion.m_fPropagationRate = 0.5f;
|
explosion.m_fPropagationRate = 0.5f;
|
||||||
posGround = pos;
|
posGround = pos;
|
||||||
bool found;
|
bool found;
|
||||||
posGround.z = CWorld::FindGroundZFor3DCoord(posGround.x, posGround.y, posGround.z + 3.0f, &found);
|
float tmp = CWorld::FindGroundZFor3DCoord(posGround.x, posGround.y, posGround.z + 3.0f, &found);
|
||||||
if (found) {
|
if (found)
|
||||||
float waterLevel;
|
posGround.z = tmp;
|
||||||
if (CWaterLevel::GetWaterLevelNoWaves(posGround.x, posGround.y, posGround.z, &waterLevel)
|
|
||||||
&& posGround.z < waterLevel
|
float waterLevel;
|
||||||
&& waterLevel - 6.0f < posGround.z) // some subway/tunnels check?
|
if (CWaterLevel::GetWaterLevelNoWaves(posGround.x, posGround.y, posGround.z, &waterLevel)
|
||||||
bDontExplode = true;
|
&& posGround.z < waterLevel && waterLevel - 6.0f < posGround.z) { // some subway/tunnels check?
|
||||||
else
|
|
||||||
gFireManager.StartFire(posGround, 1.8f, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bDontExplode = true;
|
bDontExplode = true;
|
||||||
|
} else if (found) {
|
||||||
|
gFireManager.StartFire(posGround, 1.8f, false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXPLOSION_ROCKET:
|
case EXPLOSION_ROCKET:
|
||||||
@ -186,60 +199,71 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
if (explosion.m_pVictimEntity->IsVehicle() && ((CVehicle*)explosion.m_pVictimEntity)->IsBoat())
|
if (explosion.m_pVictimEntity->IsVehicle() && ((CVehicle*)explosion.m_pVictimEntity)->IsBoat())
|
||||||
explosion.m_bIsBoat = true;
|
explosion.m_bIsBoat = true;
|
||||||
CEventList::RegisterEvent(EVENT_EXPLOSION, EVENT_ENTITY_VEHICLE, explosion.m_pVictimEntity, nil, 1000);
|
CEventList::RegisterEvent(EVENT_EXPLOSION, EVENT_ENTITY_VEHICLE, explosion.m_pVictimEntity, nil, 1000);
|
||||||
} else
|
} else {
|
||||||
CEventList::RegisterEvent(EVENT_EXPLOSION, pos, 1000);
|
CEventList::RegisterEvent(EVENT_EXPLOSION, pos, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
if (explosion.m_pVictimEntity != nil && !explosion.m_bIsBoat) {
|
if (explosion.m_pVictimEntity != nil && !explosion.m_bIsBoat) {
|
||||||
int rn = (CGeneral::GetRandomNumber() & 1) + 2;
|
|
||||||
for (int i = 0; i < rn; i++) {
|
|
||||||
CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, explosion.m_pVictimEntity->GetPosition(), CVector(0.0f, 0.0f, 0.0f), nil, 3.5f, colMedExpl);
|
|
||||||
CParticle::AddParticle(PARTICLE_EXPLOSION_LFAST, explosion.m_pVictimEntity->GetPosition(), CVector(0.0f, 0.0f, 0.0f), nil, 5.5f, color);
|
|
||||||
}
|
|
||||||
CVehicle *veh = (CVehicle*)explosion.m_pVictimEntity;
|
CVehicle *veh = (CVehicle*)explosion.m_pVictimEntity;
|
||||||
int32 component = CAR_WING_LR;
|
CVector componentPos;
|
||||||
|
|
||||||
// miami leftover
|
if (veh->IsBike()) {
|
||||||
if (veh->IsBike())
|
veh->GetComponentWorldPosition(BIKE_FORKS_REAR, componentPos);
|
||||||
component = BIKE_FORKS_REAR;
|
} else if (veh->IsComponentPresent(CAR_BUMP_REAR) && veh->IsComponentPresent(CAR_WHEEL_LB)) { //mb it's another enum
|
||||||
|
CVector tmpVec;
|
||||||
if (veh->IsComponentPresent(component)) {
|
veh->GetComponentWorldPosition(CAR_BUMP_REAR, componentPos);
|
||||||
CVector componentPos;
|
veh->GetComponentWorldPosition(CAR_WHEEL_LB, tmpVec);
|
||||||
veh->GetComponentWorldPosition(component, componentPos);
|
componentPos += tmpVec;
|
||||||
rn = (CGeneral::GetRandomNumber() & 1) + 1;
|
componentPos /= 2.0f;
|
||||||
|
} else if (veh->IsComponentPresent(CAR_BOOT)) {
|
||||||
|
veh->GetComponentWorldPosition(CAR_BOOT, componentPos);
|
||||||
|
}
|
||||||
|
if (componentPos != nil) {
|
||||||
|
int rn = (CGeneral::GetRandomNumber() & 1) + 1;
|
||||||
for (int i = 0; i < rn; i++)
|
for (int i = 0; i < rn; i++)
|
||||||
CParticle::AddJetExplosion(componentPos, 1.4f, 0.0f);
|
CParticle::AddJetExplosion(componentPos, (CGeneral::GetRandomNumber() & 7) / 7.0f + 1.5f, 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXPLOSION_HELI:
|
case EXPLOSION_HELI:
|
||||||
case EXPLOSION_HELI2:
|
case EXPLOSION_HELI2:
|
||||||
explosion.m_fRadius = 6.0f;
|
if (type == EXPLOSION_HELI2) {
|
||||||
explosion.m_fPower = 300.0f;
|
explosion.m_fRadius = 12.0f;
|
||||||
|
explosion.m_fPower = 500.0f;
|
||||||
|
} else {
|
||||||
|
explosion.m_fRadius = 6.0f;
|
||||||
|
explosion.m_fPower = 300.0f;
|
||||||
|
}
|
||||||
explosion.m_fStopTime = lifetime + CTimer::GetTimeInMilliseconds() + 750;
|
explosion.m_fStopTime = lifetime + CTimer::GetTimeInMilliseconds() + 750;
|
||||||
explosion.m_fPropagationRate = 0.5f;
|
explosion.m_fPropagationRate = 0.5f;
|
||||||
explosion.m_fStartTime = CTimer::GetTimeInMilliseconds();
|
explosion.m_fStartTime = CTimer::GetTimeInMilliseconds();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
CVector randpos;
|
CVector randpos;
|
||||||
uint8 x, y, z;
|
|
||||||
|
|
||||||
x = CGeneral::GetRandomNumber();
|
randpos.x = CGeneral::GetRandomNumber();
|
||||||
y = CGeneral::GetRandomNumber();
|
randpos.y = CGeneral::GetRandomNumber();
|
||||||
z = CGeneral::GetRandomNumber();
|
randpos.z = CGeneral::GetRandomNumber();
|
||||||
randpos = pos + CVector(x - 128, y - 128, z - 128) / 20.0f;
|
randpos -= CVector(128, 128, 128);
|
||||||
|
randpos /= 20.0f;
|
||||||
|
randpos += pos;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_EXPLOSION_MFAST, randpos, CVector(0.0f, 0.0f, 0.0f), nil, 2.5f, color);
|
CParticle::AddParticle(PARTICLE_EXPLOSION_MFAST, randpos, CVector(0.0f, 0.0f, 0.0f), nil, 2.5f, color);
|
||||||
|
|
||||||
x = CGeneral::GetRandomNumber();
|
randpos.x = CGeneral::GetRandomNumber();
|
||||||
y = CGeneral::GetRandomNumber();
|
randpos.y = CGeneral::GetRandomNumber();
|
||||||
z = CGeneral::GetRandomNumber();
|
randpos.z = CGeneral::GetRandomNumber();
|
||||||
randpos = pos + CVector(x - 128, y - 128, z - 128) / 20.0f;
|
randpos -= CVector(128, 128, 128);
|
||||||
|
randpos /= 20.0f;
|
||||||
|
randpos += pos;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_EXPLOSION_LFAST, randpos, CVector(0.0f, 0.0f, 0.0f), nil, 5.0f, color);
|
CParticle::AddParticle(PARTICLE_EXPLOSION_LFAST, randpos, CVector(0.0f, 0.0f, 0.0f), nil, 5.0f, color);
|
||||||
|
|
||||||
x = CGeneral::GetRandomNumber();
|
randpos.x = CGeneral::GetRandomNumber();
|
||||||
y = CGeneral::GetRandomNumber();
|
randpos.y = CGeneral::GetRandomNumber();
|
||||||
z = CGeneral::GetRandomNumber();
|
randpos.z = CGeneral::GetRandomNumber();
|
||||||
randpos = pos + CVector(x - 128, y - 128, z - 128) / 20.0f;
|
randpos -= CVector(128, 128, 128);
|
||||||
|
randpos /= 20.0f;
|
||||||
|
randpos += pos;
|
||||||
|
|
||||||
CParticle::AddJetExplosion(randpos, 1.4f, 3.0f);
|
CParticle::AddJetExplosion(randpos, 1.4f, 3.0f);
|
||||||
}
|
}
|
||||||
@ -262,13 +286,10 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
explosion.m_fPropagationRate = 0.5f;
|
explosion.m_fPropagationRate = 0.5f;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
CVector randpos;
|
CVector randpos;
|
||||||
uint8 x, y, z;
|
randpos.x = CGeneral::GetRandomNumber();
|
||||||
|
randpos.y = CGeneral::GetRandomNumber();
|
||||||
x = CGeneral::GetRandomNumber();
|
randpos.z = CGeneral::GetRandomNumber();
|
||||||
y = CGeneral::GetRandomNumber();
|
randpos -= CVector(128, 128, 128);
|
||||||
z = CGeneral::GetRandomNumber();
|
|
||||||
randpos = CVector(x - 128, y - 128, z - 128);
|
|
||||||
|
|
||||||
randpos.x /= 50.0f;
|
randpos.x /= 50.0f;
|
||||||
randpos.y /= 50.0f;
|
randpos.y /= 50.0f;
|
||||||
randpos.z /= 25.0f;
|
randpos.z /= 25.0f;
|
||||||
@ -300,7 +321,11 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 4.0f, nil); // BUG? result is unused
|
CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 4.0f, nil); // BUG? result is unused
|
||||||
CEventList::RegisterEvent(EVENT_EXPLOSION, posGround, 250);
|
CEventList::RegisterEvent(EVENT_EXPLOSION, posGround, 250);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
debug("Undefined explosion type, AddExplosion, Explosion.cpp");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bDontExplode) {
|
if (bDontExplode) {
|
||||||
explosion.m_nIteration = 0;
|
explosion.m_nIteration = 0;
|
||||||
return false;
|
return false;
|
||||||
@ -309,8 +334,12 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
|||||||
if (explosion.m_fPower != 0.0f && explosion.m_nParticlesExpireTime == 0)
|
if (explosion.m_fPower != 0.0f && explosion.m_nParticlesExpireTime == 0)
|
||||||
CWorld::TriggerExplosion(pos, explosion.m_fRadius, explosion.m_fPower, culprit, (type == EXPLOSION_ROCKET || type == EXPLOSION_CAR_QUICK || type == EXPLOSION_MINE || type == EXPLOSION_BARREL || type == EXPLOSION_TANK_GRENADE || type == EXPLOSION_HELI_BOMB));
|
CWorld::TriggerExplosion(pos, explosion.m_fRadius, explosion.m_fPower, culprit, (type == EXPLOSION_ROCKET || type == EXPLOSION_CAR_QUICK || type == EXPLOSION_MINE || type == EXPLOSION_BARREL || type == EXPLOSION_TANK_GRENADE || type == EXPLOSION_HELI_BOMB));
|
||||||
|
|
||||||
TheCamera.CamShake(0.6f, pos.x, pos.y, pos.z);
|
if (type == EXPLOSION_MOLOTOV) {
|
||||||
CPad::GetPad(0)->StartShake_Distance(300, 128, pos.x, pos.y, pos.z);
|
TheCamera.CamShake(0.2f, pos.x, pos.y, pos.z);
|
||||||
|
} else {
|
||||||
|
TheCamera.CamShake(0.6f, pos.x, pos.y, pos.z);
|
||||||
|
CPad::GetPad(0)->StartShake_Distance(300, 128, pos.x, pos.y, pos.z);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,11 @@ class CExplosion
|
|||||||
float m_fStopTime;
|
float m_fStopTime;
|
||||||
uint8 m_nIteration;
|
uint8 m_nIteration;
|
||||||
uint8 m_nActiveCounter;
|
uint8 m_nActiveCounter;
|
||||||
|
bool m_bIsBoat;
|
||||||
|
bool m_bIsMakeSound;
|
||||||
float m_fStartTime;
|
float m_fStartTime;
|
||||||
uint32 m_nParticlesExpireTime;
|
uint32 m_nParticlesExpireTime;
|
||||||
float m_fPower;
|
float m_fPower;
|
||||||
bool m_bIsBoat;
|
|
||||||
float m_fZshift;
|
float m_fZshift;
|
||||||
public:
|
public:
|
||||||
static void Initialise();
|
static void Initialise();
|
||||||
@ -43,8 +44,8 @@ public:
|
|||||||
static void ResetExplosionActiveCounter(uint8 id);
|
static void ResetExplosionActiveCounter(uint8 id);
|
||||||
static uint8 GetExplosionType(uint8 id);
|
static uint8 GetExplosionType(uint8 id);
|
||||||
static CVector *GetExplosionPosition(uint8 id);
|
static CVector *GetExplosionPosition(uint8 id);
|
||||||
// TODO(MIAMI): that new parameter
|
static bool DoesExplosionMakeSound(uint8 id); //done
|
||||||
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk = true);
|
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 void Update();
|
||||||
static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2);
|
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 RemoveAllExplosionsInArea(CVector pos, float radius);
|
||||||
|
Loading…
Reference in New Issue
Block a user