diff --git a/Quaver.API/Helpers/MathHelper.cs b/Quaver.API/Helpers/MathHelper.cs index 4575da013..bb531a018 100644 --- a/Quaver.API/Helpers/MathHelper.cs +++ b/Quaver.API/Helpers/MathHelper.cs @@ -9,22 +9,5 @@ public static T Clamp(this T val, T min, T max) where T : IComparable if (val.CompareTo(min) < 0) return min; return val.CompareTo(max) > 0 ? max : val; } - - /// - /// Mirrors the first bits of . - /// https://stackoverflow.com/a/4245986/23723435 - /// - /// - /// - /// - public static uint Reverse(uint x, int bits) - { - x = ((x & 0x55555555) << 1) | ((x & 0xAAAAAAAA) >> 1); // Swap _<>_ - x = ((x & 0x33333333) << 2) | ((x & 0xCCCCCCCC) >> 2); // Swap __<>__ - x = ((x & 0x0F0F0F0F) << 4) | ((x & 0xF0F0F0F0) >> 4); // Swap ____<>____ - x = ((x & 0x00FF00FF) << 8) | ((x & 0xFF00FF00) >> 8); // Swap ... - x = ((x & 0x0000FFFF) << 16) | ((x & 0xFFFF0000) >> 16); // Swap ... - return x >> (32 - bits); - } } } \ No newline at end of file diff --git a/Quaver.API/Maps/Qua.cs b/Quaver.API/Maps/Qua.cs index c8460cfc2..d12ec4159 100644 --- a/Quaver.API/Maps/Qua.cs +++ b/Quaver.API/Maps/Qua.cs @@ -171,11 +171,6 @@ public List SliderVelocities private set => DefaultScrollGroup.ScrollVelocities = value; } - /// - /// Scroll Speed Factor .qua data - /// - public List ScrollSpeedFactors { get; private set; } = new List(); - /// /// HitObject .qua data /// @@ -263,7 +258,6 @@ public bool EqualByValue(Qua other) => Genre == other.Genre && TimingPoints.SequenceEqual(other.TimingPoints, TimingPointInfo.ByValueComparer) && SliderVelocities.SequenceEqual(other.SliderVelocities, SliderVelocityInfo.ByValueComparer) && - ScrollSpeedFactors.SequenceEqual(other.ScrollSpeedFactors, ScrollSpeedFactorInfo.ByValueComparer) && InitialScrollVelocity == other.InitialScrollVelocity && CompareTimingGroups(other.TimingGroups) && BPMDoesNotAffectScrollVelocity == other.BPMDoesNotAffectScrollVelocity && @@ -495,7 +489,6 @@ public void Sort() SortSoundEffects(); SortTimingPoints(); SortSliderVelocities(); - SortScrollSpeedFactors(); } /// @@ -637,13 +630,6 @@ public TimingPointInfo GetTimingPointAt(double time) public SliderVelocityInfo GetScrollVelocityAt(double time, string timingGroupId = DefaultScrollGroupId) => ((ScrollGroup)TimingGroups[timingGroupId]).GetScrollVelocityAt(time); - /// - /// Gets a scroll velocity at a particular time in the map - /// - /// - /// - public ScrollSpeedFactorInfo GetScrollSpeedFactorAt(double time) => ScrollSpeedFactors.AtTime((float)time); - /// /// Finds the length of a timing point. /// @@ -1033,10 +1019,6 @@ public void MirrorHitObjects() /// public void SortBookmarks() => Bookmarks.HybridSort(); - /// - /// - public void SortScrollSpeedFactors() => ScrollSpeedFactors.HybridSort(); - /// /// public void SortHitObjects() => HitObjects.HybridSort(); diff --git a/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs b/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs deleted file mode 100644 index d67073772..000000000 --- a/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using MoonSharp.Interpreter; - -namespace Quaver.API.Maps.Structures -{ - /// - /// ScrollSpeedFactors section of the .qua - /// - [Serializable] - [MoonSharpUserData] - public class ScrollSpeedFactorInfo : IStartTime - { - /// - /// The time in milliseconds at which the scroll speed factor will be exactly - /// - public float StartTime { get; [MoonSharpHidden] set; } - - /// - /// The multiplier given to the scroll speed. - /// It will be lerped to the next scroll speed factor like keyframes, unless this is the last factor change. - /// - public float Factor { get; [MoonSharpHidden] set; } - - /// - /// Bit flag: i-th bit for if this factor applies to the i-th lane. For i >= KeyCount, i-th bit is 1. - /// So the value would be -1 to apply to all lanes, even after we change the key count in editor. - /// - public int LaneMask { get; [MoonSharpHidden] set; } = -1; - - public IEnumerable GetLaneMaskLanes(int keyCount) => GetLaneMaskLanes(LaneMask, keyCount); - - public string MaskRepresentation(int keyCount) => MaskRepresentation(LaneMask, keyCount); - - public static IEnumerable GetLaneMaskLanes(int laneMask, int keyCount) - { - for (var i = 0; i < keyCount; i++) - { - if ((laneMask & (1 << i)) != 0) - yield return i; - } - } - - /// - /// Mask in human-readable form should be in reverse order and binary, so that the left-most character - /// represents the left-most lane (lane 1) - /// - /// - /// - /// - public static string MaskRepresentation(int laneMask, int keyCount) - { - var sb = new StringBuilder(); - for (var i = 0; i < keyCount; i++) - { - sb.Append((laneMask & (1 << i)) == 0 ? '0' : '1'); - } - - return sb.ToString(); - } - - /// - /// Turns representation of lane mask back into integer - /// - /// - /// - public static int ParseMask(string input) - { - var result = -1; - for (var i = 0; i < input.Length; i++) - { - if (input[i] == '0') result &= ~(1 << i); - } - - return result; - } - - private sealed class StartTimeRelationalComparer : IComparer - { - public int Compare(ScrollSpeedFactorInfo x, ScrollSpeedFactorInfo y) - { - if (ReferenceEquals(x, y)) return 0; - if (ReferenceEquals(null, y)) return 1; - if (ReferenceEquals(null, x)) return -1; - return x.StartTime.CompareTo(y.StartTime); - } - } - - public static IComparer StartTimeComparer { get; } = new StartTimeRelationalComparer(); - - /// - /// By-value comparer, auto-generated by Rider. - /// - private sealed class ByValueEqualityComparer : IEqualityComparer - { - public bool Equals(ScrollSpeedFactorInfo x, ScrollSpeedFactorInfo y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - if (x.GetType() != y.GetType()) return false; - return x.StartTime.Equals(y.StartTime) && x.Factor.Equals(y.Factor) && x.LaneMask == y.LaneMask; - } - - public int GetHashCode(ScrollSpeedFactorInfo obj) - { - return HashCode.Combine(obj.StartTime, obj.Factor, obj.LaneMask); - } - } - - public static IEqualityComparer ByValueComparer { get; } = new ByValueEqualityComparer(); - } -} \ No newline at end of file