mirror of
https://github.com/ppy/osu
synced 2024-12-11 09:27:08 +00:00
Prefer legacy curve format if possible
This commit is contained in:
parent
d35d34c01b
commit
dedae69db8
@ -246,27 +246,42 @@ 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];
|
||||||
|
|
||||||
switch (point.Type.Value)
|
if (point.Type.Value != null)
|
||||||
{
|
{
|
||||||
case PathType.Bezier:
|
if (point.Type.Value != lastType)
|
||||||
writer.Write("B|");
|
{
|
||||||
break;
|
switch (point.Type.Value)
|
||||||
|
{
|
||||||
|
case PathType.Bezier:
|
||||||
|
writer.Write("B|");
|
||||||
|
break;
|
||||||
|
|
||||||
case PathType.Catmull:
|
case PathType.Catmull:
|
||||||
writer.Write("C|");
|
writer.Write("C|");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PathType.PerfectCurve:
|
case PathType.PerfectCurve:
|
||||||
writer.Write("P|");
|
writer.Write("P|");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PathType.Linear:
|
case PathType.Linear:
|
||||||
writer.Write("L|");
|
writer.Write("L|");
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user