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.

116 lines
3.9 KiB

  1. //========= Copyright � 1996-2007, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_SCENEENTITY_H
  8. #define C_SCENEENTITY_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "ichoreoeventcallback.h"
  13. class C_SceneEntity : public C_BaseEntity, public IChoreoEventCallback
  14. {
  15. friend class CChoreoEventCallback;
  16. public:
  17. DECLARE_CLASS( C_SceneEntity, C_BaseEntity );
  18. DECLARE_CLIENTCLASS();
  19. C_SceneEntity( void );
  20. ~C_SceneEntity( void );
  21. // From IChoreoEventCallback
  22. virtual void StartEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
  23. virtual void EndEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
  24. virtual void ProcessEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
  25. virtual bool CheckEvent( float currenttime, CChoreoScene *scene, CChoreoEvent *event );
  26. virtual void PostDataUpdate( DataUpdateType_t updateType );
  27. virtual void PreDataUpdate( DataUpdateType_t updateType );
  28. virtual void StopClientOnlyScene();
  29. virtual void SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *pOwner = NULL , bool bMultiplayer = false );
  30. virtual void ClientThink();
  31. void OnResetClientTime();
  32. CHandle< C_BaseFlex > GetActor( int i ){ return ( i < m_hActorList.Count() ) ? m_hActorList[i] : INVALID_EHANDLE; }
  33. virtual void DispatchStartSpeak( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event, soundlevel_t iSoundlevel );
  34. virtual void DispatchEndSpeak( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  35. bool IsClientOnly( void ){ return m_bClientOnly; }
  36. bool IsMultiplayer() const { return m_bMultiplayer; }
  37. private:
  38. void ResetActorFlexesForScene();
  39. // Scene load/unload
  40. CChoreoScene *LoadScene( const char *filename );
  41. void LoadSceneFromFile( const char *filename );
  42. void UnloadScene( void );
  43. void PrefetchAnimBlocks( CChoreoScene *pScene );
  44. C_BaseFlex *FindNamedActor( CChoreoActor *pChoreoActor );
  45. virtual void DispatchStartFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  46. virtual void DispatchEndFlexAnimation( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  47. virtual void DispatchStartExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  48. virtual void DispatchEndExpression( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  49. virtual void DispatchStartGesture( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  50. virtual void DispatchEndGesture( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  51. virtual void DispatchStartSequence( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  52. virtual void DispatchEndSequence( CChoreoScene *scene, C_BaseFlex *actor, CChoreoEvent *event );
  53. void DispatchProcessLoop( CChoreoScene *scene, CChoreoEvent *event );
  54. char const *GetSceneFileName();
  55. void DoThink( float frametime );
  56. void ClearSceneEvents( CChoreoScene *scene, bool canceled );
  57. void SetCurrentTime( float t, bool forceClientSync );
  58. bool GetHWMorphSceneFileName( const char *pFilename, char *pHWMFilename );
  59. private:
  60. void CheckQueuedEvents();
  61. void WipeQueuedEvents();
  62. void QueueStartEvent( float starttime, CChoreoScene *scene, CChoreoEvent *event );
  63. bool m_bIsPlayingBack;
  64. bool m_bPaused;
  65. bool m_bMultiplayer;
  66. float m_flCurrentTime;
  67. float m_flForceClientTime;
  68. int m_nSceneStringIndex;
  69. bool m_bClientOnly;
  70. CHandle< C_BaseFlex > m_hOwner; // if set, this overrides the m_hActorList in FindNamedActor()
  71. CUtlVector< CHandle< C_BaseFlex > > m_hActorList;
  72. private:
  73. bool m_bWasPlaying;
  74. CChoreoScene *m_pScene;
  75. struct QueuedEvents_t
  76. {
  77. float starttime;
  78. CChoreoScene *scene;
  79. CChoreoEvent *event;
  80. };
  81. CUtlVector< QueuedEvents_t > m_QueuedEvents;
  82. };
  83. #endif // C_SCENEENTITY_H