Fix remaining usage of hit window constants.

This commit is contained in:
Dean Herbert 2017-03-06 23:26:57 +09:00
parent 610de4a34c
commit fc6bd386ea
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 19 additions and 16 deletions

View File

@ -73,7 +73,7 @@ protected override void CheckJudgement(bool userTriggered)
{ {
if (!userTriggered) if (!userTriggered)
{ {
if (Judgement.TimeOffset > OsuHitObject.HIT_WINDOW_50) if (Judgement.TimeOffset > HitObject.HitWindowFor(OsuScoreResult.Hit50))
Judgement.Result = HitResult.Miss; Judgement.Result = HitResult.Miss;
return; return;
} }
@ -82,7 +82,7 @@ protected override void CheckJudgement(bool userTriggered)
OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo;
if (hitOffset < OsuHitObject.HIT_WINDOW_50) if (hitOffset < HitObject.HitWindowFor(OsuScoreResult.Hit50))
{ {
Judgement.Result = HitResult.Hit; Judgement.Result = HitResult.Hit;
osuJudgement.Score = HitObject.ScoreResultForOffset(hitOffset); osuJudgement.Score = HitObject.ScoreResultForOffset(hitOffset);

View File

@ -11,12 +11,13 @@ namespace osu.Game.Modes.Osu.Objects
{ {
public abstract class OsuHitObject : HitObject public abstract class OsuHitObject : HitObject
{ {
public const double HITTABLE_RANGE = 300;
public const double HIT_WINDOW_50 = 150;
public const double HIT_WINDOW_100 = 80;
public const double HIT_WINDOW_300 = 30;
public const double OBJECT_RADIUS = 64; public const double OBJECT_RADIUS = 64;
private const double hittable_range = 300;
private const double hit_window_50 = 150;
private const double hit_window_100 = 80;
private const double hit_window_300 = 30;
public Vector2 Position { get; set; } public Vector2 Position { get; set; }
public Vector2 StackedPosition => Position + StackOffset; public Vector2 StackedPosition => Position + StackOffset;
@ -29,6 +30,8 @@ public abstract class OsuHitObject : HitObject
public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f); public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f);
public double Radius => OBJECT_RADIUS * Scale;
public float Scale { get; set; } = 1; public float Scale { get; set; } = 1;
public abstract HitObjectType Type { get; } public abstract HitObjectType Type { get; }

View File

@ -100,20 +100,20 @@ private void createAutoReplay()
OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject; OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject;
//Make the cursor stay at a hitObject as long as possible (mainly for autopilot). //Make the cursor stay at a hitObject as long as possible (mainly for autopilot).
if (h.StartTime - OsuHitObject.HITTABLE_RANGE > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) if (h.StartTime - h.HitWindowFor(OsuScoreResult.Miss) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50)
{ {
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Miss), h.Position.X, h.Position.Y, LegacyButtonState.None));
} }
else if (h.StartTime - OsuHitObject.HIT_WINDOW_50 > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50)
{ {
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50), h.Position.X, h.Position.Y, LegacyButtonState.None));
} }
else if (h.StartTime - OsuHitObject.HIT_WINDOW_100 > last.EndTime + OsuHitObject.HIT_WINDOW_100 + 50) else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit100) + 50)
{ {
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit100), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100), h.Position.X, h.Position.Y, LegacyButtonState.None));
} }
} }
@ -185,7 +185,7 @@ private void createAutoReplay()
// Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up. // Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up.
if (timeDifference > 0 && // Sanity checks if (timeDifference > 0 && // Sanity checks
((lastPosition - targetPosition).Length > OsuHitObject.OBJECT_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough ((lastPosition - targetPosition).Length > h.Radius * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
{ {
// Perform eased movement // Perform eased movement