1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Fix linear perfect-curves not being cased to CurveType.Linear

Fixes #2151.
This commit is contained in:
smoogipoo 2018-03-02 16:25:08 +09:00
parent cdca7371a3
commit 8a15d4e677

View File

@ -9,6 +9,7 @@ using System.Globalization;
using osu.Game.Beatmaps.Formats;
using osu.Game.Audio;
using System.Linq;
using osu.Framework.MathUtils;
namespace osu.Game.Rulesets.Objects.Legacy
{
@ -74,6 +75,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
points.Add(new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)) - pos);
}
// osu-stable special-cased colinear perfect curves to a CurveType.Linear
bool isLinear(List<Vector2> p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y));
if (points.Count == 3 && curveType == CurveType.PerfectCurve && isLinear(points))
curveType = CurveType.Linear;
int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
if (repeatCount > 9000)