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; }
public static void GameInit() { C_UpdateUI.Pnlloadvisible = false; // Set the focus //This is sometimes called on a differant thread than picscreen was created on, so gotta do some more complicated stuffsss FrmGame.Default.picscreen.Invoke(new Action(() => FrmGame.Default.picscreen.Focus())); //stop the song playing C_Sound.StopMusic(); }
/// <summary> /// Handle Register button press. /// </summary> public void BtnRegister_Click(object sender, EventArgs e) { if (C_NetworkConfig.Socket.IsConnected == true) { C_Sound.PlaySound("Click.ogg"); C_UpdateUI.PnlRegisterVisible = true; C_UpdateUI.PnlLoginVisible = false; C_UpdateUI.PnlCharCreateVisible = false; C_UpdateUI.PnlCreditsVisible = false; pnlIPConfig.Visible = false; } }
/// <summary> /// Handle Credits button press. /// </summary> public void BtnCredits_Click(object sender, EventArgs e) { C_Sound.PlaySound("Click.ogg"); if (C_UpdateUI.PnlCreditsVisible == false) { tmrCredits.Enabled = true; } C_UpdateUI.PnlCreditsVisible = true; C_UpdateUI.PnlLoginVisible = false; C_UpdateUI.PnlRegisterVisible = false; C_UpdateUI.PnlCharCreateVisible = false; pnlIPConfig.Visible = false; }
public static void GameInit() { C_UpdateUI.Pnlloadvisible = false; C_Discord.SetPresence(C_Constants.GameName, "In-Game"); // We can safely call this anywhere in the code, Even if it gets called every frame // Set the focus //This is sometimes called on a differant thread than picscreen was created on, so gotta do some more complicated stuffsss FrmGame.Default.picscreen.Invoke(new Action(() => FrmGame.Default.picscreen.Focus())); //stop the song playing C_Sound.StopMusic(); }
/// <summary> /// Handle Play button press. /// </summary> public void BtnPlay_Click(object sender, EventArgs e) { if (C_NetworkConfig.Socket.IsConnected == true) { C_Sound.PlaySound("Click.ogg"); C_UpdateUI.PnlRegisterVisible = false; C_UpdateUI.PnlLoginVisible = true; C_UpdateUI.PnlCharCreateVisible = false; C_UpdateUI.PnlCreditsVisible = false; pnlIPConfig.Visible = false; txtLogin.Focus(); if (C_Types.Options.SavePass == true) { txtLogin.Text = C_Types.Options.Username; txtPassword.Text = C_Types.Options.Password; chkSavePass.Checked = true; } } }
/// <summary> /// Handles Exit button press. /// </summary> public void BtnExit_Click(object sender, EventArgs e) { C_Sound.PlaySound("Click.ogg"); C_General.DestroyGame(); }
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(); }
public static void ProcessWeather() { int i = 0; int x; if (CurrentWeather > 0 && CurrentWeather <= (int)Enums.WeatherType.Fog) { if (CurrentWeather == (int)Enums.WeatherType.Rain || CurrentWeather == (int)Enums.WeatherType.Storm) { PlayWeatherSound("Rain.ogg", true); } //Setup a particle for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 0) { WeatherParticle[i].InUse = 1; WeatherParticle[i].Type = CurrentWeather; if (C_GameLogic.Rand(1, 3) == 1) { WeatherParticle[i].Velocity = C_GameLogic.Rand(8, 14); WeatherParticle[i].X = ((C_Variables.TileView.Left * 32) - 32); WeatherParticle[i].Y = ((C_Variables.TileView.Top * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.Y)); } else { WeatherParticle[i].Velocity = C_GameLogic.Rand(10, 15); WeatherParticle[i].X = ((C_Variables.TileView.Left * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.X)); WeatherParticle[i].Y = ((C_Variables.TileView.Top * 32) - 32); } } else { WeatherParticle[i].Type = CurrentWeather; } } } else { StopWeatherSound(); for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 1) { WeatherParticle[i].InUse = 0; } } } if (CurrentWeather == (int)Enums.WeatherType.Storm) { x = C_GameLogic.Rand(1, 400 - CurrentWeatherIntensity); if (x == 1) { //Draw Thunder DrawThunder = C_GameLogic.Rand(15, 22); C_Sound.PlayExtraSound("Thunder.ogg"); } } for (i = 1; i <= MaxWeatherParticles; i++) { if (WeatherParticle[i].InUse == 1) { if (WeatherParticle[i].X > C_Variables.TileView.Right * 32 || WeatherParticle[i].Y > C_Variables.TileView.Bottom * 32) { //WeatherParticle[i].InUse = 0; if (C_GameLogic.Rand(1, 3) == 1) { WeatherParticle[i].X = (C_Variables.TileView.Left * 32) - 32; WeatherParticle[i].Y = (C_Variables.TileView.Top * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.Y); } else { WeatherParticle[i].X = (C_Variables.TileView.Left * 32) + C_GameLogic.Rand(-32, (int)C_Graphics.GameWindow.Size.X); WeatherParticle[i].Y = (C_Variables.TileView.Top * 32) - 32; } } else { WeatherParticle[i].X = WeatherParticle[i].X + WeatherParticle[i].Velocity; WeatherParticle[i].Y = WeatherParticle[i].Y + WeatherParticle[i].Velocity; } } } }