Skip to content

Commit

Permalink
Fix wrong notes being removed from notesB
Browse files Browse the repository at this point in the history
  • Loading branch information
NotHyper-474 committed Oct 7, 2024
1 parent d9c455e commit 232bafd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/funkin/ui/debug/charting/util/NoteDataFilter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,37 @@ class NoteDataFilter
{
// TODO: Maybe this whole function should be moved to SongNoteDataArrayTools
var result:Array<SongNoteData> = notesA.copy();
var overlappingNotes:Array<SongNoteData> = [];

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;
}

Expand All @@ -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;
}
}

0 comments on commit 232bafd

Please sign in to comment.