mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Add legacy slider offsets
This commit is contained in:
parent
0f123734f5
commit
80501de4b9
@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
var positionData = obj as IHasXPosition;
|
||||
var comboData = obj as IHasCombo;
|
||||
var endTime = obj as IHasEndTime;
|
||||
var legacyOffset = obj as IHasLegacyLastTickOffset;
|
||||
|
||||
if (curveData != null)
|
||||
{
|
||||
@ -39,7 +40,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
RepeatSamples = curveData.RepeatSamples,
|
||||
RepeatCount = curveData.RepeatCount,
|
||||
X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH,
|
||||
NewCombo = comboData?.NewCombo ?? false
|
||||
NewCombo = comboData?.NewCombo ?? false,
|
||||
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset ?? 0
|
||||
};
|
||||
}
|
||||
else if (endTime != null)
|
||||
|
@ -77,6 +77,13 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
|
||||
double time = spanStartTime + timeProgress * spanDuration;
|
||||
|
||||
if (LegacyLastTickOffset != null)
|
||||
{
|
||||
// If we're the last tick, apply the legacy offset
|
||||
if (span == this.SpanCount() - 1 && d + tickDistance > length)
|
||||
time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value);
|
||||
}
|
||||
|
||||
double tinyTickInterval = time - lastDropletTime;
|
||||
while (tinyTickInterval > 100)
|
||||
tinyTickInterval /= 2;
|
||||
@ -152,5 +159,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
get { return Curve.CurveType; }
|
||||
set { Curve.CurveType = value; }
|
||||
}
|
||||
|
||||
public double? LegacyLastTickOffset { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
var endTimeData = original as IHasEndTime;
|
||||
var positionData = original as IHasPosition;
|
||||
var comboData = original as IHasCombo;
|
||||
var legacyOffset = original as IHasLegacyLastTickOffset;
|
||||
|
||||
if (curveData != null)
|
||||
{
|
||||
@ -40,7 +41,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
RepeatSamples = curveData.RepeatSamples,
|
||||
RepeatCount = curveData.RepeatCount,
|
||||
Position = positionData?.Position ?? Vector2.Zero,
|
||||
NewCombo = comboData?.NewCombo ?? false
|
||||
NewCombo = comboData?.NewCombo ?? false,
|
||||
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset
|
||||
};
|
||||
}
|
||||
else if (endTimeData != null)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System.Collections.Generic;
|
||||
@ -45,6 +46,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
set { Curve.Distance = value; }
|
||||
}
|
||||
|
||||
public double? LegacyLastTickOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The position of the cursor at the point of completion of this <see cref="Slider"/> if it was hit
|
||||
/// with as few movements as possible. This is set and used by difficulty calculation.
|
||||
@ -91,6 +94,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
createSliderEnds();
|
||||
createTicks();
|
||||
createRepeatPoints();
|
||||
|
||||
if (LegacyLastTickOffset != null)
|
||||
{
|
||||
var lastObject = NestedHitObjects.Last();
|
||||
if (!(lastObject is SliderCircle))
|
||||
lastObject.StartTime = Math.Max(StartTime + Duration / 2, lastObject.StartTime - LegacyLastTickOffset.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void createSliderEnds()
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Beatmaps.ControlPoints;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
internal abstract class ConvertSlider : HitObject, IHasCurve
|
||||
internal abstract class ConvertSlider : HitObject, IHasCurve, IHasLegacyLastTickOffset
|
||||
{
|
||||
/// <summary>
|
||||
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
||||
@ -45,5 +45,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
|
||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||
}
|
||||
|
||||
public double LegacyLastTickOffset => 36;
|
||||
}
|
||||
}
|
||||
|
14
osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs
Normal file
14
osu.Game/Rulesets/Objects/Types/IHasLegacyLastTickOffset.cs
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of <see cref="HitObject"/> which may require the last tick to be offset.
|
||||
/// This is specific to osu!stable conversion, and should not be used elsewhere.
|
||||
/// </summary>
|
||||
public interface IHasLegacyLastTickOffset
|
||||
{
|
||||
double LegacyLastTickOffset { get; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user