Пример #1
0
        protected override void Initialize()
        {
            //EventInput.Initialize(this.Window);

            Log.Initialize(LogLevel.All);
            Log.AddListener(new ConsoleLogListener());
            Log.AddListener(new GameLogListener());

            ConVar.Initialize();
            FileSystem.Initialize();
            StyleManager.Load("Styles/bil.sty");
            MapManager.Load("Maps/MP1-comp.gmp");
            MapGeometry.Initialize();
            Camera.Initialize();

            base.Initialize();
        }
Пример #2
0
        private Dictionary <string, RenderBank <VertexPositionNormalTexture> > MakeBanks(bool isCol)
        {
            var banks = new Dictionary <string, RenderBank <VertexPositionNormalTexture> >();

            _workingBanks = banks;
            _isCol        = isCol;

            for (int z = (isCol ? 1 : 0); z < 7; z++)
            {
                for (int x = X; x < (X + _size); x++)
                {
                    for (int y = Y; y < (Y + _size); y++)
                    {
                        BlockInfo     block    = MapManager.GetBlock(x, y, z);
                        BlockGeometry geometry = MapGeometry.GetBlock(block.SlopeType.Slope);

                        Vector3 offsetVector = new Vector3(x, -y, z);

                        if (geometry != null)
                        {
                            _block = block;
                            DrawSide(geometry.Sides[MapGeometry.SIDE_TOP], block.Top, offsetVector, false);
                            DrawSide(geometry.Sides[MapGeometry.SIDE_BOTTOM], block.Bottom, offsetVector, false);
                            DrawSide(geometry.Sides[MapGeometry.SIDE_LEFT], block.Left, offsetVector, false);
                            DrawSide(geometry.Sides[MapGeometry.SIDE_RIGHT], block.Right, offsetVector, false);
                            DrawSide(geometry.Sides[MapGeometry.SIDE_LID], block.Lid, offsetVector, true);
                        }
                    }
                }
            }

            // remove reference
            _workingBanks = null;

            return(banks);
        }
Пример #3
0
        public static void Initialize()
        {
            // set the current culture to the invariant culture
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // initialize the logging service
            Log.Initialize(LogLevel.All);
            Log.AddListener(new ConsoleLogListener());
            Log.AddListener(new GameLogListener());
            Log.AddListener(new FileLogListener("GBHGame.log", false));

            Log.Write(LogLevel.Info, "GBH2 v0 initializing");
            Log.Write(LogLevel.Critical, "jeremych is an egghead and a nabsalad");

            ConVar.Initialize();
            FileSystem.Initialize();
            Win32System.Initialize();
            MapGeometry.Initialize();
            //StyleManager.Load("Styles/bil.sty");
            //MapManager.Load("Maps/MP1-comp.gmp");
            Camera.Initialize();
            NetManager.Initialize(29960);
            Client.Initialize();
            Server.Initialize();

            GameWindow.Initialize();

            com_maxFPS      = ConVar.Register("com_maxFPS", 0, "Maximum framerate for the game loop.", ConVarFlags.Archived);
            timescale       = ConVar.Register("timescale", 1.0f, "Scale time by this amount", ConVarFlags.Cheat);
            sv_running      = ConVar.Register("sv_running", true, "Is the server running?", ConVarFlags.ReadOnly);
            cl_running      = ConVar.Register("cl_running", false, "Is the client running?", ConVarFlags.ReadOnly);
            sv_paused       = ConVar.Register("sv_paused", false, "Is the server paused?", ConVarFlags.ReadOnly);
            cl_paused       = ConVar.Register("cl_paused", false, "Is the client paused?", ConVarFlags.ReadOnly);
            net_showpackets = ConVar.Register("net_showpackets", false, "Show network packets.", ConVarFlags.None);
            mapname         = ConVar.Register("mapname", "", "Current mapname", ConVarFlags.ReadOnly);
            nickname        = ConVar.Register("nickname", Environment.GetEnvironmentVariable("username"), "Your nickname", ConVarFlags.Archived);

            Renderer.Initialize();
            MaterialManager.ReadMaterialFile("base.material");
            MaterialManager.ReadMaterialFile("Styles/bil.material");
            ConsoleRenderer.Initialize();
            //StyleManager.CreateTextures(Renderer.Device);
            MapRenderer.Initialize(Renderer.Device);
            DeferredRenderer.Initialize(Renderer.Device);
            Renderer2D.Initialize(Renderer.Device);

            // jeez, people these days just need to get a *proper* nickname
            if (ConVar.GetValue <string>("nicknamee") == Environment.GetEnvironmentVariable("username"))
            {
                Log.Write(LogLevel.Info, "It looks it's your first time running GBH2. Please type 'nickname <WANTED NICKNAME>' to set your nickname.");
            }

            var     path  = Directory.GetCurrentDirectory() + "\\config.ini";
            IniFile ini   = new IniFile(path);
            var     value = ini.IniReadValue("CONFIG", "nickname");

            if (value != null)
            {
                ConVar.SetValue <string>("nicknamee", value);
            }
        }