From 4d1ecab4e321c57ade3a2c3a1cfb1c2e63c42a0d Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 16 Aug 2025 04:54:34 -0700 Subject: [PATCH] Map sliderpoint textures directly to HitResult types --- .../LegacyJudgementPieceSliderTickHit.cs | 21 +--------------- .../Legacy/OsuLegacySkinTransformer.cs | 25 +++++++++++-------- .../Rulesets/Judgements/DrawableJudgement.cs | 3 --- .../Judgements/IAppliesJudgementResult.cs | 16 ------------ 4 files changed, 16 insertions(+), 49 deletions(-) delete mode 100644 osu.Game/Rulesets/Judgements/IAppliesJudgementResult.cs diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyJudgementPieceSliderTickHit.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyJudgementPieceSliderTickHit.cs index 81f7ea5d9e..8c89f4c9c8 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyJudgementPieceSliderTickHit.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyJudgementPieceSliderTickHit.cs @@ -1,34 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Skinning; using osuTK; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { - public partial class LegacyJudgementPieceSliderTickHit : Sprite, IAnimatableJudgement, IAppliesJudgementResult + public partial class LegacyJudgementPieceSliderTickHit : Sprite, IAnimatableJudgement { - private Texture? texture10; - private Texture? texture30; - - [BackgroundDependencyLoader] - private void load(ISkinSource skin) - { - texture10 = skin.GetTexture("sliderpoint10"); - texture30 = skin.GetTexture("sliderpoint30"); - } - - public void ApplyJudgementResult(JudgementResult result) - { - Texture = result.HitObject is SliderTick ? texture10 : texture30; - } - public void PlayAnimation() { // https://github.com/peppy/osu-stable-reference/blob/0e91e49bc83fe8b21c3ba5f1eb2d5d06456eae84/osu!/GameModes/Play/Rulesets/Ruleset.cs#L804-L806 diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index 44b2cb484a..69e9cd00d5 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play.HUD; @@ -119,18 +120,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy case SkinComponentLookup resultComponent: switch (resultComponent.Component) { - // osu!stable didn't show slider points on the tail, since that's where the slider judgement was shown. Here, sliderpoint30 will be shown on non-classic tails via SliderTailHit. case HitResult.LargeTickHit: case HitResult.SliderTailHit: - if (hasSliderPoints()) - return new LegacyJudgementPieceSliderTickHit(); + if (getSliderPointTexture(resultComponent.Component) is Texture texture) + return new LegacyJudgementPieceSliderTickHit { Texture = texture }; return base.GetDrawableComponent(lookup); - // If slider points are showing and tick misses aren't provided by this skin, don't look up tick misses from any further skins. + // If the corresponding hit result displays a judgement and the miss texture isn't provided by this skin, don't look up the miss texture from any further skins. case HitResult.LargeTickMiss: case HitResult.IgnoreMiss: - if (hasSliderPoints()) + if (getSliderPointTexture(resultComponent.Component == HitResult.LargeTickMiss + ? HitResult.LargeTickHit + : HitResult.SliderTailHit) != null) return base.GetDrawableComponent(lookup) ?? Drawable.Empty(); return base.GetDrawableComponent(lookup); @@ -139,12 +141,15 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy return base.GetDrawableComponent(lookup); } - bool hasSliderPoints() => + Texture? getSliderPointTexture(HitResult result) + { // https://github.com/peppy/osu-stable-reference/blob/0e91e49bc83fe8b21c3ba5f1eb2d5d06456eae84/osu!/GameModes/Play/Rulesets/Ruleset.cs#L799 - GetConfig(SkinConfiguration.LegacySetting.Version)?.Value < 2m - // Note that osu!stable didn't require both sliderpoint textures to be present like this. There's not enough information in the lookup to decide which of the textures should be used, so we can't handle them separately. The hope is that this won't break many skins because it'd be very odd to customise only one of these textures. - && GetTexture("sliderpoint10") != null - && GetTexture("sliderpoint30") != null; + if (GetConfig(SkinConfiguration.LegacySetting.Version)?.Value < 2m) + // Note that osu!stable used sliderpoint30 for heads and repeats, and sliderpoint10 for ticks, but the mapping is intentionally changed here so that each texture represents one type of HitResult. + return GetTexture(result == HitResult.LargeTickHit ? "sliderpoint30" : "sliderpoint10"); + + return null; + } case OsuSkinComponentLookup osuComponent: switch (osuComponent.Component) diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 36a7183766..3e70f52ee7 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -89,9 +89,6 @@ namespace osu.Game.Rulesets.Judgements { Result = result; JudgedHitObject = judgedObject?.HitObject; - - if (JudgementBody?.Drawable is IAppliesJudgementResult appliesResult) - appliesResult.ApplyJudgementResult(Result); } protected override void FreeAfterUse() diff --git a/osu.Game/Rulesets/Judgements/IAppliesJudgementResult.cs b/osu.Game/Rulesets/Judgements/IAppliesJudgementResult.cs deleted file mode 100644 index fc58e95ba5..0000000000 --- a/osu.Game/Rulesets/Judgements/IAppliesJudgementResult.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace osu.Game.Rulesets.Judgements -{ - /// - /// A skinnable judgement element which requires the full . - /// - public interface IAppliesJudgementResult - { - /// - /// Associate a result with this judgement element. - /// - void ApplyJudgementResult(JudgementResult result); - } -}