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.

165 lines
4.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_FLAREGUN_H
  7. #define TF_WEAPON_FLAREGUN_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_gun.h"
  12. #ifdef GAME_DLL
  13. #include "tf_projectile_flare.h"
  14. #endif
  15. // Client specific.
  16. #ifdef CLIENT_DLL
  17. #define CTFFlareGun C_TFFlareGun
  18. #define CTFFlareGun_Revenge C_TFFlareGun_Revenge
  19. #endif
  20. enum FlareGunTypes_t
  21. {
  22. FLAREGUN_NORMAL = 0,
  23. FLAREGUN_DETONATE,
  24. FLAREGUN_GRORDBORT,
  25. FLAREGUN_SCORCHSHOT
  26. };
  27. //=============================================================================
  28. //
  29. // TF Weapon Flare gun.
  30. //
  31. class CTFFlareGun : public CTFWeaponBaseGun
  32. {
  33. public:
  34. DECLARE_CLASS( CTFFlareGun, CTFWeaponBaseGun );
  35. DECLARE_NETWORKCLASS();
  36. DECLARE_PREDICTABLE();
  37. // Server specific.
  38. #ifdef GAME_DLL
  39. DECLARE_DATADESC();
  40. #endif
  41. CTFFlareGun();
  42. ~CTFFlareGun();
  43. virtual void Precache();
  44. virtual void DestroySounds( void );
  45. virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAREGUN; }
  46. virtual void PrimaryAttack();
  47. virtual void SecondaryAttack();
  48. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  49. virtual bool Deploy( void );
  50. virtual void ItemPostFrame( void );
  51. virtual void WeaponReset( void );
  52. int GetFlareGunType( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return iMode; }
  53. #ifdef GAME_DLL
  54. void AddFlare( CTFProjectile_Flare *pFlare );
  55. void DeathNotice( CBaseEntity *pVictim );
  56. void DetonateFlare( void );
  57. #endif
  58. virtual void StartCharge( void );
  59. virtual void StopCharge( void );
  60. virtual void ChargePostFrame( void ) {} // Derived weapons can figure out what to do with this
  61. virtual const char* GetChargeEffect( void ) const { return "drg_cowmangler_muzzleflash_chargeup"; }
  62. float GetChargeBeginTime( void ) const { return m_flChargeBeginTime; }
  63. protected:
  64. #ifdef GAME_DLL
  65. typedef CHandle<CTFProjectile_Flare> FlareHandle;
  66. CUtlVector <FlareHandle> m_Flares;
  67. int m_iFlareCount;
  68. #endif
  69. protected:
  70. void StartChargeStartTime() { m_flChargeBeginTime = gpGlobals->curtime; }
  71. #ifdef CLIENT_DLL
  72. virtual void DispatchMuzzleFlash( const char* effectName, C_BaseEntity* pAttachEnt );
  73. void ClientEffectsThink( void );
  74. void StartChargeEffects();
  75. void StopChargeEffects();
  76. virtual bool ShouldPlayClientReloadSound() { return true; }
  77. #endif
  78. private:
  79. CNetworkVar( float, m_flChargeBeginTime );
  80. bool m_bEffectsThinking;
  81. float m_flLastDenySoundTime;
  82. #if defined( CLIENT_DLL )
  83. CSoundPatch *m_pChargeLoop;
  84. bool m_bReadyToFire;
  85. #endif
  86. CTFFlareGun( const CTFFlareGun & ) {}
  87. };
  88. //---------------------------------------------------------
  89. class CTFFlareGun_Revenge : public CTFFlareGun
  90. {
  91. public:
  92. DECLARE_CLASS( CTFFlareGun_Revenge, CTFFlareGun );
  93. DECLARE_NETWORKCLASS();
  94. DECLARE_PREDICTABLE();
  95. CTFFlareGun_Revenge();
  96. virtual void Precache();
  97. virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAREGUN_REVENGE; }
  98. virtual bool IsEnergyWeapon( void ) const { return true; }
  99. virtual int GetCustomDamageType() const;
  100. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
  101. virtual bool Deploy( void );
  102. #ifdef GAME_DLL
  103. virtual void Detach();
  104. #endif
  105. int GetCount( void );
  106. float GetProgress( void ) { return 0.0f; }
  107. const char* GetEffectLabelText( void ) { return "#TF_CRITS"; }
  108. const char* GetMuzzleFlashParticleEffect( void ) { return "drg_manmelter_muzzleflash"; }
  109. virtual void PrimaryAttack();
  110. virtual void SecondaryAttack( void );
  111. virtual void ChargePostFrame( void );
  112. virtual const char* GetChargeEffect( void ) const { return "drg_manmelter_vacuum"; }
  113. virtual const char* ReadyToFireSound( void ) const { return "Weapon_SniperRailgun.NonScoped"; }
  114. #ifdef CLIENT_DLL
  115. virtual void OnDataChanged( DataUpdateType_t type );
  116. void DoAbsorbEffect( void );
  117. #endif
  118. private:
  119. bool ExtinguishPlayerInternal( CTFPlayer *pTarget, CTFPlayer *pOwner );
  120. CNetworkVar( float, m_fLastExtinguishTime );
  121. #ifdef CLIENT_DLL
  122. int m_nOldRevengeCrits;
  123. #endif
  124. };
  125. #endif // TF_WEAPON_FLAREGUN_H