mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 12:12:56 +08:00
Add back optimisation and increase time allowance slightly
This commit is contained in:
parent
555ce7684b
commit
786d5a394b
@ -71,19 +71,28 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
// We need to use lifetime entries to find the next object (we can't just use `hitObjectContainer.Objects` due to pooling - it may even be empty).
|
// We need to use lifetime entries to find the next object (we can't just use `hitObjectContainer.Objects` due to pooling - it may even be empty).
|
||||||
// If required, we can make this lookup more efficient by adding support to get next-future-entry in LifetimeEntryManager.
|
// If required, we can make this lookup more efficient by adding support to get next-future-entry in LifetimeEntryManager.
|
||||||
var candidate = hitObjectContainer.Entries.Where(e => !isAlreadyHit(e)).MinBy(e => e.HitObject.StartTime);
|
var candidate =
|
||||||
|
// Use alive entries first as an optimisation.
|
||||||
|
hitObjectContainer.AliveEntries.Select(tuple => tuple.Entry).Where(e => !isAlreadyHit(e)).MinBy(e => e.HitObject.StartTime)
|
||||||
|
?? hitObjectContainer.Entries.Where(e => !isAlreadyHit(e)).MinBy(e => e.HitObject.StartTime);
|
||||||
|
|
||||||
// In the case there are no non-judged objects, the last hit object should be used instead.
|
// In the case there are no non-judged objects, the last hit object should be used instead.
|
||||||
if (candidate == null)
|
if (candidate == null)
|
||||||
|
{
|
||||||
mostValidObject = hitObjectContainer.Entries.LastOrDefault();
|
mostValidObject = hitObjectContainer.Entries.LastOrDefault();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isCloseEnoughToCurrentTime(candidate))
|
if (isCloseEnoughToCurrentTime(candidate))
|
||||||
|
{
|
||||||
mostValidObject = candidate;
|
mostValidObject = candidate;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
mostValidObject ??= hitObjectContainer.Entries.FirstOrDefault();
|
mostValidObject ??= hitObjectContainer.Entries.FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mostValidObject == null)
|
if (mostValidObject == null)
|
||||||
return null;
|
return null;
|
||||||
@ -98,7 +107,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool isAlreadyHit(HitObjectLifetimeEntry h) => h.Result?.HasResult == true;
|
private bool isAlreadyHit(HitObjectLifetimeEntry h) => h.Result?.HasResult == true;
|
||||||
private bool isCloseEnoughToCurrentTime(HitObjectLifetimeEntry h) => Time.Current > h.HitObject.StartTime - h.HitObject.HitWindows.WindowFor(HitResult.Miss) * 1.5;
|
private bool isCloseEnoughToCurrentTime(HitObjectLifetimeEntry h) => Time.Current >= h.HitObject.StartTime - h.HitObject.HitWindows.WindowFor(HitResult.Miss) * 2;
|
||||||
|
|
||||||
private HitObject getEarliestNestedObject(HitObject hitObject)
|
private HitObject getEarliestNestedObject(HitObject hitObject)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user