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.

112 lines
3.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "game.h"
  10. #include "physics.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include "tier0/memdbgon.h"
  13. void MapCycleFileChangedCallback( IConVar *var, const char *pOldString, float flOldValue )
  14. {
  15. if ( Q_stricmp( pOldString, mapcyclefile.GetString() ) != 0 )
  16. {
  17. if ( GameRules() )
  18. {
  19. // For multiplayer games, forces the mapcyclefile to be reloaded
  20. GameRules()->ResetMapCycleTimeStamp();
  21. }
  22. }
  23. }
  24. ConVar displaysoundlist( "displaysoundlist","0" );
  25. ConVar mapcyclefile( "mapcyclefile", "mapcycle.txt", FCVAR_NONE, "Name of the .txt file used to cycle the maps on multiplayer servers ", MapCycleFileChangedCallback );
  26. ConVar loopsingleplayermaps("loopsingleplayermaps", "0", FCVAR_REPLICATED | FCVAR_CHEAT );
  27. ConVar servercfgfile( "servercfgfile","server.cfg", FCVAR_RELEASE );
  28. #if defined(_GAMECONSOLE)
  29. ConVar lservercfgfile( "lservercfgfile","listenserver360.cfg" );
  30. #else
  31. ConVar lservercfgfile( "lservercfgfile","listenserver.cfg" );
  32. #endif
  33. // multiplayer server rules
  34. ConVar teamplay( "mp_teamplay","0", FCVAR_NOTIFY );
  35. ConVar falldamage( "mp_falldamage","0", FCVAR_NOTIFY );
  36. ConVar weaponstay( "mp_weaponstay","0", FCVAR_NOTIFY );
  37. ConVar forcerespawn( "mp_forcerespawn","1", FCVAR_NOTIFY );
  38. ConVar footsteps( "mp_footsteps","1", FCVAR_NOTIFY );
  39. ConVar flashlight( "mp_flashlight","0", FCVAR_NOTIFY );
  40. ConVar aimcrosshair( "mp_autocrosshair","1", FCVAR_NOTIFY );
  41. ConVar teamlist( "mp_teamlist","hgrunt;scientist", FCVAR_NOTIFY );
  42. ConVar teamoverride( "mp_teamoverride","1" );
  43. ConVar defaultteam( "mp_defaultteam","0" );
  44. ConVar allowNPCs( "mp_allowNPCs","1", FCVAR_NOTIFY );
  45. // Engine Cvars
  46. const ConVar *g_pDeveloper = NULL;
  47. ConVar suitvolume( "suitvolume", "0.25", FCVAR_ARCHIVE );
  48. class CGameDLL_ConVarAccessor : public IConCommandBaseAccessor
  49. {
  50. public:
  51. virtual bool RegisterConCommandBase( ConCommandBase *pCommand )
  52. {
  53. // Remember "unlinked" default value for replicated cvars
  54. bool replicated = pCommand->IsFlagSet( FCVAR_REPLICATED );
  55. const char *defvalue = NULL;
  56. if ( replicated && !pCommand->IsCommand() )
  57. {
  58. defvalue = ( ( ConVar * )pCommand)->GetDefault();
  59. }
  60. // Link to engine's list instead
  61. cvar->RegisterConCommand( pCommand );
  62. // Apply any command-line values.
  63. const char *pValue = cvar->GetCommandLineValue( pCommand->GetName() );
  64. if( pValue )
  65. {
  66. if ( !pCommand->IsCommand() )
  67. {
  68. ( ( ConVar * )pCommand )->SetValue( pValue );
  69. }
  70. }
  71. else
  72. {
  73. // NOTE: If not overridden at the command line, then if it's a replicated cvar, make sure that it's
  74. // value is the server's value. This solves a problem where think_limit is defined in shared
  75. // code but the value is inside and #if defined( _DEBUG ) block and if you have a debug game .dll
  76. // and a release client, then the limiit was coming from the client even though the server value
  77. // was the one that was important during debugging. Now the server trumps the client value for
  78. // replicated ConVars by setting the value here after the ConVar has been linked.
  79. if ( replicated && defvalue && !pCommand->IsCommand() )
  80. {
  81. ConVar *var = ( ConVar * )pCommand;
  82. var->SetValue( defvalue );
  83. }
  84. }
  85. return true;
  86. }
  87. };
  88. static CGameDLL_ConVarAccessor g_ConVarAccessor;
  89. // Register your console variables here
  90. // This gets called one time when the game is initialied
  91. void InitializeCvars( void )
  92. {
  93. // Register cvars here:
  94. ConVar_Register( FCVAR_GAMEDLL, &g_ConVarAccessor );
  95. g_pDeveloper = cvar->FindVar( "developer" );
  96. }