Merge pull request #29841 from bdach/replay-analysis-mod-woes

Fix several issues in interactions between playfield-altering mods and the replay analysis feature
This commit is contained in:
Dean Herbert 2024-09-12 13:52:09 +09:00 committed by GitHub
commit a8365202d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View File

@ -44,7 +44,9 @@ private void load(ReplayPlayer? replayPlayer)
{
if (replayPlayer != null)
{
PlayfieldAdjustmentContainer.Add(new ReplayAnalysisOverlay(replayPlayer.Score.Replay));
ReplayAnalysisOverlay analysisOverlay;
PlayfieldAdjustmentContainer.Add(analysisOverlay = new ReplayAnalysisOverlay(replayPlayer.Score.Replay));
Overlays.Add(analysisOverlay.CreateProxy().With(p => p.Depth = float.NegativeInfinity));
replayPlayer.AddSettings(new ReplayAnalysisSettings(Config));
cursorHideEnabled = Config.GetBindable<bool>(OsuRulesetSetting.ReplayCursorHideEnabled);

View File

@ -40,9 +40,11 @@ public abstract class ModBarrelRoll<TObject> : Mod, IUpdatableByPlayfield, IAppl
public override string SettingDescription => $"{SpinSpeed.Value:N2} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
private PlayfieldAdjustmentContainer playfieldAdjustmentContainer = null!;
public void Update(Playfield playfield)
{
playfield.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
playfieldAdjustmentContainer.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
@ -52,7 +54,9 @@ public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
var playfieldSize = drawableRuleset.Playfield.DrawSize;
float minSide = MathF.Min(playfieldSize.X, playfieldSize.Y);
float maxSide = MathF.Max(playfieldSize.X, playfieldSize.Y);
drawableRuleset.Playfield.Scale = new Vector2(minSide / maxSide);
playfieldAdjustmentContainer = drawableRuleset.PlayfieldAdjustmentContainer;
playfieldAdjustmentContainer.Scale = new Vector2(minSide / maxSide);
}
}
}

View File

@ -83,8 +83,6 @@ public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
flashlight.RelativeSizeAxes = Axes.Both;
flashlight.Colour = Color4.Black;
// Flashlight mods should always draw above any other mod adding overlays.
flashlight.Depth = float.MinValue;
flashlight.Combo.BindTo(Combo);
flashlight.GetPlayfieldScale = () => drawableRuleset.Playfield.Scale;
@ -95,6 +93,9 @@ public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
// workaround for 1px gaps on the edges of the playfield which would sometimes show with "gameplay" screen scaling active.
Padding = new MarginPadding(-1),
Child = flashlight,
// Flashlight mods should always draw above any other mod adding overlays.
// NegativeInfinity is not used to allow one more thing drawn on top (used in replay analysis overlay in osu!).
Depth = float.MinValue,
});
}