Skip to content

Commit

Permalink
applySongRank fix
Browse files Browse the repository at this point in the history
fixes the bug with the percent being overriden when the song has the same letter rank but lower percent (eg. E Rank with 99% being overriden by E Rank with 93%)
  • Loading branch information
KoloInDaCrib authored Sep 18, 2024
1 parent a27c4ae commit a4b59d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/funkin/save/Save.hx
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,15 @@ class Save
return;
}

//percent also accounts for different ranks
var oldPerc = (previousScoreData.tallies.sick + previousScoreData.tallies.good) / previousScoreData.tallies.totalNotes;
var newPerc = (newScoreData.tallies.sick + newScoreData.tallies.good) / newScoreData.tallies.totalNotes;

// Set the high score and the high rank separately.
var newScore:SaveScoreData =
{
score: (previousScoreData.score > newScoreData.score) ? previousScoreData.score : newScoreData.score,
tallies: (previousRank > newRank) ? previousScoreData.tallies : newScoreData.tallies
score: Std.int(Math.max(previousScoreData.score, newScoreData.score)),
tallies: (oldPerc > newPerc ? previousScoreData.tallies : newScoreData.tallies)
};

song.set(difficultyId, newScore);
Expand Down

0 comments on commit a4b59d1

Please sign in to comment.