From 6a922da87e03bb1d9613859683580f39b21a5685 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 12:05:48 +0900 Subject: [PATCH] Move legacy_velocity_multiplier application to LegacyTimingInfo. --- .../Beatmaps/TaikoBeatmapConverter.cs | 23 +++++++++++++++---- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Beatmaps/Timing/ControlPoint.cs | 4 +++- osu.Game/Beatmaps/Timing/TimingInfo.cs | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 594ed5f309..42e21e43cf 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; +using osu.Game.Beatmaps.Timing; using osu.Game.Database; namespace osu.Game.Modes.Taiko.Beatmaps @@ -41,6 +42,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { return new Beatmap(original) { + TimingInfo = new LegacyTimingInfo(original.TimingInfo), HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() }; } @@ -100,7 +102,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = j, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } } @@ -113,7 +114,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, - VelocityMultiplier = legacy_velocity_multiplier }; } } @@ -128,7 +128,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), - VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -142,7 +141,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -152,10 +150,25 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } } } + + private class LegacyTimingInfo : TimingInfo + { + public LegacyTimingInfo(TimingInfo original) + { + if (original is LegacyTimingInfo) + ControlPoints.AddRange(original.ControlPoints); + else + { + ControlPoints.AddRange(original.ControlPoints.Select(c => c.Clone())); + + foreach (var c in ControlPoints) + c.SpeedMultiplier *= legacy_velocity_multiplier; + } + } + } } } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 748583606b..2bf282346a 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -215,7 +215,7 @@ namespace osu.Game.Beatmaps.Formats { Time = double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo), BeatLength = beatLength > 0 ? beatLength : 0, - VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, + SpeedMultiplier = beatLength < 0 ? -beatLength / 100.0 : 1, TimingChange = split.Length <= 6 || split[6][0] == '1', KiaiMode = (effectFlags & 1) > 0, OmitFirstBarLine = (effectFlags & 8) > 0, diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 40320a88d7..a08bc57ecd 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -14,9 +14,11 @@ namespace osu.Game.Beatmaps.Timing public TimeSignatures TimeSignature; public double Time; public double BeatLength; - public double VelocityAdjustment; + public double SpeedMultiplier; public bool TimingChange; public bool KiaiMode; public bool OmitFirstBarLine; + + public ControlPoint Clone() => (ControlPoint)MemberwiseClone(); } } diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 076618beea..fc4a6ad24c 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Timing ControlPoint overridePoint; ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; + return overridePoint?.SpeedMultiplier ?? timingPoint?.SpeedMultiplier ?? 1; } ///