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.

83 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_DODBASE_GUN_H
  7. #define WEAPON_DODBASE_GUN_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_dodbase.h"
  12. // This is the base class for pistols and rifles.
  13. #if defined( CLIENT_DLL )
  14. //#include "particles_simple.h"
  15. //#include "particles_localspace.h"
  16. #include "fx.h"
  17. #include "fx_dod_muzzleflash.h"
  18. #define CWeaponDODBaseGun C_WeaponDODBaseGun
  19. #else
  20. #endif
  21. class CWeaponDODBaseGun : public CWeaponDODBase
  22. {
  23. public:
  24. DECLARE_CLASS( CWeaponDODBaseGun, CWeaponDODBase );
  25. DECLARE_NETWORKCLASS();
  26. DECLARE_PREDICTABLE();
  27. CWeaponDODBaseGun();
  28. virtual void Spawn();
  29. virtual void Precache();
  30. virtual void PrimaryAttack();
  31. virtual bool Reload();
  32. // Derived classes must call this from inside their Spawn() function instead of
  33. // just chaining the Spawn() call down.
  34. void DODBaseGunSpawn( void );
  35. // Derived classes call this to fire a bullet.
  36. bool DODBaseGunFire( void );
  37. // Usually plays the shot sound. Guns with silencers can play different sounds.
  38. virtual void DoFireEffects();
  39. virtual float GetFireDelay( void );
  40. virtual float GetWeaponAccuracy( float flPlayerSpeed );
  41. //Pure animation calls - inheriting classes can override with specific
  42. //logic, eg if the idle changes depending on the gun being empty or not
  43. virtual Activity GetPrimaryAttackActivity( void );
  44. virtual Activity GetReloadActivity( void );
  45. virtual Activity GetDrawActivity( void );
  46. virtual bool CanDrop( void ) { return m_pWeaponInfo->m_bCanDrop; }
  47. void SetZoomed( bool bZoomed ) { m_bZoomed = bZoomed; }
  48. bool IsSniperZoomed( void ) { return m_bZoomed; }
  49. CNetworkVar( bool, m_bZoomed );
  50. protected:
  51. CDODWeaponInfo *m_pWeaponInfo;
  52. private:
  53. CWeaponDODBaseGun( const CWeaponDODBaseGun & );
  54. #ifndef CLIENT_DLL
  55. DECLARE_DATADESC();
  56. #endif
  57. };
  58. #endif // WEAPON_DODBASE_GUN_H