Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sp/src/game/client/hl2/c_thumper_dust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ThumperDustEmitter> pSimple = ThumperDustEmitter::Create( "thumperdust" );

Expand Down Expand Up @@ -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++ )
Expand Down
62 changes: 61 additions & 1 deletion sp/src/game/server/hl2/prop_thumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
Expand All @@ -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
Expand All @@ -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() );
Expand All @@ -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 );
Expand Down Expand Up @@ -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" );
Expand Down
Loading