// // D_DoomLoop // void D_DoomLoop (void) { while (1) { try { SV_RunTics (); // will run at least one tic } catch (CRecoverableError &error) { Printf (PRINT_HIGH, "ERROR: %s\n", error.GetMessage().c_str()); Printf (PRINT_HIGH, "sleeping for 10 seconds before map reload..."); // denis - drop clients SV_SendDisconnectSignal(); // denis - sleep to conserve server resources (in case of recurring problem) I_WaitForTic(I_GetTime() + 1000*10/TICRATE); // denis - reload with current settings G_ChangeMap (); // denis - todo - throw I_FatalError if this keeps happening } } }
// // D_DoomLoop // void D_DoomLoop (void) { while (1) { try { D_RunTics(SV_RunTics, SV_DisplayTics); } catch (CRecoverableError &error) { Printf (PRINT_HIGH, "ERROR: %s\n", error.GetMsg().c_str()); Printf (PRINT_HIGH, "sleeping for 10 seconds before map reload..."); // denis - drop clients SV_SendDisconnectSignal(); // denis - sleep 10 seconds to conserve server resources (in case of recurring problem) I_Sleep(10 * 1000LL * 1000LL * 1000LL); // denis - reload with current settings G_ChangeMap (); // denis - todo - throw I_FatalError if this keeps happening } } }
void target_level_change_use(gentity_t *self, gentity_t *other, gentity_t *activator) { G_ActivateBehavior(self,BSET_USE); if( self->message && !Q_stricmp( "disconnect", self->message ) ) { gi.SendConsoleCommand( "disconnect\n"); } else { G_ChangeMap( self->message, self->target, (self->spawnflags&1) ); } if (self->spawnflags&2) //HIDEINFO { gi.cvar_set("cg_missionstatusscreen", "0"); } else { gi.cvar_set("cg_missionstatusscreen", "1"); //turn it on! } }
void target_level_change_use(gentity_t *self, gentity_t *other, gentity_t *activator) { G_ActivateBehavior(self,BSET_USE); if( self->message && !Q_stricmp( "disconnect", self->message ) ) { gi.SendConsoleCommand( "disconnect\n"); } else { G_ChangeMap( self->message, self->target, (self->spawnflags&1) ); } if (self->count>=0) { gi.cvar_set("tier_storyinfo", va("%i",self->count)); if (level.mapname[0] == 't' && level.mapname[2] == '_' && ( level.mapname[1] == '1' || level.mapname[1] == '2' || level.mapname[1] == '3' ) ) { char s[2048]; gi.Cvar_VariableStringBuffer("tiers_complete", s, sizeof(s)); //get the current list if (*s) { gi.cvar_set("tiers_complete", va("%s %s", s, level.mapname)); //strcat this level into the existing list } else { gi.cvar_set("tiers_complete", level.mapname); //set this level into the list } } if (self->noise_index) { cgi_S_StopSounds(); cgi_S_StartSound( NULL, 0, CHAN_VOICE, cgs.sound_precache[ self->noise_index ] ); } } set_mission_stats_cvars(); }
void D_DoomMain (void) { const char *iwad; M_ClearRandom(); gamestate = GS_STARTUP; M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command // Always log by default if (!LOG.is_open()) C_DoCommand("logfile"); Printf (PRINT_HIGH, "Heapsize: %u megabytes\n", got_heapsize); M_LoadDefaults (); // load before initing other systems C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line iwad = Args.CheckValue("-iwad"); if(!iwad) iwad = ""; D_AddDefWads(iwad); D_AddCmdParameterFiles(); wadhashes = W_InitMultipleFiles (wadfiles); SV_InitMultipleFiles (wadfiles); // [RH] Initialize configurable strings. D_InitStrings (); D_DoDefDehackedPatch(); I_Init (); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks (); // [RH] User-configurable startup strings. Because BOOM does. if (STARTUP1[0]) Printf (PRINT_HIGH, "%s\n", STARTUP1); if (STARTUP2[0]) Printf (PRINT_HIGH, "%s\n", STARTUP2); if (STARTUP3[0]) Printf (PRINT_HIGH, "%s\n", STARTUP3); if (STARTUP4[0]) Printf (PRINT_HIGH, "%s\n", STARTUP4); if (STARTUP5[0]) Printf (PRINT_HIGH, "%s\n", STARTUP5); devparm = Args.CheckParm ("-devparm"); // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char *val = Args.CheckValue ("-skill"); if (val) { sv_skill.Set (val[0]-'0'); } if (devparm) Printf (PRINT_HIGH, "%s", Strings[0].builtin); // D_DEVSTR const char *v = Args.CheckValue ("-timer"); if (v) { double time = atof (v); Printf (PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); sv_timelimit.Set ((float)time); } const char *w = Args.CheckValue ("-avg"); if (w) { Printf (PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); sv_timelimit.Set (20); } // [RH] Now that all text strings are set up, // insert them into the level and cluster data. G_SetLevelStrings (); // [RH] Parse through all loaded mapinfo lumps G_ParseMapInfo (); // [RH] Parse any SNDINFO lumps S_ParseSndInfo(); // Check for -file in shareware if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_FatalError ("You cannot -file with the shareware version. Register!"); Printf (PRINT_HIGH, "R_Init: Init DOOM refresh daemon.\n"); R_Init (); Printf (PRINT_HIGH, "P_Init: Init Playloop state.\n"); P_Init (); Printf (PRINT_HIGH, "SV_InitNetwork: Checking network game status.\n"); SV_InitNetwork(); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-background")) daemon_init(); #endif // Use wads mentioned on the commandline to start with //std::vector<std::string> start_wads; //std::string custwad; //iwad = Args.CheckValue("-iwad"); //D_DoomWadReboot(start_wads); unsigned p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } strncpy(level.mapname, startmap, sizeof(level.mapname)); G_ChangeMap (); D_DoomLoop (); // never returns }
void D_DoomMain (void) { M_ClearRandom(); gamestate = GS_STARTUP; if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command I_Init (); D_CheckNetGame (); M_LoadDefaults (); // load before initing other systems M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line //D_AddDefWads(); //SV_InitMultipleFiles (wadfiles); //wadhashes = W_InitMultipleFiles (wadfiles); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks (); // [RH] Initialize configurable strings. D_InitStrings (); // [RH] User-configurable startup strings. Because BOOM does. if (STARTUP1[0]) Printf (PRINT_HIGH, "%s\n", STARTUP1); if (STARTUP2[0]) Printf (PRINT_HIGH, "%s\n", STARTUP2); if (STARTUP3[0]) Printf (PRINT_HIGH, "%s\n", STARTUP3); if (STARTUP4[0]) Printf (PRINT_HIGH, "%s\n", STARTUP4); if (STARTUP5[0]) Printf (PRINT_HIGH, "%s\n", STARTUP5); devparm = Args.CheckParm ("-devparm"); // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char *val = Args.CheckValue ("-skill"); if (val) { skill.Set (val[0]-'0'); } unsigned p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } if (devparm) Printf (PRINT_HIGH, "%s", Strings[0].builtin); // D_DEVSTR const char *v = Args.CheckValue ("-timer"); if (v) { double time = atof (v); Printf (PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); timelimit.Set ((float)time); } const char *w = Args.CheckValue ("-avg"); if (w) { Printf (PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); timelimit.Set (20); } // Check for -file in shareware if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_FatalError ("You cannot -file with the shareware version. Register!"); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-background")) daemon_init(); #endif // Use wads mentioned on the commandline to start with std::vector<std::string> start_wads; std::string custwad; const char *iwadparm = Args.CheckValue ("-iwad"); if (iwadparm) { custwad = iwadparm; FixPathSeparator (custwad); start_wads.push_back(custwad); } DArgs files = Args.GatherFiles ("-file", ".wad", true); if (files.NumArgs() > 0) { modifiedgame = true; for (size_t i = 0; i < files.NumArgs(); i++) { start_wads.push_back(files.GetArg (i)); } } D_DoomWadReboot(start_wads); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); strncpy(level.mapname, startmap, sizeof(level.mapname)); gamestate = GS_STARTUP; G_ChangeMap (); D_DoomLoop (); // never returns }
// // D_DoomMain // // [NightFang] - Cause I cant call ArgsSet from g_level.cpp // [ML] 23/1/07 - Add Response file support back in // void D_DoomMain() { unsigned int p; gamestate = GS_STARTUP; // init console so it can capture all of the startup messages C_InitConsole(); atterm(C_ShutdownConsole); W_SetupFileIdentifiers(); // [RH] Initialize items. Still only used for the give command. :-( InitItems(); M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError("Could not initialize LZO routines"); C_ExecCmdLineParams(false, true); // [Nes] test for +logfile command // Always log by default if (!LOG.is_open()) C_DoCommand("logfile"); M_LoadDefaults(); // load before initing other systems C_ExecCmdLineParams(true, false); // [RH] do all +set commands on the command line std::vector<std::string> newwadfiles, newpatchfiles; const char* iwad_filename_cstr = Args.CheckValue("-iwad"); if (iwad_filename_cstr) { std::string iwad_filename(iwad_filename_cstr); M_AppendExtension(iwad_filename, ".WAD"); newwadfiles.push_back(iwad_filename); } D_AddWadCommandLineFiles(newwadfiles); D_AddDehCommandLineFiles(newpatchfiles); D_LoadResourceFiles(newwadfiles, newpatchfiles); Printf(PRINT_HIGH, "I_Init: Init hardware.\n"); I_Init(); // [SL] Call init routines that need to be reinitialized every time WAD changes D_Init(); atterm(D_Shutdown); Printf(PRINT_HIGH, "SV_InitNetwork: Checking network game status.\n"); SV_InitNetwork(); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks(); // [RH] User-configurable startup strings. Because BOOM does. if (GStrings(STARTUP1)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP1)); if (GStrings(STARTUP2)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP2)); if (GStrings(STARTUP3)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP3)); if (GStrings(STARTUP4)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP4)); if (GStrings(STARTUP5)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP5)); // developer mode devparm = Args.CheckParm("-devparm"); if (devparm) Printf (PRINT_HIGH, "%s", GStrings(D_DEVSTR)); // D_DEVSTR // Nomonsters if (Args.CheckParm("-nomonsters")) sv_nomonsters = 1; // Respawn if (Args.CheckParm("-respawn")) sv_monstersrespawn = 1; // Fast if (Args.CheckParm("-fast")) sv_fastmonsters = 1; // get skill / episode / map from parms strcpy(startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char* val = Args.CheckValue("-skill"); if (val) sv_skill.Set(val[0] - '0'); p = Args.CheckParm("-timer"); if (p && p < Args.NumArgs() - 1) { float time = atof(Args.GetArg(p + 1)); Printf(PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); sv_timelimit.Set(time); } if (Args.CheckValue("-avg")) { Printf(PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); sv_timelimit.Set(20); } // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet(); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams(false, false); // [AM] Initialize banlist SV_InitBanlist(); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-fork")) daemon_init(); #endif p = Args.CheckParm("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi(Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy(startmap, CalcMapName(ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm("+map"); if (p && p < Args.NumArgs() - 1) { strncpy(startmap, Args.GetArg(p + 1), 8); ((char*)Args.GetArg(p))[0] = '-'; autostart = true; } strncpy(level.mapname, startmap, sizeof(level.mapname)); G_ChangeMap(); D_DoomLoop(); // never returns }