From 115d82664bb0a3271e7593dacce987557a2ff098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 26 Feb 2024 10:37:03 +0100 Subject: [PATCH] Assert proportional scaling rather than assume average Because if scaling is ever actually non-proportional then this should be somewhat loud. Also use the absolute value to prevent funny things happening if/when someone does negative scale. --- osu.Game/Rulesets/Mods/ModFlashlight.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index d714cd3c85..144842def0 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using System.Runtime.InteropServices; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -13,6 +14,7 @@ using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Shaders.Types; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; +using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.OpenGL.Vertices; @@ -151,9 +153,10 @@ namespace osu.Game.Rulesets.Mods if (GetPlayfieldScale != null) { Vector2 playfieldScale = GetPlayfieldScale(); - float rulesetScaleAvg = (playfieldScale.X + playfieldScale.Y) / 2f; - size *= rulesetScaleAvg; + Debug.Assert(Precision.AlmostEquals(Math.Abs(playfieldScale.X), Math.Abs(playfieldScale.Y)), + @"Playfield has non-proportional scaling. Flashlight implementations should be revisited with regard to balance."); + size *= Math.Abs(playfieldScale.X); } if (isBreakTime.Value)