1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 08:22:56 +08:00

Don't assume catcher dash speed is 2x the walk speed

This commit is contained in:
ekrctb 2021-10-26 20:09:48 +09:00
parent aeac3287ea
commit e5050b90a5
4 changed files with 17 additions and 15 deletions

View File

@ -233,7 +233,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
int thisDirection = nextObject.EffectiveX > currentObject.EffectiveX ? 1 : -1; int thisDirection = nextObject.EffectiveX > currentObject.EffectiveX ? 1 : -1;
double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable
double distanceToNext = Math.Abs(nextObject.EffectiveX - currentObject.EffectiveX) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); double distanceToNext = Math.Abs(nextObject.EffectiveX - currentObject.EffectiveX) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
float distanceToHyper = (float)(timeToNext * Catcher.BASE_SPEED - distanceToNext); float distanceToHyper = (float)(timeToNext * Catcher.BASE_DASH_SPEED - distanceToNext);
if (distanceToHyper < 0) if (distanceToHyper < 0)
{ {

View File

@ -51,8 +51,8 @@ namespace osu.Game.Rulesets.Catch.Edit
LayerBelowRuleset.Add(distanceSnapGrid = new CatchDistanceSnapGrid(new[] LayerBelowRuleset.Add(distanceSnapGrid = new CatchDistanceSnapGrid(new[]
{ {
0.0, 0.0,
Catcher.BASE_SPEED, -Catcher.BASE_SPEED, Catcher.BASE_DASH_SPEED, -Catcher.BASE_DASH_SPEED,
Catcher.BASE_SPEED / 2, -Catcher.BASE_SPEED / 2, Catcher.BASE_WALK_SPEED, -Catcher.BASE_WALK_SPEED,
})); }));
} }

View File

@ -26,9 +26,6 @@ namespace osu.Game.Rulesets.Catch.Replays
if (Beatmap.HitObjects.Count == 0) if (Beatmap.HitObjects.Count == 0)
return; return;
// todo: add support for HT DT
const double dash_speed = Catcher.BASE_SPEED;
const double movement_speed = dash_speed / 2;
float lastPosition = CatchPlayfield.CENTER_X; float lastPosition = CatchPlayfield.CENTER_X;
double lastTime = 0; double lastTime = 0;
@ -47,8 +44,8 @@ namespace osu.Game.Rulesets.Catch.Replays
// The case where positionChange > 0 and timeAvailable == 0 results in PositiveInfinity which provides expected beheaviour. // The case where positionChange > 0 and timeAvailable == 0 results in PositiveInfinity which provides expected beheaviour.
double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable;
bool dashRequired = speedRequired > movement_speed; bool dashRequired = speedRequired > Catcher.BASE_WALK_SPEED;
bool impossibleJump = speedRequired > movement_speed * 2; bool impossibleJump = speedRequired > Catcher.BASE_DASH_SPEED;
// todo: get correct catcher size, based on difficulty CS. // todo: get correct catcher size, based on difficulty CS.
const float catcher_width_half = Catcher.BASE_SIZE * 0.3f * 0.5f; const float catcher_width_half = Catcher.BASE_SIZE * 0.3f * 0.5f;
@ -73,7 +70,7 @@ namespace osu.Game.Rulesets.Catch.Replays
else if (dashRequired) else if (dashRequired)
{ {
// we do a movement in two parts - the dash part then the normal part... // we do a movement in two parts - the dash part then the normal part...
double timeAtNormalSpeed = positionChange / movement_speed; double timeAtNormalSpeed = positionChange / Catcher.BASE_WALK_SPEED;
double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable; double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable;
double timeAtDashSpeed = timeWeNeedToSave / 2; double timeAtDashSpeed = timeWeNeedToSave / 2;
@ -86,7 +83,7 @@ namespace osu.Game.Rulesets.Catch.Replays
} }
else else
{ {
double timeBefore = positionChange / movement_speed; double timeBefore = positionChange / Catcher.BASE_WALK_SPEED;
addFrame(h.StartTime - timeBefore, lastPosition); addFrame(h.StartTime - timeBefore, lastPosition);
addFrame(h.StartTime, h.EffectiveX); addFrame(h.StartTime, h.EffectiveX);

View File

@ -57,14 +57,19 @@ namespace osu.Game.Rulesets.Catch.UI
public bool CatchFruitOnPlate { get; set; } = true; public bool CatchFruitOnPlate { get; set; } = true;
/// <summary> /// <summary>
/// The relative space to cover in 1 millisecond. based on 1 game pixel per millisecond as in osu-stable. /// The speed of the catcher when the catcher is dashing.
/// </summary> /// </summary>
public const double BASE_SPEED = 1.0; public const double BASE_DASH_SPEED = 1.0;
/// <summary> /// <summary>
/// The current speed of the catcher. /// The speed of the catcher when the catcher is not dashing.
/// </summary> /// </summary>
public double Speed => (Dashing ? 1 : 0.5) * BASE_SPEED * hyperDashModifier; public const double BASE_WALK_SPEED = 0.5;
/// <summary>
/// The current speed of the catcher with the hyper-dash modifier applied.
/// </summary>
public double Speed => (Dashing ? BASE_DASH_SPEED : BASE_WALK_SPEED) * hyperDashModifier;
/// <summary> /// <summary>
/// The amount by which caught fruit should be scaled down to fit on the plate. /// The amount by which caught fruit should be scaled down to fit on the plate.
@ -230,7 +235,7 @@ namespace osu.Game.Rulesets.Catch.UI
double positionDifference = target.EffectiveX - X; double positionDifference = target.EffectiveX - X;
var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0); var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
SetHyperDashState(Math.Abs(velocity), target.EffectiveX); SetHyperDashState(Math.Abs(velocity) / BASE_DASH_SPEED, target.EffectiveX);
} }
else else
SetHyperDashState(); SetHyperDashState();