1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 14:43:02 +08:00

Merge remote-tracking branch 'origin/master' into fix_slider_velocities

This commit is contained in:
smoogipooo 2017-04-03 15:23:02 +09:00
commit 63ca68793e
13 changed files with 161 additions and 117 deletions

View File

@ -7,8 +7,10 @@ using osu.Game.Beatmaps.Samples;
using osu.Game.Modes.Objects; using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Objects.Types;
using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Game.Database;
namespace osu.Game.Modes.Taiko.Beatmaps namespace osu.Game.Modes.Taiko.Beatmaps
{ {
@ -24,74 +26,100 @@ namespace osu.Game.Modes.Taiko.Beatmaps
return new Beatmap<TaikoHitObject>(original) return new Beatmap<TaikoHitObject>(original)
{ {
HitObjects = convertHitObjects(original.HitObjects) HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList()
}; };
} }
private List<TaikoHitObject> convertHitObjects(List<HitObject> hitObjects) private IEnumerable<TaikoHitObject> convertHitObject(HitObject obj, Beatmap beatmap)
{
return hitObjects.Select(convertHitObject).ToList();
}
private TaikoHitObject convertHitObject(HitObject original)
{ {
// Check if this HitObject is already a TaikoHitObject, and return it if so // Check if this HitObject is already a TaikoHitObject, and return it if so
TaikoHitObject originalTaiko = original as TaikoHitObject; var originalTaiko = obj as TaikoHitObject;
if (originalTaiko != null) if (originalTaiko != null)
return originalTaiko; yield return originalTaiko;
IHasDistance distanceData = original as IHasDistance; var distanceData = obj as IHasDistance;
IHasRepeats repeatsData = original as IHasRepeats; var repeatsData = obj as IHasRepeats;
IHasEndTime endTimeData = original as IHasEndTime; var endTimeData = obj as IHasEndTime;
// Old osu! used hit sounding to determine various hit type information // Old osu! used hit sounding to determine various hit type information
SampleType sample = original.Sample?.Type ?? SampleType.None; SampleType sample = obj.Sample?.Type ?? SampleType.None;
bool strong = (sample & SampleType.Finish) > 0; bool strong = (sample & SampleType.Finish) > 0;
if (distanceData != null) if (distanceData != null)
{ {
return new DrumRoll double sv = beatmap.TimingInfo.SliderVelocityAt(obj.StartTime) * beatmap.BeatmapInfo.Difficulty.SliderMultiplier;
double l = distanceData.Distance * legacy_velocity_scale;
double v = sv * legacy_velocity_scale;
double bl = beatmap.TimingInfo.BeatLengthAt(obj.StartTime);
int repeats = repeatsData?.RepeatCount ?? 1;
double skipPeriod = Math.Min(bl / beatmap.BeatmapInfo.Difficulty.SliderTickRate, distanceData.Duration / repeats);
if (skipPeriod > 0 && l / v * 1000 < 2 * bl)
{ {
StartTime = original.StartTime, for (double j = obj.StartTime; j <= distanceData.EndTime + skipPeriod / 8; j += skipPeriod)
Sample = original.Sample, {
// Todo: This should generate different type of hits (including strongs)
// depending on hitobject sound additions (not implemented fully yet)
yield return new CentreHit
{
StartTime = obj.StartTime,
Sample = obj.Sample,
IsStrong = strong
};
}
}
else
{
yield return new DrumRoll
{
StartTime = obj.StartTime,
Sample = obj.Sample,
IsStrong = strong,
Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale
};
}
}
else if (endTimeData != null)
{
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * bash_convert_factor;
yield return new Swell
{
StartTime = obj.StartTime,
Sample = obj.Sample,
IsStrong = strong, IsStrong = strong,
Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) EndTime = endTimeData.EndTime,
RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier)
}; };
} }
else
if (endTimeData != null)
{ {
// We compute the end time manually to add in the Bash convert factor bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;
return new Swell
if (isCentre)
{ {
StartTime = original.StartTime, yield return new CentreHit
Sample = original.Sample, {
IsStrong = strong, StartTime = obj.StartTime,
Sample = obj.Sample,
EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor IsStrong = strong
}; };
} }
else
bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;
if (isCentre)
{
return new CentreHit
{ {
StartTime = original.StartTime, yield return new RimHit
Sample = original.Sample, {
IsStrong = strong StartTime = obj.StartTime,
}; Sample = obj.Sample,
IsStrong = strong,
};
}
} }
return new RimHit
{
StartTime = original.StartTime,
Sample = original.Sample,
IsStrong = strong,
};
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Judgements
public override string MaxResultString => MAX_HIT_RESULT.GetDescription(); public override string MaxResultString => MAX_HIT_RESULT.GetDescription();
/// <summary> /// <summary>
/// Whether this Judgement has a secondary hit in the case of finishers. /// Whether this Judgement has a secondary hit in the case of strong hits.
/// </summary> /// </summary>
public virtual bool SecondHit { get; set; } public virtual bool SecondHit { get; set; }

