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.

90 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // TF Flare Projectile
  4. //
  5. //=============================================================================
  6. #ifndef TF_PROJECTILE_FLARE_H
  7. #define TF_PROJECTILE_FLARE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase_rocket.h"
  12. #include "iscorer.h"
  13. // Base force scaler
  14. #define TF_FLARE_PELLET_FORCE 20.0f
  15. // The farther the pellet flies, the more force it does up to a max of 4X at 1 second
  16. #define TF_FLARE_PELLET_FORCE_DISTANCE_SCALE 3.75f
  17. // We need this to get the player off the ground
  18. #define TF_FLARE_PELLET_FORCE_UPWARD 275
  19. // We need this to get the heavy off the ground
  20. #define TF_FLARE_PELLET_FORCE_UPWARD_HEAVY 525
  21. class CTFProjectile_Flare : public CTFBaseRocket, public IScorer
  22. {
  23. public:
  24. DECLARE_CLASS( CTFProjectile_Flare, CTFBaseRocket );
  25. DECLARE_NETWORKCLASS();
  26. DECLARE_DATADESC();
  27. CTFProjectile_Flare();
  28. ~CTFProjectile_Flare();
  29. // Creation.
  30. static CTFProjectile_Flare *Create( CBaseEntity *pLauncher, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner = NULL, CBaseEntity *pScorer = NULL );
  31. virtual void Spawn();
  32. virtual void Precache();
  33. virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAREGUN; }
  34. virtual void Explode( trace_t *pTrace, CBaseEntity *pOther );
  35. void Explode_Air( trace_t *pTrace, int bitsDamageType, bool bSelfOnly = false );
  36. void Detonate( bool bSelfOnly = false );
  37. virtual float GetRadius( void );
  38. void SendDeathNotice( void );
  39. float GetTimeAlive( void ) const { return gpGlobals->curtime - m_flCreationTime; }
  40. bool IsFromTaunt( void ) const { return m_bIsFromTaunt; }
  41. void ImpactThink( void );
  42. // Implement this if you use MOVETYPE_CUSTOM
  43. virtual void PerformCustomPhysics( Vector *pNewPosition, Vector *pNewVelocity, QAngle *pNewAngles, QAngle *pNewAngVelocity );
  44. // IScorer interface
  45. virtual CBasePlayer *GetScorer( void );
  46. virtual CBasePlayer *GetAssistant( void ) { return NULL; }
  47. void SetScorer( CBaseEntity *pScorer );
  48. void SetCritical( bool bCritical ) { m_bCritical = bCritical; }
  49. virtual int GetDamageType();
  50. virtual bool IsDeflectable() { return true; }
  51. virtual void Deflected( CBaseEntity *pDeflectedBy, Vector &vecDir );
  52. virtual bool IsDestroyable( void ) OVERRIDE { return false; }
  53. float GetProjectileSpeed( void ) const;
  54. float GetHeatSeekPower( void ) const;
  55. private:
  56. CBaseHandle m_Scorer;
  57. bool m_bIsFromTaunt;
  58. float m_flCreationTime;
  59. float m_flImpactTime;
  60. Vector m_vecImpactNormal;
  61. CNetworkVar( bool, m_bCritical );
  62. bool m_bImpact;
  63. float m_flNextSeekUpdate;
  64. };
  65. #endif //TF_PROJECTILE_FLARE_H