From e34a9a00014d63249582320f5b08e9cce6ec29cc Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 15 Aug 2023 19:30:37 +0900 Subject: [PATCH 1/2] Disable hold end conversion for mania HoldOff mod --- osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs index 2b0098744f..a94fdeda6b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs @@ -46,19 +46,6 @@ namespace osu.Game.Rulesets.Mania.Mods StartTime = h.StartTime, Samples = h.GetNodeSamples(0) }); - - // Don't add an end note if the duration is shorter than the threshold - double noteValue = GetNoteDurationInBeatLength(h, maniaBeatmap); // 1/1, 1/2, 1/4, etc. - - if (noteValue >= END_NOTE_ALLOW_THRESHOLD) - { - newObjects.Add(new Note - { - Column = h.Column, - StartTime = h.EndTime, - Samples = h.GetNodeSamples((h.NodeSamples?.Count - 1) ?? 1) - }); - } } maniaBeatmap.HitObjects = maniaBeatmap.HitObjects.OfType().Concat(newObjects).OrderBy(h => h.StartTime).ToList(); From 5678db4e707bf37736bb9b2ea8ad29538f886c4b Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 15 Aug 2023 19:42:32 +0900 Subject: [PATCH 2/2] Fix test + cleanup --- .../Mods/TestSceneManiaModHoldOff.cs | 37 +------------------ .../Mods/ManiaModHoldOff.cs | 8 ---- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs index 3011a93755..f5117b61af 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs @@ -6,7 +6,6 @@ using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Tests.Visual; -using System.Collections.Generic; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Mania.Beatmaps; @@ -24,21 +23,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods Assert.False(testBeatmap.HitObjects.OfType().Any()); } - [Test] - public void TestCorrectNoteValues() - { - var testBeatmap = createRawBeatmap(); - var noteValues = new List(testBeatmap.HitObjects.OfType().Count()); - - foreach (HoldNote h in testBeatmap.HitObjects.OfType()) - { - noteValues.Add(ManiaModHoldOff.GetNoteDurationInBeatLength(h, testBeatmap)); - } - - noteValues.Sort(); - Assert.AreEqual(noteValues, new List { 0.125, 0.250, 0.500, 1.000, 2.000 }); - } - [Test] public void TestCorrectObjectCount() { @@ -47,25 +31,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods var rawBeatmap = createRawBeatmap(); var testBeatmap = createModdedBeatmap(); - // Calculate expected number of objects - int expectedObjectCount = 0; - - foreach (ManiaHitObject h in rawBeatmap.HitObjects) - { - // Both notes and hold notes account for at least one object - expectedObjectCount++; - - if (h.GetType() == typeof(HoldNote)) - { - double noteValue = ManiaModHoldOff.GetNoteDurationInBeatLength((HoldNote)h, rawBeatmap); - - if (noteValue >= ManiaModHoldOff.END_NOTE_ALLOW_THRESHOLD) - { - // Should generate an end note if it's longer than the minimum note value - expectedObjectCount++; - } - } - } + // Both notes and hold notes account for at least one object + int expectedObjectCount = rawBeatmap.HitObjects.Count; Assert.That(testBeatmap.HitObjects.Count == expectedObjectCount); } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs index a94fdeda6b..4e6cc4f1d6 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs @@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Mania.Mods public override Type[] IncompatibleMods => new[] { typeof(ManiaModInvert) }; - public const double END_NOTE_ALLOW_THRESHOLD = 0.5; - public void ApplyToBeatmap(IBeatmap beatmap) { var maniaBeatmap = (ManiaBeatmap)beatmap; @@ -50,11 +48,5 @@ namespace osu.Game.Rulesets.Mania.Mods maniaBeatmap.HitObjects = maniaBeatmap.HitObjects.OfType().Concat(newObjects).OrderBy(h => h.StartTime).ToList(); } - - public static double GetNoteDurationInBeatLength(HoldNote holdNote, ManiaBeatmap beatmap) - { - double beatLength = beatmap.ControlPointInfo.TimingPointAt(holdNote.StartTime).BeatLength; - return holdNote.Duration / beatLength; - } } }