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.

123 lines
3.8 KiB

  1. //===== Copyright � 2005-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: A higher level link library for general use in the game and tools.
  4. //
  5. //===========================================================================//
  6. #ifndef TIER2_H
  7. #define TIER2_H
  8. #if defined( _WIN32 )
  9. #pragma once
  10. #endif
  11. #include "tier1/tier1.h"
  12. //-----------------------------------------------------------------------------
  13. // Call this to connect to/disconnect from all tier 2 libraries.
  14. // It's up to the caller to check the globals it cares about to see if ones are missing
  15. //-----------------------------------------------------------------------------
  16. void ConnectTier2Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount );
  17. void DisconnectTier2Libraries();
  18. //-----------------------------------------------------------------------------
  19. // Call this to get the file system set up to stdio for utilities, etc:
  20. //-----------------------------------------------------------------------------
  21. void InitDefaultFileSystem(void);
  22. void ShutdownDefaultFileSystem(void);
  23. //-----------------------------------------------------------------------------
  24. // for simple utilities using valve libraries, call the entry point below in main(). It will
  25. // init a filesystem for you, init mathlib, and create the command line. Note that this function
  26. // may modify argc/argv because it filters out arguments (like -allowdebug).
  27. //-----------------------------------------------------------------------------
  28. void InitCommandLineProgram( int &argc, char ** &argv );
  29. //-----------------------------------------------------------------------------
  30. // Helper empty implementation of an IAppSystem for tier2 libraries
  31. //-----------------------------------------------------------------------------
  32. template< class IInterface, int ConVarFlag = 0 >
  33. class CTier2AppSystem : public CTier1AppSystem< IInterface, ConVarFlag >
  34. {
  35. typedef CTier1AppSystem< IInterface, ConVarFlag > BaseClass;
  36. public:
  37. virtual bool Connect( CreateInterfaceFn factory )
  38. {
  39. if ( !BaseClass::Connect( factory ) )
  40. return false;
  41. ConnectTier2Libraries( &factory, 1 );
  42. return true;
  43. }
  44. virtual InitReturnVal_t Init()
  45. {
  46. InitReturnVal_t nRetVal = BaseClass::Init();
  47. if ( nRetVal != INIT_OK )
  48. return nRetVal;
  49. return INIT_OK;
  50. }
  51. virtual AppSystemTier_t GetTier()
  52. {
  53. return APP_SYSTEM_TIER2;
  54. }
  55. virtual void Shutdown()
  56. {
  57. BaseClass::Shutdown();
  58. }
  59. virtual void Disconnect()
  60. {
  61. DisconnectTier2Libraries();
  62. BaseClass::Disconnect();
  63. }
  64. };
  65. //-----------------------------------------------------------------------------
  66. // Distance fade information
  67. //-----------------------------------------------------------------------------
  68. enum FadeMode_t
  69. {
  70. // These map directly to cpu_level, and g_aFadeData contains settings for each given cpu_level (see videocfg.h CPULevel_t).
  71. // The exception is 'FADE_MODE_LEVEL', which refers to level-specific values in the map entity.
  72. FADE_MODE_NONE = 0,
  73. FADE_MODE_LOW,
  74. FADE_MODE_MED,
  75. FADE_MODE_HIGH,
  76. FADE_MODE_360,
  77. FADE_MODE_PS3,
  78. FADE_MODE_LEVEL,
  79. FADE_MODE_COUNT,
  80. };
  81. struct FadeData_t
  82. {
  83. float m_flPixelMin; // Size (height in pixels) above which objects start to fade in
  84. float m_flPixelMax; // Size (height in pixels) above which objects are fully faded in
  85. float m_flWidth; // Reference screen res w.r.t which the above pixel values were chosen
  86. float m_flFadeDistScale; // Scale factor applied before entity distance-based fade is calculated
  87. };
  88. // see tier2.cpp for data!
  89. extern FadeData_t g_aFadeData[FADE_MODE_COUNT];
  90. //-----------------------------------------------------------------------------
  91. // Used by the resource system for fast resource frame counter
  92. //-----------------------------------------------------------------------------
  93. extern uint32 g_nResourceFrameCount;
  94. #endif // TIER2_H