View File

@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
protected override Key[] HitKeys { get; } = { Key.F, Key.J }; protected override Key[] HitKeys { get; } = { Key.F, Key.J };
private readonly CirclePiece circlePiece;
public DrawableCentreHit(Hit hit) public DrawableCentreHit(Hit hit)
: base(hit) : base(hit)
{ {
Add(circlePiece = new CirclePiece
{
Children = new[]
{
new CentreHitSymbolPiece()
}
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
circlePiece.AccentColour = colours.PinkDarker; Circle.AccentColour = colours.PinkDarker;
} }
protected override CirclePiece CreateCirclePiece() => new CirclePiece
{
Children = new[] { new CentreHitSymbolPiece() }
};
} }
} }

View File

@ -41,6 +41,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
Add(circle = CreateCirclePiece()); Add(circle = CreateCirclePiece());
circle.KiaiMode = HitObject.Kiai;
foreach (var tick in drumRoll.Ticks) foreach (var tick in drumRoll.Ticks)
{ {

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
using System; using System;
using System.Linq; using System.Linq;
@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer; protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
protected readonly CirclePiece Circle;
private readonly Hit hit; private readonly Hit hit;
private readonly Container bodyContainer;
/// <summary> /// <summary>
/// Whether the last key pressed is a valid hit key. /// Whether the last key pressed is a valid hit key.
/// </summary> /// </summary>
private bool validKeyPressed; private bool validKeyPressed;
private readonly Container bodyContainer;
protected DrawableHit(Hit hit) protected DrawableHit(Hit hit)
: base(hit) : base(hit)
{ {
@ -38,7 +41,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Children = new[]
{
Circle = CreateCirclePiece()
}
}); });
Circle.KiaiMode = HitObject.Kiai;
} }
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
@ -100,5 +109,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
Expire(); Expire();
} }
protected abstract CirclePiece CreateCirclePiece();
} }
} }

View File

@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
protected override Key[] HitKeys { get; } = { Key.D, Key.K }; protected override Key[] HitKeys { get; } = { Key.D, Key.K };
private readonly CirclePiece circlePiece;
public DrawableRimHit(Hit hit) public DrawableRimHit(Hit hit)
: base(hit) : base(hit)
{ {
Add(circlePiece = new CirclePiece
{
Children = new[]
{
new RimHitSymbolPiece()
}
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
circlePiece.AccentColour = colours.BlueDarker; Circle.AccentColour = colours.BlueDarker;
} }
protected override CirclePiece CreateCirclePiece() => new CirclePiece
{
Children = new[] { new RimHitSymbolPiece() }
};
} }
} }

View File

@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
protected override Key[] HitKeys { get; } = { Key.F, Key.J }; protected override Key[] HitKeys { get; } = { Key.F, Key.J };
private readonly CirclePiece circlePiece;
public DrawableStrongCentreHit(Hit hit) public DrawableStrongCentreHit(Hit hit)
: base(hit) : base(hit)
{ {
Add(circlePiece = new StrongCirclePiece
{
Children = new []
{
new CentreHitSymbolPiece()
}
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
circlePiece.AccentColour = colours.PinkDarker; Circle.AccentColour = colours.PinkDarker;
} }
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
{
Children = new[] { new CentreHitSymbolPiece() }
};
} }
} }

View File

@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
protected override Key[] HitKeys { get; } = { Key.D, Key.K }; protected override Key[] HitKeys { get; } = { Key.D, Key.K };
private readonly CirclePiece circlePiece;
public DrawableStrongRimHit(Hit hit) public DrawableStrongRimHit(Hit hit)
: base(hit) : base(hit)
{ {
Add(circlePiece = new StrongCirclePiece
{
Children = new[]
{
new RimHitSymbolPiece()
}
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
circlePiece.AccentColour = colours.BlueDarker; Circle.AccentColour = colours.BlueDarker;
} }
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
{
Children = new[] { new RimHitSymbolPiece() }
};
} }
} }

View File

@ -128,6 +128,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
} }
} }
}; };
circlePiece.KiaiMode = HitObject.Kiai;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -1,9 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Taiko.Objects namespace osu.Game.Modes.Taiko.Objects
@ -17,14 +14,6 @@ namespace osu.Game.Modes.Taiko.Objects
/// <summary> /// <summary>
/// The number of hits required to complete the swell successfully. /// The number of hits required to complete the swell successfully.
/// </summary> /// </summary>
public int RequiredHits { get; protected set; } = 10; public int RequiredHits = 10;
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio);
}
} }
} }

