diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index b3da56f657..a376f925ea 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -74,6 +74,25 @@ class Preferences return value; } + /** + * If enabled, the miss sound will play when the player misses a note. + * @default `true` + */ + public static var playMissSound(get, set):Bool; + + static function get_playMissSound():Bool + { + return Save?.instance?.options?.playMissSound; + } + + static function set_playMissSound(value:Bool):Bool + { + var save:Save = Save.instance; + save.options.playMissSound = value; + save.flush(); + return value; + } + /** * If disabled, flashing lights in the main menu and other areas will be less intense. * @default `true` diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index dbacf3fa96..cf592643be 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2638,7 +2638,10 @@ class PlayState extends MusicBeatSubState if (playSound) { vocals.playerVolume = 0; - FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.5, 0.6)); + if (Preferences.playMissSound) + { + FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.5, 0.6)); + } } } diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 8403a1a775..7583937740 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -97,6 +97,7 @@ class Save downscroll: false, flashingLights: true, zoomCamera: true, + playMissSound: false, debugDisplay: false, autoPause: true, inputOffset: 0, @@ -1299,6 +1300,12 @@ typedef SaveDataOptions = */ var zoomCamera:Bool; + /** + * If enabled, the miss sound will play when the player misses a note. + * @default `true` + */ + var playMissSound:Bool; + /** * If enabled, an FPS and memory counter will be displayed even if this is not a debug build. * @default `false` diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index fb49807625..1ef7aa9a09 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -54,22 +54,25 @@ class PreferencesMenu extends Page */ function createPrefItems():Void { - createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { + createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content.', function(value:Bool):Void { Preferences.naughtyness = value; }, Preferences.naughtyness); - createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards', function(value:Bool):Void { + createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards.', function(value:Bool):Void { Preferences.downscroll = value; }, Preferences.downscroll); - createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects', function(value:Bool):Void { + createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects.', function(value:Bool):Void { Preferences.flashingLights = value; }, Preferences.flashingLights); - createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', function(value:Bool):Void { + createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song.', function(value:Bool):Void { Preferences.zoomCamera = value; }, Preferences.zoomCamera); - createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats', function(value:Bool):Void { + createPrefItemCheckbox('Play Miss Sound', 'Disable to stop the miss sound from playing when a miss happens.', function(value:Bool):Void { + Preferences.playMissSound = value; + }, Preferences.playMissSound); + createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats.', function(value:Bool):Void { Preferences.debugDisplay = value; }, Preferences.debugDisplay); - createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus', function(value:Bool):Void { + createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus.', function(value:Bool):Void { Preferences.autoPause = value; }, Preferences.autoPause);