From 232bafdf114f757d707d9e9d641a824e836e659f Mon Sep 17 00:00:00 2001 From: Hyper_ Date: Mon, 7 Oct 2024 17:19:04 -0300 Subject: [PATCH] Fix wrong notes being removed from notesB --- .../ui/debug/charting/util/NoteDataFilter.hx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source/funkin/ui/debug/charting/util/NoteDataFilter.hx b/source/funkin/ui/debug/charting/util/NoteDataFilter.hx index 36bec094da..74717036be 100644 --- a/source/funkin/ui/debug/charting/util/NoteDataFilter.hx +++ b/source/funkin/ui/debug/charting/util/NoteDataFilter.hx @@ -80,30 +80,37 @@ class NoteDataFilter { // TODO: Maybe this whole function should be moved to SongNoteDataArrayTools var result:Array = notesA.copy(); + var overlappingNotes:Array = []; for (noteB in notesB) { - var overlaps:Bool = false; + var hasOverlap:Bool = false; for (noteA in notesA) { if (doNotesStack(noteA, noteB, threshold)) { - overlaps = true; + hasOverlap = true; break; } } - if (!overlaps) + if (!hasOverlap) { result.push(noteB); } else if (modifyB) { - notesB.remove(noteB); + overlappingNotes.push(noteB); } } + if (modifyB) + { + for (note in overlappingNotes) + notesB.remove(note); + } + return result; } @@ -113,8 +120,6 @@ class NoteDataFilter */ static inline function doNotesStack(noteA:SongNoteData, noteB:SongNoteData, threshold:Float):Bool { - return noteA.getStrumlineIndex() == noteB.getStrumlineIndex() - && noteA.getDirection() == noteB.getDirection() - && Math.abs(noteA.time - noteB.time) <= threshold; + return noteA.data == noteB.data && Math.abs(noteA.time - noteB.time) <= threshold; } }