Prefer legacy curve format if possible

This commit is contained in:
smoogipoo 2019-12-12 19:52:15 +09:00
parent d35d34c01b
commit dedae69db8

View File

@ -246,10 +246,16 @@ namespace osu.Game.Beatmaps.Formats
if (hitObject is IHasCurve curveData) if (hitObject is IHasCurve curveData)
{ {
PathType? lastType = null;
for (int i = 0; i < curveData.Path.ControlPoints.Count; i++) for (int i = 0; i < curveData.Path.ControlPoints.Count; i++)
{ {
PathControlPoint point = curveData.Path.ControlPoints[i]; PathControlPoint point = curveData.Path.ControlPoints[i];
if (point.Type.Value != null)
{
if (point.Type.Value != lastType)
{
switch (point.Type.Value) switch (point.Type.Value)
{ {
case PathType.Bezier: case PathType.Bezier:
@ -269,6 +275,15 @@ namespace osu.Game.Beatmaps.Formats
break; break;
} }
lastType = point.Type.Value;
}
else
{
// New segment with the same type - duplicate the control point
writer.Write(FormattableString.Invariant($"{positionData.X + point.Position.Value.X}:{positionData.Y + point.Position.Value.Y}|"));
}
}
if (i != 0) if (i != 0)
{ {
writer.Write(FormattableString.Invariant($"{positionData.X + point.Position.Value.X}:{positionData.Y + point.Position.Value.Y}")); writer.Write(FormattableString.Invariant($"{positionData.X + point.Position.Value.X}:{positionData.Y + point.Position.Value.Y}"));