1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:03:21 +08:00

Define TickRate to adjust rate of ticks externally, removing todo.

This commit is contained in:
smoogipooo 2017-04-03 15:32:38 +09:00
parent 293ea6fbd7
commit aad8851460
4 changed files with 19 additions and 24 deletions

View File

@ -84,7 +84,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps
StartTime = obj.StartTime, StartTime = obj.StartTime,
Sample = obj.Sample, Sample = obj.Sample,
IsStrong = strong, IsStrong = strong,
Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale,
TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4
}; };
} }
} }

View File

@ -33,10 +33,9 @@ namespace osu.Game.Modes.Taiko.Objects
public double Velocity { get; protected set; } = 5; public double Velocity { get; protected set; } = 5;
/// <summary> /// <summary>
/// The distance between ticks of this drumroll. /// Numer of ticks per beat length.
/// <para>Half of this value is the hit window of the ticks.</para>
/// </summary> /// </summary>
public double TickTimeDistance { get; protected set; } = 100; public int TickRate = 1;
/// <summary> /// <summary>
/// Number of drum roll ticks required for a "Good" hit. /// Number of drum roll ticks required for a "Good" hit.
@ -60,18 +59,18 @@ namespace osu.Game.Modes.Taiko.Objects
private List<DrumRollTick> ticks; private List<DrumRollTick> ticks;
/// <summary>
/// The length (in milliseconds) between ticks of this drumroll.
/// <para>Half of this value is the hit window of the ticks.</para>
/// </summary>
private double tickSpacing = 100;
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{ {
base.ApplyDefaults(timing, difficulty); base.ApplyDefaults(timing, difficulty);
Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime); Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime);
TickTimeDistance = timing.BeatLengthAt(StartTime); tickSpacing = timing.BeatLengthAt(StartTime) / TickRate;
//TODO: move this to legacy conversion code to allow for direct division without special case.
if (difficulty.SliderTickRate == 3)
TickTimeDistance /= 3;
else
TickTimeDistance /= 4;
RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty);
RequiredGreatHits = TotalTicks * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty); RequiredGreatHits = TotalTicks * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty);
@ -81,17 +80,17 @@ namespace osu.Game.Modes.Taiko.Objects
{ {
var ret = new List<DrumRollTick>(); var ret = new List<DrumRollTick>();
if (TickTimeDistance == 0) if (tickSpacing == 0)
return ret; return ret;
bool first = true; bool first = true;
for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) for (double t = StartTime; t < EndTime + (int)tickSpacing; t += tickSpacing)
{ {
ret.Add(new DrumRollTick ret.Add(new DrumRollTick
{ {
FirstTick = first, FirstTick = first,
PreEmpt = PreEmpt, PreEmpt = PreEmpt,
TickTimeDistance = TickTimeDistance, TickSpacing = tickSpacing,
StartTime = t, StartTime = t,
IsStrong = IsStrong, IsStrong = IsStrong,
Sample = new HitSampleInfo Sample = new HitSampleInfo

View File

@ -11,14 +11,14 @@ namespace osu.Game.Modes.Taiko.Objects
public bool FirstTick; public bool FirstTick;
/// <summary> /// <summary>
/// The distance between this tick and the next in milliseconds. /// The length (in milliseconds) between this tick and the next.
/// <para>Half of this value is the hit window of the tick.</para> /// <para>Half of this value is the hit window of the tick.</para>
/// </summary> /// </summary>
public double TickTimeDistance; public double TickSpacing;
/// <summary> /// <summary>
/// The time allowed to hit this tick. /// The time allowed to hit this tick.
/// </summary> /// </summary>
public double HitWindow => TickTimeDistance / 2; public double HitWindow => TickSpacing / 2;
} }
} }

View File

@ -72,14 +72,9 @@ namespace osu.Game.Modes.Taiko.Replays
} }
else if (drumRoll != null) else if (drumRoll != null)
{ {
double delay = drumRoll.TickTimeDistance; foreach (var tick in drumRoll.Ticks)
double time = drumRoll.StartTime;
for (int j = 0; j < drumRoll.TotalTicks; j++)
{ {
Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
time += delay;
hitButton = !hitButton; hitButton = !hitButton;
} }
} }