mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 01:47:24 +08:00
Merge pull request #4298 from smoogipoo/fix-catch-diffcalc-position
Fix position not being set for the first hitobject
This commit is contained in:
commit
850a84b506
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
|
||||
|
||||
[TestCase(3.8701854263563118d, "diffcalc-test")]
|
||||
[TestCase(3.8701758020428221d, "diffcalc-test")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
||||
public new CatchHitObject LastObject => (CatchHitObject)base.LastObject;
|
||||
|
||||
public readonly float NormalizedPosition;
|
||||
public readonly float LastNormalizedPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Milliseconds elapsed since the start time of the previous <see cref="CatchDifficultyHitObject"/>, with a minimum of 25ms.
|
||||
@ -31,6 +32,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
||||
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||
|
||||
NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
||||
LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
||||
|
||||
// Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure
|
||||
StrainTime = Math.Max(25, DeltaTime);
|
||||
|
@ -21,20 +21,23 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills
|
||||
|
||||
protected override double DecayWeight => 0.94;
|
||||
|
||||
private float lastPlayerPosition;
|
||||
private float? lastPlayerPosition;
|
||||
private float lastDistanceMoved;
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
var catchCurrent = (CatchDifficultyHitObject)current;
|
||||
|
||||
if (lastPlayerPosition == null)
|
||||
lastPlayerPosition = catchCurrent.LastNormalizedPosition;
|
||||
|
||||
float playerPosition = MathHelper.Clamp(
|
||||
lastPlayerPosition,
|
||||
lastPlayerPosition.Value,
|
||||
catchCurrent.NormalizedPosition - (normalized_hitobject_radius - absolute_player_positioning_error),
|
||||
catchCurrent.NormalizedPosition + (normalized_hitobject_radius - absolute_player_positioning_error)
|
||||
);
|
||||
|
||||
float distanceMoved = playerPosition - lastPlayerPosition;
|
||||
float distanceMoved = playerPosition - lastPlayerPosition.Value;
|
||||
|
||||
double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500;
|
||||
double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime);
|
||||
|
Loading…
Reference in New Issue
Block a user