1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 00:37:20 +08:00

Merge pull request #874 from smoogipooo/beatmap-always-applydefaults

Always ApplyDefaults after parsing beatmaps to make sure hit objects …
This commit is contained in:
Dean Herbert 2017-05-29 12:24:56 +09:00 committed by GitHub
commit d74b0f5861
2 changed files with 27 additions and 2 deletions

View File

@ -428,6 +428,9 @@ namespace osu.Game.Beatmaps.Formats
break;
}
}
foreach (var hitObject in beatmap.HitObjects)
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);
}
internal enum LegacySampleBank

View File

@ -6,20 +6,30 @@ using System;
using System.Collections.Generic;
using OpenTK;
using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Database;
namespace osu.Game.Rulesets.Objects.Legacy
{
internal abstract class ConvertSlider : HitObject, IHasCurve
{
/// <summary>
/// Scoring distance with a speed-adjusted beat length of 1 second.
/// </summary>
private const float base_scoring_distance = 100;
public List<Vector2> ControlPoints { get; set; }
public CurveType CurveType { get; set; }
public double Distance { get; set; }
public List<SampleInfoList> RepeatSamples { get; set; }
public int RepeatCount { get; set; } = 1;
public double EndTime { get; set; }
public double Duration { get; set; }
public double EndTime => StartTime + RepeatCount * Distance / Velocity;
public double Duration => EndTime - StartTime;
public double Velocity = 1;
public Vector2 PositionAt(double progress)
{
@ -35,5 +45,17 @@ namespace osu.Game.Rulesets.Objects.Legacy
{
throw new NotImplementedException();
}
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(controlPointInfo, difficulty);
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime);
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / difficultyPoint.SpeedMultiplier;
Velocity = scoringDistance / timingPoint.BeatLength;
}
}
}