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.

86 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: CTF AmmoPack.
  4. //
  5. //=============================================================================//
  6. #ifndef TF_POWERUP_H
  7. #define TF_POWERUP_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "items.h"
  12. #define TF_POWERUP_LIFETIME 30.0f // normal powerup timeout
  13. enum powerupsize_t
  14. {
  15. POWERUP_SMALL,
  16. POWERUP_MEDIUM,
  17. POWERUP_FULL,
  18. POWERUP_SIZES,
  19. };
  20. extern float PackRatios[POWERUP_SIZES];
  21. //=============================================================================
  22. //
  23. // CTF Powerup class.
  24. //
  25. class CTFPowerup : public CItem
  26. {
  27. public:
  28. DECLARE_CLASS( CTFPowerup, CItem );
  29. CTFPowerup();
  30. void Spawn( void );
  31. CBaseEntity* Respawn( void );
  32. virtual void Precache();
  33. void Materialize( void );
  34. virtual bool ValidTouch( CBasePlayer *pPlayer );
  35. virtual bool MyTouch( CBasePlayer *pPlayer );
  36. void DropSingleInstance( Vector &vecLaunchVel, CBaseCombatCharacter *pThrower, float flThrowerTouchDelay, float flResetTime = 0.1f );
  37. bool IsDisabled( void );
  38. void SetDisabled( bool bDisabled );
  39. virtual float GetRespawnDelay( void ) { return g_pGameRules->FlItemRespawnTime( this ); }
  40. // Input handlers
  41. void InputEnable( inputdata_t &inputdata );
  42. void InputDisable( inputdata_t &inputdata );
  43. void InputToggle( inputdata_t &inputdata );
  44. virtual powerupsize_t GetPowerupSize( void ) { return POWERUP_FULL; }
  45. virtual const char *GetPowerupModel( void );
  46. virtual const char *GetDefaultPowerupModel( void ) = 0;
  47. virtual bool ItemCanBeTouchedByPlayer( CBasePlayer *pPlayer );
  48. virtual float GetLifeTime() { return TF_POWERUP_LIFETIME; }
  49. protected:
  50. void Materialize_Internal( void );
  51. bool m_bDisabled;
  52. bool m_bRespawning;
  53. bool m_bThrownSingleInstance;
  54. bool m_bAutoMaterialize;
  55. string_t m_iszModel;
  56. float m_flThrowerTouchTime;
  57. DECLARE_DATADESC();
  58. };
  59. #endif // TF_POWERUP_H