/* * ================ * SV_CopySaveGame * ================ */ public static void SV_CopySaveGame(string src, string dst) { Com.DPrintf("SV_CopySaveGame(" + src + "," + dst + ")\n"); SV_CCMDS.SV_WipeSavegame(dst); // copy the savegame over var name = FS.Gamedir() + "/save/" + src + "/server.ssv"; var name2 = FS.Gamedir() + "/save/" + dst + "/server.ssv"; FS.CreatePath(name2); SV_CCMDS.CopyFile(name, name2); name = FS.Gamedir() + "/save/" + src + "/game.ssv"; name2 = FS.Gamedir() + "/save/" + dst + "/game.ssv"; SV_CCMDS.CopyFile(name, name2); var name1 = FS.Gamedir() + "/save/" + src + "/"; name = FS.Gamedir() + "/save/" + src + "/*.sav"; var found = Sys.FindFirst(name, 0, 0); while (found != null) { name = name1 + Path.GetFileName(found); name2 = FS.Gamedir() + "/save/" + dst + "/" + Path.GetFileName(found); SV_CCMDS.CopyFile(name, name2); // change sav to sv2 name = name[..^ 3] + "sv2";
/** * SV_CheckForSavegame. */ public static void SV_CheckForSavegame() { string name; int i; if (SV_MAIN.sv_noreload.value != 0) { return; } if (Cvar.VariableValue("deathmatch") != 0) { return; } name = FS.Gamedir() + "/save/current/" + SV_INIT.sv.name + ".sav"; if (!File.Exists(name)) { return; } SV_WORLD.SV_ClearWorld(); // get configstrings and areaportals SV_CCMDS.SV_ReadLevelFile(); if (!SV_INIT.sv.loadgame) { // coming back to a level after being in a different // level, so run it for ten seconds // rlava2 was sending too many lightstyles, and overflowing the // reliable data. temporarily changing the server state to loading // prevents these from being passed down. int previousState; // PGM previousState = SV_INIT.sv.state; // PGM SV_INIT.sv.state = Defines.ss_loading; // PGM for (i = 0; i < 100; i++) { GameBase.G_RunFrame(); } SV_INIT.sv.state = previousState; // PGM } }
/** * Only called at quake2.exe startup, not for each game */ public static void SV_Init() { SV_CCMDS.SV_InitOperatorCommands(); //ok. SV_MAIN.rcon_password = Cvar.Get("rcon_password", "", 0); Cvar.Get("skill", "1", 0); Cvar.Get("deathmatch", "0", Defines.CVAR_LATCH); Cvar.Get("coop", "0", Defines.CVAR_LATCH); Cvar.Get("dmflags", "" + Defines.DF_INSTANT_ITEMS, Defines.CVAR_SERVERINFO); Cvar.Get("fraglimit", "0", Defines.CVAR_SERVERINFO); Cvar.Get("timelimit", "0", Defines.CVAR_SERVERINFO); Cvar.Get("cheats", "0", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); Cvar.Get("protocol", "" + Defines.PROTOCOL_VERSION, Defines.CVAR_SERVERINFO | Defines.CVAR_NOSET); SV_MAIN.maxclients = Cvar.Get("maxclients", "1", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); SV_MAIN.hostname = Cvar.Get("hostname", "noname", Defines.CVAR_SERVERINFO | Defines.CVAR_ARCHIVE); SV_MAIN.timeout = Cvar.Get("timeout", "125", 0); SV_MAIN.zombietime = Cvar.Get("zombietime", "2", 0); SV_MAIN.sv_showclamp = Cvar.Get("showclamp", "0", 0); SV_MAIN.sv_paused = Cvar.Get("paused", "0", 0); SV_MAIN.sv_timedemo = Cvar.Get("timedemo", "0", 0); SV_MAIN.sv_enforcetime = Cvar.Get("sv_enforcetime", "0", 0); SV_MAIN.allow_download = Cvar.Get("allow_download", "1", Defines.CVAR_ARCHIVE); SV_MAIN.allow_download_players = Cvar.Get("allow_download_players", "0", Defines.CVAR_ARCHIVE); SV_MAIN.allow_download_models = Cvar.Get("allow_download_models", "1", Defines.CVAR_ARCHIVE); SV_MAIN.allow_download_sounds = Cvar.Get("allow_download_sounds", "1", Defines.CVAR_ARCHIVE); SV_MAIN.allow_download_maps = Cvar.Get("allow_download_maps", "1", Defines.CVAR_ARCHIVE); SV_MAIN.sv_noreload = Cvar.Get("sv_noreload", "0", 0); SV_MAIN.sv_airaccelerate = Cvar.Get("sv_airaccelerate", "0", Defines.CVAR_LATCH); SV_MAIN.public_server = Cvar.Get("public", "0", 0); SV_MAIN.sv_reconnect_limit = Cvar.Get("sv_reconnect_limit", "3", Defines.CVAR_ARCHIVE); SZ.Init(Globals.net_message, Globals.net_message_buffer, Globals.net_message_buffer.Length); }