1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Apply rate multiplier outside BPM rounding

This commit is contained in:
Salman Ahmed 2022-05-20 17:47:45 +03:00
parent 596853da8f
commit 84a3cee452
2 changed files with 12 additions and 7 deletions

View File

@ -168,16 +168,21 @@ namespace osu.Game.Tests.Visual.SongSelect
checkDisplayedBPM($"{bpm * 2}");
}
[TestCase(120, 125, "120-125 (mostly 120)")]
[TestCase(120, 120.6, "120-121 (mostly 120)")]
[TestCase(120, 120.4, "120")]
public void TestVaryingBPM(double commonBpm, double otherBpm, string expectedDisplay)
[TestCase(120, 125, null, "120-125 (mostly 120)")]
[TestCase(120, 120.6, null, "120-121 (mostly 120)")]
[TestCase(120, 120.4, null, "120")]
[TestCase(120, 120.6, "DT", "180-182 (mostly 180)")]
[TestCase(120, 120.4, "DT", "180")]
public void TestVaryingBPM(double commonBpm, double otherBpm, string mod, string expectedDisplay)
{
IBeatmap beatmap = createTestBeatmap(new OsuRuleset().RulesetInfo);
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm });
beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
if (mod != null)
AddStep($"select {mod}", () => SelectedMods.Value = new[] { Ruleset.Value.CreateInstance().CreateModFromAcronym(mod) });
selectBeatmap(beatmap);
checkDisplayedBPM(expectedDisplay);
}

View File

@ -415,9 +415,9 @@ namespace osu.Game.Screens.Select
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
rate = mod.ApplyToRate(0, rate);
int bpmMax = (int)Math.Round(beatmap.ControlPointInfo.BPMMaximum * rate);
int bpmMin = (int)Math.Round(beatmap.ControlPointInfo.BPMMinimum * rate);
int mostCommonBPM = (int)Math.Round(60000 / beatmap.GetMostCommonBeatLength() * rate);
int bpmMax = (int)Math.Round(Math.Round(beatmap.ControlPointInfo.BPMMaximum) * rate);
int bpmMin = (int)Math.Round(Math.Round(beatmap.ControlPointInfo.BPMMinimum) * rate);
int mostCommonBPM = (int)Math.Round(Math.Round(60000 / beatmap.GetMostCommonBeatLength()) * rate);
string labelText = bpmMin == bpmMax
? $"{bpmMin}"