From c678cabbf2fd00b4d8d8a42b7d625061e4637f68 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 10 Sep 2024 17:30:33 -0400 Subject: [PATCH] Fix issue where difficulty names wouldn't show up properly sometimes. --- source/funkin/ui/freeplay/FreeplayState.hx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index ec07c9d15..14c5829af 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -349,6 +349,7 @@ class FreeplayState extends MusicBeatSubState var displayedVariations = song.getVariationsByCharacter(currentCharacter); trace('Displayed Variations (${songId}): $displayedVariations'); var availableDifficultiesForSong:Array = 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 = 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})'); } } }