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