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.

163 lines
4.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef DOD_CONTROL_POINT_H
  7. #define DOD_CONTROL_POINT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "dod_player.h"
  12. #define CAP_ICON_ALLIES_FLAG 1
  13. #define CAP_ICON_BRIT_FLAG 27 //from dod_objectives.cpp
  14. #define CAP_POINT_HIDEFLAG (1<<0)
  15. #define CAP_POINT_HIDE_MODEL (1<<1)
  16. #define CAP_POINT_TICK_FOR_BOMBS_REMAINING (1<<2)
  17. #define PLAYER_POINTS_FOR_CAP 1
  18. #define PLAYER_POINTS_FOR_BLOCK 1
  19. #define PLAYER_POINTS_FOR_BOMB_PLANT 1
  20. #define PLAYER_POINTS_FOR_BOMB_EXPLODED 3
  21. class CControlPoint : public CBaseAnimating
  22. {
  23. public:
  24. DECLARE_CLASS( CControlPoint, CBaseAnimating );
  25. DECLARE_DATADESC();
  26. CControlPoint();
  27. virtual void Spawn( void );
  28. virtual bool KeyValue( const char *szKeyName, const char *szValue );
  29. virtual void Precache( void );
  30. void Reset( void );
  31. //Inputs
  32. inline void Enable( inputdata_t &input ) { SetActive( false ); }
  33. inline void Disable( inputdata_t &input ) { SetActive( true ); }
  34. void InputReset( inputdata_t &input );
  35. void InputSetOwner( inputdata_t &input );
  36. void InputShowModel( inputdata_t &input );
  37. void InputHideModel( inputdata_t &input );
  38. int PointValue( void );
  39. void RoundRespawn( void ); //Mugsy - resetting
  40. void TriggerTargets( void );
  41. void SetActive( bool active );
  42. bool PointIsVisible( void ) { return !( FBitSet( m_spawnflags, CAP_POINT_HIDEFLAG ) ); }
  43. void SendCapString( int team, int iNumCappers, int *pCappingPlayers );
  44. void SetOwner( int team, bool bMakeSound = true, int iNumCappers = 0, int *iCappingPlayers = NULL );
  45. int GetOwner( void ) const;
  46. int GetDefaultOwner( void ) const;
  47. inline const char *GetName( void ) { return STRING(m_iszPrintName); }
  48. int GetCPGroup( void );
  49. int GetPointIndex( void ) { return m_iPointIndex; } //the mapper set index
  50. void SetPointIndex( int index ) { m_iPointIndex = index; }
  51. int GetAlliesIcon( void ) { return m_iAlliesIcon; }
  52. int GetAxisIcon( void ) { return m_iAxisIcon; }
  53. int GetNeutralIcon( void ) { return m_iNeutralIcon; }
  54. int GetCurrentHudIconIndex( void );
  55. int GetHudIconIndexForTeam( int team );
  56. int GetTimerCapHudIcon( void );
  57. int GetBombedHudIcon( void );
  58. inline bool IsActive( void ) { return m_bActive; }
  59. void SetNumCappersRequired( int alliesRequired, int axisRequired );
  60. void CaptureBlocked( CDODPlayer *pPlayer );
  61. // Bomb interface
  62. void BombPlanted( float flTimerLength, CDODPlayer *pPlantingPlayer );
  63. void BombExploded( CDODPlayer *pPlantingPlayer = NULL, int iPlantingTeam = TEAM_UNASSIGNED );
  64. void BombDisarmed( CDODPlayer *pDisarmingPlayer );
  65. void CancelBombPlanted( void );
  66. int GetBombsRemaining( void ) { return m_iBombsRemaining; } // total bombs required
  67. int GetBombsRequired( void ) { return m_iBombsRequired; } // number of bombs remaining
  68. private:
  69. void InternalSetOwner( int team, bool bMakeSound = true, int iNumCappers = 0, int *iCappingPlayers = NULL );
  70. int m_iTeam; //0 - clear, 2 - allies, 3 - axis
  71. int m_iDefaultOwner; //team that initially owns the cap point
  72. int m_iIndex; //the index of this point in the controlpointArray
  73. string_t m_iszPrintName;
  74. string_t m_iszAlliesCapSound; //the sound to play on cap
  75. string_t m_iszAxisCapSound;
  76. string_t m_iszResetSound;
  77. string_t m_iszAlliesModel; //models to set the ent to on capture
  78. string_t m_iszAxisModel;
  79. string_t m_iszResetModel;
  80. int m_iAlliesModelBodygroup;//which bodygroup to use in the model
  81. int m_iAxisModelBodygroup;
  82. int m_iResetModelBodygroup;
  83. COutputEvent m_AlliesCapOutput; //outputs to fire when capped
  84. COutputEvent m_AxisCapOutput;
  85. COutputEvent m_PointResetOutput;
  86. COutputEvent m_OwnerChangedToAllies;
  87. COutputEvent m_OwnerChangedToAxis;
  88. int m_iAlliesIcon; //custom hud sprites for cap point
  89. int m_iAxisIcon;
  90. int m_iNeutralIcon;
  91. int m_iTimerCapIcon;
  92. int m_iBombedIcon;
  93. string_t m_iszAlliesIcon;
  94. string_t m_iszAxisIcon;
  95. string_t m_iszNeutralIcon;
  96. string_t m_iszTimerCapIcon;
  97. string_t m_iszBombedIcon;
  98. int m_bPointVisible; //should this capture point be visible on the hud?
  99. int m_iPointIndex; //the mapper set index value of this control point
  100. int m_iCPGroup; //the group that this control point belongs to
  101. bool m_bActive; //
  102. string_t m_iszName; //Name used in cap messages
  103. bool m_bStartDisabled;
  104. int m_iAlliesRequired; // if we're controlled by an area cap,
  105. int m_iAxisRequired; // these hold the number of cappers required. Used to calc point value
  106. int m_iTimedPointsAllies; // timed points value of this flag, per team
  107. int m_iTimedPointsAxis;
  108. bool m_bBombPlanted;
  109. float m_flBombExplodeTime;
  110. int m_iBombsRemaining;
  111. int m_iBombsRequired; // number of bombs required to flip this control point
  112. bool m_bSetOwnerIsBombPlant; // temp flag to indicate if the set owner we're doing is the result of a bomb
  113. private:
  114. CControlPoint( const CControlPoint & );
  115. };
  116. #endif //DOD_CONTROL_POINT_H