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.

104 lines
2.7 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef ANIMSETATTRIBUTEVALUE_H
  7. #define ANIMSETATTRIBUTEVALUE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/UtlMap.h"
  12. #include "tier1/strtools.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class CDmAttribute;
  17. enum DmElementHandle_t;
  18. //-----------------------------------------------------------------------------
  19. // AnimationControlType
  20. //-----------------------------------------------------------------------------
  21. enum AnimationControlType_t
  22. {
  23. ANIM_CONTROL_INVALID = -1,
  24. ANIM_CONTROL_VALUE = 0,
  25. ANIM_CONTROL_VALUE_RIGHT,
  26. ANIM_CONTROL_VALUE_LEFT,
  27. ANIM_CONTROL_COUNT,
  28. ANIM_CONTROL_TXFORM_POSITION = ANIM_CONTROL_COUNT,
  29. ANIM_CONTROL_TXFORM_ORIENTATION,
  30. ANIM_CONTROL_FULL_COUNT,
  31. ANIM_CONTROL_TRANSFORM_CONTROL_COUNT = ANIM_CONTROL_FULL_COUNT - ANIM_CONTROL_COUNT,
  32. };
  33. struct AttributeValue_t
  34. {
  35. AttributeValue_t()
  36. {
  37. // Default values
  38. m_pValue[ANIM_CONTROL_VALUE] = 0.0f;
  39. m_pValue[ANIM_CONTROL_VALUE_RIGHT] = 0.0f;
  40. m_pValue[ANIM_CONTROL_VALUE_LEFT] = 0.0f;
  41. // Default values
  42. m_Vector.Init();
  43. m_Quaternion = quat_identity;
  44. }
  45. float m_pValue[ANIM_CONTROL_COUNT];
  46. Vector m_Vector; // ANIM_CONTROL_TXFORM_POSITION
  47. Quaternion m_Quaternion; // ANIM_CONTROL_TXFORM_ORIENTATION
  48. };
  49. struct AnimationControlAttributes_t : public AttributeValue_t
  50. {
  51. AnimationControlAttributes_t()
  52. {
  53. m_pValueAttribute[ANIM_CONTROL_VALUE] = 0;
  54. m_pValueAttribute[ANIM_CONTROL_VALUE_RIGHT] = 0;
  55. m_pValueAttribute[ANIM_CONTROL_VALUE_LEFT] = 0;
  56. m_pValueAttribute[ANIM_CONTROL_TXFORM_POSITION] = 0;
  57. m_pValueAttribute[ANIM_CONTROL_TXFORM_ORIENTATION] = 0;
  58. m_pTimesAttribute[ANIM_CONTROL_VALUE] = 0;
  59. m_pTimesAttribute[ANIM_CONTROL_VALUE_RIGHT] = 0;
  60. m_pTimesAttribute[ANIM_CONTROL_VALUE_LEFT] = 0;
  61. m_pTimesAttribute[ANIM_CONTROL_TXFORM_POSITION] = 0;
  62. m_pTimesAttribute[ANIM_CONTROL_TXFORM_ORIENTATION] = 0;
  63. }
  64. void Clear()
  65. {
  66. // Only works because we are a class
  67. Q_memset( this, 0, sizeof( *this ) );
  68. m_Quaternion = quat_identity;
  69. }
  70. CDmAttribute* m_pValueAttribute[ ANIM_CONTROL_FULL_COUNT ];
  71. CDmAttribute* m_pTimesAttribute[ ANIM_CONTROL_FULL_COUNT ];
  72. };
  73. typedef CUtlMap< DmElementHandle_t, AnimationControlAttributes_t, unsigned short > AttributeDict_t;
  74. inline AttributeDict_t *CopyAttributeDict( AttributeDict_t *pSrc )
  75. {
  76. if ( !pSrc )
  77. return NULL;
  78. AttributeDict_t *pDest = new AttributeDict_t();
  79. pDest->AccessTree()->CopyFrom( *pSrc->AccessTree() );
  80. return pDest;
  81. }
  82. #endif // ANIMSETATTRIBUTEVALUE_H