Example #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 != 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");
        }
Example #2
0
        /// <summary>
        /// Host_Shutdown
        /// </summary>
        public static void Shutdown()
        {
            _ShutdownDepth++;
            try
            {
                if (_ShutdownDepth > 1)
                {
                    return;
                }

                // keep Con_Printf from trying to update the screen
                Scr.IsDisabledForLoading = true;

                WriteConfiguration();

                CDAudio.Shutdown();
                Net.Shutdown();
                Sound.Shutdown();
                Input.Shutdown();

                if (_VcrWriter != null)
                {
                    Con.Print("Closing vcrfile.\n");
                    _VcrWriter.Close();
                    _VcrWriter = null;
                }
                if (_VcrReader != null)
                {
                    Con.Print("Closing vcrfile.\n");
                    _VcrReader.Close();
                    _VcrReader = null;
                }

                if (Client.cls.state != cactive_t.ca_dedicated)
                {
                    Vid.Shutdown();
                }

                Con.Shutdown();
            }
            finally
            {
                _ShutdownDepth--;
            }
        }