Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "cbase.h"
  14. #include "basetempentity.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include "tier0/memdbgon.h"
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Dispatches footprint decal tempentity
  19. //-----------------------------------------------------------------------------
  20. #define FOOTPRINT_DECAY_TIME 3.0f
  21. class CTEFootprintDecal : public CBaseTempEntity
  22. {
  23. public:
  24. DECLARE_CLASS( CTEFootprintDecal, CBaseTempEntity );
  25. CTEFootprintDecal( const char *name );
  26. virtual ~CTEFootprintDecal( void );
  27. DECLARE_SERVERCLASS();
  28. public:
  29. CNetworkVector( m_vecOrigin );
  30. CNetworkVector( m_vecDirection );
  31. CNetworkVar( int, m_nEntity );
  32. CNetworkVar( int, m_nIndex );
  33. CNetworkVar( unsigned char, m_chMaterialType );
  34. };
  35. IMPLEMENT_SERVERCLASS_ST(CTEFootprintDecal, DT_TEFootprintDecal)
  36. SendPropVector( SENDINFO(m_vecOrigin), -1, SPROP_COORD),
  37. SendPropVector( SENDINFO(m_vecDirection), -1, SPROP_COORD),
  38. SendPropInt( SENDINFO(m_nEntity), 11, SPROP_UNSIGNED ),
  39. SendPropInt( SENDINFO(m_nIndex), 8, SPROP_UNSIGNED ),
  40. SendPropInt( SENDINFO(m_chMaterialType), 8, SPROP_UNSIGNED ),
  41. END_SEND_TABLE()
  42. // Singleton to fire TEFootprintDecal objects
  43. static CTEFootprintDecal g_TEFootprintDecal( "Footprint Decal" );
  44. //-----------------------------------------------------------------------------
  45. // constructor, destructor
  46. //-----------------------------------------------------------------------------
  47. CTEFootprintDecal::CTEFootprintDecal( const char *name ) :
  48. CBaseTempEntity( name )
  49. {
  50. m_vecOrigin.Init();
  51. m_nEntity = 0;
  52. m_nIndex = 0;
  53. m_chMaterialType = 'C';
  54. }
  55. CTEFootprintDecal::~CTEFootprintDecal( void )
  56. {
  57. }
  58. //-----------------------------------------------------------------------------
  59. // places a footprint decal
  60. //-----------------------------------------------------------------------------
  61. void TE_FootprintDecal( IRecipientFilter& filter, float delay,
  62. const Vector *origin, const Vector *right, int entity, int index,
  63. unsigned char materialType )
  64. {
  65. Assert( origin );
  66. g_TEFootprintDecal.m_vecOrigin = *origin;
  67. g_TEFootprintDecal.m_vecDirection = *right;
  68. g_TEFootprintDecal.m_nEntity = entity;
  69. g_TEFootprintDecal.m_nIndex = index;
  70. g_TEFootprintDecal.m_chMaterialType = materialType;
  71. VectorNormalize(g_TEFootprintDecal.m_vecDirection.GetForModify());
  72. // Send it over the wire
  73. g_TEFootprintDecal.Create( filter, delay );
  74. }