This commit is contained in:
ColdVolcano
2017-05-17 01:26:34 -05:00
parent 5f192cae7b
commit 387d26a576

View File

@ -18,10 +18,6 @@ namespace osu.Game.Graphics.Containers
private const int seek_tolerance = 20; private const int seek_tolerance = 20;
private const double min_beat_length = 1E-100; private const double min_beat_length = 1E-100;
public BeatSyncedContainer()
{
}
protected override void Update() protected override void Update()
{ {
if (beatmap.Value != null) if (beatmap.Value != null)
@ -33,23 +29,23 @@ namespace osu.Game.Graphics.Containers
if (controlPoint != null) if (controlPoint != null)
{ {
double oldTimingPointStart = timingPointStart; double oldTimingPointStart = timingPointStart;
double beatLenght = double.MinValue; double beatLength;
int oldBeat = beat; int oldBeat = beat;
bool kiai = false; bool kiai;
beatLenght = controlPoint.BeatLength; beatLength = controlPoint.BeatLength;
timingPointStart = controlPoint.Time; timingPointStart = controlPoint.Time;
kiai = kiaiControlPoint?.KiaiMode ?? false; kiai = kiaiControlPoint?.KiaiMode ?? false;
beat = beatLenght > min_beat_length ? (int)((currentTime - timingPointStart) / beatLenght) : 0; beat = beatLength > min_beat_length ? (int)((currentTime - timingPointStart) / beatLength) : 0;
//should we handle negative beats? (before the start of the controlPoint) //should we handle negative beats? (before the start of the controlPoint)
//The beats before the start of the first control point are off by 1, this should do the trick //The beats before the start of the first control point are off by 1, this should do the trick
if (currentTime <= timingPointStart) if (currentTime <= timingPointStart)
beat--; beat--;
if ((timingPointStart != oldTimingPointStart || beat != oldBeat) && (int)((currentTime - timingPointStart) % (beatLenght)) <= seek_tolerance) if ((timingPointStart != oldTimingPointStart || beat != oldBeat) && (currentTime - timingPointStart) % (beatLength) <= seek_tolerance)
OnNewBeat(beat, controlPoint.BeatLength, controlPoint.TimeSignature, kiai); OnNewBeat(beat, beatLength, controlPoint.TimeSignature, kiai);
} }
} }
} }