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.

97 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "basehlcombatweapon_shared.h"
  7. #ifndef BASEHLCOMBATWEAPON_H
  8. #define BASEHLCOMBATWEAPON_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //=========================================================
  13. // Machine gun base class
  14. //=========================================================
  15. abstract_class CHLMachineGun : public CBaseHLCombatWeapon
  16. {
  17. public:
  18. DECLARE_CLASS( CHLMachineGun, CBaseHLCombatWeapon );
  19. DECLARE_DATADESC();
  20. CHLMachineGun();
  21. DECLARE_SERVERCLASS();
  22. void PrimaryAttack( void );
  23. // Default calls through to m_hOwner, but plasma weapons can override and shoot projectiles here.
  24. virtual void ItemPostFrame( void );
  25. virtual void FireBullets( const FireBulletsInfo_t &info );
  26. virtual float GetFireRate( void ) = 0;
  27. virtual int WeaponRangeAttack1Condition( float flDot, float flDist );
  28. virtual bool Deploy( void );
  29. virtual const Vector &GetBulletSpread( void );
  30. int WeaponSoundRealtime( WeaponSound_t shoot_type );
  31. // utility function
  32. static void DoMachineGunKick( CBasePlayer *pPlayer, float dampEasy, float maxVerticleKickAngle, float fireDurationTime, float slideLimitTime );
  33. protected:
  34. int m_nShotsFired; // Number of consecutive shots fired
  35. float m_flNextSoundTime; // real-time clock of when to make next sound
  36. };
  37. //=========================================================
  38. // Machine guns capable of switching between full auto and
  39. // burst fire modes.
  40. //=========================================================
  41. // Mode settings for select fire weapons
  42. enum
  43. {
  44. FIREMODE_FULLAUTO = 1,
  45. FIREMODE_SEMI,
  46. FIREMODE_3RNDBURST,
  47. };
  48. //=========================================================
  49. // >> CHLSelectFireMachineGun
  50. //=========================================================
  51. class CHLSelectFireMachineGun : public CHLMachineGun
  52. {
  53. DECLARE_CLASS( CHLSelectFireMachineGun, CHLMachineGun );
  54. public:
  55. CHLSelectFireMachineGun( void );
  56. DECLARE_SERVERCLASS();
  57. virtual float GetBurstCycleRate( void );
  58. virtual float GetFireRate( void );
  59. virtual bool Deploy( void );
  60. virtual void WeaponSound( WeaponSound_t shoot_type, float soundtime = 0.0f );
  61. DECLARE_DATADESC();
  62. virtual int GetBurstSize( void ) { return 3; };
  63. void BurstThink( void );
  64. virtual void PrimaryAttack( void );
  65. virtual void SecondaryAttack( void );
  66. virtual int WeaponRangeAttack1Condition( float flDot, float flDist );
  67. virtual int WeaponRangeAttack2Condition( float flDot, float flDist );
  68. protected:
  69. int m_iBurstSize;
  70. int m_iFireMode;
  71. };
  72. #endif // BASEHLCOMBATWEAPON_H