Skip to content

Commit

Permalink
Misc: Round all pp & live values to 3 decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotrekol committed Aug 13, 2021
1 parent 4c6fd4e commit e0c6446
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/BeatmapPpReplacements/PpReplacements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private double GetPp(CancellationToken cancellationToken, IPpCalculator ppCalcul

_ppCalculator.Mods = mods.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);

return ppCalculator.Calculate(cancellationToken);
return Math.Round(ppCalculator.Calculate(cancellationToken), 3);
}
}
}
14 changes: 12 additions & 2 deletions plugins/OsuMemoryEventSource/InterpolatedValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ public enum InterpolationType
{
Linear, EaseIn, EaseOutQuint
}
public class InterpolatedValue

public class RoundedInterpolatedValue : InterpolatedValue
{
public int DecimalPlaces { get; set; } = 3;
public override double Current => Math.Round(base.Current, DecimalPlaces);

public RoundedInterpolatedValue(double speed) : base(speed)
{
}
}

public class InterpolatedValue
{
public InterpolationType InterpolationType { get; set; } = InterpolationType.EaseOutQuint;
public double Current { get; private set; } = 0;
public virtual double Current { get; private set; } = 0;
private double _orginalValue = 0;
private double _finalValue = 0;
private double _transitionSpeed;
Expand Down
4 changes: 2 additions & 2 deletions plugins/OsuMemoryEventSource/MemoryDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private enum InterpolatedValueName
private ManualResetEvent _notUpdatingMemoryValues = new ManualResetEvent(true);
private ManualResetEvent _newPlayStarted = new ManualResetEvent(true);

private readonly Dictionary<InterpolatedValueName, InterpolatedValue> InterpolatedValues = new Dictionary<InterpolatedValueName, InterpolatedValue>();
private readonly Dictionary<InterpolatedValueName, InterpolatedValue> InterpolatedValues = new();
private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
public EventHandler<OsuStatus> TokensUpdated { get; set; }
public bool IsMainProcessor { get; private set; }
Expand All @@ -91,7 +91,7 @@ public MemoryDataProcessor(ISettings settings, IContextAwareLogger logger, IModP
_modParser = modParser;
foreach (var v in (InterpolatedValueName[])Enum.GetValues(typeof(InterpolatedValueName)))
{
InterpolatedValues.Add(v, new InterpolatedValue(0.15));
InterpolatedValues.Add(v, new RoundedInterpolatedValue(0.15));
}

ToggleSmoothing(true);
Expand Down

0 comments on commit e0c6446

Please sign in to comment.