summaryrefslogtreecommitdiff
path: root/game/client/fx_trail.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/fx_trail.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/fx_trail.cpp')
-rw-r--r--game/client/fx_trail.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/game/client/fx_trail.cpp b/game/client/fx_trail.cpp
new file mode 100644
index 0000000..9a090e6
--- /dev/null
+++ b/game/client/fx_trail.cpp
@@ -0,0 +1,78 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "fx_trail.h"
+
+C_ParticleTrail::C_ParticleTrail( void )
+{
+}
+
+C_ParticleTrail::~C_ParticleTrail( void )
+{
+ if ( m_pParticleMgr )
+ {
+ m_pParticleMgr->RemoveEffect( &m_ParticleEffect );
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Gets the attachment point to spawn at
+//-----------------------------------------------------------------------------
+void C_ParticleTrail::GetAimEntOrigin( IClientEntity *pAttachedTo, Vector *pAbsOrigin, QAngle *pAbsAngles )
+{
+ C_BaseEntity *pEnt = pAttachedTo->GetBaseEntity();
+
+ if ( pEnt && (m_nAttachment > 0) )
+ {
+ pEnt->GetAttachment( m_nAttachment, *pAbsOrigin, *pAbsAngles );
+ return;
+ }
+
+ BaseClass::GetAimEntOrigin( pAttachedTo, pAbsOrigin, pAbsAngles );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Turn on the emission of particles
+//-----------------------------------------------------------------------------
+void C_ParticleTrail::SetEmit( bool bEmit )
+{
+ m_bEmit = bEmit;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the spawn rate of the effect
+//-----------------------------------------------------------------------------
+void C_ParticleTrail::SetSpawnRate( float rate )
+{
+ m_SpawnRate = rate;
+ m_ParticleSpawn.Init( rate );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: First sent down from the server
+//-----------------------------------------------------------------------------
+void C_ParticleTrail::OnDataChanged(DataUpdateType_t updateType)
+{
+ C_BaseEntity::OnDataChanged(updateType);
+
+ if ( updateType == DATA_UPDATE_CREATED )
+ {
+ Start( ParticleMgr(), NULL );
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void C_ParticleTrail::Start( CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs )
+{
+ if( pParticleMgr->AddEffect( &m_ParticleEffect, this ) == false )
+ return;
+
+ m_pParticleMgr = pParticleMgr;
+}
+