1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix hit normals always being played, regardless of sound type.

This commit is contained in:
smoogipooo 2017-04-21 13:51:40 +09:00
parent 6e3125e115
commit ac9f0ccb48

View File

@ -108,43 +108,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
var soundType = (LegacySoundType)int.Parse(split[4]);
result.Samples.Add(new SampleInfo
{
Bank = normalSampleBank,
Name = SampleInfo.HIT_NORMAL,
Volume = sampleVolume
});
if ((soundType & LegacySoundType.Finish) > 0)
{
result.Samples.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_FINISH,
Volume = sampleVolume
});
}
if ((soundType & LegacySoundType.Whistle) > 0)
{
result.Samples.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_WHISTLE,
Volume = sampleVolume
});
}
if ((soundType & LegacySoundType.Clap) > 0)
{
result.Samples.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_CLAP,
Volume = sampleVolume
});
}
result.Samples = convertSoundType(soundType, normalSampleBank, addSampleBank);
result.Samples.ForEach(s => s.Volume = sampleVolume);
return result;
}
@ -202,6 +167,49 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// <returns>The hit object.</returns>
protected abstract HitObject CreateSpinner(Vector2 position, double endTime);
private List<SampleInfo> convertSoundType(LegacySoundType type, string normalSampleBank, string addSampleBank)
{
List<SampleInfo> soundTypes = new List<SampleInfo>();
if ((type & LegacySoundType.Normal) > 0)
{
soundTypes.Add(new SampleInfo
{
Bank = normalSampleBank,
Name = SampleInfo.HIT_NORMAL
});
}
if ((type & LegacySoundType.Finish) > 0)
{
soundTypes.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_FINISH
});
}
if ((type & LegacySoundType.Whistle) > 0)
{
soundTypes.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_WHISTLE
});
}
if ((type & LegacySoundType.Clap) > 0)
{
soundTypes.Add(new SampleInfo
{
Bank = addSampleBank,
Name = SampleInfo.HIT_CLAP
});
}
return soundTypes;
}
[Flags]
private enum LegacySoundType
{