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.

120 lines
4.0 KiB

  1. //===== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef DEMO_POLISH_CONTROLLER_H
  7. #define DEMO_POLISH_CONTROLLER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //------------------------------------------------------------------------------------------------------------------------
  12. #include "demo_polish/demo_polish_consts.h"
  13. //#include "locator.h"
  14. #include "../game/shared/Multiplayer/multiplayer_animstate.h"
  15. //------------------------------------------------------------------------------------------------------------------------
  16. class CBonePolishData;
  17. class CDemoPolishFile;
  18. class C_BaseAnimating;
  19. //------------------------------------------------------------------------------------------------------------------------
  20. class CHeaderFile;
  21. class CBoneBitList;
  22. class CFinalDemoPolishFile;
  23. class FinalPolishElementData;
  24. class CBonePath;
  25. class CPathManager;
  26. class CDemoPolishEventQueue;
  27. class CLowerBodyController;
  28. class CDemoPolishConfig;
  29. class CDemoPolishPanel;
  30. class ISequenceAnalyzer;
  31. class CDemoPolishController
  32. {
  33. public:
  34. static CDemoPolishController& Instance();
  35. bool Init( char const* pDemoBaseName );
  36. void Think( float flPlaybackTime );
  37. bool Shutdown();
  38. bool IsInitialized() const { return m_bLateInit; }
  39. bool IsEntityRegistered( int iEntIndex ) const;
  40. void RefreshEvents();
  41. int GetSequenceOverride( int iPlayerEntIndex, float flCurrentDemoTime );
  42. void MakeGlobalAdjustments( int iPlayerEntIndex, CStudioHdr const* pStudioHdr, int& iBoneMask, CBoneAccessor& boneAccessor );
  43. void MakeLocalAdjustments( int iPlayerEntIndex, CStudioHdr const* pStudioHdr, int& iBoneMask, Vector* pPositions,
  44. Quaternion* pRotations, CBoneBitList& boneComputed );
  45. void DrawUnpolishedSkeleton( int iPlayerEntIndex, CStudioHdr const* pStudioHdr );
  46. void DrawUnpolishedSkeleton( int iPlayerLookupIndex, CStudioHdr const* pStudioHdr, CBonePath const* pBonePath, int iDrawFrame, float s, int r, int g, int b );
  47. float GetAdjustedPlaybackTime() const;
  48. float GetElapsed() const;
  49. QAngle& GetRenderAngles( int iPlayerEntIndex ) const;
  50. Vector& GetRenderOrigin( int iPlayerEntIndex ) const;
  51. void UpdatePlayerAnimState( int iPlayerEntIndex, PlayerAnimEvent_t iEvent );
  52. public:
  53. bool m_bInit;
  54. private:
  55. friend class CDemoPolishRecorder;
  56. CDemoPolishController();
  57. ~CDemoPolishController();
  58. void MakeRootAdjustments( int iPlayerLookupIndex, Vector& pos, Quaternion& rot );
  59. void ReloadDemoPolishConfig();
  60. bool InitPanel();
  61. void DispatchEvents( int iPlayerLookupIndex, float flCurrentDemoTime );
  62. bool ReadEventData( int iPlayerLookupIndex );
  63. bool AnalyzeDataForEvents( int iPlayerLookupIndex, int iStartFrame = 0 );
  64. int GetLookupIndexFromEntIndex( int iPlayerEntIndex ) const;
  65. int GetEntIndexFromLookupIndex( int iPlayerLookupIndex ) const;
  66. void AddNewLeaningStartEvent( int iPlayerLookupIndex, float flStartTime, float flLeanDir, bool bStrafe );
  67. void AddNewLeaningStopEvent( int iPlayerLookupIndex, float flStopTime, float flLeanDir, bool bStrafe );
  68. CUtlVector< CDemoPolishFile* > m_vFiles;
  69. int m_iNumPlayerFiles;
  70. public:
  71. CBonePath** m_pBonePaths;
  72. CPathManager* m_pPathManager;
  73. CHeaderFile* m_pHeader;
  74. CDemoPolishEventQueue** m_pEventQueues; // TODO: One queue per player (as of now this is implemented as one queue for one player)
  75. CLowerBodyController** m_pLowerBodyControllers;
  76. CDemoPolishConfig* m_pDemoPolishConfig;
  77. ISequenceAnalyzer** m_pSequenceAnalyzers;
  78. mutable Vector m_renderOrigins[kMaxPlayersSupported];
  79. mutable QAngle m_renderAngles[kMaxPlayersSupported];
  80. private:
  81. float m_flLastTime;
  82. float m_flElapsed;
  83. Vector m_noisePt;
  84. bool LateInit();
  85. bool m_bLateInit;
  86. CDemoPolishPanel* m_pDemoPolishPanel;
  87. CThreadFastMutex m_mutex;
  88. };
  89. //------------------------------------------------------------------------------------------------------------------------
  90. #endif // DEMO_POLISH_CONTROLLER_H