1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Add better defaults for ControlPoint.

This commit is contained in:
Dean Herbert 2017-04-06 13:15:12 +09:00
parent 042aa787a5
commit c50960af63
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 6 additions and 12 deletions

View File

@ -5,17 +5,11 @@ namespace osu.Game.Beatmaps.Timing
{
public class ControlPoint
{
public static ControlPoint Default = new ControlPoint
{
BeatLength = 500,
TimingChange = true,
};
public TimeSignatures TimeSignature;
public double Time;
public double BeatLength;
public double SpeedMultiplier;
public bool TimingChange;
public double BeatLength = 500;
public double SpeedMultiplier = 1;
public bool TimingChange = true;
public bool KiaiMode;
public bool OmitFirstBarLine;

View File

@ -10,8 +10,8 @@ namespace osu.Game.Beatmaps.Timing
{
public readonly List<ControlPoint> ControlPoints = new List<ControlPoint>();
public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength;
public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength;
public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? new ControlPoint()).BeatLength;
public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new ControlPoint()).BeatLength;
public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time);
public double BPMAt(double time)
@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps.Timing
else break;
}
return timingPoint ?? ControlPoint.Default;
return timingPoint ?? new ControlPoint();
}
}
}