Counter Strike : Global Offensive Source Code
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.

108 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_CSBASE_GUN_H
  7. #define WEAPON_CSBASE_GUN_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_csbase.h"
  12. // This is the base class for pistols and rifles.
  13. #if defined( CLIENT_DLL )
  14. #define CWeaponCSBaseGun C_WeaponCSBaseGun
  15. #else
  16. #endif
  17. class CWeaponCSBaseGun : public CWeaponCSBase
  18. {
  19. public:
  20. DECLARE_CLASS( CWeaponCSBaseGun, CWeaponCSBase );
  21. DECLARE_NETWORKCLASS();
  22. DECLARE_PREDICTABLE();
  23. CWeaponCSBaseGun();
  24. virtual void Spawn();
  25. virtual void Precache();
  26. virtual void PrimaryAttack();
  27. virtual void SecondaryAttack();
  28. virtual bool Reload();
  29. virtual void WeaponIdle();
  30. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  31. virtual void Drop( const Vector &vecVelocity );
  32. virtual bool Deploy();
  33. // Derived classes call this to fire a bullet.
  34. bool CSBaseGunFire( float flCycleTime, CSWeaponMode weaponMode );
  35. void BurstFireRemaining( void );
  36. // Usually plays the shot sound. Guns with silencers can play different sounds.
  37. virtual void DoFireEffects();
  38. virtual void ItemPostFrame();
  39. virtual void ItemBusyFrame( void );
  40. float GetFOVForAccuracy( void );
  41. void SetWeaponInfo( const CCSWeaponInfo* pWeaponInfo ) { m_pWeaponInfo = pWeaponInfo; }
  42. // Get CS-specific weapon data.
  43. virtual CCSWeaponInfo const &GetCSWpnData() const;
  44. virtual int GetCSZoomLevel() {return m_zoomLevel; }
  45. CNetworkVar( int, m_zoomLevel );
  46. virtual bool HasZoom( void );
  47. virtual bool IsZoomed( void ) const;
  48. virtual bool WeaponHasBurst( void ) const { return GetCSWpnData().HasBurstMode( GetEconItemView() ); }
  49. virtual bool IsInBurstMode() const;
  50. virtual bool IsFullAuto() const;
  51. virtual bool IsRevolver( void ) const { return GetCSWpnData().IsRevolver( GetEconItemView() ); }
  52. virtual bool DoesUnzoomAfterShot( void ) const { return GetCSWpnData().DoesUnzoomAfterShot( GetEconItemView() ); }
  53. virtual bool SendWeaponAnim( int iActivity );
  54. CNetworkVar( int, m_iBurstShotsRemaining );
  55. float m_fNextBurstShot; // time to shoot the next bullet in burst fire mode
  56. virtual Activity GetDeployActivity( void );
  57. #ifdef CLIENT_DLL
  58. virtual const char *GetMuzzleFlashEffectName_1stPerson( void );
  59. virtual const char *GetMuzzleFlashEffectName_3rdPerson( void );
  60. int m_iSilencerBodygroup;
  61. #endif
  62. virtual const char *GetWorldModel( void ) const;
  63. private:
  64. const CCSWeaponInfo* m_pWeaponInfo;
  65. CWeaponCSBaseGun( const CWeaponCSBaseGun & );
  66. int m_silencedModelIndex;
  67. bool m_inPrecache;
  68. };
  69. #endif // WEAPON_CSBASE_GUN_H