mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 01:07:23 +08:00
Merge pull request #32098 from bdach/dont-drop-green-line-sample-bank
Attempt to preserve sample control point bank when encoding beatmap
This commit is contained in:
commit
d9162daac2
@ -319,11 +319,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
SampleControlPoint createSampleControlPointFor(double time, IList<HitSampleInfo> samples)
|
SampleControlPoint createSampleControlPointFor(double time, IList<HitSampleInfo> samples)
|
||||||
{
|
{
|
||||||
int volume = samples.Max(o => o.Volume);
|
int volume = samples.Max(o => o.Volume);
|
||||||
|
string bank = samples.Where(s => s.Name == HitSampleInfo.HIT_NORMAL).Select(s => s.Bank).FirstOrDefault()
|
||||||
|
?? samples.Select(s => s.Bank).First();
|
||||||
int customIndex = samples.Any(o => o is ConvertHitObjectParser.LegacyHitSampleInfo)
|
int customIndex = samples.Any(o => o is ConvertHitObjectParser.LegacyHitSampleInfo)
|
||||||
? samples.OfType<ConvertHitObjectParser.LegacyHitSampleInfo>().Max(o => o.CustomSampleBank)
|
? samples.OfType<ConvertHitObjectParser.LegacyHitSampleInfo>().Max(o => o.CustomSampleBank)
|
||||||
: -1;
|
: -1;
|
||||||
|
|
||||||
return new LegacyBeatmapDecoder.LegacySampleControlPoint { Time = time, SampleVolume = volume, CustomSampleBank = customIndex };
|
return new LegacyBeatmapDecoder.LegacySampleControlPoint { Time = time, SampleVolume = volume, SampleBank = bank, CustomSampleBank = customIndex };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user