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.

90 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_DODBASEGRENADE_H
  7. #define WEAPON_DODBASEGRENADE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_dodbase.h"
  12. #include "dod_shareddefs.h"
  13. #ifdef CLIENT_DLL
  14. #define CWeaponDODBaseGrenade C_WeaponDODBaseGrenade
  15. #endif
  16. class CWeaponDODBaseGrenade : public CWeaponDODBase
  17. {
  18. public:
  19. DECLARE_CLASS( CWeaponDODBaseGrenade, CWeaponDODBase );
  20. DECLARE_NETWORKCLASS();
  21. DECLARE_PREDICTABLE();
  22. DECLARE_ACTTABLE();
  23. CWeaponDODBaseGrenade();
  24. virtual void PrimaryAttack();
  25. virtual bool CanHolster();
  26. virtual bool IsArmed( void ) { return m_bArmed == true; }
  27. void SetArmed( bool bArmed ) { m_bArmed = bArmed; }
  28. virtual Activity GetIdleActivity( void );
  29. virtual Activity GetPrimaryAttackActivity( void );
  30. virtual Activity GetDrawActivity( void );
  31. #ifdef CLIENT_DLL
  32. #else
  33. DECLARE_DATADESC();
  34. virtual void Precache();
  35. virtual void ItemPostFrame();
  36. virtual bool AllowsAutoSwitchFrom( void ) const;
  37. virtual bool Deploy();
  38. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  39. virtual bool Reload();
  40. void DecrementAmmo( CBaseCombatCharacter *pOwner );
  41. void StartThrow( int iThrowType );
  42. void DropGrenade( void ); //forces the grenade to be dropped
  43. virtual void ThrowGrenade( bool bDrop );
  44. // Each derived grenade class implements this.
  45. virtual void EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer, float flLifeTime = GRENADE_FUSE_LENGTH );
  46. void SetDetonateTime( float flDetonateTime )
  47. {
  48. m_flDetonateTime = flDetonateTime;
  49. SetArmed( true );
  50. }
  51. void InputSetDetonateTime( inputdata_t &inputdata );
  52. virtual float GetDetonateTimerLength( void ) { return GRENADE_FUSE_LENGTH; }
  53. protected:
  54. #endif
  55. bool m_bRedraw; // Draw the weapon again after throwing a grenade
  56. CNetworkVar( bool, m_bPinPulled ); // Set to true when the pin has been pulled but the grenade hasn't been thrown yet.
  57. CNetworkVar( bool, m_bArmed ); // is the grenade armed?
  58. float m_flDetonateTime; // what time the grenade will explode ( if > 0 )
  59. CWeaponDODBaseGrenade( const CWeaponDODBaseGrenade & ) {}
  60. };
  61. #endif // WEAPON_DODBASEGRENADE_H