diff --git a/sp/src/game/client/hl2/c_thumper_dust.cpp b/sp/src/game/client/hl2/c_thumper_dust.cpp index ade7b303441..7c9953bad4a 100644 --- a/sp/src/game/client/hl2/c_thumper_dust.cpp +++ b/sp/src/game/client/hl2/c_thumper_dust.cpp @@ -76,10 +76,6 @@ class ThumperDustEmitter : public CSimpleEmitter void FX_ThumperDust( const CEffectData &data ) { - Vector vecDustColor; - vecDustColor.x = 0.85f; - vecDustColor.y = 0.75f; - vecDustColor.z = 0.52f; CSmartPtr pSimple = ThumperDustEmitter::Create( "thumperdust" ); @@ -117,7 +113,7 @@ void FX_ThumperDust( const CEffectData &data ) // Setup the color for these particles engine->ComputeLighting( data.m_vOrigin, NULL, true, vecColor ); - VectorLerp( vecColor, vecDustColor, 0.5, vecColor ); + VectorLerp( vecColor, data.m_CustomColors.m_vecColor1, 0.5, vecColor ); vecColor *= 255; for ( i = 0; i < numPuffs; i++ ) diff --git a/sp/src/game/server/hl2/prop_thumper.cpp b/sp/src/game/server/hl2/prop_thumper.cpp index 67224ca8a65..3042f191f6e 100644 --- a/sp/src/game/server/hl2/prop_thumper.cpp +++ b/sp/src/game/server/hl2/prop_thumper.cpp @@ -19,6 +19,9 @@ #define THUMPER_RADIUS 1000 #endif +#define SF_NO_DUST 1 +#define SF_NO_SHAKE 2 +#define SF_DISABLED 4 #define STATE_CHANGE_MODIFIER 0.02f #define THUMPER_SOUND_DURATION 1.5f @@ -58,6 +61,10 @@ class CPropThumper : public CBaseAnimating EHANDLE m_hRepellantEnt; int m_iDustScale; + + // I would have used color24 instead of color32, but there is no FIELD_COLOR32 + color32 m_DustColor; + COutputEvent m_OnThumped; // Fired when thumper goes off #if HL2_EPISODIC @@ -84,6 +91,9 @@ BEGIN_DATADESC( CPropThumper ) DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ), DEFINE_OUTPUT( m_OnThumped, "OnThumped" ), + + DEFINE_KEYFIELD( m_DustColor, FIELD_COLOR32, "DustColor" ), + END_DATADESC() void CPropThumper::Spawn( void ) @@ -104,7 +114,10 @@ void CPropThumper::Spawn( void ) BaseClass::Spawn(); - m_bEnabled = true; + if (HasSpawnFlags(SF_DISABLED)) + m_bEnabled = false; + else + m_bEnabled = true; SetThink( &CPropThumper::Think ); SetNextThink( gpGlobals->curtime + 1.0f ); @@ -141,6 +154,15 @@ void CPropThumper::Spawn( void ) m_iEffectRadius = 1000; #endif + //This isn't very clever, but there needs to be a fallback for maps that dont have a color specified. + //Mappers can use 1 1 1 instead of 0 0 0, as it looks the same. + if ((m_DustColor.r == 0 && m_DustColor.g == 0 && m_DustColor.b == 0) && !HasSpawnFlags(SF_NO_DUST)) + { + m_DustColor.r = 0.85 * 255; + m_DustColor.g = 0.75 * 255; + m_DustColor.b = 0.52 * 255; + } + } void CPropThumper::Precache( void ) @@ -205,8 +227,18 @@ void CPropThumper::Thump ( void ) data.m_nEntIndex = entindex(); data.m_vOrigin = vOrigin; data.m_flScale = m_iDustScale * m_flPlaybackRate; - DispatchEffect( "ThumperDust", data ); - UTIL_ScreenShake( vOrigin, 10.0 * m_flPlaybackRate, m_flPlaybackRate, m_flPlaybackRate / 2, THUMPER_RADIUS * m_flPlaybackRate, SHAKE_START, false ); + + data.m_bCustomColors = true; + data.m_CustomColors.m_vecColor1.x = (float)m_DustColor.r / 255; + data.m_CustomColors.m_vecColor1.y = (float)m_DustColor.g / 255; + data.m_CustomColors.m_vecColor1.z = (float)m_DustColor.b / 255; + + if (!HasSpawnFlags(SF_NO_DUST)) + DispatchEffect("ThumperDust", data); + + if (!HasSpawnFlags(SF_NO_SHAKE)) + UTIL_ScreenShake(vOrigin, 10.0 * m_flPlaybackRate, m_flPlaybackRate, m_flPlaybackRate / 2, THUMPER_RADIUS * m_flPlaybackRate, SHAKE_START, false); + } EmitSound( "coast.thumper_dust" );