From d32f46f279fe97f3d50675c349be1140b7c31d54 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Thu, 14 Oct 2021 01:55:05 +0000 Subject: [PATCH] Mark notes for deletion when they are passed a rewinded point. Co-authored-by: sigonasr2 --- LLSIG/src/main/java/LLSIG/LLSIG.java | 4 ++++ LLSIG/src/main/java/LLSIG/Lane.java | 2 +- LLSIG/src/main/java/LLSIG/Note.java | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/LLSIG/src/main/java/LLSIG/LLSIG.java b/LLSIG/src/main/java/LLSIG/LLSIG.java index 80e8715..3185efa 100644 --- a/LLSIG/src/main/java/LLSIG/LLSIG.java +++ b/LLSIG/src/main/java/LLSIG/LLSIG.java @@ -318,6 +318,10 @@ public class LLSIG implements KeyListener{ beatNumber=Math.max(0,beatNumber-12); } musicPlayer.seek((long)(Math.floor(musicPlayer.getPlayPosition()-(beatDelay*12)))); + double noteBeat = Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE; + LLSIG.game.lanes.forEach((l)->{ + l.noteChart.forEach((note)->{if (note.getBeatSnap()>noteBeat) {note.markForDeletion();}}); + }); }break; case KeyEvent.VK_S:{lane=1;}break; case KeyEvent.VK_D:{lane=2;}break; diff --git a/LLSIG/src/main/java/LLSIG/Lane.java b/LLSIG/src/main/java/LLSIG/Lane.java index ce711d0..9b03dc2 100644 --- a/LLSIG/src/main/java/LLSIG/Lane.java +++ b/LLSIG/src/main/java/LLSIG/Lane.java @@ -15,7 +15,7 @@ public class Lane{ return currentNoteIndex==noteChart.size()-1; } public void clearOutInactiveNotes() { - noteChart.removeIf(note->!note.active&&!note.active2); + noteChart.removeIf(note->note.deleted||(!note.active&&!note.active2)); } public boolean noteExists() { return getNote()!=null; diff --git a/LLSIG/src/main/java/LLSIG/Note.java b/LLSIG/src/main/java/LLSIG/Note.java index e165ddc..947f748 100644 --- a/LLSIG/src/main/java/LLSIG/Note.java +++ b/LLSIG/src/main/java/LLSIG/Note.java @@ -6,6 +6,7 @@ public class Note { boolean active=true; //Set to false when the note has been scored. boolean active2=false; //Set to false when the end section of the note has been scored. double beatSnapStart,beatSnapEnd = -1; + boolean deleted=false; //Set this marker to delete it on the next frame (when using the editor) public Note(NoteType type,double start,double end) { this.type=type; this.start=start; @@ -47,6 +48,9 @@ public class Note { public double getBeatSnapEnd() { return beatSnapEnd; } + public void markForDeletion() { + deleted=true; + } @Override public String toString() { return "Note [type=" + type + ", start=" + start + ", end=" + end + "]";