mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Merge pull request #20566 from smoogipoo/adjust-flashlight
Adjust flashlight to more closely match classic scaling
This commit is contained in:
commit
e0c66dbdbc
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
|
||||
public override BindableBool ComboBasedSize { get; } = new BindableBool(true);
|
||||
|
||||
public override float DefaultFlashlightSize => 350;
|
||||
public override float DefaultFlashlightSize => 325;
|
||||
|
||||
protected override Flashlight CreateFlashlight() => new CatchFlashlight(this, playfield);
|
||||
|
||||
@ -44,7 +44,19 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
: base(modFlashlight)
|
||||
{
|
||||
this.playfield = playfield;
|
||||
|
||||
FlashlightSize = new Vector2(0, GetSizeFor(0));
|
||||
FlashlightSmoothness = 1.4f;
|
||||
}
|
||||
|
||||
protected override float GetComboScaleFor(int combo)
|
||||
{
|
||||
if (combo >= 200)
|
||||
return 0.770f;
|
||||
if (combo >= 100)
|
||||
return 0.885f;
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public override BindableBool ComboBasedSize { get; } = new BindableBool(true);
|
||||
|
||||
public override float DefaultFlashlightSize => 180;
|
||||
public override float DefaultFlashlightSize => 200;
|
||||
|
||||
private OsuFlashlight flashlight = null!;
|
||||
|
||||
@ -63,6 +63,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
followDelay = modFlashlight.FollowDelay.Value;
|
||||
|
||||
FlashlightSize = new Vector2(0, GetSizeFor(0));
|
||||
FlashlightSmoothness = 1.4f;
|
||||
}
|
||||
|
||||
public void OnSliderTrackingChange(ValueChangedEvent<bool> e)
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
|
||||
public override BindableBool ComboBasedSize { get; } = new BindableBool(true);
|
||||
|
||||
public override float DefaultFlashlightSize => 250;
|
||||
public override float DefaultFlashlightSize => 200;
|
||||
|
||||
protected override Flashlight CreateFlashlight() => new TaikoFlashlight(this, playfield);
|
||||
|
||||
@ -46,7 +46,9 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
: base(modFlashlight)
|
||||
{
|
||||
this.taikoPlayfield = taikoPlayfield;
|
||||
|
||||
FlashlightSize = getSizeFor(0);
|
||||
FlashlightSmoothness = 1.4f;
|
||||
|
||||
AddLayout(flashlightProperties);
|
||||
}
|
||||
|
@ -149,16 +149,21 @@ namespace osu.Game.Rulesets.Mods
|
||||
float size = defaultFlashlightSize * sizeMultiplier;
|
||||
|
||||
if (comboBasedSize)
|
||||
{
|
||||
if (combo >= 200)
|
||||
size *= 0.8f;
|
||||
else if (combo >= 100)
|
||||
size *= 0.9f;
|
||||
}
|
||||
size *= GetComboScaleFor(combo);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
protected virtual float GetComboScaleFor(int combo)
|
||||
{
|
||||
if (combo >= 200)
|
||||
return 0.625f;
|
||||
if (combo >= 100)
|
||||
return 0.8125f;
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
private Vector2 flashlightPosition;
|
||||
|
||||
protected Vector2 FlashlightPosition
|
||||
@ -201,6 +206,20 @@ namespace osu.Game.Rulesets.Mods
|
||||
}
|
||||
}
|
||||
|
||||
private float flashlightSmoothness = 1.1f;
|
||||
|
||||
public float FlashlightSmoothness
|
||||
{
|
||||
get => flashlightSmoothness;
|
||||
set
|
||||
{
|
||||
if (flashlightSmoothness == value) return;
|
||||
|
||||
flashlightSmoothness = value;
|
||||
Invalidate(Invalidation.DrawNode);
|
||||
}
|
||||
}
|
||||
|
||||
private class FlashlightDrawNode : DrawNode
|
||||
{
|
||||
protected new Flashlight Source => (Flashlight)base.Source;
|
||||
@ -210,6 +229,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
private Vector2 flashlightPosition;
|
||||
private Vector2 flashlightSize;
|
||||
private float flashlightDim;
|
||||
private float flashlightSmoothness;
|
||||
|
||||
private IVertexBatch<PositionAndColourVertex>? quadBatch;
|
||||
private Action<TexturedVertex2D>? addAction;
|
||||
@ -228,6 +248,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
flashlightPosition = Vector2Extensions.Transform(Source.FlashlightPosition, DrawInfo.Matrix);
|
||||
flashlightSize = Source.FlashlightSize * DrawInfo.Matrix.ExtractScale().Xy;
|
||||
flashlightDim = Source.FlashlightDim;
|
||||
flashlightSmoothness = Source.flashlightSmoothness;
|
||||
}
|
||||
|
||||
public override void Draw(IRenderer renderer)
|
||||
@ -249,6 +270,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
shader.GetUniform<Vector2>("flashlightPos").UpdateValue(ref flashlightPosition);
|
||||
shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref flashlightSize);
|
||||
shader.GetUniform<float>("flashlightDim").UpdateValue(ref flashlightDim);
|
||||
shader.GetUniform<float>("flashlightSmoothness").UpdateValue(ref flashlightSmoothness);
|
||||
|
||||
renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user