Skip to content

Commit

Permalink
add back protection against perfect curve segments with > 3 points
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Aug 21, 2024
1 parent db568bf commit eefd7cf
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,23 @@ private IEnumerable<ArraySegment<PathControlPoint>> convertPoints(PathType type,
vertices[i] = new PathControlPoint { Position = points[i] };

// Edge-case rules (to match stable).
if (type == PathType.PERFECT_CURVE && FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
if (type == PathType.PERFECT_CURVE)
{
int endPointLength = endPoint == null ? 0 : 1;

if (vertices.Length + endPointLength != 3)
type = PathType.BEZIER;
else if (isLinear(points[0], points[1], endPoint ?? points[2]))
if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
{
// osu-stable special-cased colinear perfect curves to a linear path
type = PathType.LINEAR;
if (vertices.Length + endPointLength != 3)
type = PathType.BEZIER;
else if (isLinear(points[0], points[1], endPoint ?? points[2]))
{
// osu-stable special-cased colinear perfect curves to a linear path
type = PathType.LINEAR;
}
}
else if (vertices.Length + endPointLength > 3)
// Lazer supports perfect curves with less than 3 points and colinear points
type = PathType.BEZIER;
}

// The first control point must have a definite type.
Expand Down

0 comments on commit eefd7cf

Please sign in to comment.