Skip to content

Commit

Permalink
Fix replay analysis overlay not rotating with Barrel Roll enabled
Browse files Browse the repository at this point in the history
Closes ppy#29839.
  • Loading branch information
bdach committed Sep 11, 2024
1 parent b78ef81 commit 4a39873
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 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,8 @@ 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));
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);
}
}
}

0 comments on commit 4a39873

Please sign in to comment.