mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:20:04 +08:00
Respect pre-empt time when auto-generating breaks
Closes https://github.com/ppy/osu/issues/28703.
This commit is contained in:
parent
25d63ac6a5
commit
088e8ad0a2
@ -15,7 +15,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public abstract class CatchHitObject : HitObject, IHasPosition, IHasComboInformation
|
||||
public abstract class CatchHitObject : HitObject, IHasPosition, IHasComboInformation, IHasTimePreempt
|
||||
{
|
||||
public const float OBJECT_RADIUS = 64;
|
||||
|
||||
|
@ -14,7 +14,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition
|
||||
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition, IHasTimePreempt
|
||||
{
|
||||
/// <summary>
|
||||
/// The radius of hit objects (ie. the radius of a <see cref="HitCircle"/>).
|
||||
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
/// </summary>
|
||||
public const double PREEMPT_MAX = 1800;
|
||||
|
||||
public double TimePreempt = 600;
|
||||
public double TimePreempt { get; set; } = 600;
|
||||
public double TimeFadeIn = 400;
|
||||
|
||||
private HitObjectProperty<Vector2> position;
|
||||
|
13
osu.Game/Rulesets/Objects/Types/IHasTimePreempt.cs
Normal file
13
osu.Game/Rulesets/Objects/Types/IHasTimePreempt.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="HitObject"/> that appears on screen at a fixed time interval before its <see cref="HitObject.StartTime"/>.
|
||||
/// </summary>
|
||||
public interface IHasTimePreempt
|
||||
{
|
||||
double TimePreempt { get; }
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
@ -67,19 +68,26 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
for (int i = 1; i < Beatmap.HitObjects.Count; ++i)
|
||||
{
|
||||
var previousObject = Beatmap.HitObjects[i - 1];
|
||||
var nextObject = Beatmap.HitObjects[i];
|
||||
|
||||
// Keep track of the maximum end time encountered thus far.
|
||||
// This handles cases like osu!mania's hold notes, which could have concurrent other objects after their start time.
|
||||
// Note that we're relying on the implicit assumption that objects are sorted by start time,
|
||||
// which is why similar tracking is not done for start time.
|
||||
currentMaxEndTime = Math.Max(currentMaxEndTime, Beatmap.HitObjects[i - 1].GetEndTime());
|
||||
currentMaxEndTime = Math.Max(currentMaxEndTime, previousObject.GetEndTime());
|
||||
|
||||
double nextObjectStartTime = Beatmap.HitObjects[i].StartTime;
|
||||
|
||||
if (nextObjectStartTime - currentMaxEndTime < BreakPeriod.MIN_GAP_DURATION)
|
||||
if (nextObject.StartTime - currentMaxEndTime < BreakPeriod.MIN_GAP_DURATION)
|
||||
continue;
|
||||
|
||||
double breakStartTime = currentMaxEndTime + BreakPeriod.GAP_BEFORE_BREAK;
|
||||
double breakEndTime = nextObjectStartTime - Math.Max(BreakPeriod.GAP_AFTER_BREAK, Beatmap.ControlPointInfo.TimingPointAt(nextObjectStartTime).BeatLength * 2);
|
||||
|
||||
double breakEndTime = nextObject.StartTime;
|
||||
|
||||
if (nextObject is IHasTimePreempt hasTimePreempt)
|
||||
breakEndTime -= hasTimePreempt.TimePreempt;
|
||||
else
|
||||
breakEndTime -= Math.Max(BreakPeriod.GAP_AFTER_BREAK, Beatmap.ControlPointInfo.TimingPointAt(nextObject.StartTime).BeatLength * 2);
|
||||
|
||||
if (breakEndTime - breakStartTime < BreakPeriod.MIN_BREAK_DURATION)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user