Exemple #1
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>( );
        }
        public void Initialise(QuakeParameters parms)
        {
            Parameters = parms;

            //Command.SetupWrapper( ); // Temporary workaround - change soon!
            Cache.Initialise(1024 * 1024 * 512);   // debug

            Commands.Add("flush", Cache.Flush);

            //CommandBuffer.Initialise( );
            // Command.Initialise( );
            View.Initialise( );
            ChaseView.Initialise( );
            InitialiseVCR(parms);
            MainWindow.Common.Initialise(MainWindow, parms.basedir, parms.argv);
            InitialiseLocal( );

            InitialiseWAD();

            Keyboard.Initialise( );
            Console.Initialise( );
            Menus.Initialise(this);
            Programs.Initialise( );
            ProgramsBuiltIn.Initialise( );
            Model.Initialise(this);
            Network.Initialise( );
            Server.Initialise( );

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

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

            if (Client.cls.state != cactive_t.ca_dedicated)
            {
                BasePal = FileSystem.LoadFile("gfx/palette.lmp");
                if (BasePal == null)
                {
                    Utilities.Error("Couldn't load gfx/palette.lmp");
                }
                ColorMap = FileSystem.LoadFile("gfx/colormap.lmp");
                if (ColorMap == null)
                {
                    Utilities.Error("Couldn't load gfx/colormap.lmp");
                }

                // on non win32, mouse comes before video for security reasons
                MainWindow.Input.Initialise(this);
                Video.Initialise(BasePal);
                DrawingContext.Initialise( );
                Screen.Initialise( );
                RenderContext.Initialise( );
                Sound.Initialise( );
                CDAudio.Initialise( );
                Hud.Initialise( );
                Client.Initialise( );
            }
            else
            {
                DedicatedServer.Initialise( );
            }

            Commands.Buffer.Insert("exec quake.rc\n");

            IsInitialised = true;

            Console.DPrint("========Quake Initialized=========\n");
        }
Exemple #3
0
        public void Initialise(QuakeParameters parms)
        {
            Parameters = parms;

            //Command.SetupWrapper( ); // Temporary workaround - change soon!
            Cache.Initialise(1024 * 1024 * 512);   // debug

            Commands.Add("flush", Cache.Flush);

            //CommandBuffer.Initialise( );
            // Command.Initialise( );
            View.Initialise( );
            ChaseView.Initialise( );
            InitialiseVCR(parms);
            MainWindow.Common.Initialise(MainWindow, parms.basedir, parms.argv);
            InitialiseLocal( );

            // Search wads
            foreach (var wadFile in FileSystem.Search("*.wad"))
            {
                if (wadFile == "radiant.wad")
                {
                    continue;
                }

                if (wadFile == "gfx.wad")
                {
                    continue;
                }

                var data = FileSystem.LoadFile(wadFile);

                if (data == null)
                {
                    continue;
                }

                var wad = new Wad( );
                wad.LoadWadFile(wadFile, data);

                WadFiles.Add(wadFile, wad);

                var textures = wad._Lumps.Values
                               .Select(s => Encoding.ASCII.GetString(s.name).Replace("\0", ""))
                               .ToArray( );

                foreach (var texture in textures)
                {
                    if (!WadTextures.ContainsKey(texture))
                    {
                        WadTextures.Add(texture, wadFile);
                    }
                }
            }

            GfxWad.LoadWadFile("gfx.wad");
            Keyboard.Initialise( );
            Console.Initialise( );
            Menu.Initialise( );
            Programs.Initialise( );
            ProgramsBuiltIn.Initialise( );
            Model.Initialise( );
            Network.Initialise( );
            Server.Initialise( );

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

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

            if (Client.cls.state != cactive_t.ca_dedicated)
            {
                BasePal = FileSystem.LoadFile("gfx/palette.lmp");
                if (BasePal == null)
                {
                    Utilities.Error("Couldn't load gfx/palette.lmp");
                }
                ColorMap = FileSystem.LoadFile("gfx/colormap.lmp");
                if (ColorMap == null)
                {
                    Utilities.Error("Couldn't load gfx/colormap.lmp");
                }

                // on non win32, mouse comes before video for security reasons
                MainWindow.Input.Initialise(this);
                Video.Initialise(BasePal);
                DrawingContext.Initialise( );
                Screen.Initialise( );
                RenderContext.Initialise( );
                Sound.Initialise( );
                CDAudio.Initialise( );
                Hud.Initialise( );
                Client.Initialise( );
            }
            else
            {
                DedicatedServer.Initialise( );
            }

            Commands.Buffer.Insert("exec quake.rc\n");

            IsInitialised = true;

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