mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Merge implementations of ConvertHitObjectParser
Having these be separate implementations sounded awesome at the time, but it only ever led to confusion. There's no practical difference if, for example, catch sees hitobjects with `IHasPosition` instead of `IHasXPosition`.
This commit is contained in:
parent
91d9c0a7e8
commit
e1d93a7d9c
@ -38,8 +38,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
internal static RulesetStore? RulesetStore;
|
internal static RulesetStore? RulesetStore;
|
||||||
|
|
||||||
private Beatmap beatmap = null!;
|
private Beatmap beatmap = null!;
|
||||||
|
private ConvertHitObjectParser parser = null!;
|
||||||
private ConvertHitObjectParser? parser;
|
|
||||||
|
|
||||||
private LegacySampleBank defaultSampleBank;
|
private LegacySampleBank defaultSampleBank;
|
||||||
private int defaultSampleVolume = 100;
|
private int defaultSampleVolume = 100;
|
||||||
@ -80,6 +79,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion;
|
this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion;
|
||||||
|
parser = new ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
||||||
|
|
||||||
applyLegacyDefaults(this.beatmap.BeatmapInfo);
|
applyLegacyDefaults(this.beatmap.BeatmapInfo);
|
||||||
|
|
||||||
@ -162,7 +162,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
if (hitObject is IHasRepeats hasRepeats)
|
if (hitObject is IHasRepeats hasRepeats)
|
||||||
{
|
{
|
||||||
SampleControlPoint sampleControlPoint = (beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePointAt(hitObject.StartTime + CONTROL_POINT_LENIENCY + 1) ?? SampleControlPoint.DEFAULT;
|
SampleControlPoint sampleControlPoint = (beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePointAt(hitObject.StartTime + CONTROL_POINT_LENIENCY + 1)
|
||||||
|
?? SampleControlPoint.DEFAULT;
|
||||||
hitObject.Samples = hitObject.Samples.Select(o => sampleControlPoint.ApplyTo(o)).ToList();
|
hitObject.Samples = hitObject.Samples.Select(o => sampleControlPoint.ApplyTo(o)).ToList();
|
||||||
|
|
||||||
for (int i = 0; i < hasRepeats.NodeSamples.Count; i++)
|
for (int i = 0; i < hasRepeats.NodeSamples.Count; i++)
|
||||||
@ -175,7 +176,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SampleControlPoint sampleControlPoint = (beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePointAt(hitObject.GetEndTime() + CONTROL_POINT_LENIENCY) ?? SampleControlPoint.DEFAULT;
|
SampleControlPoint sampleControlPoint = (beatmap.ControlPointInfo as LegacyControlPointInfo)?.SamplePointAt(hitObject.GetEndTime() + CONTROL_POINT_LENIENCY)
|
||||||
|
?? SampleControlPoint.DEFAULT;
|
||||||
hitObject.Samples = hitObject.Samples.Select(o => sampleControlPoint.ApplyTo(o)).ToList();
|
hitObject.Samples = hitObject.Samples.Select(o => sampleControlPoint.ApplyTo(o)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -263,29 +265,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case @"Mode":
|
case @"Mode":
|
||||||
int rulesetID = Parsing.ParseInt(pair.Value);
|
beatmap.BeatmapInfo.Ruleset = RulesetStore?.GetRuleset(Parsing.ParseInt(pair.Value)) ?? throw new ArgumentException("Ruleset is not available locally.");
|
||||||
|
|
||||||
beatmap.BeatmapInfo.Ruleset = RulesetStore?.GetRuleset(rulesetID) ?? throw new ArgumentException("Ruleset is not available locally.");
|
|
||||||
|
|
||||||
switch (rulesetID)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case @"LetterboxInBreaks":
|
case @"LetterboxInBreaks":
|
||||||
@ -617,18 +597,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
private void handleHitObject(string line)
|
private void handleHitObject(string line)
|
||||||
{
|
{
|
||||||
// If the ruleset wasn't specified, assume the osu!standard ruleset.
|
|
||||||
parser ??= new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
|
|
||||||
|
|
||||||
var obj = parser.Parse(line);
|
var obj = parser.Parse(line);
|
||||||
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
obj.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
|
obj.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
|
||||||
|
|
||||||
beatmap.HitObjects.Add(obj);
|
beatmap.HitObjects.Add(obj);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private int getOffsetTime(int time) => time + (ApplyOffsets ? offset : 0);
|
private int getOffsetTime(int time) => time + (ApplyOffsets ? offset : 0);
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!catch Hit-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertHit : ConvertHitObject, IHasPosition
|
|
||||||
{
|
|
||||||
public float X => Position.X;
|
|
||||||
|
|
||||||
public float Y => Position.Y;
|
|
||||||
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osuTK;
|
|
||||||
using osu.Game.Audio;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A HitObjectParser to parse legacy osu!catch Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
|
|
||||||
{
|
|
||||||
private ConvertHitObject lastObject;
|
|
||||||
|
|
||||||
public ConvertHitObjectParser(double offset, int formatVersion)
|
|
||||||
: base(offset, formatVersion)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertHit
|
|
||||||
{
|
|
||||||
Position = position,
|
|
||||||
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
|
||||||
ComboOffset = newCombo ? comboOffset : 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
|
||||||
IList<IList<HitSampleInfo>> nodeSamples)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertSlider
|
|
||||||
{
|
|
||||||
Position = position,
|
|
||||||
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
|
||||||
ComboOffset = newCombo ? comboOffset : 0,
|
|
||||||
Path = new SliderPath(controlPoints, length),
|
|
||||||
NodeSamples = nodeSamples,
|
|
||||||
RepeatCount = repeatCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertSpinner
|
|
||||||
{
|
|
||||||
Duration = duration,
|
|
||||||
NewCombo = newCombo
|
|
||||||
// Spinners cannot have combo offset.
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return lastObject = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!catch Slider-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition
|
|
||||||
{
|
|
||||||
public float X => Position.X;
|
|
||||||
|
|
||||||
public float Y => Position.Y;
|
|
||||||
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasXPosition
|
|
||||||
{
|
|
||||||
public double EndTime => StartTime + Duration;
|
|
||||||
|
|
||||||
public double Duration { get; set; }
|
|
||||||
|
|
||||||
public float X => 256; // Required for CatchBeatmapConverter
|
|
||||||
}
|
|
||||||
}
|
|
13
osu.Game/Rulesets/Objects/Legacy/ConvertHitCircle.cs
Normal file
13
osu.Game/Rulesets/Objects/Legacy/ConvertHitCircle.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Legacy "HitCircle" hit object type.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Only used for parsing beatmaps and not gameplay.
|
||||||
|
/// </remarks>
|
||||||
|
internal sealed class ConvertHitCircle : ConvertHitObject;
|
||||||
|
}
|
@ -4,18 +4,28 @@
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A hit object only used for conversion, not actual gameplay.
|
/// Represents a legacy hit object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal abstract class ConvertHitObject : HitObject, IHasCombo
|
/// <remarks>
|
||||||
|
/// Only used for parsing beatmaps and not gameplay.
|
||||||
|
/// </remarks>
|
||||||
|
internal abstract class ConvertHitObject : HitObject, IHasCombo, IHasPosition
|
||||||
{
|
{
|
||||||
public bool NewCombo { get; set; }
|
public bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
|
||||||
|
public float X => Position.X;
|
||||||
|
|
||||||
|
public float Y => Position.Y;
|
||||||
|
|
||||||
|
public Vector2 Position { get; set; }
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System;
|
using System;
|
||||||
@ -11,7 +9,6 @@ using System.IO;
|
|||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
@ -24,24 +21,32 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A HitObjectParser to parse legacy Beatmaps.
|
/// A HitObjectParser to parse legacy Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ConvertHitObjectParser : HitObjectParser
|
public class ConvertHitObjectParser : HitObjectParser
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The offset to apply to all time values.
|
/// The offset to apply to all time values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly double Offset;
|
private readonly double offset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The .osu format (beatmap) version.
|
/// The .osu format (beatmap) version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int FormatVersion;
|
private readonly int formatVersion;
|
||||||
|
|
||||||
protected bool FirstObject { get; private set; } = true;
|
/// <summary>
|
||||||
|
/// Whether the current hitobject is the first hitobject in the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
private bool firstObject = true;
|
||||||
|
|
||||||
protected ConvertHitObjectParser(double offset, int formatVersion)
|
/// <summary>
|
||||||
|
/// The last parsed hitobject.
|
||||||
|
/// </summary>
|
||||||
|
private ConvertHitObject? lastObject;
|
||||||
|
|
||||||
|
internal ConvertHitObjectParser(double offset, int formatVersion)
|
||||||
{
|
{
|
||||||
Offset = offset;
|
this.offset = offset;
|
||||||
FormatVersion = formatVersion;
|
this.formatVersion = formatVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override HitObject Parse(string text)
|
public override HitObject Parse(string text)
|
||||||
@ -49,11 +54,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
string[] split = text.Split(',');
|
string[] split = text.Split(',');
|
||||||
|
|
||||||
Vector2 pos =
|
Vector2 pos =
|
||||||
FormatVersion >= LegacyBeatmapEncoder.FIRST_LAZER_VERSION
|
formatVersion >= LegacyBeatmapEncoder.FIRST_LAZER_VERSION
|
||||||
? new Vector2(Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE))
|
? new Vector2(Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE))
|
||||||
: new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
|
: new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
|
||||||
|
|
||||||
double startTime = Parsing.ParseDouble(split[2]) + Offset;
|
double startTime = Parsing.ParseDouble(split[2]) + offset;
|
||||||
|
|
||||||
LegacyHitObjectType type = (LegacyHitObjectType)Parsing.ParseInt(split[3]);
|
LegacyHitObjectType type = (LegacyHitObjectType)Parsing.ParseInt(split[3]);
|
||||||
|
|
||||||
@ -66,11 +71,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
var soundType = (LegacyHitSoundType)Parsing.ParseInt(split[4]);
|
var soundType = (LegacyHitSoundType)Parsing.ParseInt(split[4]);
|
||||||
var bankInfo = new SampleBankInfo();
|
var bankInfo = new SampleBankInfo();
|
||||||
|
|
||||||
HitObject result = null;
|
HitObject? result = null;
|
||||||
|
|
||||||
if (type.HasFlag(LegacyHitObjectType.Circle))
|
if (type.HasFlag(LegacyHitObjectType.Circle))
|
||||||
{
|
{
|
||||||
result = CreateHit(pos, combo, comboOffset);
|
result = createHitCircle(pos, combo, comboOffset);
|
||||||
|
|
||||||
if (split.Length > 5)
|
if (split.Length > 5)
|
||||||
readCustomSampleBanks(split[5], bankInfo);
|
readCustomSampleBanks(split[5], bankInfo);
|
||||||
@ -145,13 +150,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
for (int i = 0; i < nodes; i++)
|
for (int i = 0; i < nodes; i++)
|
||||||
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
|
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
|
||||||
|
|
||||||
result = CreateSlider(pos, combo, comboOffset, convertPathString(split[5], pos), length, repeatCount, nodeSamples);
|
result = createSlider(pos, combo, comboOffset, convertPathString(split[5], pos), length, repeatCount, nodeSamples);
|
||||||
}
|
}
|
||||||
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
||||||
{
|
{
|
||||||
double duration = Math.Max(0, Parsing.ParseDouble(split[5]) + Offset - startTime);
|
double duration = Math.Max(0, Parsing.ParseDouble(split[5]) + offset - startTime);
|
||||||
|
|
||||||
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, duration);
|
result = createSpinner(new Vector2(512, 384) / 2, combo, comboOffset, duration);
|
||||||
|
|
||||||
if (split.Length > 6)
|
if (split.Length > 6)
|
||||||
readCustomSampleBanks(split[6], bankInfo);
|
readCustomSampleBanks(split[6], bankInfo);
|
||||||
@ -169,7 +174,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
readCustomSampleBanks(string.Join(':', ss.Skip(1)), bankInfo);
|
readCustomSampleBanks(string.Join(':', ss.Skip(1)), bankInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CreateHold(pos, combo, comboOffset, endTime + Offset - startTime);
|
result = createHold(pos, combo, comboOffset, endTime + offset - startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
@ -180,7 +185,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
if (result.Samples.Count == 0)
|
if (result.Samples.Count == 0)
|
||||||
result.Samples = convertSoundType(soundType, bankInfo);
|
result.Samples = convertSoundType(soundType, bankInfo);
|
||||||
|
|
||||||
FirstObject = false;
|
firstObject = false;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -200,10 +205,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
if (!Enum.IsDefined(addBank))
|
if (!Enum.IsDefined(addBank))
|
||||||
addBank = LegacySampleBank.Normal;
|
addBank = LegacySampleBank.Normal;
|
||||||
|
|
||||||
string stringBank = bank.ToString().ToLowerInvariant();
|
string? stringBank = bank.ToString().ToLowerInvariant();
|
||||||
|
string? stringAddBank = addBank.ToString().ToLowerInvariant();
|
||||||
|
|
||||||
if (stringBank == @"none")
|
if (stringBank == @"none")
|
||||||
stringBank = null;
|
stringBank = null;
|
||||||
string stringAddBank = addBank.ToString().ToLowerInvariant();
|
|
||||||
|
|
||||||
if (stringAddBank == @"none")
|
if (stringAddBank == @"none")
|
||||||
{
|
{
|
||||||
@ -357,7 +363,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
{
|
{
|
||||||
int endPointLength = endPoint == null ? 0 : 1;
|
int endPointLength = endPoint == null ? 0 : 1;
|
||||||
|
|
||||||
if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
|
if (formatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
|
||||||
{
|
{
|
||||||
if (vertices.Length + endPointLength != 3)
|
if (vertices.Length + endPointLength != 3)
|
||||||
type = PathType.BEZIER;
|
type = PathType.BEZIER;
|
||||||
@ -393,7 +399,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
// Legacy CATMULL sliders don't support multiple segments, so adjacent CATMULL segments should be treated as a single one.
|
// Legacy CATMULL sliders don't support multiple segments, so adjacent CATMULL segments should be treated as a single one.
|
||||||
// Importantly, this is not applied to the first control point, which may duplicate the slider path's position
|
// Importantly, this is not applied to the first control point, which may duplicate the slider path's position
|
||||||
// resulting in a duplicate (0,0) control point in the resultant list.
|
// resulting in a duplicate (0,0) control point in the resultant list.
|
||||||
if (type == PathType.CATMULL && endIndex > 1 && FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
|
if (type == PathType.CATMULL && endIndex > 1 && formatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// The last control point of each segment is not allowed to start a new implicit segment.
|
// The last control point of each segment is not allowed to start a new implicit segment.
|
||||||
@ -442,7 +448,15 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
||||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||||
/// <returns>The hit object.</returns>
|
/// <returns>The hit object.</returns>
|
||||||
protected abstract HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset);
|
private HitObject createHitCircle(Vector2 position, bool newCombo, int comboOffset)
|
||||||
|
{
|
||||||
|
return lastObject = new ConvertHitCircle
|
||||||
|
{
|
||||||
|
Position = position,
|
||||||
|
NewCombo = firstObject || lastObject is ConvertSpinner || newCombo,
|
||||||
|
ComboOffset = newCombo ? comboOffset : 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creats a legacy Slider-type hit object.
|
/// Creats a legacy Slider-type hit object.
|
||||||
@ -455,8 +469,19 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="repeatCount">The slider repeat count.</param>
|
/// <param name="repeatCount">The slider repeat count.</param>
|
||||||
/// <param name="nodeSamples">The samples to be played when the slider nodes are hit. This includes the head and tail of the slider.</param>
|
/// <param name="nodeSamples">The samples to be played when the slider nodes are hit. This includes the head and tail of the slider.</param>
|
||||||
/// <returns>The hit object.</returns>
|
/// <returns>The hit object.</returns>
|
||||||
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
private HitObject createSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
||||||
IList<IList<HitSampleInfo>> nodeSamples);
|
IList<IList<HitSampleInfo>> nodeSamples)
|
||||||
|
{
|
||||||
|
return lastObject = new ConvertSlider
|
||||||
|
{
|
||||||
|
Position = position,
|
||||||
|
NewCombo = firstObject || lastObject is ConvertSpinner || newCombo,
|
||||||
|
ComboOffset = newCombo ? comboOffset : 0,
|
||||||
|
Path = new SliderPath(controlPoints, length),
|
||||||
|
NodeSamples = nodeSamples,
|
||||||
|
RepeatCount = repeatCount
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a legacy Spinner-type hit object.
|
/// Creates a legacy Spinner-type hit object.
|
||||||
@ -466,7 +491,16 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||||
/// <param name="duration">The spinner duration.</param>
|
/// <param name="duration">The spinner duration.</param>
|
||||||
/// <returns>The hit object.</returns>
|
/// <returns>The hit object.</returns>
|
||||||
protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration);
|
private HitObject createSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
|
{
|
||||||
|
return lastObject = new ConvertSpinner
|
||||||
|
{
|
||||||
|
Position = position,
|
||||||
|
Duration = duration,
|
||||||
|
NewCombo = newCombo
|
||||||
|
// Spinners cannot have combo offset.
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a legacy Hold-type hit object.
|
/// Creates a legacy Hold-type hit object.
|
||||||
@ -475,7 +509,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
||||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||||
/// <param name="duration">The hold duration.</param>
|
/// <param name="duration">The hold duration.</param>
|
||||||
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration);
|
private HitObject createHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
||||||
|
{
|
||||||
|
return lastObject = new ConvertHold
|
||||||
|
{
|
||||||
|
Position = position,
|
||||||
|
Duration = duration
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
|
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
|
||||||
{
|
{
|
||||||
@ -511,21 +552,19 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// An optional overriding filename which causes all bank/sample specifications to be ignored.
|
/// An optional overriding filename which causes all bank/sample specifications to be ignored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Filename;
|
public string? Filename;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bank identifier to use for the base ("hitnormal") sample.
|
/// The bank identifier to use for the base ("hitnormal") sample.
|
||||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[CanBeNull]
|
public string? BankForNormal;
|
||||||
public string BankForNormal;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bank identifier to use for additions ("hitwhistle", "hitfinish", "hitclap").
|
/// The bank identifier to use for additions ("hitwhistle", "hitfinish", "hitclap").
|
||||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[CanBeNull]
|
public string? BankForAdditions;
|
||||||
public string BankForAdditions;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hit sample volume (0-100).
|
/// Hit sample volume (0-100).
|
||||||
@ -548,8 +587,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone();
|
public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class LegacyHitSampleInfo : HitSampleInfo, IEquatable<LegacyHitSampleInfo>
|
public class LegacyHitSampleInfo : HitSampleInfo, IEquatable<LegacyHitSampleInfo>
|
||||||
{
|
{
|
||||||
public readonly int CustomSampleBank;
|
public readonly int CustomSampleBank;
|
||||||
@ -577,13 +614,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
IsLayered = isLayered;
|
IsLayered = isLayered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default, Optional<bool> newEditorAutoBank = default)
|
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default,
|
||||||
|
Optional<bool> newEditorAutoBank = default)
|
||||||
=> With(newName, newBank, newVolume, newEditorAutoBank);
|
=> With(newName, newBank, newVolume, newEditorAutoBank);
|
||||||
|
|
||||||
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default, Optional<bool> newEditorAutoBank = default,
|
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||||
Optional<int> newCustomSampleBank = default,
|
Optional<bool> newEditorAutoBank = default, Optional<int> newCustomSampleBank = default, Optional<bool> newIsLayered = default)
|
||||||
Optional<bool> newIsLayered = default)
|
=> new LegacyHitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newVolume.GetOr(Volume), newEditorAutoBank.GetOr(EditorAutoBank), newCustomSampleBank.GetOr(CustomSampleBank),
|
||||||
=> new LegacyHitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newVolume.GetOr(Volume), newEditorAutoBank.GetOr(EditorAutoBank), newCustomSampleBank.GetOr(CustomSampleBank), newIsLayered.GetOr(IsLayered));
|
newIsLayered.GetOr(IsLayered));
|
||||||
|
|
||||||
public bool Equals(LegacyHitSampleInfo? other)
|
public bool Equals(LegacyHitSampleInfo? other)
|
||||||
// The additions to equality checks here are *required* to ensure that pooling works correctly.
|
// The additions to equality checks here are *required* to ensure that pooling works correctly.
|
||||||
@ -615,9 +653,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
Path.ChangeExtension(Filename, null)
|
Path.ChangeExtension(Filename, null)
|
||||||
};
|
};
|
||||||
|
|
||||||
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default, Optional<bool> newEditorAutoBank = default,
|
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||||
Optional<int> newCustomSampleBank = default,
|
Optional<bool> newEditorAutoBank = default, Optional<int> newCustomSampleBank = default, Optional<bool> newIsLayered = default)
|
||||||
Optional<bool> newIsLayered = default)
|
|
||||||
=> new FileHitSampleInfo(Filename, newVolume.GetOr(Volume));
|
=> new FileHitSampleInfo(Filename, newVolume.GetOr(Volume));
|
||||||
|
|
||||||
public bool Equals(FileHitSampleInfo? other)
|
public bool Equals(FileHitSampleInfo? other)
|
||||||
|
@ -3,17 +3,18 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!mania Spinner-type, used for parsing Beatmaps.
|
/// Legacy "Hold" hit object type. Generally only valid in the mania ruleset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasXPosition
|
/// <remarks>
|
||||||
|
/// Only used for parsing beatmaps and not gameplay.
|
||||||
|
/// </remarks>
|
||||||
|
internal sealed class ConvertHold : ConvertHitObject, IHasDuration
|
||||||
{
|
{
|
||||||
public double Duration { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
public double EndTime => StartTime + Duration;
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
public float X { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -13,7 +11,13 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasSliderVelocity
|
/// <summary>
|
||||||
|
/// Legacy "Slider" hit object type.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Only used for parsing beatmaps and not gameplay.
|
||||||
|
/// </remarks>
|
||||||
|
internal class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasSliderVelocity, IHasGenerateTicks
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
||||||
@ -50,6 +54,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
set => SliderVelocityMultiplierBindable.Value = value;
|
set => SliderVelocityMultiplierBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GenerateTicks { get; set; } = true;
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!taiko Spinner-type, used for parsing Beatmaps.
|
/// Legacy "Spinner" hit object type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Only used for parsing beatmaps and not gameplay.
|
||||||
|
/// </remarks>
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration
|
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration
|
||||||
{
|
{
|
||||||
public double Duration { get; set; }
|
public double Duration { get; set; }
|
@ -1,15 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!mania Hit-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertHit : ConvertHitObject, IHasXPosition
|
|
||||||
{
|
|
||||||
public float X { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osuTK;
|
|
||||||
using osu.Game.Audio;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A HitObjectParser to parse legacy osu!mania Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
|
|
||||||
{
|
|
||||||
public ConvertHitObjectParser(double offset, int formatVersion)
|
|
||||||
: base(offset, formatVersion)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
|
|
||||||
{
|
|
||||||
return new ConvertHit
|
|
||||||
{
|
|
||||||
X = position.X
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
|
||||||
IList<IList<HitSampleInfo>> nodeSamples)
|
|
||||||
{
|
|
||||||
return new ConvertSlider
|
|
||||||
{
|
|
||||||
X = position.X,
|
|
||||||
Path = new SliderPath(controlPoints, length),
|
|
||||||
NodeSamples = nodeSamples,
|
|
||||||
RepeatCount = repeatCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return new ConvertSpinner
|
|
||||||
{
|
|
||||||
X = position.X,
|
|
||||||
Duration = duration
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return new ConvertHold
|
|
||||||
{
|
|
||||||
X = position.X,
|
|
||||||
Duration = duration
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|
||||||
{
|
|
||||||
internal sealed class ConvertHold : ConvertHitObject, IHasXPosition, IHasDuration
|
|
||||||
{
|
|
||||||
public float X { get; set; }
|
|
||||||
|
|
||||||
public double Duration { get; set; }
|
|
||||||
|
|
||||||
public double EndTime => StartTime + Duration;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!mania Slider-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition
|
|
||||||
{
|
|
||||||
public float X { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu! Hit-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertHit : ConvertHitObject, IHasPosition
|
|
||||||
{
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
|
|
||||||
public float X => Position.X;
|
|
||||||
|
|
||||||
public float Y => Position.Y;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osuTK;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Audio;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A HitObjectParser to parse legacy osu! Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
|
|
||||||
{
|
|
||||||
private ConvertHitObject lastObject;
|
|
||||||
|
|
||||||
public ConvertHitObjectParser(double offset, int formatVersion)
|
|
||||||
: base(offset, formatVersion)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertHit
|
|
||||||
{
|
|
||||||
Position = position,
|
|
||||||
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
|
||||||
ComboOffset = newCombo ? comboOffset : 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
|
||||||
IList<IList<HitSampleInfo>> nodeSamples)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertSlider
|
|
||||||
{
|
|
||||||
Position = position,
|
|
||||||
NewCombo = FirstObject || lastObject is ConvertSpinner || newCombo,
|
|
||||||
ComboOffset = newCombo ? comboOffset : 0,
|
|
||||||
Path = new SliderPath(controlPoints, length),
|
|
||||||
NodeSamples = nodeSamples,
|
|
||||||
RepeatCount = repeatCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return lastObject = new ConvertSpinner
|
|
||||||
{
|
|
||||||
Position = position,
|
|
||||||
Duration = duration,
|
|
||||||
NewCombo = newCombo
|
|
||||||
// Spinners cannot have combo offset.
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return lastObject = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu! Slider-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasGenerateTicks
|
|
||||||
{
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
|
|
||||||
public float X => Position.X;
|
|
||||||
|
|
||||||
public float Y => Position.Y;
|
|
||||||
|
|
||||||
public bool GenerateTicks { get; set; } = true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu! Spinner-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSpinner : ConvertHitObject, IHasDuration, IHasPosition
|
|
||||||
{
|
|
||||||
public double Duration { get; set; }
|
|
||||||
|
|
||||||
public double EndTime => StartTime + Duration;
|
|
||||||
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
|
|
||||||
public float X => Position.X;
|
|
||||||
|
|
||||||
public float Y => Position.Y;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!taiko Hit-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertHit : ConvertHitObject
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osuTK;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Audio;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A HitObjectParser to parse legacy osu!taiko Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
|
|
||||||
{
|
|
||||||
public ConvertHitObjectParser(double offset, int formatVersion)
|
|
||||||
: base(offset, formatVersion)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
|
|
||||||
{
|
|
||||||
return new ConvertHit();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
|
|
||||||
IList<IList<HitSampleInfo>> nodeSamples)
|
|
||||||
{
|
|
||||||
return new ConvertSlider
|
|
||||||
{
|
|
||||||
Path = new SliderPath(controlPoints, length),
|
|
||||||
NodeSamples = nodeSamples,
|
|
||||||
RepeatCount = repeatCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return new ConvertSpinner
|
|
||||||
{
|
|
||||||
Duration = duration
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Legacy osu!taiko Slider-type, used for parsing Beatmaps.
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class ConvertSlider : Legacy.ConvertSlider
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user