update SliderTick calculation + more ticks in tests

math is hard >_<
This commit is contained in:
Aergwyn 2018-01-29 12:03:22 +01:00
parent 8425f3ee93
commit 373b3871f9
3 changed files with 16 additions and 5 deletions

View File

@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Osu.Objects
AddNested(new SliderTick AddNested(new SliderTick
{ {
SpanIndex = span, SpanIndex = span,
SliderStartTime = StartTime, SpanStartTime = spanStartTime,
StartTime = spanStartTime + timeProgress * SpanDuration, StartTime = spanStartTime + timeProgress * SpanDuration,
Position = Curve.PositionAt(distanceProgress), Position = Curve.PositionAt(distanceProgress),
StackHeight = StackHeight, StackHeight = StackHeight,

View File

@ -9,14 +9,22 @@ namespace osu.Game.Rulesets.Osu.Objects
public class SliderTick : OsuHitObject public class SliderTick : OsuHitObject
{ {
public int SpanIndex { get; set; } public int SpanIndex { get; set; }
public double SliderStartTime { get; set; } public double SpanStartTime { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{ {
base.ApplyDefaultsToSelf(controlPointInfo, difficulty); base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
// SliderTicks appear earlier and earlier going further into a Slider. double offset;
TimePreempt = StartTime - ((StartTime - SliderStartTime) / 2 + SliderStartTime - TimeFadein * 0.66f);
if (SpanIndex > 0)
// Adding 200 to include the offset stable used.
// This is so on repeats ticks don't appear too late to be visually processed by the player.
offset = 200;
else
offset = TimeFadein * 0.66f;
TimePreempt = (StartTime - SpanStartTime) / 2 + offset;
} }
} }
} }

View File

@ -17,6 +17,7 @@ using OpenTK.Graphics;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using System.Linq; using System.Linq;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Osu.Tests namespace osu.Game.Rulesets.Osu.Tests
{ {
@ -27,7 +28,9 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
typeof(SliderBall), typeof(SliderBall),
typeof(SliderBody), typeof(SliderBody),
typeof(SliderTick),
typeof(DrawableSlider), typeof(DrawableSlider),
typeof(DrawableSliderTick),
typeof(DrawableRepeatPoint), typeof(DrawableRepeatPoint),
typeof(DrawableOsuHitObject) typeof(DrawableOsuHitObject)
}; };
@ -131,7 +134,7 @@ namespace osu.Game.Rulesets.Osu.Tests
var cpi = new ControlPointInfo(); var cpi = new ControlPointInfo();
cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier });
slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize }); slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize, SliderTickRate = 3 });
var drawable = new DrawableSlider(slider) var drawable = new DrawableSlider(slider)
{ {