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.

70 lines
1.3 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMETIMESELECTIONTIMES_H
  7. #define DMETIMESELECTIONTIMES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. enum TimeSelectionTimes_t
  12. {
  13. TS_LEFT_FALLOFF = 0,
  14. TS_LEFT_HOLD,
  15. TS_RIGHT_HOLD,
  16. TS_RIGHT_FALLOFF,
  17. TS_TIME_COUNT,
  18. };
  19. struct TimeSelection_t
  20. {
  21. TimeSelection_t()
  22. {
  23. m_Times[ TS_LEFT_FALLOFF ] = DMETIME_INVALID;
  24. m_Times[ TS_LEFT_HOLD ] = DMETIME_INVALID;
  25. m_Times[ TS_RIGHT_HOLD ] = DMETIME_INVALID;
  26. m_Times[ TS_RIGHT_FALLOFF] = DMETIME_INVALID;
  27. }
  28. const DmeTime_t &operator[]( int index ) const
  29. {
  30. Assert( index < TS_TIME_COUNT );
  31. return m_Times[ index ];
  32. }
  33. DmeTime_t &operator[]( int index )
  34. {
  35. Assert( index < TS_TIME_COUNT );
  36. return m_Times[ index ];
  37. }
  38. bool operator==( const TimeSelection_t &rhs )
  39. {
  40. for ( int i = 0; i < TS_TIME_COUNT; ++i )
  41. {
  42. if ( m_Times[ i ] != rhs.m_Times[ i ] )
  43. return false;
  44. }
  45. return true;
  46. }
  47. bool operator!=( const TimeSelection_t &rhs )
  48. {
  49. return !operator==( rhs );
  50. }
  51. DmeTime_t m_Times[ TS_TIME_COUNT ];
  52. };
  53. // NOTE: _side == 0 means left, == 1 means right
  54. #define TS_FALLOFF( _side ) ( ( TS_TIME_COUNT - (_side) ) & 0x3 )
  55. #define TS_HOLD( _side ) ( TS_LEFT_HOLD + (_side) )
  56. #endif // DMETIMESELECTIONTIMES_H