From cafdbc2d251626dd3dc624c9a7044db3e9828f5a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 13 Jun 2018 18:39:26 +0900 Subject: [PATCH] Fix discarding too many RNG values, and add test --- .../CatchBeatmapConversionTest.cs | 12 +++ .../Beatmaps/CatchBeatmapProcessor.cs | 6 +- .../Beatmaps/spinner-expected-conversion.json | 74 +++++++++++++++++++ .../Resources/Testing/Beatmaps/spinner.osu | 20 +++++ 4 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner-expected-conversion.json create mode 100644 osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner.osu diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 5b34e46247..9de0ce3565 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; [TestCase("basic"), Ignore("See: https://github.com/ppy/osu/issues/2232")] + [TestCase("spinner")] public new void Test(string name) { base.Test(name); @@ -35,6 +36,17 @@ namespace osu.Game.Rulesets.Catch.Tests }; } } + else if (hitObject is BananaShower shower) + { + foreach (var nested in shower.NestedHitObjects) + { + yield return new ConvertValue + { + StartTime = nested.StartTime, + Position = ((CatchHitObject)nested).X * CatchPlayfield.BASE_WIDTH + }; + } + } else { yield return new ConvertValue diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 869bc560a8..a9fbc8bcb2 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -48,10 +48,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps foreach (var nested in bananaShower.NestedHitObjects) { ((BananaShower.Banana)nested).X = (float)rng.NextDouble(); - // discarding 3 times - rng.Next(); - rng.Next(); - rng.Next(); + rng.Next(); // osu!stable retrieved a random banana type + rng.Next(); // osu!stable retrieved a random banana rotation } break; case JuiceStream juiceStream: diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner-expected-conversion.json b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner-expected-conversion.json new file mode 100644 index 0000000000..933adb4acc --- /dev/null +++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner-expected-conversion.json @@ -0,0 +1,74 @@ +{ + "Mappings": [{ + "StartTime": 18500, + "Objects": [{ + "StartTime": 18500, + "Position": 65 + }, + { + "StartTime": 18559, + "Position": 459 + }, + { + "StartTime": 18618, + "Position": 255 + }, + { + "StartTime": 18678, + "Position": 113 + }, + { + "StartTime": 18737, + "Position": 315 + }, + { + "StartTime": 18796, + "Position": 17 + }, + { + "StartTime": 18856, + "Position": 482 + }, + { + "StartTime": 18915, + "Position": 44 + }, + { + "StartTime": 18975, + "Position": 310 + }, + { + "StartTime": 19034, + "Position": 244 + }, + { + "StartTime": 19093, + "Position": 18 + }, + { + "StartTime": 19153, + "Position": 482 + }, + { + "StartTime": 19212, + "Position": 243 + }, + { + "StartTime": 19271, + "Position": 332 + }, + { + "StartTime": 19331, + "Position": 477 + }, + { + "StartTime": 19390, + "Position": 376 + }, + { + "StartTime": 19450, + "Position": 104 + } + ] + }] +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner.osu b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner.osu new file mode 100644 index 0000000000..0fbd4dbf42 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/spinner.osu @@ -0,0 +1,20 @@ +osu file format v14 + +[General] +Mode: 2 + +[Difficulty] +HPDrainRate:6 +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +13426,-100,4,3,1,45,0,0 +14884,-100,4,2,1,50,0,0 + +[HitObjects] +256,192,18500,12,0,19450,0:0:0:0: