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.

124 lines
3.9 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. #include "te_basebeam.h"
  16. // memdbgon must be the last include file in a .cpp file!!!
  17. #include "tier0/memdbgon.h"
  18. extern int g_sModelIndexSmoke; // (in combatweapon.cpp) holds the index for the smoke cloud
  19. //-----------------------------------------------------------------------------
  20. // Purpose: Dispatches a beam ring between two entities
  21. //-----------------------------------------------------------------------------
  22. class CTEBeamRingPoint : public CTEBaseBeam
  23. {
  24. public:
  25. DECLARE_CLASS( CTEBeamRingPoint, CTEBaseBeam );
  26. DECLARE_SERVERCLASS();
  27. CTEBeamRingPoint( const char *name );
  28. virtual ~CTEBeamRingPoint( void );
  29. virtual void Test( const Vector& current_origin, const QAngle& current_angles );
  30. public:
  31. CNetworkVector( m_vecCenter );
  32. CNetworkVar( float, m_flStartRadius );
  33. CNetworkVar( float, m_flEndRadius );
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Purpose:
  37. // Input : *name -
  38. //-----------------------------------------------------------------------------
  39. CTEBeamRingPoint::CTEBeamRingPoint( const char *name ) :
  40. CTEBaseBeam( name )
  41. {
  42. m_vecCenter.Init();
  43. m_flStartRadius = 0.0f;
  44. m_flEndRadius = 0.0f;
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. //-----------------------------------------------------------------------------
  49. CTEBeamRingPoint::~CTEBeamRingPoint( void )
  50. {
  51. }
  52. //-----------------------------------------------------------------------------
  53. // Purpose:
  54. // Input : *current_origin -
  55. // *current_angles -
  56. //-----------------------------------------------------------------------------
  57. void CTEBeamRingPoint::Test( const Vector& current_origin, const QAngle& current_angles )
  58. {
  59. m_vecCenter = current_origin;
  60. m_flEndRadius = 256.0f;
  61. m_flStartRadius = 16.0f;
  62. m_nModelIndex = g_sModelIndexSmoke;
  63. m_nStartFrame = 0;
  64. m_nFrameRate = 2;
  65. m_fLife = 10.0;
  66. m_fWidth = 2.0;
  67. m_fAmplitude = 1;
  68. r = 255;
  69. g = 255;
  70. b = 0;
  71. a = 127;
  72. m_nSpeed = 5;
  73. CBroadcastRecipientFilter filter;
  74. Create( filter, 0.0 );
  75. }
  76. IMPLEMENT_SERVERCLASS_ST( CTEBeamRingPoint, DT_TEBeamRingPoint)
  77. SendPropVector( SENDINFO(m_vecCenter), -1, SPROP_COORD ),
  78. SendPropFloat( SENDINFO(m_flStartRadius), 16, SPROP_ROUNDUP, 0.0f, 4096.0f ),
  79. SendPropFloat( SENDINFO(m_flEndRadius), 16, SPROP_ROUNDUP, 0.0f, 4096.0f ),
  80. END_SEND_TABLE()
  81. // Singleton to fire TEBeamRingPoint objects
  82. static CTEBeamRingPoint g_TEBeamRingPoint( "BeamRingPoint" );
  83. void TE_BeamRingPoint( IRecipientFilter& filter, float delay,
  84. const Vector& center, float start_radius, float end_radius, int modelindex, int haloindex, int startframe, int framerate,
  85. float life, float width, int spread, float amplitude, int r, int g, int b, int a, int speed, int flags )
  86. {
  87. g_TEBeamRingPoint.m_vecCenter = center;
  88. g_TEBeamRingPoint.m_flStartRadius = start_radius;
  89. g_TEBeamRingPoint.m_flEndRadius = end_radius;
  90. g_TEBeamRingPoint.m_nModelIndex = modelindex;
  91. g_TEBeamRingPoint.m_nHaloIndex = haloindex;
  92. g_TEBeamRingPoint.m_nStartFrame = startframe;
  93. g_TEBeamRingPoint.m_nFrameRate = framerate;
  94. g_TEBeamRingPoint.m_fLife = life;
  95. g_TEBeamRingPoint.m_fWidth = width;
  96. g_TEBeamRingPoint.m_fEndWidth = width;
  97. g_TEBeamRingPoint.m_nFadeLength = 0;
  98. g_TEBeamRingPoint.m_fAmplitude = amplitude;
  99. g_TEBeamRingPoint.m_nSpeed = speed;
  100. g_TEBeamRingPoint.r = r;
  101. g_TEBeamRingPoint.g = g;
  102. g_TEBeamRingPoint.b = b;
  103. g_TEBeamRingPoint.a = a;
  104. g_TEBeamRingPoint.m_nFlags = flags;
  105. // Send it over the wire
  106. g_TEBeamRingPoint.Create( filter, delay );
  107. }