diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index a0b6b7793e..aa2e97cec1 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -88,7 +88,7 @@ namespace OpenRA.GameRules public float VideoVolume = 0.5f; public bool Shuffle = false; public bool Repeat = false; - public bool ShellmapMusic = true; + public bool MapMusic = true; public string Engine = "AL"; public SoundCashTicks SoundCashTickType = SoundCashTicks.Extreme; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs index 8d8fb13bc7..5c3b99e9d0 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs @@ -109,8 +109,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic musicSlider.Value = soundSettings.MusicVolume; var shellmapMusicCheckbox = generalPane.Get("SHELLMAP_MUSIC"); - shellmapMusicCheckbox.IsChecked = () => soundSettings.ShellmapMusic; - shellmapMusicCheckbox.OnClick = () => soundSettings.ShellmapMusic ^= true; + shellmapMusicCheckbox.IsChecked = () => soundSettings.MapMusic; + shellmapMusicCheckbox.OnClick = () => soundSettings.MapMusic ^= true; // Input pane var inputPane = panel.Get("INPUT_CONTROLS"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs index 50516ee730..3edc0e88e0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs @@ -23,11 +23,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Perf text var perfText = perfRoot.Get("TEXT"); + perfText.IsVisible = () => Game.Settings.Debug.PerfText; perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F( Game.RenderFrame, Game.NetFrameNumber, - PerfHistory.items["render"].LastValue, - PerfHistory.items["tick_time"].LastValue, + PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), + PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), Game.LocalTick, PerfHistory.items["batches"].LastValue); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs index 37a4b443af..7530023eed 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs @@ -86,11 +86,24 @@ namespace OpenRA.Mods.RA.Widgets.Logic musicslider.OnChange += x => Sound.MusicVolume = x; musicslider.Value = Sound.MusicVolume; + var videoslider = audio.Get("VIDEO_VOLUME"); + videoslider.OnChange += x => Sound.VideoVolume = x; + videoslider.Value = Sound.VideoVolume; + var cashticksdropdown = audio.Get("CASH_TICK_TYPE"); cashticksdropdown.OnMouseDown = _ => ShowSoundTickDropdown(cashticksdropdown, soundSettings); cashticksdropdown.GetText = () => soundSettings.SoundCashTickType == SoundCashTicks.Extreme ? "Extreme" : soundSettings.SoundCashTickType == SoundCashTicks.Normal ? "Normal" : "Disabled"; + var mapMusicCheckbox = audio.Get("MAP_MUSIC_CHECKBOX"); + mapMusicCheckbox.IsChecked = () => Game.Settings.Sound.MapMusic; + mapMusicCheckbox.OnClick = () => Game.Settings.Sound.MapMusic ^= true; + + var soundEngineDropdown = audio.Get("SOUND_ENGINE"); + soundEngineDropdown.OnMouseDown = _ => ShowSoundEngineDropdown(soundEngineDropdown, soundSettings); + soundEngineDropdown.GetText = () => soundSettings.Engine == "AL" ? + "OpenAL" : soundSettings.Engine == "Null" ? "None" : "OpenAL"; + // Display var display = bg.Get("DISPLAY_PANE"); @@ -121,6 +134,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic Game.viewport.Zoom = gs.PixelDouble ? 2 : 1; }; + var capFrameRateCheckbox = display.Get("CAPFRAMERATE_CHECKBOX"); + capFrameRateCheckbox.IsChecked = () => gs.CapFramerate; + capFrameRateCheckbox.OnClick = () => gs.CapFramerate ^= true; + + var maxFrameRate = display.Get("MAX_FRAMERATE"); + maxFrameRate.Text = gs.MaxFramerate.ToString(); + // Keys var keys = bg.Get("KEYS_PANE"); var keyConfig = Game.Settings.Keys; @@ -182,20 +202,37 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Debug var debug = bg.Get("DEBUG_PANE"); - var perfgraphCheckbox = debug.Get("PERFDEBUG_CHECKBOX"); + var perfgraphCheckbox = debug.Get("PERFGRAPH_CHECKBOX"); perfgraphCheckbox.IsChecked = () => Game.Settings.Debug.PerfGraph; perfgraphCheckbox.OnClick = () => Game.Settings.Debug.PerfGraph ^= true; + var perftextCheckbox = debug.Get("PERFTEXT_CHECKBOX"); + perftextCheckbox.IsChecked = () => Game.Settings.Debug.PerfText; + perftextCheckbox.OnClick = () => Game.Settings.Debug.PerfText ^= true; + + var sampleSlider = debug.Get("PERFTEXT_SAMPLE_AMOUNT"); + sampleSlider.Value = sampleSlider.MaximumValue-Game.Settings.Debug.Samples; + sampleSlider.OnChange += x => Game.Settings.Debug.Samples = (int)sampleSlider.MaximumValue-(int)Math.Round(x); + var checkunsyncedCheckbox = debug.Get("CHECKUNSYNCED_CHECKBOX"); checkunsyncedCheckbox.IsChecked = () => Game.Settings.Debug.SanityCheckUnsyncedCode; checkunsyncedCheckbox.OnClick = () => Game.Settings.Debug.SanityCheckUnsyncedCode ^= true; + var botdebugCheckbox = debug.Get("BOTDEBUG_CHECKBOX"); + botdebugCheckbox.IsChecked = () => Game.Settings.Debug.BotDebug; + botdebugCheckbox.OnClick = () => Game.Settings.Debug.BotDebug ^= true; + + var longTickThreshold = debug.Get("LONG_TICK_THRESHOLD"); + longTickThreshold.Value = Game.Settings.Debug.LongTickThreshold; + longTickThreshold.OnChange += x => Game.Settings.Debug.LongTickThreshold = x; + bg.Get("BUTTON_CLOSE").OnClick = () => { int x, y; int.TryParse(windowWidth.Text, out x); int.TryParse(windowHeight.Text, out y); gs.WindowedSize = new int2(x,y); + int.TryParse(maxFrameRate.Text, out gs.MaxFramerate); Game.Settings.Save(); Ui.CloseWindow(); }; @@ -298,5 +335,26 @@ namespace OpenRA.Mods.RA.Widgets.Logic dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem); return true; } + + public static bool ShowSoundEngineDropdown(DropDownButtonWidget dropdown, SoundSettings s) + { + var options = new Dictionary() + { + { "OpenAL", "AL" }, + { "None", "Null" }, + }; + + Func setupItem = (o, itemTemplate) => + { + var item = ScrollItemWidget.Setup(itemTemplate, + () => s.Engine == options[o], + () => s.Engine = options[o]); + item.Get("LABEL").GetText = () => o; + return item; + }; + + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem); + return true; + } } } diff --git a/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs b/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs index f93d5391a0..b9c0669ad3 100644 --- a/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs +++ b/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA { var onComplete = Info.Loop ? (Action)PlayMusic : () => {}; - if (Game.Settings.Sound.ShellmapMusic && + if (Game.Settings.Sound.MapMusic && Rules.Music.ContainsKey(Info.Music)) Sound.PlayMusicThen(Rules.Music[Info.Music], onComplete); } diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index b9113b01c9..d6a38a33b1 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -149,17 +149,46 @@ Background@SETTINGS_MENU: Width:250 Height:20 Ticks:5 - Label@SOUND_TICK_TYPE_LABEL: + Label@VIDEO_VOLUME_LABEL: X:0 Y:70 + Text: Video Volume + Slider@VIDEO_VOLUME: + X:100 + Y:60 + Width:250 + Height:20 + Ticks:5 + Label@SOUND_TICK_TYPE_LABEL: + X:0 + Y:100 Text: Cash ticks DropDownButton@CASH_TICK_TYPE: X:100 - Y:60 + Y:90 Width:250 Height:25 Font:Regular Text:Extreme + Checkbox@MAP_MUSIC_CHECKBOX: + X:0 + Y:120 + Width:200 + Height:20 + Text: Autoplay Music After Map Load + Label@SOUND_ENGINE_LABEL: + X:0 + Y:150 + Width:75 + Height:25 + Text:Sound Engine: + DropDownButton@SOUND_ENGINE: + X:100 + Y:150 + Width:120 + Height:25 + Font:Regular + Text:OpenAL Container@DISPLAY_PANE: X:37 Y:100 @@ -235,6 +264,18 @@ Background@SETTINGS_MENU: Height:20 Font:Regular Text:Enable Pixel Doubling + Checkbox@CAPFRAMERATE_CHECKBOX: + Y:120 + Width:200 + Height:20 + Font:Regular + Text:Cap Framerate @ + TextField@MAX_FRAMERATE: + X:150 + Y:120 + Width:45 + Height:25 + MaxLength:3 Container@KEYS_PANE: X:37 Y:100 @@ -303,15 +344,51 @@ Background@SETTINGS_MENU: Height:PARENT_BOTTOM - 100 Visible: false Children: - Checkbox@PERFDEBUG_CHECKBOX: + Checkbox@PERFGRAPH_CHECKBOX: X:0 Y:0 Width:300 Height:20 - Text:Show Performance Information - Checkbox@CHECKUNSYNCED_CHECKBOX: + Text:Show Performance Graph + Checkbox@PERFTEXT_CHECKBOX: X:0 Y:30 Width:300 Height:20 + Text:Show Performance Text + Label@PERFTEXT_SAMPLE_LABEL: + X:30 + Y:70 + Text:Update Rate + Slider@PERFTEXT_SAMPLE_AMOUNT: + X:130 + Y:60 + Width:250 + Height:20 + Ticks:5 + MinimumValue: 1 + MaximumValue: 50 + Checkbox@CHECKUNSYNCED_CHECKBOX: + X:0 + Y:90 + Width:300 + Height:20 Text:Check Sync around Unsynced Code + Checkbox@BOTDEBUG_CHECKBOX: + X:0 + Y:120 + Width:300 + Height:20 + Text:Show Bot Debug Messages + Label@PERFTEXT_SAMPLE_LABEL: + X:0 + Y:160 + Text:Slow Trait Report Threshold in (mili)seconds + Slider@LONG_TICK_THRESHOLD: + X:0 + Y:170 + Width:380 + Height:20 + Ticks:25 + MinimumValue: 0.0001 + MaximumValue: 0.01