Creation of hold notes in the editor.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago
parent ede61ed878
commit 2bb458d99c
  1. 45
      LLSIG/src/main/java/LLSIG/LLSIG.java

@ -391,19 +391,22 @@ public class LLSIG implements KeyListener{
if (lane!=-1) { if (lane!=-1) {
if (EDITOR) { if (EDITOR) {
Lane l = LLSIG.game.lanes.get(lane); Lane l = LLSIG.game.lanes.get(lane);
List<Note> matchingNotes = l.noteChart.stream().filter((note)->note.getBeatSnap()==EDITOR_CURSOR_BEAT||(note.getNoteType()==NoteType.HOLD&&note.getBeatSnap()<=EDITOR_CURSOR_BEAT&&note.getBeatSnapEnd()>=EDITOR_CURSOR_BEAT)).collect(Collectors.toList()); if (!l.keyPressed) {
boolean replace=true; List<Note> matchingNotes = l.noteChart.stream().filter((note)->note.getBeatSnap()==EDITOR_CURSOR_BEAT||(note.getNoteType()==NoteType.HOLD&&note.getBeatSnap()<=EDITOR_CURSOR_BEAT&&note.getBeatSnapEnd()>=EDITOR_CURSOR_BEAT)).collect(Collectors.toList());
for (Note n : matchingNotes) { boolean replace=true;
if (n.getNoteType()!=NoteType.HOLD) {replace=false;} //We don't replace the note if the position was exactly matching as we may have wanted to remove the note completely. for (Note n : matchingNotes) {
n.markForDeletion(); if (n.getNoteType()!=NoteType.HOLD) {replace=false;} //We don't replace the note if the position was exactly matching as we may have wanted to remove the note completely.
} n.markForDeletion();
if (replace) { }
Note n = new Note(NoteType.NORMAL,beatDelay*EDITOR_CURSOR_BEAT); if (replace) {
n.active=false; Note n = new Note(NoteType.NORMAL,beatDelay*EDITOR_CURSOR_BEAT);
//System.out.println(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE); n.active=false;
n.setBeatSnap(EDITOR_CURSOR_BEAT); //System.out.println(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE);
LLSIG.game.lanes.get(lane).addNote(n,true); n.setBeatSnap(EDITOR_CURSOR_BEAT);
LLSIG.game.lanes.get(lane).lastNoteAdded=n; LLSIG.game.lanes.get(lane).addNote(n,true);
LLSIG.game.lanes.get(lane).lastNoteAdded=n;
l.keyPressed=true;
}
} }
} else } else
if (PLAYING&&EDITMODE) { if (PLAYING&&EDITMODE) {
@ -424,7 +427,6 @@ public class LLSIG implements KeyListener{
n.setBeatSnap(snapBeat); n.setBeatSnap(snapBeat);
LLSIG.game.lanes.get(lane).addNote(n); LLSIG.game.lanes.get(lane).addNote(n);
LLSIG.game.lanes.get(lane).lastNoteAdded=n; LLSIG.game.lanes.get(lane).lastNoteAdded=n;
LLSIG.game.lanes.get(lane).keyPressed=true;
} }
} }
} else } else
@ -484,6 +486,21 @@ public class LLSIG implements KeyListener{
case KeyEvent.VK_SEMICOLON:{lane=8;}break; case KeyEvent.VK_SEMICOLON:{lane=8;}break;
} }
if (lane!=-1) { if (lane!=-1) {
if (EDITOR) {
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;
//Create a hold note to this position.
lastNote.setNoteType(NoteType.HOLD);
lastNote.setBeatSnapEnd(noteBeat);
lastNote.active2=false;
}
}
LLSIG.game.lanes.get(lane).keyPressed=false;
}
}
if (PLAYING&&EDITMODE) { if (PLAYING&&EDITMODE) {
if (LLSIG.game.lanes.get(lane).keyPressed) { if (LLSIG.game.lanes.get(lane).keyPressed) {
double noteBeat = Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE; double noteBeat = Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE;

Loading…
Cancel
Save