1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 00:20:38 +08:00

Improves linear interpolation into final size

This commit is contained in:
O Thiago
2022-09-25 14:57:45 -04:00
Unverified
parent b62e1272e3
commit 2bcb7aa83a
2 changed files with 21 additions and 18 deletions
@@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public ManiaModFlashlight()
{
MaxChangeSizeTimes.Default = 0;
FinalFlashlightSize.Default = 1;
}
[SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")]
+20 -17
View File
@@ -12,6 +12,7 @@ using osu.Framework.Graphics.Rendering.Vertices;
using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Utils;
using osu.Game.Beatmaps.Timing;
using osu.Game.Configuration;
using osu.Game.Graphics;
@@ -27,6 +28,9 @@ namespace osu.Game.Rulesets.Mods
{
public abstract class ModFlashlight : Mod
{
private const int min_change_size_combo = 1;
private const int max_change_size_combo = 300;
public override string Name => "Flashlight";
public override string Acronym => "FL";
public override IconUsage? Icon => OsuIcon.ModFlashlight;
@@ -35,27 +39,12 @@ namespace osu.Game.Rulesets.Mods
protected ModFlashlight()
{
MaxChangeSizeTimes.DefaultChanged += _ => MaxChangeSizeTimes.SetDefault();
FinalFlashlightSize.DefaultChanged += _ => FinalFlashlightSize.SetDefault();
}
[SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")]
public abstract BindableFloat SizeMultiplier { get; }
[SettingSource("Change size combo", "Changes the combo multiplier where the flashlight size is changed.")]
public BindableFloat ChangeSizeCombo { get; } = new BindableFloat(100)
{
MinValue = 1,
MaxValue = 300,
Precision = 1
};
[SettingSource("Change size times", "Changes how many times the flashlight size is changed before reaching the final flashlight size.")]
public BindableInt MaxChangeSizeTimes { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 100
};
[SettingSource("Final flashlight size", "The final size multiplier that is reached when the flashlight changes size for the last time.")]
public BindableFloat FinalFlashlightSize { get; } = new BindableFloat(0.8f)
{
@@ -64,6 +53,20 @@ namespace osu.Game.Rulesets.Mods
Precision = 0.1f,
};
[SettingSource("Change size combo", "Changes the combo multiplier where the flashlight size is changed.")]
public BindableInt ChangeSizeCombo { get; } = new BindableInt(100)
{
MinValue = min_change_size_combo,
MaxValue = max_change_size_combo,
};
[SettingSource("Change size times", "Changes how many times the flashlight size is changed before reaching the final flashlight size.")]
public BindableInt MaxChangeSizeTimes { get; } = new BindableInt(2)
{
MinValue = min_change_size_combo,
MaxValue = max_change_size_combo,
};
/// <summary>
/// The default size of the flashlight in ruleset-appropriate dimensions.
/// </summary>
@@ -143,7 +146,7 @@ namespace osu.Game.Rulesets.Mods
var finalFlashlightSizeBinding = modFlashlight.FinalFlashlightSize;
float finalFlashlightSize = finalFlashlightSizeBinding.Value;
comboBasedSize = maxChangeSizeTimes > 0 || finalFlashlightSize < finalFlashlightSizeBinding.MaxValue;
comboBasedSize = !Precision.AlmostEquals(finalFlashlightSize, 1);
if (comboBasedSize)
changeSizeDecreaseRatio = (1 - finalFlashlightSize) / maxChangeSizeTimes;