1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:05:34 +08:00

Merge pull request #831 from smoogipooo/beat-sync-container-improvements

Beat sync container improvements
This commit is contained in:
Dean Herbert 2017-05-24 01:05:02 +09:00 committed by GitHub
commit 952179332f
2 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit c6f030d6f1ab65a48de9ff1d0c424acb686e0149 Subproject commit 773d60eb6b811f395e32a22dc66bb4d2e63a6dbc

View File

@ -2,11 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
@ -30,21 +30,21 @@ namespace osu.Game.Graphics.Containers
if (timingPoint.BeatLength == 0) if (timingPoint.BeatLength == 0)
return; return;
int beat = (int)((currentTrackTime - timingPoint.Time) / timingPoint.BeatLength); int beatIndex = (int)((currentTrackTime - timingPoint.Time) / timingPoint.BeatLength);
// 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 (currentTrackTime < timingPoint.Time) if (currentTrackTime < timingPoint.Time)
beat--; beatIndex--;
if (timingPoint == lastTimingPoint && beat == lastBeat) if (timingPoint == lastTimingPoint && beatIndex == lastBeat)
return; return;
double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength; double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength;
using (BeginDelayedSequence(offsetFromBeat, true)) using (BeginDelayedSequence(offsetFromBeat, true))
OnNewBeat(beat, timingPoint.BeatLength, timingPoint.TimeSignature, effectPoint.KiaiMode); OnNewBeat(beatIndex, timingPoint, effectPoint, beatmap.Value.Track.CurrentAmplitudes);
lastBeat = beat; lastBeat = beatIndex;
lastTimingPoint = timingPoint; lastTimingPoint = timingPoint;
} }
@ -54,7 +54,7 @@ namespace osu.Game.Graphics.Containers
beatmap.BindTo(game.Beatmap); beatmap.BindTo(game.Beatmap);
} }
protected virtual void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{ {
} }
} }