Fix hit object coordinates being truncated to `int` values

Closes https://github.com/ppy/osu/issues/29340.
This commit is contained in:
Dean Herbert 2024-08-09 16:19:25 +09:00
parent 2114f092c7
commit d072c6a743
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -18,6 +18,12 @@ public abstract class LegacyDecoder<T> : Decoder<T>
{
public const int LATEST_VERSION = 14;
/// <summary>
/// The .osu format (beatmap) version.
///
/// osu!stable's versions end at <see cref="LATEST_VERSION"/>.
/// osu!lazer's versions starts at <see cref="LegacyBeatmapEncoder.FIRST_LAZER_VERSION"/>.
/// </summary>
protected readonly int FormatVersion;
protected LegacyDecoder(int version)

View File

@ -32,7 +32,7 @@ public abstract class ConvertHitObjectParser : HitObjectParser
protected readonly double Offset;
/// <summary>
/// The beatmap version.
/// The .osu format (beatmap) version.
/// </summary>
protected readonly int FormatVersion;
@ -48,7 +48,10 @@ public override HitObject Parse(string text)
{
string[] split = text.Split(',');
Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
Vector2 pos =
FormatVersion >= LegacyBeatmapEncoder.FIRST_LAZER_VERSION
? new Vector2(Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE))
: new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
double startTime = Parsing.ParseDouble(split[2]) + Offset;