mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Allow attaching a replay to a FrameStabilityContainer when FrameStablePlayback is off
This commit is contained in:
parent
600d37cc04
commit
e8220cf1b6
@ -123,9 +123,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!FrameStablePlayback)
|
if (FrameStablePlayback)
|
||||||
return;
|
{
|
||||||
|
|
||||||
if (firstConsumption)
|
if (firstConsumption)
|
||||||
{
|
{
|
||||||
// On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
|
// On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
|
||||||
@ -145,18 +144,43 @@ namespace osu.Game.Rulesets.UI
|
|||||||
? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
|
? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
|
||||||
: Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
|
: Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isAttached)
|
if (isAttached)
|
||||||
{
|
{
|
||||||
double? newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime);
|
double? newTime;
|
||||||
|
|
||||||
|
if (FrameStablePlayback)
|
||||||
|
{
|
||||||
|
// when stability is turned on, we shouldn't execute for time values the replay is unable to satisfy.
|
||||||
|
if ((newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime)) == null)
|
||||||
|
{
|
||||||
|
// setting invalid state here ensures that gameplay will not continue (ie. our child
|
||||||
|
// hierarchy won't be updated).
|
||||||
|
validState = false;
|
||||||
|
|
||||||
|
// potentially loop to catch-up playback.
|
||||||
|
requireMoreUpdateLoops = true;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// when stability is disabled, we don't really care about accuracy.
|
||||||
|
// looping over the replay will allow it to catch up and feed out the required values
|
||||||
|
// for the current time.
|
||||||
|
while ((newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime)) != newProposedTime)
|
||||||
|
{
|
||||||
if (newTime == null)
|
if (newTime == null)
|
||||||
{
|
{
|
||||||
// we shouldn't execute for this time value. probably waiting on more replay data.
|
// special case for when the replay actually can't arrive at the required time.
|
||||||
|
// protects from potential endless loop.
|
||||||
validState = false;
|
validState = false;
|
||||||
requireMoreUpdateLoops = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newProposedTime = newTime.Value;
|
newProposedTime = newTime.Value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user