Skip to content
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
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.517.1" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.519.1" />
<!-- `ppy.osu.Framework.NativeLibs` is a transitive dependency of `ppy.osu.Framework`
that ships desktop-only natives (Linux/macOS/Windows) under `runtimes/<rid>/native/`
— including a bare Linux `libbass.so`/`libbass_fx.so`/`libbassmix.so` for linux-arm64.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override SnapResult UpdateTimeAndPosition(Vector2 screenSpacePosition, do
gridSnapResult.ScreenSpacePosition.X = screenSpacePosition.X;
var distanceSnapResult = Composer?.TryDistanceSnap(gridSnapResult.ScreenSpacePosition);

var result = distanceSnapResult != null && Vector2.Distance(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
var result = distanceSnapResult != null && Vector2.DistanceSquared(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS * CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
? distanceSnapResult
: gridSnapResult;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public override SnapResult UpdateTimeAndPosition(Vector2 screenSpacePosition, do
gridSnapResult.ScreenSpacePosition.X = screenSpacePosition.X;
var distanceSnapResult = Composer?.TryDistanceSnap(gridSnapResult.ScreenSpacePosition);

var result = distanceSnapResult != null && Vector2.Distance(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
var result = distanceSnapResult != null && Vector2.DistanceSquared(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS * CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
? distanceSnapResult
: gridSnapResult;

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint
gridSnapResult.ScreenSpacePosition.X = movePosition.X;
var distanceSnapResult = Composer.TryDistanceSnap(gridSnapResult.ScreenSpacePosition);

var result = distanceSnapResult != null && Vector2.Distance(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
var result = distanceSnapResult != null && Vector2.DistanceSquared(gridSnapResult.ScreenSpacePosition, distanceSnapResult.ScreenSpacePosition) < CatchHitObjectComposer.DISTANCE_SNAP_RADIUS * CatchHitObjectComposer.DISTANCE_SNAP_RADIUS
? distanceSnapResult
: gridSnapResult;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void computeSliderCursorPosition()
// This code is designed to prevent buffing situations where lazy end is actually a less efficient movement.
Vector2 lazyMovement = Vector2.Subtract((Vector2)LazyEndPosition, currCursorPosition);

if (lazyMovement.Length() < currMovement.Length())
if (lazyMovement.LengthSquared() < currMovement.LengthSquared())
currMovement = lazyMovement;

currMovementLength = scalingFactor * currMovement.Length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public override SnapResult UpdateTimeAndPosition(Vector2 screenSpacePosition, do
else
{
// Default to the original spacing and rotation if the distance is too small.
if (Vector2.Distance(gridToolboxGroup.StartPosition.Value, pos) < 2)
if (Vector2.DistanceSquared(gridToolboxGroup.StartPosition.Value, pos) < 4)
{
gridToolboxGroup.GridLineSpacing.Value = originalSpacing;
if (!gridToolboxGroup.GridLinesRotation.Disabled)
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 @@ -19,7 +19,7 @@ public override double ReadCurrentDistanceSnap(HitObject before, HitObject after
{
// If the pair of hit objects in question here could feasibly be on the same stack, do not provide a distance snap value -
// they're likely too close to one another for the distance snap value to be useful anyway even if they somehow are not.
if (Vector2.Distance(((OsuHitObject)before).EndPosition, ((OsuHitObject)after).Position) < OsuBeatmapProcessor.STACK_DISTANCE)
if (Vector2.DistanceSquared(((OsuHitObject)before).EndPosition, ((OsuHitObject)after).Position) < OsuBeatmapProcessor.STACK_DISTANCE * OsuBeatmapProcessor.STACK_DISTANCE)
return 0;

var lastObjectWithVelocity = EditorBeatmap.HitObjects.TakeWhile(ho => ho != after).OfType<IHasSliderVelocity>().LastOrDefault();
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult
if (!snapPositions.Any())
continue;

var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition));
var closestSnapPosition = snapPositions.MinBy(p => Vector2.DistanceSquared(p, screenSpacePosition));

if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius)
if (Vector2.DistanceSquared(closestSnapPosition, screenSpacePosition) < snapRadius * snapRadius)
{
// if the snap target is a stacked object, snap to its unstacked position rather than its stacked position.
// this is intended to make working with stacks easier (because thanks to this, you can drag an object to any
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private float getRelativeTargetAngle(float targetDistance, float offset, bool fl
float angle = (float)(2.16 / (1 + 200 * Math.Exp(0.036 * (targetDistance - 310 + customOffsetX))) + 0.5);
angle += offset + customOffsetY;

float relativeAngle = (float)Math.PI - angle;
float relativeAngle = MathF.PI - angle;

return flowDirection ? -relativeAngle : relativeAngle;
}
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Osu/Mods/OsuModTargetPractice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ private int nodeIndexFromTime(IHasRepeats curve, double timeSinceStart)

private bool checkForOverlap(IEnumerable<OsuHitObject> objectsToCheck, OsuHitObject target)
{
return objectsToCheck.Any(h => Vector2.Distance(h.Position, target.Position) < target.Radius * 2);
float radiusTwice = (float)target.Radius * 2;
return objectsToCheck.Any(h => Vector2.DistanceSquared(h.Position, target.Position) < radiusTwice * radiusTwice);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedS

void wiggle()
{
float nextAngle = (float)(objRand.NextDouble() * 2 * Math.PI);
float nextAngle = (float)(objRand.NextDouble() * 2) * MathF.PI;
float nextDist = (float)(objRand.NextDouble() * Strength.Value * 7);
drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration);
drawable.MoveTo(new Vector2(nextDist * MathF.Cos(nextAngle) + origin.X, nextDist * MathF.Sin(nextAngle) + origin.Y), wiggle_duration);
}

for (int i = 0; i < amountWiggles; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void scheduleRefresh() => Scheduler.AddOnce(() =>

Vector2 distanceVector = endPosition - startPosition;
int distance = (int)distanceVector.Length();
float rotation = (float)(Math.Atan2(distanceVector.Y, distanceVector.X) * (180 / Math.PI));
float rotation = MathF.Atan2(distanceVector.Y, distanceVector.X) * (180f / MathF.PI);

double finalTransformEndTime = startTime;

Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderBall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public void UpdateProgress(double completionProgress)

// Ensure the value is substantially high enough to allow for Atan2 to get a valid angle.
// Needed for when near completion, or in case of a very short slider.
if (diff.Length() < 0.01f)
if (diff.LengthSquared() < 0.0001f)
return;

ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
ball.Rotation = -90 + -MathF.Atan2(diff.X, diff.Y) * (180f / MathF.PI);
}
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void addHitObjectReplay(OsuHitObject h)

Vector2 spinCentreOffset = SPINNER_CENTRE - ((OsuReplayFrame)Frames[^1]).Position;

if (spinCentreOffset.Length() > SPIN_RADIUS)
if (spinCentreOffset.LengthSquared() > SPIN_RADIUS * SPIN_RADIUS)
{
// If moving in from the outside, don't ease out (default eases out). This means auto will "start" spinning immediately after moving into position.
easing = Easing.In;
Expand Down Expand Up @@ -215,7 +215,7 @@ private static void calcSpinnerStartPosAndDirection(Vector2 prevPos, out Vector2
// Move along the tangent line, now startPosition is at the tangent point.
startPosition = prevPos + spinCentreOffset;
}
else if (spinCentreOffset.Length() > 0)
else if (spinCentreOffset.LengthSquared() > 0)
{
// Previous cursor position was inside spin circle, set startPosition to the nearest point on spin circle.
startPosition = SPINNER_CENTRE - spinCentreOffset * (SPIN_RADIUS / spinCentreOffset.Length());
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected int FindInsertionIndex(ReplayFrame frame)

protected void AddFrameToReplay(ReplayFrame frame) => Frames.Insert(FindInsertionIndex(frame), frame);

protected static Vector2 CirclePosition(double t, double radius) => new Vector2((float)(Math.Cos(t) * radius), (float)(Math.Sin(t) * radius));
protected static Vector2 CirclePosition(double t, double radius) => new Vector2(MathF.Cos((float)t) * (float)radius, MathF.Sin((float)t) * (float)radius);

#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSpinnerDisc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected override void Update()
else
{
trackingElementInterpolation =
(float)Interpolation.Damp(trackingElementInterpolation, drawableSpinner.RotationTracker.Tracking ? 1 : 0, 0.985f, (float)Math.Abs(Clock.ElapsedFrameTime));
(float)Interpolation.Damp(trackingElementInterpolation, drawableSpinner.RotationTracker.Tracking ? 1 : 0, 0.985f, MathF.Abs((float)Clock.ElapsedFrameTime));

fill.Alpha = trackingElementInterpolation * (tracking_alpha - idle_alpha) + idle_alpha;
centre.Size = new Vector2(trackingElementInterpolation * (tracking_centre_size - idle_centre_size) + idle_centre_size);
Expand All @@ -214,7 +214,7 @@ protected override void Update()
const float initial_fill_scale = 0.1f;
float targetScale = initial_fill_scale + (0.98f - initial_fill_scale) * drawableSpinner.Progress;

fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(MathF.Abs((float)Time.Elapsed) / 100f, 0f, 1f)));
ticks.Rotation = drawableSpinner.RotationTracker.Rotation;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ protected override void Update()

background.Alpha = spinner.Progress >= 1 ? 0 : 1;

fill.Alpha = (float)Interpolation.DampContinuously(fill.Alpha, spinner.Progress > 0 && spinner.Progress < 1 ? 1 : 0, 40f, (float)Math.Abs(Time.Elapsed));
fill.Progress = (float)Interpolation.DampContinuously(fill.Progress, spinner.Progress >= 1 ? 0 : arc_fill * spinner.Progress, 40f, (float)Math.Abs(Time.Elapsed));
fill.Alpha = (float)Interpolation.DampContinuously(fill.Alpha, spinner.Progress > 0 && spinner.Progress < 1 ? 1 : 0, 40f, MathF.Abs((float)Time.Elapsed));
fill.Progress = (float)Interpolation.DampContinuously(fill.Progress, spinner.Progress >= 1 ? 0 : arc_fill * spinner.Progress, 40f, MathF.Abs((float)Time.Elapsed));

fill.Rotation = (float)(90 - fill.Progress * 180);
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSpinnerRingArc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ protected override void Update()
{
base.Update();

fill.Progress = (float)Interpolation.DampContinuously(fill.Progress, spinner.Progress >= 1 ? arc_fill_complete : arc_fill, 40f, (float)Math.Abs(Time.Elapsed));
fill.InnerRadius = (float)Interpolation.DampContinuously(fill.InnerRadius, spinner.Progress >= 1 ? arc_radius * 2.2f : arc_radius, 40f, (float)Math.Abs(Time.Elapsed));
fill.Progress = (float)Interpolation.DampContinuously(fill.Progress, spinner.Progress >= 1 ? arc_fill_complete : arc_fill, 40f, MathF.Abs((float)Time.Elapsed));
fill.InnerRadius = (float)Interpolation.DampContinuously(fill.InnerRadius, spinner.Progress >= 1 ? arc_radius * 2.2f : arc_radius, 40f, MathF.Abs((float)Time.Elapsed));

fill.Rotation = (float)(-fill.Progress * 180);
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Skinning/Default/DefaultSpinnerDisc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ protected override void Update()
}
else
{
fill.Alpha = (float)Interpolation.Damp(fill.Alpha, drawableSpinner.RotationTracker.Tracking ? tracking_alpha : idle_alpha, 0.98f, (float)Math.Abs(Clock.ElapsedFrameTime));
fill.Alpha = (float)Interpolation.Damp(fill.Alpha, drawableSpinner.RotationTracker.Tracking ? tracking_alpha : idle_alpha, 0.98f, MathF.Abs((float)Clock.ElapsedFrameTime));
}

const float initial_fill_scale = 0.2f;
float targetScale = initial_fill_scale + (1 - initial_fill_scale) * drawableSpinner.Progress;

fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(MathF.Abs((float)Time.Elapsed) / 100f, 0f, 1f)));
mainContainer.Rotation = drawableSpinner.RotationTracker.Rotation;
}

Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Osu/Skinning/Default/SpinnerCentreLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
Expand Down Expand Up @@ -50,7 +49,7 @@ private void load(DrawableHitObject drawableHitObject)
protected override void Update()
{
base.Update();
symbol.Rotation = (float)Interpolation.Lerp(symbol.Rotation, spinner.RotationTracker.Rotation / 2, Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1));
symbol.Rotation = float.Lerp(symbol.Rotation, spinner.RotationTracker.Rotation * 0.5f, (float)Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1));
}

private Colour4 accentColour;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void load(OsuConfigManager config, ISkinSource skinSource)

protected override bool InterpolateMovements => !DisjointTrail;

protected override float IntervalMultiplier => 1 / Math.Max(cursorSize.Value, 1);
protected override float IntervalMultiplier => 1f / MathF.Max(cursorSize.Value, 1f);
protected override bool AvoidDrawingNearCursor => !DisjointTrail;

protected override void Update()
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ protected virtual Colour4 PointColour(SmokePoint point)

if (timeDoingFinalFadeOut > 0 && point.Time >= firstVisiblePointTimeAfterSmokeEnded)
{
float fraction = Math.Clamp((float)(timeDoingFinalFadeOut / final_fade_out_duration), 0, 1);
float fraction = float.Clamp((float)(timeDoingFinalFadeOut / final_fade_out_duration), 0, 1);
fraction = MathF.Pow(fraction, 5);
color = new Colour4(color.R, color.G, color.B, (1 - fraction) * re_fade_in_alpha);
}
Expand All @@ -290,7 +290,7 @@ protected virtual Colour4 PointColour(SmokePoint point)

if (timeDoingInitialFadeOut > 0)
{
float fraction = Math.Clamp((float)(timeDoingInitialFadeOut / initial_fade_out_duration), 0, 1);
float fraction = float.Clamp((float)(timeDoingInitialFadeOut / initial_fade_out_duration), 0, 1);
color = new Colour4(color.R, color.G, color.B, (1 - fraction) * initial_alpha);
}

Expand All @@ -300,7 +300,7 @@ protected virtual Colour4 PointColour(SmokePoint point)

if (timeDoingReFadeIn > 0)
{
float fraction = Math.Clamp((float)(timeDoingReFadeIn / re_fade_in_duration), 0, 1);
float fraction = float.Clamp((float)(timeDoingReFadeIn / re_fade_in_duration), 0, 1);
fraction = 1 - MathF.Pow(1 - fraction, 5);
color = new Colour4(color.R, color.G, color.B, fraction * (re_fade_in_alpha - color.A) + color.A);
}
Expand All @@ -313,15 +313,15 @@ protected virtual Colour4 PointColour(SmokePoint point)
protected virtual float PointScale(SmokePoint point)
{
double timeDoingScale = CurrentTime - point.Time;
float fraction = Math.Clamp((float)(timeDoingScale / scale_duration), 0, 1);
float fraction = float.Clamp((float)(timeDoingScale / scale_duration), 0, 1);
fraction = 1 - MathF.Pow(1 - fraction, 5);
return fraction * (final_scale - initial_scale) + initial_scale;
}

protected virtual Vector2 PointDirection(SmokePoint point, int index)
{
double timeDoingRotation = CurrentTime - point.Time;
float fraction = Math.Clamp((float)(timeDoingRotation / rotation_duration), 0, 1);
float fraction = float.Clamp((float)(timeDoingRotation / rotation_duration), 0, 1);
fraction = 1 - MathF.Pow(1 - fraction, 5);
float angle = fraction * getRotation(index) + point.Angle;

Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ private void load()

Vector2 centre = new Vector2(points_per_dimension) / 2;
float innerRadius = centre.X * inner_portion;
float innerRadiusSq = innerRadius * innerRadius;

Drawable[][] points = new Drawable[points_per_dimension][];

Expand All @@ -191,7 +192,7 @@ private void load()

for (int c = 0; c < points_per_dimension; c++)
{
bool isHit = Vector2.Distance(new Vector2(c + 0.5f, r + 0.5f), centre) <= innerRadius;
bool isHit = Vector2.DistanceSquared(new Vector2(c + 0.5f, r + 0.5f), centre) <= innerRadiusSq;

if (isHit)
{
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Taiko/Skinning/Legacy/LegacyKiaiGlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ protected override void Update()
base.Update();

if (isKiaiActive)
sprite.Alpha = (float)Math.Min(1, sprite.Alpha + Math.Abs(Clock.ElapsedFrameTime) / 100f);
sprite.Alpha = MathF.Min(1f, sprite.Alpha + MathF.Abs((float)Clock.ElapsedFrameTime) / 100f);
else
sprite.Alpha = (float)Math.Max(0, sprite.Alpha - Math.Abs(Clock.ElapsedFrameTime) / 600f);
sprite.Alpha = MathF.Max(0f, sprite.Alpha - MathF.Abs((float)Clock.ElapsedFrameTime) / 600f);
}

protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
Expand Down
Loading
Loading