From eaa171baf47fbc82ef77c44135aa9042091bd581 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 17 Apr 2017 20:02:36 +0900 Subject: [PATCH 1/3] Rewrite bar lines to make sure they're centered at their beat's start position. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 64 +++++++-------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 32476dff7f..a7968a10dd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.MathUtils; using osu.Framework.Graphics; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Timing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Replays; @@ -49,55 +47,37 @@ namespace osu.Game.Modes.Taiko.UI if (timingPoints.Count == 0) return; - int currentIndex = 0; - - while (currentIndex < timingPoints.Count && Precision.AlmostEquals(timingPoints[currentIndex].BeatLength, 0)) - currentIndex++; - - double time = timingPoints[currentIndex].Time; - double measureLength = timingPoints[currentIndex].BeatLength * (int)timingPoints[currentIndex].TimeSignature; - - // Find the bar line time closest to 0 - time -= measureLength * (int)(time / measureLength); - - // Always start barlines from a positive time - while (time < 0) - time += measureLength; - + int currentTimingPoint = 0; int currentBeat = 0; + double time = timingPoints[currentTimingPoint].Time; while (time <= lastHitTime) - { - ControlPoint current = timingPoints[currentIndex]; - - if (time > current.Time || current.OmitFirstBarLine) + { + int nextTimingPoint = currentTimingPoint + 1; + if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) { - bool isMajor = currentBeat % (int)current.TimeSignature == 0; - - var barLine = new BarLine - { - StartTime = time, - }; - - barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); - - taikoPlayfield.AddBarLine(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); - - currentBeat++; + currentTimingPoint = nextTimingPoint; + time = timingPoints[currentTimingPoint].Time; + currentBeat = 0; } - double bl = current.BeatLength; + var currentPoint = timingPoints[currentTimingPoint]; + var barLine = new BarLine + { + StartTime = time, + }; + + barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); + + bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0; + taikoPlayfield.AddBarLine(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); + + double bl = currentPoint.BeatLength; if (bl < 800) - bl *= (int)current.TimeSignature; + bl *= (int)currentPoint.TimeSignature; time += bl; - - if (currentIndex + 1 >= timingPoints.Count || time < timingPoints[currentIndex + 1].Time) - continue; - - currentBeat = 0; - currentIndex++; - time = timingPoints[currentIndex].Time; + currentBeat++; } } From 4895a482b4231f76eca622eae8ef7a1a0ccb185a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 17:26:59 +0900 Subject: [PATCH 2/3] That's a lot of white spaces --- osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index f4336717d9..baa54ca71b 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Taiko.UI int currentBeat = 0; double time = timingPoints[currentTimingPoint].Time; while (time <= lastHitTime) - { + { int nextTimingPoint = currentTimingPoint + 1; if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) { From d4e75ecec41146d0e5f7271d82ba360b9c52a803 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 18 Apr 2017 17:37:01 +0900 Subject: [PATCH 3/3] Rename to use -index. --- osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index baa54ca71b..db15193ce5 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -48,20 +48,20 @@ namespace osu.Game.Rulesets.Taiko.UI if (timingPoints.Count == 0) return; - int currentTimingPoint = 0; + int currentIndex = 0; int currentBeat = 0; - double time = timingPoints[currentTimingPoint].Time; + double time = timingPoints[currentIndex].Time; while (time <= lastHitTime) { - int nextTimingPoint = currentTimingPoint + 1; - if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) + int nextIndex = currentIndex + 1; + if (nextIndex < timingPoints.Count && time > timingPoints[nextIndex].Time) { - currentTimingPoint = nextTimingPoint; - time = timingPoints[currentTimingPoint].Time; + currentIndex = nextIndex; + time = timingPoints[currentIndex].Time; currentBeat = 0; } - var currentPoint = timingPoints[currentTimingPoint]; + var currentPoint = timingPoints[currentIndex]; var barLine = new BarLine {