1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Add combo offset to ConvertHitObjectParser

This commit is contained in:
smoogipoo 2018-08-15 10:48:42 +09:00
parent ce77473910
commit d2709613bc
6 changed files with 34 additions and 26 deletions

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo)
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new ConvertSlider
{
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
};
}
protected override HitObject CreateSpinner(Vector2 position, double endTime)
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return new ConvertSpinner
{
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return null;
}

View File

@ -43,8 +43,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture));
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax;
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ComboOffset;
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
type &= ~ConvertHitObjectType.NewCombo;
var soundType = (LegacySoundType)int.Parse(split[4]);
@ -54,7 +57,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (type.HasFlag(ConvertHitObjectType.Circle))
{
result = CreateHit(pos, combo);
result = CreateHit(pos, combo, comboOffset);
if (split.Length > 5)
readCustomSampleBanks(split[5], bankInfo);
@ -159,11 +162,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
for (int i = 0; i < nodes; i++)
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
result = CreateSlider(pos, combo, points, length, curveType, repeatCount, nodeSamples);
result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples);
}
else if (type.HasFlag(ConvertHitObjectType.Spinner))
{
result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset);
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset);
if (split.Length > 6)
readCustomSampleBanks(split[6], bankInfo);
@ -181,7 +184,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
}
result = CreateHold(pos, combo, endTime + Offset);
result = CreateHold(pos, combo, comboOffset, endTime + Offset);
}
if (result == null)
@ -232,37 +235,42 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// </summary>
/// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <returns>The hit object.</returns>
protected abstract HitObject CreateHit(Vector2 position, bool newCombo);
protected abstract HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset);
/// <summary>
/// Creats a legacy Slider-type hit object.
/// </summary>
/// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="controlPoints">The slider control points.</param>
/// <param name="length">The slider length.</param>
/// <param name="curveType">The slider curve type.</param>
/// <param name="repeatCount">The slider repeat count.</param>
/// <param name="repeatSamples">The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider.</param>
/// <returns>The hit object.</returns>
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples);
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples);
/// <summary>
/// Creates a legacy Spinner-type hit object.
/// </summary>
/// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="endTime">The spinner end time.</param>
/// <returns>The hit object.</returns>
protected abstract HitObject CreateSpinner(Vector2 position, double endTime);
protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime);
/// <summary>
/// Creates a legacy Hold-type hit object.
/// </summary>
/// <param name="position">The position of the hit object.</param>
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
/// <param name="endTime">The hold end time.</param>
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime);
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
private List<SampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
{

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
Slider = 1 << 1,
NewCombo = 1 << 2,
Spinner = 1 << 3,
ColourHax = 112,
ComboOffset = 1 << 4 | 1 << 5 | 1 << 6,
Hold = 1 << 7
}
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo)
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new ConvertSlider
{
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
};
}
protected override HitObject CreateSpinner(Vector2 position, double endTime)
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return new ConvertSpinner
{
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return new ConvertHold
{

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo)
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new ConvertSlider
{
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
};
}
protected override HitObject CreateSpinner(Vector2 position, double endTime)
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return new ConvertSpinner
{
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return null;
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo)
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List<Vector2> controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
{
return new ConvertSlider
{
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
};
}
protected override HitObject CreateSpinner(Vector2 position, double endTime)
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return new ConvertSpinner
{
@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime)
{
return null;
}