mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 08:22:56 +08:00
Fix off-by-ones in RepeatPoint code
This commit is contained in:
parent
d37844c068
commit
33c52ba30f
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,12 +73,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
AddNested(InitialCircle);
|
AddNested(InitialCircle);
|
||||||
|
|
||||||
var repeatDuration = s.Curve.Distance / s.Velocity;
|
var spanDuration = s.Curve.Distance / s.Velocity;
|
||||||
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
|
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
|
||||||
{
|
{
|
||||||
var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration;
|
var spanStartTime = s.StartTime + tick.SpanIndex * spanDuration;
|
||||||
var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
|
var fadeInTime = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
|
||||||
var fadeOutTime = repeatStartTime + repeatDuration;
|
var fadeOutTime = spanStartTime + spanDuration;
|
||||||
|
|
||||||
var drawableTick = new DrawableSliderTick(tick)
|
var drawableTick = new DrawableSliderTick(tick)
|
||||||
{
|
{
|
||||||
@ -93,9 +93,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
foreach (var repeatPoint in s.NestedHitObjects.OfType<RepeatPoint>())
|
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 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)
|
var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
AddNested(new SliderTick
|
AddNested(new SliderTick
|
||||||
{
|
{
|
||||||
RepeatIndex = span,
|
SpanIndex = span,
|
||||||
StartTime = spanStartTime + timeProgress * spanDuration,
|
StartTime = spanStartTime + timeProgress * spanDuration,
|
||||||
Position = Curve.PositionAt(distanceProgress),
|
Position = Curve.PositionAt(distanceProgress),
|
||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
@ -148,19 +148,19 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
var repeatDuration = Distance / Velocity;
|
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;
|
var repeatStartTime = StartTime + repeat * repeatDuration;
|
||||||
|
|
||||||
AddNested(new RepeatPoint
|
AddNested(new RepeatPoint
|
||||||
{
|
{
|
||||||
RepeatIndex = repeat,
|
RepeatIndex = repeatIndex,
|
||||||
StartTime = repeatStartTime,
|
StartTime = repeatStartTime,
|
||||||
Position = Curve.PositionAt(repeat % 2),
|
Position = Curve.PositionAt(repeat % 2),
|
||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
Scale = Scale,
|
Scale = Scale,
|
||||||
ComboColour = ComboColour,
|
ComboColour = ComboColour,
|
||||||
Samples = new List<SampleInfo>(RepeatSamples[repeat])
|
Samples = new List<SampleInfo>(RepeatSamples[repeatIndex])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class SliderTick : OsuHitObject
|
public class SliderTick : OsuHitObject
|
||||||
{
|
{
|
||||||
public int RepeatIndex { get; set; }
|
public int SpanIndex { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user