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.

135 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 CTEBeamRing : public CTEBaseBeam
  23. {
  24. public:
  25. DECLARE_CLASS( CTEBeamRing, CTEBaseBeam );
  26. DECLARE_SERVERCLASS();
  27. CTEBeamRing( const char *name );
  28. virtual ~CTEBeamRing( void );
  29. virtual void Test( const Vector& current_origin, const QAngle& current_angles );
  30. public:
  31. CNetworkVar( int, m_nStartEntity );
  32. CNetworkVar( int, m_nEndEntity );
  33. };
  34. //-----------------------------------------------------------------------------
  35. // Purpose:
  36. // Input : *name -
  37. //-----------------------------------------------------------------------------
  38. CTEBeamRing::CTEBeamRing( const char *name ) :
  39. CTEBaseBeam( name )
  40. {
  41. m_nStartEntity = 0;
  42. m_nEndEntity = 0;
  43. }
  44. //-----------------------------------------------------------------------------
  45. // Purpose:
  46. //-----------------------------------------------------------------------------
  47. CTEBeamRing::~CTEBeamRing( void )
  48. {
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Purpose:
  52. // Input : *current_origin -
  53. // *current_angles -
  54. //-----------------------------------------------------------------------------
  55. void CTEBeamRing::Test( const Vector& current_origin, const QAngle& current_angles )
  56. {
  57. m_nStartEntity = 1;
  58. m_nEndEntity = 0;
  59. m_nModelIndex = g_sModelIndexSmoke;
  60. m_nStartFrame = 0;
  61. m_nFrameRate = 2;
  62. m_fLife = 10.0;
  63. m_fWidth = 2.0;
  64. m_fAmplitude = 1;
  65. r = 255;
  66. g = 255;
  67. b = 0;
  68. a = 127;
  69. m_nSpeed = 5;
  70. CBroadcastRecipientFilter filter;
  71. Create( filter, 0.0 );
  72. }
  73. IMPLEMENT_SERVERCLASS_ST( CTEBeamRing, DT_TEBeamRing)
  74. SendPropInt( SENDINFO(m_nStartEntity), MAX_EDICT_BITS, SPROP_UNSIGNED ),
  75. SendPropInt( SENDINFO(m_nEndEntity), MAX_EDICT_BITS, SPROP_UNSIGNED ),
  76. END_SEND_TABLE()
  77. // Singleton to fire TEBeamRing objects
  78. static CTEBeamRing g_TEBeamRing( "BeamRing" );
  79. //-----------------------------------------------------------------------------
  80. // Purpose:
  81. // Input : msg_dest -
  82. // delay -
  83. // *origin -
  84. // *recipient -
  85. // int start -
  86. // end -
  87. // modelindex -
  88. // startframe -
  89. // framerate -
  90. // msg_dest -
  91. // delay -
  92. // origin -
  93. // recipient -
  94. //-----------------------------------------------------------------------------
  95. void TE_BeamRing( IRecipientFilter& filter, float delay,
  96. int start, int end, int modelindex, int haloindex, int startframe, int framerate,
  97. float life, float width, int spread, float amplitude, int r, int g, int b, int a, int speed, int flags )
  98. {
  99. g_TEBeamRing.m_nStartEntity = (start & 0x0FFF) | ((1 & 0xF)<<12);
  100. g_TEBeamRing.m_nEndEntity = (end & 0x0FFF) | ((1 & 0xF)<<12);
  101. g_TEBeamRing.m_nModelIndex = modelindex;
  102. g_TEBeamRing.m_nHaloIndex = haloindex;
  103. g_TEBeamRing.m_nStartFrame = startframe;
  104. g_TEBeamRing.m_nFrameRate = framerate;
  105. g_TEBeamRing.m_fLife = life;
  106. g_TEBeamRing.m_fWidth = width;
  107. g_TEBeamRing.m_fEndWidth = width;
  108. g_TEBeamRing.m_nFadeLength = 0;
  109. g_TEBeamRing.m_fAmplitude = amplitude;
  110. g_TEBeamRing.m_nSpeed = speed;
  111. g_TEBeamRing.r = r;
  112. g_TEBeamRing.g = g;
  113. g_TEBeamRing.b = b;
  114. g_TEBeamRing.a = a;
  115. g_TEBeamRing.m_nFlags = flags;
  116. // Send it over the wire
  117. g_TEBeamRing.Create( filter, delay );
  118. }