Merge pull request #760 from FunkinCrew/bugfix/pico-mix-highscores

Fix bugs with highscore display in Freeplay (FUNK-714)
This commit is contained in:
Cameron Taylor 2024-09-18 15:14:46 -04:00 committed by GitHub
commit fdddfba3be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -586,13 +586,13 @@ class FreeplayState extends MusicBeatSubState
} }
}; };
exitMovers.set([fp, txtCompletion, fnfHighscoreSpr, txtCompletion, clearBoxSprite], exitMovers.set([fp, txtCompletion, fnfHighscoreSpr, clearBoxSprite],
{ {
x: FlxG.width, x: FlxG.width,
speed: 0.3 speed: 0.3
}); });
exitMoversCharSel.set([fp, txtCompletion, fnfHighscoreSpr, txtCompletion, clearBoxSprite], exitMoversCharSel.set([fp, txtCompletion, fnfHighscoreSpr, clearBoxSprite],
{ {
y: -270, y: -270,
speed: 0.8, speed: 0.8,
@ -1376,7 +1376,7 @@ class FreeplayState extends MusicBeatSubState
#if FEATURE_DEBUG_FUNCTIONS #if FEATURE_DEBUG_FUNCTIONS
if (FlxG.keys.justPressed.P) if (FlxG.keys.justPressed.P)
{ {
FlxG.switchState(FreeplayState.build( FlxG.switchState(() -> FreeplayState.build(
{ {
{ {
character: currentCharacterId == "pico" ? Constants.DEFAULT_CHARACTER : "pico", character: currentCharacterId == "pico" ? Constants.DEFAULT_CHARACTER : "pico",
@ -1777,12 +1777,13 @@ class FreeplayState extends MusicBeatSubState
FlxG.log.warn('WARN: could not find song with id (${daSong.songId})'); FlxG.log.warn('WARN: could not find song with id (${daSong.songId})');
return; return;
} }
var targetVariation:String = targetSong.getFirstValidVariation(currentDifficulty) ?? ''; var targetVariation:String = targetSong.getFirstValidVariation(currentDifficulty, currentCharacter) ?? '';
// TODO: This line of code makes me sad, but you can't really fix it without a breaking migration. // TODO: This line of code makes me sad, but you can't really fix it without a breaking migration.
var suffixedDifficulty = (targetVariation != Constants.DEFAULT_VARIATION var suffixedDifficulty = (targetVariation != Constants.DEFAULT_VARIATION
&& targetVariation != 'erect') ? '$currentDifficulty-${targetVariation}' : currentDifficulty; && targetVariation != 'erect') ? '$currentDifficulty-${targetVariation}' : currentDifficulty;
var songScore:Null<SaveScoreData> = Save.instance.getSongScore(daSong.songId, suffixedDifficulty); var songScore:Null<SaveScoreData> = Save.instance.getSongScore(daSong.songId, suffixedDifficulty);
trace(songScore);
intendedScore = songScore?.score ?? 0; intendedScore = songScore?.score ?? 0;
intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes); intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes);
rememberedDifficulty = suffixedDifficulty; rememberedDifficulty = suffixedDifficulty;