1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Move implementation to DrawableHit to avoid "breaking" legacy encoding

This commit is contained in:
Dean Herbert 2020-05-11 16:19:47 +09:00
parent b4d790c076
commit 77041bdbb5
2 changed files with 26 additions and 25 deletions

View File

@ -171,30 +171,6 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
bool isRim = samples.Any(isRimDefinition);
if (isRim)
{
// consume then remove the rim definition sample types.
var updatedSamples = samples.Where(s => !isRimDefinition(s)).ToList();
// strong + rim always maps to whistle.
if (strong)
{
for (var i = 0; i < updatedSamples.Count; i++)
{
var s = samples[i];
if (s.Name != HitSampleInfo.HIT_FINISH)
continue;
var sClone = s.Clone();
sClone.Name = HitSampleInfo.HIT_WHISTLE;
updatedSamples[i] = sClone;
}
}
samples = updatedSamples;
}
yield return new Hit
{
StartTime = obj.StartTime,

View File

@ -52,7 +52,32 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected override IEnumerable<HitSampleInfo> GetSamples()
{
// normal and claps are always handled by the drum (see DrumSampleMapping).
return HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);
var samples = HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);
if (HitObject.Type == HitType.Rim && HitObject.IsStrong)
{
// strong + rim always maps to whistle.
// TODO: this should really be in the legacy decoder, but can't be because legacy encoding parity would be broken.
// when we add a taiko editor, this is probably not going to play nice.
var corrected = samples.ToList();
for (var i = 0; i < corrected.Count; i++)
{
var s = corrected[i];
if (s.Name != HitSampleInfo.HIT_FINISH)
continue;
var sClone = s.Clone();
sClone.Name = HitSampleInfo.HIT_WHISTLE;
corrected[i] = sClone;
}
return corrected;
}
return samples;
}
protected override void CheckForResult(bool userTriggered, double timeOffset)