mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Fix only single sound type being written
This commit is contained in:
parent
dedae69db8
commit
ac984423bb
@ -225,7 +225,6 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
LegacyHitObjectType hitObjectType = (LegacyHitObjectType)(comboData.ComboOffset << 4);
|
LegacyHitObjectType hitObjectType = (LegacyHitObjectType)(comboData.ComboOffset << 4);
|
||||||
if (comboData.NewCombo)
|
if (comboData.NewCombo)
|
||||||
hitObjectType |= LegacyHitObjectType.NewCombo;
|
hitObjectType |= LegacyHitObjectType.NewCombo;
|
||||||
|
|
||||||
if (hitObject is IHasCurve _)
|
if (hitObject is IHasCurve _)
|
||||||
hitObjectType |= LegacyHitObjectType.Slider;
|
hitObjectType |= LegacyHitObjectType.Slider;
|
||||||
else if (hitObject is IHasEndTime _)
|
else if (hitObject is IHasEndTime _)
|
||||||
@ -233,16 +232,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
else
|
else
|
||||||
hitObjectType |= LegacyHitObjectType.Circle;
|
hitObjectType |= LegacyHitObjectType.Circle;
|
||||||
|
|
||||||
LegacyHitSoundType soundType = LegacyHitSoundType.Normal;
|
|
||||||
HitSampleInfo firstAdditionSound = hitObject.Samples.FirstOrDefault(s => s.Name != HitSampleInfo.HIT_NORMAL);
|
|
||||||
if (firstAdditionSound != null)
|
|
||||||
soundType |= toLegacyHitSound(firstAdditionSound.Name);
|
|
||||||
|
|
||||||
writer.Write(FormattableString.Invariant($"{positionData.X},"));
|
writer.Write(FormattableString.Invariant($"{positionData.X},"));
|
||||||
writer.Write(FormattableString.Invariant($"{positionData.Y},"));
|
writer.Write(FormattableString.Invariant($"{positionData.Y},"));
|
||||||
writer.Write(FormattableString.Invariant($"{hitObject.StartTime},"));
|
writer.Write(FormattableString.Invariant($"{hitObject.StartTime},"));
|
||||||
writer.Write(FormattableString.Invariant($"{(int)hitObjectType},"));
|
writer.Write(FormattableString.Invariant($"{(int)hitObjectType},"));
|
||||||
writer.Write(FormattableString.Invariant($"{(int)soundType},"));
|
writer.Write(FormattableString.Invariant($"{(int)toLegacyHitSoundType(hitObject.Samples)},"));
|
||||||
|
|
||||||
if (hitObject is IHasCurve curveData)
|
if (hitObject is IHasCurve curveData)
|
||||||
{
|
{
|
||||||
@ -296,12 +290,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
for (int i = 0; i < curveData.NodeSamples.Count; i++)
|
for (int i = 0; i < curveData.NodeSamples.Count; i++)
|
||||||
{
|
{
|
||||||
LegacyHitSoundType type = LegacyHitSoundType.None;
|
writer.Write(FormattableString.Invariant($"{(int)toLegacyHitSoundType(curveData.NodeSamples[i])}"));
|
||||||
|
|
||||||
foreach (var sample in curveData.NodeSamples[i])
|
|
||||||
type |= toLegacyHitSound(sample.Name);
|
|
||||||
|
|
||||||
writer.Write(FormattableString.Invariant($"{(int)type}"));
|
|
||||||
writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ",");
|
writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,25 +348,29 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private LegacyHitSoundType toLegacyHitSound(string hitSoundName)
|
private LegacyHitSoundType toLegacyHitSoundType(IList<HitSampleInfo> samples)
|
||||||
{
|
{
|
||||||
switch (hitSoundName)
|
LegacyHitSoundType type = LegacyHitSoundType.None;
|
||||||
|
|
||||||
|
foreach (var sample in samples)
|
||||||
{
|
{
|
||||||
case HitSampleInfo.HIT_NORMAL:
|
switch (sample.Name)
|
||||||
return LegacyHitSoundType.Normal;
|
{
|
||||||
|
case HitSampleInfo.HIT_WHISTLE:
|
||||||
|
type |= LegacyHitSoundType.Whistle;
|
||||||
|
break;
|
||||||
|
|
||||||
case HitSampleInfo.HIT_WHISTLE:
|
case HitSampleInfo.HIT_FINISH:
|
||||||
return LegacyHitSoundType.Whistle;
|
type |= LegacyHitSoundType.Finish;
|
||||||
|
break;
|
||||||
|
|
||||||
case HitSampleInfo.HIT_FINISH:
|
case HitSampleInfo.HIT_CLAP:
|
||||||
return LegacyHitSoundType.Finish;
|
type |= LegacyHitSoundType.Clap;
|
||||||
|
break;
|
||||||
case HitSampleInfo.HIT_CLAP:
|
}
|
||||||
return LegacyHitSoundType.Clap;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return LegacyHitSoundType.None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LegacySampleBank toLegacySampleBank(string sampleBank)
|
private LegacySampleBank toLegacySampleBank(string sampleBank)
|
||||||
|
Loading…
Reference in New Issue
Block a user