forked from sears2424/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseparticleentity.cpp
115 lines (92 loc) · 2.72 KB
/
baseparticleentity.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//===========================================================================//
#include "cbase.h"
#include "baseparticleentity.h"
#ifdef CLIENT_DLL
#include "tier1/KeyValues.h"
#include "toolframework_client.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
IMPLEMENT_NETWORKCLASS_ALIASED( BaseParticleEntity, DT_BaseParticleEntity )
BEGIN_NETWORK_TABLE( CBaseParticleEntity, DT_BaseParticleEntity )
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( CBaseParticleEntity )
END_PREDICTION_DATA()
#ifdef CLIENT_DLL
REGISTER_EFFECT( CBaseParticleEntity );
#endif
CBaseParticleEntity::CBaseParticleEntity( void )
{
#if defined( CLIENT_DLL )
m_bSimulate = true;
m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID;
#endif
}
CBaseParticleEntity::~CBaseParticleEntity( void )
{
#if defined( CLIENT_DLL )
if ( ToolsEnabled() && ( m_nToolParticleEffectId != TOOLPARTICLESYSTEMID_INVALID ) && clienttools->IsInRecordingMode() )
{
KeyValues *msg = new KeyValues( "ParticleSystem_Destroy" );
msg->SetInt( "id", m_nToolParticleEffectId );
m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID;
}
#endif
}
#if !defined( CLIENT_DLL )
int CBaseParticleEntity::UpdateTransmitState( void )
{
if ( IsEffectActive( EF_NODRAW ) )
return SetTransmitState( FL_EDICT_DONTSEND );
if ( IsEFlagSet( EFL_IN_SKYBOX ) )
return SetTransmitState( FL_EDICT_ALWAYS );
// cull against PVS
return SetTransmitState( FL_EDICT_PVSCHECK );
}
#endif
void CBaseParticleEntity::Activate()
{
#if !defined( CLIENT_DLL )
BaseClass::Activate();
#endif
}
void CBaseParticleEntity::Think()
{
Remove( );
}
void CBaseParticleEntity::FollowEntity(CBaseEntity *pEntity)
{
BaseClass::FollowEntity( pEntity );
SetLocalOrigin( vec3_origin );
}
void CBaseParticleEntity::SetLifetime(float lifetime)
{
if(lifetime == -1)
SetNextThink( TICK_NEVER_THINK );
else
SetNextThink( gpGlobals->curtime + lifetime );
}
#if defined( CLIENT_DLL )
const Vector &CBaseParticleEntity::GetSortOrigin()
{
// By default, we do the cheaper behavior of getting the root parent's abs origin, so we don't have to
// setup any bones along the way. If this screws anything up, we can always make it an option.
return GetRootMoveParent()->GetAbsOrigin();
}
void CBaseParticleEntity::SimulateParticles( CParticleSimulateIterator *pIterator )
{
// If you derive from CBaseParticleEntity, you must implement simulation and rendering.
Assert( false );
}
void CBaseParticleEntity::RenderParticles( CParticleRenderIterator *pIterator )
{
// If you derive from CBaseParticleEntity, you must implement simulation and rendering.
Assert( false );
}
#endif