Team Fortress 2 Source Code as on 22/4/2020
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.

120 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef SCENEENTITY_SHARED_H
  7. #define SCENEENTITY_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #if defined( CLIENT_DLL )
  12. #define CBaseFlex C_BaseFlex
  13. #define CSceneEntity C_SceneEntity
  14. #endif
  15. #include "iscenetokenprocessor.h"
  16. class CBaseFlex;
  17. class CChoreoEvent;
  18. class CChoreoScene;
  19. class CChoreoActor;
  20. class CSceneEntity;
  21. //-----------------------------------------------------------------------------
  22. // Purpose: One of a number of currently playing scene events for this actor
  23. //-----------------------------------------------------------------------------
  24. // FIXME: move this, it's only used in in baseflex and baseactor
  25. class CSceneEventInfo
  26. {
  27. public:
  28. CSceneEventInfo()
  29. :
  30. m_pEvent( 0 ),
  31. m_pScene( 0 ),
  32. m_pActor( 0 ),
  33. m_bStarted( false ),
  34. m_iLayer( -1 ),
  35. m_iPriority( 0 ),
  36. m_nSequence( 0 ),
  37. m_bIsGesture( false ),
  38. m_flWeight( 0.0f ),
  39. m_hTarget(),
  40. m_bIsMoving( false ),
  41. m_bHasArrived( false ),
  42. m_flInitialYaw( 0.0f ),
  43. m_flTargetYaw( 0.0f ),
  44. m_flFacingYaw( 0.0f ),
  45. m_nType( 0 ),
  46. m_flNext( 0.0f ),
  47. m_bClientSide( false )
  48. {
  49. }
  50. // The event handle of the current scene event
  51. CChoreoEvent *m_pEvent;
  52. // Current Scene
  53. CChoreoScene *m_pScene;
  54. // Current actor
  55. CChoreoActor *m_pActor;
  56. // Set after the first time the event has been configured ( allows
  57. // bumping markov index only at start of event playback, not every frame )
  58. bool m_bStarted;
  59. public:
  60. // EVENT local data...
  61. // FIXME: Evil, make accessors or figure out better place
  62. // FIXME: This won't work, scenes don't save and restore...
  63. int m_iLayer;
  64. int m_iPriority;
  65. int m_nSequence;
  66. bool m_bIsGesture;
  67. float m_flWeight; // used for suppressions of posture while moving
  68. // movement, faceto targets?
  69. EHANDLE m_hTarget;
  70. bool m_bIsMoving;
  71. bool m_bHasArrived;
  72. float m_flInitialYaw;
  73. float m_flTargetYaw;
  74. float m_flFacingYaw;
  75. // generic AI events
  76. int m_nType;
  77. float m_flNext;
  78. // is this event only client side?
  79. bool m_bClientSide;
  80. void InitWeight( CBaseFlex *pActor );
  81. float UpdateWeight( CBaseFlex *pActor );
  82. };
  83. //-----------------------------------------------------------------------------
  84. // Purpose: Helper for parsing scene data file
  85. //-----------------------------------------------------------------------------
  86. class CSceneTokenProcessor : public ISceneTokenProcessor
  87. {
  88. public:
  89. const char *CurrentToken( void );
  90. bool GetToken( bool crossline );
  91. bool TokenAvailable( void );
  92. void Error( PRINTF_FORMAT_STRING const char *fmt, ... );
  93. void SetBuffer( char *buffer );
  94. private:
  95. const char *m_pBuffer;
  96. char m_szToken[ 1024 ];
  97. };
  98. extern CSceneTokenProcessor g_TokenProcessor;
  99. void Scene_Printf( PRINTF_FORMAT_STRING const char *pFormat, ... );
  100. extern ConVar scene_clientflex;
  101. #endif // SCENEENTITY_SHARED_H