1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 20:07:25 +08:00

Merge pull request #3232 from smoogipoo/fix-combo-colours

Implement hitobject combo offsets
This commit is contained in:
ekrctb 2018-08-16 10:54:02 +09:00 committed by GitHub
commit d110d19f99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 154 additions and 73 deletions

View File

@ -41,6 +41,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
RepeatCount = curveData.RepeatCount, RepeatCount = curveData.RepeatCount,
X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH, X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH,
NewCombo = comboData?.NewCombo ?? false, NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset ?? 0 LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset ?? 0
}; };
} }
@ -51,7 +52,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
StartTime = obj.StartTime, StartTime = obj.StartTime,
Samples = obj.Samples, Samples = obj.Samples,
Duration = endTime.Duration, Duration = endTime.Duration,
NewCombo = comboData?.NewCombo ?? false NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
}; };
} }
else else
@ -61,6 +63,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
StartTime = obj.StartTime, StartTime = obj.StartTime,
Samples = obj.Samples, Samples = obj.Samples,
NewCombo = comboData?.NewCombo ?? false, NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH
}; };
} }

View File

@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Catch.Objects
public virtual bool NewCombo { get; set; } public virtual bool NewCombo { get; set; }
public int ComboOffset { get; set; }
public int IndexInCurrentCombo { get; set; } public int IndexInCurrentCombo { get; set; }
public int ComboIndex { get; set; } public int ComboIndex { get; set; }

View File

@ -42,6 +42,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
RepeatCount = curveData.RepeatCount, RepeatCount = curveData.RepeatCount,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false, NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset
}; };
} }
@ -52,7 +53,9 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
StartTime = original.StartTime, StartTime = original.StartTime,
Samples = original.Samples, Samples = original.Samples,
EndTime = endTimeData.EndTime, EndTime = endTimeData.EndTime,
Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2 Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
}; };
} }
else else
@ -62,7 +65,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
StartTime = original.StartTime, StartTime = original.StartTime,
Samples = original.Samples, Samples = original.Samples,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
}; };
} }
} }

View File

@ -54,6 +54,8 @@ namespace osu.Game.Rulesets.Osu.Objects
public virtual bool NewCombo { get; set; } public virtual bool NewCombo { get; set; }
public int ComboOffset { get; set; }
public virtual int IndexInCurrentCombo { get; set; } public virtual int IndexInCurrentCombo { get; set; }
public virtual int ComboIndex { get; set; } public virtual int ComboIndex { get; set; }

View File

@ -186,6 +186,18 @@ namespace osu.Game.Tests.Beatmaps.Formats
} }
} }
[Test]
public void TestDecodeBeatmapComboOffsets()
{
var decoder = new LegacyBeatmapDecoder();
using (var resStream = Resource.OpenResource("hitobject-combo-offset.osu"))
using (var stream = new StreamReader(resStream))
{
var beatmap = decoder.Decode(stream);
Assert.AreEqual(3, ((IHasCombo)beatmap.HitObjects[0]).ComboOffset);
}
}
[Test] [Test]
public void TestDecodeBeatmapHitObjects() public void TestDecodeBeatmapHitObjects()
{ {

View File

@ -0,0 +1,4 @@
osu file format v14
[HitObjects]
255,193,2170,49,0,0:0:0:0:

View File

@ -27,11 +27,10 @@ namespace osu.Game.Beatmaps
if (obj.NewCombo) if (obj.NewCombo)
{ {
obj.IndexInCurrentCombo = 0; obj.IndexInCurrentCombo = 0;
obj.ComboIndex = (lastObj?.ComboIndex ?? 0) + obj.ComboOffset + 1;
if (lastObj != null) if (lastObj != null)
{
lastObj.LastInCombo = true; lastObj.LastInCombo = true;
obj.ComboIndex = lastObj.ComboIndex + 1;
}
} }
else if (lastObj != null) else if (lastObj != null)
{ {

View File

@ -126,16 +126,16 @@ namespace osu.Game.Beatmaps.Formats
switch (beatmap.BeatmapInfo.RulesetID) switch (beatmap.BeatmapInfo.RulesetID)
{ {
case 0: case 0:
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 1: case 1:
parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 2: case 2:
parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 3: case 3:
parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
} }
@ -405,9 +405,9 @@ namespace osu.Game.Beatmaps.Formats
{ {
// If the ruleset wasn't specified, assume the osu!standard ruleset. // If the ruleset wasn't specified, assume the osu!standard ruleset.
if (parser == null) if (parser == null)
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
var obj = parser.Parse(line, getOffsetTime()); var obj = parser.Parse(line);
if (obj != null) if (obj != null)
{ {

View File

@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
public float X { get; set; } public float X { get; set; }
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
} }
} }

View File

@ -13,21 +13,28 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
/// </summary> /// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{ {
protected override HitObject CreateHit(Vector2 position, bool newCombo) public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{ {
return new ConvertHit return new ConvertHit
{ {
X = position.X, X = position.X,
NewCombo = newCombo, NewCombo = newCombo,
ComboOffset = comboOffset
}; };
} }
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples) protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{ {
return new ConvertSlider return new ConvertSlider
{ {
X = position.X, X = position.X,
NewCombo = newCombo, NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset,
ControlPoints = controlPoints, ControlPoints = controlPoints,
Distance = length, Distance = length,
CurveType = curveType, CurveType = curveType,
@ -36,15 +43,17 @@ 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 return new ConvertSpinner
{ {
EndTime = endTime EndTime = endTime,
NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset
}; };
} }
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{ {
return null; return null;
} }

View File

@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
public float X { get; set; } public float X { get; set; }
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
} }
} }

View File

@ -8,10 +8,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
/// <summary> /// <summary>
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertSpinner : HitObject, IHasEndTime internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasCombo
{ {
public double EndTime { get; set; } public double EndTime { get; set; }
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
} }
} }

