mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Revert "Make OsuAutoGenerator spin the cursor around the position of the spinner instead of a set value"
This reverts commit 817bb5213c
.
This commit is contained in:
parent
6e85c4e069
commit
19fc224348
@ -155,9 +155,9 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
if (spinner.SpinsRequired == 0)
|
||||
return;
|
||||
|
||||
calcSpinnerStartPosAndDirection(spinner, ((OsuReplayFrame)Frames[^1]).Position, out startPosition, out spinnerDirection);
|
||||
calcSpinnerStartPosAndDirection(((OsuReplayFrame)Frames[^1]).Position, out startPosition, out spinnerDirection);
|
||||
|
||||
Vector2 spinCentreOffset = spinner.Position - ((OsuReplayFrame)Frames[^1]).Position;
|
||||
Vector2 spinCentreOffset = SPINNER_CENTRE - ((OsuReplayFrame)Frames[^1]).Position;
|
||||
|
||||
if (spinCentreOffset.Length > SPIN_RADIUS)
|
||||
{
|
||||
@ -180,9 +180,9 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
|
||||
#region Helper subroutines
|
||||
|
||||
private static void calcSpinnerStartPosAndDirection(Spinner spinner, Vector2 prevPos, out Vector2 startPosition, out float spinnerDirection)
|
||||
private static void calcSpinnerStartPosAndDirection(Vector2 prevPos, out Vector2 startPosition, out float spinnerDirection)
|
||||
{
|
||||
Vector2 spinCentreOffset = spinner.Position - prevPos;
|
||||
Vector2 spinCentreOffset = SPINNER_CENTRE - prevPos;
|
||||
float distFromCentre = spinCentreOffset.Length;
|
||||
float distToTangentPoint = MathF.Sqrt(distFromCentre * distFromCentre - SPIN_RADIUS * SPIN_RADIUS);
|
||||
|
||||
@ -216,13 +216,13 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
else if (spinCentreOffset.Length > 0)
|
||||
{
|
||||
// Previous cursor position was inside spin circle, set startPosition to the nearest point on spin circle.
|
||||
startPosition = spinner.Position - spinCentreOffset * (SPIN_RADIUS / spinCentreOffset.Length);
|
||||
startPosition = SPINNER_CENTRE - spinCentreOffset * (SPIN_RADIUS / spinCentreOffset.Length);
|
||||
spinnerDirection = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Degenerate case where cursor position is exactly at the centre of the spin circle.
|
||||
startPosition = spinner.Position + new Vector2(0, -SPIN_RADIUS);
|
||||
startPosition = SPINNER_CENTRE + new Vector2(0, -SPIN_RADIUS);
|
||||
spinnerDirection = 1;
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
{
|
||||
// We add intermediate frames for spinning / following a slider here.
|
||||
case Spinner spinner:
|
||||
Vector2 difference = startPosition - spinner.Position;
|
||||
Vector2 difference = startPosition - SPINNER_CENTRE;
|
||||
|
||||
float radius = difference.Length;
|
||||
float angle = radius == 0 ? 0 : MathF.Atan2(difference.Y, difference.X);
|
||||
@ -348,7 +348,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
t = ApplyModsToTimeDelta(previousFrame, nextFrame) * spinnerDirection;
|
||||
angle += (float)t / 20;
|
||||
|
||||
Vector2 pos = spinner.Position + CirclePosition(angle, SPIN_RADIUS);
|
||||
Vector2 pos = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);
|
||||
AddFrameToReplay(new OsuReplayFrame((int)nextFrame, new Vector2(pos.X, pos.Y), action));
|
||||
|
||||
previousFrame = nextFrame;
|
||||
@ -357,7 +357,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
t = ApplyModsToTimeDelta(previousFrame, spinner.EndTime) * spinnerDirection;
|
||||
angle += (float)t / 20;
|
||||
|
||||
Vector2 endPosition = spinner.Position + CirclePosition(angle, SPIN_RADIUS);
|
||||
Vector2 endPosition = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);
|
||||
|
||||
AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action));
|
||||
|
||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Replays
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
/// <summary>
|
||||
/// Constants (for spinners).
|
||||
/// </summary>
|
||||
protected static readonly Vector2 SPINNER_CENTRE = OsuPlayfield.BASE_SIZE / 2;
|
||||
|
||||
public const float SPIN_RADIUS = 50;
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user