1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Fix hitobject lengths not being calculated for overlapping speed changes

Fixes #2359
This commit is contained in:
smoogipoo 2018-04-16 20:18:33 +09:00
parent af154e66a2
commit ea0683adb2

View File

@ -4,6 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Lists; using osu.Framework.Lists;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
using OpenTK; using OpenTK;
@ -22,8 +23,24 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
foreach (var obj in hitObjects) foreach (var obj in hitObjects)
{ {
var controlPoint = controlPointAt(obj.HitObject.StartTime); obj.LifetimeStart = obj.HitObject.StartTime - timeRange / controlPointAt(obj.HitObject.StartTime).Multiplier;
obj.LifetimeStart = obj.HitObject.StartTime - timeRange / controlPoint.Multiplier;
if (obj.HitObject is IHasEndTime endTime)
{
var diff = -positionAt(endTime.EndTime, obj, timeRange);
switch (direction)
{
case ScrollingDirection.Up:
case ScrollingDirection.Down:
obj.Height = (float)(diff * length.Y);
break;
case ScrollingDirection.Left:
case ScrollingDirection.Right:
obj.Width = (float)(diff * length.X);
break;
}
}
if (obj.HasNestedHitObjects) if (obj.HasNestedHitObjects)
{ {
@ -37,9 +54,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
{ {
foreach (var obj in hitObjects) foreach (var obj in hitObjects)
{ {
var controlPoint = controlPointAt(obj.HitObject.StartTime); var position = positionAt(currentTime, obj, timeRange);
var position = (obj.HitObject.StartTime - currentTime) * controlPoint.Multiplier / timeRange;
switch (direction) switch (direction)
{ {
@ -59,6 +74,9 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers
} }
} }
private double positionAt(double time, DrawableHitObject obj, double timeRange)
=> (obj.HitObject.StartTime - time) * controlPointAt(obj.HitObject.StartTime).Multiplier / timeRange;
private readonly MultiplierControlPoint searchPoint = new MultiplierControlPoint(); private readonly MultiplierControlPoint searchPoint = new MultiplierControlPoint();
private MultiplierControlPoint controlPointAt(double time) private MultiplierControlPoint controlPointAt(double time)
{ {