View File

@ -19,12 +19,25 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// </summary> /// </summary>
public abstract class ConvertHitObjectParser : HitObjectParser public abstract class ConvertHitObjectParser : HitObjectParser
{ {
public override HitObject Parse(string text) /// <summary>
/// The offset to apply to all time values.
/// </summary>
protected readonly double Offset;
/// <summary>
/// The beatmap version.
/// </summary>
protected readonly int FormatVersion;
protected bool FirstObject { get; private set; } = true;
protected ConvertHitObjectParser(double offset, int formatVersion)
{ {
return Parse(text, 0); Offset = offset;
FormatVersion = formatVersion;
} }
public HitObject Parse(string text, double offset) public override HitObject Parse(string text)
{ {
try try
{ {
@ -32,7 +45,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)); 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]);
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
type &= ~ConvertHitObjectType.ComboOffset;
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
type &= ~ConvertHitObjectType.NewCombo; type &= ~ConvertHitObjectType.NewCombo;
@ -43,7 +60,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (type.HasFlag(ConvertHitObjectType.Circle)) if (type.HasFlag(ConvertHitObjectType.Circle))
{ {
result = CreateHit(pos, combo); result = CreateHit(pos, combo, comboOffset);
if (split.Length > 5) if (split.Length > 5)
readCustomSampleBanks(split[5], bankInfo); readCustomSampleBanks(split[5], bankInfo);
@ -148,11 +165,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
for (int i = 0; i < nodes; i++) for (int i = 0; i < nodes; i++)
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[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)) 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) if (split.Length > 6)
readCustomSampleBanks(split[6], bankInfo); readCustomSampleBanks(split[6], bankInfo);
@ -170,15 +187,17 @@ namespace osu.Game.Rulesets.Objects.Legacy
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
} }
result = CreateHold(pos, combo, endTime + offset); result = CreateHold(pos, combo, comboOffset, endTime + Offset);
} }
if (result == null) if (result == null)
throw new InvalidOperationException($@"Unknown hit object type {type}."); throw new InvalidOperationException($@"Unknown hit object type {type}.");
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + offset; result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset;
result.Samples = convertSoundType(soundType, bankInfo); result.Samples = convertSoundType(soundType, bankInfo);
FirstObject = false;
return result; return result;
} }
catch (FormatException) catch (FormatException)
@ -221,37 +240,42 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// </summary> /// </summary>
/// <param name="position">The position of the hit object.</param> /// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param> /// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <returns>The hit object.</returns> /// <returns>The hit object.</returns>
protected abstract HitObject CreateHit(Vector2 position, bool newCombo); protected abstract HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset);
/// <summary> /// <summary>
/// Creats a legacy Slider-type hit object. /// Creats a legacy Slider-type hit object.
/// </summary> /// </summary>
/// <param name="position">The position of the hit object.</param> /// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param> /// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="controlPoints">The slider control points.</param> /// <param name="controlPoints">The slider control points.</param>
/// <param name="length">The slider length.</param> /// <param name="length">The slider length.</param>
/// <param name="curveType">The slider curve type.</param> /// <param name="curveType">The slider curve type.</param>
/// <param name="repeatCount">The slider repeat count.</param> /// <param name="repeatCount">The slider repeat count.</param>
/// <param name="repeatSamples">The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider.</param> /// <param name="repeatSamples">The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider.</param>
/// <returns>The hit object.</returns> /// <returns>The hit object.</returns>
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples); protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples);
/// <summary> /// <summary>
/// Creates a legacy Spinner-type hit object. /// Creates a legacy Spinner-type hit object.
/// </summary> /// </summary>
/// <param name="position">The position of the hit object.</param> /// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="endTime">The spinner end time.</param> /// <param name="endTime">The spinner end time.</param>
/// <returns>The hit object.</returns> /// <returns>The hit object.</returns>
protected abstract HitObject CreateSpinner(Vector2 position, double endTime); protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime);
/// <summary> /// <summary>
/// Creates a legacy Hold-type hit object. /// Creates a legacy Hold-type hit object.
/// </summary> /// </summary>
/// <param name="position">The position of the hit object.</param> /// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param> /// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="endTime">The hold end time.</param> /// <param name="endTime">The hold end time.</param>
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime); protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
private List<SampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) private List<SampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
{ {

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
Slider = 1 << 1, Slider = 1 << 1,
NewCombo = 1 << 2, NewCombo = 1 << 2,
Spinner = 1 << 3, Spinner = 1 << 3,
ColourHax = 112, ComboOffset = 1 << 4 | 1 << 5 | 1 << 6,
Hold = 1 << 7 Hold = 1 << 7
} }
} }

