Merge branch 'master' into fix-skin-layout-editor-crash

This commit is contained in:
Dean Herbert
2021-10-28 06:24:20 +09:00
322 changed files with 2368 additions and 979 deletions

View File

@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Objects
for (double t = currentTimingPoint.Time; Precision.DefinitelyBigger(endTime, t); t += barLength, currentBeat++)
{
var roundedTime = Math.Round(t, MidpointRounding.AwayFromZero);
double roundedTime = Math.Round(t, MidpointRounding.AwayFromZero);
// in the case of some bar lengths, rounding errors can cause t to be slightly less than
// the expected whole number value due to floating point inaccuracies.

View File

@ -568,7 +568,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (Result != null && Result.HasResult)
{
var endTime = HitObject.GetEndTime();
double endTime = HitObject.GetEndTime();
if (Result.TimeOffset + endTime > Time.Current)
{

View File

@ -119,6 +119,8 @@ namespace osu.Game.Rulesets.Objects
DifficultyControlPoint = (DifficultyControlPoint)legacyInfo.DifficultyPointAt(StartTime).DeepClone();
DifficultyControlPoint.Time = StartTime;
}
else if (DifficultyControlPoint == DifficultyControlPoint.DEFAULT)
DifficultyControlPoint = new DifficultyControlPoint();
ApplyDefaultsToSelf(controlPointInfo, difficulty);
@ -128,6 +130,8 @@ namespace osu.Game.Rulesets.Objects
SampleControlPoint = (SampleControlPoint)legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency).DeepClone();
SampleControlPoint.Time = this.GetEndTime() + control_point_leniency;
}
else if (SampleControlPoint == SampleControlPoint.DEFAULT)
SampleControlPoint = new SampleControlPoint();
nestedHitObjects.Clear();

View File

@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (i >= adds.Length)
break;
int.TryParse(adds[i], out var sound);
int.TryParse(adds[i], out int sound);
nodeSoundTypes[i] = (LegacyHitSoundType)sound;
}
}

View File

@ -18,10 +18,10 @@ namespace osu.Game.Rulesets.Objects
// This exists for edge cases such as /b/1573664 where the beatmap has been edited by the user, and should never be reached in normal usage.
const double max_length = 100000;
var length = Math.Min(max_length, totalDistance);
double length = Math.Min(max_length, totalDistance);
tickDistance = Math.Clamp(tickDistance, 0, length);
var minDistanceFromEnd = velocity * 10;
double minDistanceFromEnd = velocity * 10;
yield return new SliderEventDescriptor
{
@ -34,10 +34,10 @@ namespace osu.Game.Rulesets.Objects
if (tickDistance != 0)
{
for (var span = 0; span < spanCount; span++)
for (int span = 0; span < spanCount; span++)
{
var spanStartTime = startTime + span * spanDuration;
var reversed = span % 2 == 1;
double spanStartTime = startTime + span * spanDuration;
bool reversed = span % 2 == 1;
var ticks = generateTicks(span, spanStartTime, spanDuration, reversed, length, tickDistance, minDistanceFromEnd, cancellationToken);
@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Objects
private static IEnumerable<SliderEventDescriptor> generateTicks(int spanIndex, double spanStartTime, double spanDuration, bool reversed, double length, double tickDistance,
double minDistanceFromEnd, CancellationToken cancellationToken = default)
{
for (var d = tickDistance; d <= length; d += tickDistance)
for (double d = tickDistance; d <= length; d += tickDistance)
{
cancellationToken.ThrowIfCancellationRequested();
@ -123,8 +123,8 @@ namespace osu.Game.Rulesets.Objects
break;
// Always generate ticks from the start of the path rather than the span to ensure that ticks in repeat spans are positioned identically to those in non-repeat spans
var pathProgress = d / length;
var timeProgress = reversed ? 1 - pathProgress : pathProgress;
double pathProgress = d / length;
double timeProgress = reversed ? 1 - pathProgress : pathProgress;
yield return new SliderEventDescriptor
{

View File

@ -280,6 +280,13 @@ namespace osu.Game.Rulesets.Objects
if (ExpectedDistance.Value is double expectedDistance && calculatedLength != expectedDistance)
{
// In osu-stable, if the last two control points of a slider are equal, extension is not performed.
if (ControlPoints.Count >= 2 && ControlPoints[^1].Position == ControlPoints[^2].Position && expectedDistance > calculatedLength)
{
cumulativeLength.Add(calculatedLength);
return;
}
// The last length is always incorrect
cumulativeLength.RemoveAt(cumulativeLength.Count - 1);

View File

@ -19,20 +19,23 @@ namespace osu.Game.Rulesets.Objects
public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOffset)
{
var points = sliderPath.ControlPoints.ToArray();
positionalOffset = points.Last().Position;
positionalOffset = sliderPath.PositionAt(1);
sliderPath.ControlPoints.Clear();
PathType? lastType = null;
for (var i = 0; i < points.Length; i++)
for (int i = 0; i < points.Length; i++)
{
var p = points[i];
p.Position -= positionalOffset;
// propagate types forwards to last null type
if (i == points.Length - 1)
{
p.Type = lastType;
p.Position = Vector2.Zero;
}
else if (p.Type != null)
(p.Type, lastType) = (lastType, p.Type);