示例#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");
        }
示例#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--;
            }
        }
示例#3
0
        public Host(MainWindow window)
        {
            MainWindow = window;
            Cvars      = new Cvars();

            // Factories
            Commands = AddFactory <CommandFactory>( );
            CVars    = AddFactory <ClientVariableFactory>( );

            Commands.Initialise(CVars);

            // Old
            Cache = new Cache( );
            //CommandBuffer = new CommandBuffer( this );
            //Command = new Command( this );
            //CVar.Initialise( Command );
            View            = new View(this);
            ChaseView       = new ChaseView(this);
            GfxWad          = new Wad( );
            Keyboard        = new Keyboard(this);
            Console         = new Con(this);
            Menu            = new Menu(this);
            Programs        = new Programs(this);
            ProgramsBuiltIn = new ProgramsBuiltIn(this);
            Model           = new Mod(this);
            Network         = new Network(this);
            Server          = new server(this);
            Client          = new client(this);
            Video           = new Vid(this);
            DrawingContext  = new Drawer(this);
            Screen          = new Scr(this);
            RenderContext   = new render(this);
            Sound           = new snd(this);
            CDAudio         = new cd_audio(this);
            Hud             = new Hud(this);
            DedicatedServer = new DedicatedServer( );

            WadFiles    = new Dictionary <String, Wad>( );
            WadTextures = new Dictionary <String, String>( );
        }