CHalfLifeMultiplay :: CHalfLifeMultiplay() { g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); RefreshSkillData(); m_flIntermissionEndTime = 0; // 11/8/98 // Modified by YWB: Server .cfg file is now a cvar, so that // server ops can run multiple game servers, with different server .cfg files, // from a single installed directory. // Mapcyclefile is already a cvar. // 3/31/99 // Added lservercfg file cvar, since listen and dedicated servers should not // share a single config file. (sjb) if ( IS_DEDICATED_SERVER() ) { // this code has been moved into engine, to only run server.cfg once } else { // listen server char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" ); if ( lservercfgfile && lservercfgfile[0] ) { char szCommand[256]; ALERT( at_console, "Executing listen server config file\n" ); sprintf( szCommand, "exec %s\n", lservercfgfile ); SERVER_COMMAND( szCommand ); } } }
bool CGameRules::Init() { #ifndef CLIENT_DLL RefreshSkillData( true ); #endif return true; }
CHalfLifeMultiplay :: CHalfLifeMultiplay() { m_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); int length; char * pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length ); if ( pFileList ) g_bHaveMOTD = true; else g_bHaveMOTD = false; RefreshSkillData(); m_flIntermissionEndTime = 0; m_flGameEndTime = 0.0; // 11/8/98 // Modified by YWB: Server .cfg file is now a cvar, so that // server ops can run multiple game servers, with different server .cfg files, // from a single installed directory. // Mapcyclefile is already a cvar. // 3/31/99 // Added lservercfg file cvar, since listen and dedicated servers should not // share a single config file. (sjb) if ( IS_DEDICATED_SERVER() ) { // dedicated server char *servercfgfile = (char *)CVAR_GET_STRING( "servercfgfile" ); if ( servercfgfile && servercfgfile[0] ) { char szCommand[256]; ALERT( at_console, "Executing dedicated server config file\n" ); sprintf( szCommand, "exec %s\n", servercfgfile ); SERVER_COMMAND( szCommand ); } } else { // listen server char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" ); if ( lservercfgfile && lservercfgfile[0] ) { char szCommand[256]; ALERT( at_console, "Executing listen server config file\n" ); sprintf( szCommand, "exec %s\n", lservercfgfile ); SERVER_COMMAND( szCommand ); } } }
CHeadQuartersRules :: CHeadQuartersRules() { m_DisableDeathMessages = false; FirstBlood = false; g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); RefreshSkillData(); m_flIntermissionEndTime = 0; g_flIntermissionStartTime = 0; State = STATE_IDLE; CurrentBase = LastBase = NULL; LastCurrentTeam = -1; SERVER_COMMAND( "exec server.cfg\n" ); }
CMultiplayRules::CMultiplayRules() { RefreshSkillData( true ); // 11/8/98 // Modified by YWB: Server .cfg file is now a cvar, so that // server ops can run multiple game servers, with different server .cfg files, // from a single installed directory. // Mapcyclefile is already a cvar. // 3/31/99 // Added lservercfg file cvar, since listen and dedicated servers should not // share a single config file. (sjb) if ( engine->IsDedicatedServer() ) { // dedicated server const char *cfgfile = servercfgfile.GetString(); if ( cfgfile && cfgfile[0] ) { char szCommand[256]; Msg( "Executing dedicated server config file\n" ); Q_snprintf( szCommand,sizeof(szCommand), "exec %s\n", cfgfile ); engine->ServerCommand( szCommand ); } } else { // listen server const char *cfgfile = lservercfgfile.GetString(); if ( cfgfile && cfgfile[0] ) { char szCommand[256]; Msg( "Executing listen server config file\n" ); Q_snprintf( szCommand,sizeof(szCommand), "exec %s\n", cfgfile ); engine->ServerCommand( szCommand ); } } }
//========================================================= //========================================================= CSingleplayRules::CSingleplayRules( void ) { RefreshSkillData( true ); const char *cfgfile = defaultcfgfile.GetString(); if (cfgfile && cfgfile[0]) { char szCommand[256]; Log("Executing default gamemode config file %s\n", cfgfile); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfile); engine->ServerCommand(szCommand); } char mapcfg[256]; Q_snprintf(mapcfg, sizeof(mapcfg), "cfg/%s.cfg", STRING(gpGlobals->mapname)); Q_FixSlashes(mapcfg); Q_strlower(mapcfg); if (mapcfg) { char szCommandMap[256]; Log("Executing map config file %s\n", mapcfg); Q_snprintf(szCommandMap, sizeof(szCommandMap), "exec %s\n", mapcfg); engine->ServerCommand(szCommandMap); } char mapname[256]; #if !defined( CLIENT_DLL ) Q_snprintf(mapname, sizeof(mapname), "maps/%s", STRING(gpGlobals->mapname)); #else Q_strncpy(mapname, engine->GetLevelName(), sizeof(mapname)); #endif Q_FixSlashes(mapname); Q_strlower(mapname); if (V_stristr(mapname, "cf")) { SetGamemode(FIREFIGHT_PRIMARY_COMBINEFIREFIGHT); Log("Automatically setting the gamemode to COMBINE FIREFIGHT due to mapname.\n"); } else if (V_stristr(mapname, "xi")) { SetGamemode(FIREFIGHT_PRIMARY_XENINVASION); Log("Automatically setting the gamemode to XEN INVASION due to mapname.\n"); } else if (V_stristr(mapname, "aa")) { SetGamemode(FIREFIGHT_PRIMARY_ANTLIONASSAULT); Log("Automatically setting the gamemode to ANTLION ASSAULT due to mapname.\n"); } else if (V_stristr(mapname, "zs")) { SetGamemode(FIREFIGHT_PRIMARY_ZOMBIESURVIVAL); Log("Automatically setting the gamemode to ZOMBIE SURVIVAL due to mapname.\n"); } else if (V_stristr(mapname, "fr")) { SetGamemode(FIREFIGHT_PRIMARY_FIREFIGHTRUMBLE); Log("Automatically setting the gamemode to FIREFIGHT RUMBLE due to mapname.\n"); } if (GetGamemode() == FIREFIGHT_PRIMARY_DEFAULT) { if (bHasRandomized) { bHasRandomized = false; iRandomGamemode = 0; } Log("No gamemode defined! Randomizing gamemodes.\n"); SetGamemodeRandom(FIREFIGHT_PRIMARY_COMBINEFIREFIGHT, FIREFIGHT_PRIMARY_FIREFIGHTRUMBLE, true); bHasRandomized = true; } if (bHasRandomized) { if (iRandomGamemode == FIREFIGHT_PRIMARY_COMBINEFIREFIGHT) { // listen server const char *cfgfilecf = combinefirefightcfgfile.GetString(); if (cfgfilecf && cfgfilecf[0]) { char szCommand[256]; Log("Executing COMBINE FIREFIGHT gamemode config file %s\n", cfgfilecf); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilecf); engine->ServerCommand(szCommand); } } else if (iRandomGamemode == FIREFIGHT_PRIMARY_XENINVASION) { // listen server const char *cfgfilexi = xeninvasioncfgfile.GetString(); if (cfgfilexi && cfgfilexi[0]) { char szCommand[256]; Log("Executing XEN INVASION gamemode config file %s\n", cfgfilexi); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilexi); engine->ServerCommand(szCommand); } } else if (iRandomGamemode == FIREFIGHT_PRIMARY_ANTLIONASSAULT) { // listen server const char *cfgfileaa = antlionassaultcfgfile.GetString(); if (cfgfileaa && cfgfileaa[0]) { char szCommand[256]; Log("Executing ANTLION ASSAULT gamemode config file %s\n", cfgfileaa); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfileaa); engine->ServerCommand(szCommand); } } else if (iRandomGamemode == FIREFIGHT_PRIMARY_ZOMBIESURVIVAL) { // listen server const char *cfgfilezs = zombiesurvivalcfgfile.GetString(); if (cfgfilezs && cfgfilezs[0]) { char szCommand[256]; Log("Executing ZOMBIE SURVIVAL gamemode config file %s\n", cfgfilezs); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilezs); engine->ServerCommand(szCommand); } } else if (iRandomGamemode == FIREFIGHT_PRIMARY_FIREFIGHTRUMBLE) { // listen server const char *cfgfilefr = firefightrumblecfgfile.GetString(); if (cfgfilefr && cfgfilefr[0]) { char szCommand[256]; Log("Executing FIREFIGHT RUMBLE gamemode config file %s\n", cfgfilefr); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilefr); engine->ServerCommand(szCommand); } } } else { if (GetGamemode() == FIREFIGHT_PRIMARY_COMBINEFIREFIGHT) { // listen server const char *cfgfilecf = combinefirefightcfgfile.GetString(); if (cfgfilecf && cfgfilecf[0]) { char szCommand[256]; Log("Executing COMBINE FIREFIGHT gamemode config file %s\n", cfgfilecf); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilecf); engine->ServerCommand(szCommand); } } else if (GetGamemode() == FIREFIGHT_PRIMARY_XENINVASION) { // listen server const char *cfgfilexi = xeninvasioncfgfile.GetString(); if (cfgfilexi && cfgfilexi[0]) { char szCommand[256]; Log("Executing XEN INVASION gamemode config file %s\n", cfgfilexi); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilexi); engine->ServerCommand(szCommand); } } else if (GetGamemode() == FIREFIGHT_PRIMARY_ANTLIONASSAULT) { // listen server const char *cfgfileaa = antlionassaultcfgfile.GetString(); if (cfgfileaa && cfgfileaa[0]) { char szCommand[256]; Log("Executing ANTLION ASSAULT gamemode config file %s\n", cfgfileaa); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfileaa); engine->ServerCommand(szCommand); } } else if (GetGamemode() == FIREFIGHT_PRIMARY_ZOMBIESURVIVAL) { // listen server const char *cfgfilezs = zombiesurvivalcfgfile.GetString(); if (cfgfilezs && cfgfilezs[0]) { char szCommand[256]; Log("Executing ZOMBIE SURVIVAL gamemode config file %s\n", cfgfilezs); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilezs); engine->ServerCommand(szCommand); } } else if (GetGamemode() == FIREFIGHT_PRIMARY_FIREFIGHTRUMBLE) { // listen server const char *cfgfilefr = firefightrumblecfgfile.GetString(); if (cfgfilefr && cfgfilefr[0]) { char szCommand[256]; Log("Executing FIREFIGHT RUMBLE gamemode config file %s\n", cfgfilefr); Q_snprintf(szCommand, sizeof(szCommand), "exec %s\n", cfgfilefr); engine->ServerCommand(szCommand); } } } }
CHalfLifeRules::CHalfLifeRules(void) { RefreshSkillData(); }
//========================================================= //========================================================= CHalfLifeRules::CHalfLifeRules( void ) { RefreshSkillData(); g_TimerStart = -1; g_TimerFinish = -1; }
//========================================================= //========================================================= CSingleplayRules::CSingleplayRules( void ) { RefreshSkillData( true ); }
CHalfLifeRules::CHalfLifeRules() { m_bFreezePeriod = FALSE; RefreshSkillData(); }