From eaeee80a262abb31d9ef3664dec0b42ad2712ed0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Nov 2021 16:53:50 +0900 Subject: [PATCH 1/5] Fix PP counter showing incorrect values with rate adjustment mods --- osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index ef289c2a20..09ca326cce 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -48,6 +48,9 @@ namespace osu.Game.Screens.Play.HUD [CanBeNull] private GameplayState gameplayState { get; set; } + [Resolved(CanBeNull = true)] + private GameplayClock gameplayClock { get; set; } + [CanBeNull] private List timedAttributes; @@ -133,10 +136,12 @@ namespace osu.Game.Screens.Play.HUD [CanBeNull] private DifficultyAttributes getAttributeAtTime(JudgementResult judgement) { - if (timedAttributes == null || timedAttributes.Count == 0) + if (timedAttributes == null || timedAttributes.Count == 0 || gameplayClock == null) return null; - int attribIndex = timedAttributes.BinarySearch(new TimedDifficultyAttributes(judgement.HitObject.GetEndTime(), null)); + double judgementTime = judgement.HitObject.GetEndTime() / gameplayClock.TrueGameplayRate; + + int attribIndex = timedAttributes.BinarySearch(new TimedDifficultyAttributes(judgementTime, null)); if (attribIndex < 0) attribIndex = ~attribIndex - 1; From 0cdd2898feb831da98511e7f1189dcd6d3309a5b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Nov 2021 17:17:14 +0900 Subject: [PATCH 2/5] Expose non-adjusted time from CalculateTimed() --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 2 +- .../Rulesets/Difficulty/TimedDifficultyAttributes.cs | 7 +++++++ osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs | 9 ++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index eab81186d5..d410fb6edf 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Difficulty foreach (var skill in skills) skill.ProcessInternal(hitObject); - attribs.Add(new TimedDifficultyAttributes(hitObject.EndTime, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate))); + attribs.Add(new TimedDifficultyAttributes(hitObject.EndTime * clockRate, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate))); } return attribs; diff --git a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs index 973b2dacb2..28319ec6d7 100644 --- a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs @@ -11,7 +11,14 @@ namespace osu.Game.Rulesets.Difficulty /// public class TimedDifficultyAttributes : IComparable { + /// + /// The non-clock adjusted time value at which the attributes take effect. + /// public readonly double Time; + + /// + /// The attributes. + /// public readonly DifficultyAttributes Attributes; public TimedDifficultyAttributes(double time, DifficultyAttributes attributes) diff --git a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs index 09ca326cce..ef289c2a20 100644 --- a/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/PerformancePointsCounter.cs @@ -48,9 +48,6 @@ namespace osu.Game.Screens.Play.HUD [CanBeNull] private GameplayState gameplayState { get; set; } - [Resolved(CanBeNull = true)] - private GameplayClock gameplayClock { get; set; } - [CanBeNull] private List timedAttributes; @@ -136,12 +133,10 @@ namespace osu.Game.Screens.Play.HUD [CanBeNull] private DifficultyAttributes getAttributeAtTime(JudgementResult judgement) { - if (timedAttributes == null || timedAttributes.Count == 0 || gameplayClock == null) + if (timedAttributes == null || timedAttributes.Count == 0) return null; - double judgementTime = judgement.HitObject.GetEndTime() / gameplayClock.TrueGameplayRate; - - int attribIndex = timedAttributes.BinarySearch(new TimedDifficultyAttributes(judgementTime, null)); + int attribIndex = timedAttributes.BinarySearch(new TimedDifficultyAttributes(judgement.HitObject.GetEndTime(), null)); if (attribIndex < 0) attribIndex = ~attribIndex - 1; From efba7a9c4d70093a00ccb4f163c02c805b1248df Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Nov 2021 17:18:02 +0900 Subject: [PATCH 3/5] Missed hyphen --- osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs index 28319ec6d7..e61fa72de9 100644 --- a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Difficulty public class TimedDifficultyAttributes : IComparable { /// - /// The non-clock adjusted time value at which the attributes take effect. + /// The non-clock-adjusted time value at which the attributes take effect. /// public readonly double Time; From 168a7a588b62b3f087e1d6e9785b7e8eeb2f9959 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Nov 2021 17:19:14 +0900 Subject: [PATCH 4/5] Add xmldoc to ctor also --- osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs index e61fa72de9..2509971389 100644 --- a/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs @@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Difficulty /// public readonly DifficultyAttributes Attributes; + /// + /// Creates new . + /// + /// The non-clock-adjusted time value at which the attributes take effect. + /// The attributes. public TimedDifficultyAttributes(double time, DifficultyAttributes attributes) { Time = time; From 81aaef719fc58911d3ec94fc9c5c6bd2a77480b8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Nov 2021 17:55:00 +0900 Subject: [PATCH 5/5] Add xmldoc to CalculateTimed() --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index d410fb6edf..5b4284dc2f 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -58,6 +58,11 @@ namespace osu.Game.Rulesets.Difficulty return CreateDifficultyAttributes(Beatmap, playableMods, skills, clockRate); } + /// + /// Calculates the difficulty of the beatmap and returns a set of representing the difficulty at every relevant time value in the beatmap. + /// + /// The mods that should be applied to the beatmap. + /// The set of . public List CalculateTimed(params Mod[] mods) { preProcess(mods);