mirror of
https://github.com/ppy/osu
synced 2025-02-02 11:21:59 +00:00
Merge pull request #20756 from goodtrailer/smoke-rotation-fix
Fix smoke shaking when gameplay is paused
This commit is contained in:
commit
b72c117333
@ -14,6 +14,7 @@ using osu.Framework.Graphics.Rendering.Vertices;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -185,6 +186,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
private float radius;
|
||||
private Vector2 drawSize;
|
||||
private Texture? texture;
|
||||
private int rotationSeed;
|
||||
private int rotationIndex;
|
||||
|
||||
// anim calculation vars (color, scale, direction)
|
||||
private double initialFadeOutDurationTrunc;
|
||||
@ -194,8 +197,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
private double reFadeInTime;
|
||||
private double finalFadeOutTime;
|
||||
|
||||
private Random rotationRNG = new Random();
|
||||
|
||||
public SmokeDrawNode(ITexturedShaderDrawable source)
|
||||
: base(source)
|
||||
{
|
||||
@ -216,7 +217,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
SmokeEndTime = Source.smokeEndTime;
|
||||
CurrentTime = Source.Clock.CurrentTime;
|
||||
|
||||
rotationRNG = new Random(Source.rotationSeed);
|
||||
rotationSeed = Source.rotationSeed;
|
||||
|
||||
initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime);
|
||||
firstVisiblePointTime = SmokeEndTime - initialFadeOutDurationTrunc;
|
||||
@ -233,6 +234,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
if (points.Count == 0)
|
||||
return;
|
||||
|
||||
rotationIndex = 0;
|
||||
|
||||
quadBatch ??= renderer.CreateQuadBatch<TexturedVertex2D>(max_point_count / 10, 10);
|
||||
texture ??= renderer.WhitePixel;
|
||||
RectangleF textureRect = texture.GetTextureRect();
|
||||
@ -311,7 +314,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
return new Vector2(MathF.Sin(angle), -MathF.Cos(angle));
|
||||
}
|
||||
|
||||
private float nextRotation() => max_rotation * ((float)rotationRNG.NextDouble() * 2 - 1);
|
||||
private float nextRotation() => max_rotation * (StatelessRNG.NextSingle(rotationSeed, rotationIndex++) * 2 - 1);
|
||||
|
||||
private void drawPointQuad(SmokePoint point, RectangleF textureRect)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user