Skip to content

Commit

Permalink
Merge pull request YARC-Official#65 from raphaelgoulart/master
Browse files Browse the repository at this point in the history
Make five fret combo recovery more natural
  • Loading branch information
EliteAsian123 authored Apr 10, 2023
2 parents 5cddf9e + 1284598 commit 78a79ef
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Assets/Script/PlayMode/FiveFretTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,38 @@ private void UpdateInput() {
return;
} else if (chord[0].hopo && Combo <= 0 && !strummed) {
return;
} else if (/*Combo <= 0 && */strummed && !ChordPressed(chord)) { // If strumming to recover combo, skip to first valid note within the timing window
UpdateOverstrums(true);
var ignore_overstrum = false;
for (int i = 0; i < allowedOverstrums.Count; i++) { // Ensure allowed overstrums won't break combos
if (ChordPressed(allowedOverstrums[i])) {
ignore_overstrum = true;
break;
}
}
if (!ignore_overstrum) {
var found = false;
foreach (List<NoteInfo> new_chord in expectedHits) {
if (Play.Instance.SongTime - new_chord[0].time > Play.HIT_MARGIN) { // Stop looking if note's not within the timing window
break;
}
if (ChordPressed(new_chord)) { // Stop looking if a valid note to strum was found
found = true;
chord = new_chord;
break;
}
}
if (found) {
// Miss all notes previous to the strummed note
while (expectedHits.Peek() != chord) {
var missedChord = expectedHits.Dequeue();
foreach (var hit in missedChord) {
notePool.MissNote(hit);
}
}
Combo = 0; // Reset the combo (it will be added to later on)
}
}
}

// Check if correct chord is pressed
Expand Down Expand Up @@ -220,7 +252,7 @@ private void UpdateInput() {
}
}

private void UpdateOverstrums() {
private void UpdateOverstrums(bool remove_outdated_only = false) {
// Remove all old allowed overstrums
while (allowedOverstrums.Count > 0
&& Play.Instance.SongTime - allowedOverstrums[0][0].time > Play.HIT_MARGIN) {
Expand All @@ -229,7 +261,7 @@ private void UpdateOverstrums() {
}

// Don't do anything else if we didn't strum
if (!strummed) {
if (!strummed || remove_outdated_only) {
return;
}

Expand Down

0 comments on commit 78a79ef

Please sign in to comment.