1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-07-01 02:43:47 +00:00

miami pobj

This commit is contained in:
Fire-Head 2020-07-03 02:18:06 +03:00
parent 6cf698badd
commit d4004805f5
4 changed files with 370 additions and 384 deletions

View file

@ -591,7 +591,8 @@ void CGame::ShutDownForRestart(void)
CStreaming::ms_disableStreaming = false; CStreaming::ms_disableStreaming = false;
CRadar::RemoveRadarSections(); CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures(); FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects(); CParticleObject::RemoveAllExpireableParticleObjects();
//CWaterCreatures::RemoveAll(); //TODO VC
CSetPieces::Init(); CSetPieces::Init();
CPedType::Shutdown(); CPedType::Shutdown();
CSpecialFX::Shutdown(); CSpecialFX::Shutdown();

View file

@ -686,15 +686,12 @@ CEntity::AddSteamsFromGround(CVector *unused)
case 4: case 4:
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false); CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false);
break; break;
// TODO(MIAMI): enable this once we have the particle objects
/*
case 5: case 5:
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_VERT, pos, effect->particle.dir, effect->particle.scale, false); CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_VERT, pos, effect->particle.dir, effect->particle.scale, false);
break; break;
case 6: case 6:
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_HORIZ, pos, effect->particle.dir, effect->particle.scale, false); CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_HORIZ, pos, effect->particle.dir, effect->particle.scale, false);
break; break;
*/
} }
} }
} }

View file

