Skip to content

Commit

Permalink
Fix legacy mania note body animation not resetting sometimes
Browse files Browse the repository at this point in the history
Hopefully closes #28284.

As far as I can tell this is a somewhat difficult one to reproduce
because it relies on a specific set of circumstances (at least the
reproduction case that I found does). The reset to frame 0 would
previously be called explicitly when `isHitting` changed:

    https://github.com/ppy/osu/blob/182ca145c78432f4b832c8ea407e107dfeaaa8ad/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs#L144

However, it can be the case that `bodyAnimation` is not loaded at the
point of this call. This is significant because
`SkinnableTextureAnimation` contains this logic:

    https://github.com/ppy/osu/blob/182ca145c78432f4b832c8ea407e107dfeaaa8ad/osu.Game/Skinning/LegacySkinExtensions.cs#L192-L211

which cannot be moved any earlier (because any earlier the `Clock` may
no longer be correct), and also causes the animation to be seeked
forward while it is stopped.

I can't figure out a decent way to layer this otherwise (by scheduling
or whatever), so this commit is just applying the nuclear option of just
seeking back to frame 0 on every update frame in which the body piece is
not being hit.
  • Loading branch information
bdach committed May 28, 2024
1 parent 182ca14 commit bf00404
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyBodyPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ private void applyCustomUpdateState(DrawableHitObject hitObject, ArmedState stat
private void onIsHittingChanged(ValueChangedEvent<bool> isHitting)
{
if (bodySprite is TextureAnimation bodyAnimation)
{
bodyAnimation.GotoFrame(0);
bodyAnimation.IsPlaying = isHitting.NewValue;
}

if (lightContainer == null)
return;
Expand Down Expand Up @@ -219,6 +216,9 @@ protected override void Update()
{
base.Update();

if (!isHitting.Value)
(bodySprite as TextureAnimation)?.GotoFrame(0);

if (holdNote.Body.HasHoldBreak)
missFadeTime.Value = holdNote.Body.Result.TimeAbsolute;

Expand Down

0 comments on commit bf00404

Please sign in to comment.