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.

124 lines
3.0 KiB

  1. //========= Copyright � 1996-2008, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Client handler for instruction players how to play
  4. //
  5. //=============================================================================//
  6. #ifndef _C_GAMEINSTRUCTOR_H_
  7. #define _C_GAMEINSTRUCTOR_H_
  8. #include "GameEventListener.h"
  9. #include "vgui_controls/PHandle.h"
  10. class CBaseLesson;
  11. struct LessonGroupConVarToggle_t
  12. {
  13. ConVarRef var;
  14. char szLessonGroupName[ 64 ];
  15. explicit LessonGroupConVarToggle_t( const char *pchConVarName ) :
  16. var( pchConVarName )
  17. {
  18. }
  19. };
  20. class C_GameInstructor : public CAutoGameSystemPerFrame, public CGameEventListener
  21. {
  22. public:
  23. C_GameInstructor() : CAutoGameSystemPerFrame( "C_GameInstructor" )
  24. {
  25. m_nSplitScreenSlot = -1;
  26. m_bHasLoadedSaveData = false;
  27. m_bEnsureThatInitIsNotCalledMultipleTimes = false;
  28. }
  29. void SetSlot( int nSlot ) { m_nSplitScreenSlot = nSlot; }
  30. // Methods of IGameSystem
  31. virtual bool Init( void );
  32. virtual void Shutdown( void );
  33. virtual void Update( float frametime );
  34. void UpdateHiddenByOtherElements( void );
  35. bool Mod_HiddenByOtherElements( void );
  36. virtual void FireGameEvent( IGameEvent *event );
  37. void DefineLesson( CBaseLesson *pLesson );
  38. const CBaseLesson * GetLesson( const char *pchLessonName );
  39. bool IsLessonOfSameTypeOpen( const CBaseLesson *pLesson ) const;
  40. // Save / Restore
  41. void SaveGameBlock( ISave *pSave );
  42. void RestoreGameBlock( IRestore *pRestore, bool );
  43. bool ReadSaveData( void );
  44. bool WriteSaveData( void );
  45. void KeyValueBuilder( KeyValues *pKeyValues );
  46. void RefreshDisplaysAndSuccesses( void );
  47. void ResetDisplaysAndSuccesses( void );
  48. void MarkDisplayed( const char *pchLessonName );
  49. void MarkSucceeded( const char *pchLessonName );
  50. void PlaySound( const char *pchSoundName );
  51. bool OpenOpportunity( CBaseLesson *pLesson );
  52. void DumpOpenOpportunities( void );
  53. KeyValues * GetScriptKeys( void );
  54. C_BasePlayer * GetLocalPlayer( void );
  55. void EvaluateLessonsForGameRules( void );
  56. void SetLessonGroupEnabled( const char *pszGroup, bool bEnabled );
  57. private:
  58. void FindErrors( void );
  59. bool UpdateActiveLesson( CBaseLesson *pLesson, const CBaseLesson *pRootLesson );
  60. void UpdateInactiveLesson( CBaseLesson *pLesson );
  61. CBaseLesson * GetLesson_Internal( const char *pchLessonName );
  62. void StopAllLessons( void );
  63. void CloseAllOpenOpportunities( void );
  64. void CloseOpportunity( CBaseLesson *pLesson );
  65. void ReadLessonsFromFile( const char *pchFileName );
  66. void InitLessonPrerequisites( void );
  67. private:
  68. CUtlVector < CBaseLesson* > m_Lessons;
  69. CUtlVector < CBaseLesson* > m_OpenOpportunities;
  70. CUtlVector < LessonGroupConVarToggle_t > m_LessonGroupConVarToggles;
  71. KeyValues *m_pScriptKeys;
  72. bool m_bNoDraw;
  73. bool m_bHiddenDueToOtherElements;
  74. int m_iCurrentPriority;
  75. EHANDLE m_hLastSpectatedPlayer;
  76. bool m_bSpectatedPlayerChanged;
  77. char m_szPreviousStartSound[ 128 ];
  78. float m_fNextStartSoundTime;
  79. int m_nSplitScreenSlot;
  80. bool m_bHasLoadedSaveData;
  81. bool m_bEnsureThatInitIsNotCalledMultipleTimes;
  82. };
  83. C_GameInstructor &GetGameInstructor();
  84. #endif // _C_GAMEINSTRUCTOR_H_