From d2709613bc355d1158e577e650fdc1a3dec97d24 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:48:42 +0900 Subject: [PATCH] Add combo offset to ConvertHitObjectParser --- .../Legacy/Catch/ConvertHitObjectParser.cs | 8 +++--- .../Objects/Legacy/ConvertHitObjectParser.cs | 26 ++++++++++++------- .../Objects/Legacy/ConvertHitObjectType.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 8 +++--- .../Legacy/Osu/ConvertHitObjectParser.cs | 8 +++--- .../Legacy/Taiko/ConvertHitObjectParser.cs | 8 +++--- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 46be5ff3a5..35392cd237 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; } diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 4919aaea2b..77e5bd0e98 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -43,8 +43,11 @@ namespace osu.Game.Rulesets.Objects.Legacy Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture)); - ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax; + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ComboOffset; + bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); + int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4; + type &= ~ConvertHitObjectType.NewCombo; var soundType = (LegacySoundType)int.Parse(split[4]); @@ -54,7 +57,7 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(pos, combo); + result = CreateHit(pos, combo, comboOffset); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); @@ -159,11 +162,11 @@ namespace osu.Game.Rulesets.Objects.Legacy for (int i = 0; i < nodes; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); - result = CreateSlider(pos, combo, points, length, curveType, repeatCount, nodeSamples); + result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples); } else if (type.HasFlag(ConvertHitObjectType.Spinner)) { - result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset); + result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); @@ -181,7 +184,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(pos, combo, endTime + Offset); + result = CreateHold(pos, combo, comboOffset, endTime + Offset); } if (result == null) @@ -232,37 +235,42 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The hit object. - protected abstract HitObject CreateHit(Vector2 position, bool newCombo); + protected abstract HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset); /// /// Creats a legacy Slider-type hit object. /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The slider control points. /// The slider length. /// The slider curve type. /// The slider repeat count. /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. /// /// The position of the hit object. + /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The spinner end time. /// The hit object. - protected abstract HitObject CreateSpinner(Vector2 position, double endTime); + protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime); /// /// Creates a legacy Hold-type hit object. /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The hold end time. - protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime); + protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime); private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs index c0626c3e56..fa47e56de7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Objects.Legacy Slider = 1 << 1, NewCombo = 1 << 2, Spinner = 1 << 3, - ColourHax = 112, + ComboOffset = 1 << 4 | 1 << 5 | 1 << 6, Hold = 1 << 7 } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index e4d4fc4687..ab6cfa3061 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertHold { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index ca94234afc..7ef9865a96 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 20a9134dea..483e890392 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; }