Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Quaver.API/Replays/Replay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ public static Replay GeneratePerfectReplayKeys(Replay replay, Qua map)
replay.Frames.Add(new ReplayFrame(item.Key, state));
}

// Add ending frame w/ no press state. (+10000 just to be on the safe side.)
// This ensures that mines are handled at the end of the map.
replay.Frames.Add(new ReplayFrame(map.Length + 10000, 0));

return replay;
}

Expand Down
13 changes: 11 additions & 2 deletions Quaver.API/Replays/Virtual/VirtualReplayPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,15 @@ public void PlayNextFrame()
{
var obj = Map.GetHitObjectAtJudgementIndex(i);

var hitStat = new HitStat(HitStatType.Miss, KeyPressType.None, obj, obj.StartTime,
Judgement.Miss, int.MinValue, ScoreProcessor.Accuracy, ScoreProcessor.Health);
var hitStat = obj.Type switch
{
HitObjectType.Normal => new HitStat(HitStatType.Miss, KeyPressType.None, obj, obj.StartTime,
Judgement.Miss, int.MinValue, ScoreProcessor.Accuracy, ScoreProcessor.Health),
HitObjectType.Mine => new HitStat(HitStatType.Hit, KeyPressType.None, obj, obj.StartTime,
Judgement.Marv, 0, ScoreProcessor.Accuracy, ScoreProcessor.Health),
_ => throw new ArgumentOutOfRangeException(nameof(obj.Type), obj.Type,
"Unhandled note type")
};

ScoreProcessor.CalculateScore(hitStat);

Expand Down Expand Up @@ -230,6 +237,8 @@ private void HandleKeyPressesInFrame()
// Handle mines that were hit between frames.
// The previous frame's pressed keys are held up until now, so [previousFrameTime..Time)
// is the interval to check for mine hits.
// This covers the last frame too! see ReplayCapturer.Capture: it adds a frame if judgement count
// does not match expected, forcing another call into this.
foreach (var lane in previousFramePressed)
{
foreach (var mine in ActiveMines)
Expand Down
Loading