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.

106 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // TF Particle Cannon
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_PARTICLE_CANNON_H
  7. #define TF_WEAPON_PARTICLE_CANNON_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_gun.h"
  12. #include "tf_weaponbase_rocket.h"
  13. #include "tf_weapon_sniperrifle.h"
  14. #include "tf_weapon_rocketlauncher.h"
  15. #ifdef CLIENT_DLL
  16. #include "particle_property.h"
  17. #endif
  18. // Client specific.
  19. #ifdef CLIENT_DLL
  20. #define CTFParticleCannon C_TFParticleCannon
  21. #endif
  22. #define TF_PARTICLE_MAX_CHARGE_TIME 2.f
  23. class CTFParticleCannon : public CTFRocketLauncher
  24. {
  25. public:
  26. DECLARE_CLASS( CTFParticleCannon, CTFRocketLauncher );
  27. DECLARE_NETWORKCLASS();
  28. DECLARE_PREDICTABLE();
  29. CTFParticleCannon();
  30. // Server specific.
  31. #ifdef GAME_DLL
  32. DECLARE_DATADESC();
  33. virtual void Precache();
  34. #endif
  35. virtual int GetWeaponID( void ) const { return TF_WEAPON_PARTICLE_CANNON; }
  36. virtual float GetProjectileSpeed( void );
  37. virtual float GetProjectileGravity( void );
  38. virtual bool IsViewModelFlipped( void );
  39. const char* GetEffectLabelText( void ) { return "#TF_MANGLER"; }
  40. float GetProgress( void );
  41. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
  42. virtual bool Deploy( void );
  43. virtual void WeaponReset( void );
  44. virtual void ItemPostFrame( void );
  45. virtual void PrimaryAttack( void );
  46. virtual void SecondaryAttack( void );
  47. virtual void FireChargedShot();
  48. virtual void ModifyProjectile( CBaseEntity* pProj );
  49. virtual void PlayWeaponShootSound( void );
  50. virtual const char *GetMuzzleFlashParticleEffect( void );
  51. virtual bool IsEnergyWeapon( void ) const { return true; }
  52. virtual bool ShouldPlayFireAnim( void ) { return !m_bChargedShot; }
  53. #ifdef CLIENT_DLL
  54. virtual void OnDataChanged( DataUpdateType_t updateType );
  55. void StartEffects( void );
  56. void ClientEffectsThink( void );
  57. void CreateChargeEffect( void );
  58. virtual void DispatchMuzzleFlash( const char* effectName, C_BaseEntity* pAttachEnt );
  59. virtual bool ShouldPlayClientReloadSound() { return true; }
  60. virtual void CreateMuzzleFlashEffects( C_BaseEntity *pAttachEnt, int nIndex );
  61. #endif
  62. virtual char const* GetShootSound( int iIndex ) const;
  63. // Charged shot support.
  64. virtual float GetChargeBeginTime( void ) { return m_flChargeBeginTime; }
  65. virtual float GetChargeMaxTime( void ) { return TF_PARTICLE_MAX_CHARGE_TIME; }
  66. virtual float GetChargeForceReleaseTime( void ) { return GetChargeMaxTime(); }
  67. virtual float Energy_GetShotCost( void ) const { return 5.f; }
  68. virtual float Energy_GetRechargeCost( void ) const { return 5.f; }
  69. bool CanChargeFire( void ) { if (Energy_FullyCharged() && (m_flChargeBeginTime<=0)) return true; else return false; }
  70. virtual bool OwnerCanTaunt( void );
  71. private:
  72. CNetworkVar( float, m_flChargeBeginTime );
  73. CNetworkVar( int, m_iChargeEffect );
  74. bool m_bChargedShot;
  75. #ifdef CLIENT_DLL
  76. bool m_bEffectsThinking;
  77. int m_iChargeEffectBase;
  78. #endif
  79. };
  80. #endif // TF_WEAPON_PARTICLE_CANNON_H