mirror of
https://github.com/ppy/osu
synced 2025-01-02 04:12:13 +00:00
Add spinner automation
This commit is contained in:
parent
d4d348390a
commit
4cd5eb783a
@ -11,6 +11,7 @@ using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
@ -22,25 +23,30 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "No need to chase the circle, the circle chases you";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModAutoplay), typeof(OsuModWiggle), typeof(OsuModTransform) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModWiggle), typeof(OsuModTransform), typeof(ModAutoplay) };
|
||||
|
||||
private readonly List<DrawableOsuHitObject> movingObjects = new List<DrawableOsuHitObject>();
|
||||
private DrawableSpinner activeSpinner;
|
||||
private double spinnerAngle; // in radians
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
{
|
||||
var cursorPos = playfield.Cursor.ActiveCursor.DrawPosition;
|
||||
var currentTime = playfield.Clock.CurrentTime;
|
||||
|
||||
// Avoid relocating judgment displays and hide follow points
|
||||
playfield.DisplayJudgements.Value = false;
|
||||
(playfield as OsuPlayfield)?.ConnectionLayer.Hide();
|
||||
|
||||
// First move objects to new destination, then remove them from movingObjects list if they're too old
|
||||
// If object too old, remove from movingObjects list, otherwise move to new destination
|
||||
movingObjects.RemoveAll(d =>
|
||||
{
|
||||
var h = d.HitObject;
|
||||
var currentTime = playfield.Clock.CurrentTime;
|
||||
var endTime = (h as IHasEndTime)?.EndTime ?? h.StartTime;
|
||||
d.ClearTransforms();
|
||||
|
||||
// Object no longer required to be moved -> remove from list
|
||||
if (currentTime > endTime)
|
||||
return true;
|
||||
|
||||
switch (d)
|
||||
{
|
||||
@ -48,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
// 10ms earlier on the note to reduce chance of missing when clicking early / cursor moves fast
|
||||
circle.MoveTo(cursorPos, Math.Max(0, endTime - currentTime - 10));
|
||||
return currentTime > endTime;
|
||||
return false;
|
||||
|
||||
case DrawableSlider slider:
|
||||
|
||||
@ -56,23 +62,56 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
if (currentTime < h.StartTime)
|
||||
{
|
||||
slider.MoveTo(cursorPos, Math.Max(0, h.StartTime - currentTime - 10));
|
||||
return false;
|
||||
}
|
||||
// Move slider so that sliderball stays on the cursor
|
||||
else
|
||||
{
|
||||
slider.HeadCircle.Hide(); // temporary solution to supress HeadCircle's explosion, flash, ... at wrong location
|
||||
slider.MoveTo(cursorPos - slider.Ball.DrawPosition);
|
||||
return currentTime > endTime;
|
||||
}
|
||||
|
||||
case DrawableSpinner _:
|
||||
// TODO
|
||||
return true;
|
||||
return false;
|
||||
|
||||
case DrawableSpinner spinner:
|
||||
|
||||
// Move spinner to cursor
|
||||
if (currentTime < h.StartTime)
|
||||
{
|
||||
spinner.MoveTo(cursorPos, Math.Max(0, h.StartTime - currentTime - 10));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
spinnerAngle = 0;
|
||||
activeSpinner = spinner;
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (activeSpinner != null)
|
||||
{
|
||||
if (currentTime > (activeSpinner.HitObject as IHasEndTime)?.EndTime)
|
||||
{
|
||||
activeSpinner = null;
|
||||
spinnerAngle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const float additional_degrees = 4;
|
||||
const int dist_from_cursor = 30;
|
||||
spinnerAngle += additional_degrees * Math.PI / 180;
|
||||
|
||||
// Visual progress
|
||||
activeSpinner.MoveTo(new Vector2((float)(dist_from_cursor * Math.Cos(spinnerAngle) + cursorPos.X), (float)(dist_from_cursor * Math.Sin(spinnerAngle) + cursorPos.Y)));
|
||||
|
||||
// Logical progress
|
||||
activeSpinner.Disc.RotationAbsolute += additional_degrees;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||
@ -91,9 +130,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
/*
|
||||
* TODOs
|
||||
* - fix sliders reappearing at original position after their EndTime (see https://puu.sh/E7zT4/111cf9cdc8.gif)
|
||||
* - relocate / hide slider headcircle's explosion, flash, ...
|
||||
* - automate spinners
|
||||
* - combine with OsuModRelax (?)
|
||||
* - find nicer way to handle slider headcircle explosion, flash, ...
|
||||
* - add Aim Assist as incompatible mod for Autoplay (?)
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override ModType Type => ModType.Automation;
|
||||
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay), typeof(OsuModAimAssist) };
|
||||
|
||||
public bool AllowFail => false;
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "Everything rotates. EVERYTHING.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle), typeof(OsuModAimAssist) };
|
||||
|
||||
private float theta;
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "They just won't stay still...";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform), typeof(OsuModAimAssist) };
|
||||
|
||||
private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles
|
||||
private const int wiggle_strength = 10; // Higher = stronger wiggles
|
||||
|
Loading…
Reference in New Issue
Block a user