1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-25 06:36:43 +00:00

music persist fixes for title screen

This commit is contained in:
Cameron Taylor 2024-09-30 10:53:27 -04:00
parent 136e7358b1
commit 0971a0bb4c
2 changed files with 11 additions and 6 deletions

View file

@ -390,7 +390,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
} }
else 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) if (music != null)
{ {
FlxG.sound.music = music; FlxG.sound.music = music;
@ -514,7 +514,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
}); });
soundRequest.future.onComplete(function(partialSound) { 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); promise.complete(snd);
}); });
} }
@ -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> 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; return result;
} }
@ -630,6 +630,11 @@ typedef FunkinSoundPlayMusicParams =
var ?partialParams:PartialSoundParams; var ?partialParams:PartialSoundParams;
/**
* Whether the sound should be destroyed on state switches
*/
var ?persist:Bool;
var ?onComplete:Void->Void; var ?onComplete:Void->Void;
var ?onLoad:Void->Void; var ?onLoad:Void->Void;
} }

View file

@ -232,7 +232,8 @@ class TitleState extends MusicBeatState
{ {
startingVolume: 0.0, startingVolume: 0.0,
overrideExisting: true, overrideExisting: true,
restartTrack: true restartTrack: false,
persist: true
}); });
// Fade from 0.0 to 1 over 4 seconds // Fade from 0.0 to 1 over 4 seconds
if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0); if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0);
@ -488,8 +489,7 @@ class TitleState extends MusicBeatState
// easter egg for when the game is trending with the wrong spelling // easter egg for when the game is trending with the wrong spelling
// the random intro text would be "trending--only on x" // the random intro text would be "trending--only on x"
if (curWacky[0] == "trending") if (curWacky[0] == "trending") addMoreText('Nigth');
addMoreText('Nigth');
else else
addMoreText('Night'); addMoreText('Night');
case 15: case 15: