Skip to content

Commit

Permalink
Fix kiai stars flickering on and off during gameplay
Browse files Browse the repository at this point in the history
Closes ppy#24503.

The problematic reset of `lastParticleAdded` has been moved to a place
that should hopefully (a) not cause such problems and (b) be much more
explicit about what's happening.
  • Loading branch information
bdach committed Aug 15, 2023
1 parent 31c31a9 commit ab1d523
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions osu.Game/Graphics/ParticleSpewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,27 @@ protected ParticleSpewer(Texture texture, int perSecond, double maxDuration)
this.maxDuration = maxDuration;
}

protected override void LoadComplete()
{
base.LoadComplete();

Active.BindValueChanged(active =>
{
// ensure that particles can be spawned immediately after the spewer becomes active.
if (active.NewValue)
lastParticleAdded = null;
});
}

protected override void Update()
{
base.Update();

Invalidate(Invalidation.DrawNode);

if (!Active.Value || !CanSpawnParticles)
{
lastParticleAdded = null;
return;
}

// Always want to spawn the first particle in an activation immediately.
if (lastParticleAdded == null)
{
lastParticleAdded = Time.Current;
Expand Down

0 comments on commit ab1d523

Please sign in to comment.