2023-10-03 14:23:56 +00:00
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
2020-04-22 16:56:21 +00:00
//
// Purpose:
//
//=============================================================================
# ifndef PARTICLE_SYSTEM_H
# define PARTICLE_SYSTEM_H
# ifdef _WIN32
# pragma once
# endif
# include "cbase.h"
//-----------------------------------------------------------------------------
// Purpose: An entity that spawns and controls a particle system
//-----------------------------------------------------------------------------
class CParticleSystem : public CBaseEntity
{
DECLARE_CLASS ( CParticleSystem , CBaseEntity ) ;
public :
DECLARE_SERVERCLASS ( ) ;
DECLARE_DATADESC ( ) ;
2023-10-03 14:23:56 +00:00
CParticleSystem ( void ) ;
2020-04-22 16:56:21 +00:00
virtual void Precache ( void ) ;
virtual void Spawn ( void ) ;
virtual void Activate ( void ) ;
virtual int UpdateTransmitState ( void ) ;
2023-10-03 14:23:56 +00:00
virtual int ObjectCaps ( void ) ;
virtual bool KeyValue ( const char * szKeyName , const char * szValue ) ;
virtual bool GetKeyValue ( const char * szKeyName , char * szValue , int iMaxLen ) ;
2020-04-22 16:56:21 +00:00
void StartParticleSystem ( void ) ;
2023-10-03 14:23:56 +00:00
void StopParticleSystem ( int nStopType = STOP_NORMAL ) ;
2020-04-22 16:56:21 +00:00
void InputStart ( inputdata_t & inputdata ) ;
void InputStop ( inputdata_t & inputdata ) ;
2023-10-03 14:23:56 +00:00
void InputStopEndCap ( inputdata_t & inputdata ) ;
void InputDestroy ( inputdata_t & inputdata ) ;
2020-04-22 16:56:21 +00:00
void StartParticleSystemThink ( void ) ;
2023-10-03 14:23:56 +00:00
bool SetControlPointValue ( int iControlPoint , const Vector & vValue ) ; //server controlled control points (variables in particle effects instead of literal follow points)
void DisableSaveRestore ( bool bState ) { m_bNoSave = bState ; }
2020-04-22 16:56:21 +00:00
2023-10-03 14:23:56 +00:00
enum
{
kSERVERCONTROLLEDPOINTS = 4 ,
kMAXCONTROLPOINTS = 63 , ///< actually one less than the total number of cpoints since 0 is assumed to be me
} ;
// stop types
enum
{
STOP_NORMAL = 0 ,
STOP_DESTROY_IMMEDIATELY ,
STOP_PLAY_ENDCAP ,
NUM_STOP_TYPES
} ;
2020-04-22 16:56:21 +00:00
protected :
/// Load up and resolve the entities that are supposed to be the control points
void ReadControlPointEnts ( void ) ;
2023-10-03 14:23:56 +00:00
bool m_bNoSave ;
2020-04-22 16:56:21 +00:00
bool m_bStartActive ;
string_t m_iszEffectName ;
2023-10-03 14:23:56 +00:00
CNetworkString ( m_szSnapshotFileName , MAX_PATH ) ;
2020-04-22 16:56:21 +00:00
CNetworkVar ( bool , m_bActive ) ;
2023-10-03 14:23:56 +00:00
CNetworkVar ( int , m_nStopType ) ;
CNetworkVar ( int , m_iEffectIndex ) ;
2020-04-22 16:56:21 +00:00
CNetworkVar ( float , m_flStartTime ) ; // Time at which this effect was started. This is used after restoring an active effect.
2023-10-03 14:23:56 +00:00
//server controlled control points (variables in particle effects instead of literal follow points)
CNetworkArray ( Vector , m_vServerControlPoints , kSERVERCONTROLLEDPOINTS ) ;
CNetworkArray ( uint8 , m_iServerControlPointAssignments , kSERVERCONTROLLEDPOINTS ) ;
2020-04-22 16:56:21 +00:00
string_t m_iszControlPointNames [ kMAXCONTROLPOINTS ] ;
CNetworkArray ( EHANDLE , m_hControlPointEnts , kMAXCONTROLPOINTS ) ;
CNetworkArray ( unsigned char , m_iControlPointParents , kMAXCONTROLPOINTS ) ;
} ;
# endif // PARTICLE_SYSTEM_H