mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Merge pull request #24848 from Magnus-Cosmos/fix-slider-length
Use correct check for slider path extension
This commit is contained in:
commit
46acd807f7
@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
[TestCase("colinear-perfect-curve")]
|
||||
[TestCase("slider-ticks")]
|
||||
[TestCase("slider-ticks-edge-case")]
|
||||
[TestCase("slider-paths-edge-case")]
|
||||
[TestCase("repeat-slider")]
|
||||
[TestCase("uneven-repeat-slider")]
|
||||
[TestCase("old-stacking")]
|
||||
|
@ -0,0 +1,94 @@
|
||||
{
|
||||
"Mappings": [
|
||||
{
|
||||
"StartTime": 46060.0,
|
||||
"Objects": [
|
||||
{
|
||||
"StartTime": 46060.0,
|
||||
"EndTime": 46060.0,
|
||||
"X": 160.0,
|
||||
"Y": 208.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 46398.0,
|
||||
"EndTime": 46398.0,
|
||||
"X": 160.980164,
|
||||
"Y": 317.779083,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 46737.0,
|
||||
"EndTime": 46737.0,
|
||||
"X": 268.887268,
|
||||
"Y": 320.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 47040.0,
|
||||
"EndTime": 47040.0,
|
||||
"X": 378.995544,
|
||||
"Y": 320.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"StartTime": 123348.0,
|
||||
"Objects": [
|
||||
{
|
||||
"StartTime": 123348.0,
|
||||
"EndTime": 123348.0,
|
||||
"X": 352.0,
|
||||
"Y": 160.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 123686.0,
|
||||
"EndTime": 123686.0,
|
||||
"X": 351.019836,
|
||||
"Y": 50.2209129,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 124025.0,
|
||||
"EndTime": 124025.0,
|
||||
"X": 243.112747,
|
||||
"Y": 48.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"StartTime": 124328.0,
|
||||
"EndTime": 124328.0,
|
||||
"X": 133.004471,
|
||||
"Y": 48.0,
|
||||
"StackOffset": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
osu file format v6
|
||||
|
||||
[General]
|
||||
StackLeniency: 0.7
|
||||
|
||||
[Difficulty]
|
||||
HPDrainRate:1
|
||||
CircleSize:3
|
||||
OverallDifficulty:1
|
||||
SliderMultiplier:1.1
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
-41,338.983050847458,4,1,0,70,1,0
|
||||
93648,-100,4,1,0,70,0,0
|
||||
|
||||
[HitObjects]
|
||||
160,208,46060,6,0,B|161:320|161:320|271:320|271:320,1,330,8|0
|
||||
352,160,123348,6,0,B|351:48|351:48|241:48|241:48,1,330,8|0
|
@ -262,9 +262,16 @@ namespace osu.Game.Rulesets.Objects
|
||||
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
||||
var segmentType = ControlPoints[start].Type ?? PathType.Linear;
|
||||
|
||||
foreach (Vector2 t in calculateSubPath(segmentVertices, segmentType))
|
||||
// No need to calculate path when there is only 1 vertex
|
||||
if (segmentVertices.Length == 1)
|
||||
calculatedPath.Add(segmentVertices[0]);
|
||||
else if (segmentVertices.Length > 1)
|
||||
{
|
||||
if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
|
||||
List<Vector2> subPath = calculateSubPath(segmentVertices, segmentType);
|
||||
// Skip the first vertex if it is the same as the last vertex from the previous segment
|
||||
int skipFirst = calculatedPath.Count > 0 && subPath.Count > 0 && calculatedPath.Last() == subPath[0] ? 1 : 0;
|
||||
|
||||
foreach (Vector2 t in subPath.Skip(skipFirst))
|
||||
calculatedPath.Add(t);
|
||||
}
|
||||
|
||||
@ -328,8 +335,8 @@ 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)
|
||||
// In osu-stable, if the last two path points of a slider are equal, extension is not performed.
|
||||
if (calculatedPath.Count >= 2 && calculatedPath[^1] == calculatedPath[^2] && expectedDistance > calculatedLength)
|
||||
{
|
||||
cumulativeLength.Add(calculatedLength);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user