1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22:56 +08:00

Rename accumulated rotation variable

This commit is contained in:
Dean Herbert 2023-10-23 16:46:15 +09:00
parent 92524d4299
commit 4e057b446a
No known key found for this signature in database

View File

@ -31,11 +31,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly Stack<CompletedSpin> completedSpins = new Stack<CompletedSpin>(); private readonly Stack<CompletedSpin> completedSpins = new Stack<CompletedSpin>();
/// <summary> /// <summary>
/// The total accumulated rotation. /// The total accumulated (absolute) rotation.
/// </summary> /// </summary>
private float totalAbsoluteRotation; private float totalAccumulatedRotation;
private float totalAbsoluteRotationAtLastCompletion; private float totalAccumulatedRotationAtLastCompletion;
/// <summary> /// <summary>
/// For the current spin, represents the maximum absolute rotation (from 0..360) achieved by the user. /// For the current spin, represents the maximum absolute rotation (from 0..360) achieved by the user.
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// <summary> /// <summary>
/// The current spin, from -360..360. /// The current spin, from -360..360.
/// </summary> /// </summary>
private float currentSpinRotation => totalAbsoluteRotation - totalAbsoluteRotationAtLastCompletion; private float currentSpinRotation => totalAccumulatedRotation - totalAccumulatedRotationAtLastCompletion;
private double lastReportTime = double.NegativeInfinity; private double lastReportTime = double.NegativeInfinity;
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// //
// But this can come later. // But this can come later.
totalAbsoluteRotation += delta; totalAccumulatedRotation += delta;
if (currentTime >= lastReportTime) if (currentTime >= lastReportTime)
{ {
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// Incrementing the last completion point will cause `currentSpinRotation` to // Incrementing the last completion point will cause `currentSpinRotation` to
// hold the remaining spin that needs to be considered. // hold the remaining spin that needs to be considered.
totalAbsoluteRotationAtLastCompletion += direction * 360; totalAccumulatedRotationAtLastCompletion += direction * 360;
// Reset the current max as we are entering a new spin. // Reset the current max as we are entering a new spin.
// Importantly, carry over the remainder (which is now stored in `currentSpinRotation`). // Importantly, carry over the remainder (which is now stored in `currentSpinRotation`).
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
while (completedSpins.TryPeek(out var segment) && segment.CompletionTime > currentTime) while (completedSpins.TryPeek(out var segment) && segment.CompletionTime > currentTime)
{ {
completedSpins.Pop(); completedSpins.Pop();
totalAbsoluteRotationAtLastCompletion -= segment.Direction * 360; totalAccumulatedRotationAtLastCompletion -= segment.Direction * 360;
} }
// This is a best effort. We may not have enough data to match this 1:1, but that's okay. // This is a best effort. We may not have enough data to match this 1:1, but that's okay.