Пример #1
0
        public void btnSaveSettings_Click(object sender, EventArgs e)
        {
            //music
            if (optMOn.Checked == true)
            {
                C_Types.Options.Music = (byte)1;
                // start music playing
                C_Sound.PlayMusic(C_Maps.Map.Music.Trim());
            }
            else
            {
                C_Types.Options.Music = (byte)0;
                // stop music playing
                C_Sound.StopMusic();
                C_Sound.CurMusic = "";
            }

            //sound
            if (optSOn.Checked == true)
            {
                C_Types.Options.Sound = (byte)1;
            }
            else
            {
                C_Types.Options.Sound = (byte)0;
                C_Sound.StopSound();
            }

            //screensize
            C_Types.Options.ScreenSize = System.Convert.ToByte(cmbScreenSize.SelectedIndex);

            if (chkHighEnd.Checked)
            {
                C_Types.Options.HighEnd = (byte)1;
            }
            else
            {
                C_Types.Options.HighEnd = (byte)0;
            }

            if (chkNpcBars.Checked)
            {
                C_Types.Options.ShowNpcBar = (byte)1;
            }
            else
            {
                C_Types.Options.ShowNpcBar = (byte)0;
            }

            // save to config.ini
            C_DataBase.SaveOptions();

            //reload options
            C_DataBase.LoadOptions();

            C_General.RePositionGui();

            this.Visible = false;
        }
Пример #2
0
        public static void Startup()
        {
            SFML.Portable.Activate();

            SetStatus(Strings.Get("loadscreen", "loading"));

            FrmMenu.Default.Visible = true;

            Application.DoEvents();

            C_Types.CharSelection = new C_Types.CharSelRec[4];

            C_Types.Player = new C_Types.PlayerRec[Constants.MAX_PLAYERS + 1];

            for (var i = 1; i <= Constants.MAX_PLAYERS; i++)
            {
                C_Player.ClearPlayer(i);
            }

            C_AutoTiles.ClearAutotiles();

            //Housing
            C_Housing.House       = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];
            C_Housing.HouseConfig = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];

            //quests
            C_Quest.ClearQuests();

            //npc's
            C_DataBase.ClearNpcs();
            C_Maps.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1];
            C_Maps.MapNpc  = new C_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++)
                {
                    C_Maps.MapNpc[(int)i].Vital = new int[(int)x + 1];
                }
            }

            C_Shops.ClearShops();

            C_DataBase.ClearAnimations();

            C_DataBase.ClearAnimInstances();

            C_Banks.ClearBank();

            C_Projectiles.MapProjectiles = new C_Projectiles.MapProjectileRec[C_Projectiles.MaxProjectiles + 1];
            C_Projectiles.Projectiles    = new C_Projectiles.ProjectileRec[C_Projectiles.MaxProjectiles + 1];

            C_Items.ClearItems();

            //craft
            C_Crafting.ClearRecipes();

            //party
            C_Parties.ClearParty();

            //pets
            C_Pets.ClearPets();

            C_Variables.GettingMap = true;
            C_Variables.VbQuote    = System.Convert.ToString((char)34);           // "

            // Update the form with the game's name before it's loaded
            FrmGame.Default.Text = C_Constants.GameName;

            SetStatus(Strings.Get("loadscreen", "options"));

            // load options
            if (File.Exists(Application.StartupPath + "\\Data\\Config.xml"))
            {
                C_DataBase.LoadOptions();
            }
            else
            {
                C_DataBase.CreateOptions();
            }

            // randomize rnd's seed
            VBMath.Randomize();

            SetStatus(Strings.Get("loadscreen", "network"));

            FrmMenu.Default.Text = C_Constants.GameName;

            // DX7 Master Object is already created, early binding
            SetStatus(Strings.Get("loadscreen", "graphics"));
            C_Maps.CheckTilesets();
            C_DataBase.CheckCharacters();
            C_DataBase.CheckPaperdolls();
            C_DataBase.CheckAnimations();
            C_Items.CheckItems();
            C_Resources.CheckResources();
            C_DataBase.CheckSkillIcons();
            C_DataBase.CheckFaces();
            C_DataBase.CheckFog();
            C_DataBase.CacheMusic();
            C_DataBase.CacheSound();
            C_DataBase.CheckEmotes();
            C_DataBase.CheckPanoramas();
            C_Housing.CheckFurniture();
            C_Projectiles.CheckProjectiles();
            C_DataBase.CheckParallax();

            C_Graphics.InitGraphics();

            // check if we have main-menu music
            if (C_Types.Options.Music == 1 && C_Types.Options.MenuMusic.Trim().Length > 0)
            {
                C_Sound.PlayMusic(C_Types.Options.MenuMusic.Trim());
                C_Sound.MusicPlayer.Volume = 100;
            }

            // Reset values
            C_Variables.Ping = -1;

            // set values for directional blocking arrows
            C_Variables.DirArrowX[1] = 12;             // up
            C_Variables.DirArrowY[1] = 0;

            C_Variables.DirArrowX[2] = 12;             // down
            C_Variables.DirArrowY[2] = 23;

            C_Variables.DirArrowX[3] = 0;             // left
            C_Variables.DirArrowY[3] = 12;

            C_Variables.DirArrowX[4] = 23;             // right
            C_Variables.DirArrowY[4] = 12;

            //set gui switches
            C_UpdateUI.HudVisible = true;

            SetStatus(Strings.Get("loadscreen", "starting"));
            Started = true;
            C_UpdateUI.Frmmenuvisible = true;
            C_UpdateUI.Pnlloadvisible = false;

            //C_UpdateUI.PnlInventoryVisible = true;

            C_NetworkConfig.InitNetwork();

            C_GameLogic.GameLoop();
        }