diff --git a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 index f1df900..e4a53f5 100644 Binary files a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 and b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 9c166ff..5cf5136 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites.sln b/EvilSatellites.sln index 05af865..5b76ab4 100644 --- a/EvilSatellites.sln +++ b/EvilSatellites.sln @@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30907.101 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvilSatellites", "EvilSatellites\EvilSatellites.csproj", "{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EvilSatellites", "EvilSatellites\EvilSatellites.csproj", "{48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|x86.ActiveCfg = Debug|x86 + {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Debug|x86.Build.0 = Debug|x86 {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|Any CPU.Build.0 = Release|Any CPU + {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|x86.ActiveCfg = Release|x86 + {48DE0A06-5D79-4EB1-B16A-4807A15AEBD0}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EvilSatellites/EvilSatellites.csproj b/EvilSatellites/EvilSatellites.csproj index 8b434b1..7a31545 100644 --- a/EvilSatellites/EvilSatellites.csproj +++ b/EvilSatellites/EvilSatellites.csproj @@ -4,6 +4,7 @@ net5.0 false false + AnyCPU;x86 app.manifest @@ -12,6 +13,9 @@ + + + diff --git a/EvilSatellites/GameSettings.cs b/EvilSatellites/GameSettings.cs index 1cd141a..96a0631 100644 --- a/EvilSatellites/GameSettings.cs +++ b/EvilSatellites/GameSettings.cs @@ -3,13 +3,61 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.IO; namespace EvilSatellites { public static class GameSettings { + public static string SettingsDirectory = Environment.SpecialFolder.Personal + "/EvilSatellites"; + public static string SettingsFile = SettingsDirectory + "/settings.dat"; public static bool PreferSAPI = true; public static bool UseForceFeedback = true; public static bool EnableAI = true; + + public static void SaveSettings() + { + if (!Directory.Exists(SettingsDirectory)) + { + Directory.CreateDirectory(SettingsDirectory); + } + try + { + var file = new BinaryWriter(File.Open(SettingsFile, FileMode.Create)); + file.Write(PreferSAPI); + file.Write(UseForceFeedback); + file.Write(EnableAI); + file.Close(); + } catch (Exception e) + { + DavyKager.Tolk.Output("Error saving settings: " + e.Message); + } + + } + + public static void ReadSettings() + { + if (!Directory.Exists(SettingsDirectory)) + { + return; + } + if (!File.Exists(SettingsFile)) + { + return; + } + try + { + var file = new BinaryReader(File.OpenRead(SettingsFile)); + PreferSAPI = file.ReadBoolean(); + UseForceFeedback = file.ReadBoolean(); + EnableAI = file.ReadBoolean(); + file.Close(); + } catch (Exception e) + { + return; + } + + + } } } diff --git a/EvilSatellites/Objects/Player.cs b/EvilSatellites/Objects/Player.cs index 6676f08..40e819b 100644 --- a/EvilSatellites/Objects/Player.cs +++ b/EvilSatellites/Objects/Player.cs @@ -80,6 +80,7 @@ namespace EvilSatellites.Objects sfxTaps.Destroy(); sfxElevator.Destroy(); sfxDamage.Destroy(); + CurrentWeapon.Destroy(); return; } override public void Update(GameTime gameTime) @@ -109,19 +110,19 @@ namespace EvilSatellites.Objects Move(Movement); if (Turning == -1) { - RotateY(0.035f); + RotateY(0.025f); } if (Turning == 1) { - RotateY(-0.035f); + RotateY(-0.025f); } if (Elevating == -1) { - RotateX(-0.035f); + RotateX(-0.025f); } if (Elevating == 1) { - RotateX(0.035f); + RotateX(0.025f); } sfxEngine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 4; sfxWhine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 1; diff --git a/EvilSatellites/Program.cs b/EvilSatellites/Program.cs index 7edd58b..603629a 100644 --- a/EvilSatellites/Program.cs +++ b/EvilSatellites/Program.cs @@ -7,7 +7,7 @@ namespace EvilSatellites [STAThread] static void Main() { - + GameSettings.ReadSettings(); DavyKager.Tolk.Load(); if (GameSettings.PreferSAPI) { diff --git a/EvilSatellites/Screens/MenuScreen.cs b/EvilSatellites/Screens/MenuScreen.cs index 95a46a6..76ab0c6 100644 --- a/EvilSatellites/Screens/MenuScreen.cs +++ b/EvilSatellites/Screens/MenuScreen.cs @@ -25,7 +25,7 @@ namespace EvilSatellites.Screens public virtual void Activate() { CursorPosition = 0; - Tolk.Output(MenuOptions.Title, true); + Tolk.Output(MenuOptions.Title, false); Tolk.Output(MenuOptions.Description, false); Tolk.Output(MenuOptions.Entries[CursorPosition].Name); Manager.Sound.PlayOneshot(@"sfx/ui/menuOpen.wav"); diff --git a/EvilSatellites/Screens/OptionsScreen.cs b/EvilSatellites/Screens/OptionsScreen.cs index 556773a..a8dcf9e 100644 --- a/EvilSatellites/Screens/OptionsScreen.cs +++ b/EvilSatellites/Screens/OptionsScreen.cs @@ -42,6 +42,7 @@ namespace EvilSatellites.Screens } if (CursorPosition == 4) { + GameSettings.SaveSettings(); Manager.RemoveScreen(this); Manager.AddScreen(new MainMenuScreen()); } diff --git a/EvilSatellites/Weapons/AbstractWeapon.cs b/EvilSatellites/Weapons/AbstractWeapon.cs index b7fec3f..2541e86 100644 --- a/EvilSatellites/Weapons/AbstractWeapon.cs +++ b/EvilSatellites/Weapons/AbstractWeapon.cs @@ -30,5 +30,6 @@ namespace EvilSatellites.Weapons public virtual void Stop() { } public virtual void Update(GameTime time) { } public abstract void Reload(int amount); + public abstract void Destroy(); } } diff --git a/EvilSatellites/Weapons/IWeapon.cs b/EvilSatellites/Weapons/IWeapon.cs index df68099..991bba3 100644 --- a/EvilSatellites/Weapons/IWeapon.cs +++ b/EvilSatellites/Weapons/IWeapon.cs @@ -18,5 +18,6 @@ namespace EvilSatellites.Weapons int MaxAmmo { get; set; } int RemainingAmmo { get; set; } WeaponState State { get; set; } + void Destroy(); } } diff --git a/EvilSatellites/Weapons/LaserMG.cs b/EvilSatellites/Weapons/LaserMG.cs index 0d45fa0..01e972e 100644 --- a/EvilSatellites/Weapons/LaserMG.cs +++ b/EvilSatellites/Weapons/LaserMG.cs @@ -130,5 +130,15 @@ namespace EvilSatellites.Weapons sfxReload.Play(); Screen.Manager.Vibrations.AddVibration(1, 1, 500); } + + public override void Destroy() + { + sfxEmpty.Destroy(); + sfxReload.Destroy(); + sfxShoot.Destroy(); + sfxSpindown.Destroy(); + sfxSpinning.Destroy(); + sfxSpinup.Destroy(); + } } }