1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 14:27:51 +08:00

Merge pull request #30021 from bdach/fix-random-mod-broken-sr

Fix broken star rating on Random mod
This commit is contained in:
Dan Balasescu 2024-10-07 14:54:55 +09:00 committed by GitHub
commit b977a187e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 26 deletions

View File

@ -204,6 +204,7 @@ namespace osu.Game.Rulesets.Osu.Objects
SpanStartTime = e.SpanStartTime, SpanStartTime = e.SpanStartTime,
StartTime = e.Time, StartTime = e.Time,
Position = Position + Path.PositionAt(e.PathProgress), Position = Position + Path.PositionAt(e.PathProgress),
PathProgress = e.PathProgress,
StackHeight = StackHeight, StackHeight = StackHeight,
}); });
break; break;
@ -236,6 +237,7 @@ namespace osu.Game.Rulesets.Osu.Objects
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration, StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
Position = Position + Path.PositionAt(e.PathProgress), Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight, StackHeight = StackHeight,
PathProgress = e.PathProgress,
}); });
break; break;
} }
@ -248,14 +250,27 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
endPositionCache.Invalidate(); endPositionCache.Invalidate();
if (HeadCircle != null) foreach (var nested in NestedHitObjects)
HeadCircle.Position = Position; {
switch (nested)
{
case SliderHeadCircle headCircle:
headCircle.Position = Position;
break;
if (TailCircle != null) case SliderTailCircle tailCircle:
TailCircle.Position = EndPosition; tailCircle.Position = EndPosition;
break;
if (LastRepeat != null) case SliderRepeat repeat:
LastRepeat.Position = RepeatCount % 2 == 0 ? Position : Position + Path.PositionAt(1); repeat.Position = Position + Path.PositionAt(repeat.PathProgress);
break;
case SliderTick tick:
tick.Position = Position + Path.PositionAt(tick.PathProgress);
break;
}
}
} }
protected void UpdateNestedSamples() protected void UpdateNestedSamples()

View File

@ -5,6 +5,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public class SliderRepeat : SliderEndCircle public class SliderRepeat : SliderEndCircle
{ {
public double PathProgress { get; set; }
public SliderRepeat(Slider slider) public SliderRepeat(Slider slider)
: base(slider) : base(slider)
{ {

View File

@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public int SpanIndex { get; set; } public int SpanIndex { get; set; }
public double SpanStartTime { get; set; } public double SpanStartTime { get; set; }
public double PathProgress { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
{ {

View File

@ -232,8 +232,6 @@ namespace osu.Game.Rulesets.Osu.Utils
slider.Position = workingObject.PositionModified = new Vector2(newX, newY); slider.Position = workingObject.PositionModified = new Vector2(newX, newY);
workingObject.EndPositionModified = slider.EndPosition; workingObject.EndPositionModified = slider.EndPosition;
shiftNestedObjects(slider, workingObject.PositionModified - workingObject.PositionOriginal);
return workingObject.PositionModified - previousPosition; return workingObject.PositionModified - previousPosition;
} }
@ -307,22 +305,6 @@ namespace osu.Game.Rulesets.Osu.Utils
return new RectangleF(left, top, right - left, bottom - top); return new RectangleF(left, top, right - left, bottom - top);
} }
/// <summary>
/// Shifts all nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s by the specified shift.
/// </summary>
/// <param name="slider"><see cref="Slider"/> whose nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s should be shifted</param>
/// <param name="shift">The <see cref="Vector2"/> the <see cref="Slider"/>'s nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s should be shifted by</param>
private static void shiftNestedObjects(Slider slider, Vector2 shift)
{
foreach (var hitObject in slider.NestedHitObjects.Where(o => o is SliderTick || o is SliderRepeat))
{
if (!(hitObject is OsuHitObject osuHitObject))
continue;
osuHitObject.Position += shift;
}
}
/// <summary> /// <summary>
/// Clamp a position to playfield, keeping a specified distance from the edges. /// Clamp a position to playfield, keeping a specified distance from the edges.
/// </summary> /// </summary>
@ -431,7 +413,6 @@ namespace osu.Game.Rulesets.Osu.Utils
private class WorkingObject private class WorkingObject
{ {
public float RotationOriginal { get; } public float RotationOriginal { get; }
public Vector2 PositionOriginal { get; }
public Vector2 PositionModified { get; set; } public Vector2 PositionModified { get; set; }
public Vector2 EndPositionModified { get; set; } public Vector2 EndPositionModified { get; set; }
@ -442,7 +423,7 @@ namespace osu.Game.Rulesets.Osu.Utils
{ {
PositionInfo = positionInfo; PositionInfo = positionInfo;
RotationOriginal = HitObject is Slider slider ? getSliderRotation(slider) : 0; RotationOriginal = HitObject is Slider slider ? getSliderRotation(slider) : 0;
PositionModified = PositionOriginal = HitObject.Position; PositionModified = HitObject.Position;
EndPositionModified = HitObject.EndPosition; EndPositionModified = HitObject.EndPosition;
} }
} }