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.

65 lines
1.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "c_tesla.h"
  8. #include "fx.h"
  9. #include <bitbuf.h>
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. IMPLEMENT_CLIENTCLASS_DT( C_Tesla, DT_Tesla, CTesla )
  13. RecvPropString( RECVINFO( m_SoundName ) ),
  14. RecvPropString( RECVINFO( m_iszSpriteName ) )
  15. END_RECV_TABLE()
  16. C_Tesla::C_Tesla()
  17. {
  18. }
  19. void C_Tesla::ReceiveMessage( int classID, bf_read &msg )
  20. {
  21. CTeslaInfo teslaInfo;
  22. msg.ReadBitVec3Coord( teslaInfo.m_vPos );
  23. teslaInfo.m_vAngles.Init();
  24. teslaInfo.m_nEntIndex = msg.ReadShort();
  25. teslaInfo.m_flRadius = msg.ReadFloat();
  26. teslaInfo.m_vColor.x = ((unsigned char)msg.ReadChar()) / 255.0f;
  27. teslaInfo.m_vColor.y = ((unsigned char)msg.ReadChar()) / 255.0f;
  28. teslaInfo.m_vColor.z = ((unsigned char)msg.ReadChar()) / 255.0f;
  29. float flAlpha = 0;
  30. flAlpha = ((unsigned char)msg.ReadChar()) / 255.0f;
  31. teslaInfo.m_nBeams = msg.ReadChar();
  32. teslaInfo.m_flBeamWidth = msg.ReadFloat();
  33. teslaInfo.m_flTimeVisible = msg.ReadFloat();
  34. teslaInfo.m_pszSpriteName = m_iszSpriteName;
  35. EmitSound( m_SoundName );
  36. m_QueuedCommands.AddToTail( teslaInfo );
  37. SetNextClientThink( CLIENT_THINK_ALWAYS );
  38. }
  39. void C_Tesla::ClientThink()
  40. {
  41. FOR_EACH_LL( m_QueuedCommands, i )
  42. {
  43. FX_Tesla( m_QueuedCommands[i] );
  44. }
  45. m_QueuedCommands.Purge();
  46. SetNextClientThink( CLIENT_THINK_NEVER );
  47. }