mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Calculate unstable rate using rate-adjusted offsets
This commit is contained in:
parent
1c63f1f89d
commit
064857c40b
@ -54,6 +54,11 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// </remarks>
|
||||
public double TimeAbsolute => RawTime != null ? Math.Min(RawTime.Value, HitObject.GetEndTime() + HitObject.MaximumJudgementOffset) : HitObject.GetEndTime();
|
||||
|
||||
/// <summary>
|
||||
/// The gameplay rate at the time this <see cref="JudgementResult"/> occurred.
|
||||
/// </summary>
|
||||
public double GameplayRate { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The combo prior to this <see cref="JudgementResult"/> occurring.
|
||||
/// </summary>
|
||||
|
@ -704,6 +704,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
}
|
||||
|
||||
Result.RawTime = Time.Current;
|
||||
Result.GameplayRate = Clock.Rate;
|
||||
|
||||
if (Result.HasResult)
|
||||
updateState(Result.IsHit ? ArmedState.Hit : ArmedState.Miss);
|
||||
|
@ -19,6 +19,11 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
public readonly double TimeOffset;
|
||||
|
||||
/// <summary>
|
||||
/// The true gameplay rate at the time of the event.
|
||||
/// </summary>
|
||||
public readonly double GameplayRate;
|
||||
|
||||
/// <summary>
|
||||
/// The hit result.
|
||||
/// </summary>
|
||||
@ -46,12 +51,14 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
/// <param name="timeOffset">The time offset from the end of <paramref name="hitObject"/> at which the event occurs.</param>
|
||||
/// <param name="result">The <see cref="HitResult"/>.</param>
|
||||
/// <param name="gameplayRate">The true gameplay rate at the time of the event.</param>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> that triggered the event.</param>
|
||||
/// <param name="lastHitObject">The previous <see cref="HitObject"/>.</param>
|
||||
/// <param name="position">A position corresponding to the event.</param>
|
||||
public HitEvent(double timeOffset, HitResult result, HitObject hitObject, [CanBeNull] HitObject lastHitObject, [CanBeNull] Vector2? position)
|
||||
public HitEvent(double timeOffset, double gameplayRate, HitResult result, HitObject hitObject, [CanBeNull] HitObject lastHitObject, [CanBeNull] Vector2? position)
|
||||
{
|
||||
TimeOffset = timeOffset;
|
||||
GameplayRate = gameplayRate;
|
||||
Result = result;
|
||||
HitObject = hitObject;
|
||||
LastHitObject = lastHitObject;
|
||||
@ -63,6 +70,6 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
/// <param name="positionOffset">The positional offset.</param>
|
||||
/// <returns>The new <see cref="HitEvent"/>.</returns>
|
||||
public HitEvent With(Vector2? positionOffset) => new HitEvent(TimeOffset, Result, HitObject, LastHitObject, positionOffset);
|
||||
public HitEvent With(Vector2? positionOffset) => new HitEvent(TimeOffset, GameplayRate, Result, HitObject, LastHitObject, positionOffset);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </returns>
|
||||
public static double? CalculateUnstableRate(this IEnumerable<HitEvent> hitEvents)
|
||||
{
|
||||
double[] timeOffsets = hitEvents.Where(affectsUnstableRate).Select(ev => ev.TimeOffset).ToArray();
|
||||
// Division by gameplay rate is to account for TimeOffset scaling with gameplay rate.
|
||||
double[] timeOffsets = hitEvents.Where(affectsUnstableRate).Select(ev => ev.TimeOffset / ev.GameplayRate).ToArray();
|
||||
return 10 * standardDeviation(timeOffsets);
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <param name="result">The <see cref="JudgementResult"/> to describe.</param>
|
||||
/// <returns>The <see cref="HitEvent"/>.</returns>
|
||||
protected virtual HitEvent CreateHitEvent(JudgementResult result)
|
||||
=> new HitEvent(result.TimeOffset, result.Type, result.HitObject, lastHitObject, null);
|
||||
=> new HitEvent(result.TimeOffset, result.GameplayRate, result.Type, result.HitObject, lastHitObject, null);
|
||||
|
||||
protected sealed override void RevertResultInternal(JudgementResult result)
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
private void onNewResult(DrawableHitObject drawable, JudgementResult result)
|
||||
{
|
||||
Debug.Assert(result != null && drawable.Entry?.Result == result && result.RawTime != null);
|
||||
Debug.Assert(result != null && drawable.Entry?.Result == result && result.RawTime != null && result.GameplayRate != 0.0);
|
||||
judgedEntries.Push(drawable.Entry.AsNonNull());
|
||||
|
||||
NewResult?.Invoke(drawable, result);
|
||||
|
@ -224,7 +224,7 @@ namespace osu.Game.Screens.Utility
|
||||
.FadeOut(duration)
|
||||
.ScaleTo(1.5f, duration);
|
||||
|
||||
HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject
|
||||
HitEvent = new HitEvent(Clock.CurrentTime - HitTime, 1.0, HitResult.Good, new HitObject
|
||||
{
|
||||
HitWindows = new HitWindows(),
|
||||
}, null, null);
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Screens.Utility
|
||||
.FadeOut(duration / 2)
|
||||
.ScaleTo(1.5f, duration / 2);
|
||||
|
||||
HitEvent = new HitEvent(Clock.CurrentTime - HitTime, HitResult.Good, new HitObject
|
||||
HitEvent = new HitEvent(Clock.CurrentTime - HitTime, 1.0, HitResult.Good, new HitObject
|
||||
{
|
||||
HitWindows = new HitWindows(),
|
||||
}, null, null);
|
||||
|
Loading…
Reference in New Issue
Block a user