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.

103 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef DOD_AREA_CAPTURE_H
  7. #define DOD_AREA_CAPTURE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "triggers.h"
  12. #include "dod_control_point.h"
  13. #define AREA_ATTEND_TIME 0.7f
  14. #define AREA_THINK_TIME 0.1f
  15. #define CAPTURE_NORMAL 0
  16. #define CAPTURE_CATCHUP_ALIVEPLAYERS 1
  17. #define MAX_CLIENT_AREAS 128
  18. class CAreaCapture : public CBaseTrigger
  19. {
  20. public:
  21. DECLARE_CLASS( CAreaCapture, CBaseTrigger );
  22. virtual void Spawn( void );
  23. virtual void Precache( void );
  24. virtual bool KeyValue( const char *szKeyName, const char *szValue );
  25. void area_SetIndex( int index );
  26. bool IsActive( void );
  27. bool CheckIfDeathCausesBlock( CDODPlayer *pVictim, CDODPlayer *pKiller );
  28. private:
  29. void EXPORT AreaTouch( CBaseEntity *pOther );
  30. void Think( void );
  31. void StartCapture( int team, int capmode );
  32. void EndCapture( int team );
  33. void BreakCapture( bool bNotEnoughPlayers );
  34. void SwitchCapture( int team );
  35. void SendNumPlayers( CBasePlayer *pPlayer = NULL );
  36. void SetOwner( int team ); //sets the owner of this point - useful for resetting all to -1
  37. void InputEnable( inputdata_t &inputdata );
  38. void InputDisable( inputdata_t &inputdata );
  39. void InputRoundInit( inputdata_t &inputdata );
  40. private:
  41. int m_iCapMode; //which capture mode we're in
  42. int m_bCapturing;
  43. int m_nCapturingTeam; //the team that is capturing this point
  44. int m_nOwningTeam; //the team that has captured this point
  45. float m_flCapTime; //the total time it takes to capture the area, in seconds
  46. float m_fTimeRemaining; //the time left in the capture
  47. int m_nAlliesNumCap; //number of allies required to cap
  48. int m_nAxisNumCap; //number of axis required to cap
  49. int m_nNumAllies;
  50. int m_nNumAxis;
  51. bool m_bAlliesCanCap;
  52. bool m_bAxisCanCap;
  53. //used for catchup capping
  54. int m_iCappingRequired; //how many players are currently capping
  55. int m_iCappingPlayers; //how many are required?
  56. bool m_bActive;
  57. COutputEvent m_AlliesStartOutput;
  58. COutputEvent m_AlliesBreakOutput;
  59. COutputEvent m_AlliesCapOutput;
  60. COutputEvent m_AxisStartOutput;
  61. COutputEvent m_AxisBreakOutput;
  62. COutputEvent m_AxisCapOutput;
  63. COutputEvent m_StartOutput;
  64. COutputEvent m_BreakOutput;
  65. COutputEvent m_CapOutput;
  66. int m_iAreaIndex; //index of this area among all other areas
  67. CControlPoint *m_pPoint; //the capture point that we are linked to!
  68. bool m_bRequiresObject;
  69. string_t m_iszCapPointName; //name of the cap point that we're linked to
  70. int m_iCapAttemptNumber; // number used to keep track of discrete cap attempts, for block tracking
  71. DECLARE_DATADESC();
  72. };
  73. #endif //DOD_AREA_CAPTURE_H