Skip to content

Commit

Permalink
miss note sound option
Browse files Browse the repository at this point in the history
i totally "perma-borrowed" it from fnf spooky mix lol
  • Loading branch information
charlesisfeline committed Nov 16, 2024
1 parent b11d1f1 commit 25ea125
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
15 changes: 15 additions & 0 deletions source/funkin/Preferences.hx
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,21 @@ class Preferences
return value;
}

public static var missNoteSounds(get, set):Bool;

static function get_missNoteSounds():Bool
{
return Save?.instance?.options?.missNoteSounds;
}

static function set_missNoteSounds(value:Bool):Bool
{
var save:Save = Save.instance;
save.options.missNoteSounds = value;
save.flush();
return value;
}

#if web
// We create a haxe version of this just for readability.
// We use these to override `window.requestAnimationFrame` in Javascript to uncap the framerate / "animation" request rate
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/play/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,7 @@ 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.missNoteSounds) FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.5, 0.6));
}
}

Expand Down
6 changes: 4 additions & 2 deletions source/funkin/save/Save.hx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Save
#end
antialiasing: false, flashingLights: true, zoomCamera: true, judgeCounter: true, comboHUD: true, extraScoreText: true, coloredHealthBar: true,
showTimings: true, debugDisplay: true, autoPause: true, autoFullscreen: false, laneAlpha: 15, strumAlpha: 85, badsShitsCauseMiss: false,
inputOffset: 0, audioVisualOffset: 0, unlockedFramerate: false,
inputOffset: 0, audioVisualOffset: 0, unlockedFramerate: false, missNoteSounds: true,
#else
framerate: 60, noteHitSound: NoteHitSoundType.None, noteHitSoundVolume: 100, noteSplash: true, inputSystem: InputSystemType.Pbot, naughtyness: true,
downscroll: false, middlescroll: false,
Expand All @@ -114,7 +114,7 @@ class Save
#end
antialiasing: true, flashingLights: true, zoomCamera: true, judgeCounter: true, comboHUD: true, extraScoreText: true, coloredHealthBar: true,
showTimings: true, debugDisplay: true, autoPause: true, autoFullscreen: false, laneAlpha: 0, strumAlpha: 100, badsShitsCauseMiss: false,
inputOffset: 0, audioVisualOffset: 0, unlockedFramerate: false,
inputOffset: 0, audioVisualOffset: 0, unlockedFramerate: false, missNoteSounds: true,
#end

controls:
Expand Down Expand Up @@ -1451,6 +1451,8 @@ typedef SaveDataOptions =
*/
var audioVisualOffset:Int;

var missNoteSounds:Bool;

/**
* Whether we want the framerate to be unlocked on HTML5 builds.
* @default `false`
Expand Down
10 changes: 8 additions & 2 deletions source/funkin/ui/charSelect/CharSelectGF.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass

public function onStepHit(event:SongTimeScriptEvent):Void {}

var danceEvery:Int = 2;
// var danceEvery:Int = 2;

public function onBeatHit(event:SongTimeScriptEvent):Void
{
Expand All @@ -82,9 +82,15 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
// I tried make this not interrupt an existing idle,
// but isAnimationFinished() and isLoopComplete() both don't work! What the hell?
// danceEvery isn't necessary if that gets fixed.

// if (currentGFPath.endsWith("freyaChill"))
// danceEvery = 1;
// else
// danceEvery = 2;

if (getCurrentAnimation() == "idle" && (event.beat % danceEvery == 0))
{
trace('GF beat hit');
// trace('GF beat hit');
playAnimation("idle", true, false, false);
}
};
Expand Down
5 changes: 5 additions & 0 deletions source/funkin/ui/options/PreferencesMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class PreferencesMenu extends Page
Preferences.flashingLights = value;
yeahBf(value);
}, Preferences.flashingLights);
createPrefItemCheckbox('Note Miss Sounds', 'Enable to play a sound when you miss a note', function(value:Bool):Void {
Preferences.missNoteSounds = value;
yeahBf(value);
}, Preferences.missNoteSounds);
createPrefItemCheckbox('Colored Health Bar', 'Enable to make the health bar use icon-based colors', function(value:Bool):Void {
Preferences.coloredHealthBar = value;
yeahBf(value);
Expand Down Expand Up @@ -283,6 +287,7 @@ class PreferencesMenu extends Page
#if (desktop || web)
createPrefItemCheckbox('Launch in Fullscreen', 'Enable to automatically launch the game in fullscreen on startup', function(value:Bool):Void {
Preferences.autoFullscreen = value;
yeahBf(value);
}, Preferences.autoFullscreen);
#end
#if mobile
Expand Down

0 comments on commit 25ea125

Please sign in to comment.