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.

197 lines
5.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_SHOTGUN_H
  7. #define TF_WEAPON_SHOTGUN_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_gun.h"
  12. #if defined( CLIENT_DLL )
  13. #define CTFShotgun C_TFShotgun
  14. #define CTFShotgun_Soldier C_TFShotgun_Soldier
  15. #define CTFShotgun_HWG C_TFShotgun_HWG
  16. #define CTFShotgun_Pyro C_TFShotgun_Pyro
  17. #define CTFScatterGun C_TFScatterGun
  18. #define CTFShotgun_Revenge C_TFShotgun_Revenge
  19. #define CTFSodaPopper C_TFSodaPopper
  20. #define CTFPEPBrawlerBlaster C_TFPEPBrawlerBlaster
  21. #define CTFShotgunBuildingRescue C_TFShotgunBuildingRescue
  22. #define CTFLeech C_TFLeech
  23. #endif
  24. // Reload Modes
  25. enum
  26. {
  27. TF_WEAPON_SHOTGUN_RELOAD_START = 0,
  28. TF_WEAPON_SHOTGUN_RELOAD_SHELL,
  29. TF_WEAPON_SHOTGUN_RELOAD_CONTINUE,
  30. TF_WEAPON_SHOTGUN_RELOAD_FINISH
  31. };
  32. //=============================================================================
  33. //
  34. // Shotgun class.
  35. //
  36. class CTFShotgun : public CTFWeaponBaseGun
  37. {
  38. public:
  39. DECLARE_CLASS( CTFShotgun, CTFWeaponBaseGun );
  40. DECLARE_NETWORKCLASS();
  41. DECLARE_PREDICTABLE();
  42. CTFShotgun();
  43. virtual int GetWeaponID( void ) const { return TF_WEAPON_SHOTGUN_PRIMARY; }
  44. virtual void PrimaryAttack();
  45. virtual void PlayWeaponShootSound( void );
  46. #ifdef GAME_DLL
  47. virtual CDmgAccumulator *GetDmgAccumulator( void ) { return &m_Accumulator; }
  48. #endif // GAME_DLL
  49. protected:
  50. void Fire( CTFPlayer *pPlayer );
  51. void UpdatePunchAngles( CTFPlayer *pPlayer );
  52. private:
  53. CTFShotgun( const CTFShotgun & ) {}
  54. #ifdef GAME_DLL
  55. CDmgAccumulator m_Accumulator;
  56. #endif // GAME_DLL
  57. };
  58. // Engineer's revenge shotgun.
  59. class CTFShotgun_Revenge : public CTFShotgun
  60. {
  61. public:
  62. DECLARE_CLASS( CTFShotgun_Revenge, CTFShotgun );
  63. DECLARE_NETWORKCLASS();
  64. DECLARE_PREDICTABLE();
  65. CTFShotgun_Revenge();
  66. virtual int GetWeaponID( void ) const { return TF_WEAPON_SENTRY_REVENGE; }
  67. void Precache();
  68. virtual void PrimaryAttack();
  69. virtual void SentryKilled( int iKills );
  70. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
  71. virtual bool Deploy( void );
  72. virtual int GetCustomDamageType() const;
  73. int GetCount( void );
  74. float GetProgress( void ) { return 0.f; }
  75. const char* GetEffectLabelText( void ) { return "#TF_REVENGE"; }
  76. #ifdef CLIENT_DLL
  77. virtual void SetWeaponVisible( bool visible );
  78. virtual int GetWorldModelIndex( void );
  79. #else
  80. virtual void Detach();
  81. #endif
  82. };
  83. // Scout version. Different models, possibly different behaviour later on
  84. class CTFScatterGun : public CTFShotgun
  85. {
  86. public:
  87. DECLARE_CLASS( CTFScatterGun, CTFShotgun );
  88. DECLARE_NETWORKCLASS();
  89. DECLARE_PREDICTABLE();
  90. virtual int GetWeaponID( void ) const { return TF_WEAPON_SCATTERGUN; }
  91. virtual bool Reload( void );
  92. virtual void FireBullet( CTFPlayer *pPlayer );
  93. virtual void ApplyPostHitEffects( const CTakeDamageInfo &inputInfo, CTFPlayer *pPlayer );
  94. virtual void FinishReload( void );
  95. virtual bool HasKnockback( void );
  96. virtual bool SendWeaponAnim( int iActivity );
  97. #ifdef GAME_DLL
  98. virtual void Equip( CBaseCombatCharacter *pOwner );
  99. #endif // GAME_DLL
  100. };
  101. class CTFShotgun_Soldier : public CTFShotgun
  102. {
  103. public:
  104. DECLARE_CLASS( CTFShotgun_Soldier, CTFShotgun );
  105. DECLARE_NETWORKCLASS();
  106. DECLARE_PREDICTABLE();
  107. virtual int GetWeaponID( void ) const { return TF_WEAPON_SHOTGUN_SOLDIER; }
  108. };
  109. // Secondary version. Different weapon slot, different ammo
  110. class CTFShotgun_HWG : public CTFShotgun
  111. {
  112. public:
  113. DECLARE_CLASS( CTFShotgun_HWG, CTFShotgun );
  114. DECLARE_NETWORKCLASS();
  115. DECLARE_PREDICTABLE();
  116. virtual int GetWeaponID( void ) const { return TF_WEAPON_SHOTGUN_HWG; }
  117. };
  118. class CTFShotgun_Pyro : public CTFShotgun
  119. {
  120. public:
  121. DECLARE_CLASS( CTFShotgun_Pyro, CTFShotgun );
  122. DECLARE_NETWORKCLASS();
  123. DECLARE_PREDICTABLE();
  124. virtual int GetWeaponID( void ) const { return TF_WEAPON_SHOTGUN_PYRO; }
  125. };
  126. class CTFSodaPopper : public CTFScatterGun
  127. {
  128. public:
  129. DECLARE_CLASS( CTFSodaPopper, CTFScatterGun );
  130. DECLARE_NETWORKCLASS();
  131. DECLARE_PREDICTABLE();
  132. virtual int GetWeaponID( void ) const { return TF_WEAPON_SODA_POPPER; }
  133. virtual void ItemBusyFrame( void );
  134. virtual void SecondaryAttack( void );
  135. const char* GetEffectLabelText( void ) { return "#TF_HYPE"; }
  136. float GetProgress( void );
  137. };
  138. class CTFPEPBrawlerBlaster : public CTFScatterGun
  139. {
  140. public:
  141. DECLARE_CLASS( CTFPEPBrawlerBlaster, CTFScatterGun );
  142. DECLARE_NETWORKCLASS();
  143. DECLARE_PREDICTABLE();
  144. virtual int GetWeaponID( void ) const { return TF_WEAPON_PEP_BRAWLER_BLASTER; }
  145. const char* GetEffectLabelText( void ) { return "#TF_Boost"; }
  146. float GetProgress( void );
  147. };
  148. class CTFShotgunBuildingRescue : public CTFShotgun
  149. {
  150. public:
  151. DECLARE_CLASS( CTFShotgunBuildingRescue, CTFShotgun );
  152. DECLARE_NETWORKCLASS();
  153. DECLARE_PREDICTABLE();
  154. virtual int GetWeaponID( void ) const { return TF_WEAPON_SHOTGUN_BUILDING_RESCUE; }
  155. virtual float GetProjectileSpeed( void );
  156. virtual float GetProjectileGravity( void );
  157. virtual bool IsViewModelFlipped( void );
  158. };
  159. #endif // TF_WEAPON_SHOTGUN_H