mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
Merge branch 'rewrite/bugfix/pause-and-results-fixes' of https://github.com/FunkinCrew/Funkin-secret into rewrite/bugfix/pause-and-results-fixes
This commit is contained in:
commit
6888e7b122
2 changed files with 56 additions and 1 deletions
|
@ -245,12 +245,41 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
|||
{
|
||||
if (variationId == '') variationId = null;
|
||||
|
||||
return difficulties.keys().array().filter(function(diffId:String):Bool {
|
||||
var diffFiltered:Array<String> = difficulties.keys().array().filter(function(diffId:String):Bool {
|
||||
if (variationId == null) return true;
|
||||
var difficulty:Null<SongDifficulty> = difficulties.get(diffId);
|
||||
if (difficulty == null) return false;
|
||||
return difficulty.variation == variationId;
|
||||
});
|
||||
|
||||
// sort the difficulties, since they may be out of order in the chart JSON
|
||||
// maybe be careful of lowercase/uppercase?
|
||||
// also used in Level.listDifficulties()!!
|
||||
var diffMap:Map<String, Int> = new Map<String, Int>();
|
||||
for (difficulty in diffFiltered)
|
||||
{
|
||||
var num:Int = 0;
|
||||
switch (difficulty)
|
||||
{
|
||||
case 'easy':
|
||||
num = 0;
|
||||
case 'normal':
|
||||
num = 1;
|
||||
case 'hard':
|
||||
num = 2;
|
||||
case 'erect':
|
||||
num = 3;
|
||||
case 'nightmare':
|
||||
num = 4;
|
||||
}
|
||||
diffMap.set(difficulty, num);
|
||||
}
|
||||
|
||||
diffFiltered.sort(function(a:String, b:String) {
|
||||
return (diffMap.get(a) ?? 0) - (diffMap.get(b) ?? 0);
|
||||
});
|
||||
|
||||
return diffFiltered;
|
||||
}
|
||||
|
||||
public function hasDifficulty(diffId:String, ?variationId:String):Bool
|
||||
|
|
|
@ -155,6 +155,32 @@ class Level implements IRegistryEntry<LevelData>
|
|||
}
|
||||
}
|
||||
|
||||
// sort the difficulties, since they may be out of order in the chart JSON
|
||||
// also copy/pasted to Song.listDifficulties()!
|
||||
var diffMap:Map<String, Int> = new Map<String, Int>();
|
||||
for (difficulty in difficulties)
|
||||
{
|
||||
var num:Int = 0;
|
||||
switch (difficulty)
|
||||
{
|
||||
case 'easy':
|
||||
num = 0;
|
||||
case 'normal':
|
||||
num = 1;
|
||||
case 'hard':
|
||||
num = 2;
|
||||
case 'erect':
|
||||
num = 3;
|
||||
case 'nightmare':
|
||||
num = 4;
|
||||
}
|
||||
diffMap.set(difficulty, num);
|
||||
}
|
||||
|
||||
difficulties.sort(function(a:String, b:String) {
|
||||
return diffMap.get(a) - diffMap.get(b);
|
||||
});
|
||||
|
||||
// Filter to only include difficulties that are present in all songs
|
||||
for (songIndex in 1...songList.length)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue