Beispiel #1
0
        public static void Init(quakeparms_t parms)
        {
            _Params = parms;

            Cache.Init(1024 * 1024 * 16); // debug
            Cbuf.Init();
            Cmd.Init();
            View.Init();
            Chase.Init();
            InitVCR(parms);
            Common.Init(parms.basedir, parms.argv);
            InitLocal();
            Wad.LoadWadFile("gfx.wad");
            Key.Init();
            Con.Init();
            Menu.Init();
            Progs.Init();
            Mod.Init();
            Net.Init();
            Server.Init();

            //Con.Print("Exe: "__TIME__" "__DATE__"\n");
            //Con.Print("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));

            Render.InitTextures();              // needed even for dedicated servers

            if (Client.Cls.state != ClientActivityState.Dedicated)
            {
                _BasePal = Common.LoadFile("gfx/palette.lmp");
                if (_BasePal == null)
                {
                    Sys.Error("Couldn't load gfx/palette.lmp");
                }

                _ColorMap = Common.LoadFile("gfx/colormap.lmp");
                if (_ColorMap == null)
                {
                    Sys.Error("Couldn't load gfx/colormap.lmp");
                }

                // on non win32, mouse comes before video for security reasons
                Input.Init();
                Vid.Init(_BasePal);
                Drawer.Init();
                Scr.Init();
                Render.Init();
                Sound.Init();
                CDAudio.Init();
                Sbar.Init();
                Client.Init();
            }

            Cbuf.InsertText("exec quake.rc\n");

            _IsInitialized = true;

            Con.DPrint("========Quake Initialized=========\n");
        }
Beispiel #2
0
        static int Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif
            // select display device
            _DisplayDevice = DisplayDevice.Default;

            if (File.Exists(DumpFilePath))
            {
                File.Delete(DumpFilePath);
            }

            quakeparms_t parms = new quakeparms_t();

            parms.basedir = Application.StartupPath;

            string[] args2 = new string[args.Length + 1];
            args2[0] = String.Empty;
            args.CopyTo(args2, 1);

            Common.InitArgv(args2);

            parms.argv = new string[Common.Argc];
            Common.Args.CopyTo(parms.argv, 0);

            if (Common.HasParam("-dedicated"))
            {
                throw new QuakeException("Dedicated server mode not supported!");
            }

            Size size         = new Size(640, 480);
            GraphicsMode mode = new GraphicsMode();
            bool fullScreen   = false;
            using (MainForm form = MainForm.CreateInstance(size, mode, fullScreen))
            {
                Con.DPrint("Host.Init\n");
                Host.Init(parms);

                form.Run();
            }
            Host.Shutdown();
#if !DEBUG
        }

        catch (QuakeSystemError se)
        {
            HandleException(se);
        }
        catch (Exception ex)
        {
            HandleException(ex);
        }
#endif
            return(0);    // all Ok
        }
Beispiel #3
0
        public static void Init(quakeparms_t parms)
        {
            _Params = parms;

            Cache.Init(1024 * 1024 * 512);   // debug
            Cbuf.Init();
            cmd.Init();
            view.Init();
            chase.Init();
            InitVCR(parms);
            common.Init(parms.basedir, parms.argv);
            InitLocal();
            wad.LoadWadFile("gfx.wad");
            Key.Init();
            Con.Init();
            menu.Init();
            progs.Init();
            Mod.Init();
            net.Init();
            server.Init();

            //Con.Print("Exe: "__TIME__" "__DATE__"\n");
            //Con.Print("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));

            render.InitTextures();              // needed even for dedicated servers

            if (client.cls.state != cactive_t.ca_dedicated)
            {
                _BasePal = common.LoadFile("gfx/palette.lmp");
                if (_BasePal == null)
                {
                    sys.Error("Couldn't load gfx/palette.lmp");
                }
                _ColorMap = common.LoadFile("gfx/colormap.lmp");
                if (_ColorMap == null)
                {
                    sys.Error("Couldn't load gfx/colormap.lmp");
                }

                // on non win32, mouse comes before video for security reasons
                input.Init();
                vid.Init(_BasePal);
                Drawer.Init();
                Scr.Init();
                render.Init();
                snd.Init();
                cd_audio.Init();
                sbar.Init();
                client.Init();
            }

            Cbuf.InsertText("exec quake.rc\n");

            _IsInitialized = true;

            Con.DPrint("========Quake Initialized=========\n");
        }
