From bd633889e79da9db86f1163cc24463f19a682602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Sep 2023 08:23:39 +0200 Subject: [PATCH] Remove local preempt time calculation And just use a hitcircle, and read the actual value. Comes with 100% less chance of forgetting to update either place in the future. --- osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs index 933771321c..be41355846 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs @@ -1,15 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Mods { @@ -76,11 +77,13 @@ namespace osu.Game.Rulesets.Osu.Mods public partial class ApproachRateSlider : RoundedSliderBar { public override LocalisableString TooltipText => - $"{base.TooltipText} ({millisecondsFromApproachRate(Current.Value, 1.0f)} ms)"; + $"{base.TooltipText} ({getPreemptTime(Current.Value):0} ms)"; - private double millisecondsFromApproachRate(float value, float clockRate) + private double getPreemptTime(float approachRate) { - return Math.Round(1800 - Math.Min(value, 5) * 120 - (value >= 5 ? (value - 5) * 150 : 0) / clockRate); + var hitCircle = new HitCircle(); + hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { ApproachRate = approachRate }); + return hitCircle.TimePreempt; } } }