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.

66 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Round timer for dod gamerules
  4. //
  5. //=============================================================================//
  6. #ifndef DOD_ROUND_TIMER_H
  7. #define DOD_ROUND_TIMER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #ifdef CLIENT_DLL
  12. #define CDODRoundTimer C_DODRoundTimer
  13. #endif
  14. class CDODRoundTimer : public CBaseEntity
  15. {
  16. public:
  17. DECLARE_CLASS( CDODRoundTimer, CBaseEntity );
  18. DECLARE_NETWORKCLASS();
  19. // Constructor
  20. CDODRoundTimer();
  21. // Destructor
  22. virtual ~CDODRoundTimer();
  23. // Set the initial length of the timer
  24. void SetTimeRemaining( int iTimerSeconds );
  25. // Add time to an already running ( or paused ) timer
  26. void AddTimerSeconds( int iSecondsToAdd );
  27. void PauseTimer( void );
  28. void ResumeTimer( void );
  29. // Returns seconds to display.
  30. // When paused shows amount of time left once the timer is resumed
  31. float GetTimeRemaining( void );
  32. int GetTimerMaxLength( void );
  33. #ifndef CLIENT_DLL
  34. int UpdateTransmitState();
  35. #else
  36. void InternalSetPaused( bool bPaused ) { m_bTimerPaused = bPaused; }
  37. #endif
  38. private:
  39. CNetworkVar( bool, m_bTimerPaused );
  40. CNetworkVar( float, m_flTimeRemaining );
  41. CNetworkVar( float, m_flTimerEndTime );
  42. int m_iTimerMaxLength; // Sum of starting duration plus any time we added
  43. };
  44. #ifdef CLIENT_DLL
  45. extern CDODRoundTimer *g_DODRoundTimer;
  46. #endif
  47. #endif //DOD_ROUND_TIMER_H