Counter Strike : Global Offensive Source Code
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.

127 lines
3.2 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TEAM_TRAIN_WATCHER_H
  7. #define TEAM_TRAIN_WATCHER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "cbase.h"
  12. #include "trigger_area_capture.h"
  13. class CFuncTrackTrain;
  14. class CPathTrack;
  15. class CTeamControlPoint;
  16. #define TF_TRAIN_ALERT_DISTANCE 750 // alert is the VO warning
  17. #define TF_TRAIN_ALARM_DISTANCE 200 // alarm is the looping sound played at the control point
  18. #define TF_TRAIN_ATTACK_ALERT "Announcer.Cart.AttackWarning"
  19. #define TF_TRAIN_DEFEND_ALERT "Announcer.Cart.DefendWarning"
  20. #define TF_TRAIN_ATTACK_FINAL_ALERT "Announcer.Cart.AttackFinalWarning"
  21. #define TF_TRAIN_DEFEND_FINAL_ALERT "Announcer.Cart.DefendFinalWarning"
  22. #define TF_TRAIN_ALARM "Cart.Warning"
  23. class CTeamTrainWatcher : public CBaseEntity
  24. {
  25. DECLARE_CLASS( CTeamTrainWatcher, CBaseEntity );
  26. public:
  27. DECLARE_SERVERCLASS();
  28. DECLARE_DATADESC();
  29. CTeamTrainWatcher();
  30. virtual int UpdateTransmitState();
  31. void InputRoundActivate( inputdata_t &inputdata );
  32. void InputEnable( inputdata_t &inputdata );
  33. void InputDisable( inputdata_t &inputdata );
  34. void InputSetNumTrainCappers( inputdata_t &inputdata );
  35. void InputOnStartOvertime( inputdata_t &inputdata );
  36. // ==========================================================
  37. // given a start node and a list of goal nodes
  38. // calculate the distance between each
  39. // ==========================================================
  40. void WatcherActivate( void );
  41. void WatcherThink( void );
  42. CBaseEntity *GetTrainEntity( void );
  43. bool IsDisabled( void ) { return m_bDisabled; }
  44. bool TimerMayExpire( void );
  45. void StopCaptureAlarm( void );
  46. private:
  47. void StartCaptureAlarm( CTeamControlPoint *pPoint );
  48. void PlayCaptureAlert( CTeamControlPoint *pPoint, bool bFinalPointInMap );
  49. private:
  50. bool m_bDisabled;
  51. // === Data ===
  52. // pointer to the train that we're checking
  53. CHandle<CFuncTrackTrain> m_hTrain;
  54. // start node
  55. CHandle<CPathTrack> m_hStartNode;
  56. // goal node
  57. CHandle<CPathTrack> m_hGoalNode;
  58. string_t m_iszTrain;
  59. string_t m_iszStartNode;
  60. string_t m_iszGoalNode;
  61. // list of node associations with control points
  62. typedef struct
  63. {
  64. CHandle<CPathTrack> hPathTrack;
  65. CHandle<CTeamControlPoint> hCP;
  66. float flDistanceFromStart;
  67. bool bAlertPlayed;
  68. } node_cp_pair_t;
  69. node_cp_pair_t m_CPLinks[MAX_CONTROL_POINTS];
  70. int m_iNumCPLinks;
  71. string_t m_iszLinkedPathTracks[MAX_CONTROL_POINTS];
  72. string_t m_iszLinkedCPs[MAX_CONTROL_POINTS];
  73. float m_flTotalPathDistance; // calculated only at round start, node graph
  74. // may get chopped as the round progresses
  75. float m_flSpeedLevels[3];
  76. // === Networked Data ===
  77. // current total progress, percentage
  78. CNetworkVar( float, m_flTotalProgress );
  79. CNetworkVar( int, m_iTrainSpeedLevel );
  80. CNetworkVar( int, m_nNumCappers );
  81. bool m_bWaitingToRecede;
  82. CNetworkVar( float, m_flRecedeTime );
  83. float m_flRecedeTotalTime;
  84. float m_flRecedeStartTime;
  85. COutputEvent m_OnTrainStartRecede;
  86. bool m_bCapBlocked;
  87. float m_flNextSpeakForwardConceptTime; // used to have players speak the forward concept every X seconds
  88. CHandle<CTriggerAreaCapture> m_hAreaCap;
  89. };
  90. #endif //TEAM_TRAIN_WATCHER_H