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.

109 lines
3.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #include "cbase.h"
  10. #include "c_basetempentity.h"
  11. #include "iefx.h"
  12. #include "fx.h"
  13. #include "tier0/vprof.h"
  14. // memdbgon must be the last include file in a .cpp file!!!
  15. #include "tier0/memdbgon.h"
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Footprint Decal TE
  18. //-----------------------------------------------------------------------------
  19. class C_TEFootprintDecal : public C_BaseTempEntity
  20. {
  21. public:
  22. DECLARE_CLASS( C_TEFootprintDecal, C_BaseTempEntity );
  23. DECLARE_CLIENTCLASS();
  24. C_TEFootprintDecal( void );
  25. virtual ~C_TEFootprintDecal( void );
  26. virtual void PostDataUpdate( DataUpdateType_t updateType );
  27. virtual void Precache( void );
  28. public:
  29. Vector m_vecOrigin;
  30. Vector m_vecDirection;
  31. Vector m_vecStart;
  32. int m_nEntity;
  33. int m_nIndex;
  34. char m_chMaterialType;
  35. };
  36. IMPLEMENT_CLIENTCLASS_EVENT_DT(C_TEFootprintDecal, DT_TEFootprintDecal, CTEFootprintDecal)
  37. RecvPropVector( RECVINFO(m_vecOrigin)),
  38. RecvPropVector( RECVINFO(m_vecDirection)),
  39. RecvPropInt( RECVINFO(m_nEntity)),
  40. RecvPropInt( RECVINFO(m_nIndex)),
  41. RecvPropInt( RECVINFO(m_chMaterialType)),
  42. END_RECV_TABLE()
  43. //-----------------------------------------------------------------------------
  44. // Constructor, destructor
  45. //-----------------------------------------------------------------------------
  46. C_TEFootprintDecal::C_TEFootprintDecal( void )
  47. {
  48. m_vecOrigin.Init();
  49. m_vecStart.Init();
  50. m_nEntity = 0;
  51. m_nIndex = 0;
  52. m_chMaterialType = 'C';
  53. }
  54. C_TEFootprintDecal::~C_TEFootprintDecal( void )
  55. {
  56. }
  57. //-----------------------------------------------------------------------------
  58. // Purpose:
  59. //-----------------------------------------------------------------------------
  60. void C_TEFootprintDecal::Precache( void )
  61. {
  62. }
  63. //-----------------------------------------------------------------------------
  64. // Do stuff when data changes
  65. //-----------------------------------------------------------------------------
  66. void C_TEFootprintDecal::PostDataUpdate( DataUpdateType_t updateType )
  67. {
  68. VPROF( "C_TEFootprintDecal::PostDataUpdate" );
  69. // FIXME: Make this choose the decal based on material type
  70. if ( r_decals.GetInt() )
  71. {
  72. C_BaseEntity *ent = cl_entitylist->GetEnt( m_nEntity );
  73. if ( ent )
  74. {
  75. effects->DecalShoot( m_nIndex,
  76. m_nEntity, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), m_vecOrigin, &m_vecDirection, 0 );
  77. }
  78. }
  79. }
  80. void TE_FootprintDecal( IRecipientFilter& filter, float delay, const Vector *origin, const Vector* right,
  81. int entity, int index, unsigned char materialType )
  82. {
  83. if ( r_decals.GetInt() )
  84. {
  85. C_BaseEntity *ent = cl_entitylist->GetEnt( entity );
  86. if ( ent )
  87. {
  88. effects->DecalShoot( index, entity, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), *origin, right, 0 );
  89. }
  90. }
  91. }