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.

98 lines
3.2 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMETIMESELECTION_H
  7. #define DMETIMESELECTION_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/dmelement.h"
  12. #include "datamodel/dmattributevar.h"
  13. #include "movieobjects/dmetimeselectiontimes.h"
  14. enum RecordingState_t;
  15. class CDmeTimeSelection : public CDmElement
  16. {
  17. DEFINE_ELEMENT( CDmeTimeSelection, CDmElement );
  18. public:
  19. bool IsEnabled() const;
  20. void SetEnabled( bool state );
  21. bool IsRelative() const;
  22. void SetRelative( DmeTime_t time, bool state );
  23. DmeTime_t GetAbsFalloff( DmeTime_t time, int side ) const;
  24. DmeTime_t GetAbsHold( DmeTime_t time, int side ) const;
  25. DmeTime_t GetRelativeFalloff( DmeTime_t time, int side ) const;
  26. DmeTime_t GetRelativeHold( DmeTime_t time, int side ) const;
  27. void SetAbsFalloff( DmeTime_t time, int side, DmeTime_t absfallofftime );
  28. void SetAbsHold ( DmeTime_t time, int side, DmeTime_t absholdtime );
  29. int GetFalloffInterpolatorType( int side ) const;
  30. void SetFalloffInterpolatorType( int side, int interpolatorType );
  31. void GetAlphaForTime( DmeTime_t t, DmeTime_t curtime, byte &alpha );
  32. float GetAmountForTime( DmeTime_t t, DmeTime_t curtime );
  33. float AdjustFactorForInterpolatorType( float factor, int side );
  34. void CopyFrom( const CDmeTimeSelection &src );
  35. void GetAbsTimes( DmeTime_t time, DmeTime_t pTimes[TS_TIME_COUNT] ) const;
  36. void GetCurrent( DmeTime_t pTimes[TS_TIME_COUNT] ) const;
  37. void SetCurrent( const TimeSelection_t &times );
  38. float GetThreshold() const;
  39. void SetThreshold( float threshold );
  40. DmeTime_t GetResampleInterval() const;
  41. void SetResampleInterval( DmeTime_t resampleInterval );
  42. void SetRecordingState( RecordingState_t state );
  43. RecordingState_t GetRecordingState() const;
  44. void GetTimeSelectionTimes( DmeTime_t curtime, DmeTime_t t[ TS_TIME_COUNT ] ) const;
  45. void SetTimeSelectionTimes( DmeTime_t curtime, DmeTime_t t[ TS_TIME_COUNT ] );
  46. // Does selection extend to 'infinity' in this side?
  47. bool IsInfinite( int side ) const;
  48. void SetInfinite( int side );
  49. bool IsFullyInfinite() const;
  50. bool IsEitherInfinite() const;
  51. void GetInfinite( bool bInfinite[ 2 ] ) const;
  52. DmeTime_t GetAbsTime( DmeTime_t time, int tsType ) const;
  53. DmeTime_t GetRelativeTime( DmeTime_t time, int tsType ) const;
  54. void SetAbsTime( DmeTime_t time, int tsType, DmeTime_t absTime );
  55. // helper to see if any of the times are really close to DME_MAXTIME/DME_MINTIME but not exactly on them
  56. bool IsSuspicious( bool bCheckHoldAndFalloff = false );
  57. private:
  58. CDmeTimeSelection & operator =( const CDmeTimeSelection& src ) { Assert( 0 ); }
  59. void ConvertToRelative( DmeTime_t time );
  60. void ConvertToAbsolute( DmeTime_t time );
  61. CDmaVar< bool > m_bEnabled;
  62. CDmaVar< bool > m_bRelative;
  63. // These are all offsets from the "current" head position in seconds, or they are absolute times if not using relative mode
  64. CDmaTime m_falloff[ 2 ];
  65. CDmaTime m_hold[ 2 ];
  66. CDmaVar< int > m_nFalloffInterpolatorType[ 2 ];
  67. CDmaVar< float > m_threshold;
  68. CDmaTime m_resampleInterval;
  69. CDmaVar< int > m_nRecordingState;
  70. };
  71. #endif // DMETIMESELECTION_H