Skip to content

Commit

Permalink
Merge branch 'master' into freestyle-mods
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Feb 12, 2025
2 parents 218151b + 0612c0a commit bc94ffe
Show file tree
Hide file tree
Showing 119 changed files with 2,913 additions and 1,155 deletions.
2 changes: 1 addition & 1 deletion osu.Desktop/DiscordRichPresence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void updatePresence(bool hideIdentifiableInformation)
new Button
{
Label = "View beatmap",
Url = $@"{api.WebsiteRootUrl}/beatmaps/{beatmapId}?mode={ruleset.Value.ShortName}"
Url = $@"{api.Endpoints.WebsiteUrl}/beatmaps/{beatmapId}?mode={ruleset.Value.ShortName}"
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override double ReadCurrentDistanceSnap(HitObject before, HitObject after
//
// The implementation below is probably correct but should be checked if/when exposed via controls.

float expectedDistance = DurationToDistance(before, after.StartTime - before.GetEndTime());
float expectedDistance = DurationToDistance(after.StartTime - before.GetEndTime(), before.StartTime);

float previousEndX = (before as JuiceStream)?.EndX ?? ((CatchHitObject)before).EffectiveX;
float actualDistance = Math.Abs(previousEndX - ((CatchHitObject)after).EffectiveX);
Expand Down
14 changes: 11 additions & 3 deletions osu.Game.Rulesets.Mania/Skinning/Argon/ArgonJudgementPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
Expand All @@ -12,6 +13,7 @@
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
using osuTK.Graphics;

Expand All @@ -26,18 +28,22 @@ public partial class ArgonJudgementPiece : TextJudgementPiece, IAnimatableJudgem
[Resolved]
private OsuColour colours { get; set; } = null!;

private IBindable<ScrollingDirection> direction = null!;

public ArgonJudgementPiece(HitResult result)
: base(result)
{
AutoSizeAxes = Axes.Both;

Origin = Anchor.Centre;
Y = judgement_y_position;
}

[BackgroundDependencyLoader]
private void load()
private void load(IScrollingInfo scrollingInfo)
{
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => onDirectionChanged(), true);

if (Result.IsHit())
{
AddInternal(ringExplosion = new RingExplosion(Result)
Expand All @@ -47,6 +53,8 @@ private void load()
}
}

private void onDirectionChanged() => Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position;

protected override SpriteText CreateJudgementText() =>
new OsuSpriteText
{
Expand Down Expand Up @@ -78,7 +86,7 @@ public virtual void PlayAnimation()
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveToY(judgement_y_position);
this.MoveToY(direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Mania.Skinning.Legacy
Expand All @@ -28,14 +30,16 @@ public LegacyManiaJudgementPiece(HitResult result, Drawable animation)
AutoSizeAxes = Axes.Both;
}

private IBindable<ScrollingDirection> direction = null!;

[Resolved]
private ISkinSource skin { get; set; } = null!;

[BackgroundDependencyLoader]
private void load(ISkinSource skin)
private void load(IScrollingInfo scrollingInfo)
{
float hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? 0;
float scorePosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value ?? 0;

float absoluteHitPosition = 480f * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR - hitPosition;
Y = scorePosition - absoluteHitPosition;
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => onDirectionChanged(), true);

InternalChild = animation.With(d =>
{
Expand All @@ -44,6 +48,17 @@ private void load(ISkinSource skin)
});
}

private void onDirectionChanged()
{
float hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? 0;
float scorePosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value ?? 0;

float absoluteHitPosition = 480f * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR - hitPosition;
float finalPosition = scorePosition - absoluteHitPosition;

Y = direction.Value == ScrollingDirection.Up ? -finalPosition : finalPosition;
}

public void PlayAnimation()
{
(animation as IFramedAnimation)?.GotoFrame(0);
Expand Down
75 changes: 75 additions & 0 deletions osu.Game.Rulesets.Mania/UI/DefaultManiaJudgementPiece.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;

namespace osu.Game.Rulesets.Mania.UI
{
public partial class DefaultManiaJudgementPiece : DefaultJudgementPiece
{
private const float judgement_y_position = -180f;

private IBindable<ScrollingDirection> direction = null!;

public DefaultManiaJudgementPiece(HitResult result)
: base(result)
{
}

[BackgroundDependencyLoader]
private void load(IScrollingInfo scrollingInfo)
{
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => onDirectionChanged(), true);
}

private void onDirectionChanged() => Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position;

protected override void LoadComplete()
{
base.LoadComplete();

JudgementText.Font = JudgementText.Font.With(size: 25);
}

public override void PlayAnimation()
{
switch (Result)
{
case HitResult.None:
this.FadeOutFromOne(800);
break;

case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveToY(direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);

this.FadeOutFromOne(800);
break;

default:
this.ScaleTo(0.8f);
this.ScaleTo(1, 250, Easing.OutElastic);

this.Delay(50)
.ScaleTo(0.75f, 250)
.FadeOut(200);

// osu!mania uses a custom fade length, so the base call is intentionally omitted.
break;
}
}
}
}
63 changes: 15 additions & 48 deletions osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,32 @@

#nullable disable

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osuTK;
using osu.Game.Rulesets.UI.Scrolling;

namespace osu.Game.Rulesets.Mania.UI
{
public partial class DrawableManiaJudgement : DrawableJudgement
{
protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);
private IBindable<ScrollingDirection> direction;

private partial class DefaultManiaJudgementPiece : DefaultJudgementPiece
[BackgroundDependencyLoader]
private void load(IScrollingInfo scrollingInfo)
{
private const float judgement_y_position = -180f;

public DefaultManiaJudgementPiece(HitResult result)
: base(result)
{
Y = judgement_y_position;
}

protected override void LoadComplete()
{
base.LoadComplete();

JudgementText.Font = JudgementText.Font.With(size: 25);
}

public override void PlayAnimation()
{
switch (Result)
{
case HitResult.None:
this.FadeOutFromOne(800);
break;

case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

this.MoveToY(judgement_y_position);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);

this.RotateTo(0);
this.RotateTo(40, 800, Easing.InQuint);

this.FadeOutFromOne(800);
break;

default:
this.ScaleTo(0.8f);
this.ScaleTo(1, 250, Easing.OutElastic);
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => onDirectionChanged(), true);
}

this.Delay(50)
.ScaleTo(0.75f, 250)
.FadeOut(200);
break;
}
}
private void onDirectionChanged()
{
Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
Origin = Anchor.Centre;
}

protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);
}
}
8 changes: 1 addition & 7 deletions osu.Game.Rulesets.Mania/UI/Stage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,7 @@ internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result
return;

