mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:15:45 +08:00
Clearer slider Velocity and TickDistance calculations.
This commit is contained in:
parent
e2fae24ad5
commit
b7fca88b4f
@ -4,6 +4,7 @@
|
||||
using OpenTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Samples;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -53,11 +54,13 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
|
||||
var baseDifficulty = beatmap.BeatmapInfo.BaseDifficulty;
|
||||
|
||||
var startBeatLength = beatmap.BeatLengthAt(StartTime);
|
||||
var multipliedStartBeatLength = beatmap.BeatLengthAt(StartTime, true);
|
||||
ControlPoint overridePoint;
|
||||
ControlPoint timingPoint = beatmap.TimingPointAt(StartTime, out overridePoint);
|
||||
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
|
||||
var baseVelocity = 100 * baseDifficulty.SliderMultiplier;
|
||||
|
||||
Velocity = 100 / multipliedStartBeatLength * baseDifficulty.SliderMultiplier;
|
||||
TickDistance = (100 * baseDifficulty.SliderMultiplier) / baseDifficulty.SliderTickRate / (multipliedStartBeatLength / startBeatLength);
|
||||
Velocity = baseVelocity / (timingPoint.BeatLength * velocityAdjustment);
|
||||
TickDistance = baseVelocity / (baseDifficulty.SliderTickRate * velocityAdjustment);
|
||||
}
|
||||
|
||||
public int RepeatCount = 1;
|
||||
|
@ -26,26 +26,31 @@ namespace osu.Game.Beatmaps
|
||||
return 60000 / BeatLengthAt(time);
|
||||
}
|
||||
|
||||
public double BeatLengthAt(double time, bool applyMultipliers = false)
|
||||
public double BeatLengthAt(double time)
|
||||
{
|
||||
int point = 0;
|
||||
int samplePoint = 0;
|
||||
ControlPoint overridePoint;
|
||||
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
|
||||
return timingPoint.BeatLength;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ControlPoints.Count; i++)
|
||||
if (ControlPoints[i].Time <= time)
|
||||
public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint)
|
||||
{
|
||||
overridePoint = null;
|
||||
|
||||
ControlPoint timingPoint = null;
|
||||
foreach (var controlPoint in ControlPoints)
|
||||
if (controlPoint.Time <= time)
|
||||
{
|
||||
if (ControlPoints[i].TimingChange)
|
||||
point = i;
|
||||
else
|
||||
samplePoint = i;
|
||||
if (controlPoint.TimingChange)
|
||||
{
|
||||
timingPoint = controlPoint;
|
||||
overridePoint = null;
|
||||
}
|
||||
else overridePoint = controlPoint;
|
||||
}
|
||||
else break;
|
||||
|
||||
double mult = 1;
|
||||
|
||||
if (applyMultipliers && samplePoint > point)
|
||||
mult = ControlPoints[samplePoint].VelocityAdjustment;
|
||||
|
||||
return ControlPoints[point].BeatLength * mult;
|
||||
return timingPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user