Beispiel #4
0
        static void InitVCR(quakeparms_t parms)
        {
            if (Common.HasParam("-playback"))
            {
                if (Common.Argc != 2)
                {
                    Sys.Error("No other parameters allowed with -playback\n");
                }

                Stream file = Sys.FileOpenRead("quake.vcr");
                if (file == null)
                {
                    Sys.Error("playback file not found\n");
                }

                _VcrReader = new BinaryReader(file, Encoding.ASCII);
                int signature = _VcrReader.ReadInt32();  //Sys_FileRead(vcrFile, &i, sizeof(int));
                if (signature != Host.VCR_SIGNATURE)
                {
                    Sys.Error("Invalid signature in vcr file\n");
                }

                int      argc = _VcrReader.ReadInt32(); // Sys_FileRead(vcrFile, &com_argc, sizeof(int));
                string[] argv = new string[argc + 1];
                argv[0] = parms.argv[0];

                for (int i = 1; i < argv.Length; i++)
                {
                    argv[i] = Sys.ReadString(_VcrReader);
                }
                Common.Args = argv;
                parms.argv  = argv;
            }

            int n = Common.CheckParm("-record");

            if (n != 0)
            {
                Stream file = Sys.FileOpenWrite("quake.vcr"); // vcrFile = Sys_FileOpenWrite("quake.vcr");
                _VcrWriter = new BinaryWriter(file, Encoding.ASCII);

                _VcrWriter.Write(VCR_SIGNATURE); //  Sys_FileWrite(vcrFile, &i, sizeof(int));
                _VcrWriter.Write(Common.Argc - 1);
                for (int i = 1; i < Common.Argc; i++)
                {
                    if (i == n)
                    {
                        Sys.WriteString(_VcrWriter, "-playback");
                        continue;
                    }
                    Sys.WriteString(_VcrWriter, Common.Argv(i));
                }
            }
        }
Beispiel #5
0
        private static int Main(string[] args)
        {
            //Workaround for SDL2 mouse input issues
            var options = new ToolkitOptions();

            options.Backend = PlatformBackend.PreferNative;
            options.EnableHighResolution = true; //Just for testing
            Toolkit.Init(options);
#if !DEBUG
            try
            {
#endif
            // select display device
            _DisplayDevice = DisplayDevice.Default;

            if (File.Exists(DumpFilePath))
            {
                File.Delete(DumpFilePath);
            }

            quakeparms_t parms = new quakeparms_t();

            parms.basedir = AppDomain.CurrentDomain.BaseDirectory; //Application.StartupPath;

            string[] args2 = new string[args.Length + 1];
            args2[0] = String.Empty;
            args.CopyTo(args2, 1);

            common.InitArgv(args2);

            parms.argv = new string[common.Argc];
            common.Args.CopyTo(parms.argv, 0);

            if (common.HasParam("-dedicated"))
            {
                throw new QuakeException("Dedicated server mode not supported!");
            }

            Size size         = new Size(1280, 720);
            GraphicsMode mode = new GraphicsMode();
            using (mainwindow form = mainwindow.CreateInstance(size, mode, false))
            {
                Con.DPrint("Host.Init\n");
                host.Init(parms);
                Instance.CursorVisible = false; //Hides mouse cursor during main menu on start up
                form.Run();
            }
            host.Shutdown();
#if !DEBUG
        }

        catch (QuakeSystemError se)
        {
            HandleException(se);
        }
        catch (Exception ex)
        {
            HandleException(ex);
        }
#endif
            return(0); // all Ok
        }