View File

@ -18,12 +18,21 @@ namespace osu.Game.Modes.Taiko.UI
/// </summary> /// </summary>
internal class HitExplosion : CircularContainer internal class HitExplosion : CircularContainer
{ {
private readonly TaikoJudgement judgement; /// <summary>
/// The size multiplier of a hit explosion if a hit object has been hit with the second key.
/// </summary>
private const float secondhit_size_multiplier = 1.5f;
/// <summary>
/// The judgement this hit explosion visualises.
/// </summary>
public readonly TaikoJudgement Judgement;
private readonly Box innerFill; private readonly Box innerFill;
public HitExplosion(TaikoJudgement judgement) public HitExplosion(TaikoJudgement judgement)
{ {
this.judgement = judgement; Judgement = judgement;
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2);
@ -50,10 +59,7 @@ namespace osu.Game.Modes.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
if (judgement.SecondHit) switch (Judgement.TaikoResult)
Size *= 1.5f;
switch (judgement.TaikoResult)
{ {
case TaikoHitResult.Good: case TaikoHitResult.Good:
innerFill.Colour = colours.Green; innerFill.Colour = colours.Green;
@ -73,5 +79,13 @@ namespace osu.Game.Modes.Taiko.UI
Expire(); Expire();
} }
/// <summary>
/// Transforms this hit explosion to visualise a secondary hit.
/// </summary>
public void VisualiseSecondHit()
{
ResizeTo(Size * secondhit_size_multiplier, 50);
}
} }
} }

View File

@ -21,9 +21,9 @@ namespace osu.Game.Modes.Taiko.UI
private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2; private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2;
/// <summary> /// <summary>
/// Diameter of finisher hit object circles. /// Diameter of strong hit object circles.
/// </summary> /// </summary>
private const float finisher_diameter = normal_diameter * 1.5f; private const float strong_hit_diameter = normal_diameter * 1.5f;
/// <summary> /// <summary>
/// The 1px inner border of the taiko playfield. /// The 1px inner border of the taiko playfield.
@ -47,15 +47,15 @@ namespace osu.Game.Modes.Taiko.UI
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Y = border_offset, Y = border_offset,
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset),
Alpha = 0.1f Alpha = 0.1f
}, },
new CircularContainer new CircularContainer
{ {
Name = "Finisher Ring", Name = "Strong Hit Ring",
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(finisher_diameter), Size = new Vector2(strong_hit_diameter),
Masking = true, Masking = true,
BorderColour = Color4.White, BorderColour = Color4.White,
BorderThickness = border_thickness, BorderThickness = border_thickness,
@ -72,7 +72,7 @@ namespace osu.Game.Modes.Taiko.UI
}, },
new CircularContainer new CircularContainer
{ {
Name = "Normal Ring", Name = "Normal Hit Ring",
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(normal_diameter), Size = new Vector2(normal_diameter),
@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Y = -border_offset, Y = -border_offset,
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset),
Alpha = 0.1f Alpha = 0.1f
}, },
}; };

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable;
using System.Linq;
namespace osu.Game.Modes.Taiko.UI namespace osu.Game.Modes.Taiko.UI
{ {
@ -22,7 +23,7 @@ namespace osu.Game.Modes.Taiko.UI
{ {
/// <summary> /// <summary>
/// The play field height. This is relative to the size of hit objects /// The play field height. This is relative to the size of hit objects
/// such that the playfield is just a bit larger than finishers. /// such that the playfield is just a bit larger than strong hits.
/// </summary> /// </summary>
public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2;
@ -176,9 +177,7 @@ namespace osu.Game.Modes.Taiko.UI
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject) public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
{ {
bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; bool wasHit = judgedObject.Judgement.Result == HitResult.Hit;
bool secondHit = judgedObject.Judgement.SecondHit;
if (wasHit)
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement) judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement)
{ {
@ -187,6 +186,22 @@ namespace osu.Game.Modes.Taiko.UI
RelativePositionAxes = Axes.X, RelativePositionAxes = Axes.X,
X = wasHit ? judgedObject.Position.X : 0, X = wasHit ? judgedObject.Position.X : 0,
}); });
if (!wasHit)
return;
if (!secondHit)
{
if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell))
{
// If we're far enough away from the left stage, we should bring outselves in front of it
topLevelHitContainer.Add(judgedObject.CreateProxy());
}
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
}
else
hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit();
} }
} }
} }