1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +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,
Sample = obj.Sample,
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;
/// <summary>
/// The distance between ticks of this drumroll.
/// <para>Half of this value is the hit window of the ticks.</para>
/// Numer of ticks per beat length.
/// </summary>
public double TickTimeDistance { get; protected set; } = 100;
public int TickRate = 1;
/// <summary>
/// Number of drum roll ticks required for a "Good" hit.
@ -60,18 +59,18 @@ namespace osu.Game.Modes.Taiko.Objects
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)
{
base.ApplyDefaults(timing, difficulty);
Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime);
TickTimeDistance = timing.BeatLengthAt(StartTime);
//TODO: move this to legacy conversion code to allow for direct division without special case.
if (difficulty.SliderTickRate == 3)
TickTimeDistance /= 3;
else
TickTimeDistance /= 4;
tickSpacing = timing.BeatLengthAt(StartTime) / TickRate;
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);
@ -81,17 +80,17 @@ namespace osu.Game.Modes.Taiko.Objects
{
var ret = new List<DrumRollTick>();
if (TickTimeDistance == 0)
if (tickSpacing == 0)
return ret;
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
{
FirstTick = first,
PreEmpt = PreEmpt,
TickTimeDistance = TickTimeDistance,
TickSpacing = tickSpacing,
StartTime = t,
IsStrong = IsStrong,
Sample = new HitSampleInfo

View File

@ -11,14 +11,14 @@ namespace osu.Game.Modes.Taiko.Objects
public bool FirstTick;
/// <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>
/// </summary>
public double TickTimeDistance;
public double TickSpacing;
/// <summary>
/// The time allowed to hit this tick.
/// </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)
{
double delay = drumRoll.TickTimeDistance;
double time = drumRoll.StartTime;
for (int j = 0; j < drumRoll.TotalTicks; j++)
foreach (var tick in drumRoll.Ticks)
{
Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
time += delay;
Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
hitButton = !hitButton;
}
}