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
2.9 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. // UNDONE: Get rid of this?
  17. #define FDECAL_PERMANENT 0x01
  18. //-----------------------------------------------------------------------------
  19. // Purpose: BSP Decal TE
  20. //-----------------------------------------------------------------------------
  21. class C_TEBSPDecal : public C_BaseTempEntity
  22. {
  23. public:
  24. DECLARE_CLASS( C_TEBSPDecal, C_BaseTempEntity );
  25. DECLARE_CLIENTCLASS();
  26. C_TEBSPDecal( void );
  27. virtual ~C_TEBSPDecal( void );
  28. virtual void PostDataUpdate( DataUpdateType_t updateType );
  29. virtual void Precache( void );
  30. public:
  31. Vector m_vecOrigin;
  32. int m_nEntity;
  33. int m_nIndex;
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Purpose:
  37. //-----------------------------------------------------------------------------
  38. C_TEBSPDecal::C_TEBSPDecal( void )
  39. {
  40. m_vecOrigin.Init();
  41. m_nEntity = 0;
  42. m_nIndex = 0;
  43. }
  44. //-----------------------------------------------------------------------------
  45. // Purpose:
  46. //-----------------------------------------------------------------------------
  47. C_TEBSPDecal::~C_TEBSPDecal( void )
  48. {
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Purpose:
  52. //-----------------------------------------------------------------------------
  53. void C_TEBSPDecal::Precache( void )
  54. {
  55. }
  56. void TE_BSPDecal( IRecipientFilter& filter, float delay,
  57. const Vector* pos, int entity, int index )
  58. {
  59. C_BaseEntity *ent;
  60. if ( ( ent = cl_entitylist->GetEnt( entity ) ) == NULL )
  61. {
  62. DevMsg( 1, "Decal: entity = %i", entity );
  63. return;
  64. }
  65. if ( r_decals.GetInt() )
  66. {
  67. effects->DecalShoot( index, entity, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), *pos, 0, FDECAL_PERMANENT );
  68. }
  69. }
  70. //-----------------------------------------------------------------------------
  71. // Purpose:
  72. // Input : bool -
  73. //-----------------------------------------------------------------------------
  74. void C_TEBSPDecal::PostDataUpdate( DataUpdateType_t updateType )
  75. {
  76. VPROF( "C_TEBSPDecal::PostDataUpdate" );
  77. C_BaseEntity *ent;
  78. if ( ( ent = cl_entitylist->GetEnt( m_nEntity ) ) == NULL )
  79. {
  80. DevMsg( 1, "Decal: entity = %i", m_nEntity );
  81. return;
  82. }
  83. if ( r_decals.GetInt() )
  84. {
  85. effects->DecalShoot( m_nIndex, m_nEntity, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), m_vecOrigin, 0, FDECAL_PERMANENT );
  86. }
  87. }
  88. IMPLEMENT_CLIENTCLASS_EVENT_DT(C_TEBSPDecal, DT_TEBSPDecal, CTEBSPDecal)
  89. RecvPropVector( RECVINFO(m_vecOrigin)),
  90. RecvPropInt( RECVINFO(m_nEntity)),
  91. RecvPropInt( RECVINFO(m_nIndex)),
  92. END_RECV_TABLE()