Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several issues in interactions between playfield-altering mods and the replay analysis feature #29841

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions osu.Game/Rulesets/Mods/ModBarrelRoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
}
5 changes: 3 additions & 2 deletions osu.Game/Rulesets/Mods/ModFlashlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
});
}

Expand Down
Loading