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.

277 lines
9.0 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =====//
  2. //
  3. // Dme representation of QC: $sequence
  4. //
  5. //===========================================================================//
  6. #ifndef DMESEQUENCE_H
  7. #define DMESEQUENCE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Valve includes
  12. #include "datamodel/dmattributevar.h"
  13. #include "datamodel/dmelement.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. class CDmeDag;
  18. class CDmeAnimationList;
  19. class CDmeIkRule;
  20. class CDmeIkLock;
  21. class CDmeAnimCmd;
  22. class CDmeEvent;
  23. class CDmeMotionControl;
  24. class CDmeSequenceBase;
  25. class CDmeChannelsClip;
  26. class CDmeBoneMask;
  27. //-----------------------------------------------------------------------------
  28. // Animation event
  29. //-----------------------------------------------------------------------------
  30. class CDmeAnimationEvent : public CDmElement
  31. {
  32. DEFINE_ELEMENT( CDmeAnimationEvent, CDmElement );
  33. public:
  34. // Name is the event name
  35. CDmaVar< int > m_nFrame;
  36. CDmaString m_sDataString;
  37. };
  38. //-----------------------------------------------------------------------------
  39. //
  40. // QC $sequence activity <name> <weight>
  41. //
  42. // .name = <name>
  43. // .weight = <weight>
  44. // .modifierList = $QC activityModifier
  45. //-----------------------------------------------------------------------------
  46. #ifdef SWIG
  47. %ignore CDmeSequenceActivity::m_sModifierList;
  48. #endif // #ifdef SWIG
  49. class CDmeSequenceActivity : public CDmElement
  50. {
  51. DEFINE_ELEMENT( CDmeSequenceActivity, CDmElement );
  52. public:
  53. CDmaVar< int > m_nWeight;
  54. CDmaStringArray m_sModifierList;
  55. };
  56. //-----------------------------------------------------------------------------
  57. // CDmeSequenceLayerBase
  58. //-----------------------------------------------------------------------------
  59. class CDmeSequenceLayerBase : public CDmElement
  60. {
  61. DEFINE_ELEMENT( CDmeSequenceLayerBase, CDmElement );
  62. public:
  63. CDmaElement< CDmeSequenceBase > m_eAnimation;
  64. };
  65. //-----------------------------------------------------------------------------
  66. // CDmeSequenceAddLayer
  67. //-----------------------------------------------------------------------------
  68. class CDmeSequenceAddLayer : public CDmeSequenceLayerBase
  69. {
  70. DEFINE_ELEMENT( CDmeSequenceAddLayer, CDmeSequenceLayerBase );
  71. public:
  72. };
  73. //-----------------------------------------------------------------------------
  74. // CDmeSequenceBlendLayer
  75. //-----------------------------------------------------------------------------
  76. class CDmeSequenceBlendLayer : public CDmeSequenceLayerBase
  77. {
  78. DEFINE_ELEMENT( CDmeSequenceBlendLayer, CDmeSequenceLayerBase );
  79. public:
  80. CDmaVar< float > m_flStartFrame;
  81. CDmaVar< float > m_flPeakFrame;
  82. CDmaVar< float > m_flTailFrame;
  83. CDmaVar< float > m_flEndFrame;
  84. CDmaVar< bool > m_bSpline;
  85. CDmaVar< bool > m_bCrossfade;
  86. CDmaVar< bool > m_bNoBlend;
  87. CDmaVar< bool > m_bLocal;
  88. CDmaString m_sPoseParameterName;
  89. };
  90. //-----------------------------------------------------------------------------
  91. // QC seq blend/calcblend base class
  92. //-----------------------------------------------------------------------------
  93. class CDmeSequenceBlendBase : public CDmElement
  94. {
  95. DEFINE_ELEMENT( CDmeSequenceBlendBase, CDmElement );
  96. public:
  97. CDmaString m_sPoseParameterName;
  98. };
  99. //-----------------------------------------------------------------------------
  100. // QC seq blend
  101. //-----------------------------------------------------------------------------
  102. class CDmeSequenceBlend : public CDmeSequenceBlendBase
  103. {
  104. DEFINE_ELEMENT( CDmeSequenceBlend, CDmeSequenceBlendBase );
  105. public:
  106. CDmaVar< float > m_flParamStart;
  107. CDmaVar< float > m_flParamEnd;
  108. };
  109. //-----------------------------------------------------------------------------
  110. // QC seq calcblend
  111. //-----------------------------------------------------------------------------
  112. class CDmeSequenceCalcBlend : public CDmeSequenceBlendBase
  113. {
  114. DEFINE_ELEMENT( CDmeSequenceCalcBlend, CDmeSequenceBlendBase );
  115. public:
  116. CDmaString m_sAttachmentName;
  117. CDmaElement< CDmeMotionControl > m_eMotionControl;
  118. };
  119. //-----------------------------------------------------------------------------
  120. // CDmeSequenceBase - Base Class For CDmeSequence & CDmeMultiSequence
  121. //-----------------------------------------------------------------------------
  122. class CDmeSequenceBase : public CDmElement
  123. {
  124. DEFINE_ELEMENT( CDmeSequenceBase, CDmElement );
  125. public:
  126. CDmaElement< CDmeSequenceActivity > m_eActivity; // QC activity
  127. CDmaVar< bool > m_bHidden; // QC hidden
  128. CDmaVar< bool > m_bDelta; // QC delta
  129. CDmaVar< bool > m_bWorldSpace; // QC worldspace
  130. CDmaVar< bool > m_bPreDelta; // QC predelta
  131. CDmaVar< bool > m_bAutoPlay; // QC autoplay
  132. CDmaVar< bool > m_bRealtime; // QC realtime
  133. CDmaVar< float > m_flFadeIn; // QC fadein
  134. CDmaVar< float > m_flFadeOut; // QC fadeout
  135. CDmaString m_sEntryNode; // QC node, transition, rtransition
  136. CDmaString m_sExitNode; // QC node, transition, rtransition
  137. CDmaVar< bool > m_bReverseNodeTransition; // QC rtransition
  138. CDmaVar< bool > m_bSnap; // QC snap - Both Sequence & Animation
  139. CDmaVar< bool > m_bPost; // QC post - Both Sequence & Animation
  140. CDmaVar< bool > m_bLoop; // QC loop - Both Sequence & Animation
  141. CDmaElementArray< CDmeIkLock > m_eIkLockList;
  142. CDmaElementArray< CDmeAnimationEvent > m_eAnimationEventList;
  143. CDmaElementArray< CDmeSequenceLayerBase > m_eLayerList;
  144. CDmaString m_sKeyValues; // Sequence KeyValues
  145. //-----------------------------------------------------------------------------
  146. // qsort function for sorting DmeBaseSequence elements based on type and
  147. // sequence references.
  148. //
  149. // * A DmeBaseSequence must be either a DmeSequence or a DmeMultiSequence
  150. // They are mutually exclusive, cannot be both
  151. // * DmeMultiSequence refer to DmeSequence's so should always go last
  152. // * DmeMultiSequence cannot refer to other DmeMultiSequence so they are
  153. // considered equal
  154. // * DmeSequence can refer to other DmeSequence elements via DmeAnimCmd's
  155. // but circular references are not allowed. If a DmeSequence refers
  156. // to another, the DmeSequence being referenced needs to be before the
  157. // DmeSequence doing the referring
  158. // * If no referrals between two DmeSequence's, sort based on DmeAnimCmd count
  159. // so DmeSequence's with fewer DmeAnimCmd's go first
  160. //-----------------------------------------------------------------------------
  161. static int QSortFunction( const void *pVoidSeq1, const void *pVoidSeq2 );
  162. };
  163. //-----------------------------------------------------------------------------
  164. // Animation data
  165. //
  166. // QC $sequence
  167. //
  168. //-----------------------------------------------------------------------------
  169. class CDmeSequence : public CDmeSequenceBase
  170. {
  171. DEFINE_ELEMENT( CDmeSequence, CDmeSequenceBase );
  172. public:
  173. CDmaElement< CDmeDag > m_eSkeleton;
  174. CDmaElement< CDmeAnimationList > m_eAnimationList; // QC animation file
  175. CDmaVar< float > m_flFPS; // QC fps
  176. CDmaVar< Vector > m_vOrigin; // QC origin
  177. CDmaVar< float > m_flScale; // QC scale
  178. CDmaVar< int > m_nStartLoop; // QC startloop
  179. CDmaVar< bool > m_bForceLoop; // QC !( noforceloop )
  180. CDmaVar< bool > m_bAutoIk; // QC autoik / noautoik
  181. CDmaVar< float > m_flMotionRollback; // QC motionrollback
  182. CDmaVar< bool > m_bAnimBlocks; // QC !( noanimblock )
  183. CDmaVar< bool > m_bAnimBlockStall; // QC !( noanimblockstalls )
  184. CDmaElement< CDmeMotionControl > m_eMotionControl; // QC STUDIO_X, etc...
  185. CDmaElementArray< CDmeAnimCmd > m_eAnimationCommandList;
  186. CDmaElementArray< CDmeIkRule > m_eIkRuleList;
  187. CDmaElement< CDmeBoneMask > m_eBoneMask;
  188. CDmeChannelsClip *GetDmeChannelsClip() const;
  189. DmeFramerate_t GetFrameRate(
  190. DmeFramerate_t fallbackFrameRate = DmeFramerate_t( 30 ),
  191. bool bForceFallback = false ) const;
  192. // Gets the maximum frame count from all animations in the DmeSequence
  193. int GetFrameCount(
  194. DmeFramerate_t fallbackFrameRate = DmeFramerate_t( 30 ),
  195. bool bForceFallback = false ) const;
  196. // Put all DmeChannel's in this DmeSequence to CM_PLAY
  197. void PrepareChannels( CUtlVector< IDmeOperator * > &dmeOperatorList );
  198. // Operate all DmeChannel's in this DmeSequence
  199. // Pass the dmeOperatorList returned by PrepareChannels
  200. void UpdateChannels( CUtlVector< IDmeOperator * > &dmeOperatorList, DmeTime_t nClipTime );
  201. void GetDependentOperators( CUtlVector< IDmeOperator * > &operatorList, CDmeOperator *pDmeOperator ) const;
  202. };
  203. //-----------------------------------------------------------------------------
  204. // Animation data
  205. //
  206. // QC $sequence
  207. //
  208. //-----------------------------------------------------------------------------
  209. class CDmeMultiSequence : public CDmeSequenceBase
  210. {
  211. DEFINE_ELEMENT( CDmeMultiSequence, CDmeSequenceBase );
  212. public:
  213. CDmaVar< int > m_nBlendWidth; // QC blendwidth
  214. CDmaElement< CDmeSequence > m_eBlendRef; // QC blendref
  215. CDmaElement< CDmeSequence > m_eBlendComp; // QC blendcomp
  216. CDmaElement< CDmeSequence > m_eBlendCenter; // QC blendcenter
  217. CDmaElementArray< CDmeSequence > m_eSequenceList;
  218. CDmaElementArray< CDmeSequenceBlendBase > m_eBlendList;
  219. };
  220. #endif // DMESEQUENCE_H