From 2a59735525abb6d481fadc044808f497ace7f2a4 Mon Sep 17 00:00:00 2001 From: mk-56 Date: Sat, 15 Jan 2022 21:43:28 +0100 Subject: [PATCH 01/12] Initial commit --- .../Mods/CatchModFlashlight.cs | 21 +++------- .../Mods/ManiaModFlashlight.cs | 13 ++++-- .../Mods/OsuModFlashlight.cs | 42 ++++++++++--------- .../Mods/TaikoModFlashlight.cs | 20 ++++----- osu.Game/Rulesets/Mods/ModFlashlight.cs | 42 +++++++++++++++++++ 5 files changed, 89 insertions(+), 49 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index f399f48ebd..e5da168dc6 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -15,9 +15,10 @@ namespace osu.Game.Rulesets.Catch.Mods { public override double ScoreMultiplier => 1.12; - private const float default_flashlight_size = 350; + public override bool DefaultComboDependency => true; + public override float DefaultRadius => 350; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield); + public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); private CatchPlayfield playfield; @@ -31,10 +32,10 @@ namespace osu.Game.Rulesets.Catch.Mods { private readonly CatchPlayfield playfield; - public CatchFlashlight(CatchPlayfield playfield) + public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius) : base(isRadiusBasedOnCombo, initialRadius) { this.playfield = playfield; - FlashlightSize = new Vector2(0, getSizeFor(0)); + FlashlightSize = new Vector2(0, GetRadiusFor(0)); } protected override void Update() @@ -44,19 +45,9 @@ namespace osu.Game.Rulesets.Catch.Mods FlashlightPosition = playfield.CatcherArea.ToSpaceOfOtherDrawable(playfield.Catcher.DrawPosition, this); } - private float getSizeFor(int combo) - { - if (combo > 200) - return default_flashlight_size * 0.8f; - else if (combo > 100) - return default_flashlight_size * 0.9f; - else - return default_flashlight_size; - } - protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 86a00271e9..676b5f3842 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -16,17 +16,19 @@ namespace osu.Game.Rulesets.Mania.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(ModHidden) }; - private const float default_flashlight_size = 180; + public override bool DefaultComboDependency => false; + public override float DefaultRadius => 180; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(); + public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value); private class ManiaFlashlight : Flashlight { private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); - public ManiaFlashlight() + public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius) + : base(isRadiusBasedOnCombo, initialRadius) { - FlashlightSize = new Vector2(0, default_flashlight_size); + FlashlightSize = new Vector2(DrawWidth, GetRadiusFor(0)); AddLayout(flashlightProperties); } @@ -46,9 +48,12 @@ namespace osu.Game.Rulesets.Mania.Mods protected override void OnComboChange(ValueChangedEvent e) { + this.TransformTo(nameof(FlashlightSize), new Vector2(DrawWidth, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "RectangularFlashlight"; } } } + + diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 300a9d48aa..f15527460c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods @@ -21,13 +20,16 @@ namespace osu.Game.Rulesets.Osu.Mods { public override double ScoreMultiplier => 1.12; - private const float default_flashlight_size = 180; + public override bool DefaultComboDependency => true; + + //private const float default_flashlight_size = 180; + public override float DefaultRadius => 180; private const double default_follow_delay = 120; private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(); + public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { @@ -35,13 +37,6 @@ namespace osu.Game.Rulesets.Osu.Mods s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange; } - public override void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) - { - base.ApplyToDrawableRuleset(drawableRuleset); - - flashlight.FollowDelay = FollowDelay.Value; - } - [SettingSource("Follow delay", "Milliseconds until the flashlight reaches the cursor")] public BindableNumber FollowDelay { get; } = new BindableDouble(default_follow_delay) { @@ -54,9 +49,15 @@ namespace osu.Game.Rulesets.Osu.Mods { public double FollowDelay { private get; set; } - public OsuFlashlight() + //public float InitialRadius { private get; set; } + public bool ChangeRadius { private get; set; } + + public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay) + : base(isRadiusBasedOnCombo, initialRadius) { - FlashlightSize = new Vector2(0, getSizeFor(0)); + FollowDelay = followDelay; + + FlashlightSize = new Vector2(0, GetRadiusFor(0)); } public void OnSliderTrackingChange(ValueChangedEvent e) @@ -78,17 +79,20 @@ namespace osu.Game.Rulesets.Osu.Mods private float getSizeFor(int combo) { - if (combo > 200) - return default_flashlight_size * 0.8f; - else if (combo > 100) - return default_flashlight_size * 0.9f; - else - return default_flashlight_size; + if (ChangeRadius) + { + if (combo > 200) + return InitialRadius * 0.8f; + else if (combo > 100) + return InitialRadius * 0.9f; + } + + return InitialRadius; } protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 0a325f174e..29f29863c0 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -16,9 +16,12 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override double ScoreMultiplier => 1.12; - private const float default_flashlight_size = 250; + public override bool DefaultComboDependency => true; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield); + //private const float default_flashlight_size = 250; + public override float DefaultRadius => 250; + + public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); private TaikoPlayfield playfield; @@ -33,7 +36,8 @@ namespace osu.Game.Rulesets.Taiko.Mods private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); private readonly TaikoPlayfield taikoPlayfield; - public TaikoFlashlight(TaikoPlayfield taikoPlayfield) + public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius) + : base(isRadiusBasedOnCombo, initialRadius) { this.taikoPlayfield = taikoPlayfield; FlashlightSize = getSizeFor(0); @@ -43,15 +47,9 @@ namespace osu.Game.Rulesets.Taiko.Mods private Vector2 getSizeFor(int combo) { - float size = default_flashlight_size; - - if (combo > 200) - size *= 0.8f; - else if (combo > 100) - size *= 0.9f; - // Preserve flashlight size through the playfield's aspect adjustment. - return new Vector2(0, size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); + // return new Vector2(0, size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); + return new Vector2(0, GetRadiusFor(combo) * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); } protected override void OnComboChange(ValueChangedEvent e) diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index a77a83b36c..bff0e2f12d 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps.Timing; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.OpenGL.Vertices; using osu.Game.Rulesets.Objects; @@ -32,8 +33,26 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Restricted view area."; + [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] + public Bindable ChangeRadius { get; private set; } + + [SettingSource("Initial radius", "Initial radius of the flashlight area.")] + public BindableNumber InitialRadius { get; private set; } + + public abstract float DefaultRadius { get; } + + public abstract bool DefaultComboDependency { get; } + internal ModFlashlight() { + InitialRadius = new BindableFloat + { + MinValue = 90f, + MaxValue = 250f, + Precision = 5f, + }; + + ChangeRadius = new BindableBool(DefaultComboDependency); } } @@ -93,6 +112,16 @@ namespace osu.Game.Rulesets.Mods public List Breaks; + public readonly bool IsRadiusBasedOnCombo; + + public readonly float InitialRadius; + + protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius) + { + IsRadiusBasedOnCombo = isRadiusBasedOnCombo; + InitialRadius = initialRadius; + } + [BackgroundDependencyLoader] private void load(ShaderManager shaderManager) { @@ -124,6 +153,19 @@ namespace osu.Game.Rulesets.Mods protected abstract string FragmentShader { get; } + protected float GetRadiusFor(int combo) + { + if (IsRadiusBasedOnCombo) + { + if (combo > 200) + return InitialRadius * 0.8f; + else if (combo > 100) + return InitialRadius * 0.9f; + } + + return InitialRadius; + } + private Vector2 flashlightPosition; protected Vector2 FlashlightPosition From 57cc2f78933fb89c3226c7ab28bc1a3fe6c0e8da Mon Sep 17 00:00:00 2001 From: mk-56 Date: Sun, 16 Jan 2022 14:26:26 +0100 Subject: [PATCH 02/12] Adjustment to size values of FL per mode --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 3 ++- osu.Game/Rulesets/Mods/ModFlashlight.cs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index e5da168dc6..9d9fa5aed4 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -32,7 +32,8 @@ namespace osu.Game.Rulesets.Catch.Mods { private readonly CatchPlayfield playfield; - public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius) : base(isRadiusBasedOnCombo, initialRadius) + public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius) + : base(isRadiusBasedOnCombo, initialRadius) { this.playfield = playfield; FlashlightSize = new Vector2(0, GetRadiusFor(0)); diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index bff0e2f12d..c218ab45fe 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -45,10 +45,10 @@ namespace osu.Game.Rulesets.Mods internal ModFlashlight() { - InitialRadius = new BindableFloat + InitialRadius = new BindableFloat(DefaultRadius) { - MinValue = 90f, - MaxValue = 250f, + MinValue = DefaultRadius * .5f, + MaxValue = DefaultRadius * 1.5f, Precision = 5f, }; From bd308ca38c5afbddbc18cebaa4e8effa1d4cca90 Mon Sep 17 00:00:00 2001 From: mk-56 Date: Mon, 17 Jan 2022 15:15:25 +0100 Subject: [PATCH 03/12] Cleanup --- .../Mods/ManiaModFlashlight.cs | 2 -- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 15 ++------------- .../Mods/TaikoModFlashlight.cs | 1 - 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 676b5f3842..4fff736c57 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -55,5 +55,3 @@ namespace osu.Game.Rulesets.Mania.Mods } } } - - diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index f15527460c..f381d14ffe 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -27,6 +27,8 @@ namespace osu.Game.Rulesets.Osu.Mods private const double default_follow_delay = 120; + + private OsuFlashlight flashlight; public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value); @@ -77,19 +79,6 @@ namespace osu.Game.Rulesets.Osu.Mods return base.OnMouseMove(e); } - private float getSizeFor(int combo) - { - if (ChangeRadius) - { - if (combo > 200) - return InitialRadius * 0.8f; - else if (combo > 100) - return InitialRadius * 0.9f; - } - - return InitialRadius; - } - protected override void OnComboChange(ValueChangedEvent e) { this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 29f29863c0..76f7c45b75 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -48,7 +48,6 @@ namespace osu.Game.Rulesets.Taiko.Mods private Vector2 getSizeFor(int combo) { // Preserve flashlight size through the playfield's aspect adjustment. - // return new Vector2(0, size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); return new Vector2(0, GetRadiusFor(combo) * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); } From 955bab926fac76513a660737a42e48e01cfd9bc0 Mon Sep 17 00:00:00 2001 From: mk-56 Date: Sat, 22 Jan 2022 19:38:56 +0100 Subject: [PATCH 04/12] Separate the settings for each modes radiuses --- .../Mods/CatchModFlashlight.cs | 19 ++++++++-- .../Mods/ManiaModFlashlight.cs | 19 ++++++++-- .../Mods/OsuModFlashlight.cs | 36 ++++++++++++------- .../Mods/TaikoModFlashlight.cs | 19 ++++++++-- osu.Game/Rulesets/Mods/ModFlashlight.cs | 20 ++--------- 5 files changed, 75 insertions(+), 38 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 9d9fa5aed4..f75772b04e 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -3,6 +3,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Configuration; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mods; @@ -15,8 +16,22 @@ namespace osu.Game.Rulesets.Catch.Mods { public override double ScoreMultiplier => 1.12; - public override bool DefaultComboDependency => true; - public override float DefaultRadius => 350; + [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] + public override BindableBool ChangeRadius { get; } = new BindableBool + { + Default = true, + Value = true + }; + + [SettingSource("Initial radius", "Initial radius of the flashlight area.")] + public override BindableNumber InitialRadius { get; } = new BindableNumber + { + MinValue = 150f, + MaxValue = 600f, + Default = 350f, + Value = 350f, + Precision = 5f + }; public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 4fff736c57..a6a3c3be73 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Layout; +using osu.Game.Configuration; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; using osuTK; @@ -16,8 +17,22 @@ namespace osu.Game.Rulesets.Mania.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(ModHidden) }; - public override bool DefaultComboDependency => false; - public override float DefaultRadius => 180; + [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] + public override BindableBool ChangeRadius { get; } = new BindableBool + { + Default = false, + Value = false + }; + + [SettingSource("Initial radius", "Initial radius of the flashlight area.")] + public override BindableNumber InitialRadius { get; } = new BindableNumber + { + MinValue = 0f, + MaxValue = 230f, + Default = 50f, + Value = 50f, + Precision = 5f + }; public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index f381d14ffe..e2a6d0f0dc 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -20,14 +20,32 @@ namespace osu.Game.Rulesets.Osu.Mods { public override double ScoreMultiplier => 1.12; - public override bool DefaultComboDependency => true; - - //private const float default_flashlight_size = 180; - public override float DefaultRadius => 180; - private const double default_follow_delay = 120; + [SettingSource("Follow delay", "Milliseconds until the flashlight reaches the cursor")] + public BindableNumber FollowDelay { get; } = new BindableDouble(default_follow_delay) + { + MinValue = default_follow_delay, + MaxValue = default_follow_delay * 10, + Precision = default_follow_delay, + }; + [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] + public override BindableBool ChangeRadius { get; } = new BindableBool + { + Default = true, + Value = true + }; + + [SettingSource("Initial radius", "Initial radius of the flashlight area.")] + public override BindableNumber InitialRadius { get; } = new BindableNumber + { + MinValue = 90f, + MaxValue = 360f, + Default = 180f, + Value = 180f, + Precision = 5f + }; private OsuFlashlight flashlight; @@ -39,14 +57,6 @@ namespace osu.Game.Rulesets.Osu.Mods s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange; } - [SettingSource("Follow delay", "Milliseconds until the flashlight reaches the cursor")] - public BindableNumber FollowDelay { get; } = new BindableDouble(default_follow_delay) - { - MinValue = default_follow_delay, - MaxValue = default_follow_delay * 10, - Precision = default_follow_delay, - }; - private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { public double FollowDelay { private get; set; } diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 76f7c45b75..71c9d777ec 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -4,6 +4,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Layout; +using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.UI; @@ -16,10 +17,22 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override double ScoreMultiplier => 1.12; - public override bool DefaultComboDependency => true; + [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] + public override BindableBool ChangeRadius { get; } = new BindableBool + { + Default = true, + Value = true + }; - //private const float default_flashlight_size = 250; - public override float DefaultRadius => 250; + [SettingSource("Initial radius", "Initial radius of the flashlight area.")] + public override BindableNumber InitialRadius { get; } = new BindableNumber + { + MinValue = 0f, + MaxValue = 400f, + Default = 250f, + Value = 250f, + Precision = 5f + }; public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index c218ab45fe..51006d96e8 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -34,26 +34,10 @@ namespace osu.Game.Rulesets.Mods public override string Description => "Restricted view area."; [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public Bindable ChangeRadius { get; private set; } + public abstract BindableBool ChangeRadius { get; } [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public BindableNumber InitialRadius { get; private set; } - - public abstract float DefaultRadius { get; } - - public abstract bool DefaultComboDependency { get; } - - internal ModFlashlight() - { - InitialRadius = new BindableFloat(DefaultRadius) - { - MinValue = DefaultRadius * .5f, - MaxValue = DefaultRadius * 1.5f, - Precision = 5f, - }; - - ChangeRadius = new BindableBool(DefaultComboDependency); - } + public abstract BindableNumber InitialRadius { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor From ed84ae0ac0d8f57f66ee7e2360b3259e6a786e2c Mon Sep 17 00:00:00 2001 From: mk-56 Date: Mon, 24 Jan 2022 00:42:43 +0100 Subject: [PATCH 05/12] Adjust values to Bdach's refined taste --- .../Mods/CatchModFlashlight.cs | 22 ++++++++++++------- .../Mods/ManiaModFlashlight.cs | 20 +++++++++++------ .../Mods/OsuModFlashlight.cs | 22 ++++++++++++------- .../Mods/TaikoModFlashlight.cs | 22 ++++++++++++------- osu.Game/Rulesets/Mods/ModFlashlight.cs | 13 +++++++---- 5 files changed, 64 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index f75772b04e..e8f1ebdd10 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -26,14 +26,20 @@ namespace osu.Game.Rulesets.Catch.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public override BindableNumber InitialRadius { get; } = new BindableNumber { - MinValue = 150f, - MaxValue = 600f, - Default = 350f, - Value = 350f, - Precision = 5f + MinValue = 0.4f, + MaxValue = 1.7f, + Default = 1f, + Value = 1f, + Precision = 0.1f }; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); + protected override BindableNumber ModeMultiplier { get; } = new BindableNumber + { + Default = 350, + Value = 350, + }; + + public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); private CatchPlayfield playfield; @@ -47,8 +53,8 @@ namespace osu.Game.Rulesets.Catch.Mods { private readonly CatchPlayfield playfield; - public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius) - : base(isRadiusBasedOnCombo, initialRadius) + public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) + : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) { this.playfield = playfield; FlashlightSize = new Vector2(0, GetRadiusFor(0)); diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index a6a3c3be73..9ca1a72584 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -28,20 +28,26 @@ namespace osu.Game.Rulesets.Mania.Mods public override BindableNumber InitialRadius { get; } = new BindableNumber { MinValue = 0f, - MaxValue = 230f, - Default = 50f, - Value = 50f, - Precision = 5f + MaxValue = 4.5f, + Default = 1f, + Value = 1f, + Precision = 0.1f }; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value); + protected override BindableNumber ModeMultiplier { get; } = new BindableNumber + { + Default = 50, + Value = 50, + }; + + public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); private class ManiaFlashlight : Flashlight { private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); - public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius) - : base(isRadiusBasedOnCombo, initialRadius) + public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) + : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) { FlashlightSize = new Vector2(DrawWidth, GetRadiusFor(0)); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index e2a6d0f0dc..c6cf5ce4b5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -40,16 +40,22 @@ namespace osu.Game.Rulesets.Osu.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public override BindableNumber InitialRadius { get; } = new BindableNumber { - MinValue = 90f, - MaxValue = 360f, - Default = 180f, - Value = 180f, - Precision = 5f + MinValue = 0.5f, + MaxValue = 2f, + Default = 1f, + Value = 1f, + Precision = 0.1f + }; + + protected override BindableNumber ModeMultiplier { get; } = new BindableNumber + { + Default = 180, + Value = 180, }; private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value); + public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, ModeMultiplier.Value); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { @@ -64,8 +70,8 @@ namespace osu.Game.Rulesets.Osu.Mods //public float InitialRadius { private get; set; } public bool ChangeRadius { private get; set; } - public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay) - : base(isRadiusBasedOnCombo, initialRadius) + public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay, float modeMultiplier) + : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) { FollowDelay = followDelay; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 71c9d777ec..f235698b55 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -27,14 +27,20 @@ namespace osu.Game.Rulesets.Taiko.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public override BindableNumber InitialRadius { get; } = new BindableNumber { - MinValue = 0f, - MaxValue = 400f, - Default = 250f, - Value = 250f, - Precision = 5f + MinValue = 0, + MaxValue = 1.66f, + Default = 1f, + Value = 1f, + Precision = 0.1f }; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value); + protected override BindableNumber ModeMultiplier { get; } = new BindableNumber + { + Default = 250, + Value = 250, + }; + + public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); private TaikoPlayfield playfield; @@ -49,8 +55,8 @@ namespace osu.Game.Rulesets.Taiko.Mods private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); private readonly TaikoPlayfield taikoPlayfield; - public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius) - : base(isRadiusBasedOnCombo, initialRadius) + public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) + : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) { this.taikoPlayfield = taikoPlayfield; FlashlightSize = getSizeFor(0); diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 51006d96e8..d16f310582 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -38,6 +38,8 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public abstract BindableNumber InitialRadius { get; } + + protected abstract BindableNumber ModeMultiplier { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor @@ -100,10 +102,13 @@ namespace osu.Game.Rulesets.Mods public readonly float InitialRadius; - protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius) + public readonly float ModeMultiplier; + + protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) { IsRadiusBasedOnCombo = isRadiusBasedOnCombo; InitialRadius = initialRadius; + ModeMultiplier = modeMultiplier; } [BackgroundDependencyLoader] @@ -142,12 +147,12 @@ namespace osu.Game.Rulesets.Mods if (IsRadiusBasedOnCombo) { if (combo > 200) - return InitialRadius * 0.8f; + return InitialRadius * 0.8f * ModeMultiplier; else if (combo > 100) - return InitialRadius * 0.9f; + return InitialRadius * 0.9f * ModeMultiplier; } - return InitialRadius; + return InitialRadius * ModeMultiplier; } private Vector2 flashlightPosition; From 161a2a321ef5ecc93dfeb9d5a99af66f7881be2a Mon Sep 17 00:00:00 2001 From: mk-56 Date: Mon, 24 Jan 2022 09:07:07 +0100 Subject: [PATCH 06/12] Remove bindable from ModeMultiplier --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 8 ++------ osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 8 ++------ osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 8 ++------ osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 8 ++------ osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 +- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index e8f1ebdd10..4fbbf63abf 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -33,13 +33,9 @@ namespace osu.Game.Rulesets.Catch.Mods Precision = 0.1f }; - protected override BindableNumber ModeMultiplier { get; } = new BindableNumber - { - Default = 350, - Value = 350, - }; + protected override float ModeMultiplier => 350; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); + public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); private CatchPlayfield playfield; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 9ca1a72584..61f73a1ee5 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -34,13 +34,9 @@ namespace osu.Game.Rulesets.Mania.Mods Precision = 0.1f }; - protected override BindableNumber ModeMultiplier { get; } = new BindableNumber - { - Default = 50, - Value = 50, - }; + protected override float ModeMultiplier => 50; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); + public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); private class ManiaFlashlight : Flashlight { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index c6cf5ce4b5..75299863a9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -47,15 +47,11 @@ namespace osu.Game.Rulesets.Osu.Mods Precision = 0.1f }; - protected override BindableNumber ModeMultiplier { get; } = new BindableNumber - { - Default = 180, - Value = 180, - }; + protected override float ModeMultiplier => 180; private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, ModeMultiplier.Value); + public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, ModeMultiplier); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index f235698b55..65a173b491 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -34,13 +34,9 @@ namespace osu.Game.Rulesets.Taiko.Mods Precision = 0.1f }; - protected override BindableNumber ModeMultiplier { get; } = new BindableNumber - { - Default = 250, - Value = 250, - }; + protected override float ModeMultiplier => 250; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier.Value); + public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); private TaikoPlayfield playfield; diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index d16f310582..7b980e8097 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public abstract BindableNumber InitialRadius { get; } - protected abstract BindableNumber ModeMultiplier { get; } + protected abstract float ModeMultiplier { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor From 948867898cb36ed2a32ff2e58a6f7c9de64d66d5 Mon Sep 17 00:00:00 2001 From: mk-56 Date: Mon, 24 Jan 2022 11:38:52 +0100 Subject: [PATCH 07/12] ModeMultiplier rename --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 8 ++++---- osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 8 ++++---- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 8 ++++---- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 8 ++++---- osu.Game/Rulesets/Mods/ModFlashlight.cs | 14 ++++++-------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 4fbbf63abf..d48382a9ee 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -33,9 +33,9 @@ namespace osu.Game.Rulesets.Catch.Mods Precision = 0.1f }; - protected override float ModeMultiplier => 350; + protected virtual float DefaultFlashlightSize => 350; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); + public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); private CatchPlayfield playfield; @@ -49,8 +49,8 @@ namespace osu.Game.Rulesets.Catch.Mods { private readonly CatchPlayfield playfield; - public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) - : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) + public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) + : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) { this.playfield = playfield; FlashlightSize = new Vector2(0, GetRadiusFor(0)); diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 61f73a1ee5..eb3f60edce 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -34,16 +34,16 @@ namespace osu.Game.Rulesets.Mania.Mods Precision = 0.1f }; - protected override float ModeMultiplier => 50; + protected virtual float DefaultFlashlightSize => 50; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); + public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); private class ManiaFlashlight : Flashlight { private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); - public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) - : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) + public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) + : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) { FlashlightSize = new Vector2(DrawWidth, GetRadiusFor(0)); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 75299863a9..6a9d199c54 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -47,11 +47,11 @@ namespace osu.Game.Rulesets.Osu.Mods Precision = 0.1f }; - protected override float ModeMultiplier => 180; + protected virtual float DefaultFlashlightSize => 180; private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, ModeMultiplier); + public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, DefaultFlashlightSize); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { @@ -66,8 +66,8 @@ namespace osu.Game.Rulesets.Osu.Mods //public float InitialRadius { private get; set; } public bool ChangeRadius { private get; set; } - public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay, float modeMultiplier) - : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) + public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay, float defaultFlashlightSize) + : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) { FollowDelay = followDelay; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 65a173b491..8de7c859c4 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -34,9 +34,9 @@ namespace osu.Game.Rulesets.Taiko.Mods Precision = 0.1f }; - protected override float ModeMultiplier => 250; + protected virtual float DefaultFlashlightSize => 250; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, ModeMultiplier); + public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); private TaikoPlayfield playfield; @@ -51,8 +51,8 @@ namespace osu.Game.Rulesets.Taiko.Mods private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); private readonly TaikoPlayfield taikoPlayfield; - public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) - : base(isRadiusBasedOnCombo, initialRadius, modeMultiplier) + public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) + : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) { this.taikoPlayfield = taikoPlayfield; FlashlightSize = getSizeFor(0); diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 7b980e8097..531ee92b7a 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Initial radius", "Initial radius of the flashlight area.")] public abstract BindableNumber InitialRadius { get; } - - protected abstract float ModeMultiplier { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor @@ -102,13 +100,13 @@ namespace osu.Game.Rulesets.Mods public readonly float InitialRadius; - public readonly float ModeMultiplier; + public readonly float DefaultFlashlightSize; - protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius, float modeMultiplier) + protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) { IsRadiusBasedOnCombo = isRadiusBasedOnCombo; InitialRadius = initialRadius; - ModeMultiplier = modeMultiplier; + DefaultFlashlightSize = defaultFlashlightSize; } [BackgroundDependencyLoader] @@ -147,12 +145,12 @@ namespace osu.Game.Rulesets.Mods if (IsRadiusBasedOnCombo) { if (combo > 200) - return InitialRadius * 0.8f * ModeMultiplier; + return InitialRadius * 0.8f * DefaultFlashlightSize; else if (combo > 100) - return InitialRadius * 0.9f * ModeMultiplier; + return InitialRadius * 0.9f * DefaultFlashlightSize; } - return InitialRadius * ModeMultiplier; + return InitialRadius * DefaultFlashlightSize; } private Vector2 flashlightPosition; From a7c0d507cefa16343475f5aa73a23d666b6b7446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jan 2022 20:44:25 +0100 Subject: [PATCH 08/12] Rename flashlight settings to be more accurate --- .../Mods/CatchModFlashlight.cs | 20 +++++++++---------- .../Mods/ManiaModFlashlight.cs | 20 +++++++++---------- .../Mods/OsuModFlashlight.cs | 20 +++++++++---------- .../Mods/TaikoModFlashlight.cs | 20 +++++++++---------- osu.Game/Rulesets/Mods/ModFlashlight.cs | 8 ++++---- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index d48382a9ee..e7335dcc34 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -16,15 +16,8 @@ namespace osu.Game.Rulesets.Catch.Mods { public override double ScoreMultiplier => 1.12; - [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public override BindableBool ChangeRadius { get; } = new BindableBool - { - Default = true, - Value = true - }; - - [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public override BindableNumber InitialRadius { get; } = new BindableNumber + [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] + public override BindableNumber SizeMultiplier { get; } = new BindableNumber { MinValue = 0.4f, MaxValue = 1.7f, @@ -33,9 +26,16 @@ namespace osu.Game.Rulesets.Catch.Mods Precision = 0.1f }; + [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] + public override BindableBool ComboBasedSize { get; } = new BindableBool + { + Default = true, + Value = true + }; + protected virtual float DefaultFlashlightSize => 350; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); + public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); private CatchPlayfield playfield; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index eb3f60edce..f89c131fea 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -17,15 +17,8 @@ namespace osu.Game.Rulesets.Mania.Mods public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(ModHidden) }; - [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public override BindableBool ChangeRadius { get; } = new BindableBool - { - Default = false, - Value = false - }; - - [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public override BindableNumber InitialRadius { get; } = new BindableNumber + [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] + public override BindableNumber SizeMultiplier { get; } = new BindableNumber { MinValue = 0f, MaxValue = 4.5f, @@ -34,9 +27,16 @@ namespace osu.Game.Rulesets.Mania.Mods Precision = 0.1f }; + [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] + public override BindableBool ComboBasedSize { get; } = new BindableBool + { + Default = false, + Value = false + }; + protected virtual float DefaultFlashlightSize => 50; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); + public override Flashlight CreateFlashlight() => new ManiaFlashlight(ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); private class ManiaFlashlight : Flashlight { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 6a9d199c54..bc915591d0 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -30,15 +30,8 @@ namespace osu.Game.Rulesets.Osu.Mods Precision = default_follow_delay, }; - [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public override BindableBool ChangeRadius { get; } = new BindableBool - { - Default = true, - Value = true - }; - - [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public override BindableNumber InitialRadius { get; } = new BindableNumber + [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] + public override BindableNumber SizeMultiplier { get; } = new BindableNumber { MinValue = 0.5f, MaxValue = 2f, @@ -47,11 +40,18 @@ namespace osu.Game.Rulesets.Osu.Mods Precision = 0.1f }; + [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] + public override BindableBool ComboBasedSize { get; } = new BindableBool + { + Default = true, + Value = true + }; + protected virtual float DefaultFlashlightSize => 180; private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ChangeRadius.Value, InitialRadius.Value, FollowDelay.Value, DefaultFlashlightSize); + public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ComboBasedSize.Value, SizeMultiplier.Value, FollowDelay.Value, DefaultFlashlightSize); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 8de7c859c4..48e56c8784 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -17,15 +17,8 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override double ScoreMultiplier => 1.12; - [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public override BindableBool ChangeRadius { get; } = new BindableBool - { - Default = true, - Value = true - }; - - [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public override BindableNumber InitialRadius { get; } = new BindableNumber + [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] + public override BindableNumber SizeMultiplier { get; } = new BindableNumber { MinValue = 0, MaxValue = 1.66f, @@ -34,9 +27,16 @@ namespace osu.Game.Rulesets.Taiko.Mods Precision = 0.1f }; + [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] + public override BindableBool ComboBasedSize { get; } = new BindableBool + { + Default = true, + Value = true + }; + protected virtual float DefaultFlashlightSize => 250; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ChangeRadius.Value, InitialRadius.Value, DefaultFlashlightSize); + public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); private TaikoPlayfield playfield; diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 531ee92b7a..d3998bcad4 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -33,11 +33,11 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Restricted view area."; - [SettingSource("Change radius based on combo", "Decrease the flashlight radius as combo increases.")] - public abstract BindableBool ChangeRadius { get; } + [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] + public abstract BindableNumber SizeMultiplier { get; } - [SettingSource("Initial radius", "Initial radius of the flashlight area.")] - public abstract BindableNumber InitialRadius { get; } + [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] + public abstract BindableBool ComboBasedSize { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor From 5874475dffbc5ba6d1bf620d07e026360858a3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jan 2022 20:46:54 +0100 Subject: [PATCH 09/12] Extract `DefaultFlashlightSize` to base flashlight class --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 2 +- osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 2 +- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 2 +- osu.Game/Rulesets/Mods/ModFlashlight.cs | 6 ++++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index e7335dcc34..4c5dcf84d2 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Mods Value = true }; - protected virtual float DefaultFlashlightSize => 350; + public override float DefaultFlashlightSize => 350; public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index f89c131fea..03be00c5db 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Mods Value = false }; - protected virtual float DefaultFlashlightSize => 50; + public override float DefaultFlashlightSize => 50; public override Flashlight CreateFlashlight() => new ManiaFlashlight(ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index bc915591d0..f344bb017e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Mods Value = true }; - protected virtual float DefaultFlashlightSize => 180; + public override float DefaultFlashlightSize => 180; private OsuFlashlight flashlight; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 48e56c8784..576fbb65a0 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Mods Value = true }; - protected virtual float DefaultFlashlightSize => 250; + public override float DefaultFlashlightSize => 250; public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index d3998bcad4..f2fd86d549 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -38,6 +38,12 @@ namespace osu.Game.Rulesets.Mods [SettingSource("Change size based on combo", "Decrease the flashlight size as combo increases.")] public abstract BindableBool ComboBasedSize { get; } + + /// + /// The default size of the flashlight in ruleset-appropriate dimensions. + /// and will apply their adjustments on top of this size. + /// + public abstract float DefaultFlashlightSize { get; } } public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor From a227af75edb70a847aac468c47371bacc4d3d49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jan 2022 20:55:24 +0100 Subject: [PATCH 10/12] Simplify flashlight parameter passing flow --- .../Mods/CatchModFlashlight.cs | 10 +++---- .../Mods/ManiaModFlashlight.cs | 10 +++---- .../Mods/OsuModFlashlight.cs | 19 +++++------- .../Mods/TaikoModFlashlight.cs | 8 ++--- osu.Game/Rulesets/Mods/ModFlashlight.cs | 30 +++++++++---------- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 4c5dcf84d2..6bd914de33 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Mods public override float DefaultFlashlightSize => 350; - public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); + protected override Flashlight CreateFlashlight() => new CatchFlashlight(this, playfield); private CatchPlayfield playfield; @@ -49,11 +49,11 @@ namespace osu.Game.Rulesets.Catch.Mods { private readonly CatchPlayfield playfield; - public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) - : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) + public CatchFlashlight(CatchModFlashlight modFlashlight, CatchPlayfield playfield) + : base(modFlashlight) { this.playfield = playfield; - FlashlightSize = new Vector2(0, GetRadiusFor(0)); + FlashlightSize = new Vector2(0, GetSizeFor(0)); } protected override void Update() @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Mods protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 03be00c5db..def3f8b274 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -36,16 +36,16 @@ namespace osu.Game.Rulesets.Mania.Mods public override float DefaultFlashlightSize => 50; - public override Flashlight CreateFlashlight() => new ManiaFlashlight(ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); + protected override Flashlight CreateFlashlight() => new ManiaFlashlight(this); private class ManiaFlashlight : Flashlight { private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); - public ManiaFlashlight(bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) - : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) + public ManiaFlashlight(ManiaModFlashlight modFlashlight) + : base(modFlashlight) { - FlashlightSize = new Vector2(DrawWidth, GetRadiusFor(0)); + FlashlightSize = new Vector2(DrawWidth, GetSizeFor(0)); AddLayout(flashlightProperties); } @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Mania.Mods protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(DrawWidth, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(DrawWidth, GetSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "RectangularFlashlight"; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index f344bb017e..b4eff57c55 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.Mods private OsuFlashlight flashlight; - public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(ComboBasedSize.Value, SizeMultiplier.Value, FollowDelay.Value, DefaultFlashlightSize); + protected override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight(this); public void ApplyToDrawableHitObject(DrawableHitObject drawable) { @@ -61,17 +61,14 @@ namespace osu.Game.Rulesets.Osu.Mods private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { - public double FollowDelay { private get; set; } + private readonly double followDelay; - //public float InitialRadius { private get; set; } - public bool ChangeRadius { private get; set; } - - public OsuFlashlight(bool isRadiusBasedOnCombo, float initialRadius, double followDelay, float defaultFlashlightSize) - : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) + public OsuFlashlight(OsuModFlashlight modFlashlight) + : base(modFlashlight) { - FollowDelay = followDelay; + followDelay = modFlashlight.FollowDelay.Value; - FlashlightSize = new Vector2(0, GetRadiusFor(0)); + FlashlightSize = new Vector2(0, GetSizeFor(0)); } public void OnSliderTrackingChange(ValueChangedEvent e) @@ -86,14 +83,14 @@ namespace osu.Game.Rulesets.Osu.Mods var destination = e.MousePosition; FlashlightPosition = Interpolation.ValueAt( - Math.Min(Math.Abs(Clock.ElapsedFrameTime), FollowDelay), position, destination, 0, FollowDelay, Easing.Out); + Math.Min(Math.Abs(Clock.ElapsedFrameTime), followDelay), position, destination, 0, followDelay, Easing.Out); return base.OnMouseMove(e); } protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 576fbb65a0..84444dded9 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Mods public override float DefaultFlashlightSize => 250; - public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize); + protected override Flashlight CreateFlashlight() => new TaikoFlashlight(this, playfield); private TaikoPlayfield playfield; @@ -51,8 +51,8 @@ namespace osu.Game.Rulesets.Taiko.Mods private readonly LayoutValue flashlightProperties = new LayoutValue(Invalidation.DrawSize); private readonly TaikoPlayfield taikoPlayfield; - public TaikoFlashlight(TaikoPlayfield taikoPlayfield, bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) - : base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize) + public TaikoFlashlight(TaikoModFlashlight modFlashlight, TaikoPlayfield taikoPlayfield) + : base(modFlashlight) { this.taikoPlayfield = taikoPlayfield; FlashlightSize = getSizeFor(0); @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Mods private Vector2 getSizeFor(int combo) { // Preserve flashlight size through the playfield's aspect adjustment. - return new Vector2(0, GetRadiusFor(combo) * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); + return new Vector2(0, GetSizeFor(combo) * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT); } protected override void OnComboChange(ValueChangedEvent e) diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index f2fd86d549..e6487c6b29 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Mods flashlight.Breaks = drawableRuleset.Beatmap.Breaks; } - public abstract Flashlight CreateFlashlight(); + protected abstract Flashlight CreateFlashlight(); public abstract class Flashlight : Drawable { @@ -102,17 +102,15 @@ namespace osu.Game.Rulesets.Mods public List Breaks; - public readonly bool IsRadiusBasedOnCombo; + private readonly float defaultFlashlightSize; + private readonly float sizeMultiplier; + private readonly bool comboBasedSize; - public readonly float InitialRadius; - - public readonly float DefaultFlashlightSize; - - protected Flashlight(bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize) + protected Flashlight(ModFlashlight modFlashlight) { - IsRadiusBasedOnCombo = isRadiusBasedOnCombo; - InitialRadius = initialRadius; - DefaultFlashlightSize = defaultFlashlightSize; + defaultFlashlightSize = modFlashlight.DefaultFlashlightSize; + sizeMultiplier = modFlashlight.SizeMultiplier.Value; + comboBasedSize = modFlashlight.ComboBasedSize.Value; } [BackgroundDependencyLoader] @@ -146,17 +144,19 @@ namespace osu.Game.Rulesets.Mods protected abstract string FragmentShader { get; } - protected float GetRadiusFor(int combo) + protected float GetSizeFor(int combo) { - if (IsRadiusBasedOnCombo) + float size = defaultFlashlightSize * sizeMultiplier; + + if (comboBasedSize) { if (combo > 200) - return InitialRadius * 0.8f * DefaultFlashlightSize; + size *= 0.8f; else if (combo > 100) - return InitialRadius * 0.9f * DefaultFlashlightSize; + size *= 0.9f; } - return InitialRadius * DefaultFlashlightSize; + return size; } private Vector2 flashlightPosition; From 4a13c93ca7e98c89ba5938c89c1e00a2856c08c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jan 2022 20:56:59 +0100 Subject: [PATCH 11/12] Disallow zero size multiplier in flashlight implementations --- osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 2 +- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index def3f8b274..60de063b24 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mania.Mods [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] public override BindableNumber SizeMultiplier { get; } = new BindableNumber { - MinValue = 0f, + MinValue = 0.1f, MaxValue = 4.5f, Default = 1f, Value = 1f, diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 84444dded9..bdb30e9ded 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Mods [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] public override BindableNumber SizeMultiplier { get; } = new BindableNumber { - MinValue = 0, + MinValue = 0.1f, MaxValue = 1.66f, Default = 1f, Value = 1f, From 2375420d4cbce1372fd2848b7de799bee2f281b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jan 2022 21:16:10 +0100 Subject: [PATCH 12/12] Tweak allowable ranges of size multiplier --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 4 ++-- osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 4 ++-- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 6bd914de33..2d92c925d7 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Catch.Mods [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] public override BindableNumber SizeMultiplier { get; } = new BindableNumber { - MinValue = 0.4f, - MaxValue = 1.7f, + MinValue = 0.5f, + MaxValue = 1.5f, Default = 1f, Value = 1f, Precision = 0.1f diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 60de063b24..1ee4ea12e3 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Mania.Mods [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] public override BindableNumber SizeMultiplier { get; } = new BindableNumber { - MinValue = 0.1f, - MaxValue = 4.5f, + MinValue = 0.5f, + MaxValue = 3f, Default = 1f, Value = 1f, Precision = 0.1f diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index bdb30e9ded..fb07c687bb 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Taiko.Mods [SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")] public override BindableNumber SizeMultiplier { get; } = new BindableNumber { - MinValue = 0.1f, - MaxValue = 1.66f, + MinValue = 0.5f, + MaxValue = 1.5f, Default = 1f, Value = 1f, Precision = 0.1f