mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Merge pull request #822 from smoogipooo/mania-pattern-changes
Mania pattern changes
This commit is contained in:
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
HitObject firstObject = Beatmap.HitObjects.FirstOrDefault();
|
HitObject firstObject = Beatmap.HitObjects.FirstOrDefault();
|
||||||
|
|
||||||
double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0);
|
double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0);
|
||||||
drainTime -= Beatmap.EventInfo.TotalBreakTime;
|
drainTime -= Beatmap.TotalBreakTime;
|
||||||
|
|
||||||
if (drainTime == 0)
|
if (drainTime == 0)
|
||||||
drainTime = 10000;
|
drainTime = 10000;
|
||||||
|
@ -15,51 +15,51 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep the same as last row.
|
/// Keep the same as last row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ForceStack = 1,
|
ForceStack = 1 << 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep different from last row.
|
/// Keep different from last row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ForceNotStack = 2,
|
ForceNotStack = 1 << 1,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep as single note at its original position.
|
/// Keep as single note at its original position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
KeepSingle = 4,
|
KeepSingle = 1 << 2,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use a lower random value.
|
/// Use a lower random value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LowProbability = 8,
|
LowProbability = 1 << 3,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reserved.
|
/// Reserved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Alternate = 16,
|
Alternate = 1 << 4,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore the repeat count.
|
/// Ignore the repeat count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ForceSigSlider = 32,
|
ForceSigSlider = 1 << 5,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert slider to circle.
|
/// Convert slider to circle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ForceNotSlider = 64,
|
ForceNotSlider = 1 << 6,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Notes gathered together.
|
/// Notes gathered together.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Gathered = 128,
|
Gathered = 1 << 7,
|
||||||
Mirror = 256,
|
Mirror = 1 << 8,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change 0 -> 6.
|
/// Change 0 -> 6.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Reverse = 512,
|
Reverse = 1 << 9,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 1 -> 5 -> 1 -> 5 like reverse.
|
/// 1 -> 5 -> 1 -> 5 like reverse.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Cycle = 1024,
|
Cycle = 1 << 10,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Next note will be at column + 1.
|
/// Next note will be at column + 1.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Stair = 2048,
|
Stair = 1 << 11,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Next note will be at column - 1.
|
/// Next note will be at column - 1.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ReverseStair = 4096
|
ReverseStair = 1 << 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
||||||
@ -21,16 +20,16 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
|||||||
public IEnumerable<ManiaHitObject> HitObjects => hitObjects;
|
public IEnumerable<ManiaHitObject> HitObjects => hitObjects;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this pattern already contains a hit object in a code.
|
/// Check whether a column of this patterns contains a hit object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="column">The column index.</param>
|
/// <param name="column">The column index.</param>
|
||||||
/// <returns>Whether this pattern already contains a hit object in <paramref name="column"/></returns>
|
/// <returns>Whether the column with index <paramref name="column"/> contains a hit object.</returns>
|
||||||
public bool IsFilled(int column) => hitObjects.Exists(h => h.Column == column);
|
public bool ColumnHasObject(int column) => hitObjects.Exists(h => h.Column == column);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Amount of columns taken up by hit objects in this pattern.
|
/// Amount of columns taken up by hit objects in this pattern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ColumnsFilled => HitObjects.GroupBy(h => h.Column).Count();
|
public int ColumnWithObjects => HitObjects.GroupBy(h => h.Column).Count();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a hit object to this pattern.
|
/// Adds a hit object to this pattern.
|
||||||
@ -42,10 +41,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
|||||||
/// Copies hit object from another pattern to this one.
|
/// Copies hit object from another pattern to this one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">The other pattern.</param>
|
/// <param name="other">The other pattern.</param>
|
||||||
public void Add(Pattern other)
|
public void Add(Pattern other) => hitObjects.AddRange(other.HitObjects);
|
||||||
{
|
|
||||||
other.HitObjects.ForEach(Add);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears this pattern, removing all hit objects.
|
/// Clears this pattern, removing all hit objects.
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Beatmaps.Events;
|
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
public TimingInfo TimingInfo = new TimingInfo();
|
public TimingInfo TimingInfo = new TimingInfo();
|
||||||
public EventInfo EventInfo = new EventInfo();
|
public List<BreakPeriod> Breaks = new List<BreakPeriod>();
|
||||||
public readonly List<Color4> ComboColors = new List<Color4>
|
public readonly List<Color4> ComboColors = new List<Color4>
|
||||||
{
|
{
|
||||||
new Color4(17, 136, 170, 255),
|
new Color4(17, 136, 170, 255),
|
||||||
@ -34,6 +34,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<T> HitObjects;
|
public List<T> HitObjects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total amount of break time in the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new beatmap.
|
/// Constructs a new beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -42,7 +47,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo;
|
BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo;
|
||||||
TimingInfo = original?.TimingInfo ?? TimingInfo;
|
TimingInfo = original?.TimingInfo ?? TimingInfo;
|
||||||
EventInfo = original?.EventInfo ?? EventInfo;
|
Breaks = original?.Breaks ?? Breaks;
|
||||||
ComboColors = original?.ComboColors ?? ComboColors;
|
ComboColors = original?.ComboColors ?? ComboColors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Events
|
|
||||||
{
|
|
||||||
public class BackgroundEvent : Event
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The file name.
|
|
||||||
/// </summary>
|
|
||||||
public string Filename;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Events
|
|
||||||
{
|
|
||||||
public abstract class Event
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The event start time.
|
|
||||||
/// </summary>
|
|
||||||
public double StartTime;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Events
|
|
||||||
{
|
|
||||||
public class EventInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// All the background events.
|
|
||||||
/// </summary>
|
|
||||||
public readonly List<BackgroundEvent> Backgrounds = new List<BackgroundEvent>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// All the break events.
|
|
||||||
/// </summary>
|
|
||||||
public readonly List<BreakEvent> Breaks = new List<BreakEvent>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Total duration of all breaks.
|
|
||||||
/// </summary>
|
|
||||||
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves the active background at a time.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="time">The time to retrieve the background at.</param>
|
|
||||||
/// <returns>The background.</returns>
|
|
||||||
public BackgroundEvent BackgroundAt(double time) => Backgrounds.FirstOrDefault(b => b.StartTime <= time);
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Beatmaps.Events;
|
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
@ -217,18 +216,12 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
case EventType.Background:
|
case EventType.Background:
|
||||||
string filename = split[2].Trim('"');
|
string filename = split[2].Trim('"');
|
||||||
|
|
||||||
beatmap.EventInfo.Backgrounds.Add(new BackgroundEvent
|
|
||||||
{
|
|
||||||
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
|
|
||||||
Filename = filename
|
|
||||||
});
|
|
||||||
|
|
||||||
if (type == EventType.Background)
|
if (type == EventType.Background)
|
||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EventType.Break:
|
case EventType.Break:
|
||||||
var breakEvent = new BreakEvent
|
var breakEvent = new BreakPeriod
|
||||||
{
|
{
|
||||||
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
|
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
|
||||||
EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo)
|
EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo)
|
||||||
@ -237,7 +230,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (!breakEvent.HasEffect)
|
if (!breakEvent.HasEffect)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.EventInfo.Breaks.Add(breakEvent);
|
beatmap.Breaks.Add(breakEvent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,32 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Events
|
namespace osu.Game.Beatmaps.Timing
|
||||||
{
|
{
|
||||||
public class BreakEvent : Event
|
public class BreakPeriod
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum duration required for a break to have any effect.
|
/// The minimum duration required for a break to have any effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const double min_break_duration = 650;
|
private const double min_break_duration = 650;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The break start time.
|
||||||
|
/// </summary>
|
||||||
|
public double StartTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The break end time.
|
/// The break end time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double EndTime;
|
public double EndTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The duration of the break.
|
/// The break duration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the break has any effect. Breaks that are too short are culled before they reach the EventInfo.
|
/// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasEffect => Duration >= min_break_duration;
|
public bool HasEffect => Duration >= min_break_duration;
|
||||||
}
|
}
|
@ -74,10 +74,6 @@
|
|||||||
<Compile Include="Audio\SampleInfoList.cs" />
|
<Compile Include="Audio\SampleInfoList.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
<Compile Include="Beatmaps\Events\BackgroundEvent.cs" />
|
|
||||||
<Compile Include="Beatmaps\Events\BreakEvent.cs" />
|
|
||||||
<Compile Include="Beatmaps\Events\Event.cs" />
|
|
||||||
<Compile Include="Beatmaps\Events\EventInfo.cs" />
|
|
||||||
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
|
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
|
||||||
<Compile Include="Online\Chat\ErrorMessage.cs" />
|
<Compile Include="Online\Chat\ErrorMessage.cs" />
|
||||||
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
|
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
|
||||||
@ -91,6 +87,7 @@
|
|||||||
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
|
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
|
||||||
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
|
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
|
||||||
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
|
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
|
||||||
|
<Compile Include="Beatmaps\Timing\BreakPeriod.cs" />
|
||||||
<Compile Include="Beatmaps\Timing\TimeSignatures.cs" />
|
<Compile Include="Beatmaps\Timing\TimeSignatures.cs" />
|
||||||
<Compile Include="Beatmaps\Timing\TimingInfo.cs" />
|
<Compile Include="Beatmaps\Timing\TimingInfo.cs" />
|
||||||
<Compile Include="Database\BeatmapMetrics.cs" />
|
<Compile Include="Database\BeatmapMetrics.cs" />
|
||||||
|
Reference in New Issue
Block a user