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.

85 lines
3.0 KiB

  1. //===== Copyright (c) 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. #include <tier2/tier2.h>
  7. #include "tier0/dbg.h"
  8. #include "tier2/resourceprecacher.h"
  9. #include "resourcesystem/iresourcesystem.h"
  10. // NOTE: This has to be the last file included!
  11. #include "tier0/memdbgon.h"
  12. //-----------------------------------------------------------------------------
  13. // These tier2 libraries must be set by any users of this library.
  14. // They can be set by calling ConnectTier2Libraries or InitDefaultFileSystem.
  15. // It is hoped that setting this, and using this library will be the common mechanism for
  16. // allowing link libraries to access tier2 library interfaces
  17. //-----------------------------------------------------------------------------
  18. // Fade data.
  19. FadeData_t g_aFadeData[FADE_MODE_COUNT] =
  20. {
  21. // PixelMin PixelMax Width DistScale FadeMode_t
  22. #ifdef CSTRIKE15
  23. // Ensure fade settings are consistent across CPU levels in CS:GO.
  24. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_NONE
  25. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_LOW
  26. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_MED
  27. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_HIGH
  28. #else
  29. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_NONE
  30. { 10.0f, 15.0f, 800.0f, 1.0f }, // FADE_MODE_LOW
  31. { 5.0f, 10.0f, 1024.0f, 1.0f }, // FADE_MODE_MED
  32. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_HIGH
  33. #endif
  34. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_360
  35. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_PS3
  36. { 0.0f, 0.0f, 1280.0f, 1.0f }, // FADE_MODE_LEVEL
  37. };
  38. //-----------------------------------------------------------------------------
  39. // Used by the resource system for fast resource frame counter
  40. //-----------------------------------------------------------------------------
  41. uint32 g_nResourceFrameCount;
  42. static bool s_bResourceFCRegistered;
  43. static bool s_bPrecachesRegistered;
  44. //-----------------------------------------------------------------------------
  45. // Call this to connect to all tier 2 libraries.
  46. // It's up to the caller to check the globals it cares about to see if ones are missing
  47. //-----------------------------------------------------------------------------
  48. void ConnectTier2Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount )
  49. {
  50. if ( g_pPrecacheSystem && !s_bPrecachesRegistered )
  51. {
  52. // Make all the PRECACHE_ macros register w/precache system now that it's connected
  53. CBaseResourcePrecacher::RegisterAll();
  54. s_bPrecachesRegistered = true;
  55. }
  56. if ( g_pResourceSystem && !s_bResourceFCRegistered )
  57. {
  58. g_pResourceSystem->RegisterFrameCounter( &g_nResourceFrameCount );
  59. s_bResourceFCRegistered = true;
  60. CSchemaClassBindingBase::Install();
  61. }
  62. }
  63. void DisconnectTier2Libraries()
  64. {
  65. if ( g_pResourceSystem && s_bResourceFCRegistered )
  66. {
  67. g_pResourceSystem->UnregisterFrameCounter( &g_nResourceFrameCount );
  68. s_bResourceFCRegistered = false;
  69. }
  70. }