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.

103 lines
2.9 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "dme_controls/dmecontrols.h"
  8. #include "soundemittersystem/isoundemittersystembase.h"
  9. #include "matsys_controls/matsyscontrols.h"
  10. #include "toolframework/ienginetool.h"
  11. #include "vphysics_interface.h"
  12. #include "dme_controls/inotifyui.h"
  13. #include "tier3/tier3.h"
  14. // memdbgon must be the last include file in a .cpp file!!!
  15. #include "tier0/memdbgon.h"
  16. namespace vgui
  17. {
  18. ISoundEmitterSystemBase *g_pSoundEmitterSystem = NULL;
  19. ISoundEmitterSystemBase *SoundEmitterSystem()
  20. {
  21. return g_pSoundEmitterSystem;
  22. }
  23. IEngineTool *enginetools = NULL;
  24. IEngineTool *EngineTool()
  25. {
  26. return enginetools;
  27. }
  28. IPhysicsCollision *g_pPhysicsCollision = NULL;
  29. IPhysicsCollision *PhysicsCollision()
  30. {
  31. return g_pPhysicsCollision;
  32. }
  33. class CDefaultElementPropertiesChoices : public CBaseElementPropertiesChoices
  34. {
  35. public:
  36. };
  37. static CDefaultElementPropertiesChoices s_DefaultChoices;
  38. IElementPropertiesChoices *g_pElementPropertiesChoices = &s_DefaultChoices;
  39. IElementPropertiesChoices *ElementPropertiesChoices()
  40. {
  41. return g_pElementPropertiesChoices;
  42. }
  43. void SetElementPropertiesChoices( IElementPropertiesChoices *pElementPropertiesChoices )
  44. {
  45. g_pElementPropertiesChoices = pElementPropertiesChoices ? pElementPropertiesChoices : &s_DefaultChoices;
  46. }
  47. //-----------------------------------------------------------------------------
  48. // Purpose: finds a particular interface in the factory set
  49. //-----------------------------------------------------------------------------
  50. static void *InitializeInterface( char const *interfaceName, CreateInterfaceFn *factoryList, int numFactories )
  51. {
  52. void *retval;
  53. for ( int i = 0; i < numFactories; i++ )
  54. {
  55. CreateInterfaceFn factory = factoryList[ i ];
  56. if ( !factory )
  57. continue;
  58. retval = factory( interfaceName, NULL );
  59. if ( retval )
  60. return retval;
  61. }
  62. // No provider for requested interface!!!
  63. // Assert( !"No provider for requested interface!!!" );
  64. return NULL;
  65. }
  66. //-----------------------------------------------------------------------------
  67. // Purpose: Initializes the controls
  68. //-----------------------------------------------------------------------------
  69. bool VGui_InitDmeInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories )
  70. {
  71. if ( !vgui::VGui_InitMatSysInterfacesList( moduleName, factoryList, numFactories ) )
  72. return false;
  73. g_pSoundEmitterSystem = (ISoundEmitterSystemBase*)InitializeInterface( SOUNDEMITTERSYSTEM_INTERFACE_VERSION, factoryList, numFactories );
  74. enginetools = (IEngineTool*)InitializeInterface( VENGINETOOL_INTERFACE_VERSION, factoryList, numFactories );
  75. g_pPhysicsCollision = (IPhysicsCollision*)InitializeInterface( VPHYSICS_COLLISION_INTERFACE_VERSION, factoryList, numFactories );
  76. // Can function without either of these
  77. return true;
  78. }
  79. } // namespace vgui