1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

Merge branch 'ninjamuffin99/funk-250' into rewrite/master

This commit is contained in:
Cameron Taylor 2024-06-05 17:11:22 -04:00
commit 6334d16984
2 changed files with 16 additions and 6 deletions

View file

@ -357,6 +357,11 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
var shouldLoadPartial = params.partialParams?.loadPartial ?? false;
// even if we arent' trying to partial load a song, we want to error out any songs in progress,
// so we don't get overlapping music if someone were to load a new song while a partial one is loading!
emptyPartialQueue();
if (shouldLoadPartial)
{
var music = FunkinSound.loadPartial(pathToUse, params.partialParams?.start ?? 0.0, params.partialParams?.end ?? 1.0, params?.startingVolume ?? 1.0,
@ -364,12 +369,6 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
if (music != null)
{
while (partialQueue.length > 0)
{
@:nullSafety(Off)
partialQueue.pop().error("Cancel loading partial sound");
}
partialQueue.push(music);
@:nullSafety(Off)
@ -406,6 +405,15 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
}
}
public static function emptyPartialQueue():Void
{
while (partialQueue.length > 0)
{
@:nullSafety(Off)
partialQueue.pop().error("Cancel loading partial sound");
}
}
static var partialQueue:Array<Promise<Null<FunkinSound>>> = [];
/**

View file

@ -1769,6 +1769,8 @@ class FreeplayState extends MusicBeatSubState
funnyScroll3.visible = false;
new FlxTimer().start(1, function(tmr:FlxTimer) {
FunkinSound.emptyPartialQueue();
Paths.setCurrentLevel(cap.songData.levelId);
LoadingState.loadPlayState(
{