1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-22 21:26:49 +00:00

Fix FlxAtlasSprite completion handling and music looping

This commit is contained in:
EliteMasterEric 2024-09-12 15:48:41 -04:00
parent 3970189fe9
commit a9667c54f3
4 changed files with 11 additions and 19 deletions

View file

@ -340,6 +340,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
if (songMusicData != null)
{
Conductor.instance.mapTimeChanges(songMusicData.timeChanges);
if (songMusicData.looped != null && params.loop == null) params.loop = songMusicData.looped;
}
else
{

View file

@ -185,11 +185,12 @@ class FlxAtlasSprite extends FlxAnimate
// Move to the first frame of the animation.
// goToFrameLabel(id);
trace('Playing animation $id');
if (this.anim.symbolDictionary.exists(id) || (this.anim.getByName(id) != null))
if ((id == null || id == "") || this.anim.symbolDictionary.exists(id) || (this.anim.getByName(id) != null))
{
this.anim.play(id, restart, false, startFrame);
if (id == "Boyfriend DJ fist pump" || startFrame == 4) trace("PUMP COMMAND: " + anim.curFrame);
this.currentAnimation = anim.curSymbol.name;
fr = null;
}
// Only call goToFrameLabel if there is a frame label with that name. This prevents annoying warnings!
@ -316,6 +317,10 @@ class FlxAtlasSprite extends FlxAnimate
{
onAnimationComplete.dispatch(currentAnimation);
}
else
{
onAnimationComplete.dispatch('');
}
}
var prevFrames:Map<Int, FlxFrame> = [];

View file

@ -418,8 +418,7 @@ class ResultState extends MusicBeatSubState
{
startingVolume: 1.0,
overrideExisting: true,
restartTrack: true,
loop: rank.shouldMusicLoop()
restartTrack: true
});
});
}
@ -429,8 +428,7 @@ class ResultState extends MusicBeatSubState
{
startingVolume: 1.0,
overrideExisting: true,
restartTrack: true,
loop: rank.shouldMusicLoop()
restartTrack: true
});
}
});

View file

@ -577,19 +577,6 @@ enum abstract ScoringRank(String)
}
}
public function shouldMusicLoop():Bool
{
switch (abstract)
{
case PERFECT_GOLD | PERFECT | EXCELLENT | GREAT | GOOD:
return true;
case SHIT:
return false;
default:
return false;
}
}
public function getHorTextAsset()
{
switch (abstract)