mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Take circle radius into account when clamping hit objects to playfield
This commit is contained in:
parent
f5134c7fc2
commit
cca26d4651
@ -52,12 +52,12 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public bool DisplayResultsOnFail => true;
|
public bool DisplayResultsOnFail => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Jump distance for circles in the last combo
|
/// Jump distance for circles in the last combo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const float max_base_distance = 250f;
|
private const float max_base_distance = 250f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum allowed jump distance after multipliers are applied
|
/// The maximum allowed jump distance after multipliers are applied
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const float distance_cap = 350f;
|
private const float distance_cap = 350f;
|
||||||
|
|
||||||
@ -67,7 +67,12 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private const byte border_distance_y = 144;
|
private const byte border_distance_y = 144;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Duration of the undimming animation
|
/// The extent of rotation towards playfield centre when a circle is near the edge
|
||||||
|
/// </summary>
|
||||||
|
private const float edge_rotation_multiplier = 0.75f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Duration of the undimming animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const double undim_duration = 96;
|
private const double undim_duration = 96;
|
||||||
|
|
||||||
@ -295,14 +300,16 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
var newPosition = Vector2.Add(lastPos, relativePos);
|
var newPosition = Vector2.Add(lastPos, relativePos);
|
||||||
|
|
||||||
if (newPosition.Y < 0)
|
var radius = (float)obj.Radius;
|
||||||
newPosition.Y = 0;
|
|
||||||
else if (newPosition.Y > OsuPlayfield.BASE_SIZE.Y)
|
if (newPosition.Y < radius)
|
||||||
newPosition.Y = OsuPlayfield.BASE_SIZE.Y;
|
newPosition.Y = radius;
|
||||||
if (newPosition.X < 0)
|
else if (newPosition.Y > OsuPlayfield.BASE_SIZE.Y - radius)
|
||||||
newPosition.X = 0;
|
newPosition.Y = OsuPlayfield.BASE_SIZE.Y - radius;
|
||||||
else if (newPosition.X > OsuPlayfield.BASE_SIZE.X)
|
if (newPosition.X < radius)
|
||||||
newPosition.X = OsuPlayfield.BASE_SIZE.X;
|
newPosition.X = radius;
|
||||||
|
else if (newPosition.X > OsuPlayfield.BASE_SIZE.X - radius)
|
||||||
|
newPosition.X = OsuPlayfield.BASE_SIZE.X - radius;
|
||||||
|
|
||||||
obj.Position = newPosition;
|
obj.Position = newPosition;
|
||||||
|
|
||||||
@ -314,10 +321,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get samples (if any) for a specific point in time.
|
/// Get samples (if any) for a specific point in time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Samples will be returned if a hit circle or a slider node exists at that point of time.
|
/// Samples will be returned if a hit circle or a slider node exists at that point of time.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="hitObjects">The list of hit objects in a beatmap, ordered by StartTime</param>
|
/// <param name="hitObjects">The list of hit objects in a beatmap, ordered by StartTime</param>
|
||||||
/// <param name="time">The point in time to get samples for</param>
|
/// <param name="time">The point in time to get samples for</param>
|
||||||
@ -349,7 +356,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the position of the current hit object relative to the previous one.
|
/// Determines the position of the current hit object relative to the previous one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The position of the current hit object relative to the previous one</returns>
|
/// <returns>The position of the current hit object relative to the previous one</returns>
|
||||||
private Vector2 getRotatedVector(Vector2 prevPosChanged, Vector2 posRelativeToPrev)
|
private Vector2 getRotatedVector(Vector2 prevPosChanged, Vector2 posRelativeToPrev)
|
||||||
@ -390,18 +397,18 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
return rotateVectorTowardsVector(
|
return rotateVectorTowardsVector(
|
||||||
posRelativeToPrev,
|
posRelativeToPrev,
|
||||||
Vector2.Subtract(playfieldMiddle, prevPosChanged),
|
Vector2.Subtract(playfieldMiddle, prevPosChanged),
|
||||||
Math.Min(1, relativeRotationDistance * 0.75f)
|
Math.Min(1, relativeRotationDistance * edge_rotation_multiplier)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rotates vector "initial" towards vector "destination"
|
/// Rotates vector "initial" towards vector "destination"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="initial">Vector to rotate to "destination"</param>
|
/// <param name="initial">Vector to rotate to "destination"</param>
|
||||||
/// <param name="destination">Vector "initial" should be rotated to</param>
|
/// <param name="destination">Vector "initial" should be rotated to</param>
|
||||||
/// <param name="relativeDistance">
|
/// <param name="relativeDistance">
|
||||||
/// The angle the vector should be rotated relative to the difference between the angles of
|
/// The angle the vector should be rotated relative to the difference between the angles of
|
||||||
/// the the two vectors.
|
/// the the two vectors.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>Resulting vector</returns>
|
/// <returns>Resulting vector</returns>
|
||||||
private Vector2 rotateVectorTowardsVector(Vector2 initial, Vector2 destination, float relativeDistance)
|
private Vector2 rotateVectorTowardsVector(Vector2 initial, Vector2 destination, float relativeDistance)
|
||||||
|
Loading…
Reference in New Issue
Block a user