Beispiel #6
0
        static int Main(string[] args)
        {
            #if !DEBUG
            try
            {
            #endif
                // select display device
                _DisplayDevice = DisplayDevice.Default;

                if (File.Exists(DumpFilePath))
                    File.Delete(DumpFilePath);

                quakeparms_t parms = new quakeparms_t();

                parms.basedir = Application.StartupPath;

                string[] args2 = new string[args.Length + 1];
                args2[0] = String.Empty;
                args.CopyTo(args2, 1);

                Common.InitArgv(args2);

                parms.argv = new string[Common.Argc];
                Common.Args.CopyTo(parms.argv, 0);

                if (Common.HasParam("-dedicated"))
                    throw new QuakeException("Dedicated server mode not supported!");

                Size size = new Size(640, 480);
                GraphicsMode mode = new GraphicsMode();
                bool fullScreen = false;
                using (MainForm form = MainForm.CreateInstance(size, mode, fullScreen))
                {
                    Con.DPrint("Host.Init\n");
                    Host.Init(parms);

                    form.Run();
                }
                Host.Shutdown();
            #if !DEBUG
            }
            catch (QuakeSystemError se)
            {
                HandleException(se);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            #endif
                return 0; // all Ok
        }
Beispiel #7
0
        static void InitVCR(quakeparms_t parms)
        {
            if (Common.HasParam("-playback"))
            {
                if (Common.Argc != 2)
                    Sys.Error("No other parameters allowed with -playback\n");

                Stream file = Sys.FileOpenRead("quake.vcr");
                if (file == null)
                    Sys.Error("playback file not found\n");

                _VcrReader = new BinaryReader(file, Encoding.ASCII);
                int signature = _VcrReader.ReadInt32();  //Sys_FileRead(vcrFile, &i, sizeof(int));
                if (signature != Host.VCR_SIGNATURE)
                    Sys.Error("Invalid signature in vcr file\n");

                int argc = _VcrReader.ReadInt32(); // Sys_FileRead(vcrFile, &com_argc, sizeof(int));
                string[] argv = new string[argc + 1];
                argv[0] = parms.argv[0];

                for (int i = 1; i < argv.Length; i++)
                {
                    argv[i] = Sys.ReadString(_VcrReader);
                }
                Common.Args = argv;
                parms.argv = argv;
            }

            int n = Common.CheckParm("-record");
            if (n != 0)
            {
                Stream file = Sys.FileOpenWrite("quake.vcr"); // vcrFile = Sys_FileOpenWrite("quake.vcr");
                _VcrWriter = new BinaryWriter(file, Encoding.ASCII);

                _VcrWriter.Write(VCR_SIGNATURE); //  Sys_FileWrite(vcrFile, &i, sizeof(int));
                _VcrWriter.Write(Common.Argc - 1);
                for (int i = 1; i < Common.Argc; i++)
                {
                    if (i == n)
                    {
                        Sys.WriteString(_VcrWriter, "-playback");
                        continue;
                    }
                    Sys.WriteString(_VcrWriter, Common.Argv(i));
                }
            }
        }
Beispiel #8
0
        public static void Init(quakeparms_t parms)
        {
            _Params = parms;

            Cache.Init(1024 * 1024 * 16); // debug
            Cbuf.Init();
            Cmd.Init();
            View.Init();
            Chase.Init();
            InitVCR (parms);
            Common.Init(parms.basedir, parms.argv);
            InitLocal();
            Wad.LoadWadFile("gfx.wad");
            Key.Init();
            Con.Init();
            Menu.Init();
            Progs.Init();
            Mod.Init();
            Net.Init();
            Server.Init();

            //Con.Print("Exe: "__TIME__" "__DATE__"\n");
            //Con.Print("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));

            Render.InitTextures();		// needed even for dedicated servers

            if (Client.cls.state != cactive_t.ca_dedicated)
            {
                _BasePal = Common.LoadFile("gfx/palette.lmp");
                if (_BasePal == null)
                    Sys.Error("Couldn't load gfx/palette.lmp");
                _ColorMap = Common.LoadFile("gfx/colormap.lmp");
                if (_ColorMap == null)
                    Sys.Error ("Couldn't load gfx/colormap.lmp");

                // on non win32, mouse comes before video for security reasons
                Input.Init();
                Vid.Init(_BasePal);
                Drawer.Init();
                Scr.Init();
                Render.Init();
                Sound.Init();
                CDAudio.Init();
                Sbar.Init();
                Client.Init();
            }

            Cbuf.InsertText ("exec quake.rc\n");

            _IsInitialized = true;

            Con.DPrint ("========Quake Initialized=========\n");
        }