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.

98 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Engineer's Laser Pointer
  4. //
  5. //=============================================================================//
  6. #ifndef TF_WEAPON_LASER_POINTER_H
  7. #define TF_WEAPON_LASER_POINTER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_gun.h"
  12. #include "tf_weapon_sniperrifle.h"
  13. #include "Sprite.h"
  14. #if defined( CLIENT_DLL )
  15. #define CTFLaserPointer C_TFLaserPointer
  16. #define CLaserDot C_LaserDot
  17. #endif
  18. //=============================================================================
  19. //
  20. // Laser Dot
  21. //
  22. class CLaserDot : public CSniperDot
  23. {
  24. public:
  25. DECLARE_CLASS( CLaserDot, CSniperDot );
  26. DECLARE_NETWORKCLASS();
  27. DECLARE_DATADESC();
  28. // Creation/Destruction.
  29. CLaserDot( void );
  30. ~CLaserDot( void );
  31. static CLaserDot *Create( const Vector &origin, CBaseEntity *pOwner = NULL, bool bVisibleDot = true );
  32. #ifdef CLIENT_DLL
  33. virtual int DrawModel( int flags );
  34. virtual bool ShouldDraw( void ) { return false; }
  35. #endif
  36. };
  37. //=============================================================================
  38. //
  39. // Laser Pointer
  40. //
  41. class CTFLaserPointer : public CTFWeaponBaseGun
  42. {
  43. public:
  44. DECLARE_CLASS( CTFLaserPointer, CTFWeaponBaseGun );
  45. DECLARE_NETWORKCLASS();
  46. DECLARE_PREDICTABLE();
  47. CTFLaserPointer();
  48. ~CTFLaserPointer();
  49. virtual int GetWeaponID( void ) const { return TF_WEAPON_LASER_POINTER; }
  50. virtual void Precache();
  51. virtual bool Deploy( void );
  52. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  53. virtual void ItemPostFrame( void );
  54. virtual void PrimaryAttack( void );
  55. virtual void SecondaryAttack( void );
  56. virtual void WeaponIdle( void );
  57. virtual bool UsesClipsForAmmo1( void ) const { return false; }
  58. virtual bool UsesClipsForAmmo2( void ) const { return false; }
  59. #ifdef GAME_DLL
  60. CLaserDot* GetLaserDot() { return m_hLaserDot.Get(); }
  61. bool HasLaserDot() { return GetLaserDot()?true:false; }
  62. #endif
  63. private:
  64. void CreateLaserDot( void );
  65. void DestroyLaserDot( void );
  66. void UpdateLaserDot( void );
  67. private:
  68. #ifdef GAME_DLL
  69. CHandle<CLaserDot> m_hLaserDot;
  70. #endif
  71. float m_flNextAttack;
  72. float m_flStartedFiring;
  73. bool m_bDoHandIdle;
  74. bool m_bDeployed;
  75. CTFLaserPointer( const CTFLaserPointer & );
  76. };
  77. #endif // TF_WEAPON_LASER_POINTER_H