1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Merge pull request #25490 from peppy/auto-generator-spm

Refactor `OsuAutoGenerator` to allow custom SPM specifications
This commit is contained in:
Bartłomiej Dach 2023-11-20 12:21:35 +09:00 committed by GitHub
commit aeb1aaf97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,6 +339,11 @@ namespace osu.Game.Rulesets.Osu.Replays
AddFrameToReplay(startFrame);
// 0.05 rad/ms, or ~477 RPM, as per stable.
// the redundant conversion from RPM to rad/ms is here for ease of testing custom SPM specs.
const float spin_rpm = 0.05f / (2 * MathF.PI) * 60000;
float radsPerMillisecond = MathUtils.DegreesToRadians(spin_rpm * 360) / 60000;
switch (h)
{
// We add intermediate frames for spinning / following a slider here.
@ -354,7 +359,7 @@ namespace osu.Game.Rulesets.Osu.Replays
for (double nextFrame = h.StartTime + GetFrameDelay(h.StartTime); nextFrame < spinner.EndTime; nextFrame += GetFrameDelay(nextFrame))
{
t = ApplyModsToTimeDelta(previousFrame, nextFrame) * spinnerDirection;
angle += (float)t / 20;
angle += (float)t * radsPerMillisecond;
Vector2 pos = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);
AddFrameToReplay(new OsuReplayFrame((int)nextFrame, new Vector2(pos.X, pos.Y), action));
@ -363,7 +368,7 @@ namespace osu.Game.Rulesets.Osu.Replays
}
t = ApplyModsToTimeDelta(previousFrame, spinner.EndTime) * spinnerDirection;
angle += (float)t / 20;
angle += (float)t * radsPerMillisecond;
Vector2 endPosition = SPINNER_CENTRE + CirclePosition(angle, SPIN_RADIUS);