From e5050b90a56a08bffbacb951d91cd83a4a30fba0 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 26 Oct 2021 20:09:48 +0900 Subject: [PATCH] Don't assume catcher dash speed is 2x the walk speed --- .../Beatmaps/CatchBeatmapProcessor.cs | 2 +- .../Edit/CatchHitObjectComposer.cs | 4 ++-- .../Replays/CatchAutoGenerator.cs | 11 ++++------- osu.Game.Rulesets.Catch/UI/Catcher.cs | 15 ++++++++++----- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 87cc2c45e8..346a09cac8 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -233,7 +233,7 @@ private static void initialiseHyperDash(IBeatmap beatmap) 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 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) { diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 67055fb5e0..164f465438 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -51,8 +51,8 @@ private void load() LayerBelowRuleset.Add(distanceSnapGrid = new CatchDistanceSnapGrid(new[] { 0.0, - Catcher.BASE_SPEED, -Catcher.BASE_SPEED, - Catcher.BASE_SPEED / 2, -Catcher.BASE_SPEED / 2, + Catcher.BASE_DASH_SPEED, -Catcher.BASE_DASH_SPEED, + Catcher.BASE_WALK_SPEED, -Catcher.BASE_WALK_SPEED, })); } diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 2fc05701db..7c84cb24f3 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -26,9 +26,6 @@ protected override void GenerateFrames() if (Beatmap.HitObjects.Count == 0) 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; double lastTime = 0; @@ -47,8 +44,8 @@ void moveToNext(PalpableCatchHitObject h) // The case where positionChange > 0 and timeAvailable == 0 results in PositiveInfinity which provides expected beheaviour. double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; - bool dashRequired = speedRequired > movement_speed; - bool impossibleJump = speedRequired > movement_speed * 2; + bool dashRequired = speedRequired > Catcher.BASE_WALK_SPEED; + bool impossibleJump = speedRequired > Catcher.BASE_DASH_SPEED; // todo: get correct catcher size, based on difficulty CS. const float catcher_width_half = Catcher.BASE_SIZE * 0.3f * 0.5f; @@ -73,7 +70,7 @@ void moveToNext(PalpableCatchHitObject h) else if (dashRequired) { // 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 timeAtDashSpeed = timeWeNeedToSave / 2; @@ -86,7 +83,7 @@ void moveToNext(PalpableCatchHitObject h) } else { - double timeBefore = positionChange / movement_speed; + double timeBefore = positionChange / Catcher.BASE_WALK_SPEED; addFrame(h.StartTime - timeBefore, lastPosition); addFrame(h.StartTime, h.EffectiveX); diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 3745099010..a70dbcf25e 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -57,14 +57,19 @@ public class Catcher : SkinReloadableDrawable public bool CatchFruitOnPlate { get; set; } = true; /// - /// 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. /// - public const double BASE_SPEED = 1.0; + public const double BASE_DASH_SPEED = 1.0; /// - /// The current speed of the catcher. + /// The speed of the catcher when the catcher is not dashing. /// - public double Speed => (Dashing ? 1 : 0.5) * BASE_SPEED * hyperDashModifier; + public const double BASE_WALK_SPEED = 0.5; + + /// + /// The current speed of the catcher with the hyper-dash modifier applied. + /// + public double Speed => (Dashing ? BASE_DASH_SPEED : BASE_WALK_SPEED) * hyperDashModifier; /// /// The amount by which caught fruit should be scaled down to fit on the plate. @@ -230,7 +235,7 @@ public void OnNewResult(DrawableCatchHitObject drawableObject, JudgementResult r double positionDifference = target.EffectiveX - X; 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 SetHyperDashState();