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.

207 lines
5.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #if !defined( MOVIESLOT_H_ )
  8. #define MOVIESLOT_H_
  9. class ScaleformUIImpl;
  10. #include "UtlStringMap.h"
  11. class BaseSlot
  12. {
  13. public:
  14. SF::GFx::MovieDef* m_pMovieDef;
  15. SF::GFx::Movie* m_pMovieView;
  16. SF::GFx::Value m_GlobalValue;
  17. SF::GFx::Value m_GameAPI;
  18. CUtlStringMap< SF::GFx::Value * > m_mapGlobalObjects;
  19. int m_iSlot;
  20. int m_iRefCount;
  21. bool m_bControllerUI;
  22. float m_fChangeControllerTimeout;
  23. protected:
  24. enum CVAR_TYPE_WANTED
  25. {
  26. CVAR_WANT_NUMBER,
  27. CVAR_WANT_NUMBER_MIN,
  28. CVAR_WANT_NUMBER_MAX,
  29. CVAR_WANT_STRING,
  30. CVAR_WANT_BOOL,
  31. };
  32. void GetConvar( SF::GFx::FunctionHandler::Params* params, CVAR_TYPE_WANTED typeWanted );
  33. bool ConvertValue( SF::GFx::Value *value, KeyValues* kv );
  34. void PopulateObject( SF::GFx::Value* value, KeyValues* kv );
  35. const char* PopulateArray( SF::GFx::Value* value, KeyValues* kv );
  36. public:
  37. BaseSlot();
  38. void CreateKeyTable();
  39. void Init( const char* movieName, int slot );
  40. void UpdateSafeZone( void );
  41. void UpdateTint( void );
  42. void AddRef( void );
  43. bool Release( void );
  44. void LoadKVFile( SCALEFORM_CALLBACK_ARGS_DECL );
  45. void SaveKVFile( SCALEFORM_CALLBACK_ARGS_DECL );
  46. void GetConvarNumber( SCALEFORM_CALLBACK_ARGS_DECL );
  47. void GetConvarNumberMin( SCALEFORM_CALLBACK_ARGS_DECL );
  48. void GetConvarNumberMax( SCALEFORM_CALLBACK_ARGS_DECL );
  49. void GetConvarString( SCALEFORM_CALLBACK_ARGS_DECL );
  50. void GetConvarBoolean( SCALEFORM_CALLBACK_ARGS_DECL );
  51. void GetPlayerColorObject( SCALEFORM_CALLBACK_ARGS_DECL );
  52. void SetConvar( SCALEFORM_CALLBACK_ARGS_DECL );
  53. void Translate( SCALEFORM_CALLBACK_ARGS_DECL );
  54. void ReplaceGlyphs( SCALEFORM_CALLBACK_ARGS_DECL );
  55. void GetPAXAvatarFromName(SCALEFORM_CALLBACK_ARGS_DECL);
  56. void SendUIEvent( SCALEFORM_CALLBACK_ARGS_DECL );
  57. void GetClipboardText( SCALEFORM_CALLBACK_ARGS_DECL );
  58. void SetClipboardText( SCALEFORM_CALLBACK_ARGS_DECL );
  59. void MakeStringSafe( SCALEFORM_CALLBACK_ARGS_DECL );
  60. bool HandleCharTyped( const wchar_t* typed, int slost );
  61. bool HandleKeyEvent( bool keyDown, ButtonCode_t code, ButtonCode_t vkey, const char* binding, int slot );
  62. void LockInputToSlot( int slot );
  63. void UnlockInput( void );
  64. bool SetToControllerUI( bool value, bool isKeyOrButtonPress );
  65. bool IsSetToControllerUI( void );
  66. void Advance( float time );
  67. void LockMostRecentInputDevice( void );
  68. void ConsoleCommand( SCALEFORM_CALLBACK_ARGS_DECL );
  69. void ConsoleCommandExecute( SCALEFORM_CALLBACK_ARGS_DECL );
  70. void ForceCollectGarbage( void );
  71. virtual void RequestElement( const char* elementName, ScaleformUIFunctionHandlerObject* object, const IScaleformUIFunctionHandlerDefinitionTable* tableObject )
  72. {
  73. }
  74. virtual void RemoveElement( SF::GFx::Value* element )
  75. {
  76. }
  77. virtual void InstallGlobalObject( const char* elementName, ScaleformUIFunctionHandlerObject* object, const IScaleformUIFunctionHandlerDefinitionTable* tableObject, SF::GFx::Value* *pInstalledGlobalObjectResult )
  78. {
  79. }
  80. virtual void RemoveGlobalObject( SF::GFx::Value* element )
  81. {
  82. }
  83. virtual const ScaleformUIFunctionHandlerDefinition* GetSlotAPITable( void )
  84. {
  85. return NULL;
  86. }
  87. virtual bool ConsumesInputEvents( void )
  88. {
  89. return true;
  90. }
  91. // SF4 TODO
  92. // We create slot 2 while loading the map and start calling advance on it. However, the qms doesn't call
  93. // render very often during this phase so the advance gets too far ahead of the renderer which causes SF
  94. // internal buffers to fill up. This is a hack to work around this and might need to be done differently
  95. volatile uint32 m_advanceCount;
  96. protected:
  97. virtual void Unload( void );
  98. };
  99. class MovieSlot: public BaseSlot
  100. {
  101. public:
  102. int m_iNumInputConsumers;
  103. bool m_bDisableAnalogNavigation;
  104. public:
  105. MovieSlot();
  106. public:
  107. void RequestElement( const char* elementName, ScaleformUIFunctionHandlerObject* object, const IScaleformUIFunctionHandlerDefinitionTable* tableObject );
  108. void RemoveElement( SF::GFx::Value* element );
  109. void InstallGlobalObject( const char* elementName, ScaleformUIFunctionHandlerObject* object, const IScaleformUIFunctionHandlerDefinitionTable* tableObject, SF::GFx::Value* *pInstalledGlobalObjectResult );
  110. void RemoveGlobalObject( SF::GFx::Value* element );
  111. const ScaleformUIFunctionHandlerDefinition* GetSlotAPITable();
  112. bool ConsumesInputEvents( void )
  113. {
  114. return m_iNumInputConsumers > 0;
  115. }
  116. public:
  117. void AddInputConsumer( SCALEFORM_CALLBACK_ARGS_DECL );
  118. void RemoveInputConsumer( SCALEFORM_CALLBACK_ARGS_DECL );
  119. void DenyInputToGameFromFlash( SCALEFORM_CALLBACK_ARGS_DECL );
  120. void SetCursorShape( SCALEFORM_CALLBACK_ARGS_DECL );
  121. void ShowCursor( SCALEFORM_CALLBACK_ARGS_DECL );
  122. void HideCursor( SCALEFORM_CALLBACK_ARGS_DECL );
  123. void PlaySoundScaleform( SCALEFORM_CALLBACK_ARGS_DECL );
  124. void DisableAnalogStickNavigation( SCALEFORM_CALLBACK_ARGS_DECL );
  125. bool AnalogStickNavigationDisabled( void );
  126. #if defined( _PS3 )
  127. void PS3UseMoveCursor( SCALEFORM_CALLBACK_ARGS_DECL );
  128. void PS3UseStandardCursor( SCALEFORM_CALLBACK_ARGS_DECL );
  129. void PS3ForceCursorStart( SCALEFORM_CALLBACK_ARGS_DECL );
  130. void PS3ForceCursorEnd( SCALEFORM_CALLBACK_ARGS_DECL );
  131. #endif
  132. };
  133. class CursorSlot: public BaseSlot
  134. {
  135. bool m_bUIHidden;
  136. public:
  137. CursorSlot() :
  138. m_bUIHidden( true )
  139. {
  140. }
  141. void SetCursorShape( int shape );
  142. void Hide( void );
  143. void Show( void );
  144. virtual bool IsHidden( void )
  145. {
  146. return m_bUIHidden;
  147. }
  148. virtual bool IsVisible( void )
  149. {
  150. return !m_bUIHidden;
  151. }
  152. };
  153. #endif /* MOVIESLOT_H_ */