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.

117 lines
2.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ITEM_SONARPULSE_H
  7. #define ITEM_SONARPULSE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "cbase.h"
  12. #include "utlvector.h"
  13. #if defined( CLIENT_DLL )
  14. #include "c_cs_player.h"
  15. #include "c_baseanimating.h"
  16. #include "GameEventListener.h"
  17. #define CSonarPulse C_SonarPulse
  18. #else
  19. #include "cs_player.h"
  20. #include "baseanimating.h"
  21. #endif
  22. #ifdef CLIENT_DLL
  23. #define SONARPULSE_ICON_LIFETIME 10.0f
  24. struct sonarpulseicon_t
  25. {
  26. Vector m_vecPos;
  27. float m_flTimeCreated;
  28. sonarpulseicon_t( Vector vecPos )
  29. {
  30. m_vecPos = vecPos;
  31. m_flTimeCreated = gpGlobals->curtime;
  32. }
  33. float GetLifeRemaining( void )
  34. {
  35. return SONARPULSE_ICON_LIFETIME - (gpGlobals->curtime - m_flTimeCreated);
  36. }
  37. };
  38. #endif
  39. class CSonarPulse : public CBaseAnimating
  40. #ifdef CLIENT_DLL
  41. , public CGameEventListener
  42. #endif
  43. {
  44. public:
  45. DECLARE_CLASS( CSonarPulse, CBaseAnimating );
  46. public:
  47. DECLARE_NETWORKCLASS();
  48. DECLARE_PREDICTABLE();
  49. #if !defined( CLIENT_DLL )
  50. DECLARE_DATADESC();
  51. #endif
  52. CSonarPulse();
  53. virtual ~CSonarPulse();
  54. virtual void Spawn();
  55. virtual void Precache();
  56. float GetPulseRadius( void );
  57. Vector GetPulseOrigin( void );
  58. #if defined( CLIENT_DLL )
  59. void FireGameEvent( IGameEvent *event );
  60. void RenderIcons( void );
  61. IMaterial *m_pIconMaterial;
  62. void ClientThink( void );
  63. #else
  64. // need to always transmit since we want to see the pulse edge even when the center is way out of pvs
  65. virtual int UpdateTransmitState() { return SetTransmitState( FL_EDICT_ALWAYS ); }
  66. virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo ){ return FL_EDICT_ALWAYS; }
  67. virtual int ObjectCaps() { return BaseClass::ObjectCaps() | (FCAP_ONOFF_USE); }
  68. void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
  69. void PulseStart( void );
  70. void PulseThink( void );
  71. void PulseReset( void );
  72. bool IsOkToPulse( CCSPlayer* pPlayer );
  73. CUtlVector<CCSPlayer*>m_vecPlayersOutsidePulse;
  74. CUtlVector<CCSPlayer*>m_vecPingedPlayers;
  75. #endif
  76. CNetworkVar( bool, m_bPulseInProgress );
  77. CNetworkVar( float, m_flPulseInitTime );
  78. CNetworkVar( float, m_flPlaybackRate );
  79. };
  80. #endif // ITEM_CRATEBEACON_H