1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 11:52:54 +08:00

Fixes FinalChangeSizeCombo calculations

This commit is contained in:
o-dasher 2024-07-15 00:41:20 -03:00
parent 4ff322bf9a
commit c333226b9f

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mods
public override LocalisableString Description => "Restricted view area.";
public override bool Ranked => UsesDefaultConfiguration;
private float findClosestMultipleFrom(int value, float multiple) => MathF.Round(value / multiple) * multiple;
private float ceilSnap(int value, float step) => MathF.Ceiling(value / step) * step;
protected ModFlashlight()
{
@ -49,9 +49,11 @@ namespace osu.Game.Rulesets.Mods
{
int newChangeSizeComboDivisor = e.NewValue;
FinalChangeSizeCombo.MinValue = newChangeSizeComboDivisor;
FinalChangeSizeCombo.MaxValue = findClosestMultipleFrom(ChangeSizeComboDivisor.MaxValue, newChangeSizeComboDivisor);
FinalChangeSizeCombo.Precision = newChangeSizeComboDivisor;
FinalChangeSizeCombo.MinValue = newChangeSizeComboDivisor;
// The previously triggered bindable events may cause the bindable value to overflow a rounded snap, so we must account to the worst case by ceiling.
FinalChangeSizeCombo.MaxValue = ceilSnap(ChangeSizeComboDivisor.MaxValue, newChangeSizeComboDivisor);
}, true);
// The final flashlight size shouldn't exceed the starting flashlight size.