1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 13:07:25 +08:00

Merge pull request #10400 from peppy/fix-first-hitobject-must-be-combo

Ensure first hitobject is always a new combo
This commit is contained in:
Dan Balasescu 2020-10-07 17:01:31 +09:00 committed by GitHub
commit 54ca544855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 21 deletions

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Editing
{ {
HitObjects = HitObjects =
{ {
new HitCircle { StartTime = 1000 } new HitCircle { StartTime = 1000, NewCombo = true }
} }
}; };
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new HitCircle { StartTime = 3000 }, new HitCircle { StartTime = 3000 },
}); });
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
new HitCircle { StartTime = 3000 }, new HitCircle { StartTime = 3000 },
}); });
@ -100,7 +100,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
new HitCircle { StartTime = 3000 }, new HitCircle { StartTime = 3000 },
}); });
@ -109,7 +109,7 @@ namespace osu.Game.Tests.Editing
{ {
HitObjects = HitObjects =
{ {
new HitCircle { StartTime = 500 }, new HitCircle { StartTime = 500, NewCombo = true },
(OsuHitObject)current.HitObjects[1], (OsuHitObject)current.HitObjects[1],
(OsuHitObject)current.HitObjects[2], (OsuHitObject)current.HitObjects[2],
} }
@ -123,7 +123,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
new HitCircle { StartTime = 3000 }, new HitCircle { StartTime = 3000 },
}); });
@ -146,7 +146,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new OsuHitObject[] current.AddRange(new OsuHitObject[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new Slider new Slider
{ {
StartTime = 2000, StartTime = 2000,
@ -188,7 +188,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000, NewCombo = true },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
new HitCircle { StartTime = 3000 }, new HitCircle { StartTime = 3000 },
}); });
@ -197,7 +197,7 @@ namespace osu.Game.Tests.Editing
{ {
HitObjects = HitObjects =
{ {
new HitCircle { StartTime = 500 }, new HitCircle { StartTime = 500, NewCombo = true },
(OsuHitObject)current.HitObjects[0], (OsuHitObject)current.HitObjects[0],
new HitCircle { StartTime = 1500 }, new HitCircle { StartTime = 1500 },
(OsuHitObject)current.HitObjects[1], (OsuHitObject)current.HitObjects[1],
@ -216,7 +216,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 500 }, new HitCircle { StartTime = 500, NewCombo = true },
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000 },
new HitCircle { StartTime = 1500 }, new HitCircle { StartTime = 1500 },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
@ -226,6 +226,9 @@ namespace osu.Game.Tests.Editing
new HitCircle { StartTime = 3500 }, new HitCircle { StartTime = 3500 },
}); });
var patchedFirst = (HitCircle)current.HitObjects[1];
patchedFirst.NewCombo = true;
var patch = new OsuBeatmap var patch = new OsuBeatmap
{ {
HitObjects = HitObjects =
@ -244,7 +247,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 500 }, new HitCircle { StartTime = 500, NewCombo = true },
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000 },
new HitCircle { StartTime = 1500 }, new HitCircle { StartTime = 1500 },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
@ -277,7 +280,7 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 500 }, new HitCircle { StartTime = 500, NewCombo = true },
new HitCircle { StartTime = 1000 }, new HitCircle { StartTime = 1000 },
new HitCircle { StartTime = 1500 }, new HitCircle { StartTime = 1500 },
new HitCircle { StartTime = 2000 }, new HitCircle { StartTime = 2000 },
@ -291,7 +294,7 @@ namespace osu.Game.Tests.Editing
{ {
HitObjects = HitObjects =
{ {
new HitCircle { StartTime = 750 }, new HitCircle { StartTime = 750, NewCombo = true },
(OsuHitObject)current.HitObjects[1], (OsuHitObject)current.HitObjects[1],
(OsuHitObject)current.HitObjects[4], (OsuHitObject)current.HitObjects[4],
(OsuHitObject)current.HitObjects[5], (OsuHitObject)current.HitObjects[5],
@ -309,20 +312,20 @@ namespace osu.Game.Tests.Editing
{ {
current.AddRange(new[] current.AddRange(new[]
{ {
new HitCircle { StartTime = 500, Position = new Vector2(50) }, new HitCircle { StartTime = 500, Position = new Vector2(50), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(100) }, new HitCircle { StartTime = 500, Position = new Vector2(100), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(150) }, new HitCircle { StartTime = 500, Position = new Vector2(150), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(200) }, new HitCircle { StartTime = 500, Position = new Vector2(200), NewCombo = true },
}); });
var patch = new OsuBeatmap var patch = new OsuBeatmap
{ {
HitObjects = HitObjects =
{ {
new HitCircle { StartTime = 500, Position = new Vector2(150) }, new HitCircle { StartTime = 500, Position = new Vector2(150), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(100) }, new HitCircle { StartTime = 500, Position = new Vector2(100), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(50) }, new HitCircle { StartTime = 500, Position = new Vector2(50), NewCombo = true },
new HitCircle { StartTime = 500, Position = new Vector2(200) }, new HitCircle { StartTime = 500, Position = new Vector2(200), NewCombo = true },
} }
}; };

View File

@ -22,8 +22,18 @@ namespace osu.Game.Beatmaps
{ {
IHasComboInformation lastObj = null; IHasComboInformation lastObj = null;
bool isFirst = true;
foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>()) foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>())
{ {
if (isFirst)
{
obj.NewCombo = true;
// first hitobject should always be marked as a new combo for sanity.
isFirst = false;
}
if (obj.NewCombo) if (obj.NewCombo)
{ {
obj.IndexInCurrentCombo = 0; obj.IndexInCurrentCombo = 0;