Skip to content

Commit

Permalink
Merge pull request #563 from LumpBloom7/Live-counter-div-by-zero-fix
Browse files Browse the repository at this point in the history
Avoid div-by-zero in LiveCounter
  • Loading branch information
LumpBloom7 authored Mar 3, 2024
2 parents 0d38d3f + 624dc3d commit afa8a34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion osu.Game.Rulesets.Sentakki/UI/Components/LiveCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,
float panicDurationMultiplier = 1 * MathF.Pow(0.75f, panicLevel);
float beatMagnitude = 0.1f + (0.05f * panicLevel);

if (beatIndex % (int)(timingPoint.TimeSignature.Numerator * Math.Max(panicDurationMultiplier, 0.5f)) == 0)
int heartbeatFreq = (int)(timingPoint.TimeSignature.Numerator * Math.Max(panicDurationMultiplier, 0.5f));

if (heartbeatFreq == 0)
return;

if (beatIndex % heartbeatFreq == 0)
{
this.ScaleTo(1 + beatMagnitude, 200 * panicDurationMultiplier)
.Then().ScaleTo(1, 120 * panicDurationMultiplier)
Expand Down

0 comments on commit afa8a34

Please sign in to comment.