mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +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)
|
if (spinner.SpinsRequired == 0)
|
||||||
return;
|
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)
|
if (spinCentreOffset.Length > SPIN_RADIUS)
|
||||||
{
|
{
|
||||||
@ -180,9 +180,9 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
#region Helper subroutines
|
#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 distFromCentre = spinCentreOffset.Length;
|
||||||
float distToTangentPoint = MathF.Sqrt(distFromCentre * distFromCentre - SPIN_RADIUS * SPIN_RADIUS);
|
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)
|
else if (spinCentreOffset.Length > 0)
|
||||||
{
|
{
|
||||||
// Previous cursor position was inside spin circle, set startPosition to the nearest point on spin circle.
|
// 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;
|
spinnerDirection = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Degenerate case where cursor position is exactly at the centre of the spin circle.
|
// 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;
|
spinnerDirection = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
{
|
{
|
||||||
// We add intermediate frames for spinning / following a slider here.
|
// We add intermediate frames for spinning / following a slider here.
|
||||||
case Spinner spinner:
|
case Spinner spinner:
|
||||||
Vector2 difference = startPosition - spinner.Position;
|
Vector2 difference = startPosition - SPINNER_CENTRE;
|
||||||
|
|
||||||
float radius = difference.Length;
|
float radius = difference.Length;
|
||||||
float angle = radius == 0 ? 0 : MathF.Atan2(difference.Y, difference.X);
|
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;
|
t = ApplyModsToTimeDelta(previousFrame, nextFrame) * spinnerDirection;
|
||||||
angle += (float)t / 20;
|
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));
|
AddFrameToReplay(new OsuReplayFrame((int)nextFrame, new Vector2(pos.X, pos.Y), action));
|
||||||
|
|
||||||
previousFrame = nextFrame;
|
previousFrame = nextFrame;
|
||||||
@ -357,7 +357,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
t = ApplyModsToTimeDelta(previousFrame, spinner.EndTime) * spinnerDirection;
|
t = ApplyModsToTimeDelta(previousFrame, spinner.EndTime) * spinnerDirection;
|
||||||
angle += (float)t / 20;
|
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));
|
AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action));
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Replays
|
namespace osu.Game.Rulesets.Osu.Replays
|
||||||
@ -19,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constants (for spinners).
|
/// Constants (for spinners).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
protected static readonly Vector2 SPINNER_CENTRE = OsuPlayfield.BASE_SIZE / 2;
|
||||||
|
|
||||||
public const float SPIN_RADIUS = 50;
|
public const float SPIN_RADIUS = 50;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user