Consider "combo offsets" as legacy logic and separate from combo information

This commit is contained in:
Salman Ahmed
2021-05-05 07:27:57 +03:00
parent eeeb001d62
commit cd6d070b4a
17 changed files with 56 additions and 54 deletions

View File

@ -13,7 +13,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
public float X { get; set; }
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -18,21 +18,16 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
}
private bool forceNewCombo;
private int extraComboOffset;
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
newCombo |= forceNewCombo;
comboOffset += extraComboOffset;
forceNewCombo = false;
extraComboOffset = 0;
return new ConvertHit
{
X = position.X,
NewCombo = newCombo,
ComboOffset = comboOffset
};
}
@ -40,16 +35,12 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
List<IList<HitSampleInfo>> nodeSamples)
{
newCombo |= forceNewCombo;
comboOffset += extraComboOffset;
forceNewCombo = false;
extraComboOffset = 0;
return new ConvertSlider
{
X = position.X,
NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset,
Path = new SliderPath(controlPoints, length),
NodeSamples = nodeSamples,
RepeatCount = repeatCount
@ -58,11 +49,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
{
// Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo
// Their combo offset is still added to that next hitobject's combo index
forceNewCombo |= FormatVersion <= 8 || newCombo;
extraComboOffset += comboOffset;
return new ConvertSpinner
{
Duration = duration

View File

@ -13,7 +13,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
public float X { get; set; }
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -17,7 +17,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
public float X => 256; // Required for CatchBeatmapConverter
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary>
/// Legacy osu! Hit-type, used for parsing Beatmaps.
/// </summary>
internal sealed class ConvertHit : ConvertHitObject, IHasPosition, IHasCombo
internal sealed class ConvertHit : ConvertHitObject, IHasPosition, IHasCombo, IHasLegacyBeatmapComboOffset
{
public Vector2 Position { get; set; }
@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
public int LegacyBeatmapComboOffset { get; set; }
int IHasLegacyBeatmapComboOffset.LegacyBeatmapComboIndex { get; set; }
}
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
{
Position = position,
NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset
LegacyBeatmapComboOffset = comboOffset
};
}
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
{
Position = position,
NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset,
LegacyBeatmapComboOffset = comboOffset,
Path = new SliderPath(controlPoints, length),
NodeSamples = nodeSamples,
RepeatCount = repeatCount

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary>
/// Legacy osu! Slider-type, used for parsing Beatmaps.
/// </summary>
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo, IHasLegacyBeatmapComboOffset
{
public Vector2 Position { get; set; }
@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
public int LegacyBeatmapComboOffset { get; set; }
int IHasLegacyBeatmapComboOffset.LegacyBeatmapComboIndex { get; set; }
}
}

View File

@ -22,7 +22,5 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public float Y => Position.Y;
public bool NewCombo { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -12,10 +12,5 @@ namespace osu.Game.Rulesets.Objects.Types
/// Whether the HitObject starts a new combo.
/// </summary>
bool NewCombo { get; }
/// <summary>
/// When starting a new combo, the offset of the new combo relative to the current one.
/// </summary>
int ComboOffset { get; }
}
}

View File

@ -0,0 +1,24 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Rulesets.Objects.Types
{
/// <summary>
/// A type of <see cref="HitObject"/> that has a combo index with arbitrary offsets applied to use when retrieving legacy beatmap combo colours.
/// This is done in stable for hitobjects to skip combo colours from the beatmap skin (known as "colour hax").
/// See https://osu.ppy.sh/wiki/en/osu%21_File_Formats/Osu_%28file_format%29#type for more information.
/// </summary>
public interface IHasLegacyBeatmapComboOffset
{
/// <summary>
/// The legacy offset of the new combo relative to the current one, when starting a new combo.
/// </summary>
int LegacyBeatmapComboOffset { get; }
/// <summary>
/// The combo index with the <see cref="LegacyBeatmapComboOffset"/> applied,
/// to use for legacy beatmap skins to decide on the combo colour.
/// </summary>
int LegacyBeatmapComboIndex { get; set; }
}
}