Revert making ComboOffsets legacy and define BeatmapSkinComboIndex instead

This commit is contained in:
Salman Ahmed
2021-07-20 14:15:43 +03:00
parent 3a974d5027
commit 9d92b795fa
22 changed files with 102 additions and 78 deletions

View File

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

View File

@ -18,16 +18,21 @@ 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
{
Position = position,
NewCombo = newCombo,
ComboOffset = comboOffset
};
}
@ -35,12 +40,16 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
List<IList<HitSampleInfo>> nodeSamples)
{
newCombo |= forceNewCombo;
comboOffset += extraComboOffset;
forceNewCombo = false;
extraComboOffset = 0;
return new ConvertSlider
{
Position = position,
NewCombo = FirstObject || newCombo,
ComboOffset = comboOffset,
Path = new SliderPath(controlPoints, length),
NodeSamples = nodeSamples,
RepeatCount = repeatCount
@ -49,6 +58,11 @@ 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

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

View File

@ -17,5 +17,7 @@ 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, IHasLegacyBeatmapComboOffset
internal sealed class ConvertHit : ConvertHitObject, IHasPosition, IHasCombo
{
public Vector2 Position { get; set; }
@ -19,8 +19,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; }
public int LegacyBeatmapComboOffset { get; set; }
int IHasLegacyBeatmapComboOffset.LegacyBeatmapComboIndex { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
{
Position = position,
NewCombo = FirstObject || newCombo,
LegacyBeatmapComboOffset = comboOffset
ComboOffset = comboOffset
};
}
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
{
Position = position,
NewCombo = FirstObject || newCombo,
LegacyBeatmapComboOffset = comboOffset,
ComboOffset = 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, IHasLegacyBeatmapComboOffset
internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo
{
public Vector2 Position { get; set; }
@ -19,8 +19,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; }
public int LegacyBeatmapComboOffset { get; set; }
int IHasLegacyBeatmapComboOffset.LegacyBeatmapComboIndex { get; set; }
public int ComboOffset { get; set; }
}
}

View File

@ -22,5 +22,7 @@ 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,5 +12,10 @@ 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

@ -26,6 +26,12 @@ namespace osu.Game.Rulesets.Objects.Types
/// </summary>
int ComboIndex { get; set; }
/// <summary>
/// A <see cref="ComboIndex"/> with the <see cref="IHasCombo.ComboOffset"/> of this and all previous hitobjects applied to it.
/// This is used primarily for beatmap skins during combo colour retrieval, rather than the regular <see cref="ComboIndex"/>.
/// </summary>
int BeatmapSkinComboIndex { get; set; }
/// <summary>
/// Whether the HitObject starts a new combo.
/// </summary>

View File

@ -1,24 +0,0 @@
// 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; }
}
}