View File

@ -8,12 +8,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
/// <summary> /// <summary>
/// Legacy osu!mania Hit-type, used for parsing Beatmaps. /// Legacy osu!mania Hit-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertHit : HitObject, IHasXPosition, IHasCombo internal sealed class ConvertHit : HitObject, IHasXPosition
{ {
public float X { get; set; } public float X { get; set; }
public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -13,21 +13,24 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
/// </summary> /// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{ {
protected override HitObject CreateHit(Vector2 position, bool newCombo) public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{ {
return new ConvertHit return new ConvertHit
{ {
X = position.X, X = position.X
NewCombo = newCombo,
}; };
} }
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples) protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{ {
return new ConvertSlider return new ConvertSlider
{ {
X = position.X, X = position.X,
NewCombo = newCombo,
ControlPoints = controlPoints, ControlPoints = controlPoints,
Distance = length, Distance = length,
CurveType = curveType, CurveType = curveType,
@ -36,7 +39,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 return new ConvertSpinner
{ {
@ -45,7 +48,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 return new ConvertHold
{ {

View File

@ -8,12 +8,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
/// <summary> /// <summary>
/// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// Legacy osu!mania Slider-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition, IHasCombo internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition
{ {
public float X { get; set; } public float X { get; set; }
public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -14,21 +14,28 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// </summary> /// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{ {
protected override HitObject CreateHit(Vector2 position, bool newCombo) public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{ {
return new ConvertHit return new ConvertHit
{ {
Position = position, Position = position,
NewCombo = newCombo, NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset
}; };
} }
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples) protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{ {
return new ConvertSlider return new ConvertSlider
{ {
Position = position, Position = position,
NewCombo = newCombo, NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset,
ControlPoints = controlPoints, ControlPoints = controlPoints,
Distance = Math.Max(0, length), Distance = Math.Max(0, length),
CurveType = curveType, CurveType = curveType,
@ -37,16 +44,18 @@ 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 return new ConvertSpinner
{ {
Position = position, Position = position,
EndTime = endTime EndTime = endTime,
NewCombo = FormatVersion <= 8 || FirstObject || newCombo,
ComboOffset = comboOffset
}; };
} }
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{ {
return null; return null;
} }

View File

@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary> /// <summary>
/// Legacy osu! Spinner-type, used for parsing Beatmaps. /// Legacy osu! Spinner-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition, IHasCombo
{ {
public double EndTime { get; set; } public double EndTime { get; set; }
@ -22,5 +22,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public float Y => Position.Y; public float Y => Position.Y;
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
} }
} }

View File

@ -1,17 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Legacy.Taiko namespace osu.Game.Rulesets.Objects.Legacy.Taiko
{ {
/// <summary> /// <summary>
/// Legacy osu!taiko Hit-type, used for parsing Beatmaps. /// Legacy osu!taiko Hit-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertHit : HitObject, IHasCombo internal sealed class ConvertHit : HitObject
{ {
public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -13,19 +13,20 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
/// </summary> /// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{ {
protected override HitObject CreateHit(Vector2 position, bool newCombo) public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{ {
return new ConvertHit
{
NewCombo = newCombo,
};
} }
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples) protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit();
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{ {
return new ConvertSlider return new ConvertSlider
{ {
NewCombo = newCombo,
ControlPoints = controlPoints, ControlPoints = controlPoints,
Distance = length, Distance = length,
CurveType = curveType, CurveType = curveType,
@ -34,7 +35,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 return new ConvertSpinner
{ {
@ -42,7 +43,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; return null;
} }

View File

@ -1,17 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Legacy.Taiko namespace osu.Game.Rulesets.Objects.Legacy.Taiko
{ {
/// <summary> /// <summary>
/// Legacy osu!taiko Slider-type, used for parsing Beatmaps. /// Legacy osu!taiko Slider-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasCombo internal sealed class ConvertSlider : Legacy.ConvertSlider
{ {
public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => null; protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -12,5 +12,10 @@ namespace osu.Game.Rulesets.Objects.Types
/// Whether the HitObject starts a new combo. /// Whether the HitObject starts a new combo.
/// </summary> /// </summary>
bool NewCombo { get; } bool NewCombo { get; }
/// <summary>
/// When starting a new combo, the offset of the new combo relative to the current one.
/// </summary>
int ComboOffset { get; }
} }
} }