1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 18:42:56 +08:00

catch: the fruit positions are finalized on the post process

This commit is contained in:
ekrctb 2018-05-25 19:11:29 +09:00
parent 8c8e87ed7a
commit 26c6313dec
2 changed files with 46 additions and 1 deletions

View File

@ -9,6 +9,7 @@ using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using OpenTK; using OpenTK;
using osu.Game.Rulesets.Catch.MathUtils;
namespace osu.Game.Rulesets.Catch.Beatmaps namespace osu.Game.Rulesets.Catch.Beatmaps
{ {
@ -21,6 +22,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
public override void PostProcess() public override void PostProcess()
{ {
finalizePosition();
initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects); initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects);
base.PostProcess(); base.PostProcess();
@ -30,6 +33,48 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
obj.IndexInBeatmap = index++; 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<CatchHitObject> objects) private void initialiseHyperDash(List<CatchHitObject> objects)
{ {
// todo: add difficulty adjust. // todo: add difficulty adjust.

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{ {
Samples = Samples, Samples = Samples,
StartTime = i, StartTime = i,
X = RNG.NextSingle() X = 0 // The position will be set on the post processing
}); });
} }