From b9b45493e6f3f546f61c5d26034584d83265da03 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 17 May 2017 18:02:17 +0800 Subject: [PATCH 01/23] Use generic IComparable together with IEqutable for Message. --- osu.Game/Online/Chat/Channel.cs | 2 +- osu.Game/Online/Chat/Message.cs | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 2925c3ccb4..93fd0a8956 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -23,7 +23,7 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; - public readonly SortedList Messages = new SortedList((m1, m2) => m1.Id.CompareTo(m2.Id)); + public readonly SortedList Messages = new SortedList(Comparer.Default); //internal bool Joined; diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index bf53a68910..8c0cb043c4 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -8,7 +8,7 @@ using osu.Game.Users; namespace osu.Game.Online.Chat { - public class Message + public class Message : IComparable, IEquatable { [JsonProperty(@"message_id")] public readonly long Id; @@ -42,17 +42,9 @@ namespace osu.Game.Online.Chat Id = id; } - public override bool Equals(object obj) - { - var objMessage = obj as Message; + public int CompareTo(Message other) => Id.CompareTo(other.Id); - return Id == objMessage?.Id; - } - - public override int GetHashCode() - { - return Id.GetHashCode(); - } + public bool Equals(Message other) => Id == other.Id; } public enum TargetType From 6c9505fa3a053cc4fc607f366a30d1b94fe3600f Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 17 May 2017 18:11:38 +0800 Subject: [PATCH 02/23] Handle possible nulls. --- osu.Game/Online/Chat/Message.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 8c0cb043c4..ed76ef248e 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -44,7 +44,7 @@ namespace osu.Game.Online.Chat public int CompareTo(Message other) => Id.CompareTo(other.Id); - public bool Equals(Message other) => Id == other.Id; + public bool Equals(Message other) => Id == other?.Id; } public enum TargetType From b5d7211cd6471d58c9bcf6b78d49c9f5ce4e9a77 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 01:30:24 +0800 Subject: [PATCH 03/23] Expire placeholder text. --- osu.Game/Overlays/ChatOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 2836be22ae..c722d46ace 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -229,6 +229,7 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { loading.FadeOut(100); + loading.Expire(); addChannel(channels.Find(c => c.Name == @"#lazer")); addChannel(channels.Find(c => c.Name == @"#osu")); From e2b1fcc0887f2ff46c87058261d5c47a1e95c96c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 01:43:11 +0800 Subject: [PATCH 04/23] Use string.Join in GetMessagesRequest. --- osu.Game/Online/API/Requests/GetMessagesRequest.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index cf52f9ccd3..858015e29b 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; using osu.Framework.IO.Network; using osu.Game.Online.Chat; @@ -20,10 +21,7 @@ namespace osu.Game.Online.API.Requests protected override WebRequest CreateWebRequest() { - string channelString = string.Empty; - foreach (Channel c in channels) - channelString += c.Id + ","; - channelString = channelString.TrimEnd(','); + string channelString = string.Join(",", channels.Select(x => x.Id)); var req = base.CreateWebRequest(); req.AddParameter(@"channels", channelString); From 23e2d3ef07b2fd99749245c06ad94bd8d4763699 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 02:30:17 +0800 Subject: [PATCH 05/23] Use GroupBy in ChatOverlay. --- osu.Game/Overlays/ChatOverlay.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index c722d46ace..686a1d513a 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -321,11 +321,8 @@ namespace osu.Game.Overlays fetchReq = new GetMessagesRequest(careChannels, lastMessageId); fetchReq.Success += delegate (List messages) { - var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct(); - - //batch messages per channel. - foreach (var id in ids) - careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.TargetId == id).ToArray()); + foreach (var group in messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) + careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; From 88f8619e9a655f8ab29d14d3697f29793dcec58c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 02:46:12 +0800 Subject: [PATCH 06/23] More missed exceptions. --- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index 6c39ba40f9..2ff97047c0 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Timing var controlPoint = drawableControlPoints.LastOrDefault(t => t.CanContain(drawable)) ?? drawableControlPoints.FirstOrDefault(); if (controlPoint == null) - throw new Exception("Could not find suitable timing section to add object to."); + throw new InvalidOperationException("Could not find suitable timing section to add object to."); controlPoint.Add(drawable); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index 986aefb2bd..dccc18fa8b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.UI ControlPoint firstTimingChange = Beatmap.TimingInfo.ControlPoints.FirstOrDefault(t => t.TimingChange); if (firstTimingChange == null) - throw new Exception("The Beatmap contains no timing points!"); + throw new InvalidOperationException("The Beatmap contains no timing points!"); // Generate the timing points, making non-timing changes use the previous timing change var timingChanges = Beatmap.TimingInfo.ControlPoints.Select(c => diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 2f344e0bdf..7e3bb44465 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -288,7 +288,7 @@ namespace osu.Game.Online.API { APIRequest req; while (oldQueue.TryDequeue(out req)) - req.Fail(new Exception(@"Disconnected from server")); + req.Fail(new WebException(@"Disconnected from server")); } } From ffbab6bfeb55212cb1177b46b168621e551a3996 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 03:26:07 +0800 Subject: [PATCH 07/23] Tidy up DrawableChannel. --- osu.Game/Overlays/Chat/DrawableChannel.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 355aeed134..50c849f00e 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Chat public class DrawableChannel : Container { public readonly Channel Channel; - private readonly FillFlowContainer flow; + private readonly FillFlowContainer flow; private readonly ScrollContainer scroll; public DrawableChannel(Channel channel) @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - flow = new FillFlowContainer + flow = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, @@ -63,19 +63,18 @@ namespace osu.Game.Overlays.Chat var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY)); + //up to last Channel.MAX_HISTORY messages + flow.Add(displayMessages.Select(m => new ChatLine(m))); + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) scrollToEnd(); - //up to last Channel.MAX_HISTORY messages - foreach (Message m in displayMessages) - { - var d = new ChatLine(m); - flow.Add(d); - } + var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); + int count = staleMessages.Length - Channel.MAX_HISTORY; - while (flow.Children.Count(c => c.LifetimeEnd == double.MaxValue) > Channel.MAX_HISTORY) + for (int i = 0; i < count; i++) { - var d = flow.Children.First(c => c.LifetimeEnd == double.MaxValue); + var d = staleMessages[i]; if (!scroll.IsScrolledToEnd(10)) scroll.OffsetScrollPosition(-d.DrawHeight); d.Expire(); From cd065b8ff31ce97931cd6e560bf27763290fdccc Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 18 May 2017 05:27:20 +0800 Subject: [PATCH 08/23] Add back GetHashCode. --- osu.Game/Online/Chat/Message.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index ed76ef248e..4c7e099647 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -45,6 +45,8 @@ namespace osu.Game.Online.Chat public int CompareTo(Message other) => Id.CompareTo(other.Id); public bool Equals(Message other) => Id == other?.Id; + + public override int GetHashCode() => Id.GetHashCode(); } public enum TargetType From 2af025e630256e510c72070df391ea322971b087 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 18:09:13 +0900 Subject: [PATCH 09/23] Add IHasDistance object pattern generation. --- .../Legacy/DistanceObjectPatternGenerator.cs | 463 ++++++++++++++++++ .../osu.Game.Rulesets.Mania.csproj | 1 + 2 files changed, 464 insertions(+) create mode 100644 osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs new file mode 100644 index 0000000000..03240a2be4 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -0,0 +1,463 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +using osu.Game.Audio; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Mania.MathUtils; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; + +namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy +{ + /// + /// A pattern generator for IHasDistance hit objects. + /// + internal class DistanceObjectPatternGenerator : PatternGenerator + { + /// + /// Base osu! slider scoring distance. + /// + private const float osu_base_scoring_distance = 100; + + private readonly double endTime; + private readonly int repeatCount; + + private PatternType convertType; + + public DistanceObjectPatternGenerator(FastRandom random, HitObject hitObject, Beatmap beatmap, Pattern previousPattern) + : base(random, hitObject, beatmap, previousPattern) + { + ControlPoint overridePoint; + ControlPoint controlPoint = Beatmap.TimingInfo.TimingPointAt(hitObject.StartTime, out overridePoint); + + convertType = PatternType.None; + if ((overridePoint ?? controlPoint)?.KiaiMode == false) + convertType = PatternType.LowProbability; + + var distanceData = hitObject as IHasDistance; + var repeatsData = hitObject as IHasRepeats; + + repeatCount = repeatsData?.RepeatCount ?? 1; + + double speedAdjustment = beatmap.TimingInfo.SpeedMultiplierAt(hitObject.StartTime); + double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(hitObject.StartTime) * speedAdjustment; + + // The true distance, accounting for any repeats. This ends up being the drum roll distance later + double distance = distanceData.Distance * repeatCount; + + // The velocity of the osu! hit object - calculated as the velocity of a slider + double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength; + // The duration of the osu! hit object + double osuDuration = distance / osuVelocity; + + endTime = hitObject.StartTime + osuDuration; + } + + public override Pattern Generate() + { + double segmentDuration = endTime / repeatCount; + + if (repeatCount > 1) + { + if (segmentDuration <= 90) + return generateRandomHoldNotes(HitObject.StartTime, endTime, 1); + + if (segmentDuration <= 120) + { + convertType |= PatternType.ForceNotStack; + return generateRandomNotes(HitObject.StartTime, segmentDuration, repeatCount); + } + + if (segmentDuration <= 160) + return generateStair(HitObject.StartTime, segmentDuration); + + if (segmentDuration <= 200 && ConversionDifficulty > 3) + return generateRandomMultipleNotes(HitObject.StartTime, segmentDuration, repeatCount); + + double duration = endTime - HitObject.StartTime; + if (duration >= 4000) + return generateNRandomNotes(HitObject.StartTime, endTime, 0.23, 0, 0); + + if (segmentDuration > 400 && duration < 4000 && repeatCount < AvailableColumns - 1 - RandomStart) + return generateTiledHoldNotes(HitObject.StartTime, segmentDuration, repeatCount); + + return generateHoldAndNormalNotes(HitObject.StartTime, segmentDuration); + } + + if (segmentDuration <= 110) + { + if (PreviousPattern.ColumnsFilled < AvailableColumns) + convertType |= PatternType.ForceNotStack; + else + convertType &= ~PatternType.ForceNotStack; + return generateRandomNotes(HitObject.StartTime, segmentDuration, segmentDuration < 80 ? 0 : 1); + } + + if (ConversionDifficulty > 6.5) + { + if ((convertType & PatternType.LowProbability) > 0) + return generateNRandomNotes(HitObject.StartTime, endTime, 0.78, 0.3, 0); + return generateNRandomNotes(HitObject.StartTime, endTime, 0.85, 0.36, 0.03); + } + + if (ConversionDifficulty > 4) + { + if ((convertType & PatternType.LowProbability) > 0) + return generateNRandomNotes(HitObject.StartTime, endTime, 0.43, 0.08, 0); + return generateNRandomNotes(HitObject.StartTime, endTime, 0.56, 0.18, 0); + } + + if (ConversionDifficulty > 2.5) + { + if ((convertType & PatternType.LowProbability) > 0) + return generateNRandomNotes(HitObject.StartTime, endTime, 0.3, 0, 0); + return generateNRandomNotes(HitObject.StartTime, endTime, 0.37, 0.08, 0); + } + + if ((convertType & PatternType.LowProbability) > 0) + return generateNRandomNotes(HitObject.StartTime, endTime, 0.17, 0, 0); + return generateNRandomNotes(HitObject.StartTime, endTime, 0.27, 0, 0); + } + + /// + /// Generates random hold notes that start at an span the same amount of rows. + /// + /// Start time of each hold note. + /// End time of the hold notes. + /// Number of hold notes. + /// The containing the hit objects. + private Pattern generateRandomHoldNotes(double startTime, double endTime, int noteCount) + { + // - - - - + // ■ - ■ ■ + // □ - □ □ + // ■ - ■ ■ + + var pattern = new Pattern(); + + int usableColumns = AvailableColumns - RandomStart - PreviousPattern.ColumnsFilled; + int nextColumn = Random.Next(RandomStart, AvailableColumns); + for (int i = 0; i < Math.Min(usableColumns, noteCount); i++) + { + while (pattern.IsFilled(nextColumn) || PreviousPattern.IsFilled(nextColumn)) //find available column + nextColumn = Random.Next(RandomStart, AvailableColumns); + AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + } + + // This is can't be combined with the above loop due to RNG + for (int i = 0; i < noteCount - usableColumns; i++) + { + while (pattern.IsFilled(nextColumn)) + nextColumn = Random.Next(RandomStart, AvailableColumns); + AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + } + + return pattern; + } + + /// + /// Generates random notes, with one note per row and no stacking. + /// + /// The start time. + /// The separation of notes between rows. + /// The number of rows. + /// The containing the hit objects. + private Pattern generateRandomNotes(double startTime, double separationTime, int repeatCount) + { + // - - - - + // x - - - + // - - x - + // - - - x + // x - - - + + var pattern = new Pattern(); + + int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + { + while (PreviousPattern.IsFilled(nextColumn)) + nextColumn = Random.Next(RandomStart, AvailableColumns); + } + + int lastColumn = nextColumn; + for (int i = 0; i <= repeatCount; i++) + { + AddToPattern(pattern, HitObject, nextColumn, startTime, startTime); + while (nextColumn == lastColumn) + nextColumn = Random.Next(RandomStart, AvailableColumns); + + lastColumn = nextColumn; + startTime += separationTime; + } + + return pattern; + } + + /// + /// Generates a stair of notes, with one note per row. + /// + /// The start time. + /// The separation of notes between rows. + /// The containing the hit objects. + private Pattern generateStair(double startTime, double separationTime) + { + // - - - - + // x - - - + // - x - - + // - - x - + // - - - x + // - - x - + // - x - - + // x - - - + + var pattern = new Pattern(); + + int column = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); + bool increasing = Random.NextDouble() > 0.5; + + for (int i = 0; i <= repeatCount; i++) + { + AddToPattern(pattern, HitObject, column, startTime, startTime); + startTime += separationTime; + + // Check if we're at the borders of the stage, and invert the pattern if so + if (increasing) + { + if (column >= AvailableColumns - 1) + { + increasing = false; + column--; + } + else + column++; + } + else + { + if (column <= RandomStart) + { + increasing = true; + column++; + } + else + column--; + } + } + + return pattern; + } + + /// + /// Generates random notes with 1-2 notes per row and no stacking. + /// + /// The start time. + /// The separation of notes between rows. + /// The number of rows. + /// The containing the hit objects. + private Pattern generateRandomMultipleNotes(double startTime, double separationTime, int repeatCount) + { + // - - - - + // x - - + // - x x - + // - - - x + // x - x - + + var pattern = new Pattern(); + + bool legacy = AvailableColumns >= 4 && AvailableColumns <= 8; + int interval = Random.Next(1, AvailableColumns - (legacy ? 1 : 0)); + + int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); + for (int i = 0; i <= repeatCount; i++) + { + AddToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + + nextColumn += interval; + if (nextColumn >= AvailableColumns - RandomStart) + nextColumn = nextColumn - AvailableColumns - RandomStart + (legacy ? 1 : 0); + nextColumn += RandomStart; + + // If we're in 2K, let's not add many consecutive doubles + if (AvailableColumns > 2) + AddToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + + nextColumn = Random.Next(RandomStart, AvailableColumns); + startTime += separationTime; + } + + return pattern; + } + + /// + /// Generates random hold notes. The amount of hold notes generated is determined by probabilities. + /// + /// The hold note start time. + /// The hold note end time. + /// The probability required for 2 hold notes to be generated. + /// The probability required for 3 hold notes to be generated. + /// The probability required for 4 hold notes to be generated. + /// The containing the hit objects. + private Pattern generateNRandomNotes(double startTime, double endTime, double p2, double p3, double p4) + { + // - - - - + // ■ - ■ ■ + // □ - □ □ + // ■ - ■ ■ + + switch (AvailableColumns) + { + case 2: + p2 = 0; + p3 = 0; + p4 = 0; + break; + case 3: + p2 = Math.Max(p2, 0.1); + p3 = 0; + p4 = 0; + break; + case 4: + p2 = Math.Max(p2, 0.3); + p3 = Math.Max(p3, 0.04); + p4 = 0; + break; + case 5: + p2 = Math.Max(p2, 0.34); + p3 = Math.Max(p3, 0.1); + p4 = Math.Max(p4, 0.03); + break; + } + + Func isDoubleSample = sample => sample.Name == SampleInfo.HIT_CLAP && sample.Name == SampleInfo.HIT_FINISH; + + bool canGenerateTwoNotes = (convertType & PatternType.LowProbability) == 0; + canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); + + if (canGenerateTwoNotes) + p2 = 1; + + return generateRandomHoldNotes(startTime, endTime, GetRandomNoteCount(p2, p3, p4)); + } + + /// + /// Generates tiled hold notes. You can think of this as a stair of hold notes. + /// + /// The first hold note start time. + /// The separation time between hold notes. + /// The amount of hold notes. + /// The containing the hit objects. + private Pattern generateTiledHoldNotes(double startTime, double separationTime, int noteCount) + { + // - - - - + // ■ ■ ■ ■ + // □ □ □ □ + // □ □ □ □ + // □ □ □ ■ + // □ □ ■ - + // □ ■ - - + // ■ - - - + + var pattern = new Pattern(); + + int columnRepeat = Math.Min(noteCount, AvailableColumns); + + int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + { + while (PreviousPattern.IsFilled(nextColumn)) + nextColumn = Random.Next(RandomStart, AvailableColumns); + } + + for (int i = 0; i < columnRepeat; i++) + { + while (pattern.IsFilled(nextColumn)) + nextColumn = Random.Next(RandomStart, AvailableColumns); + + AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + startTime += separationTime; + } + + return pattern; + } + + /// + /// Generates a hold note alongside normal notes. + /// + /// The start time of notes. + /// The separation time between notes. + /// The containing the hit objects. + private Pattern generateHoldAndNormalNotes(double startTime, double separationTime) + { + // - - - - + // ■ x x - + // ■ - x x + // ■ x - x + // ■ - x x + + var pattern = new Pattern(); + + int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + { + while (PreviousPattern.IsFilled(holdColumn)) + holdColumn = Random.Next(RandomStart, AvailableColumns); + } + + // Create the hold note + AddToPattern(pattern, HitObject, holdColumn, startTime, separationTime * repeatCount); + + int noteCount = 1; + if (ConversionDifficulty > 6.5) + noteCount = GetRandomNoteCount(0.63, 0); + else if (ConversionDifficulty > 4) + noteCount = GetRandomNoteCount(AvailableColumns < 6 ? 0.12 : 0.45, 0); + else if (ConversionDifficulty > 2.5) + noteCount = GetRandomNoteCount(AvailableColumns < 6 ? 0 : 0.24, 0); + noteCount = Math.Min(AvailableColumns - 1, noteCount); + + bool ignoreHead = !sampleInfoListAt(startTime).Any(s => s.Name == SampleInfo.HIT_WHISTLE || s.Name == SampleInfo.HIT_FINISH || s.Name == SampleInfo.HIT_CLAP); + int nextColumn = Random.Next(RandomStart, AvailableColumns); + + var rowPattern = new Pattern(); + for (int i = 0; i <= repeatCount; i++) + { + if (!(ignoreHead && startTime == HitObject.StartTime)) + { + for (int j = 0; j < noteCount; j++) + { + while (rowPattern.IsFilled(nextColumn) || nextColumn == holdColumn) + nextColumn = Random.Next(RandomStart, AvailableColumns); + AddToPattern(rowPattern, HitObject, nextColumn, startTime, startTime, noteCount + 1); + } + } + + pattern.Add(rowPattern); + rowPattern.Clear(); + + startTime += separationTime; + } + + return pattern; + } + + /// + /// Retrieves the sample info list at a point in time. + /// + /// The time to retrieve the sample info list from. + /// + private SampleInfoList sampleInfoListAt(double time) + { + var curveData = HitObject as IHasCurve; + + if (curveData == null) + return HitObject.Samples; + + double segmentTime = (curveData.EndTime - HitObject.StartTime) / repeatCount; + + int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); + return curveData.RepeatSamples[index]; + } + } +} diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index ea65588a81..9de9cd703f 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -47,6 +47,7 @@ + From eae4f8b4127cb98a1717cd590ab4ac2dd2f83c4a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 18:11:09 +0900 Subject: [PATCH 10/23] Fix compilation due to previously-removed function. --- .../Legacy/DistanceObjectPatternGenerator.cs | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 03240a2be4..304a32a51b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -9,6 +9,7 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Mania.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { @@ -144,7 +145,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn) || PreviousPattern.IsFilled(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, AvailableColumns); - AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); } // This is can't be combined with the above loop due to RNG @@ -152,7 +153,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); } return pattern; @@ -185,7 +186,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int lastColumn = nextColumn; for (int i = 0; i <= repeatCount; i++) { - AddToPattern(pattern, HitObject, nextColumn, startTime, startTime); + addToPattern(pattern, HitObject, nextColumn, startTime, startTime); while (nextColumn == lastColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); @@ -220,7 +221,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy for (int i = 0; i <= repeatCount; i++) { - AddToPattern(pattern, HitObject, column, startTime, startTime); + addToPattern(pattern, HitObject, column, startTime, startTime); startTime += separationTime; // Check if we're at the borders of the stage, and invert the pattern if so @@ -272,7 +273,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); for (int i = 0; i <= repeatCount; i++) { - AddToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + addToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); nextColumn += interval; if (nextColumn >= AvailableColumns - RandomStart) @@ -281,7 +282,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // If we're in 2K, let's not add many consecutive doubles if (AvailableColumns > 2) - AddToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + addToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); nextColumn = Random.Next(RandomStart, AvailableColumns); startTime += separationTime; @@ -375,7 +376,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - AddToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); startTime += separationTime; } @@ -406,7 +407,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } // Create the hold note - AddToPattern(pattern, HitObject, holdColumn, startTime, separationTime * repeatCount); + addToPattern(pattern, HitObject, holdColumn, startTime, separationTime * repeatCount); int noteCount = 1; if (ConversionDifficulty > 6.5) @@ -429,7 +430,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (rowPattern.IsFilled(nextColumn) || nextColumn == holdColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); - AddToPattern(rowPattern, HitObject, nextColumn, startTime, startTime, noteCount + 1); + addToPattern(rowPattern, HitObject, nextColumn, startTime, startTime, noteCount + 1); } } @@ -459,5 +460,44 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); return curveData.RepeatSamples[index]; } + + + /// + /// Constructs and adds a note to a pattern. + /// + /// The pattern to add to. + /// The original hit object (used for samples). + /// The column to add the note to. + /// The start time of the note. + /// The end time of the note (set to for a non-hold note). + /// The number of children alongside this note (these will not be generated, but are used for volume calculations). + private void addToPattern(Pattern pattern, HitObject originalObject, int column, double startTime, double endTime, int siblings = 1) + { + ManiaHitObject newObject; + + if (startTime == endTime) + { + newObject = new Note + { + StartTime = startTime, + Samples = originalObject.Samples, + Column = column + }; + } + else + { + newObject = new HoldNote + { + StartTime = startTime, + Samples = originalObject.Samples, + Column = column, + Duration = endTime - startTime + }; + } + + // Todo: Consider siblings and write sample volumes (probably at ManiaHitObject level) + + pattern.Add(newObject); + } } } From 53a2f34f8b891e4e084b5351eb5fef1b629cc989 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 18:15:09 +0900 Subject: [PATCH 11/23] Set siblings, removing warning. --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 304a32a51b..adb0966b81 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -481,7 +481,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { StartTime = startTime, Samples = originalObject.Samples, - Column = column + Column = column, + Siblings = siblings }; } else @@ -491,12 +492,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy StartTime = startTime, Samples = originalObject.Samples, Column = column, - Duration = endTime - startTime + Duration = endTime - startTime, + Siblings = siblings }; } - // Todo: Consider siblings and write sample volumes (probably at ManiaHitObject level) - pattern.Add(newObject); } } From a30e49d21bf925586fdc19a43d760e631046c5c1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 18:19:29 +0900 Subject: [PATCH 12/23] Add hold end samples. --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 5 +++-- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index adb0966b81..b2a9de4b54 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -480,7 +480,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy newObject = new Note { StartTime = startTime, - Samples = originalObject.Samples, + Samples = sampleInfoListAt(startTime), Column = column, Siblings = siblings }; @@ -490,7 +490,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy newObject = new HoldNote { StartTime = startTime, - Samples = originalObject.Samples, + Samples = sampleInfoListAt(startTime), + EndSamples = sampleInfoListAt(endTime), Column = column, Duration = endTime - startTime, Siblings = siblings diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index a25b8fbf2a..701947c381 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Rulesets.Mania.Judgements; @@ -22,6 +23,11 @@ namespace osu.Game.Rulesets.Mania.Objects public double Duration { get; set; } public double EndTime => StartTime + Duration; + /// + /// The samples to be played when this hold note is released. + /// + public SampleInfoList EndSamples = new SampleInfoList(); + /// /// The key-release hit windows for this hold note. /// From 35bd608a4ac5c6a74fe466bfa96f865b06c6976f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 18:41:44 +0900 Subject: [PATCH 13/23] Simplify method parameters, make conversion work again. --- .../Beatmaps/LegacyBeatmapConverter.cs | 4 +- .../Legacy/DistanceObjectPatternGenerator.cs | 83 +++++++++---------- 2 files changed, 40 insertions(+), 47 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs index 3aa88af62d..a69145ba75 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; using osu.Game.Rulesets.Mania.MathUtils; +using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; namespace osu.Game.Rulesets.Mania.Beatmaps { @@ -74,10 +75,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var distanceData = original as IHasDistance; var positionData = original as IHasPosition; - PatternGenerator conversion = null; + Patterns.PatternGenerator conversion = null; if (distanceData != null) { + conversion = new DistanceObjectPatternGenerator(random, original, beatmap, lastPattern); // Slider } else if (endTimeData != null) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index b2a9de4b54..238e25f0c4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private const float osu_base_scoring_distance = 100; private readonly double endTime; + private readonly double segmentDuration; private readonly int repeatCount; private PatternType convertType; @@ -55,37 +56,36 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy double osuDuration = distance / osuVelocity; endTime = hitObject.StartTime + osuDuration; + segmentDuration = (endTime - HitObject.StartTime) / repeatCount; } public override Pattern Generate() { - double segmentDuration = endTime / repeatCount; - if (repeatCount > 1) { if (segmentDuration <= 90) - return generateRandomHoldNotes(HitObject.StartTime, endTime, 1); + return generateRandomHoldNotes(HitObject.StartTime, 1); if (segmentDuration <= 120) { convertType |= PatternType.ForceNotStack; - return generateRandomNotes(HitObject.StartTime, segmentDuration, repeatCount); + return generateRandomNotes(HitObject.StartTime, repeatCount + 1); } if (segmentDuration <= 160) - return generateStair(HitObject.StartTime, segmentDuration); + return generateStair(HitObject.StartTime); if (segmentDuration <= 200 && ConversionDifficulty > 3) - return generateRandomMultipleNotes(HitObject.StartTime, segmentDuration, repeatCount); + return generateRandomMultipleNotes(HitObject.StartTime); double duration = endTime - HitObject.StartTime; if (duration >= 4000) - return generateNRandomNotes(HitObject.StartTime, endTime, 0.23, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0); if (segmentDuration > 400 && duration < 4000 && repeatCount < AvailableColumns - 1 - RandomStart) - return generateTiledHoldNotes(HitObject.StartTime, segmentDuration, repeatCount); + return generateTiledHoldNotes(HitObject.StartTime); - return generateHoldAndNormalNotes(HitObject.StartTime, segmentDuration); + return generateHoldAndNormalNotes(HitObject.StartTime); } if (segmentDuration <= 110) @@ -94,43 +94,42 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy convertType |= PatternType.ForceNotStack; else convertType &= ~PatternType.ForceNotStack; - return generateRandomNotes(HitObject.StartTime, segmentDuration, segmentDuration < 80 ? 0 : 1); + return generateRandomNotes(HitObject.StartTime, segmentDuration < 80 ? 1 : 2); } if (ConversionDifficulty > 6.5) { if ((convertType & PatternType.LowProbability) > 0) - return generateNRandomNotes(HitObject.StartTime, endTime, 0.78, 0.3, 0); - return generateNRandomNotes(HitObject.StartTime, endTime, 0.85, 0.36, 0.03); + return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0); + return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03); } if (ConversionDifficulty > 4) { if ((convertType & PatternType.LowProbability) > 0) - return generateNRandomNotes(HitObject.StartTime, endTime, 0.43, 0.08, 0); - return generateNRandomNotes(HitObject.StartTime, endTime, 0.56, 0.18, 0); + return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0); + return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0); } if (ConversionDifficulty > 2.5) { if ((convertType & PatternType.LowProbability) > 0) - return generateNRandomNotes(HitObject.StartTime, endTime, 0.3, 0, 0); - return generateNRandomNotes(HitObject.StartTime, endTime, 0.37, 0.08, 0); + return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0); } if ((convertType & PatternType.LowProbability) > 0) - return generateNRandomNotes(HitObject.StartTime, endTime, 0.17, 0, 0); - return generateNRandomNotes(HitObject.StartTime, endTime, 0.27, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0); } /// /// Generates random hold notes that start at an span the same amount of rows. /// /// Start time of each hold note. - /// End time of the hold notes. /// Number of hold notes. /// The containing the hit objects. - private Pattern generateRandomHoldNotes(double startTime, double endTime, int noteCount) + private Pattern generateRandomHoldNotes(double startTime, int noteCount) { // - - - - // ■ - ■ ■ @@ -163,10 +162,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Generates random notes, with one note per row and no stacking. /// /// The start time. - /// The separation of notes between rows. - /// The number of rows. + /// The number of notes. /// The containing the hit objects. - private Pattern generateRandomNotes(double startTime, double separationTime, int repeatCount) + private Pattern generateRandomNotes(double startTime, int noteCount) { // - - - - // x - - - @@ -184,14 +182,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } int lastColumn = nextColumn; - for (int i = 0; i <= repeatCount; i++) + for (int i = 0; i < noteCount; i++) { addToPattern(pattern, HitObject, nextColumn, startTime, startTime); while (nextColumn == lastColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); lastColumn = nextColumn; - startTime += separationTime; + startTime += segmentDuration; } return pattern; @@ -201,9 +199,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Generates a stair of notes, with one note per row. /// /// The start time. - /// The separation of notes between rows. /// The containing the hit objects. - private Pattern generateStair(double startTime, double separationTime) + private Pattern generateStair(double startTime) { // - - - - // x - - - @@ -222,7 +219,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy for (int i = 0; i <= repeatCount; i++) { addToPattern(pattern, HitObject, column, startTime, startTime); - startTime += separationTime; + startTime += segmentDuration; // Check if we're at the borders of the stage, and invert the pattern if so if (increasing) @@ -254,10 +251,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Generates random notes with 1-2 notes per row and no stacking. /// /// The start time. - /// The separation of notes between rows. - /// The number of rows. /// The containing the hit objects. - private Pattern generateRandomMultipleNotes(double startTime, double separationTime, int repeatCount) + private Pattern generateRandomMultipleNotes(double startTime) { // - - - - // x - - @@ -285,7 +280,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy addToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); nextColumn = Random.Next(RandomStart, AvailableColumns); - startTime += separationTime; + startTime += segmentDuration; } return pattern; @@ -295,12 +290,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Generates random hold notes. The amount of hold notes generated is determined by probabilities. /// /// The hold note start time. - /// The hold note end time. /// The probability required for 2 hold notes to be generated. /// The probability required for 3 hold notes to be generated. /// The probability required for 4 hold notes to be generated. /// The containing the hit objects. - private Pattern generateNRandomNotes(double startTime, double endTime, double p2, double p3, double p4) + private Pattern generateNRandomNotes(double startTime, double p2, double p3, double p4) { // - - - - // ■ - ■ ■ @@ -339,17 +333,15 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (canGenerateTwoNotes) p2 = 1; - return generateRandomHoldNotes(startTime, endTime, GetRandomNoteCount(p2, p3, p4)); + return generateRandomHoldNotes(startTime, GetRandomNoteCount(p2, p3, p4)); } /// /// Generates tiled hold notes. You can think of this as a stair of hold notes. /// /// The first hold note start time. - /// The separation time between hold notes. - /// The amount of hold notes. /// The containing the hit objects. - private Pattern generateTiledHoldNotes(double startTime, double separationTime, int noteCount) + private Pattern generateTiledHoldNotes(double startTime) { // - - - - // ■ ■ ■ ■ @@ -362,7 +354,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); - int columnRepeat = Math.Min(noteCount, AvailableColumns); + int columnRepeat = Math.Min(repeatCount, AvailableColumns); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) @@ -376,8 +368,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); - startTime += separationTime; + addToPattern(pattern, HitObject, nextColumn, startTime, endTime, repeatCount); + startTime += segmentDuration; } return pattern; @@ -387,9 +379,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Generates a hold note alongside normal notes. /// /// The start time of notes. - /// The separation time between notes. /// The containing the hit objects. - private Pattern generateHoldAndNormalNotes(double startTime, double separationTime) + private Pattern generateHoldAndNormalNotes(double startTime) { // - - - - // ■ x x - @@ -407,7 +398,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } // Create the hold note - addToPattern(pattern, HitObject, holdColumn, startTime, separationTime * repeatCount); + addToPattern(pattern, HitObject, holdColumn, startTime, endTime); int noteCount = 1; if (ConversionDifficulty > 6.5) @@ -437,7 +428,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy pattern.Add(rowPattern); rowPattern.Clear(); - startTime += separationTime; + startTime += segmentDuration; } return pattern; @@ -455,7 +446,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (curveData == null) return HitObject.Samples; - double segmentTime = (curveData.EndTime - HitObject.StartTime) / repeatCount; + double segmentTime = (endTime - HitObject.StartTime) / repeatCount; int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); return curveData.RepeatSamples[index]; From a239411808b14df9a90895bc331e798010c28861 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 18 May 2017 19:09:02 +0900 Subject: [PATCH 14/23] Fix warnings/errors. --- .../Beatmaps/LegacyBeatmapConverter.cs | 10 ++++---- .../Legacy/DistanceObjectPatternGenerator.cs | 23 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs index 17552c05ef..de826063b0 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/LegacyBeatmapConverter.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps // Following lines currently commented out to appease resharper - //PatternGenerator conversion = null; + Patterns.PatternGenerator conversion = null; if (distanceData != null) { @@ -93,13 +93,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps // Circle } - //if (conversion == null) + if (conversion == null) return null; - //Pattern newPattern = conversion.Generate(); - //lastPattern = newPattern; + Pattern newPattern = conversion.Generate(); + lastPattern = newPattern; - //return newPattern.HitObjects; + return newPattern.HitObjects; } /// diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 238e25f0c4..04e2b30816 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(hitObject.StartTime) * speedAdjustment; // The true distance, accounting for any repeats. This ends up being the drum roll distance later - double distance = distanceData.Distance * repeatCount; + double distance = (distanceData?.Distance ?? 0) * repeatCount; // The velocity of the osu! hit object - calculated as the velocity of a slider double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength; @@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn) || PreviousPattern.IsFilled(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, nextColumn, startTime, endTime, noteCount); } // This is can't be combined with the above loop due to RNG @@ -152,7 +152,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, HitObject, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, nextColumn, startTime, endTime, noteCount); } return pattern; @@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int lastColumn = nextColumn; for (int i = 0; i < noteCount; i++) { - addToPattern(pattern, HitObject, nextColumn, startTime, startTime); + addToPattern(pattern, nextColumn, startTime, startTime); while (nextColumn == lastColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); @@ -218,7 +218,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy for (int i = 0; i <= repeatCount; i++) { - addToPattern(pattern, HitObject, column, startTime, startTime); + addToPattern(pattern, column, startTime, startTime); startTime += segmentDuration; // Check if we're at the borders of the stage, and invert the pattern if so @@ -268,7 +268,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); for (int i = 0; i <= repeatCount; i++) { - addToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + addToPattern(pattern, nextColumn, startTime, startTime, 2); nextColumn += interval; if (nextColumn >= AvailableColumns - RandomStart) @@ -277,7 +277,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // If we're in 2K, let's not add many consecutive doubles if (AvailableColumns > 2) - addToPattern(pattern, HitObject, nextColumn, startTime, startTime, 2); + addToPattern(pattern, nextColumn, startTime, startTime, 2); nextColumn = Random.Next(RandomStart, AvailableColumns); startTime += segmentDuration; @@ -368,7 +368,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, HitObject, nextColumn, startTime, endTime, repeatCount); + addToPattern(pattern, nextColumn, startTime, endTime, repeatCount); startTime += segmentDuration; } @@ -398,7 +398,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } // Create the hold note - addToPattern(pattern, HitObject, holdColumn, startTime, endTime); + addToPattern(pattern, holdColumn, startTime, endTime); int noteCount = 1; if (ConversionDifficulty > 6.5) @@ -421,7 +421,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (rowPattern.IsFilled(nextColumn) || nextColumn == holdColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(rowPattern, HitObject, nextColumn, startTime, startTime, noteCount + 1); + addToPattern(rowPattern, nextColumn, startTime, startTime, noteCount + 1); } } @@ -457,12 +457,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// Constructs and adds a note to a pattern. /// /// The pattern to add to. - /// The original hit object (used for samples). /// The column to add the note to. /// The start time of the note. /// The end time of the note (set to for a non-hold note). /// The number of children alongside this note (these will not be generated, but are used for volume calculations). - private void addToPattern(Pattern pattern, HitObject originalObject, int column, double startTime, double endTime, int siblings = 1) + private void addToPattern(Pattern pattern, int column, double startTime, double endTime, int siblings = 1) { ManiaHitObject newObject; From b5674c8f300720c8bdd60072e0011cf60ba2b580 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 18 May 2017 19:33:02 +0900 Subject: [PATCH 15/23] Update DistanceObjectPatternGenerator.cs --- .../Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 04e2b30816..d1cc638fe2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { addToPattern(pattern, column, startTime, startTime); startTime += segmentDuration; - + // Check if we're at the borders of the stage, and invert the pattern if so if (increasing) { From e52b87bc586512735493f1b76ce8b2e74e400ec5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 18 May 2017 19:47:16 +0900 Subject: [PATCH 16/23] Fix incorrect comment. --- .../Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index d1cc638fe2..9ea4353317 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -255,7 +255,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private Pattern generateRandomMultipleNotes(double startTime) { // - - - - - // x - - + // x - - - // - x x - // - - - x // x - x - From 90270ac5869d5ddb8212c67d603cacbc061b45c0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 19 May 2017 17:48:23 +0900 Subject: [PATCH 17/23] Update to match base branch. --- .../Beatmaps/ManiaBeatmapConverter.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 933fe0787c..46ca90e02b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -11,6 +11,7 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Database; +using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; namespace osu.Game.Rulesets.Mania.Beatmaps { @@ -83,12 +84,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps // Following lines currently commented out to appease resharper - //Patterns.PatternGenerator conversion = null; + Patterns.PatternGenerator conversion = null; if (distanceData != null) - { - // Slider - } + conversion = new DistanceObjectPatternGenerator(random, original, beatmap, lastPattern); else if (endTimeData != null) { // Spinner @@ -98,13 +97,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps // Circle } - //if (conversion == null) - return null; + if (conversion == null) + return null; - //Pattern newPattern = conversion.Generate(); - //lastPattern = newPattern; + Pattern newPattern = conversion.Generate(); + lastPattern = newPattern; - //return newPattern.HitObjects; + return newPattern.HitObjects; } /// From 57b9ed0f547fdcccd23aa66b5fdbe2f1e0aebd47 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 20 May 2017 18:56:50 +0200 Subject: [PATCH 18/23] Do not pause a running replay if the window is not focused. --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f9307595d2..3efc85d743 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -150,7 +150,7 @@ namespace osu.Game.Screens.Play FramedClock = offsetClock, OnRetry = Restart, OnQuit = Exit, - CheckCanPause = () => ValidForResume && !HasFailed, + CheckCanPause = () => ValidForResume && !HasFailed && !HitRenderer.HasReplayLoaded, Retries = RestartCount, OnPause = () => { hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; From ecf81fa8d2bc802631212b24c44907e85244798f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 08:25:48 +0900 Subject: [PATCH 19/23] Cleanup. --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 9ea4353317..4b063be222 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -47,9 +47,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy double speedAdjustment = beatmap.TimingInfo.SpeedMultiplierAt(hitObject.StartTime); double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(hitObject.StartTime) * speedAdjustment; - // The true distance, accounting for any repeats. This ends up being the drum roll distance later + // The true distance, accounting for any repeats double distance = (distanceData?.Distance ?? 0) * repeatCount; - // The velocity of the osu! hit object - calculated as the velocity of a slider double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength; // The duration of the osu! hit object @@ -82,7 +81,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (duration >= 4000) return generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0); - if (segmentDuration > 400 && duration < 4000 && repeatCount < AvailableColumns - 1 - RandomStart) + if (segmentDuration > 400 && repeatCount < AvailableColumns - 1 - RandomStart) return generateTiledHoldNotes(HitObject.StartTime); return generateHoldAndNormalNotes(HitObject.StartTime); From 3041b55aacd53b8ae4fc227f2d60f2373b856694 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 09:50:36 +0900 Subject: [PATCH 20/23] Remove siblings. --- .../Legacy/DistanceObjectPatternGenerator.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 4b063be222..ece278e64b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn) || PreviousPattern.IsFilled(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, nextColumn, startTime, endTime); } // This is can't be combined with the above loop due to RNG @@ -151,7 +151,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, nextColumn, startTime, endTime, noteCount); + addToPattern(pattern, nextColumn, startTime, endTime); } return pattern; @@ -267,7 +267,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); for (int i = 0; i <= repeatCount; i++) { - addToPattern(pattern, nextColumn, startTime, startTime, 2); + addToPattern(pattern, nextColumn, startTime, startTime); nextColumn += interval; if (nextColumn >= AvailableColumns - RandomStart) @@ -276,7 +276,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // If we're in 2K, let's not add many consecutive doubles if (AvailableColumns > 2) - addToPattern(pattern, nextColumn, startTime, startTime, 2); + addToPattern(pattern, nextColumn, startTime, startTime); nextColumn = Random.Next(RandomStart, AvailableColumns); startTime += segmentDuration; @@ -367,7 +367,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.IsFilled(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(pattern, nextColumn, startTime, endTime, repeatCount); + addToPattern(pattern, nextColumn, startTime, endTime); startTime += segmentDuration; } @@ -420,7 +420,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (rowPattern.IsFilled(nextColumn) || nextColumn == holdColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); - addToPattern(rowPattern, nextColumn, startTime, startTime, noteCount + 1); + addToPattern(rowPattern, nextColumn, startTime, startTime); } } @@ -459,8 +459,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// The column to add the note to. /// The start time of the note. /// The end time of the note (set to for a non-hold note). - /// The number of children alongside this note (these will not be generated, but are used for volume calculations). - private void addToPattern(Pattern pattern, int column, double startTime, double endTime, int siblings = 1) + private void addToPattern(Pattern pattern, int column, double startTime, double endTime) { ManiaHitObject newObject; @@ -470,8 +469,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { StartTime = startTime, Samples = sampleInfoListAt(startTime), - Column = column, - Siblings = siblings + Column = column }; } else @@ -482,8 +480,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy Samples = sampleInfoListAt(startTime), EndSamples = sampleInfoListAt(endTime), Column = column, - Duration = endTime - startTime, - Siblings = siblings + Duration = endTime - startTime }; } From 82cf94bbff70f42a10d35d06c1b7ef07aad7a89d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 22 May 2017 09:50:45 +0900 Subject: [PATCH 21/23] Move spinner colours to local definition for now We don't want to start polluting the OsuColours namespace with non-UI colours. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 7 +++++-- osu.Game/Graphics/OsuColour.cs | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index cc5086f442..3722d13ffc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -30,6 +30,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly TextAwesome symbol; + private readonly Color4 baseColour = OsuColour.FromHex(@"002c3c"); + private readonly Color4 fillColour = OsuColour.FromHex(@"005b7c"); + private Color4 normalColour; private Color4 completeColour; @@ -154,13 +157,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables [BackgroundDependencyLoader] private void load(OsuColour colours) { - normalColour = colours.SpinnerBase; + normalColour = baseColour; background.AccentColour = normalColour; completeColour = colours.YellowLight.Opacity(0.75f); - disc.AccentColour = colours.SpinnerFill; + disc.AccentColour = fillColour; circle.Colour = colours.BlueDark; glow.Colour = colours.BlueDark; } diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 697f8f4629..3d83668d07 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -87,8 +87,5 @@ namespace osu.Game.Graphics public readonly Color4 RedDarker = FromHex(@"870000"); public readonly Color4 ChatBlue = FromHex(@"17292e"); - - public readonly Color4 SpinnerBase = FromHex(@"002c3c"); - public readonly Color4 SpinnerFill = FromHex(@"005b7c"); } } From cd66e2af140763698f50af017052564c4d22bece Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 10:17:08 +0900 Subject: [PATCH 22/23] Update with pattern changes. --- .../Legacy/DistanceObjectPatternGenerator.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index ece278e64b..0cad23304e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (segmentDuration <= 110) { - if (PreviousPattern.ColumnsFilled < AvailableColumns) + if (PreviousPattern.ColumnWithObjects < AvailableColumns) convertType |= PatternType.ForceNotStack; else convertType &= ~PatternType.ForceNotStack; @@ -137,11 +137,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); - int usableColumns = AvailableColumns - RandomStart - PreviousPattern.ColumnsFilled; + int usableColumns = AvailableColumns - RandomStart - PreviousPattern.ColumnWithObjects; int nextColumn = Random.Next(RandomStart, AvailableColumns); for (int i = 0; i < Math.Min(usableColumns, noteCount); i++) { - while (pattern.IsFilled(nextColumn) || PreviousPattern.IsFilled(nextColumn)) //find available column + while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, AvailableColumns); addToPattern(pattern, nextColumn, startTime, endTime); } @@ -149,7 +149,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // This is can't be combined with the above loop due to RNG for (int i = 0; i < noteCount - usableColumns; i++) { - while (pattern.IsFilled(nextColumn)) + while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); addToPattern(pattern, nextColumn, startTime, endTime); } @@ -174,9 +174,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < AvailableColumns) { - while (PreviousPattern.IsFilled(nextColumn)) + while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); } @@ -356,15 +356,15 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int columnRepeat = Math.Min(repeatCount, AvailableColumns); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < AvailableColumns) { - while (PreviousPattern.IsFilled(nextColumn)) + while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); } for (int i = 0; i < columnRepeat; i++) { - while (pattern.IsFilled(nextColumn)) + while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, AvailableColumns); addToPattern(pattern, nextColumn, startTime, endTime); @@ -390,9 +390,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnsFilled < AvailableColumns) + if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < AvailableColumns) { - while (PreviousPattern.IsFilled(holdColumn)) + while (PreviousPattern.ColumnHasObject(holdColumn)) holdColumn = Random.Next(RandomStart, AvailableColumns); } @@ -418,7 +418,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { for (int j = 0; j < noteCount; j++) { - while (rowPattern.IsFilled(nextColumn) || nextColumn == holdColumn) + while (rowPattern.ColumnHasObject(nextColumn) || nextColumn == holdColumn) nextColumn = Random.Next(RandomStart, AvailableColumns); addToPattern(rowPattern, nextColumn, startTime, startTime); } From 4ce3a7806690b7672080253bc13caaf7e9fe3813 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 22 May 2017 10:18:42 +0900 Subject: [PATCH 23/23] Update Pattern.cs --- osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs index 331b92f8a4..15d31406e9 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Pattern.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns