From ccc2253068a669158cc8f9fcbc94f0d34ce42fd8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:39:38 +0900 Subject: [PATCH 1/8] Implement basic Taiko HitObject conversion. --- .../Beatmaps/TaikoBeatmapConverter.cs | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index d78c347f22..0fa7572cd4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,8 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Taiko.Objects; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -11,9 +15,52 @@ namespace osu.Game.Modes.Taiko.Beatmaps { public Beatmap Convert(Beatmap original) { + if (original is IIsLegacy) + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + return new Beatmap(original) { - HitObjects = new List() // Todo: Implement + HitObjects = convertHitObjects(original.HitObjects) + }; + } + + private List convertHitObjects(List hitObjects) + { + return hitObjects.Select(convertHitObject).ToList(); + } + + private TaikoHitObject convertHitObject(HitObject original) + { + IHasDistance distanceData = original as IHasDistance; + IHasRepeats repeatsData = original as IHasRepeats; + IHasEndTime endTimeData = original as IHasEndTime; + + if (distanceData != null) + { + return new DrumRoll + { + StartTime = original.StartTime, + Sample = original.Sample, + + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) + }; + } + + if (endTimeData != null) + { + return new Bash + { + StartTime = original.StartTime, + Sample = original.Sample, + + EndTime = endTimeData.EndTime + }; + } + + return new TaikoHitObject + { + StartTime = original.StartTime, + Sample = original.Sample, }; } } From 4a85b899c9a9fdf9adbbcb0510adebd5134e1fd2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:44:48 +0900 Subject: [PATCH 2/8] Fix up VelocityAdjustment value. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 0fa7572cd4..e89ba110be 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -13,10 +13,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps { internal class TaikoBeatmapConverter : IBeatmapConverter { + private const float legacy_velocity_scale = 1.4f; + public Beatmap Convert(Beatmap original) { if (original is IIsLegacy) - original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) { From 7f7e8047d4dcf4c6b9bdf6cb99580d2edaa8ed47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:51:56 +0900 Subject: [PATCH 3/8] Don't convert originally taiko hitobjects. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index e89ba110be..6533295ce4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -33,6 +33,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps private TaikoHitObject convertHitObject(HitObject original) { + // Check if this HitObject is already a TaikoHitObject, and return it if so + TaikoHitObject originalTaiko = original as TaikoHitObject; + if (originalTaiko != null) + return originalTaiko; + IHasDistance distanceData = original as IHasDistance; IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; From 605f733cf905f299050af7f0212662eb11e06c56 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:52:24 +0900 Subject: [PATCH 4/8] Add back the bash conversion factor. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 6533295ce4..00a17c017c 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -14,6 +14,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps internal class TaikoBeatmapConverter : IBeatmapConverter { private const float legacy_velocity_scale = 1.4f; + private const float bash_convert_factor = 1.65f; public Beatmap Convert(Beatmap original) { @@ -55,12 +56,13 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (endTimeData != null) { + // We compute the end time manually to add in the Bash convert factor return new Bash { StartTime = original.StartTime, Sample = original.Sample, - EndTime = endTimeData.EndTime + EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor }; } From 2a9e8f4ed6b98aa4ac8e3eb83751d022f5ede0cf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:54:36 +0900 Subject: [PATCH 5/8] Fix license headers. --- osu.Game/Beatmaps/Legacy/IIsLegacy.cs | 5 ++++- osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs index 23ab9f4bc4..3babd3e66f 100644 --- a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs +++ b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A Beatmap that was loaded from a legacy .osu beatmap file (version <=15). diff --git a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs index 00aeeb2b49..d0386e7560 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A type of Beatmap loaded from a legacy .osu beatmap file (version <=15). From 77bdfe880a54a00e53c3aa8f05a775f3f95b4489 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:34:45 +0900 Subject: [PATCH 6/8] Fix post-merge errors. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 00a17c017c..06c0b6c994 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { - if (original is IIsLegacy) + if (original is LegacyBeatmap) original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) From f4f571590658415d9dbe44e7a291040006427b46 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:37:48 +0900 Subject: [PATCH 7/8] Resharper. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 9ce2758d84..eebbb4717e 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; @@ -68,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); if (difficulty.SliderTickRate == 3) From b77b039d73dfd867e7aac68e930fd9e4edca9f7f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:25:38 +0900 Subject: [PATCH 8/8] Don't instantiate TaikoHitObject. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 06c0b6c994..0606ee4d5a 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -66,7 +66,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps }; } - return new TaikoHitObject + return new Hit { StartTime = original.StartTime, Sample = original.Sample,