Skip to content

Commit

Permalink
Attempt to standardise miss handling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 20, 2023
1 parent fcf4726 commit eb8fb80
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 22 deletions.
16 changes: 8 additions & 8 deletions osu.Game.Rulesets.Osu/Skinning/Argon/ArgonJudgementPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ protected override SpriteText CreateJudgementText() =>
/// </remarks>
public virtual void PlayAnimation()
{
if (Result.IsHit())
{
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
}
else
if (Result.IsMiss())
{
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
Expand All @@ -80,6 +73,13 @@ public virtual void PlayAnimation()
this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);
}
else
{
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
}

this.FadeOutFromOne(800);

Expand Down
19 changes: 19 additions & 0 deletions osu.Game/Rulesets/Scoring/HitResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,25 @@ public static bool IsBonus(this HitResult result)
}
}

/// <summary>
/// Whether a <see cref="HitResult"/> represents a miss of any type.
/// </summary>
public static bool IsMiss(this HitResult result)
{
switch (result)
{
case HitResult.IgnoreMiss:
case HitResult.Miss:
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
case HitResult.ComboBreak:
return true;

default:
return false;
}
}

/// <summary>
/// Whether a <see cref="HitResult"/> represents a successful hit.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Skinning/LegacyJudgementPieceNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public LegacyJudgementPieceNew(HitResult result, Func<Drawable> createMainDrawab
});
}

if (result.IsHit())
if (!result.IsMiss())
{
//new judgement shows old as a temporary effect
AddInternal(temporaryOldStyle = new LegacyJudgementPieceOld(result, createMainDrawable, 1.05f, true)
Expand Down
24 changes: 12 additions & 12 deletions osu.Game/Skinning/LegacyJudgementPieceOld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,7 @@ public virtual void PlayAnimation()
if (animation?.FrameCount > 1 && !forceTransforms)
return;

if (result.IsHit())
{
this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2
// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.
// so we need to force the current value to be correct at 1.2 (0.95) then complete the
// second half of the transform.
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
}
else
if (result.IsMiss())
{
bool isTick = result != HitResult.Miss;

Expand Down Expand Up @@ -92,6 +81,17 @@ public virtual void PlayAnimation()
.Then().RotateTo(rotation * 2, fade_out_delay + fade_out_length - fade_in_length, Easing.In);
}
}
else
{
this.ScaleTo(0.6f).Then()
.ScaleTo(1.1f, fade_in_length * 0.8f).Then() // t = 0.8
.Delay(fade_in_length * 0.2f) // t = 1.0
.ScaleTo(0.9f, fade_in_length * 0.2f).Then() // t = 1.2
// stable dictates scale of 0.9->1 over time 1.0 to 1.4, but we are already at 1.2.

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 90 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
// so we need to force the current value to be correct at 1.2 (0.95) then complete the

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 91 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
// second half of the transform.

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 92 in osu.Game/Skinning/LegacyJudgementPieceOld.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting
.ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4
}
}

public Drawable GetAboveHitObjectsProxiedContent() => CreateProxy();
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Skinning/LegacySkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ protected override void ParseConfigurationStream(Stream stream)

private Drawable? getJudgementAnimation(HitResult result)
{
if (!result.IsHit())
if (result.IsMiss())
return this.GetAnimation("hit0", true, false);

switch (result)
Expand Down

0 comments on commit eb8fb80

Please sign in to comment.