1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Update the displayed BPM at song select with rate adjust mods

This only covers constant rate rate adjust mods. Mods like wind up/wind
down will need a more complex implementation which we haven't really
planned yet.
This commit is contained in:
Dean Herbert 2021-02-25 17:00:42 +09:00
parent a9aed0eef4
commit 31c52bd585

View File

@ -383,10 +383,18 @@ namespace osu.Game.Screens.Select
return labels.ToArray();
}
[Resolved]
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
private string getBPMRange(IBeatmap beatmap)
{
double bpmMax = beatmap.ControlPointInfo.BPMMaximum;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum;
// this doesn't consider mods which apply variable rates, yet.
double rate = 1;
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
rate = mod.ApplyToRate(0, rate);
double bpmMax = beatmap.ControlPointInfo.BPMMaximum * rate;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum * rate;
if (Precision.AlmostEquals(bpmMin, bpmMax))
return $"{bpmMin:0}";