From 39ed87570bdb2f86969d4be821c94b722dc71179 Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Wed, 26 Jun 2013 15:22:04 -0700 Subject: First version of the SOurce SDK 2013 --- mp/src/game/shared/baseparticleentity.h | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 mp/src/game/shared/baseparticleentity.h (limited to 'mp/src/game/shared/baseparticleentity.h') 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 + + -- cgit v1.2.3