diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index e7cab246c6..d553dc341f 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -1,5 +1,6 @@ package funkin.data.song; +import funkin.data.freeplay.player.PlayerRegistry; import funkin.data.song.SongData; import funkin.data.song.migrator.SongData_v2_0_0.SongMetadata_v2_0_0; import funkin.data.song.migrator.SongData_v2_1_0.SongMetadata_v2_1_0; @@ -508,8 +509,32 @@ class SongRegistry extends BaseRegistry public function listBaseGameSongIds():Array { return [ - "tutorial", "bopeebo", "fresh", "dadbattle", "spookeez", "south", "monster", "pico", "philly-nice", "blammed", "satin-panties", "high", "milf", "cocoa", - "eggnog", "winter-horrorland", "senpai", "roses", "thorns", "ugh", "guns", "stress", "darnell", "lit-up", "2hot", "blazin" + "tutorial", + "bopeebo", + "fresh", + "dadbattle", + "spookeez", + "south", + "monster", + "pico", + "philly-nice", + "blammed", + "satin-panties", + "high", + "milf", + "cocoa", + "eggnog", + "winter-horrorland", + "senpai", + "roses", + "thorns", + "ugh", + "guns", + "stress", + "darnell", + "lit-up", + "2hot", + "blazin" ]; } @@ -522,4 +547,39 @@ class SongRegistry extends BaseRegistry return listBaseGameSongIds().indexOf(id) == -1; }); } + + /** + * A list of all difficulties for a specific character. + */ + public function listAllDifficulties(characterId:String):Array + { + var allDifficulties:Array = Constants.DEFAULT_DIFFICULTY_LIST.copy(); + var character = PlayerRegistry.instance.fetchEntry(characterId); + + if (character == null) + { + trace(' [WARN] Could not locate character $characterId'); + return allDifficulties; + } + + allDifficulties = []; + for (songId in listEntryIds()) + { + var song = fetchEntry(songId); + if (song == null) continue; + + for (diff in song.listDifficulties(null, song.getVariationsByCharacter(character))) + { + if (!allDifficulties.contains(diff)) allDifficulties.push(diff); + } + } + + if (allDifficulties.length == 0) + { + trace(' [WARN] No difficulties found. Returning default difficulty list.'); + allDifficulties = Constants.DEFAULT_DIFFICULTY_LIST.copy(); + } + + return allDifficulties; + } } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 351de6b977..f3e244bac5 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -176,6 +176,8 @@ class FreeplayState extends MusicBeatSubState */ public static var rememberedVariation:String = Constants.DEFAULT_VARIATION; + var allDifficulties:Array = Constants.DEFAULT_DIFFICULTY_LIST_FULL; + var funnyCam:FunkinCamera; var rankCamera:FunkinCamera; var rankBg:FunkinSprite; @@ -638,6 +640,8 @@ class FreeplayState extends MusicBeatSubState onDJIntroDone(); } + allDifficulties = SongRegistry.instance.listAllDifficulties(currentCharacterId); + // Generates song list with the starter params (who our current character is, last remembered difficulty, etc.) generateSongList(null, false); @@ -1697,7 +1701,7 @@ class FreeplayState extends MusicBeatSubState // Gets all available difficulties for our character, via our available variations var difficultiesAvailable:Array = grpCapsules.members[curSelected].freeplayData?.data.listDifficulties(null, - characterVariations) ?? Constants.DEFAULT_DIFFICULTY_LIST; + characterVariations) ?? allDifficulties; var currentDifficultyIndex:Int = difficultiesAvailable.indexOf(currentDifficulty);