From f1b0a12ee357012684c7b458e961075f04b303eb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:48:15 +0900 Subject: [PATCH 1/3] Rename BPMMultiplierAt -> SpeedMultiplierAt. --- osu.Game/Beatmaps/Timing/TimingInfo.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 0e47ba983b..1535ae8879 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -20,11 +20,11 @@ namespace osu.Game.Beatmaps.Timing } /// - /// Finds the BPM multiplier at a time. + /// Finds the speed multiplier at a time. /// - /// The time to find the BPM multiplier at. - /// The BPM multiplier. - public double BPMMultiplierAt(double time) + /// The time to find the speed multiplier at. + /// The speed multiplier. + public double SpeedMultiplierAt(double time) { ControlPoint overridePoint; ControlPoint timingPoint = TimingPointAt(time, out overridePoint); @@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps.Timing } /// - /// Finds the beat length at a time. + /// Finds the beat length at a time. This is expressed in milliseconds. /// /// The time to find the beat length at. - /// The beat length in milliseconds. + /// The beat length. public double BeatLengthAt(double time) { ControlPoint overridePoint; From ffe4d0ae4a569797aa9cb9386fda6738e6f651e2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:48:42 +0900 Subject: [PATCH 2/3] Remove BeatDistanceAt (does not express distance) and BeatVelocityAt. --- osu.Game/Beatmaps/Timing/TimingInfo.cs | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 1535ae8879..a0a3bd38f0 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -45,32 +45,6 @@ namespace osu.Game.Beatmaps.Timing return timingPoint.BeatLength; } - /// - /// Finds the beat velocity at a time. - /// - /// The time to find the velocity at. - /// The velocity. - public double BeatVelocityAt(double time) - { - ControlPoint overridePoint; - ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - - return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; - } - - /// - /// Finds the beat length at a time. - /// - /// The time to find the beat length at. - /// The beat length in positional length units. - public double BeatDistanceAt(double time) - { - ControlPoint overridePoint; - ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - - return (timingPoint?.BeatLength ?? 1) * (overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1); - } - /// /// Finds the timing point at a time. /// From 74bd4279977a8c7541a66a6701dbf982bd70850c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:10:20 +0900 Subject: [PATCH 3/3] Remove SliderVelocityAt, compute it manually inside hit objects. --- osu.Game.Modes.Osu/Objects/Slider.cs | 14 ++++++++------ osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 7 ++++++- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 7 ++++++- osu.Game/Beatmaps/Timing/TimingInfo.cs | 16 ---------------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 213a4a7bee..38d1dfda5d 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -14,6 +14,11 @@ namespace osu.Game.Modes.Osu.Objects { public class Slider : OsuHitObject, IHasCurve { + /// + /// Scoring distance with a speed-adjusted beat length of 1 second. + /// + private const float base_scoring_distance = 100; + public IHasCurve CurveObject { get; set; } public SliderCurve Curve => CurveObject.Curve; @@ -51,13 +56,10 @@ namespace osu.Game.Modes.Osu.Objects { base.ApplyDefaults(timing, difficulty); - ControlPoint overridePoint; - ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); - var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1; - var baseVelocity = 100 * difficulty.SliderMultiplier / velocityAdjustment; + double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / timing.SpeedMultiplierAt(StartTime); - Velocity = baseVelocity / timingPoint.BeatLength; - TickDistance = baseVelocity / difficulty.SliderTickRate; + Velocity = scoringDistance / timing.BeatLengthAt(StartTime); + TickDistance = scoringDistance / difficulty.SliderTickRate; } public IEnumerable Ticks diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 1f9241268b..40277e18fb 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -13,6 +13,11 @@ namespace osu.Game.Modes.Taiko.Objects { public class DrumRoll : TaikoHitObject, IHasDistance { + /// + /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. + /// + private const float base_distance = 100; + public double EndTime => StartTime + Distance / Velocity; public double Duration => EndTime - StartTime; @@ -59,7 +64,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; + Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime); TickTimeDistance = timing.BeatLengthAt(StartTime); //TODO: move this to legacy conversion code to allow for direct division without special case. diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index ac47a3bc88..327c0402ab 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -14,6 +14,11 @@ namespace osu.Game.Modes.Taiko.Objects /// public const float CIRCLE_RADIUS = 42f; + /// + /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. + /// + private const double base_scroll_time = 6000; + /// /// The time to scroll in the HitObject. /// @@ -34,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000; + PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index a0a3bd38f0..076618beea 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -76,21 +76,5 @@ namespace osu.Game.Beatmaps.Timing return timingPoint ?? ControlPoint.Default; } - - /// - /// Finds the slider velocity at a time. - /// - /// The time to find the slider velocity at. - /// The slider velocity in milliseconds. - public double SliderVelocityAt(double time) - { - const double base_scoring_distance = 100; - - double beatDistance = BeatDistanceAt(time); - - if (beatDistance > 0) - return base_scoring_distance / beatDistance * 1000; - return base_scoring_distance; - } } } \ No newline at end of file