mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #2473 from NeoAdonis/hold-offset-fix
Apply offset to end times on legacy converter
This commit is contained in:
commit
80eb98c5da
@ -373,17 +373,18 @@ namespace osu.Game.Beatmaps.Formats
|
||||
if (parser == null)
|
||||
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
|
||||
|
||||
var obj = parser.Parse(line);
|
||||
var obj = parser.Parse(line, getOffsetTime());
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
obj.StartTime = getOffsetTime(obj.StartTime);
|
||||
beatmap.HitObjects.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private int getOffsetTime(int time) => time + (ApplyOffsets ? offset : 0);
|
||||
|
||||
private double getOffsetTime() => ApplyOffsets ? offset : 0;
|
||||
|
||||
private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
public abstract class ConvertHitObjectParser : HitObjectParser
|
||||
{
|
||||
public override HitObject Parse(string text)
|
||||
{
|
||||
return Parse(text, 0);
|
||||
}
|
||||
|
||||
public HitObject Parse(string text, double offset)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -146,7 +151,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
}
|
||||
else if ((type & ConvertHitObjectType.Spinner) > 0)
|
||||
{
|
||||
result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture));
|
||||
result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + offset);
|
||||
|
||||
if (split.Length > 6)
|
||||
readCustomSampleBanks(split[6], bankInfo);
|
||||
@ -164,13 +169,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
||||
}
|
||||
|
||||
result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime);
|
||||
result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime + offset);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
throw new InvalidOperationException($@"Unknown hit object type {type}.");
|
||||
|
||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + offset;
|
||||
result.Samples = convertSoundType(soundType, bankInfo);
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user