1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-03-21 09:29:41 +00:00

Fix issue where difficulty names wouldn't show up properly sometimes.

This commit is contained in:
EliteMasterEric 2024-09-10 17:30:33 -04:00
parent 5021b49915
commit c678cabbf2

View file

@ -349,6 +349,7 @@ class FreeplayState extends MusicBeatSubState
var displayedVariations = song.getVariationsByCharacter(currentCharacter);
trace('Displayed Variations (${songId}): $displayedVariations');
var availableDifficultiesForSong:Array<String> = song.listSuffixedDifficulties(displayedVariations, false, false);
var unsuffixedDifficulties = song.listDifficulties(displayedVariations, false, false);
trace('Available Difficulties: $availableDifficultiesForSong');
if (availableDifficultiesForSong.length == 0) continue;
@ -357,6 +358,10 @@ class FreeplayState extends MusicBeatSubState
{
diffIdsTotal.pushUnique(difficulty);
}
for (difficulty in unsuffixedDifficulties)
{
diffIdsTotal.pushUnique(difficulty);
}
}
}
@ -2414,10 +2419,13 @@ class DifficultySprite extends FlxSprite
// Remove the last suffix of the difficulty id until we find an asset or there are no more suffixes.
var assetDiffIdParts:Array<String> = assetDiffId.split('-');
assetDiffIdParts.pop();
if (assetDiffIdParts.length == 0) break;
if (assetDiffIdParts.length == 0)
{
trace('Could not find difficulty asset: freeplay/freeplay${diffId} (from ${diffId})');
return;
};
assetDiffId = assetDiffIdParts.join('-');
}
trace('Found difficulty asset: freeplay/freeplay${assetDiffId}');
// Check for an XML to use an animation instead of an image.
if (Assets.exists(Paths.file('images/freeplay/freeplay${assetDiffId}.xml')))
@ -2429,6 +2437,7 @@ class DifficultySprite extends FlxSprite
else
{
this.loadGraphic(Paths.image('freeplay/freeplay' + assetDiffId));
trace('Loaded difficulty asset: freeplay/freeplay${assetDiffId} (from ${diffId})');
}
}
}