diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/te_footprintdecal.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/te_footprintdecal.cpp')
| -rw-r--r-- | game/server/te_footprintdecal.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/game/server/te_footprintdecal.cpp b/game/server/te_footprintdecal.cpp new file mode 100644 index 0000000..a729525 --- /dev/null +++ b/game/server/te_footprintdecal.cpp @@ -0,0 +1,91 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "basetempentity.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: Dispatches footprint decal tempentity +//----------------------------------------------------------------------------- + +#define FOOTPRINT_DECAY_TIME 3.0f + +class CTEFootprintDecal : public CBaseTempEntity +{ +public: + DECLARE_CLASS( CTEFootprintDecal, CBaseTempEntity ); + + CTEFootprintDecal( const char *name ); + virtual ~CTEFootprintDecal( void ); + + DECLARE_SERVERCLASS(); + +public: + CNetworkVector( m_vecOrigin ); + CNetworkVector( m_vecDirection ); + CNetworkVar( int, m_nEntity ); + CNetworkVar( int, m_nIndex ); + CNetworkVar( unsigned char, m_chMaterialType ); +}; + +IMPLEMENT_SERVERCLASS_ST(CTEFootprintDecal, DT_TEFootprintDecal) + SendPropVector( SENDINFO(m_vecOrigin), -1, SPROP_COORD), + SendPropVector( SENDINFO(m_vecDirection), -1, SPROP_COORD), + SendPropInt( SENDINFO(m_nEntity), 11, SPROP_UNSIGNED ), + SendPropInt( SENDINFO(m_nIndex), 8, SPROP_UNSIGNED ), + SendPropInt( SENDINFO(m_chMaterialType), 8, SPROP_UNSIGNED ), +END_SEND_TABLE() + + +// Singleton to fire TEFootprintDecal objects +static CTEFootprintDecal g_TEFootprintDecal( "Footprint Decal" ); + +//----------------------------------------------------------------------------- +// constructor, destructor +//----------------------------------------------------------------------------- + +CTEFootprintDecal::CTEFootprintDecal( const char *name ) : + CBaseTempEntity( name ) +{ + m_vecOrigin.Init(); + m_nEntity = 0; + m_nIndex = 0; + m_chMaterialType = 'C'; +} + +CTEFootprintDecal::~CTEFootprintDecal( void ) +{ +} + +//----------------------------------------------------------------------------- +// places a footprint decal +//----------------------------------------------------------------------------- + +void TE_FootprintDecal( IRecipientFilter& filter, float delay, + const Vector *origin, const Vector *right, int entity, int index, + unsigned char materialType ) +{ + Assert( origin ); + g_TEFootprintDecal.m_vecOrigin = *origin; + g_TEFootprintDecal.m_vecDirection = *right; + g_TEFootprintDecal.m_nEntity = entity; + g_TEFootprintDecal.m_nIndex = index; + g_TEFootprintDecal.m_chMaterialType = materialType; + + VectorNormalize(g_TEFootprintDecal.m_vecDirection.GetForModify()); + + // Send it over the wire + g_TEFootprintDecal.Create( filter, delay ); +}
\ No newline at end of file |