mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Generate better temporary frames to support framed handling flaws
This commit is contained in:
@ -37,10 +37,6 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
float lastPosition = 0.5f;
|
float lastPosition = 0.5f;
|
||||||
double lastTime = 0;
|
double lastTime = 0;
|
||||||
|
|
||||||
// Todo: Realistically this shouldn't be needed, but the first frame is skipped with the way replays are currently handled
|
|
||||||
addFrame(-100000, lastPosition);
|
|
||||||
addFrame(0, lastPosition);
|
|
||||||
|
|
||||||
void moveToNext(CatchHitObject h)
|
void moveToNext(CatchHitObject h)
|
||||||
{
|
{
|
||||||
float positionChange = Math.Abs(lastPosition - h.X);
|
float positionChange = Math.Abs(lastPosition - h.X);
|
||||||
@ -128,6 +124,10 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
|
|
||||||
private void addFrame(double time, float? position = null, bool dashing = false)
|
private void addFrame(double time, float? position = null, bool dashing = false)
|
||||||
{
|
{
|
||||||
|
// todo: can be removed once FramedReplayInputHandler correctly handles rewinding before first frame.
|
||||||
|
if (Replay.Frames.Count == 0)
|
||||||
|
Replay.Frames.Add(new CatchReplayFrame(time - 1, position, false, null));
|
||||||
|
|
||||||
var last = currentFrame;
|
var last = currentFrame;
|
||||||
currentFrame = new CatchReplayFrame(time, position, dashing, last);
|
currentFrame = new CatchReplayFrame(time, position, dashing, last);
|
||||||
Replay.Frames.Add(currentFrame);
|
Replay.Frames.Add(currentFrame);
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of frames which are generated at the start of a replay regardless of hitobject content.
|
/// The number of frames which are generated at the start of a replay regardless of hitobject content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int frame_offset = 2;
|
private const int frame_offset = 1;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSingleNote()
|
public void TestSingleNote()
|
||||||
|
@ -47,10 +47,6 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
|
|
||||||
public override Replay Generate()
|
public override Replay Generate()
|
||||||
{
|
{
|
||||||
// Todo: Realistically this shouldn't be needed, but the first frame is skipped with the way replays are currently handled
|
|
||||||
Replay.Frames.Add(new ManiaReplayFrame(-100000, 0));
|
|
||||||
Replay.Frames.Add(new ManiaReplayFrame(0, 0));
|
|
||||||
|
|
||||||
var pointGroups = generateActionPoints().GroupBy(a => a.Time).OrderBy(g => g.First().Time);
|
var pointGroups = generateActionPoints().GroupBy(a => a.Time).OrderBy(g => g.First().Time);
|
||||||
|
|
||||||
var actions = new List<ManiaAction>();
|
var actions = new List<ManiaAction>();
|
||||||
@ -71,6 +67,10 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: can be removed once FramedReplayInputHandler correctly handles rewinding before first frame.
|
||||||
|
if (Replay.Frames.Count == 0)
|
||||||
|
Replay.Frames.Add(new ManiaReplayFrame(group.First().Time - 1));
|
||||||
|
|
||||||
Replay.Frames.Add(new ManiaReplayFrame(group.First().Time, actions.ToArray()));
|
Replay.Frames.Add(new ManiaReplayFrame(group.First().Time, actions.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
public ManiaReplayFrame(double time, params ManiaAction[] actions)
|
public ManiaReplayFrame(double time, params ManiaAction[] actions)
|
||||||
: base(time)
|
: base(time)
|
||||||
{
|
{
|
||||||
Actions.AddRange(actions);
|
if (actions.Length > 0)
|
||||||
|
Actions.AddRange(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConvertFrom(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
|
public void ConvertFrom(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
|
||||||
|
Reference in New Issue
Block a user