From 26c6313dec3a1286757f157947e93f10a61f2bdc Mon Sep 17 00:00:00 2001 From: ekrctb Date: Fri, 25 May 2018 19:11:29 +0900 Subject: [PATCH] catch: the fruit positions are finalized on the post process --- .../Beatmaps/CatchBeatmapProcessor.cs | 45 +++++++++++++++++++ .../Objects/BananaShower.cs | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index e16f5fcb60..91a69b5c34 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Objects.Types; using OpenTK; +using osu.Game.Rulesets.Catch.MathUtils; namespace osu.Game.Rulesets.Catch.Beatmaps { @@ -21,6 +22,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps public override void PostProcess() { + finalizePosition(); + initialiseHyperDash((List)Beatmap.HitObjects); base.PostProcess(); @@ -30,6 +33,48 @@ namespace osu.Game.Rulesets.Catch.Beatmaps obj.IndexInBeatmap = index++; } + public const int RNG_SEED = 1337; + + private void finalizePosition() + { + var rng = new FastRandom(RNG_SEED); + // todo: HardRock displacement should be applied here + + foreach (var obj in Beatmap.HitObjects) + { + switch (obj) + { + case BananaShower bananaShower: + foreach (var nested in bananaShower.NestedHitObjects) + { + ((BananaShower.Banana)nested).X = (float)rng.NextDouble(); + // discarding 3 times + rng.Next(); + rng.Next(); + rng.Next(); + } + break; + case JuiceStream juiceStream: + foreach (var nested in juiceStream.NestedHitObjects) + { + if (nested is TinyDroplet tinyDroplet) + { + tinyDroplet.X += (float)rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH; + } + else if (nested is Droplet) + { + rng.Next(); // Big droplets are not slided + } + } + break; + case Fruit fruit: + break; + } + var catchHitObject = obj as CatchHitObject; + + } + } + private void initialiseHyperDash(List objects) { // todo: add difficulty adjust. diff --git a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs index a6aba42f03..ed49359c0f 100644 --- a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = Samples, StartTime = i, - X = RNG.NextSingle() + X = 0 // The position will be set on the post processing }); }