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.

110 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef WEAPON_DODSNIPER_H
  7. #define WEAPON_DODSNIPER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "cbase.h"
  12. #include "shake.h"
  13. #include "weapon_dodsemiauto.h"
  14. #include "dod_shareddefs.h"
  15. #if defined( CLIENT_DLL )
  16. #define CDODSniperWeapon C_DODSniperWeapon
  17. #endif
  18. #define DOD_SNIPER_ZOOM_CHANGE_TIME 0.3
  19. class CDODSniperWeapon : public CDODSemiAutoWeapon
  20. {
  21. public:
  22. DECLARE_CLASS( CDODSniperWeapon, CDODSemiAutoWeapon );
  23. DECLARE_NETWORKCLASS();
  24. DECLARE_PREDICTABLE();
  25. #ifndef CLIENT_DLL
  26. DECLARE_DATADESC();
  27. #endif
  28. CDODSniperWeapon();
  29. virtual void Spawn( void );
  30. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  31. virtual bool Reload( void );
  32. virtual void FinishReload( void );
  33. virtual void Drop( const Vector &vecVelocity );
  34. virtual void ItemPostFrame( void );
  35. virtual void PrimaryAttack( void );
  36. virtual void SecondaryAttack( void );
  37. void ResetTimers( void ); // reset all the flags, timers that would cause us to re-zoom or unzoom
  38. #ifdef CLIENT_DLL
  39. virtual Vector GetDesiredViewModelOffset( C_DODPlayer *pOwner );
  40. virtual float GetViewModelSwayScale( void );
  41. float GetZoomedPercentage( void );
  42. #endif
  43. // Is the weapon completely zoomed, finished the raising animation
  44. bool IsFullyZoomed( void );
  45. virtual bool ShouldDrawCrosshair( void );
  46. virtual bool HideViewModelWhenZoomed( void ) { return true; }
  47. virtual float GetWeaponAccuracy( float flPlayerSpeed );
  48. virtual float GetZoomedFOV( void ) { return 20; }
  49. bool IsZoomed( void );
  50. virtual bool ShouldZoomOutBetweenShots( void ) { return true; }
  51. virtual bool ShouldRezoomAfterReload( void ) { return false; }
  52. void ToggleZoom( void );
  53. void ZoomIn( void );
  54. void ZoomOut( void );
  55. void ZoomOutIn( void );
  56. void SetRezoom( bool bRezoom, float flDelay );
  57. bool IsZoomingIn( void );
  58. CNetworkVar( bool, m_bDoViewAnim );
  59. #ifdef CLIENT_DLL
  60. bool m_bDoViewAnimCache;
  61. float m_flViewAnimTimer;
  62. float m_flZoomPercent;
  63. #endif
  64. protected:
  65. bool m_bShouldRezoomAfterShot; // if the gun zooms out after a shot, does it zoom back in automatically?
  66. private:
  67. CDODSniperWeapon( const CDODSniperWeapon & );
  68. float m_flUnzoomTime;
  69. float m_flRezoomTime;
  70. float m_flZoomInTime;
  71. float m_flZoomOutTime;
  72. bool m_bRezoomAfterReload;
  73. float m_flZoomChangeTime;
  74. bool m_bRezoomAfterShot;
  75. };
  76. #endif // WEAPON_DODSNIPER_H