Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Assets/Script/Menu/DifficultySelect/DifficultySelectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ private void CreateInstrumentMenu()
var preferredInstrument = CurrentPlayer.Profile.PreferredInstrument;
CurrentPlayer.Profile.CurrentInstrument = instrument;

// Re-resolve after an instrument switch in case the raw harmony index is out
// of range for this song (ChangePlayer's check can be masked by the
// HarmonyIndex getter returning 0 when not on Harmony).
CurrentPlayer.Profile.ResolveHarmonyIndex(_maxHarmonyIndex);

// What we are doing here is resetting preferred instrument only if the current preferred instrument
// was an option for this chart. This ensures that preferred instrument does not change when the
// player is forced to use a different instrument.
Expand Down Expand Up @@ -606,11 +611,14 @@ private void ChangePlayer(int add)
_maxHarmonyIndex = Mathf.Min(_maxHarmonyIndex, showsong.VocalsCount);
}

// Set the harmony index to a valid one
if (profile.HarmonyIndex >= _maxHarmonyIndex)
{
profile.HarmonyIndex = 0;
}
// Resolve the effective harmony index for this song from the player's last
// explicit selection (clamped to the available parts). Uses ResolveHarmonyIndex
// so the raw backing field is checked regardless of CurrentInstrument
// (HarmonyIndex getter returns 0 when not on Harmony, which would mask an
// out-of-range value from a direct comparison), and so a song with fewer
// parts doesn't permanently erase the selection — like DifficultyFallback
// preserves Expert+ across songs that lack it.
profile.ResolveHarmonyIndex(_maxHarmonyIndex);

UpdatePossibleModifiers();

Expand Down