mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
Fix incorrect angle being used (at object vs into object)
This commit is contained in:
parent
162774ce27
commit
1972f1f279
@ -39,11 +39,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
// If the map has less than two OsuHitObjects, the enumerator will not return anything.
|
||||
for (int i = 1; i < objects.Count; i++)
|
||||
{
|
||||
var prev = objects[i - 1];
|
||||
var lastLast = i > 1 ? objects[i - 2] : null;
|
||||
var last = objects[i - 1];
|
||||
var current = objects[i];
|
||||
var next = i < objects.Count - 1 ? objects[i + 1] : null;
|
||||
|
||||
yield return new OsuDifficultyHitObject(prev, current, next, timeRate);
|
||||
yield return new OsuDifficultyHitObject(lastLast, last, current, timeRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,19 +40,23 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
/// </summary>
|
||||
public double StrainTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Angle the player has to take to hit this <see cref="OsuDifficultyHitObject"/>.
|
||||
/// Calculated as the angle between the circles (current-2, current-1, current).
|
||||
/// </summary>
|
||||
public double? Angle { get; private set; }
|
||||
|
||||
private readonly OsuHitObject lastLastObject;
|
||||
private readonly OsuHitObject lastObject;
|
||||
private readonly OsuHitObject nextObject;
|
||||
private readonly double timeRate;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object calculating extra data required for difficulty calculation.
|
||||
/// </summary>
|
||||
public OsuDifficultyHitObject(OsuHitObject lastObject, OsuHitObject currentObject, OsuHitObject nextObject, double timeRate)
|
||||
public OsuDifficultyHitObject(OsuHitObject lastLastObject, OsuHitObject lastObject, OsuHitObject currentObject, double timeRate)
|
||||
{
|
||||
this.lastLastObject = lastLastObject;
|
||||
this.lastObject = lastObject;
|
||||
this.nextObject = nextObject;
|
||||
this.timeRate = timeRate;
|
||||
|
||||
BaseObject = currentObject;
|
||||
@ -72,34 +76,21 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
scalingFactor *= 1 + smallCircleBonus;
|
||||
}
|
||||
|
||||
Vector2 lastCursorPosition = lastObject.StackedPosition;
|
||||
|
||||
var lastSlider = lastObject as Slider;
|
||||
if (lastSlider != null)
|
||||
{
|
||||
computeSliderCursorPosition(lastSlider);
|
||||
lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition;
|
||||
|
||||
if (lastObject is Slider lastSlider)
|
||||
TravelDistance = lastSlider.LazyTravelDistance * scalingFactor;
|
||||
}
|
||||
|
||||
Vector2 lastCursorPosition = getEndCursorPosition(lastObject);
|
||||
|
||||
// Don't need to jump to reach spinners
|
||||
if (!(BaseObject is Spinner))
|
||||
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;
|
||||
|
||||
if (nextObject != null)
|
||||
if (lastLastObject != null)
|
||||
{
|
||||
var endCursorPosition = BaseObject.StackedPosition;
|
||||
Vector2 lastLastCursorPosition = getEndCursorPosition(lastLastObject);
|
||||
|
||||
var currentSlider = BaseObject as Slider;
|
||||
if (currentSlider != null)
|
||||
{
|
||||
computeSliderCursorPosition(currentSlider);
|
||||
endCursorPosition = currentSlider.LazyEndPosition ?? endCursorPosition;
|
||||
}
|
||||
|
||||
Vector2 v1 = lastCursorPosition - BaseObject.StackedPosition;
|
||||
Vector2 v2 = nextObject.StackedPosition - endCursorPosition;
|
||||
Vector2 v1 = lastLastCursorPosition - lastObject.StackedPosition;
|
||||
Vector2 v2 = BaseObject.StackedPosition - lastCursorPosition;
|
||||
|
||||
float dot = Vector2.Dot(v1, v2);
|
||||
float det = v1.X * v2.Y - v1.Y * v2.X;
|
||||
@ -151,5 +142,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
computeVertex(time);
|
||||
computeVertex(slider.EndTime);
|
||||
}
|
||||
|
||||
private Vector2 getEndCursorPosition(OsuHitObject hitObject)
|
||||
{
|
||||
Vector2 pos = hitObject.StackedPosition;
|
||||
|
||||
var slider = hitObject as Slider;
|
||||
if (slider != null)
|
||||
{
|
||||
computeSliderCursorPosition(slider);
|
||||
pos = slider.LazyEndPosition ?? pos;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user