Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT]: Miss Sound Preference #4177

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
19 changes: 19 additions & 0 deletions source/funkin/Preferences.hx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,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 enabled, the game will automatically pause when tabbing out.
* @default `true`
Expand Down
14 changes: 10 additions & 4 deletions source/funkin/play/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1458,8 +1458,8 @@ class PlayState extends MusicBeatSubState

if (!startingSong
&& (Math.abs(FlxG.sound.music.time - correctSync) > 100
|| Math.abs(playerVoicesError) > 100
|| Math.abs(opponentVoicesError) > 100))
|| Math.abs(playerVoicesError) > 100
|| Math.abs(opponentVoicesError) > 100))
{
trace("VOCALS NEED RESYNC");
if (vocals != null)
Expand Down Expand Up @@ -2620,7 +2620,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));
}
}
}

Expand Down Expand Up @@ -2675,7 +2678,10 @@ class PlayState extends MusicBeatSubState
if (event.playSound)
{
vocals.playerVolume = 0;
FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
if (Preferences.playMissSound)
{
FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions source/funkin/save/Save.hx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class Save
flashingLights: true,
zoomCamera: true,
debugDisplay: false,
playMissSound: true,
autoPause: true,
autoFullscreen: false,
inputOffset: 0,
Expand Down Expand Up @@ -1334,6 +1335,12 @@ typedef SaveDataOptions =
*/
var debugDisplay:Bool;

/**
* If enabled, the miss sound will play when the player misses a note.
* @default `true`
*/
var playMissSound:Bool;

/**
* If enabled, the game will automatically pause when tabbing out.
* @default `true`
Expand Down
10 changes: 6 additions & 4 deletions source/funkin/ui/options/PreferencesMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,18 @@ class PreferencesMenu extends Page
createPrefItemCheckbox('Downscroll', 'If enabled, this will make the notes move downwards.', function(value:Bool):Void {
Preferences.downscroll = value;
}, Preferences.downscroll);
createPrefItemCheckbox('Flashing Lights', 'If disabled, it will dampen flashing effects. Useful for people with photosensitive epilepsy.',
function(value:Bool):Void {
Preferences.flashingLights = value;
}, Preferences.flashingLights);
createPrefItemCheckbox('Flashing Lights', 'If disabled, it will dampen flashing effects. Useful for people with photosensitive epilepsy.', function(value:Bool):Void {
Preferences.flashingLights = value;
}, Preferences.flashingLights);
createPrefItemCheckbox('Camera Zooms', 'If disabled, camera stops bouncing to the song.', function(value:Bool):Void {
Preferences.zoomCamera = value;
}, Preferences.zoomCamera);
createPrefItemCheckbox('Debug Display', 'If enabled, FPS and other debug stats will be displayed.', function(value:Bool):Void {
Preferences.debugDisplay = value;
}, Preferences.debugDisplay);
createPrefItemCheckbox('Play Miss Sound', 'If disabled, miss sounds will not play when missing notes.', function(value:Bool):Void {
Preferences.playMissSound = value;
}, Preferences.playMissSound);
createPrefItemCheckbox('Auto Pause', 'If enabled, game automatically pauses when it loses focus.', function(value:Bool):Void {
Preferences.autoPause = value;
}, Preferences.autoPause);
Expand Down