1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 19:52:57 +08:00

Simplify application logic

This commit is contained in:
Dean Herbert 2021-05-24 14:33:07 +09:00
parent a92ded8a2f
commit 53b5341bb9

View File

@ -83,9 +83,9 @@ namespace osu.Game.Rulesets.Osu.Mods
var distanceToPrev = Vector2.Distance(prevObjectInfo.EndPositionOriginal, currentObjectInfo.PositionOriginal); var distanceToPrev = Vector2.Distance(prevObjectInfo.EndPositionOriginal, currentObjectInfo.PositionOriginal);
switch (hitObject) if (hitObject is Spinner)
{ continue;
case HitCircle circle:
applyRandomisation( applyRandomisation(
rateOfChangeMultiplier, rateOfChangeMultiplier,
prevObjectInfo, prevObjectInfo,
@ -93,26 +93,14 @@ namespace osu.Game.Rulesets.Osu.Mods
ref currentObjectInfo ref currentObjectInfo
); );
circle.Position = currentObjectInfo.PositionRandomised; hitObject.Position = currentObjectInfo.PositionRandomised;
// update end position as it may have changed as a result of the position update.
currentObjectInfo.EndPositionRandomised = currentObjectInfo.PositionRandomised; currentObjectInfo.EndPositionRandomised = currentObjectInfo.PositionRandomised;
break; switch (hitObject)
{
case Slider slider: case Slider slider:
currentObjectInfo.EndPositionOriginal = slider.EndPosition;
currentObjectInfo.EndPositionOriginal = slider.TailCircle.Position;
applyRandomisation(
rateOfChangeMultiplier,
prevObjectInfo,
distanceToPrev,
ref currentObjectInfo
);
slider.Position = currentObjectInfo.PositionRandomised;
currentObjectInfo.EndPositionRandomised = slider.TailCircle.Position;
moveSliderIntoPlayfield(ref slider, ref currentObjectInfo); moveSliderIntoPlayfield(ref slider, ref currentObjectInfo);
var sliderShift = Vector2.Subtract(slider.Position, currentObjectInfo.PositionOriginal); var sliderShift = Vector2.Subtract(slider.Position, currentObjectInfo.PositionOriginal);
@ -239,15 +227,9 @@ namespace osu.Game.Rulesets.Osu.Mods
var diff = destAngleRad - initialAngleRad; var diff = destAngleRad - initialAngleRad;
while (diff < -Math.PI) while (diff < -Math.PI) diff += 2 * Math.PI;
{
diff += 2 * Math.PI;
}
while (diff > Math.PI) while (diff > Math.PI) diff -= 2 * Math.PI;
{
diff -= 2 * Math.PI;
}
var finalAngleRad = initialAngleRad + relativeDistance * diff; var finalAngleRad = initialAngleRad + relativeDistance * diff;