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.

175 lines
3.8 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "movieobjects/dmeoverlay.h"
  7. #include "tier0/dbg.h"
  8. #include "datamodel/dmelementfactoryhelper.h"
  9. #include "mathlib/vector.h"
  10. #include "mathlib/mathlib.h"
  11. #include "datamodel/dmattributevar.h"
  12. #include "movieobjects/dmedag.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include "tier0/memdbgon.h"
  15. //-----------------------------------------------------------------------------
  16. // Expose this class to the scene database
  17. //-----------------------------------------------------------------------------
  18. IMPLEMENT_ELEMENT_FACTORY( DmeOverlay, CDmeOverlay );
  19. //-----------------------------------------------------------------------------
  20. // Constructor, destructor
  21. //-----------------------------------------------------------------------------
  22. void CDmeOverlay::OnConstruction()
  23. {
  24. m_flWeight.Init( this, "weight", FATTRIB_HAS_CALLBACK );
  25. m_nSequence.Init( this, "sequence", FATTRIB_HAS_CALLBACK );
  26. m_flPrevCycle.Init( this, "prevCycle", FATTRIB_HAS_CALLBACK );
  27. m_flCycle.Init( this, "cycle", FATTRIB_HAS_CALLBACK );
  28. m_nOrder.Init( this, "order", FATTRIB_HAS_CALLBACK );
  29. m_flPlaybackRate.Init( this, "playbackRate", FATTRIB_HAS_CALLBACK );
  30. m_flLayerAnimtime.Init( this, "layerAnimtime", FATTRIB_HAS_CALLBACK );
  31. m_flLayerFadeOuttime.Init( this, "layerFadeOuttime", FATTRIB_HAS_CALLBACK );
  32. }
  33. void CDmeOverlay::OnDestruction()
  34. {
  35. }
  36. void CDmeOverlay::OnAttributeChanged( CDmAttribute *pAttribute )
  37. {
  38. BaseClass::OnAttributeChanged( pAttribute );
  39. InvokeOnAttributeChangedOnReferrers( GetHandle(), pAttribute );
  40. }
  41. float CDmeOverlay::GetWeight() const
  42. {
  43. return m_flWeight;
  44. }
  45. float CDmeOverlay::GetSequence() const
  46. {
  47. return m_nSequence;
  48. }
  49. float CDmeOverlay::GetPrevCycle() const
  50. {
  51. return m_flPrevCycle;
  52. }
  53. float CDmeOverlay::GetCycle() const
  54. {
  55. return m_flCycle;
  56. }
  57. int CDmeOverlay::GetOrder() const
  58. {
  59. return m_nOrder;
  60. }
  61. float CDmeOverlay::GetPlaybackRate() const
  62. {
  63. return m_flPlaybackRate;
  64. }
  65. float CDmeOverlay::GetLayerAnimtime() const
  66. {
  67. return m_flLayerAnimtime;
  68. }
  69. float CDmeOverlay::GetLayerFadeOuttime() const
  70. {
  71. return m_flLayerFadeOuttime;
  72. }
  73. void CDmeOverlay::SetWeight( float flWeight )
  74. {
  75. m_flWeight = flWeight;
  76. }
  77. void CDmeOverlay::SetSequence( int nSequence )
  78. {
  79. m_nSequence = nSequence;
  80. }
  81. void CDmeOverlay::SetPrevCycle( float flPrevCycle )
  82. {
  83. m_flPrevCycle = flPrevCycle;
  84. }
  85. void CDmeOverlay::SetCycle( float flCycle )
  86. {
  87. m_flCycle = flCycle;
  88. }
  89. void CDmeOverlay::SetOrder( int nOrder )
  90. {
  91. m_nOrder = nOrder;
  92. }
  93. void CDmeOverlay::SetPlaybackRate( float flPlaybackRate )
  94. {
  95. m_flPlaybackRate = flPlaybackRate;
  96. }
  97. void CDmeOverlay::SetLayerAnimttime( float flAnimttime )
  98. {
  99. m_flLayerAnimtime = flAnimttime;
  100. }
  101. void CDmeOverlay::SetLayerFadeOuttime( float flLayerFadeOuttime )
  102. {
  103. m_flLayerFadeOuttime = flLayerFadeOuttime;
  104. }
  105. CDmAttribute *CDmeOverlay::GetWeightAttribute()
  106. {
  107. return m_flWeight.GetAttribute();
  108. }
  109. CDmAttribute *CDmeOverlay::GetSequenceAttribute()
  110. {
  111. return m_nSequence.GetAttribute();
  112. }
  113. CDmAttribute *CDmeOverlay::GetPrevCycleAttribute()
  114. {
  115. return m_flPrevCycle.GetAttribute();
  116. }
  117. CDmAttribute *CDmeOverlay::GetCycleAttribute()
  118. {
  119. return m_flCycle.GetAttribute();
  120. }
  121. CDmAttribute *CDmeOverlay::GetOrderAttribute()
  122. {
  123. return m_nOrder.GetAttribute();
  124. }
  125. CDmAttribute *CDmeOverlay::GetPlaybackRateAttribute()
  126. {
  127. return m_flPlaybackRate.GetAttribute();
  128. }
  129. CDmAttribute *CDmeOverlay::GetLayerAnimtimeAttribute()
  130. {
  131. return m_flLayerAnimtime.GetAttribute();
  132. }
  133. CDmAttribute *CDmeOverlay::GetLayerFadeOuttimeAttribute()
  134. {
  135. return m_flLayerFadeOuttime.GetAttribute();
  136. }
  137. CDmeDag *CDmeOverlay::GetDag()
  138. {
  139. static CUtlSymbolLarge overlaySymbol = g_pDataModel->GetSymbol( "overlay" );
  140. CDmeDag *pDag = FindReferringElement< CDmeDag >( this, overlaySymbol );
  141. return pDag;
  142. }