mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 11:03:21 +08:00
Move constants to base OsuHitObject representation.
This commit is contained in:
parent
910d9ccc00
commit
20fcb8848b
@ -69,18 +69,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
Size = circle.DrawSize;
|
||||
}
|
||||
|
||||
//todo: these aren't constants.
|
||||
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 CIRCLE_RADIUS = 64;
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (!userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset > HIT_WINDOW_50)
|
||||
if (Judgement.TimeOffset > OsuHitObject.HIT_WINDOW_50)
|
||||
Judgement.Result = HitResult.Miss;
|
||||
return;
|
||||
}
|
||||
@ -89,15 +82,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
|
||||
OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo;
|
||||
|
||||
if (hitOffset < HIT_WINDOW_50)
|
||||
if (hitOffset < OsuHitObject.HIT_WINDOW_50)
|
||||
{
|
||||
Judgement.Result = HitResult.Hit;
|
||||
|
||||
if (hitOffset < HIT_WINDOW_300)
|
||||
if (hitOffset < OsuHitObject.HIT_WINDOW_300)
|
||||
osuJudgement.Score = OsuScoreResult.Hit300;
|
||||
else if (hitOffset < HIT_WINDOW_100)
|
||||
else if (hitOffset < OsuHitObject.HIT_WINDOW_100)
|
||||
osuJudgement.Score = OsuScoreResult.Hit100;
|
||||
else if (hitOffset < HIT_WINDOW_50)
|
||||
else if (hitOffset < OsuHitObject.HIT_WINDOW_50)
|
||||
osuJudgement.Score = OsuScoreResult.Hit50;
|
||||
}
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
Size = new Vector2((float)DrawableHitCircle.CIRCLE_RADIUS * 2);
|
||||
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Masking = true;
|
||||
CornerRadius = Size.X / 2;
|
||||
|
||||
|
@ -5,11 +5,18 @@ using System;
|
||||
using osu.Game.Modes.Objects;
|
||||
using OpenTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects
|
||||
{
|
||||
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 Vector2 Position { get; set; }
|
||||
|
||||
public Vector2 StackedPosition => Position + StackOffset;
|
||||
@ -26,6 +33,21 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
|
||||
public abstract HitObjectType Type { get; }
|
||||
|
||||
public double HitWindowFor(OsuScoreResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
default:
|
||||
return 300;
|
||||
case OsuScoreResult.Hit50:
|
||||
return 150;
|
||||
case OsuScoreResult.Hit100:
|
||||
return 80;
|
||||
case OsuScoreResult.Hit300:
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
|
||||
{
|
||||
base.SetDefaultsFromBeatmap(beatmap);
|
||||
|
@ -100,20 +100,20 @@ namespace osu.Game.Modes.Osu
|
||||
OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject;
|
||||
|
||||
//Make the cursor stay at a hitObject as long as possible (mainly for autopilot).
|
||||
if (h.StartTime - DrawableHitCircle.HITTABLE_RANGE > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50)
|
||||
if (h.StartTime - OsuHitObject.HITTABLE_RANGE > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50)
|
||||
{
|
||||
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
|
||||
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
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 (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
}
|
||||
else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_50 > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50)
|
||||
else if (h.StartTime - OsuHitObject.HIT_WINDOW_50 > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50)
|
||||
{
|
||||
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
|
||||
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
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 (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
}
|
||||
else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_100 > last.EndTime + DrawableHitCircle.HIT_WINDOW_100 + 50)
|
||||
else if (h.StartTime - OsuHitObject.HIT_WINDOW_100 > last.EndTime + OsuHitObject.HIT_WINDOW_100 + 50)
|
||||
{
|
||||
if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None));
|
||||
if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
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 (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None));
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ namespace osu.Game.Modes.Osu
|
||||
|
||||
// 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
|
||||
((lastPosition - targetPosition).Length > DrawableHitCircle.CIRCLE_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough
|
||||
((lastPosition - targetPosition).Length > OsuHitObject.OBJECT_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough
|
||||
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
|
||||
{
|
||||
// Perform eased movement
|
||||
|
Loading…
Reference in New Issue
Block a user