Team Fortress 2 Source Code as on 22/4/2020
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.

78 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: TF Base Grenade.
  4. //
  5. //=============================================================================//
  6. #ifndef TF_WEAPONBASE_GRENADE_H
  7. #define TF_WEAPONBASE_GRENADE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_shareddefs.h"
  12. #include "tf_weaponbase.h"
  13. #include "npcevent.h"
  14. #ifdef CLIENT_DLL
  15. #define CTFWeaponBaseGrenade C_TFWeaponBaseGrenade
  16. #endif
  17. //=============================================================================//
  18. //
  19. // TF Base Grenade
  20. //
  21. class CTFWeaponBaseGrenade : public CTFWeaponBase
  22. {
  23. public:
  24. DECLARE_CLASS( CTFWeaponBaseGrenade, CTFWeaponBase );
  25. DECLARE_NETWORKCLASS();
  26. DECLARE_PREDICTABLE();
  27. CTFWeaponBaseGrenade();
  28. virtual void Spawn();
  29. virtual void Precache();
  30. bool Deploy( void );
  31. bool IsPrimed( void );
  32. void Prime( void );
  33. void Throw( void );
  34. bool ShouldDetonate( void );
  35. virtual void ItemPostFrame();
  36. virtual void HideThink( void ) { SetWeaponVisible( false ); }
  37. bool ShouldLowerMainWeapon( void );
  38. // Client specific.
  39. #ifdef CLIENT_DLL
  40. bool ShouldDraw( void );
  41. // Server specific.
  42. #else
  43. DECLARE_DATADESC();
  44. virtual void HandleAnimEvent( animevent_t *pEvent );
  45. // Each derived grenade class implements this.
  46. virtual CTFWeaponBaseGrenadeProj *EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer, float flTime, int iflags = 0 );
  47. #endif
  48. protected:
  49. CNetworkVar( bool, m_bPrimed ); // Set to true when the pin has been pulled but the grenade hasn't been thrown yet.
  50. CNetworkVar( float, m_flThrowTime ); // the time at which the grenade will be thrown. If this value is 0 then the time hasn't been set yet.
  51. CNetworkVar( bool, m_bThrow ); // True when the player is throwing the grenade
  52. private:
  53. CTFWeaponBaseGrenade( const CTFWeaponBaseGrenade & ) {}
  54. };
  55. #endif // TF_WEAPONBASE_GRENADE_H