mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
Update NoteDataFilter.hx
This commit is contained in:
parent
99f05e1084
commit
21cee45cbb
1 changed files with 19 additions and 16 deletions
|
@ -24,31 +24,33 @@ class NoteDataFilter
|
|||
|
||||
for (note in notes)
|
||||
{
|
||||
if (note == null)
|
||||
// noticed a bug that displayedNoteData somehow can have duplicate notes
|
||||
// thats why we need `chunks[chunks.length - 1].contains(note)`
|
||||
if (note == null || chunks[chunks.length - 1].contains(note))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note.time >= chunkTime && note.time < chunkTime + CHUNK_INTERVAL_MS)
|
||||
while (note.time >= chunkTime + CHUNK_INTERVAL_MS)
|
||||
{
|
||||
chunks[chunks.length - 1].push(note);
|
||||
}
|
||||
else
|
||||
{
|
||||
chunks.push([]);
|
||||
chunkTime += CHUNK_INTERVAL_MS;
|
||||
chunks.push([]);
|
||||
}
|
||||
|
||||
chunks[chunks.length - 1].push(note);
|
||||
}
|
||||
|
||||
for (chunk in chunks)
|
||||
{
|
||||
for (i in 0...chunk.length - 1)
|
||||
for (i in 0...(chunk.length - 1))
|
||||
{
|
||||
for (j in i...chunk.length)
|
||||
for (j in (i + 1)...chunk.length)
|
||||
{
|
||||
var noteI:SongNoteData = chunk[i];
|
||||
var noteJ:SongNoteData = chunk[j];
|
||||
|
||||
if (noteI.getStrumlineIndex() == noteJ.getStrumlineIndex() && noteI.getDirection() == noteJ.getDirection())
|
||||
{
|
||||
if (Math.abs(noteJ.time - noteI.time) <= threshold)
|
||||
{
|
||||
if (!stackedNotes.contains(noteI))
|
||||
|
@ -64,6 +66,7 @@ class NoteDataFilter
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stackedNotes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue