Skip to content

Commit

Permalink
music persist fixes for title screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Sep 30, 2024
1 parent 136e735 commit 0971a0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions source/funkin/audio/FunkinSound.hx
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
}
else
{
var music = FunkinSound.load(pathToUse, params?.startingVolume ?? 1.0, params.loop ?? true, false, true, params.onComplete);
var music = FunkinSound.load(pathToUse, params?.startingVolume ?? 1.0, params.loop ?? true, false, true, params.persist ?? false, params.onComplete);
if (music != null)
{
FlxG.sound.music = music;
Expand Down Expand Up @@ -514,7 +514,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
});

soundRequest.future.onComplete(function(partialSound) {
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, onComplete, onLoad);
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, false, onComplete, onLoad);
promise.complete(snd);
});
}
Expand Down Expand Up @@ -544,7 +544,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
*/
public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
{
var result:Null<FunkinSound> = FunkinSound.load(key, volume, false, true, true, onComplete, onLoad);
var result:Null<FunkinSound> = FunkinSound.load(key, volume, false, true, true, false, onComplete, onLoad);
return result;
}

Expand Down Expand Up @@ -630,6 +630,11 @@ typedef FunkinSoundPlayMusicParams =

var ?partialParams:PartialSoundParams;

/**
* Whether the sound should be destroyed on state switches
*/
var ?persist:Bool;

var ?onComplete:Void->Void;
var ?onLoad:Void->Void;
}
Expand Down
6 changes: 3 additions & 3 deletions source/funkin/ui/title/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ class TitleState extends MusicBeatState
{
startingVolume: 0.0,
overrideExisting: true,
restartTrack: true
restartTrack: false,
persist: true
});
// Fade from 0.0 to 1 over 4 seconds
if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0);
Expand Down Expand Up @@ -488,8 +489,7 @@ class TitleState extends MusicBeatState
// easter egg for when the game is trending with the wrong spelling
// the random intro text would be "trending--only on x"

if (curWacky[0] == "trending")
addMoreText('Nigth');
if (curWacky[0] == "trending") addMoreText('Nigth');
else
addMoreText('Night');
case 15:
Expand Down

0 comments on commit 0971a0b

Please sign in to comment.