diff --git a/sp/src/game/client/hl2/c_thumper_dust.cpp b/sp/src/game/client/hl2/c_thumper_dust.cpp index ade7b303441..b71872972bf 100644 --- a/sp/src/game/client/hl2/c_thumper_dust.cpp +++ b/sp/src/game/client/hl2/c_thumper_dust.cpp @@ -76,10 +76,13 @@ class ThumperDustEmitter : public CSimpleEmitter void FX_ThumperDust( const CEffectData &data ) { + +#ifndef MAPBASE Vector vecDustColor; vecDustColor.x = 0.85f; vecDustColor.y = 0.75f; vecDustColor.z = 0.52f; +#endif CSmartPtr pSimple = ThumperDustEmitter::Create( "thumperdust" ); @@ -117,7 +120,13 @@ void FX_ThumperDust( const CEffectData &data ) // Setup the color for these particles engine->ComputeLighting( data.m_vOrigin, NULL, true, vecColor ); + +#ifdef MAPBASE + VectorLerp( vecColor, data.m_CustomColors.m_vecColor1, 0.5, vecColor ); +#else VectorLerp( vecColor, vecDustColor, 0.5, vecColor ); +#endif + 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..3d626ea63a1 100644 --- a/sp/src/game/server/hl2/prop_thumper.cpp +++ b/sp/src/game/server/hl2/prop_thumper.cpp @@ -19,6 +19,11 @@ #define THUMPER_RADIUS 1000 #endif +#ifdef MAPBASE +#define SF_NO_DUST 1 +#define SF_NO_SHAKE 2 +#define SF_DISABLED 4 +#endif #define STATE_CHANGE_MODIFIER 0.02f #define THUMPER_SOUND_DURATION 1.5f @@ -35,6 +40,10 @@ class CPropThumper : public CBaseAnimating DECLARE_CLASS( CPropThumper, CBaseAnimating ); DECLARE_DATADESC(); +#ifdef MAPBASE + CPropThumper( void ); +#endif + virtual void Spawn( void ); virtual void Precache( void ); virtual void Think ( void ); @@ -58,6 +67,12 @@ class CPropThumper : public CBaseAnimating EHANDLE m_hRepellantEnt; int m_iDustScale; + +#ifdef MAPBASE + // I would have used color24 instead of color32, but there is no FIELD_COLOR32 + color32 m_DustColor; +#endif + COutputEvent m_OnThumped; // Fired when thumper goes off #if HL2_EPISODIC @@ -84,8 +99,26 @@ BEGIN_DATADESC( CPropThumper ) DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ), DEFINE_OUTPUT( m_OnThumped, "OnThumped" ), + +#ifdef MAPBASE + DEFINE_KEYFIELD( m_DustColor, FIELD_COLOR32, "DustColor" ), +#endif + END_DATADESC() +#ifdef MAPBASE +CPropThumper::CPropThumper() : + m_bEnabled( true ), + m_iHammerAttachment( -1 ), + m_sndMotor( NULL ), + m_hRepellantEnt( NULL ), + m_iDustScale( THUMPER_MIN_SCALE ) +{ + KeyValue( "dustcolor", "217 191 133" ); +} +#endif + + void CPropThumper::Spawn( void ) { char *szModel = (char *)STRING( GetModelName() ); @@ -104,7 +137,14 @@ void CPropThumper::Spawn( void ) BaseClass::Spawn(); +#ifdef MAPBASE + if ( HasSpawnFlags( SF_DISABLED ) ) + m_bEnabled = false; + else + m_bEnabled = true; +#else m_bEnabled = true; +#endif SetThink( &CPropThumper::Think ); SetNextThink( gpGlobals->curtime + 1.0f ); @@ -205,8 +245,28 @@ void CPropThumper::Thump ( void ) data.m_nEntIndex = entindex(); data.m_vOrigin = vOrigin; data.m_flScale = m_iDustScale * m_flPlaybackRate; - DispatchEffect( "ThumperDust", data ); + +#ifdef MAPBASE + 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; +#endif + +#ifdef MAPBASE + if ( !HasSpawnFlags( SF_NO_DUST ) ) + DispatchEffect( "ThumperDust", data ); +#else + DispatchEffect("ThumperDust", data); +#endif + +#ifdef MAPBASE + if ( !HasSpawnFlags( SF_NO_SHAKE ) ) + UTIL_ScreenShake( vOrigin, 10.0 * m_flPlaybackRate, m_flPlaybackRate, m_flPlaybackRate / 2, THUMPER_RADIUS * m_flPlaybackRate, SHAKE_START, false ); +#else UTIL_ScreenShake( vOrigin, 10.0 * m_flPlaybackRate, m_flPlaybackRate, m_flPlaybackRate / 2, THUMPER_RADIUS * m_flPlaybackRate, SHAKE_START, false ); +#endif + } EmitSound( "coast.thumper_dust" );