diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/c_te_sparks.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/c_te_sparks.cpp')
| -rw-r--r-- | game/client/c_te_sparks.cpp | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/game/client/c_te_sparks.cpp b/game/client/c_te_sparks.cpp new file mode 100644 index 0000000..7f1310a --- /dev/null +++ b/game/client/c_te_sparks.cpp @@ -0,0 +1,105 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// +#include "cbase.h" +#include "c_te_particlesystem.h" +#include "IEffects.h" +#include "tier1/KeyValues.h" +#include "toolframework_client.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: Sparks TE +//----------------------------------------------------------------------------- +class C_TESparks : public C_TEParticleSystem +{ +public: + DECLARE_CLASS( C_TESparks, C_TEParticleSystem ); + DECLARE_CLIENTCLASS(); + + C_TESparks( void ); + virtual ~C_TESparks( void ); + + virtual void PostDataUpdate( DataUpdateType_t updateType ); + virtual void Precache( void ); + + int m_nMagnitude; + int m_nTrailLength; + Vector m_vecDir; +}; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +C_TESparks::C_TESparks( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +C_TESparks::~C_TESparks( void ) +{ +} + +void C_TESparks::Precache( void ) +{ +} + + +//----------------------------------------------------------------------------- +// Recording +//----------------------------------------------------------------------------- +static inline void RecordSparks( const Vector &start, int nMagnitude, int nTrailLength, const Vector &direction ) +{ + if ( !ToolsEnabled() ) + return; + + if ( clienttools->IsInRecordingMode() ) + { + KeyValues *msg = new KeyValues( "TempEntity" ); + + msg->SetInt( "te", TE_SPARKS ); + msg->SetString( "name", "TE_Sparks" ); + msg->SetFloat( "time", gpGlobals->curtime ); + msg->SetFloat( "originx", start.x ); + msg->SetFloat( "originy", start.y ); + msg->SetFloat( "originz", start.z ); + msg->SetFloat( "directionx", direction.x ); + msg->SetFloat( "directiony", direction.y ); + msg->SetFloat( "directionz", direction.z ); + msg->SetInt( "magnitude", nMagnitude ); + msg->SetInt( "traillength", nTrailLength ); + + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); + msg->deleteThis(); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void C_TESparks::PostDataUpdate( DataUpdateType_t updateType ) +{ + g_pEffects->Sparks( m_vecOrigin, m_nMagnitude, m_nTrailLength, &m_vecDir ); + RecordSparks( m_vecOrigin, m_nMagnitude, m_nTrailLength, m_vecDir ); +} + +void TE_Sparks( IRecipientFilter& filter, float delay, + const Vector* pos, int nMagnitude, int nTrailLength, const Vector *pDir ) +{ + g_pEffects->Sparks( *pos, nMagnitude, nTrailLength, pDir ); + RecordSparks( *pos, nMagnitude, nTrailLength, *pDir ); +} + +IMPLEMENT_CLIENTCLASS_EVENT_DT(C_TESparks, DT_TESparks, CTESparks) + RecvPropInt( RECVINFO( m_nMagnitude ) ), + RecvPropInt( RECVINFO( m_nTrailLength ) ), + RecvPropVector( RECVINFO( m_vecDir ) ), +END_RECV_TABLE() |