1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge pull request #20566 from smoogipoo/adjust-flashlight

Adjust flashlight to more closely match classic scaling
This commit is contained in:
Dean Herbert 2022-10-07 15:23:42 +09:00 committed by GitHub
commit e0c66dbdbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 9 deletions

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Mods
public override BindableBool ComboBasedSize { get; } = new BindableBool(true); 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); protected override Flashlight CreateFlashlight() => new CatchFlashlight(this, playfield);
@ -44,7 +44,19 @@ namespace osu.Game.Rulesets.Catch.Mods
: base(modFlashlight) : base(modFlashlight)
{ {
this.playfield = playfield; this.playfield = playfield;
FlashlightSize = new Vector2(0, GetSizeFor(0)); 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() protected override void Update()

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override BindableBool ComboBasedSize { get; } = new BindableBool(true); public override BindableBool ComboBasedSize { get; } = new BindableBool(true);
public override float DefaultFlashlightSize => 180; public override float DefaultFlashlightSize => 200;
private OsuFlashlight flashlight = null!; private OsuFlashlight flashlight = null!;
@ -63,6 +63,7 @@ namespace osu.Game.Rulesets.Osu.Mods
followDelay = modFlashlight.FollowDelay.Value; followDelay = modFlashlight.FollowDelay.Value;
FlashlightSize = new Vector2(0, GetSizeFor(0)); FlashlightSize = new Vector2(0, GetSizeFor(0));
FlashlightSmoothness = 1.4f;
} }
public void OnSliderTrackingChange(ValueChangedEvent<bool> e) public void OnSliderTrackingChange(ValueChangedEvent<bool> e)

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
public override BindableBool ComboBasedSize { get; } = new BindableBool(true); 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); protected override Flashlight CreateFlashlight() => new TaikoFlashlight(this, playfield);
@ -46,7 +46,9 @@ namespace osu.Game.Rulesets.Taiko.Mods
: base(modFlashlight) : base(modFlashlight)
{ {
this.taikoPlayfield = taikoPlayfield; this.taikoPlayfield = taikoPlayfield;
FlashlightSize = getSizeFor(0); FlashlightSize = getSizeFor(0);
FlashlightSmoothness = 1.4f;
AddLayout(flashlightProperties); AddLayout(flashlightProperties);
} }

View File

@ -149,16 +149,21 @@ namespace osu.Game.Rulesets.Mods
float size = defaultFlashlightSize * sizeMultiplier; float size = defaultFlashlightSize * sizeMultiplier;
if (comboBasedSize) if (comboBasedSize)
{ size *= GetComboScaleFor(combo);
if (combo >= 200)
size *= 0.8f;
else if (combo >= 100)
size *= 0.9f;
}
return size; 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; private Vector2 flashlightPosition;
protected 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 private class FlashlightDrawNode : DrawNode
{ {
protected new Flashlight Source => (Flashlight)base.Source; protected new Flashlight Source => (Flashlight)base.Source;
@ -210,6 +229,7 @@ namespace osu.Game.Rulesets.Mods
private Vector2 flashlightPosition; private Vector2 flashlightPosition;
private Vector2 flashlightSize; private Vector2 flashlightSize;
private float flashlightDim; private float flashlightDim;
private float flashlightSmoothness;
private IVertexBatch<PositionAndColourVertex>? quadBatch; private IVertexBatch<PositionAndColourVertex>? quadBatch;
private Action<TexturedVertex2D>? addAction; private Action<TexturedVertex2D>? addAction;
@ -228,6 +248,7 @@ namespace osu.Game.Rulesets.Mods
flashlightPosition = Vector2Extensions.Transform(Source.FlashlightPosition, DrawInfo.Matrix); flashlightPosition = Vector2Extensions.Transform(Source.FlashlightPosition, DrawInfo.Matrix);
flashlightSize = Source.FlashlightSize * DrawInfo.Matrix.ExtractScale().Xy; flashlightSize = Source.FlashlightSize * DrawInfo.Matrix.ExtractScale().Xy;
flashlightDim = Source.FlashlightDim; flashlightDim = Source.FlashlightDim;
flashlightSmoothness = Source.flashlightSmoothness;
} }
public override void Draw(IRenderer renderer) 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>("flashlightPos").UpdateValue(ref flashlightPosition);
shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref flashlightSize); shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref flashlightSize);
shader.GetUniform<float>("flashlightDim").UpdateValue(ref flashlightDim); shader.GetUniform<float>("flashlightDim").UpdateValue(ref flashlightDim);
shader.GetUniform<float>("flashlightSmoothness").UpdateValue(ref flashlightSmoothness);
renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction); renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);