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.

82 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_BASECSGRENADE_H
  7. #define WEAPON_BASECSGRENADE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_csbase.h"
  12. #ifdef CLIENT_DLL
  13. #define CBaseCSGrenade C_BaseCSGrenade
  14. #endif
  15. class CBaseCSGrenade : public CWeaponCSBase
  16. {
  17. public:
  18. DECLARE_CLASS( CBaseCSGrenade, CWeaponCSBase );
  19. DECLARE_NETWORKCLASS();
  20. DECLARE_PREDICTABLE();
  21. CBaseCSGrenade();
  22. virtual void Precache();
  23. bool Deploy();
  24. bool Holster( CBaseCombatWeapon *pSwitchingTo );
  25. void PrimaryAttack();
  26. void SecondaryAttack();
  27. // virtual float GetSpread() const;
  28. bool Reload();
  29. virtual void ItemPostFrame();
  30. void DecrementAmmo( CBaseCombatCharacter *pOwner );
  31. virtual void StartGrenadeThrow();
  32. virtual void ThrowGrenade();
  33. virtual void DropGrenade();
  34. bool IsPinPulled() const;
  35. bool IsBeingThrown() const { return m_fThrowTime > 0; }
  36. #ifndef CLIENT_DLL
  37. DECLARE_DATADESC();
  38. virtual bool AllowsAutoSwitchFrom( void ) const;
  39. int CapabilitiesGet();
  40. // Each derived grenade class implements this.
  41. virtual void EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer );
  42. #endif
  43. protected:
  44. CNetworkVar( bool, m_bRedraw ); // Draw the weapon again after throwing a grenade
  45. CNetworkVar( bool, m_bPinPulled ); // Set to true when the pin has been pulled but the grenade hasn't been thrown yet.
  46. CNetworkVar( float, m_fThrowTime ); // the time at which the grenade will be thrown. If this value is 0 then the time hasn't been set yet.
  47. private:
  48. CBaseCSGrenade( const CBaseCSGrenade & ) {}
  49. };
  50. inline bool CBaseCSGrenade::IsPinPulled() const
  51. {
  52. return m_bPinPulled;
  53. }
  54. #endif // WEAPON_BASECSGRENADE_H