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.

92 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //
  4. //=============================================================================
  5. #ifndef TF_WEAPON_SMG_H
  6. #define TF_WEAPON_SMG_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "tf_weaponbase_gun.h"
  11. // Client specific.
  12. #ifdef CLIENT_DLL
  13. #define CTFSMG C_TFSMG
  14. #define CTFChargedSMG C_TFChargedSMG
  15. #endif
  16. //=============================================================================
  17. //
  18. // TF Weapon Sub-machine gun.
  19. //
  20. class CTFSMG : public CTFWeaponBaseGun
  21. {
  22. public:
  23. DECLARE_CLASS( CTFSMG, CTFWeaponBaseGun );
  24. DECLARE_NETWORKCLASS();
  25. DECLARE_PREDICTABLE();
  26. // Server specific.
  27. #ifdef GAME_DLL
  28. DECLARE_DATADESC();
  29. #endif
  30. CTFSMG() {}
  31. ~CTFSMG() {}
  32. virtual int GetWeaponID( void ) const { return TF_WEAPON_SMG; }
  33. virtual int GetDamageType( void ) const;
  34. virtual bool CanFireCriticalShot( bool bIsHeadshot );
  35. bool CanHeadshot( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return (iMode == 1); };
  36. private:
  37. CTFSMG( const CTFSMG & ) {}
  38. };
  39. //=============================================================================
  40. //
  41. // TF Weapon Charged Sub-machine gun.
  42. //
  43. class CTFChargedSMG : public CTFSMG
  44. {
  45. public:
  46. DECLARE_CLASS( CTFChargedSMG, CTFSMG );
  47. DECLARE_NETWORKCLASS();
  48. DECLARE_PREDICTABLE();
  49. // Server specific.
  50. #ifdef GAME_DLL
  51. DECLARE_DATADESC();
  52. #endif
  53. CTFChargedSMG() {}
  54. ~CTFChargedSMG() {}
  55. virtual int GetWeaponID( void ) const { return TF_WEAPON_CHARGED_SMG; }
  56. const char* GetEffectLabelText( void ) { return "#TF_SmgCharge"; }
  57. float GetProgress( void );
  58. bool ShouldFlashChargeBar();
  59. void SecondaryAttack() OVERRIDE;
  60. bool CanPerformSecondaryAttack() const OVERRIDE;
  61. void WeaponReset() OVERRIDE;
  62. #ifdef GAME_DLL
  63. void ApplyOnHitAttributes( CBaseEntity *pVictimBaseEntity, CTFPlayer *pAttacker, const CTakeDamageInfo &info ) OVERRIDE;
  64. #endif
  65. protected:
  66. CNetworkVar( float, m_flMinicritCharge );
  67. float m_flMinicritStartTime;
  68. private:
  69. CTFChargedSMG( const CTFChargedSMG & ) {}
  70. };
  71. #endif // TF_WEAPON_SMG_H