1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Fix off-by-ones in RepeatPoint code

This commit is contained in:
smoogipoo 2018-01-23 13:58:43 +09:00
parent d37844c068
commit 33c52ba30f
4 changed files with 12 additions and 12 deletions

View File

@ -72,6 +72,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
public void UpdateSnakingPosition(Vector2 start, Vector2 end) => Position = repeatPoint.RepeatIndex % 2 == 1 ? end : start;
public void UpdateSnakingPosition(Vector2 start, Vector2 end) => Position = repeatPoint.RepeatIndex % 2 == 0 ? end : start;
}
}

View File

@ -73,12 +73,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddNested(InitialCircle);
var repeatDuration = s.Curve.Distance / s.Velocity;
var spanDuration = s.Curve.Distance / s.Velocity;
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
{
var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration;
var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = repeatStartTime + repeatDuration;
var spanStartTime = s.StartTime + tick.SpanIndex * spanDuration;
var fadeInTime = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = spanStartTime + spanDuration;
var drawableTick = new DrawableSliderTick(tick)
{
@ -93,9 +93,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var repeatPoint in s.NestedHitObjects.OfType<RepeatPoint>())
{
var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration;
var repeatStartTime = s.StartTime + (repeatPoint.RepeatIndex + 1) * spanDuration;
var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = repeatStartTime + repeatDuration;
var fadeOutTime = repeatStartTime + spanDuration;
var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
{

View File

@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Objects
AddNested(new SliderTick
{
RepeatIndex = span,
SpanIndex = span,
StartTime = spanStartTime + timeProgress * spanDuration,
Position = Curve.PositionAt(distanceProgress),
StackHeight = StackHeight,
@ -148,19 +148,19 @@ namespace osu.Game.Rulesets.Osu.Objects
{
var repeatDuration = Distance / Velocity;
for (var repeat = 1; repeat <= RepeatCount; repeat++)
for (int repeatIndex = 0, repeat = 1; repeatIndex < RepeatCount; repeatIndex++, repeat++)
{
var repeatStartTime = StartTime + repeat * repeatDuration;
AddNested(new RepeatPoint
{
RepeatIndex = repeat,
RepeatIndex = repeatIndex,
StartTime = repeatStartTime,
Position = Curve.PositionAt(repeat % 2),
StackHeight = StackHeight,
Scale = Scale,
ComboColour = ComboColour,
Samples = new List<SampleInfo>(RepeatSamples[repeat])
Samples = new List<SampleInfo>(RepeatSamples[repeatIndex])
});
}
}

View File

@ -5,6 +5,6 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderTick : OsuHitObject
{
public int RepeatIndex { get; set; }
public int SpanIndex { get; set; }
}
}