mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 21:02:59 +08:00
adjustable assist strength + dont update spinner & running slider
This commit is contained in:
parent
04d060aba3
commit
b9d2a10530
@ -11,6 +11,8 @@ using osu.Game.Rulesets.Osu.UI;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -24,16 +26,16 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) };
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) };
|
||||||
|
|
||||||
private const float spin_radius = 30;
|
[SettingSource("Assist strength", "Change the distance notes should travel towards you.", 0)]
|
||||||
|
public BindableFloat AssistStrength { get; } = new BindableFloat(0.3f)
|
||||||
private Vector2? prevCursorPos;
|
{
|
||||||
private OsuInputManager inputManager;
|
Precision = 0.05f,
|
||||||
|
MinValue = 0.0f,
|
||||||
|
MaxValue = 1.0f,
|
||||||
|
};
|
||||||
|
|
||||||
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
// Grab the input manager for future use
|
|
||||||
inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
|
||||||
|
|
||||||
// Hide judgment displays and follow points
|
// Hide judgment displays and follow points
|
||||||
drawableRuleset.Playfield.DisplayJudgements.Value = false;
|
drawableRuleset.Playfield.DisplayJudgements.Value = false;
|
||||||
(drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
|
(drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
|
||||||
@ -41,75 +43,23 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public void Update(Playfield playfield)
|
public void Update(Playfield playfield)
|
||||||
{
|
{
|
||||||
var cursorPos = playfield.Cursor.ActiveCursor.DrawPosition;
|
Vector2 cursorPos = playfield.Cursor.ActiveCursor.DrawPosition;
|
||||||
double currentTime = playfield.Clock.CurrentTime;
|
double currentTime = playfield.Clock.CurrentTime;
|
||||||
|
|
||||||
// Move all currently alive object to new destination
|
|
||||||
foreach (var drawable in playfield.HitObjectContainer.AliveObjects.OfType<DrawableOsuHitObject>())
|
foreach (var drawable in playfield.HitObjectContainer.AliveObjects.OfType<DrawableOsuHitObject>())
|
||||||
{
|
{
|
||||||
var h = drawable.HitObject;
|
var h = drawable.HitObject;
|
||||||
|
|
||||||
switch (drawable)
|
if (currentTime < h.StartTime && (drawable is DrawableHitCircle || drawable is DrawableSlider))
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
double timeMoving = currentTime - (h.StartTime - h.TimePreempt);
|
||||||
|
float percentDoneMoving = (float)(timeMoving / h.TimePreempt);
|
||||||
|
float percentDistLeft = Math.Clamp(AssistStrength.Value - percentDoneMoving + 0.1f, 0, 1);
|
||||||
|
|
||||||
// 10ms earlier on the note to reduce chance of missing when clicking early / cursor moves fast
|
Vector2 targetPos = drawable.Position + percentDistLeft * (cursorPos - drawable.Position);
|
||||||
circle.MoveTo(cursorPos, Math.Max(0, h.StartTime - currentTime - 10));
|
drawable.MoveTo(targetPos, h.StartTime - currentTime);
|
||||||
// FIXME: some circles cause flash at original(?) position when clicked too early
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DrawableSlider slider:
|
|
||||||
|
|
||||||
// Move slider to cursor
|
|
||||||
if (currentTime < h.StartTime)
|
|
||||||
{
|
|
||||||
slider.MoveTo(cursorPos, Math.Max(0, h.StartTime - currentTime - 10));
|
|
||||||
}
|
|
||||||
// Move slider so that sliderball stays on the cursor
|
|
||||||
else
|
|
||||||
{
|
|
||||||
slider.HeadCircle.Hide(); // hide flash, triangles, ... so they don't move with slider
|
|
||||||
slider.MoveTo(cursorPos - slider.Ball.DrawPosition);
|
|
||||||
// FIXME: some sliders re-appearing at their original position for a single frame when they're done
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DrawableSpinner spinner:
|
|
||||||
|
|
||||||
// Move spinner _next_ to cursor
|
|
||||||
if (currentTime < h.StartTime)
|
|
||||||
{
|
|
||||||
spinner.MoveTo(cursorPos + new Vector2(0, -spin_radius), Math.Max(0, h.StartTime - currentTime - 10));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Move spinner visually
|
|
||||||
Vector2 delta = spin_radius * (spinner.Position - prevCursorPos ?? cursorPos).Normalized();
|
|
||||||
const float angle = 3 * MathF.PI / 180; // radians per update, arbitrary value
|
|
||||||
|
|
||||||
// Rotation matrix
|
|
||||||
var targetPos = new Vector2(
|
|
||||||
delta.X * MathF.Cos(angle) - delta.Y * MathF.Sin(angle) + cursorPos.X,
|
|
||||||
delta.X * MathF.Sin(angle) + delta.Y * MathF.Cos(angle) + cursorPos.Y
|
|
||||||
);
|
|
||||||
|
|
||||||
spinner.MoveTo(targetPos);
|
|
||||||
|
|
||||||
// Move spinner logically
|
|
||||||
if (inputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false)
|
|
||||||
{
|
|
||||||
// Arbitrary value, might lead to some inconsistencies depending on clock rate, replay, ...
|
|
||||||
spinner.RotationTracker.AddRotation(2 * MathF.PI);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
prevCursorPos = cursorPos;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user