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.

112 lines
3.1 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 Fizz tempentity
  19. //-----------------------------------------------------------------------------
  20. class CTEFizz : public CBaseTempEntity
  21. {
  22. public:
  23. DECLARE_CLASS( CTEFizz, CBaseTempEntity );
  24. CTEFizz( const char *name );
  25. virtual ~CTEFizz( void );
  26. virtual void Test( const Vector& current_origin, const QAngle& current_angles );
  27. virtual void Precache( void );
  28. DECLARE_SERVERCLASS();
  29. public:
  30. CNetworkVar( int, m_nEntity );
  31. CNetworkVar( int, m_nModelIndex );
  32. CNetworkVar( int, m_nDensity );
  33. CNetworkVar( int, m_nCurrent );
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Purpose:
  37. // Input : *name -
  38. //-----------------------------------------------------------------------------
  39. CTEFizz::CTEFizz( const char *name ) :
  40. CBaseTempEntity( name )
  41. {
  42. m_nEntity = 0;
  43. m_nModelIndex = 0;
  44. m_nDensity = 0;
  45. m_nCurrent = 0;
  46. }
  47. //-----------------------------------------------------------------------------
  48. // Purpose:
  49. //-----------------------------------------------------------------------------
  50. CTEFizz::~CTEFizz( void )
  51. {
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Purpose:
  55. // Input : *current_origin -
  56. // *current_angles -
  57. //-----------------------------------------------------------------------------
  58. void CTEFizz::Test( const Vector& current_origin, const QAngle& current_angles )
  59. {
  60. // Fill in data
  61. m_nModelIndex = CBaseEntity::PrecacheModel( "sprites/bubble.vmt" );;
  62. m_nDensity = 200;
  63. m_nEntity = 1;
  64. m_nCurrent = 100;
  65. CBroadcastRecipientFilter filter;
  66. Create( filter, 0.0 );
  67. }
  68. //-----------------------------------------------------------------------------
  69. // Purpose:
  70. //-----------------------------------------------------------------------------
  71. void CTEFizz::Precache( void )
  72. {
  73. CBaseEntity::PrecacheModel( "sprites/bubble.vmt" );
  74. }
  75. IMPLEMENT_SERVERCLASS_ST(CTEFizz, DT_TEFizz)
  76. SendPropInt( SENDINFO(m_nEntity), MAX_EDICT_BITS, SPROP_UNSIGNED ),
  77. SendPropModelIndex( SENDINFO(m_nModelIndex) ),
  78. SendPropInt( SENDINFO(m_nDensity), 8, SPROP_UNSIGNED ),
  79. SendPropInt(SENDINFO(m_nCurrent), 16 ),
  80. END_SEND_TABLE()
  81. // Singleton to fire TEFizz objects
  82. static CTEFizz g_TEFizz( "Fizz" );
  83. void TE_Fizz( IRecipientFilter& filter, float delay,
  84. const CBaseEntity *entity, int modelindex, int density, int current )
  85. {
  86. Assert( entity );
  87. g_TEFizz.m_nEntity = ENTINDEX( (edict_t *)entity->edict() );
  88. g_TEFizz.m_nModelIndex = modelindex;
  89. g_TEFizz.m_nDensity = density;
  90. g_TEFizz.m_nCurrent = current;
  91. // Send it over the wire
  92. g_TEFizz.Create( filter, delay );
  93. }