mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Extract legacy hitobject type enum
This commit is contained in:
parent
8012b21ffa
commit
e3f925f69a
15
osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs
Normal file
15
osu.Game/Beatmaps/Legacy/LegacyHitObjectType.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Legacy
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
internal enum LegacyHitObjectType
|
||||||
|
{
|
||||||
|
Circle = 1,
|
||||||
|
Slider = 1 << 1,
|
||||||
|
NewCombo = 1 << 2,
|
||||||
|
Spinner = 1 << 3,
|
||||||
|
ComboOffset = (1 << 4) | (1 << 5) | (1 << 6),
|
||||||
|
Hold = 1 << 7
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ using osu.Game.Audio;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Beatmaps.Legacy;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
@ -46,27 +47,27 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
|
|
||||||
double startTime = Parsing.ParseDouble(split[2]) + Offset;
|
double startTime = Parsing.ParseDouble(split[2]) + Offset;
|
||||||
|
|
||||||
ConvertHitObjectType type = (ConvertHitObjectType)Parsing.ParseInt(split[3]);
|
LegacyHitObjectType type = (LegacyHitObjectType)Parsing.ParseInt(split[3]);
|
||||||
|
|
||||||
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
|
int comboOffset = (int)(type & LegacyHitObjectType.ComboOffset) >> 4;
|
||||||
type &= ~ConvertHitObjectType.ComboOffset;
|
type &= ~LegacyHitObjectType.ComboOffset;
|
||||||
|
|
||||||
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
bool combo = type.HasFlag(LegacyHitObjectType.NewCombo);
|
||||||
type &= ~ConvertHitObjectType.NewCombo;
|
type &= ~LegacyHitObjectType.NewCombo;
|
||||||
|
|
||||||
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(ConvertHitObjectType.Circle))
|
if (type.HasFlag(LegacyHitObjectType.Circle))
|
||||||
{
|
{
|
||||||
result = CreateHit(pos, combo, comboOffset);
|
result = CreateHit(pos, combo, comboOffset);
|
||||||
|
|
||||||
if (split.Length > 5)
|
if (split.Length > 5)
|
||||||
readCustomSampleBanks(split[5], bankInfo);
|
readCustomSampleBanks(split[5], bankInfo);
|
||||||
}
|
}
|
||||||
else if (type.HasFlag(ConvertHitObjectType.Slider))
|
else if (type.HasFlag(LegacyHitObjectType.Slider))
|
||||||
{
|
{
|
||||||
PathType pathType = PathType.Catmull;
|
PathType pathType = PathType.Catmull;
|
||||||
double? length = null;
|
double? length = null;
|
||||||
@ -186,7 +187,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
// The samples are played when the slider ends, which is the last node
|
// The samples are played when the slider ends, which is the last node
|
||||||
result.Samples = nodeSamples[nodeSamples.Count - 1];
|
result.Samples = nodeSamples[nodeSamples.Count - 1];
|
||||||
}
|
}
|
||||||
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
||||||
{
|
{
|
||||||
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
|
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
if (split.Length > 6)
|
if (split.Length > 6)
|
||||||
readCustomSampleBanks(split[6], bankInfo);
|
readCustomSampleBanks(split[6], bankInfo);
|
||||||
}
|
}
|
||||||
else if (type.HasFlag(ConvertHitObjectType.Hold))
|
else if (type.HasFlag(LegacyHitObjectType.Hold))
|
||||||
{
|
{
|
||||||
// Note: Hold is generated by BMS converts
|
// Note: Hold is generated by BMS converts
|
||||||
|
|
||||||
|
@ -1,18 +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 System;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
|
||||||
{
|
|
||||||
[Flags]
|
|
||||||
internal enum ConvertHitObjectType
|
|
||||||
{
|
|
||||||
Circle = 1,
|
|
||||||
Slider = 1 << 1,
|
|
||||||
NewCombo = 1 << 2,
|
|
||||||
Spinner = 1 << 3,
|
|
||||||
ComboOffset = (1 << 4) | (1 << 5) | (1 << 6),
|
|
||||||
Hold = 1 << 7
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user