Skip to content

Commit 0971a0b

Browse files
committed
music persist fixes for title screen
1 parent 136e735 commit 0971a0b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

source/funkin/audio/FunkinSound.hx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
390390
}
391391
else
392392
{
393-
var music = FunkinSound.load(pathToUse, params?.startingVolume ?? 1.0, params.loop ?? true, false, true, params.onComplete);
393+
var music = FunkinSound.load(pathToUse, params?.startingVolume ?? 1.0, params.loop ?? true, false, true, params.persist ?? false, params.onComplete);
394394
if (music != null)
395395
{
396396
FlxG.sound.music = music;
@@ -514,7 +514,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
514514
});
515515

516516
soundRequest.future.onComplete(function(partialSound) {
517-
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, onComplete, onLoad);
517+
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, false, onComplete, onLoad);
518518
promise.complete(snd);
519519
});
520520
}
@@ -544,7 +544,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
544544
*/
545545
public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
546546
{
547-
var result:Null<FunkinSound> = FunkinSound.load(key, volume, false, true, true, onComplete, onLoad);
547+
var result:Null<FunkinSound> = FunkinSound.load(key, volume, false, true, true, false, onComplete, onLoad);
548548
return result;
549549
}
550550

@@ -630,6 +630,11 @@ typedef FunkinSoundPlayMusicParams =
630630

631631
var ?partialParams:PartialSoundParams;
632632

633+
/**
634+
* Whether the sound should be destroyed on state switches
635+
*/
636+
var ?persist:Bool;
637+
633638
var ?onComplete:Void->Void;
634639
var ?onLoad:Void->Void;
635640
}

source/funkin/ui/title/TitleState.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ class TitleState extends MusicBeatState
232232
{
233233
startingVolume: 0.0,
234234
overrideExisting: true,
235-
restartTrack: true
235+
restartTrack: false,
236+
persist: true
236237
});
237238
// Fade from 0.0 to 1 over 4 seconds
238239
if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0);
@@ -488,8 +489,7 @@ class TitleState extends MusicBeatState
488489
// easter egg for when the game is trending with the wrong spelling
489490
// the random intro text would be "trending--only on x"
490491

491-
if (curWacky[0] == "trending")
492-
addMoreText('Nigth');
492+
if (curWacky[0] == "trending") addMoreText('Nigth');
493493
else
494494
addMoreText('Night');
495495
case 15:

0 commit comments

Comments
 (0)