1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Consider slider lengths as part of Distance

This commit is contained in:
smoogipoo 2017-11-17 21:28:59 +09:00
parent 9260f5b64e
commit eb03b0db30
2 changed files with 18 additions and 9 deletions

View File

@ -46,10 +46,16 @@ namespace osu.Game.Rulesets.Osu.Objects
}
/// <summary>
/// The position of the cursor at the point of completion of this <see cref="OsuHitObject"/>.
/// This is set and used by difficulty calculation.
/// The position of the cursor at the point of completion of this <see cref="Slider"/> if it was hit
/// with as few movements as possible. This is set and used by difficulty calculation.
/// </summary>
internal Vector2? CursorPosition;
internal Vector2? LazyEndPosition;
/// <summary>
/// The distance travelled by the cursor upon completion of this <see cref="Slider"/> if it was hit
/// with as few movements as possible. This is set and used by difficulty calculation.
/// </summary>
internal float LazyTravelDistance;
public List<SampleInfoList> RepeatSamples { get; set; } = new List<SampleInfoList>();
public int RepeatCount { get; set; } = 1;

View File

@ -64,15 +64,17 @@ namespace osu.Game.Rulesets.Osu.OsuDifficulty.Preprocessing
}
Vector2 lastCursorPosition = t[1].StackedPosition;
float lastTravelDistance = 0;
var lastSlider = t[1] as Slider;
if (lastSlider != null)
{
computeSliderCursorPosition(lastSlider);
lastCursorPosition = lastSlider.CursorPosition ?? lastCursorPosition;
lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition;
lastTravelDistance = lastSlider.LazyTravelDistance;
}
Distance = (BaseObject.StackedPosition - lastCursorPosition).Length * scalingFactor;
Distance = (lastTravelDistance + (BaseObject.StackedPosition - lastCursorPosition).Length) * scalingFactor;
}
private void setTimingValues()
@ -84,14 +86,14 @@ namespace osu.Game.Rulesets.Osu.OsuDifficulty.Preprocessing
private void computeSliderCursorPosition(Slider slider)
{
if (slider.CursorPosition != null)
if (slider.LazyEndPosition != null)
return;
slider.CursorPosition = slider.StackedPosition;
slider.LazyEndPosition = slider.StackedPosition;
float approxFollowCircleRadius = (float)(slider.Radius * 3);
var computeVertex = new Action<double>(t =>
{
var diff = slider.PositionAt(t) - slider.CursorPosition.Value;
var diff = slider.PositionAt(t) - slider.LazyEndPosition.Value;
float dist = diff.Length;
if (dist > approxFollowCircleRadius)
@ -99,7 +101,8 @@ namespace osu.Game.Rulesets.Osu.OsuDifficulty.Preprocessing
// The cursor would be outside the follow circle, we need to move it
diff.Normalize(); // Obtain direction of diff
dist -= approxFollowCircleRadius;
slider.CursorPosition += diff * dist;
slider.LazyEndPosition += diff * dist;
slider.LazyTravelDistance += dist;
}
});