diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/shared/baseparticleentity.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/shared/baseparticleentity.h')
| -rw-r--r-- | mp/src/game/shared/baseparticleentity.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/mp/src/game/shared/baseparticleentity.h b/mp/src/game/shared/baseparticleentity.h new file mode 100644 index 00000000..5f7ad3f4 --- /dev/null +++ b/mp/src/game/shared/baseparticleentity.h @@ -0,0 +1,100 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+// Particle system entities can derive from this to handle some of the mundane
+// functionality of hooking into the engine's entity system.
+
+#ifndef PARTICLE_BASEEFFECT_H
+#define PARTICLE_BASEEFFECT_H
+
+#include "predictable_entity.h"
+#include "baseentity_shared.h"
+
+#if defined( CLIENT_DLL )
+#define CBaseParticleEntity C_BaseParticleEntity
+
+#include "particlemgr.h"
+
+#endif
+
+class CBaseParticleEntity : public CBaseEntity
+#if defined( CLIENT_DLL )
+, public IParticleEffect
+#endif
+{
+public:
+ DECLARE_CLASS( CBaseParticleEntity, CBaseEntity );
+ DECLARE_PREDICTABLE();
+ DECLARE_NETWORKCLASS();
+
+ CBaseParticleEntity();
+ virtual ~CBaseParticleEntity();
+
+ // CBaseEntity overrides.
+public:
+#if !defined( CLIENT_DLL )
+ virtual int UpdateTransmitState( void );
+#else
+// Default IParticleEffect overrides.
+public:
+
+ virtual bool ShouldSimulate() const { return m_bSimulate; }
+ virtual void SetShouldSimulate( bool bSim ) { m_bSimulate = bSim; }
+
+ virtual void SimulateParticles( CParticleSimulateIterator *pIterator );
+ virtual void RenderParticles( CParticleRenderIterator *pIterator );
+ virtual const Vector & GetSortOrigin();
+public:
+ CParticleEffectBinding m_ParticleEffect;
+#endif
+
+ virtual void Activate();
+ virtual void Think();
+
+#if defined( CLIENT_DLL )
+ // NOTE: Ths enclosed particle effect binding will do all the drawing
+ virtual bool ShouldDraw() { return false; }
+
+ int AllocateToolParticleEffectId();
+ int GetToolParticleEffectId() const;
+
+private:
+ int m_nToolParticleEffectId;
+ bool m_bSimulate;
+#endif
+
+public:
+ void FollowEntity(CBaseEntity *pEntity);
+
+ // UTIL_Remove will be called after the specified amount of time.
+ // If you pass in -1, the entity will never go away automatically.
+ void SetLifetime(float lifetime);
+
+private:
+ CBaseParticleEntity( const CBaseParticleEntity & ); // not defined, not accessible
+};
+
+
+#if defined( CLIENT_DLL )
+
+inline int CBaseParticleEntity::GetToolParticleEffectId() const
+{
+ return m_nToolParticleEffectId;
+}
+
+inline int CBaseParticleEntity::AllocateToolParticleEffectId()
+{
+ m_nToolParticleEffectId = ParticleMgr()->AllocateToolParticleEffectId();
+ return m_nToolParticleEffectId;
+}
+
+#endif // CLIENT_DLL
+
+#endif
+
+
|