@ -162,19 +162,13 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_fSize = size; pobj->m_fSize = size;
pobj->m_fRandVal = 0.0f; pobj->m_fRandVal = 0.0f;
if ( type <= POBJECT_CATALINAS_SHOTGUNFLASH )
{
switch ( type ) switch ( type )
{ {
case POBJECT_PAVEMENT_STEAM: case POBJECT_PAVEMENT_STEAM:
{ {
pobj->m_ParticleType = PARTICLE_STEAM_NY; pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3; pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8; pobj->m_nCreationChance = 8;
break; break;
} }
@ -192,11 +186,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_STEAM_NY; pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3; pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8; pobj->m_nCreationChance = 8;
break; break;
} }
@ -214,20 +204,35 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_STEAM_NY; pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3; pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8; pobj->m_nCreationChance = 8;
pobj->m_Color = CRGBA(16, 16, 16, 255); pobj->m_Color = CRGBA(16, 16, 16, 255);
break; break;
} }
case POBJECT_WATER_FOUNTAIN_VERT:
{
pobj->m_ParticleType = PARTICLE_WATER_HYDRANT;
pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.1f);
break;
}
case POBJECT_WATER_FOUNTAIN_HORIZ:
{
pobj->m_ParticleType = PARTICLE_WATER_HYDRANT;
pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0;
break;
}
case POBJECT_FIRE_HYDRANT: case POBJECT_FIRE_HYDRANT:
{ {
pobj->m_ParticleType = PARTICLE_WATER_HYDRANT; pobj->m_ParticleType = PARTICLE_WATER_HYDRANT;
pobj->m_nNumEffectCycles = 4; pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1; pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0; pobj->m_nCreationChance = 0;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.3f); pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.3f);
@ -241,11 +246,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_CAR_SPLASH; pobj->m_ParticleType = PARTICLE_CAR_SPLASH;
pobj->m_nNumEffectCycles = 0; pobj->m_nNumEffectCycles = 0;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 1; pobj->m_nSkipFrames = 1;
#else
pobj->m_nSkipFrames = 3;
#endif
pobj->m_nCreationChance = 0; pobj->m_nCreationChance = 0;
break; break;
} }
@ -253,11 +254,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
case POBJECT_SPLASHES_AROUND: case POBJECT_SPLASHES_AROUND:
{ {
pobj->m_ParticleType = PARTICLE_SPLASH; pobj->m_ParticleType = PARTICLE_SPLASH;
#ifdef PC_PARTICLE
pobj->m_nNumEffectCycles = 15; pobj->m_nNumEffectCycles = 15;
#else
pobj->m_nNumEffectCycles = 30;
#endif
pobj->m_nSkipFrames = 2; pobj->m_nSkipFrames = 2;
pobj->m_nCreationChance = 0; pobj->m_nCreationChance = 0;
break; break;
@ -267,11 +264,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_FLAME; pobj->m_ParticleType = PARTICLE_FLAME;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 2; pobj->m_nSkipFrames = 2;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 2; pobj->m_nCreationChance = 2;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f);
break; break;
@ -281,11 +274,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_FLAME; pobj->m_ParticleType = PARTICLE_FLAME;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 2; pobj->m_nSkipFrames = 2;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 4; pobj->m_nCreationChance = 4;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f);
break; break;
@ -315,11 +304,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{ {
pobj->m_ParticleType = PARTICLE_EXPLOSION_MEDIUM; pobj->m_ParticleType = PARTICLE_EXPLOSION_MEDIUM;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3; pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 2; pobj->m_nCreationChance = 2;
pobj->m_fRandVal = 0.01f; pobj->m_fRandVal = 0.01f;
break; break;
@ -340,7 +325,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_ParticleType = PARTICLE_FLAME; pobj->m_ParticleType = PARTICLE_FLAME;
pobj->m_nNumEffectCycles = 1; pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1; pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 2; pobj->m_nCreationChance = 0;
pobj->m_fRandVal = 0.1f; pobj->m_fRandVal = 0.1f;
break; break;
} }
@ -364,21 +349,50 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds(); pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds();
break; break;
} }
}
case POBJECT_CATALINAS_GUNFLASH: return pobj;
case POBJECT_CATALINAS_SHOTGUNFLASH: }
CParticleObject *
CParticleObject::AddObject(tParticleType type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, uint8 numEffectCycles, uint8 skipFrames, uint16 creationChance, uint8 remove)
{ {
pobj->m_ParticleType = PARTICLE_GUNFLASH_NOANIM; CParticleObject *pobj = pUnusedListHead;
pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1; ASSERT(pobj != NULL);
pobj->m_nCreationChance = 0;
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds(); if ( pobj == NULL )
pobj->m_vecTarget.Normalise(); {
break; printf("Error: No particle objects available!\n");
} return NULL;
}
} }
MoveToList(&pUnusedListHead, &pCloseListHead, pobj);
pobj->m_nState = POBJECTSTATE_UPDATE_CLOSE;
pobj->m_Type = (eParticleObjectType)-1;
pobj->m_ParticleType = type;
pobj->SetPosition(pos);
pobj->m_vecTarget = target;
pobj->m_nNumEffectCycles = numEffectCycles;
pobj->m_nSkipFrames = skipFrames;
pobj->m_nCreationChance = creationChance;
pobj->m_nFrameCounter = 0;
pobj->m_bRemove = remove;
if ( lifeTime != 0 )
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + lifeTime;
else
pobj->m_nRemoveTimer = 0;
pobj->m_Color.alpha = 0;
pobj->m_fSize = size;
pobj->m_fRandVal = 0.0f;
return pobj; return pobj;
} }
@ -631,7 +645,6 @@ void CParticleObject::UpdateClose(void)
case POBJECT_PED_WATER_SPLASH: case POBJECT_PED_WATER_SPLASH:
{ {
#ifdef PC_PARTICLE
CRGBA colorsmoke(255, 255, 255, 196); CRGBA colorsmoke(255, 255, 255, 196);
CVector pos = this->GetPosition(); CVector pos = this->GetPosition();
@ -733,69 +746,12 @@ void CParticleObject::UpdateClose(void)
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color); CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color);
} }
#else
CVector pos;
CVector vel;
for ( int32 i = -2; i < 2; i++ )
{
pos = this->GetPosition();
pos += CVector(-0.75f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += -1.5 * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.75f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), -0.75, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += -1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), 0.75, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
}
for ( int32 i = 0; i < 4; i++ )
{
pos = this->GetPosition();
pos.x += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f);
pos.y += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f);
pos.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
vel = this->m_vecTarget;
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
}
#endif
break; break;
} }
case POBJECT_CAR_WATER_SPLASH: case POBJECT_CAR_WATER_SPLASH:
{ {
#ifdef PC_PARTICLE
CRGBA colorsmoke(255, 255, 255, 196); CRGBA colorsmoke(255, 255, 255, 196);
CVector pos = this->GetPosition(); CVector pos = this->GetPosition();
@ -890,65 +846,7 @@ void CParticleObject::UpdateClose(void)
splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f); splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color);
} }
#else
CVector pos;
CVector vel;
for ( int32 i = -3; i < 4; i++ )
{
pos = this->GetPosition();
pos += CVector(-1.5f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(1.5f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), -1.5f, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), 1.5f, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
}
for ( int32 i = 0; i < 8; i++ )
{
pos = this->GetPosition();
pos.x += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f);
pos.y += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f);
vel = this->m_vecTarget;
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
}
#endif
break; break;
} }
@ -979,62 +877,106 @@ void CParticleObject::UpdateClose(void)
break; break;
} }
case POBJECT_CATALINAS_GUNFLASH: case POBJECT_FIRE_HYDRANT:
{ {
CRGBA flashcolor(120, 120, 120, 255);
CVector vel = this->m_vecTarget;
CVector pos = this->GetPosition(); CVector pos = this->GetPosition();
CVector vel = this->m_vecTarget;
float size = 1.0f; if ( (TheCamera.GetPosition() - pos).Magnitude() > 5.0f )
if ( this->m_fSize != 0.0f ) {
size = this->m_fSize; for ( int32 i = 0; i < 1; i++ )
{
int32 angle = 180 * i;
CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.12f*size, flashcolor); float fCos = CParticle::Cos(angle);
float fSin = CParticle::Sin(angle);
pos += size * (0.06f * vel); CVector splashpos, splashvel;
CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.08f*size, flashcolor);
pos += size * (0.04f * vel); splashpos = pos + CVector(0.01f*fCos, 0.01f*fSin, 0.0f);
CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f*size, flashcolor); splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CVector smokepos = this->GetPosition(); CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CVector smokevel = 0.1f * vel; CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300);
CParticle::AddParticle(PARTICLE_GUNSMOKE2, smokepos, smokevel, NULL, 0.005f*size);
splashpos = pos + CVector(0.01f*fCos, 0.01f*-fSin, 0.0f);
splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300);
splashpos = pos + CVector(0.01f*-fCos, 0.01f*fSin, 0.0f);
splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300);
splashpos = pos + CVector(0.01f*-fCos, 0.01f*-fSin, 0.0f);
splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300);
}
for ( int32 i = 0; i < this->m_nNumEffectCycles; i++ )
{
CParticle::AddParticle(this->m_ParticleType, pos, vel, NULL, 0.0f, this->m_Color);
}
}
break; break;
} }
case POBJECT_CATALINAS_SHOTGUNFLASH: case POBJECT_WATER_FOUNTAIN_VERT:
{ {
CRGBA flashcolor(120, 120, 120, 255); CVector pos = this->GetPosition();
CVector vel = this->m_vecTarget; CVector vel = this->m_vecTarget;
float size = 1.0f; for ( int32 i = 0; i < 2; i++ )
if ( this->m_fSize != 0.0f ) {
size = this->m_fSize; int32 angle = 180 * i;
float fCos = CParticle::Cos(angle);
float fSin = CParticle::Sin(angle);
CVector splashpos, splashvel;
splashpos = pos + CVector(0.015f*fCos, 0.015f*fSin, 0.0f);
splashvel = vel + CVector(0.015f*fCos, 0.015f*fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000);
splashpos = pos + CVector(0.015f*fCos, 0.015f*-fSin, 0.0f);
splashvel = vel + CVector(0.015f*fCos, 0.015f*-fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000);
splashpos = pos + CVector(0.015f*-fCos, 0.015f*fSin, 0.0f);
splashvel = vel + CVector(0.015f*-fCos, 0.015f*fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000);
splashpos = pos + CVector(0.015f*-fCos, 0.015f*-fSin, 0.0f);
splashvel = vel + CVector(0.015f*-fCos, 0.015f*-fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f));
CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000);
}
break;
}
case POBJECT_WATER_FOUNTAIN_HORIZ:
{
CVector pos = this->GetPosition(); CVector pos = this->GetPosition();
CVector vel = this->m_vecTarget;
CVector velstep = size * (0.1f * vel); for ( int32 i = 0; i < 3; i++ )
CVector flashpos = pos; {
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.001f, this->m_Color, 0, 0, 1, 1000);
flashpos += velstep; }
CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, flashcolor);
flashpos += velstep;
CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.15f*size, flashcolor);
flashpos += velstep;
CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.2f*size, flashcolor);
CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, flashcolor);
CVector smokepos = this->GetPosition();
CVector smokevel = 0.1f*vel;
CParticle::AddParticle(PARTICLE_GUNSMOKE2, smokepos, smokevel, NULL, 0.1f*size);
break; break;
} }
@ -1201,6 +1143,48 @@ CParticleObject::LoadParticle(uint8 *buffer, uint32 length)
return true; return true;
} }
void
CParticleObject::RemoveAllExpireableParticleObjects(void)
{
{
CParticleObject *pobj = pCloseListHead;
CParticleObject *nextpobj;
if ( pobj != NULL )
{
do
{
nextpobj = pobj->m_pNext;
if ( pobj->m_nRemoveTimer != 0 )
{
MoveToList(&pCloseListHead, &pUnusedListHead, pobj);
pobj->m_nState = POBJECTSTATE_FREE;
}
pobj = nextpobj;
}
while ( nextpobj != NULL );
}
}
{
CParticleObject *pobj = pFarListHead;
CParticleObject *nextpobj;
if ( pobj != NULL )
{
do
{
nextpobj = pobj->m_pNext;
if ( pobj->m_nRemoveTimer != 0 )
{
MoveToList(&pFarListHead, &pUnusedListHead, pobj);
pobj->m_nState = POBJECTSTATE_FREE;
}
pobj = nextpobj;
}
while ( nextpobj != NULL );
}
}
}
void void
CParticleObject::RemoveAllParticleObjects(void) CParticleObject::RemoveAllParticleObjects(void)
{ {

View file

@ -4,12 +4,12 @@
#include "ParticleType.h" #include "ParticleType.h"
#include "Placeable.h" #include "Placeable.h"
#define MAX_PARTICLEOBJECTS 100 #define MAX_PARTICLEOBJECTS 70
#define MAX_AUDIOHYDRANTS 8 #define MAX_AUDIOHYDRANTS 8
enum eParticleObjectType enum eParticleObjectType
{ {
POBJECT_PAVEMENT_STEAM, POBJECT_PAVEMENT_STEAM = 0,
POBJECT_PAVEMENT_STEAM_SLOWMOTION, POBJECT_PAVEMENT_STEAM_SLOWMOTION,
POBJECT_WALL_STEAM, POBJECT_WALL_STEAM,
POBJECT_WALL_STEAM_SLOWMOTION, POBJECT_WALL_STEAM_SLOWMOTION,
@ -22,6 +22,8 @@ enum eParticleObjectType
POBJECT_BIG_FIRE, POBJECT_BIG_FIRE,
POBJECT_DRY_ICE, POBJECT_DRY_ICE,
POBJECT_DRY_ICE_SLOWMOTION, POBJECT_DRY_ICE_SLOWMOTION,
POBJECT_WATER_FOUNTAIN_VERT,
POBJECT_WATER_FOUNTAIN_HORIZ,
POBJECT_FIRE_TRAIL, POBJECT_FIRE_TRAIL,
POBJECT_SMOKE_TRAIL, POBJECT_SMOKE_TRAIL,
POBJECT_FIREBALL_AND_SMOKE, POBJECT_FIREBALL_AND_SMOKE,
@ -74,6 +76,7 @@ public:
static CParticleObject *AddObject(uint16 type, CVector const &pos, float size, uint8 remove); static CParticleObject *AddObject(uint16 type, CVector const &pos, float size, uint8 remove);
static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint8 remove); static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint8 remove);
static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, RwRGBA const &color, uint8 remove); static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, RwRGBA const &color, uint8 remove);
static CParticleObject *AddObject(tParticleType type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, uint8 numEffectCycles, uint8 skipFrames, uint16 creationChance, uint8 remove);
void RemoveObject(void); void RemoveObject(void);
@ -84,6 +87,7 @@ public:
static bool SaveParticle(uint8 *buffer, uint32 *length); static bool SaveParticle(uint8 *buffer, uint32 *length);
static bool LoadParticle(uint8 *buffer, uint32 length); static bool LoadParticle(uint8 *buffer, uint32 length);
static void RemoveAllExpireableParticleObjects(void);
static void RemoveAllParticleObjects(void); static void RemoveAllParticleObjects(void);
static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj); static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj);
}; };