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.

134 lines
3.8 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 between two entities
  21. //-----------------------------------------------------------------------------
  22. class CTEBeamEnts : public CTEBaseBeam
  23. {
  24. public:
  25. DECLARE_CLASS( CTEBeamEnts, CTEBaseBeam );
  26. DECLARE_SERVERCLASS();
  27. CTEBeamEnts( const char *name );
  28. virtual ~CTEBeamEnts( 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. CTEBeamEnts::CTEBeamEnts( const char *name ) :
  39. CTEBaseBeam( name )
  40. {
  41. m_nStartEntity = 0;
  42. m_nEndEntity = 0;
  43. }
  44. //-----------------------------------------------------------------------------
  45. // Purpose:
  46. //-----------------------------------------------------------------------------
  47. CTEBeamEnts::~CTEBeamEnts( void )
  48. {
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Purpose:
  52. // Input : *current_origin -
  53. // *current_angles -
  54. //-----------------------------------------------------------------------------
  55. void CTEBeamEnts::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 = 10;
  62. m_fLife = 2.0;
  63. m_fWidth = 1.0;
  64. m_fAmplitude = 1;
  65. r = 127;
  66. g = 63;
  67. b = 0;
  68. a = 150;
  69. m_nSpeed = 1;
  70. CBroadcastRecipientFilter filter;
  71. Create( filter, 0.0 );
  72. }
  73. IMPLEMENT_SERVERCLASS_ST(CTEBeamEnts, DT_TEBeamEnts)
  74. SendPropInt( SENDINFO(m_nStartEntity), 24, SPROP_UNSIGNED ),
  75. SendPropInt( SENDINFO(m_nEndEntity), 24, SPROP_UNSIGNED ),
  76. END_SEND_TABLE()
  77. // Singleton to fire TEBeamEnts objects
  78. static CTEBeamEnts g_TEBeamEnts( "BeamEnts" );
  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_BeamEnts( IRecipientFilter& filter, float delay,
  96. int start, int end, int modelindex, int haloindex, int startframe, int framerate,
  97. float life, float width, float endWidth, int fadeLength, float amplitude, int r, int g, int b, int a, int speed )
  98. {
  99. g_TEBeamEnts.m_nStartEntity = (start & 0x0FFF) | ((1 & 0xF)<<12);
  100. g_TEBeamEnts.m_nEndEntity = (end & 0x0FFF) | ((1 & 0xF)<<12);
  101. g_TEBeamEnts.m_nModelIndex = modelindex;
  102. g_TEBeamEnts.m_nHaloIndex = haloindex;
  103. g_TEBeamEnts.m_nStartFrame = startframe;
  104. g_TEBeamEnts.m_nFrameRate = framerate;
  105. g_TEBeamEnts.m_fLife = life;
  106. g_TEBeamEnts.m_fWidth = width;
  107. g_TEBeamEnts.m_fEndWidth = endWidth;
  108. g_TEBeamEnts.m_nFadeLength = fadeLength;
  109. g_TEBeamEnts.m_fAmplitude = amplitude;
  110. g_TEBeamEnts.m_nSpeed = speed;
  111. g_TEBeamEnts.r = r;
  112. g_TEBeamEnts.g = g;
  113. g_TEBeamEnts.b = b;
  114. g_TEBeamEnts.a = a;
  115. // Send it over the wire
  116. g_TEBeamEnts.Create( filter, delay );
  117. }