예제 #1
0
        static void Reconfigure(Boolean clear)
        {
            var dir = Cvar.Get("cddir", "", CVAR_ARCHIVE).string_renamed;

            Cbuf.AddText("exec default.cfg\\n");
            Cbuf.AddText("bind MWHEELUP weapnext\\n");
            Cbuf.AddText("bind MWHEELDOWN weapprev\\n");
            Cbuf.AddText("bind w +forward\\n");
            Cbuf.AddText("bind s +back\\n");
            Cbuf.AddText("bind a +moveleft\\n");
            Cbuf.AddText("bind d +moveright\\n");
            Cbuf.Execute();
            Cvar.Set("vid_fullscreen", "0");
            Cbuf.AddText("exec config.cfg\\n");
            Cbuf.AddEarlyCommands(clear);
            Cbuf.Execute();
            if (!("".Equals(dir)))
            {
                Cvar.Set("cddir", dir);
            }
        }
예제 #2
0
        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");
            }
        }