FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/fx_explosion.cpp

181920212223
#include "fx_quad.h" #include "fx_line.h" #include "fx_water.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
18192021222324
#include "fx_quad.h" #include "fx_line.h" #include "fx_water.h" #include "utlqueue.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
363738394041
CLIENTEFFECT_MATERIAL( "effects/splashwake1" ) CLIENTEFFECT_REGISTER_END() // // CExplosionParticle //
3738394041424344454647484950515253
CLIENTEFFECT_MATERIAL( "effects/splashwake1" ) CLIENTEFFECT_REGISTER_END() CUtlQueue m_QueueExplosions; static float g_flFractional = 1.0f;; // dlight scale extern ConVar cl_ffdlight_explosion; void ClearExplosions() { m_QueueExplosions.RemoveAll(); } // // CExplosionParticle //
162163164165166167
return dot; } //----------------------------------------------------------------------------- // Purpose: // Input : position -
174175176177178179180181
return dot; } static ConVar cl_reducedexplosions("cl_reduced_explosions", "0", FCVAR_ARCHIVE); //----------------------------------------------------------------------------- // Purpose: // Input : position -
183184185186187188
PlaySound(); if ( scale != 0 ) { // UNDONE: Make core size parametric to scale or remove scale?
197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
PlaySound(); // --> Mirv: Now supporting better explosion scaling // HACK HACK: Rather than replace all the times when scale is much bigger // we're just going to reduce to a "normal" size if they're trying an old-style scale if (scale > 2.5f) scale = 0.9f; m_flScale = clamp(scale, 0.5f, 2.0f); // <-- Mirv while (m_QueueExplosions.Count() > 0 && m_QueueExplosions.Head() < gpGlobals->curtime) { m_QueueExplosions.RemoveAtHead(); } // Yes using a global is shocking business, but nevermind I'm just testing this out... if (cl_reducedexplosions.GetBool()) { int c = m_QueueExplosions.Count(); g_flFractional = 1.0f - 0.2f * c; if (g_flFractional < 0.01f) g_flFractional = 0.01f; } if ( scale != 0 ) { // UNDONE: Make core size parametric to scale or remove scale?
190191192193194195196197
} CreateDebris(); //FIXME: CreateDynamicLight(); CreateMisc(); } //-----------------------------------------------------------------------------
227228229230231232233234235236237238
} CreateDebris(); if ( !(UTIL_PointContents( m_vecOrigin ) & CONTENTS_WATER) ) CreateDynamicLight(); CreateMisc(); // Now add this explosion to our tracker m_QueueExplosions.Insert(gpGlobals->curtime + 0.8f); } //-----------------------------------------------------------------------------
204205206207208209210211212213214215216217218219
Vector offset; int i; //Spread constricts as force rises float force = m_flForce; //Cap our force if ( force < EXPLOSION_FORCE_MIN ) force = EXPLOSION_FORCE_MIN; if ( force > EXPLOSION_FORCE_MAX ) force = EXPLOSION_FORCE_MAX; float spread = 1.0f - (0.15f*force);
245246247248249250251252253254255256257258259260261262263
Vector offset; int i; int number; //Spread constricts as force rises float force = m_flForce; // --> Mirv: Remove the cap for now //Cap our force //if ( force < EXPLOSION_FORCE_MIN ) // force = EXPLOSION_FORCE_MIN; //if ( force > EXPLOSION_FORCE_MAX ) // force = EXPLOSION_FORCE_MAX; // <-- float spread = 1.0f - (0.15f*force);
258259260261262263264265266
{ // // Smoke - basic internal filler // for ( i = 0; i < 4; i++ ) { pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Smoke, m_vecOrigin );
302303304305306307308309310311312
{ // // Smoke - basic internal filler // Rises above afterwards // number = (int) ceil(4 * g_flFractional); for ( i = 0; i < number; i++ ) { pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Smoke, m_vecOrigin );
268269270271272273274275276277278
{ pParticle->m_flLifetime = 0.0f; #ifdef _XBOX pParticle->m_flDieTime = 1.0f; #else pParticle->m_flDieTime = random->RandomFloat( 2.0f, 3.0f ); #endif pParticle->m_vecVelocity.Random( -spread, spread ); pParticle->m_vecVelocity += ( m_vecDirection * random->RandomFloat( 1.0f, 6.0f ) );
314315316317318319320321322323324325326
{ pParticle->m_flLifetime = 0.0f; // --> Mirv: Use TF2 length smoke but scale it so that it hovers up slowly //#ifdef TF2_CLIENT_DLL pParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f ) * (m_flScale * m_flScale * m_flScale); //#else // pParticle->m_flDieTime = random->RandomFloat( 2.0f, 3.0f ); //#endif // <-- Mirv pParticle->m_vecVelocity.Random( -spread, spread ); pParticle->m_vecVelocity += ( m_vecDirection * random->RandomFloat( 1.0f, 6.0f ) );
285286287288289290
ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread, &fForce ); pParticle->m_vecVelocity *= fForce; #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 );
333334335336337338339340341342343
ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread, &fForce ); pParticle->m_vecVelocity *= fForce; // --> Mirv: Reduce velocity for scale if (m_flScale < 1.0f) pParticle->m_vecVelocity *= m_flScale; // <-- Mirv #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 );
295296297298299300301302
pParticle->m_uchColor[1] = ( worldLight[1] * nColor ); pParticle->m_uchColor[2] = ( worldLight[2] * nColor ); pParticle->m_uchStartSize = 72; pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2; pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0;
348349350351352353354355356357
pParticle->m_uchColor[1] = ( worldLight[1] * nColor ); pParticle->m_uchColor[2] = ( worldLight[2] * nColor ); // --> Mirv: Scale the size of the rising smoke too pParticle->m_uchStartSize = clamp(72 * m_flScale, 20, 126); pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2; // <-- Mirv pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0;
308309310311312313314315316317318319320321
// // Inner core // #ifndef _XBOX for ( i = 0; i < 8; i++ ) { offset.Random( -16.0f, 16.0f ); offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Smoke, offset );
363364365366367368369370371372373374375376377378379
// // Inner core of smoke // #ifndef _XBOX number = (int) ceil(8 * g_flFractional); for ( i = 0; i < number; i++ ) { offset.Random( -16.0f, 16.0f ); offset *= m_flScale; // |-- Mirv: Scale offset offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Smoke, offset );
324325326327328329330
{ pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f ); pParticle->m_vecVelocity.Random( -spread, spread ); pParticle->m_vecVelocity += ( m_vecDirection * random->RandomFloat( 1.0f, 6.0f ) );
382383384385386387388389390391392393394
{ pParticle->m_flLifetime = 0.0f; // --> Mirv: Use quicker TF2 style smoke time again, but don't modify for scale //#ifdef TF2_CLIENT_DLL pParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f ); //#else // pParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f ); //#endif // <-- Mirv pParticle->m_vecVelocity.Random( -spread, spread ); pParticle->m_vecVelocity += ( m_vecDirection * random->RandomFloat( 1.0f, 6.0f ) );
337338339340341342
ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread, &fForce ); pParticle->m_vecVelocity *= fForce; #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 );
401402403404405406407408409410411
ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread, &fForce ); pParticle->m_vecVelocity *= fForce; // --> Mirv: Reduce velocity for scale if (m_flScale < 1.0f) pParticle->m_vecVelocity *= m_flScale; // <-- Mirv #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 );
347348349350351352353354
pParticle->m_uchColor[1] = ( worldLight[1] * nColor ); pParticle->m_uchColor[2] = ( worldLight[2] * nColor ); pParticle->m_uchStartSize = random->RandomInt( 32, 64 ); pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2; pParticle->m_uchStartAlpha = random->RandomFloat( 128, 255 ); pParticle->m_uchEndAlpha = 0;
416417418419420421422423
pParticle->m_uchColor[1] = ( worldLight[1] * nColor ); pParticle->m_uchColor[2] = ( worldLight[2] * nColor ); pParticle->m_uchStartSize = random->RandomInt( 32, 64 ) * m_flScale; pParticle->m_uchEndSize = clamp(pParticle->m_uchStartSize * 2, 32, 255); pParticle->m_uchStartAlpha = random->RandomFloat( 128, 255 ); pParticle->m_uchEndAlpha = 0;
357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
pParticle->m_flRollDelta = random->RandomFloat( -8.0f, 8.0f ); } } #endif // !_XBOX // // Ground ring // Vector vRight, vUp; VectorVectors( m_vecDirection, vRight, vUp ); Vector forward; #ifndef _XBOX int numRingSprites = 32; #else int numRingSprites = 8; #endif float flIncr = (2*M_PI) / (float) numRingSprites; // Radians float flYaw = 0.0f; for ( i = 0; i < numRingSprites; i++ ) { flYaw += flIncr; SinCos( flYaw, &forward.y, &forward.x ); forward.z = 0.0f; offset = ( RandomVector( -4.0f, 4.0f ) + m_vecOrigin ) + ( forward * random->RandomFloat( 8.0f, 16.0f ) ); pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Smoke, offset ); if ( pParticle != NULL ) { pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.5f ); pParticle->m_vecVelocity = forward; float fForce = random->RandomFloat( 500, 2000 ) * force; //Scale the force down as we fall away from our main direction ScaleForceByDeviation( pParticle->m_vecVelocity, pParticle->m_vecVelocity, spread, &fForce ); pParticle->m_vecVelocity *= fForce; #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( luminosity*0.5f, luminosity ); pParticle->m_uchColor[0] = ( worldLight[0] * nColor ); pParticle->m_uchColor[1] = ( worldLight[1] * nColor ); pParticle->m_uchColor[2] = ( worldLight[2] * nColor ); pParticle->m_uchStartSize = random->RandomInt( 16, 32 ); pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; pParticle->m_uchStartAlpha = random->RandomFloat( 16, 32 ); pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 );
426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
pParticle->m_flRollDelta = random->RandomFloat( -8.0f, 8.0f ); } } #endif #ifndef _XBOX // // Embers // if ( m_Material_Embers[0] == NULL ) { m_Material_Embers[0] = pSimple->GetPMaterial( "effects/fire_embers1" ); } if ( m_Material_Embers[1] == NULL ) { m_Material_Embers[1] = pSimple->GetPMaterial( "effects/fire_embers2" ); } number = (int) ceil(16 * g_flFractional); for ( i = 0; i < number; i++ ) { offset.Random( -32.0f, 32.0f ); offset *= m_flScale; // |-- Mirv: Scale offset offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Embers[random->RandomInt(0,1)], offset ); if ( pParticle != NULL ) { pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 2.0f, 3.0f ); pParticle->m_vecVelocity.Random( -spread*2, spread*2 ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 1.0f, 400.0f ); //Scale the force down as we fall away from our main direction float vDev = ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread ); pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); // --> Mirv: Reduce velocity for scale if (m_flScale < 1.0f) pParticle->m_vecVelocity *= m_flScale; // <-- Mirv #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 192, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 8, 16 ) * vDev; // --> Mirv: Scale up the ember size too pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize * m_flScale * m_flScale * m_flScale * m_flScale, 4, 255 ); // <-- Mirv pParticle->m_uchEndSize = pParticle->m_uchStartSize; pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 );
421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
pParticle->m_flRollDelta = random->RandomFloat( -8.0f, 8.0f ); } } } #ifndef _XBOX // // Embers // if ( m_Material_Embers[0] == NULL ) { m_Material_Embers[0] = pSimple->GetPMaterial( "effects/fire_embers1" ); } if ( m_Material_Embers[1] == NULL ) { m_Material_Embers[1] = pSimple->GetPMaterial( "effects/fire_embers2" ); } for ( i = 0; i < 16; i++ ) { offset.Random( -32.0f, 32.0f ); offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_Embers[random->RandomInt(0,1)], offset ); if ( pParticle != NULL ) { pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 2.0f, 3.0f ); pParticle->m_vecVelocity.Random( -spread*2, spread*2 ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 1.0f, 400.0f ); //Scale the force down as we fall away from our main direction float vDev = ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread ); pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 192, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 8, 16 ) * vDev; pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize, 4, 32 ); pParticle->m_uchEndSize = pParticle->m_uchStartSize; pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( -8.0f, 8.0f ); } } #endif // !_XBOX // // Fireballs // if ( m_Material_FireCloud == NULL ) { m_Material_FireCloud = pSimple->GetPMaterial( "effects/fire_cloud2" ); } #ifndef _XBOX int numFireballs = 32; #else int numFireballs = 16; #endif for ( i = 0; i < numFireballs; i++ ) { offset.Random( -48.0f, 48.0f ); offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_FireCloud, offset ); if ( pParticle != NULL ) { pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 0.2f, 0.4f ); pParticle->m_vecVelocity.Random( -spread*0.75f, spread*0.75f ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 400.0f, 800.0f ); //Scale the force down as we fall away from our main direction float vDev = ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread ); pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 128, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 32, 85 ) * vDev; pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize, 32, 85 ); pParticle->m_uchEndSize = (int)((float)pParticle->m_uchStartSize * 1.5f); pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( -16.0f, 16.0f ); } } }
497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
pParticle->m_flRollDelta = random->RandomFloat( -8.0f, 8.0f ); } } #endif // !_XBOX // // Fireballs // if ( m_Material_FireCloud == NULL ) { m_Material_FireCloud = pSimple->GetPMaterial( "effects/fire_cloud2" ); } #ifndef _XBOX int numFireballs = (int) ceil(32 * g_flFractional); #else int numFireballs = 16; #endif for ( i = 0; i < numFireballs; i++ ) { offset.Random( -48.0f, 48.0f ); offset *= m_flScale; // |-- Mirv: Scale offset offset += m_vecOrigin; pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), m_Material_FireCloud, offset ); if ( pParticle != NULL ) { pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = random->RandomFloat( 0.4f, 0.6f ); pParticle->m_vecVelocity.Random( -spread*0.75f, spread*0.75f ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 400.0f, 800.0f ); //Scale the force down as we fall away from our main direction float vDev = ScaleForceByDeviation( pParticle->m_vecVelocity, m_vecDirection, spread ); pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); // --> Mirv: Reduce velocity for scale if (m_flScale < 1.0f) pParticle->m_vecVelocity *= (m_flScale); // <-- Mirv #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 128, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 32, 85 ) * vDev; // --> Mirv: Scale up the explosion fireball size pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize * m_flScale, 8, 168 ); // <-- Mirv pParticle->m_uchEndSize = (int)((float)pParticle->m_uchStartSize * 1.5f); pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( -16.0f, 16.0f ); } } } }
559560561562563564565
// Sparks // CSmartPtr pSparkEmitter = CTrailParticles::Create( "CreateDebris 1" ); if ( pSparkEmitter == NULL ) { assert(0);
581582583584585586587
// Sparks // /*CSmartPtr pSparkEmitter = CTrailParticles::Create( "CreateDebris 1" ); if ( pSparkEmitter == NULL ) { assert(0);
612613614615616617618619
tParticle->m_vecVelocity = dir * random->RandomFloat( 1500, 2500 ); Color32Init( tParticle->m_color, 255, 255, 255, 255 ); } #ifndef _XBOX // // Chunks
634635636637638639640641642643644
tParticle->m_vecVelocity = dir * random->RandomFloat( 1500, 2500 ); Color32Init( tParticle->m_color, 255, 255, 255, 255 ); }*/ int i; Vector dir; #ifndef _XBOX // // Chunks
638639640641642643644645646647
hMaterialArray[0] = fleckEmitter->GetPMaterial( "effects/fleck_cement1" ); hMaterialArray[1] = fleckEmitter->GetPMaterial( "effects/fleck_cement2" ); #ifdef _XBOX int numFlecks = random->RandomInt( 8, 16 ); #else int numFlecks = random->RandomInt( 16, 32 ); #endif // _XBOX
663664665666667668669670671672673674
hMaterialArray[0] = fleckEmitter->GetPMaterial( "effects/fleck_cement1" ); hMaterialArray[1] = fleckEmitter->GetPMaterial( "effects/fleck_cement2" ); int number = (int) ceil(16 * g_flFractional); #ifdef _XBOX int numFlecks = random->RandomInt( 8, 16 ); #else int numFlecks = random->RandomInt( number, number * 2 ); #endif // _XBOX
694695696697698699
{ } //----------------------------------------------------------------------------- // Purpose: //-----------------------------------------------------------------------------
721722723724725726727728729730731732733734
{ } //ConVar ffdev_explosion_light_radius_min( "ffdev_explosion_light_radius_min", "224" ); //ConVar ffdev_explosion_light_radius_max( "ffdev_explosion_light_radius_max", "256" ); //ConVar ffdev_explosion_light_life( "ffdev_explosion_light_life", "0.25" ); //ConVar ffdev_explosion_light_color_r( "ffdev_explosion_light_color_r", "255" ); //ConVar ffdev_explosion_light_color_g( "ffdev_explosion_light_color_g", "224" ); //ConVar ffdev_explosion_light_color_b( "ffdev_explosion_light_color_b", "128" ); //ConVar ffdev_explosion_light_color_e( "ffdev_explosion_light_color_e", "5" ); //----------------------------------------------------------------------------- // Purpose: //-----------------------------------------------------------------------------
702703704705706707708709710711712713714715716717
if ( m_fFlags & TE_EXPLFLAG_NODLIGHTS ) return; dlight_t *dl = effects->CL_AllocDlight( 0 ); VectorCopy (m_vecOrigin, dl->origin); dl->decay = 200; dl->radius = 255; dl->color.r = 255; dl->color.g = 220; dl->color.b = 128; dl->die = gpGlobals->curtime + 0.1f; } //-----------------------------------------------------------------------------
737738739740741742743744745746747748749750751752753754755756757758759760761762
if ( m_fFlags & TE_EXPLFLAG_NODLIGHTS ) return; // dlight scale float flDLightScale = cl_ffdlight_explosion.GetFloat(); dlight_t *dl = NULL; if (flDLightScale > 0.0f) // Make a dlight (that's a "D" for dynamic so everything lights up, YAAAAYYYYY!) //dl = effects->CL_AllocDlight( LIGHT_INDEX_TE_DYNAMIC ); dl = effects->CL_AllocDlight( 0 ); // 0 allows multiple dynamic lights at the same time if (dl) // I'm scared, daddy...of NULL pointers. { dl->origin = m_vecOrigin; dl->radius = random->RandomFloat( 208/*ffdev_explosion_light_radius_min.GetFloat()*/, 224/*ffdev_explosion_light_radius_max.GetFloat()*/ ) * flDLightScale; // kinda big radius for explosion dl->die = gpGlobals->curtime + 0.25/*ffdev_explosion_light_life.GetFloat()*/; // die = current time + life dl->decay = dl->radius / 0.25/*ffdev_explosion_light_life.GetFloat()*/; // radius / life = good fade dl->color.r = 255/*ffdev_explosion_light_color_r.GetFloat()*/; dl->color.g = 160/*ffdev_explosion_light_color_g.GetFloat()*/; dl->color.b = 64/*ffdev_explosion_light_color_b.GetFloat()*/; dl->color.exponent = 5/*ffdev_explosion_light_color_e.GetFloat()*/; // essentially the brightness...also determines the gradient, basically } } //-----------------------------------------------------------------------------
1371137213731374137513761377
pParticle->m_vecVelocity.Random( -spread*0.75f, spread*0.75f ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 400.0f, 800.0f );
1416141714181419142014211422
pParticle->m_vecVelocity.Random( -spread*0.75f, spread*0.75f ); pParticle->m_vecVelocity += m_vecDirection; VectorNormalize( pParticle->m_vecVelocity ); float fForce = random->RandomFloat( 400.0f, 800.0f );
1381138213831384138513861387138813891390139113921393139413951396139713981399140014011402
pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 128, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 32, 85 ) * vDev; pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize, 32, 85 ); pParticle->m_uchEndSize = (int)((float)pParticle->m_uchStartSize * 1.5f); pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( -16.0f, 16.0f ); }
1426142714281429143014311432143314341435143614371438143914401441144214431444144514461447
pParticle->m_vecVelocity *= fForce * ( 16.0f * (vDev*vDev*0.5f) ); #if __EXPLOSION_DEBUG debugoverlay->AddLineOverlay( m_vecOrigin, m_vecOrigin + pParticle->m_vecVelocity, 255, 0, 0, false, 3 ); #endif int nColor = random->RandomInt( 128, 255 ); pParticle->m_uchColor[0] = pParticle->m_uchColor[1] = pParticle->m_uchColor[2] = nColor; pParticle->m_uchStartSize = random->RandomInt( 32, 85 ) * vDev; pParticle->m_uchStartSize = clamp( pParticle->m_uchStartSize, 32, 85 ); pParticle->m_uchEndSize = (int)((float)pParticle->m_uchStartSize * 1.5f); pParticle->m_uchStartAlpha = 255; pParticle->m_uchEndAlpha = 0; pParticle->m_flRoll = random->RandomInt( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( -16.0f, 16.0f ); }