judgements.Clear(false);
judgements.Add(judgementPooler.Get(result.Type, j =>
{
j.Apply(result, judgedObject);

j.Anchor = Anchor.BottomCentre;
j.Origin = Anchor.Centre;
})!);
judgements.Add(judgementPooler.Get(result.Type, j => j.Apply(result, judgedObject))!);
}

protected override void Update()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public partial class PathControlPointVisualiser<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IHasContextMenu
where T : OsuHitObject, IHasPath
where T : OsuHitObject, IHasPath, IHasSliderVelocity
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // allow context menu to appear outside the playfield.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private void updateSlider()
if (state == SliderPlacementState.Drawing)
HitObject.Path.ExpectedDistance.Value = (float)HitObject.Path.CalculatedDistance;
else
HitObject.Path.ExpectedDistance.Value = distanceSnapProvider?.FindSnappedDistance(HitObject, (float)HitObject.Path.CalculatedDistance, DistanceSnapTarget.Start) ?? (float)HitObject.Path.CalculatedDistance;
HitObject.Path.ExpectedDistance.Value = distanceSnapProvider?.FindSnappedDistance((float)HitObject.Path.CalculatedDistance, HitObject.StartTime, HitObject) ?? (float)HitObject.Path.CalculatedDistance;

bodyPiece.UpdateFrom(HitObject);
headCirclePiece.UpdateFrom(HitObject.HeadCircle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ private void adjustLength(double proposedDistance, bool adjustVelocity)
}
else
{
double minDistance = distanceSnapProvider?.GetBeatSnapDistanceAt(HitObject, false) * oldVelocityMultiplier ?? 1;
double minDistance = distanceSnapProvider?.GetBeatSnapDistance() * oldVelocityMultiplier ?? 1;
// Add a small amount to the proposed distance to make it easier to snap to the full length of the slider.
proposedDistance = distanceSnapProvider?.FindSnappedDistance(HitObject, (float)proposedDistance + 1, DistanceSnapTarget.Start) ?? proposedDistance;
proposedDistance = distanceSnapProvider?.FindSnappedDistance((float)proposedDistance + 1, HitObject.StartTime, HitObject) ?? proposedDistance;
proposedDistance = MathHelper.Clamp(proposedDistance, minDistance, HitObject.Path.CalculatedDistance);
}

Expand Down
5 changes: 3 additions & 2 deletions osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@

using JetBrains.Annotations;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;

namespace osu.Game.Rulesets.Osu.Edit
{
public partial class OsuDistanceSnapGrid : CircularDistanceSnapGrid
{
public OsuDistanceSnapGrid(OsuHitObject hitObject, [CanBeNull] OsuHitObject nextHitObject = null)
: base(hitObject, hitObject.StackedEndPosition, hitObject.GetEndTime(), nextHitObject?.StartTime - 1)
public OsuDistanceSnapGrid(OsuHitObject hitObject, [CanBeNull] OsuHitObject nextHitObject = null, [CanBeNull] IHasSliderVelocity sliderVelocitySource = null)
: base(hitObject.StackedEndPosition, hitObject.GetEndTime(), nextHitObject?.StartTime - 1, sliderVelocitySource)
{
Masking = true;
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class OsuDistanceSnapProvider : ComposerDistanceSnapProvider
{
public override double ReadCurrentDistanceSnap(HitObject before, HitObject after)
{
float expectedDistance = DurationToDistance(before, after.StartTime - before.GetEndTime());
float expectedDistance = DurationToDistance(after.StartTime - before.GetEndTime(), before.StartTime);
float actualDistance = Vector2.Distance(((OsuHitObject)before).EndPosition, ((OsuHitObject)after).Position);

return actualDistance / expectedDistance;
Expand Down
Loading

0 comments on commit bc94ffe

Please sign in to comment.