diff --git a/source/funkin/Highscore.hx b/source/funkin/Highscore.hx index dfaf44a5e..ff0f36424 100644 --- a/source/funkin/Highscore.hx +++ b/source/funkin/Highscore.hx @@ -10,7 +10,7 @@ class Highscore public static var tallies:Tallies = new Tallies(); - public static function saveScore(song:String, score:Int = 0, ?diff:Int = 0):Void + public static function saveScore(song:String, score:Int = 0, ?diff:Int = 0):Bool { var formattedSong:String = formatSong(song, diff); @@ -21,10 +21,16 @@ class Highscore if (songScores.exists(formattedSong)) { if (songScores.get(formattedSong) < score) + { setScore(formattedSong, score); + return true; + // new highscore + } } else setScore(formattedSong, score); + + return false; } public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void @@ -114,7 +120,8 @@ abstract Tallies(RawTallies) good: 0, sick: 0, totalNotes: 0, - maxCombo: 0 + maxCombo: 0, + isNewHighscore: false } } } @@ -133,6 +140,7 @@ typedef RawTallies = var good:Int; var sick:Int; var maxCombo:Int; + var isNewHighscore:Bool; /** * How many notes total that you hit. (NOT how many notes total in the song!) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index cd3a6edff..fe643c348 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1360,7 +1360,8 @@ class PlayState extends MusicBeatState implements IHook vocals.volume = 0; if (currentSong.validScore) { - Highscore.saveScore(currentSong.song, songScore, storyDifficulty); + // crackhead double thingie, sets whether was new highscore, AND saves the song! + Highscore.tallies.isNewHighscore = Highscore.saveScore(currentSong.song, songScore, storyDifficulty); } if (isStoryMode) diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index cfbf285d6..987ad3a09 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -178,6 +178,9 @@ class ResultState extends MusicBeatSubstate }); }); + if (Highscore.tallies.isNewHighscore) + trace("ITS A NEW HIGHSCORE!!!"); + super.create(); }