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.

103 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //
  4. //=============================================================================
  5. #ifndef TF_WEAPON_PISTOL_H
  6. #define TF_WEAPON_PISTOL_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "tf_weaponbase_gun.h"
  11. #include "tf_weapon_shotgun.h"
  12. // Client specific.
  13. #ifdef CLIENT_DLL
  14. #define CTFPistol C_TFPistol
  15. #define CTFPistol_Scout C_TFPistol_Scout
  16. #define CTFPistol_ScoutPrimary C_TFPistol_ScoutPrimary
  17. #define CTFPistol_ScoutSecondary C_TFPistol_ScoutSecondary
  18. #endif
  19. // We allow the pistol to fire as fast as the player can click.
  20. // This is the minimum time between shots.
  21. #define PISTOL_FASTEST_REFIRE_TIME 0.1f
  22. // The faster the player fires, the more inaccurate he becomes
  23. #define PISTOL_ACCURACY_SHOT_PENALTY_TIME 0.2f // Applied amount of time each shot adds to the time we must recover from
  24. #define PISTOL_ACCURACY_MAXIMUM_PENALTY_TIME 1.5f // Maximum time penalty we'll allow
  25. //=============================================================================
  26. //
  27. // TF Weapon Pistol.
  28. //
  29. class CTFPistol : public CTFWeaponBaseGun
  30. {
  31. public:
  32. DECLARE_CLASS( CTFPistol, CTFWeaponBaseGun );
  33. DECLARE_NETWORKCLASS();
  34. DECLARE_PREDICTABLE();
  35. // Server specific.
  36. #ifdef GAME_DLL
  37. DECLARE_DATADESC();
  38. #endif
  39. CTFPistol() {}
  40. ~CTFPistol() {}
  41. virtual int GetWeaponID( void ) const { return TF_WEAPON_PISTOL; }
  42. private:
  43. CTFPistol( const CTFPistol & ) {}
  44. };
  45. // Scout specific version
  46. class CTFPistol_Scout : public CTFPistol
  47. {
  48. public:
  49. DECLARE_CLASS( CTFPistol_Scout, CTFPistol );
  50. DECLARE_NETWORKCLASS();
  51. DECLARE_PREDICTABLE();
  52. virtual int GetWeaponID( void ) const { return TF_WEAPON_PISTOL_SCOUT; }
  53. };
  54. class CTFPistol_ScoutPrimary : public CTFPistol_Scout
  55. {
  56. public:
  57. DECLARE_CLASS( CTFPistol_ScoutPrimary, CTFPistol_Scout );
  58. DECLARE_NETWORKCLASS();
  59. DECLARE_PREDICTABLE();
  60. CTFPistol_ScoutPrimary();
  61. virtual int GetViewModelWeaponRole() { return TF_WPN_TYPE_SECONDARY; }
  62. virtual int GetWeaponID( void ) const { return TF_WEAPON_HANDGUN_SCOUT_PRIMARY; }
  63. virtual void PlayWeaponShootSound( void );
  64. virtual void SecondaryAttack( void );
  65. virtual void ItemPostFrame();
  66. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  67. virtual void Precache( void );
  68. void Push( void );
  69. private:
  70. float m_flPushTime;
  71. };
  72. class CTFPistol_ScoutSecondary : public CTFPistol_Scout
  73. {
  74. public:
  75. DECLARE_CLASS( CTFPistol_ScoutSecondary, CTFPistol_Scout );
  76. DECLARE_NETWORKCLASS();
  77. DECLARE_PREDICTABLE();
  78. virtual int GetViewModelWeaponRole() { return TF_WPN_TYPE_SECONDARY; }
  79. virtual int GetWeaponID( void ) const { return TF_WEAPON_HANDGUN_SCOUT_SECONDARY; }
  80. virtual int GetDamageType( void ) const;
  81. };
  82. #endif // TF_WEAPON_PISTOL_H