mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Fix time snap of sliders not matching when SV is not 1.0x
This regressed with https://github.com/ppy/osu/pull/20850 because the function was used in other places which expect it to factor slider velocity into the equation. Rather than reverting, I've added a new argument, as based on the method naming alone it was hard to discern whether SV should actually be considered. The reason for the change in #20850 was to avoid the SV coming in from a reference object which may not have a correct SV in the first place. In such cases, passing `false` to the function will give the expected behaviour.
This commit is contained in:
parent
00bd77ce76
commit
2a88409dfe
@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
IBindable<double> IDistanceSnapProvider.DistanceSpacingMultiplier => DistanceSpacingMultiplier;
|
||||
|
||||
public float GetBeatSnapDistanceAt(HitObject referenceObject) => beat_snap_distance;
|
||||
public float GetBeatSnapDistanceAt(HitObject referenceObject, bool useReferenceSliderVelocity = true) => beat_snap_distance;
|
||||
|
||||
public float DurationToDistance(HitObject referenceObject, double duration) => (float)duration;
|
||||
|
||||
|
@ -259,9 +259,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual float GetBeatSnapDistanceAt(HitObject referenceObject)
|
||||
public virtual float GetBeatSnapDistanceAt(HitObject referenceObject, bool useReferenceSliderVelocity = true)
|
||||
{
|
||||
return (float)(100 * EditorBeatmap.Difficulty.SliderMultiplier * 1 / BeatSnapProvider.BeatDivisor);
|
||||
return (float)(100 * (useReferenceSliderVelocity ? referenceObject.DifficultyControlPoint.SliderVelocity : 1) * EditorBeatmap.Difficulty.SliderMultiplier * 1 / BeatSnapProvider.BeatDivisor);
|
||||
}
|
||||
|
||||
public virtual float DurationToDistance(HitObject referenceObject, double duration)
|
||||
@ -273,7 +273,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
public virtual double DistanceToDuration(HitObject referenceObject, float distance)
|
||||
{
|
||||
double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime);
|
||||
return distance / GetBeatSnapDistanceAt(referenceObject) * beatLength;
|
||||
return distance / GetBeatSnapDistanceAt(referenceObject) * beatLength * referenceObject.DifficultyControlPoint.SliderVelocity;
|
||||
}
|
||||
|
||||
public virtual double FindSnappedDuration(HitObject referenceObject, float distance)
|
||||
|
@ -27,8 +27,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// Retrieves the distance between two points within a timing point that are one beat length apart.
|
||||
/// </summary>
|
||||
/// <param name="referenceObject">An object to be used as a reference point for this operation.</param>
|
||||
/// <param name="useReferenceSliderVelocity">Whether the <paramref name="referenceObject"/>'s slider velocity should be factored into the returned distance.</param>
|
||||
/// <returns>The distance between two points residing in the timing point that are one beat length apart.</returns>
|
||||
float GetBeatSnapDistanceAt(HitObject referenceObject);
|
||||
float GetBeatSnapDistanceAt(HitObject referenceObject, bool useReferenceSliderVelocity = true);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a duration to a distance without applying any snapping.
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
private void updateSpacing()
|
||||
{
|
||||
float distanceSpacingMultiplier = (float)DistanceSpacingMultiplier.Value;
|
||||
float beatSnapDistance = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject);
|
||||
float beatSnapDistance = SnapProvider.GetBeatSnapDistanceAt(ReferenceObject, false);
|
||||
|
||||
DistanceBetweenTicks = beatSnapDistance * distanceSpacingMultiplier;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user