From 7554a765c3480437d5b73974d18c787aacfaa421 Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Fri, 15 Oct 2021 13:38:54 +0900 Subject: [PATCH] Hold note replacements when dragging over other notes. --- LLSIG/src/main/java/LLSIG/LLSIG.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/LLSIG/src/main/java/LLSIG/LLSIG.java b/LLSIG/src/main/java/LLSIG/LLSIG.java index 24757e2..ecbe381 100644 --- a/LLSIG/src/main/java/LLSIG/LLSIG.java +++ b/LLSIG/src/main/java/LLSIG/LLSIG.java @@ -52,7 +52,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{ public boolean METRONOME = false; public boolean BPM_MEASURE = false; public boolean PLAYING = true; //Whether or not a song is loaded and playing. - public boolean EDITOR = false; //Whether or not we are in beatmap editing mode. + public boolean EDITOR = true; //Whether or not we are in beatmap editing mode. public boolean HOLDING_CTRL_KEY = false; public static double EDITOR_CURSOR_BEAT = 0; @@ -497,11 +497,16 @@ public class LLSIG implements KeyListener,MouseWheelListener{ if (LLSIG.game.lanes.get(lane).keyPressed) { Note lastNote = LLSIG.game.lanes.get(lane).lastNoteAdded; if (lastNote!=null) { - if (EDITOR_CURSOR_BEAT!=lastNote.getBeatSnap()) { - double noteBeat = Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE; + if (EDITOR_CURSOR_BEAT-lastNote.getBeatSnap()>=1) { + List matchingNotes = LLSIG.game.lanes.get(lane).noteChart.stream().filter((note)->(note!=lastNote&¬e.getBeatSnap()<=EDITOR_CURSOR_BEAT&¬e.getBeatSnap()>=lastNote.getBeatSnap())||(note.getNoteType()==NoteType.HOLD&&((EDITOR_CURSOR_BEAT>=note.getBeatSnap()&&EDITOR_CURSOR_BEAT<=note.getBeatSnapEnd())||(lastNote.getBeatSnap()>=note.getBeatSnap()&&lastNote.getBeatSnap()<=note.getBeatSnapEnd())))).collect(Collectors.toList()); + for (Note n : matchingNotes) { + n.markForDeletion(); + } + double noteBeat = Math.round(EDITOR_CURSOR_BEAT*beatDelay); //Create a hold note to this position. + lastNote.setEndFrame(noteBeat); lastNote.setNoteType(NoteType.HOLD); - lastNote.setBeatSnapEnd(noteBeat); + lastNote.setBeatSnapEnd(EDITOR_CURSOR_BEAT); lastNote.active2=false; } }