Fix scrolling rulesets not accounting for slider multiplier

This commit is contained in:
smoogipoo 2018-10-01 18:12:26 +09:00
parent 1fe5ed5524
commit b68eeae777
2 changed files with 9 additions and 32 deletions

View File

@ -18,9 +18,14 @@ public class MultiplierControlPoint : IJsonSerializable, IComparable<MultiplierC
public double StartTime;
/// <summary>
/// The multiplier which this <see cref="MultiplierControlPoint"/> provides.
/// The aggregate multiplier which this <see cref="MultiplierControlPoint"/> provides.
/// </summary>
public double Multiplier => 1000 / TimingPoint.BeatLength * DifficultyPoint.SpeedMultiplier;
public double Multiplier => Velocity * DifficultyPoint.SpeedMultiplier * 1000 / TimingPoint.BeatLength;
/// <summary>
/// The velocity multiplier.
/// </summary>
public double Velocity = 1;
/// <summary>
/// The <see cref="TimingControlPoint"/> that provides the timing information for this <see cref="MultiplierControlPoint"/>.
@ -48,18 +53,6 @@ public MultiplierControlPoint(double startTime)
StartTime = startTime;
}
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/> by copying another <see cref="MultiplierControlPoint"/>.
/// </summary>
/// <param name="startTime">The start time of this <see cref="MultiplierControlPoint"/>.</param>
/// <param name="other">The <see cref="MultiplierControlPoint"/> to copy.</param>
public MultiplierControlPoint(double startTime, MultiplierControlPoint other)
: this(startTime)
{
TimingPoint = other.TimingPoint;
DifficultyPoint = other.DifficultyPoint;
}
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
public int CompareTo(MultiplierControlPoint other) => StartTime.CompareTo(other?.StartTime);
}

View File

@ -60,6 +60,7 @@ private void load()
return new MultiplierControlPoint(c.Time)
{
Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier,
TimingPoint = lastTimingPoint,
DifficultyPoint = lastDifficultyPoint
};
@ -78,7 +79,7 @@ private void load()
// If we have no control points, add a default one
if (DefaultControlPoints.Count == 0)
DefaultControlPoints.Add(new MultiplierControlPoint());
DefaultControlPoints.Add(new MultiplierControlPoint { Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier });
DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield));
}
@ -88,22 +89,5 @@ private void applySpeedAdjustment(MultiplierControlPoint controlPoint, Scrolling
playfield.HitObjects.AddControlPoint(controlPoint);
playfield.NestedPlayfields?.OfType<ScrollingPlayfield>().ForEach(p => applySpeedAdjustment(controlPoint, p));
}
/// <summary>
/// Generates a <see cref="MultiplierControlPoint"/> with the default timing change/difficulty change from the beatmap at a time.
/// </summary>
/// <param name="time">The time to create the control point at.</param>
/// <returns>The default <see cref="MultiplierControlPoint"/> at <paramref name="time"/>.</returns>
public MultiplierControlPoint CreateControlPointAt(double time)
{
if (DefaultControlPoints.Count == 0)
return new MultiplierControlPoint(time);
int index = DefaultControlPoints.BinarySearch(new MultiplierControlPoint(time));
if (index < 0)
return new MultiplierControlPoint(time);
return new MultiplierControlPoint(time, DefaultControlPoints[index]);
}
}
}