mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 12:32:58 +08:00
Merge branch 'master' into better-star-counter
This commit is contained in:
commit
d150eb4450
@ -29,26 +29,21 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
case CurveTypes.Linear:
|
case CurveTypes.Linear:
|
||||||
return subControlPoints;
|
return subControlPoints;
|
||||||
case CurveTypes.PerfectCurve:
|
case CurveTypes.PerfectCurve:
|
||||||
// If we have a different amount than 3 control points, use bezier for perfect curves.
|
//we can only use CircularArc iff we have exactly three control points and no dissection.
|
||||||
if (ControlPoints.Count != 3)
|
if (ControlPoints.Count != 3 || subControlPoints.Count != 3)
|
||||||
return new BezierApproximator(subControlPoints).CreateBezier();
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Assert(subControlPoints.Count == 3);
|
|
||||||
|
|
||||||
// Here we have exactly 3 control points. Attempt to fit a circular arc.
|
// Here we have exactly 3 control points. Attempt to fit a circular arc.
|
||||||
List<Vector2> subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc();
|
List<Vector2> subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc();
|
||||||
|
|
||||||
if (subpath.Count == 0)
|
// If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation.
|
||||||
// For some reason a circular arc could not be fit to the 3 given points. Fall back
|
if (subpath.Count == 0)
|
||||||
// to a numerically stable bezier approximation.
|
break;
|
||||||
subpath = new BezierApproximator(subControlPoints).CreateBezier();
|
|
||||||
|
|
||||||
return subpath;
|
return subpath;
|
||||||
}
|
|
||||||
default:
|
|
||||||
return new BezierApproximator(subControlPoints).CreateBezier();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new BezierApproximator(subControlPoints).CreateBezier();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculatePath()
|
private void calculatePath()
|
||||||
@ -181,7 +176,7 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
path.Clear();
|
path.Clear();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i);
|
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) ;
|
||||||
|
|
||||||
path.Add(interpolateVertices(i, d0) + Offset);
|
path.Add(interpolateVertices(i, d0) + Offset);
|
||||||
|
|
||||||
|
@ -119,10 +119,6 @@ namespace osu.Game.Database
|
|||||||
using (var reader = ArchiveReader.GetReader(storage, path))
|
using (var reader = ArchiveReader.GetReader(storage, path))
|
||||||
metadata = reader.ReadMetadata();
|
metadata = reader.ReadMetadata();
|
||||||
|
|
||||||
if (metadata.OnlineBeatmapSetID.HasValue &&
|
|
||||||
connection.Table<BeatmapSetInfo>().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0)
|
|
||||||
return; // TODO: Update this beatmap instead
|
|
||||||
|
|
||||||
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
||||||
{
|
{
|
||||||
using (var md5 = MD5.Create())
|
using (var md5 = MD5.Create())
|
||||||
@ -131,10 +127,26 @@ namespace osu.Game.Database
|
|||||||
hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
|
hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
|
||||||
input.Seek(0, SeekOrigin.Begin);
|
input.Seek(0, SeekOrigin.Begin);
|
||||||
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
|
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
|
||||||
using (var output = storage.GetStream(path, FileAccess.Write))
|
if (!storage.Exists(path))
|
||||||
input.CopyTo(output);
|
using (var output = storage.GetStream(path, FileAccess.Write))
|
||||||
|
input.CopyTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var existing = connection.Table<BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);
|
||||||
|
|
||||||
|
if (existing != null)
|
||||||
|
{
|
||||||
|
if (existing.DeletePending)
|
||||||
|
{
|
||||||
|
existing.DeletePending = false;
|
||||||
|
Update(existing, false);
|
||||||
|
BeatmapSetAdded?.Invoke(existing);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var beatmapSet = new BeatmapSetInfo
|
var beatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
||||||
|
Loading…
Reference in New Issue
Block a user