mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Tidy up kiai time access
This commit is contained in:
@ -21,6 +21,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool BeatSyncAvailable => Clock != null;
|
public bool BeatSyncAvailable => Clock != null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the beat sync provider is currently in a kiai section. Should make everything more epic.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsKiaiTime => Clock != null && (ControlPoints?.EffectPointAt(Clock.CurrentTime).KiaiMode ?? false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Access any available control points from a beatmap providing beat sync. If <c>null</c>, no current provider is available.
|
/// Access any available control points from a beatmap providing beat sync. If <c>null</c>, no current provider is available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -26,8 +26,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
private int lastBeat;
|
private int lastBeat;
|
||||||
|
|
||||||
protected TimingControlPoint? LastTimingPoint { get; private set; }
|
private TimingControlPoint? lastTimingPoint { get; set; }
|
||||||
protected EffectControlPoint? LastEffectPoint { get; private set; }
|
private EffectControlPoint? lastEffectPoint { get; set; }
|
||||||
|
|
||||||
|
public bool IsKiaiTime { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
|
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
|
||||||
@ -125,7 +127,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
||||||
|
|
||||||
if (ReferenceEquals(timingPoint, LastTimingPoint) && beatIndex == lastBeat)
|
if (ReferenceEquals(timingPoint, lastTimingPoint) && beatIndex == lastBeat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// as this event is sometimes used for sound triggers where `BeginDelayedSequence` has no effect, avoid firing it if too far away from the beat.
|
// as this event is sometimes used for sound triggers where `BeginDelayedSequence` has no effect, avoid firing it if too far away from the beat.
|
||||||
@ -137,8 +139,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastBeat = beatIndex;
|
lastBeat = beatIndex;
|
||||||
LastTimingPoint = timingPoint;
|
lastTimingPoint = timingPoint;
|
||||||
LastEffectPoint = effectPoint;
|
lastEffectPoint = effectPoint;
|
||||||
|
|
||||||
|
IsKiaiTime = lastEffectPoint?.KiaiMode ?? false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,23 +100,18 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private void updateAmplitudes()
|
private void updateAmplitudes()
|
||||||
{
|
{
|
||||||
bool isKiaiTime = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < temporalAmplitudes.Length; i++)
|
for (int i = 0; i < temporalAmplitudes.Length; i++)
|
||||||
temporalAmplitudes[i] = 0;
|
temporalAmplitudes[i] = 0;
|
||||||
|
|
||||||
if (beatSyncProvider.Clock != null)
|
if (beatSyncProvider.Clock != null)
|
||||||
{
|
|
||||||
isKiaiTime = beatSyncProvider.ControlPoints?.EffectPointAt(beatSyncProvider.Clock.CurrentTime).KiaiMode ?? false;
|
|
||||||
addAmplitudesFromSource(beatSyncProvider);
|
addAmplitudesFromSource(beatSyncProvider);
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var source in amplitudeSources)
|
foreach (var source in amplitudeSources)
|
||||||
addAmplitudesFromSource(source);
|
addAmplitudesFromSource(source);
|
||||||
|
|
||||||
for (int i = 0; i < bars_per_visualiser; i++)
|
for (int i = 0; i < bars_per_visualiser; i++)
|
||||||
{
|
{
|
||||||
float targetAmplitude = (temporalAmplitudes[(i + indexOffset) % bars_per_visualiser]) * (isKiaiTime ? 1 : 0.5f);
|
float targetAmplitude = (temporalAmplitudes[(i + indexOffset) % bars_per_visualiser]) * (beatSyncProvider.IsKiaiTime ? 1 : 0.5f);
|
||||||
if (targetAmplitude > frequencyAmplitudes[i])
|
if (targetAmplitude > frequencyAmplitudes[i])
|
||||||
frequencyAmplitudes[i] = targetAmplitude;
|
frequencyAmplitudes[i] = targetAmplitude;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
|
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
|
||||||
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
|
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
|
||||||
|
|
||||||
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity * (LastEffectPoint.KiaiMode ? 4 : 2), 0.995f, Time.Elapsed);
|
triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, triangles_paused_velocity * (IsKiaiTime ? 4 : 2), 0.995f, Time.Elapsed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user