1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:43:22 +08:00

complete version

This commit is contained in:
Daiter 2024-03-06 12:23:03 +03:00
parent 19425ee180
commit 0c477b7f96

View File

@ -38,64 +38,28 @@ namespace osu.Game.Rulesets.Mania.Mods
foreach (var column in maniaBeatmap.HitObjects.GroupBy(h => h.Column))
{
var newColumnObjects = new List<ManiaHitObject>();
if (true)
var locations = column.Select(n => (startTime: n.StartTime, samples: n.Samples))
.OrderBy(n => n.startTime).ToList();
for (int i = 0; i < locations.Count - 1; i++)
{
// Full duration of the hold note.
double duration = locations[i + 1].startTime - locations[i].startTime;
var locations = column.Select(n => (startTime: n.StartTime, samples: n.Samples))
.OrderBy(h => h.startTime).ToList();
// Beat length at the end of the hold note.
double beatLength = beatmap.ControlPointInfo.TimingPointAt(locations[i + 1].startTime).BeatLength;
// Decrease the duration by at most a 1/4 beat to ensure there's no instantaneous notes.
duration = Math.Max(duration / 2, duration - beatLength / 4);
for (int i = 0; i < locations.Count - 1; i++)
newColumnObjects.Add(new HoldNote
{
// Full duration of the hold note.
double duration = locations[i + 1].startTime - locations[i].startTime;
// Beat length at the end of the hold note.
double beatLength = beatmap.ControlPointInfo.TimingPointAt(locations[i + 1].startTime).BeatLength;
// Decrease the duration by at most a 1/4 beat to ensure there's no instantaneous notes.
duration = Math.Max(duration / 2, duration - beatLength / 4);
newColumnObjects.Add(new HoldNote
{
Column = column.Key,
StartTime = locations[i].startTime,
Duration = duration,
NodeSamples = new List<IList<HitSampleInfo>> { locations[i].samples, Array.Empty<HitSampleInfo>() }
});
}
}
else
{
//var locations = column.OfType<Note>().Select(n => (startTime: n.StartTime, samples: n.Samples))
// .Concat(column.OfType<HoldNote>().SelectMany(h => new[]
// {
// (startTime: h.StartTime, samples: h.GetNodeSamples(0)),
// (startTime: h.EndTime, samples: h.GetNodeSamples(1))
// }))
// .OrderBy(h => h.startTime).ToList();
//for (int i = 0; i < locations.Count - 1; i++)
//{
// // Full duration of the hold note.
// double duration = locations[i + 1].startTime - locations[i].startTime;
// // Beat length at the end of the hold note.
// double beatLength = beatmap.ControlPointInfo.TimingPointAt(locations[i + 1].startTime).BeatLength;
// // Decrease the duration by at most a 1/4 beat to ensure there's no instantaneous notes.
// duration = Math.Max(duration / 2, duration - beatLength / 4);
// newColumnObjects.Add(new HoldNote
// {
// Column = column.Key,
// StartTime = locations[i].startTime,
// Duration = duration,
// NodeSamples = new List<IList<HitSampleInfo>> { locations[i].samples, Array.Empty<HitSampleInfo>() }
// });
//}
Column = column.Key,
StartTime = locations[i].startTime,
Duration = duration,
NodeSamples = new List<IList<HitSampleInfo>> { locations[i].samples, Array.Empty<HitSampleInfo>() }
});
}
newObjects.AddRange(newColumnObjects);
}