Fix edit mode press and release holding tracking for editing mode.

This commit is contained in:
Joshua Sigona 2021-10-14 23:17:01 +09:00
parent 82c6f63538
commit 39759fa789
2 changed files with 21 additions and 14 deletions

View File

@ -402,12 +402,15 @@ public class LLSIG implements KeyListener{
} }
} else } else
if (PLAYING&&EDITMODE) { if (PLAYING&&EDITMODE) {
if (!LLSIG.game.lanes.get(lane).keyPressed) {
Note n = new Note(NoteType.NORMAL,musicPlayer.getPlayPosition()); Note n = new Note(NoteType.NORMAL,musicPlayer.getPlayPosition());
n.active=false; n.active=false;
//System.out.println(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE); //System.out.println(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE);
n.setBeatSnap(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE); n.setBeatSnap(Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE);
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
if (PLAYING&&!EDITMODE&&!EDITOR) { if (PLAYING&&!EDITMODE&&!EDITOR) {
Lane l = lanes.get(lane); Lane l = lanes.get(lane);
@ -466,6 +469,7 @@ public class LLSIG implements KeyListener{
} }
if (lane!=-1) { if (lane!=-1) {
if (PLAYING&&EDITMODE) { if (PLAYING&&EDITMODE) {
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;
Note lastNote = LLSIG.game.lanes.get(lane).lastNoteAdded; Note lastNote = LLSIG.game.lanes.get(lane).lastNoteAdded;
if (lastNote!=null) { if (lastNote!=null) {
@ -476,6 +480,8 @@ public class LLSIG implements KeyListener{
LLSIG.game.lanes.get(lane).lastNoteAdded=null; LLSIG.game.lanes.get(lane).lastNoteAdded=null;
} }
} }
LLSIG.game.lanes.get(lane).keyPressed=false;
}
} }
if (PLAYING&&!EDITMODE&&!EDITOR) { if (PLAYING&&!EDITMODE&&!EDITOR) {
keyState[lane]=false; keyState[lane]=false;

View File

@ -7,6 +7,7 @@ public class Lane{
TimingRating lastRating = TimingRating.MISS; TimingRating lastRating = TimingRating.MISS;
double lastNote = -1; double lastNote = -1;
Note lastNoteAdded; Note lastNoteAdded;
boolean keyPressed=false;
public Lane(List<Note> noteChart) { public Lane(List<Note> noteChart) {
super(); super();
this.noteChart = noteChart; this.noteChart = noteChart;