Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions osu.Game.Rulesets.Catch.Tests/CatchBeatmapProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects;

namespace osu.Game.Rulesets.Catch.Tests
{
Expand Down Expand Up @@ -54,5 +56,64 @@ public void TestHardRockOffsetDoublePrecision()
Assert.That(secondObj.XOffset, Is.Not.EqualTo(0).Within(0.001));
Assert.That(secondObj.XOffset, Is.EqualTo(33.2f).Within(0.001));
}

[Test]
public void TestHardRockJuiceStreamTimeOffset()
{
var beatmap = new Beatmap<CatchHitObject>
{
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty { SliderMultiplier = 1, SliderTickRate = 1 }
},
HitObjects = new List<CatchHitObject>
{
new JuiceStream
{
StartTime = 1000,
Path = new SliderPath(new[]
{
new PathControlPoint(osuTK.Vector2.Zero),
new PathControlPoint(new osuTK.Vector2(0, 100))
}, 100),
X = 100
},
new Fruit
{
StartTime = 2200,
X = 110
}
}
};

beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });

foreach (var obj in beatmap.HitObjects)
obj.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);

// Confirm calculated duration
var juiceStream = (JuiceStream)beatmap.HitObjects[0];
Assert.That(juiceStream.EndTime, Is.EqualTo(2000));

var processor = new CatchBeatmapProcessor(beatmap)
{
HardRockOffsets = true
};

processor.ApplyPositionOffsets(beatmap);

var fruit = beatmap.HitObjects[1];

// If start time (1000) is used: diff = 2200 - 1000 = 1200 > 1000 -> Reset -> XOffset = 0.
// If end time (2000) is used: diff = 2200 - 2000 = 200 < 1000 -> Offset applied -> XOffset != 0.
// Position difference is 110 - 100 = 10.
// 10 < 200 / 3 (66.6) is True.
// ApplyOffset adds 10 to offsetPosition (starts at 110). New offsetPosition = 120.
// XOffset = 120 - 110 = 10.

// We expect the fix to result in offset being applied.
Assert.That(fruit.XOffset, Is.Not.Zero, "Fruit should have HardRock offset applied if correct time is used.");
Assert.That(fruit.XOffset, Is.EqualTo(10), "Fruit offset amount incorrect.");
}
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public void ApplyPositionOffsets(IBeatmap beatmap)
// Todo: BUG!! Stable used the last control point as the final position of the path, but it should use the computed path instead.
lastPosition = juiceStream.OriginalX + juiceStream.Path.ControlPoints[^1].Position.X;

// Todo: BUG!! Stable attempted to use the end time of the stream, but referenced it too early in execution and used the start time instead.
lastStartTime = juiceStream.StartTime;
lastStartTime = juiceStream.EndTime;

foreach (var nested in juiceStream.NestedHitObjects)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public void SetupSteps()
public void TestDeleteViaRightClick()
{
ScoreInfo scoreBeingDeleted = null;

AddUntilStep("wait for top score", () => leaderboard.ChildrenOfType<LeaderboardScore>().Any());
AddStep("open menu for top score", () =>
{
var leaderboardScore = leaderboard.ChildrenOfType<LeaderboardScore>().First();
Expand Down
9 changes: 6 additions & 3 deletions osu.Game/Overlays/SkinEditor/SkinBlueprint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ internal partial class AnchorOriginVisualiser : CompositeDrawable
{
private readonly Drawable drawable;

private Drawable originBox = null!;
private Drawable? originBox;

private Drawable anchorBox = null!;
private Drawable anchorLine = null!;
private Drawable? anchorBox;
private Drawable? anchorLine;

public AnchorOriginVisualiser(Drawable drawable)
{
Expand Down Expand Up @@ -202,6 +202,9 @@ protected override void Update()
{
base.Update();

if (anchorBox == null || originBox == null || anchorLine == null)
return;

if (drawable.Parent == null)
return;

Expand Down