mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
made the SampleControlPoint and DifficultyControlPoint obsolete
This commit is contained in:
parent
36113f60b7
commit
a4c6850ab2
@ -49,15 +49,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
Debug.Assert(distanceData != null);
|
Debug.Assert(distanceData != null);
|
||||||
|
|
||||||
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
|
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
|
||||||
DifficultyControlPoint difficultyPoint = hitObject.DifficultyControlPoint;
|
|
||||||
|
|
||||||
double beatLength;
|
double beatLength;
|
||||||
#pragma warning disable 618
|
if (hitObject.LegacyBpmMultiplier.HasValue)
|
||||||
if (difficultyPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyPoint)
|
beatLength = timingPoint.BeatLength * hitObject.LegacyBpmMultiplier.Value;
|
||||||
#pragma warning restore 618
|
else if (hitObject is IHasSliderVelocity hasSliderVelocity)
|
||||||
beatLength = timingPoint.BeatLength * legacyDifficultyPoint.BpmMultiplier;
|
beatLength = timingPoint.BeatLength / hasSliderVelocity.SliderVelocity;
|
||||||
else
|
else
|
||||||
beatLength = timingPoint.BeatLength / difficultyPoint.SliderVelocity;
|
beatLength = timingPoint.BeatLength;
|
||||||
|
|
||||||
SpanCount = repeatsData?.SpanCount() ?? 1;
|
SpanCount = repeatsData?.SpanCount() ?? 1;
|
||||||
StartTime = (int)Math.Round(hitObject.StartTime);
|
StartTime = (int)Math.Round(hitObject.StartTime);
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Caching;
|
using osu.Framework.Caching;
|
||||||
@ -15,13 +16,14 @@ using osu.Game.Audio;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
public class Slider : OsuHitObject, IHasPathWithRepeats
|
public class Slider : OsuHitObject, IHasPathWithRepeats, IHasSliderVelocity
|
||||||
{
|
{
|
||||||
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
||||||
|
|
||||||
@ -134,6 +136,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool OnlyJudgeNestedObjects = true;
|
public bool OnlyJudgeNestedObjects = true;
|
||||||
|
|
||||||
|
public double SliderVelocity { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to generate ticks on this <see cref="Slider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public bool GenerateTicks = true;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SliderHeadCircle HeadCircle { get; protected set; }
|
public SliderHeadCircle HeadCircle { get; protected set; }
|
||||||
|
|
||||||
@ -151,15 +160,24 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
||||||
#pragma warning disable 618
|
|
||||||
var legacyDifficultyPoint = DifficultyControlPoint as LegacyBeatmapDecoder.LegacyDifficultyControlPoint;
|
|
||||||
#pragma warning restore 618
|
|
||||||
|
|
||||||
double scoringDistance = BASE_SCORING_DISTANCE * difficulty.SliderMultiplier * DifficultyControlPoint.SliderVelocity;
|
double scoringDistance = BASE_SCORING_DISTANCE * difficulty.SliderMultiplier * SliderVelocity;
|
||||||
bool generateTicks = legacyDifficultyPoint?.GenerateTicks ?? true;
|
|
||||||
|
|
||||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||||
TickDistance = generateTicks ? (scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier) : double.PositiveInfinity;
|
TickDistance = GenerateTicks ? (scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier) : double.PositiveInfinity;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ApplyLegacyInfoToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyLegacyInfoToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
|
DifficultyControlPoint difficultyControlPoint = controlPointInfo is LegacyControlPointInfo legacyInfo ? legacyInfo.DifficultyPointAt(StartTime) : DifficultyControlPoint.DEFAULT;
|
||||||
|
#pragma warning disable 618
|
||||||
|
var legacyDifficultyPoint = difficultyControlPoint as LegacyBeatmapDecoder.LegacyDifficultyControlPoint;
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
|
SliderVelocity = difficultyControlPoint.SliderVelocity;
|
||||||
|
GenerateTicks = legacyDifficultyPoint?.GenerateTicks ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
|
@ -177,15 +177,14 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
|||||||
double distance = distanceData.Distance * spans * LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
|
double distance = distanceData.Distance * spans * LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
|
||||||
|
|
||||||
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime);
|
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime);
|
||||||
DifficultyControlPoint difficultyPoint = obj.DifficultyControlPoint;
|
|
||||||
|
|
||||||
double beatLength;
|
double beatLength;
|
||||||
#pragma warning disable 618
|
if (obj.LegacyBpmMultiplier.HasValue)
|
||||||
if (difficultyPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyPoint)
|
beatLength = timingPoint.BeatLength * obj.LegacyBpmMultiplier.Value;
|
||||||
#pragma warning restore 618
|
else if (obj is IHasSliderVelocity hasSliderVelocity)
|
||||||
beatLength = timingPoint.BeatLength * legacyDifficultyPoint.BpmMultiplier;
|
beatLength = timingPoint.BeatLength / hasSliderVelocity.SliderVelocity;
|
||||||
else
|
else
|
||||||
beatLength = timingPoint.BeatLength / difficultyPoint.SliderVelocity;
|
beatLength = timingPoint.BeatLength;
|
||||||
|
|
||||||
double sliderScoringPointDistance = osu_base_scoring_distance * beatmap.Difficulty.SliderMultiplier / beatmap.Difficulty.SliderTickRate;
|
double sliderScoringPointDistance = osu_base_scoring_distance * beatmap.Difficulty.SliderMultiplier / beatmap.Difficulty.SliderTickRate;
|
||||||
|
|
||||||
|
@ -85,8 +85,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
this.beatmap.HitObjects = this.beatmap.HitObjects.OrderBy(h => h.StartTime).ToList();
|
this.beatmap.HitObjects = this.beatmap.HitObjects.OrderBy(h => h.StartTime).ToList();
|
||||||
|
|
||||||
foreach (var hitObject in this.beatmap.HitObjects)
|
foreach (var hitObject in this.beatmap.HitObjects)
|
||||||
|
{
|
||||||
|
hitObject.ApplyLegacyInfo(this.beatmap.ControlPointInfo, this.beatmap.Difficulty);
|
||||||
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.Difficulty);
|
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.Difficulty);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Some `BeatmapInfo` members have default values that differ from the default values used by stable.
|
/// Some `BeatmapInfo` members have default values that differ from the default values used by stable.
|
||||||
|
@ -16,6 +16,7 @@ using osu.Framework.Lists;
|
|||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
@ -80,6 +81,12 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
public SampleControlPoint SampleControlPoint = SampleControlPoint.DEFAULT;
|
public SampleControlPoint SampleControlPoint = SampleControlPoint.DEFAULT;
|
||||||
public DifficultyControlPoint DifficultyControlPoint = DifficultyControlPoint.DEFAULT;
|
public DifficultyControlPoint DifficultyControlPoint = DifficultyControlPoint.DEFAULT;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it.
|
||||||
|
/// DO NOT USE THIS UNLESS 100% SURE.
|
||||||
|
/// </summary>
|
||||||
|
public double? LegacyBpmMultiplier { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this <see cref="HitObject"/> is in Kiai time.
|
/// Whether this <see cref="HitObject"/> is in Kiai time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,25 +112,6 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
public void ApplyDefaults(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty, CancellationToken cancellationToken = default)
|
public void ApplyDefaults(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var legacyInfo = controlPointInfo as LegacyControlPointInfo;
|
|
||||||
|
|
||||||
if (legacyInfo != null)
|
|
||||||
DifficultyControlPoint = (DifficultyControlPoint)legacyInfo.DifficultyPointAt(StartTime).DeepClone();
|
|
||||||
else if (ReferenceEquals(DifficultyControlPoint, DifficultyControlPoint.DEFAULT))
|
|
||||||
DifficultyControlPoint = new DifficultyControlPoint();
|
|
||||||
|
|
||||||
DifficultyControlPoint.Time = StartTime;
|
|
||||||
|
|
||||||
ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
||||||
|
|
||||||
// This is done here after ApplyDefaultsToSelf as we may require custom defaults to be applied to have an accurate end time.
|
|
||||||
if (legacyInfo != null)
|
|
||||||
SampleControlPoint = (SampleControlPoint)legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency).DeepClone();
|
|
||||||
else if (ReferenceEquals(SampleControlPoint, SampleControlPoint.DEFAULT))
|
|
||||||
SampleControlPoint = new SampleControlPoint();
|
|
||||||
|
|
||||||
SampleControlPoint.Time = this.GetEndTime() + control_point_leniency;
|
|
||||||
|
|
||||||
nestedHitObjects.Clear();
|
nestedHitObjects.Clear();
|
||||||
|
|
||||||
CreateNestedHitObjects(cancellationToken);
|
CreateNestedHitObjects(cancellationToken);
|
||||||
@ -164,9 +152,6 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
foreach (var nested in nestedHitObjects)
|
foreach (var nested in nestedHitObjects)
|
||||||
nested.StartTime += offset;
|
nested.StartTime += offset;
|
||||||
|
|
||||||
DifficultyControlPoint.Time = time.NewValue;
|
|
||||||
SampleControlPoint.Time = this.GetEndTime() + control_point_leniency;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +163,38 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
HitWindows?.SetDifficulty(difficulty.OverallDifficulty);
|
HitWindows?.SetDifficulty(difficulty.OverallDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies legacy information to this HitObject.
|
||||||
|
/// This method gets called at the end of <see cref="LegacyBeatmapDecoder"/> before applying defaults.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controlPointInfo">The control points.</param>
|
||||||
|
/// <param name="difficulty">The difficulty settings to use.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
public void ApplyLegacyInfo(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var legacyInfo = controlPointInfo as LegacyControlPointInfo;
|
||||||
|
|
||||||
|
DifficultyControlPoint difficultyControlPoint = legacyInfo != null ? legacyInfo.DifficultyPointAt(StartTime) : DifficultyControlPoint.DEFAULT;
|
||||||
|
#pragma warning disable 618
|
||||||
|
if (difficultyControlPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyControlPoint)
|
||||||
|
#pragma warning restore 618
|
||||||
|
LegacyBpmMultiplier = legacyDifficultyControlPoint.BpmMultiplier;
|
||||||
|
|
||||||
|
ApplyLegacyInfoToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
|
// This is done here after ApplyLegacyInfoToSelf as we may require custom defaults to be applied to have an accurate end time.
|
||||||
|
SampleControlPoint sampleControlPoint = legacyInfo != null ? legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency) : SampleControlPoint.DEFAULT;
|
||||||
|
|
||||||
|
foreach (var hitSampleInfo in Samples)
|
||||||
|
{
|
||||||
|
sampleControlPoint.ApplyTo(hitSampleInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ApplyLegacyInfoToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void CreateNestedHitObjects(CancellationToken cancellationToken)
|
protected virtual void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,11 @@ using Newtonsoft.Json;
|
|||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Beatmaps.Legacy;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasLegacyLastTickOffset
|
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasLegacyLastTickOffset, IHasSliderVelocity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
||||||
@ -40,17 +41,27 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
|
|
||||||
public double Velocity = 1;
|
public double Velocity = 1;
|
||||||
|
|
||||||
|
public double SliderVelocity { get; set; } = 1;
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
||||||
|
|
||||||
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * DifficultyControlPoint.SliderVelocity;
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * SliderVelocity;
|
||||||
|
|
||||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ApplyLegacyInfoToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyLegacyInfoToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
|
DifficultyControlPoint difficultyControlPoint = controlPointInfo is LegacyControlPointInfo legacyInfo ? legacyInfo.DifficultyPointAt(StartTime) : DifficultyControlPoint.DEFAULT;
|
||||||
|
SliderVelocity = difficultyControlPoint.SliderVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
public double LegacyLastTickOffset => 36;
|
public double LegacyLastTickOffset => 36;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
osu.Game/Rulesets/Objects/Types/IHasSliderVelocity.cs
Normal file
15
osu.Game/Rulesets/Objects/Types/IHasSliderVelocity.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A HitObject that has a slider velocity multiplier.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasSliderVelocity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The slider velocity multiplier.
|
||||||
|
/// </summary>
|
||||||
|
double SliderVelocity { get; set; }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user