public override void Execute( ) { SCR.EndLoadingPlaque(); if (Globals.cl.attractloop) { Cbuf.AddText("killserver\\n"); return; } if (Globals.cls.state == Defines.ca_disconnected) { Cbuf.AddText("d1\\n"); return; } Key.ClearTyping(); Con.ClearNotify(); if (Globals.cls.key_dest == Defines.key_console) { Menu.ForceMenuOff(); Cvar.Set("paused", "0"); } else { Menu.ForceMenuOff(); Globals.cls.key_dest = Defines.key_console; if (Cvar.VariableValue("maxclients") == 1 && Globals.server_state != 0) { Cvar.Set("paused", "1"); } } }
public static void Init(String[] args) { try { Com.InitArgv(args); Cbuf.Init(); Cmd.Init(); Cvar.Init(); Key.Init(); Cbuf.AddEarlyCommands(false); Cbuf.Execute(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.SetStatus("initializing filesystem..."); } FS.InitFilesystem(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.SetStatus("loading config..."); } Reconfigure(false); FS.SetCDDir(); FS.MarkBaseSearchPaths(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.TestQ2Data(); } Reconfigure(true); Cmd.AddCommand("error", Com.Error_f); Globals.host_speeds = Cvar.Get("host_speeds", "0", 0); Globals.log_stats = Cvar.Get("log_stats", "0", 0); Globals.developer = Cvar.Get("developer", "0", CVAR_ARCHIVE); Globals.timescale = Cvar.Get("timescale", "0", 0); Globals.fixedtime = Cvar.Get("fixedtime", "0", 0); Globals.logfile_active = Cvar.Get("logfile", "0", 0); Globals.showtrace = Cvar.Get("showtrace", "0", 0); Globals.dedicated = Cvar.Get("dedicated", "0", CVAR_NOSET); var s = Com.Sprintf("%4.2f %s %s %s", Globals.VERSION, CPUSTRING, Globals.__DATE__, BUILDSTRING); Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.SetStatus("initializing network subsystem..."); } NET.Init(); Netchan.Netchan_Init(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.SetStatus("initializing server subsystem..."); } SV_MAIN.SV_Init(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.SetStatus("initializing client subsystem..."); } CL.Init(); if (!Cbuf.AddLateCommands()) { if (Globals.dedicated.value == 0) { Cbuf.AddText("d1\\n"); } else { Cbuf.AddText("dedicated_start\\n"); } Cbuf.Execute(); } else { SCR.EndLoadingPlaque(); } Com.Printf("====== Quake2 Initialized ======\\n\\n"); CL.WriteConfiguration(); if (Globals.dedicated.value != 1F) { Program.Q2Dialog.Dispose(); } } catch (longjmpException e) { CoreSys.Error("Error during initialization"); } }
public static void ParseFrame( ) { Int32 cmd; Int32 len; frame_t old; Globals.cl.frame.Reset(); Globals.cl.frame.serverframe = MSG.ReadLong(Globals.net_message); Globals.cl.frame.deltaframe = MSG.ReadLong(Globals.net_message); Globals.cl.frame.servertime = Globals.cl.frame.serverframe * 100; if (Globals.cls.serverProtocol != 26) { Globals.cl.surpressCount = MSG.ReadByte(Globals.net_message); } if (Globals.cl_shownet.value == 3) { Com.Printf(" frame:" + Globals.cl.frame.serverframe + " delta:" + Globals.cl.frame.deltaframe + "\\n"); } if (Globals.cl.frame.deltaframe <= 0) { Globals.cl.frame.valid = true; old = null; Globals.cls.demowaiting = false; } else { old = Globals.cl.frames[Globals.cl.frame.deltaframe & Defines.UPDATE_MASK]; if (!old.valid) { Com.Printf("Delta from invalid frame (not supposed to happen!).\\n"); } if (old.serverframe != Globals.cl.frame.deltaframe) { Com.Printf("Delta frame too old.\\n"); } else if (Globals.cl.parse_entities - old.parse_entities > Defines.MAX_PARSE_ENTITIES - 128) { Com.Printf("Delta parse_entities too old.\\n"); } else { Globals.cl.frame.valid = true; } } if (Globals.cl.time > Globals.cl.frame.servertime) { Globals.cl.time = Globals.cl.frame.servertime; } else if (Globals.cl.time < Globals.cl.frame.servertime - 100) { Globals.cl.time = Globals.cl.frame.servertime - 100; } len = MSG.ReadByte(Globals.net_message); MSG.ReadData(Globals.net_message, Globals.cl.frame.areabits, len); cmd = MSG.ReadByte(Globals.net_message); CL_parse.SHOWNET(CL_parse.svc_strings[cmd]); if (cmd != Defines.svc_playerinfo) { Com.Error(Defines.ERR_DROP, "CL_ParseFrame: not playerinfo"); } ParsePlayerstate(old, Globals.cl.frame); cmd = MSG.ReadByte(Globals.net_message); CL_parse.SHOWNET(CL_parse.svc_strings[cmd]); if (cmd != Defines.svc_packetentities) { Com.Error(Defines.ERR_DROP, "CL_ParseFrame: not packetentities"); } ParsePacketEntities(old, Globals.cl.frame); Globals.cl.frames[Globals.cl.frame.serverframe & Defines.UPDATE_MASK].Set(Globals.cl.frame); if (Globals.cl.frame.valid) { if (Globals.cls.state != Defines.ca_active) { Globals.cls.state = Defines.ca_active; Globals.cl.force_refdef = true; Globals.cl.predicted_origin[0] = Globals.cl.frame.playerstate.pmove.origin[0] * 0.125F; Globals.cl.predicted_origin[1] = Globals.cl.frame.playerstate.pmove.origin[1] * 0.125F; Globals.cl.predicted_origin[2] = Globals.cl.frame.playerstate.pmove.origin[2] * 0.125F; Math3D.VectorCopy(Globals.cl.frame.playerstate.viewangles, Globals.cl.predicted_angles); if (Globals.cls.disable_servercount != Globals.cl.servercount && Globals.cl.refresh_prepped) { SCR.EndLoadingPlaque(); } } Globals.cl.sound_prepped = true; FireEntityEvents(Globals.cl.frame); CL_pred.CheckPredictionError(); } }
/** * This function initializes the different subsystems of * the game engine. The setjmp/longjmp mechanism of the original * was replaced with exceptions. * @param args the original unmodified command line arguments */ public static void Init(string[] args) { try { // prepare enough of the subsystems to handle // cvar and command buffer management Com.InitArgv(args); Cbuf.Init(); Cmd.Init(); Cvar.Init(); Key.Init(); // we need to add the early commands twice, because // a basedir or cddir needs to be set before execing // config files, but we want other parms to override // the settings of the config files Cbuf.AddEarlyCommands(false); Cbuf.Execute(); if (Globals.dedicated.value != 1.0f) { Console.WriteLine("initializing filesystem..."); } FS.InitFilesystem(); if (Globals.dedicated.value != 1.0f) { Console.WriteLine("loading config..."); } Qcommon.reconfigure(false); FS.markBaseSearchPaths(); // mark the default search paths Qcommon.reconfigure(true); // reload default.cfg and config.cfg // // init commands and vars // Cmd.AddCommand("error", Com.Error_f); Globals.host_speeds = Cvar.Get("host_speeds", "0", 0); Globals.log_stats = Cvar.Get("log_stats", "0", 0); Globals.developer = Cvar.Get("developer", "0", Defines.CVAR_ARCHIVE); Globals.timescale = Cvar.Get("timescale", "0", 0); Globals.fixedtime = Cvar.Get("fixedtime", "0", 0); Globals.logfile_active = Cvar.Get("logfile", "0", 0); Globals.showtrace = Cvar.Get("showtrace", "0", 0); Globals.dedicated = Cvar.Get("dedicated", "0", Defines.CVAR_NOSET); var s = Com.sprintf("%4.2f %s %s %s", Globals.VERSION, Qcommon.CPUSTRING, Globals.__DATE__, Qcommon.BUILDSTRING); Cvar.Get("version", s, Defines.CVAR_SERVERINFO | Defines.CVAR_NOSET); if (Globals.dedicated.value != 1.0f) { Console.WriteLine("initializing network subsystem..."); } NET.Init(); //ok Netchan.Netchan_Init(); //ok if (Globals.dedicated.value != 1.0f) { Console.WriteLine("initializing server subsystem..."); } SV_MAIN.SV_Init(); //ok if (Globals.dedicated.value != 1.0f) { Console.WriteLine("initializing client subsystem..."); } Cl.Init(); // add + commands from command line if (!Cbuf.AddLateCommands()) { // if the user didn't give any commands, run default action if (Globals.dedicated.value == 0) { Cbuf.AddText("d1\n"); } else { Cbuf.AddText("dedicated_start\n"); } Cbuf.Execute(); } else { // the user asked for something explicit // so drop the loading plaque SCR.EndLoadingPlaque(); } Com.Printf("====== Quake2 Initialized ======\n\n"); // save config when configuration is completed Cl.WriteConfiguration(); } catch (Exception) { Sys.Error("Error during initialization"); } }