Merge pull request #587 from smoogipooo/fix_slider_velocities

Fix slider velocities
This commit is contained in:
Dean Herbert 2017-04-03 15:13:37 +09:00 committed by GitHub
commit c005cf82c1
4 changed files with 26 additions and 56 deletions

View File

@ -14,6 +14,11 @@ namespace osu.Game.Modes.Osu.Objects
{
public class Slider : OsuHitObject, IHasCurve
{
/// <summary>
/// Scoring distance with a speed-adjusted beat length of 1 second.
/// </summary>
private const float base_scoring_distance = 100;
public IHasCurve CurveObject { get; set; }
public SliderCurve Curve => CurveObject.Curve;
@ -51,13 +56,10 @@ namespace osu.Game.Modes.Osu.Objects
{
base.ApplyDefaults(timing, difficulty);
ControlPoint overridePoint;
ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint);
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
var baseVelocity = 100 * difficulty.SliderMultiplier / velocityAdjustment;
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / timing.SpeedMultiplierAt(StartTime);
Velocity = baseVelocity / timingPoint.BeatLength;
TickDistance = baseVelocity / difficulty.SliderTickRate;
Velocity = scoringDistance / timing.BeatLengthAt(StartTime);
TickDistance = scoringDistance / difficulty.SliderTickRate;
}
public IEnumerable<SliderTick> Ticks

View File

@ -13,6 +13,11 @@ namespace osu.Game.Modes.Taiko.Objects
{
public class DrumRoll : TaikoHitObject, IHasDistance
{
/// <summary>
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
/// </summary>
private const float base_distance = 100;
public double EndTime => StartTime + Distance / Velocity;
public double Duration => EndTime - StartTime;
@ -59,7 +64,7 @@ namespace osu.Game.Modes.Taiko.Objects
{
base.ApplyDefaults(timing, difficulty);
Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000;
Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime);
TickTimeDistance = timing.BeatLengthAt(StartTime);
//TODO: move this to legacy conversion code to allow for direct division without special case.

View File

@ -14,6 +14,11 @@ namespace osu.Game.Modes.Taiko.Objects
/// </summary>
public const float CIRCLE_RADIUS = 42f;
/// <summary>
/// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second.
/// </summary>
private const double base_scroll_time = 6000;
/// <summary>
/// The time to scroll in the HitObject.
/// </summary>
@ -34,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects
{
base.ApplyDefaults(timing, difficulty);
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;
PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000;
ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;

View File

@ -20,11 +20,11 @@ namespace osu.Game.Beatmaps.Timing
}
/// <summary>
/// Finds the BPM multiplier at a time.
/// Finds the speed multiplier at a time.
/// </summary>
/// <param name="time">The time to find the BPM multiplier at.</param>
/// <returns>The BPM multiplier.</returns>
public double BPMMultiplierAt(double time)
/// <param name="time">The time to find the speed multiplier at.</param>
/// <returns>The speed multiplier.</returns>
public double SpeedMultiplierAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps.Timing
}
/// <summary>
/// Finds the beat length at a time.
/// Finds the beat length at a time. This is expressed in milliseconds.
/// </summary>
/// <param name="time">The time to find the beat length at.</param>
/// <returns>The beat length in milliseconds.</returns>
/// <returns>The beat length.</returns>
public double BeatLengthAt(double time)
{
ControlPoint overridePoint;
@ -45,32 +45,6 @@ namespace osu.Game.Beatmaps.Timing
return timingPoint.BeatLength;
}
/// <summary>
/// Finds the beat velocity at a time.
/// </summary>
/// <param name="time">The time to find the velocity at.</param>
/// <returns>The velocity.</returns>
public double BeatVelocityAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1;
}
/// <summary>
/// Finds the beat length at a time.
/// </summary>
/// <param name="time">The time to find the beat length at.</param>
/// <returns>The beat length in positional length units.</returns>
public double BeatDistanceAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
return (timingPoint?.BeatLength ?? 1) * (overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1);
}
/// <summary>
/// Finds the timing point at a time.
/// </summary>
@ -102,21 +76,5 @@ namespace osu.Game.Beatmaps.Timing
return timingPoint ?? ControlPoint.Default;
}
/// <summary>
/// Finds the slider velocity at a time.
/// </summary>
/// <param name="time">The time to find the slider velocity at.</param>
/// <returns>The slider velocity in milliseconds.</returns>
public double SliderVelocityAt(double time)
{
const double base_scoring_distance = 100;
double beatDistance = BeatDistanceAt(time);
if (beatDistance > 0)
return base_scoring_distance / beatDistance * 1000;
return base_scoring_distance;
}
}
}