mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Distance object generator should output a secondary pattern
In osu!stable, only the hitobjects which ended at the distance object's EndTime would be considered for further pattern generation. Previously this generator was group _all_ objects including those that don't end at the object's EndTime, resulting in incorrect hitobject count for further pattern generation.
This commit is contained in:
parent
2d59ae9354
commit
55f0b3c42c
@ -119,10 +119,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
{
|
||||
var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap);
|
||||
|
||||
Pattern newPattern = generator.Generate();
|
||||
lastPattern = newPattern;
|
||||
foreach (var newPattern in generator.Generate())
|
||||
{
|
||||
lastPattern = newPattern;
|
||||
|
||||
return newPattern.HitObjects;
|
||||
foreach (var obj in newPattern.HitObjects)
|
||||
yield return obj;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -167,14 +170,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
}
|
||||
|
||||
if (conversion == null)
|
||||
return null;
|
||||
yield break;
|
||||
|
||||
Pattern newPattern = conversion.Generate();
|
||||
foreach (var newPattern in conversion.Generate())
|
||||
{
|
||||
lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern;
|
||||
lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair;
|
||||
|
||||
lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern;
|
||||
lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair;
|
||||
foreach (var obj in newPattern.HitObjects)
|
||||
yield return obj;
|
||||
|
||||
return newPattern.HitObjects;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -187,7 +193,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
{
|
||||
}
|
||||
|
||||
public override Pattern Generate()
|
||||
public override IEnumerable<Pattern> Generate()
|
||||
{
|
||||
yield return generate();
|
||||
}
|
||||
|
||||
private Pattern generate()
|
||||
{
|
||||
var endTimeData = HitObject as IHasEndTime;
|
||||
var positionData = HitObject as IHasXPosition;
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.MathUtils;
|
||||
@ -57,7 +58,30 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
SegmentDuration = (EndTime - HitObject.StartTime) / spanCount;
|
||||
}
|
||||
|
||||
public override Pattern Generate()
|
||||
public override IEnumerable<Pattern> Generate()
|
||||
{
|
||||
var originalPattern = generate();
|
||||
|
||||
// We need to split the intermediate pattern into two new patterns:
|
||||
// 1. A pattern containing all objects that do not end at our EndTime.
|
||||
// 2. A pattern containing all objects that end at our EndTime. This will be used for further pattern generation.
|
||||
var intermediatePattern = new Pattern();
|
||||
var endTimePattern = new Pattern();
|
||||
|
||||
foreach (var obj in originalPattern.HitObjects)
|
||||
{
|
||||
if (!Precision.AlmostEquals(EndTime, (obj as IHasEndTime)?.EndTime ?? obj.StartTime))
|
||||
intermediatePattern.Add(obj);
|
||||
else
|
||||
endTimePattern.Add(obj);
|
||||
}
|
||||
|
||||
|
||||
yield return intermediatePattern;
|
||||
yield return endTimePattern;
|
||||
}
|
||||
|
||||
private Pattern generate()
|
||||
{
|
||||
if (TotalColumns == 1)
|
||||
{
|
||||
|
@ -24,7 +24,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
endTime = endtimeData?.EndTime ?? 0;
|
||||
}
|
||||
|
||||
public override Pattern Generate()
|
||||
public override IEnumerable<Pattern> Generate()
|
||||
{
|
||||
yield return generate();
|
||||
}
|
||||
|
||||
private Pattern generate()
|
||||
{
|
||||
var pattern = new Pattern();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using osu.Game.Audio;
|
||||
@ -87,7 +88,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
}
|
||||
}
|
||||
|
||||
public override Pattern Generate()
|
||||
public override IEnumerable<Pattern> Generate()
|
||||
{
|
||||
yield return generate();
|
||||
}
|
||||
|
||||
private Pattern generate()
|
||||
{
|
||||
var pattern = new Pattern();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
||||
@ -42,9 +43,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the pattern for <see cref="HitObject"/>, filled with hit objects.
|
||||
/// Generates the patterns for <see cref="HitObject"/>, each filled with hit objects.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||
public abstract Pattern Generate();
|
||||
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
|
||||
public abstract IEnumerable<Pattern> Generate();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user