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.
This commit is contained in:
Bartłomiej Dach 2024-02-26 10:37:03 +01:00
parent 75b9d0fe66
commit 115d82664b
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -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.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 @@ public float GetSize()
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)