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.

117 lines
3.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_COMPOUND_BOW_H
  7. #define TF_WEAPON_COMPOUND_BOW_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_gun.h"
  12. #include "tf_weapon_pipebomblauncher.h"
  13. // Client specific.
  14. #ifdef CLIENT_DLL
  15. #define CTFCompoundBow C_TFCompoundBow
  16. #else
  17. class CTFProjectile_Arrow;
  18. #endif
  19. //=============================================================================
  20. //
  21. // TF Weapon Bow
  22. //
  23. class CTFCompoundBow : public CTFPipebombLauncher
  24. {
  25. public:
  26. DECLARE_CLASS( CTFCompoundBow, CTFPipebombLauncher );
  27. DECLARE_NETWORKCLASS();
  28. DECLARE_PREDICTABLE();
  29. // Server specific.
  30. #ifdef GAME_DLL
  31. DECLARE_DATADESC();
  32. #endif
  33. CTFCompoundBow();
  34. ~CTFCompoundBow() {}
  35. virtual void Precache( void );
  36. virtual void WeaponReset( void );
  37. virtual int GetWeaponID( void ) const { return TF_WEAPON_COMPOUND_BOW; }
  38. virtual void PrimaryAttack();
  39. virtual void LaunchGrenade( void );
  40. virtual bool CalcIsAttackCriticalHelper();
  41. virtual float GetChargeMaxTime( void );
  42. virtual float GetCurrentCharge( void );
  43. virtual float GetProjectileDamage( void );
  44. virtual float GetProjectileSpeed( void );
  45. virtual float GetProjectileGravity( void );
  46. virtual void AddPipeBomb( CTFGrenadePipebombProjectile *pBomb );
  47. virtual bool DetonateRemotePipebombs( bool bFizzle );
  48. virtual void SecondaryAttack( void );
  49. virtual void LowerBow( void );
  50. virtual bool Reload( void );
  51. virtual bool OwnerCanJump( void );
  52. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  53. virtual bool SendWeaponAnim( int iActivity );
  54. virtual void ItemPostFrame( void );
  55. virtual float GetChargeForceReleaseTime( void ) { return 5.0f; }
  56. virtual void ForceLaunchGrenade( void );
  57. virtual bool ShouldDoMuzzleFlash( void ) { return false; }
  58. virtual void GetProjectileFireSetup( CTFPlayer *pPlayer, Vector vecOffset, Vector *vecSrc, QAngle *angForward, bool bHitTeammates = true, float flEndDist = 2000.f );
  59. void ApplyRefireSpeedModifications( float &flBaseRef );
  60. // The bow doesn't actually reload, it instead uses the AE_WPN_INCREMENTAMMO anim event in the fire to reload the clip.
  61. virtual bool CanReload( void ){ return false; }
  62. virtual bool CanPickupOtherWeapon() const { return m_flChargeBeginTime == 0.f; }
  63. #ifdef CLIENT_DLL
  64. virtual void OnDataChanged( DataUpdateType_t type );
  65. virtual void UpdateOnRemove( void );
  66. #endif
  67. void SetArrowAlight( bool bAlight );
  68. private:
  69. #ifdef CLIENT_DLL
  70. virtual void StartBurningEffect( void );
  71. virtual void StopBurningEffect( void );
  72. #else
  73. #ifdef STAGING_ONLY
  74. void CreateExtraArrow( CTFProjectile_Arrow* pMainArrow, const QAngle& qSpreadAngles, float flSpeed );
  75. float GetRandomSpreadOffset( int iArrowMasteryLevel );
  76. #endif // STAGING_ONLY
  77. #endif
  78. private:
  79. float m_flLastDenySoundTime;
  80. CNetworkVar( bool, m_bNoFire );
  81. CNetworkVar( bool, m_bArrowAlight );
  82. #ifdef CLIENT_DLL
  83. EHANDLE m_hParticleEffectOwner;
  84. HPARTICLEFFECT m_pBurningArrowEffect;
  85. #endif
  86. CTFCompoundBow( const CTFCompoundBow & ) {}
  87. };
  88. #endif // TF_WEAPON_COMPOUND_BOW_H