mirror of
https://github.com/ppy/osu
synced 2024-12-11 17:42:28 +00:00
Merge pull request #10962 from smoogipoo/improve-dho-time-offsets
Fix judgement offsets in non-framestable contexts
This commit is contained in:
commit
7f34e11467
@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
public void UpdateResult() => base.UpdateResult(true);
|
||||
|
||||
protected override double MaximumJudgementOffset => base.MaximumJudgementOffset * release_window_lenience;
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
Debug.Assert(HitObject.HitWindows != null);
|
||||
|
@ -9,9 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
@ -61,13 +59,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
PositionBindable.BindTo(HitObject.PositionBindable);
|
||||
StackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||
ScaleBindable.BindTo(HitObject.ScaleBindable);
|
||||
|
||||
// Manually set to reduce the number of future alive objects to a bare minimum.
|
||||
LifetimeStart = HitObject.StartTime - HitObject.TimePreempt;
|
||||
|
||||
// Arbitrary lifetime end to prevent past objects in idle states remaining alive in non-frame-stable contexts.
|
||||
// An extra 1000ms is added to always overestimate the true lifetime, and a more exact value is set by hit transforms and the following expiry.
|
||||
LifetimeEnd = HitObject.GetEndTime() + HitObject.HitWindows.WindowFor(HitResult.Miss) + 1000;
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
public class DrawableSpinnerTick : DrawableOsuHitObject
|
||||
@ -17,6 +19,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
}
|
||||
|
||||
private DrawableSpinner drawableSpinner;
|
||||
|
||||
protected override void OnParentReceived(DrawableHitObject parent)
|
||||
{
|
||||
base.OnParentReceived(parent);
|
||||
drawableSpinner = (DrawableSpinner)parent;
|
||||
}
|
||||
|
||||
protected override double MaximumJudgementOffset => drawableSpinner.HitObject.Duration;
|
||||
|
||||
/// <summary>
|
||||
/// Apply a judgement result.
|
||||
/// </summary>
|
||||
|
@ -176,6 +176,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
public OsuHitObjectLifetimeEntry(HitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
// Prevent past objects in idles states from remaining alive as their end times are skipped in non-frame-stable contexts.
|
||||
LifetimeEnd = HitObject.GetEndTime() + HitObject.HitWindows.WindowFor(HitResult.Miss);
|
||||
}
|
||||
|
||||
protected override double InitialLifetimeOffset => ((OsuHitObject)HitObject).TimePreempt;
|
||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
Filled = HitObject.FirstTick
|
||||
});
|
||||
|
||||
protected override double MaximumJudgementOffset => HitObject.HitWindow;
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (!userTriggered)
|
||||
|
@ -710,6 +710,18 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
UpdateResult(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum offset from the end time of <see cref="HitObject"/> at which this <see cref="DrawableHitObject"/> can be judged.
|
||||
/// The time offset of <see cref="Result"/> will be clamped to this value during <see cref="ApplyResult"/>.
|
||||
/// <para>
|
||||
/// Defaults to the miss window of <see cref="HitObject"/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This does not affect the time offset provided to invocations of <see cref="CheckForResult"/>.
|
||||
/// </remarks>
|
||||
protected virtual double MaximumJudgementOffset => HitObject.HitWindows?.WindowFor(HitResult.Miss) ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Applies the <see cref="Result"/> of this <see cref="DrawableHitObject"/>, notifying responders such as
|
||||
/// the <see cref="ScoreProcessor"/> of the <see cref="JudgementResult"/>.
|
||||
@ -749,14 +761,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
$"{GetType().ReadableName()} applied an invalid hit result (was: {Result.Type}, expected: [{Result.Judgement.MinResult} ... {Result.Judgement.MaxResult}]).");
|
||||
}
|
||||
|
||||
// Ensure that the judgement is given a valid time offset, because this may not get set by the caller
|
||||
var endTime = HitObject.GetEndTime();
|
||||
|
||||
Result.TimeOffset = Time.Current - endTime;
|
||||
|
||||
double missWindow = HitObject.HitWindows.WindowFor(HitResult.Miss);
|
||||
if (missWindow > 0)
|
||||
Result.TimeOffset = Math.Min(Result.TimeOffset, missWindow);
|
||||
Result.TimeOffset = Math.Min(MaximumJudgementOffset, Time.Current - HitObject.GetEndTime());
|
||||
|
||||
if (Result.HasResult)
|
||||
updateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss);
|
||||
@ -778,8 +783,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
if (Judged)
|
||||
return false;
|
||||
|
||||
var endTime = HitObject.GetEndTime();
|
||||
CheckForResult(userTriggered, Time.Current - endTime);
|
||||
CheckForResult(userTriggered, Time.Current - HitObject.GetEndTime());
|
||||
|
||||
return Judged;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user