diff --git a/LLSIG/src/main/java/LLSIG/LLSIG.java b/LLSIG/src/main/java/LLSIG/LLSIG.java index a38ef48..91e836e 100644 --- a/LLSIG/src/main/java/LLSIG/LLSIG.java +++ b/LLSIG/src/main/java/LLSIG/LLSIG.java @@ -161,9 +161,9 @@ public class LLSIG implements KeyListener{ for (int i=0;i<9;i++) { Lane l =lanes.get(i); l.markMissedNotes(); - if (!EDITMODE) { + /*if (!EDITMODE) { l.clearOutInactiveNotes(); - } + }*/ } window.repaint(); long endTime = System.nanoTime(); @@ -346,23 +346,13 @@ public class LLSIG implements KeyListener{ if (l.noteExists()) { Note n = l.getNote(); double diff = n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition(); - if (diff<=BAD_TIMING_WINDOW) { - if (Math.abs(diff)<=PERFECT_TIMING_WINDOW) {l.lastRating=TimingRating.PERFECT;COMBO++;PERFECT_COUNT++;LAST_PERFECT=LLSIG.game.musicPlayer.getPlayPosition();} else - if (Math.abs(diff)<=EXCELLENT_TIMING_WINDOW) {l.lastRating=TimingRating.EXCELLENT;COMBO++;EXCELLENT_COUNT++;LAST_EXCELLENT=LLSIG.game.musicPlayer.getPlayPosition();} else - if (Math.abs(diff)<=GREAT_TIMING_WINDOW) {l.lastRating=TimingRating.GREAT;COMBO++;GREAT_COUNT++;LAST_GREAT=LLSIG.game.musicPlayer.getPlayPosition();} else - if (Math.abs(diff)<=BAD_TIMING_WINDOW) { - if (Math.signum(diff)>0) { - l.lastRating=TimingRating.EARLY; - EARLY_COUNT++; - LAST_EARLY=LLSIG.game.musicPlayer.getPlayPosition(); - } else { - l.lastRating=TimingRating.LATE; - LATE_COUNT++; - LAST_LATE=LLSIG.game.musicPlayer.getPlayPosition(); - } - COMBO=0; - } - l.lastNote=LLSIG.game.musicPlayer.getPlayPosition(); + double diff2 = n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition(); + if (n.getNoteType()==NoteType.HOLD&&n.active2&&!n.active&&diff2<=BAD_TIMING_WINDOW) { + judgeNote(l, diff2); + n.active2=false; + } + if (n.active&&diff<=BAD_TIMING_WINDOW) { + judgeNote(l, diff); n.active=false; } } @@ -372,6 +362,25 @@ public class LLSIG implements KeyListener{ //System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition()); } + private void judgeNote(Lane l, double diff) { + if (Math.abs(diff)<=PERFECT_TIMING_WINDOW) {l.lastRating=TimingRating.PERFECT;COMBO++;PERFECT_COUNT++;LAST_PERFECT=LLSIG.game.musicPlayer.getPlayPosition();} else + if (Math.abs(diff)<=EXCELLENT_TIMING_WINDOW) {l.lastRating=TimingRating.EXCELLENT;COMBO++;EXCELLENT_COUNT++;LAST_EXCELLENT=LLSIG.game.musicPlayer.getPlayPosition();} else + if (Math.abs(diff)<=GREAT_TIMING_WINDOW) {l.lastRating=TimingRating.GREAT;COMBO++;GREAT_COUNT++;LAST_GREAT=LLSIG.game.musicPlayer.getPlayPosition();} else + if (Math.abs(diff)<=BAD_TIMING_WINDOW) { + if (Math.signum(diff)>0) { + l.lastRating=TimingRating.EARLY; + EARLY_COUNT++; + LAST_EARLY=LLSIG.game.musicPlayer.getPlayPosition(); + } else { + l.lastRating=TimingRating.LATE; + LATE_COUNT++; + LAST_LATE=LLSIG.game.musicPlayer.getPlayPosition(); + } + COMBO=0; + } + l.lastNote=LLSIG.game.musicPlayer.getPlayPosition(); + } + @Override public void keyReleased(KeyEvent e) { int lane = -1; diff --git a/LLSIG/src/main/java/LLSIG/Lane.java b/LLSIG/src/main/java/LLSIG/Lane.java index d38868c..6350caf 100644 --- a/LLSIG/src/main/java/LLSIG/Lane.java +++ b/LLSIG/src/main/java/LLSIG/Lane.java @@ -14,7 +14,7 @@ public class Lane{ return currentNoteIndex==noteChart.size()-1; } public void clearOutInactiveNotes() { - noteChart.removeIf(note->!note.active); + noteChart.removeIf(note->!note.active&&!note.active2); } public boolean noteExists() { return getNote()!=null; @@ -64,8 +64,21 @@ public class Lane{ if (LLSIG.game.PLAYING) { noteChart.forEach((note)->{ double diff = note.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition(); - if (diff<-LLSIG.BAD_TIMING_WINDOW) { + double diff2 = note.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition(); + if (note.getNoteType()==NoteType.HOLD&¬e.active2&&!note.active&&diff2<-LLSIG.BAD_TIMING_WINDOW) { + note.active2=false; + lastRating = TimingRating.MISS; + lastNote = LLSIG.game.musicPlayer.getPlayPosition(); + LLSIG.COMBO=0; + LLSIG.MISS_COUNT++; + LLSIG.LAST_MISS=LLSIG.game.musicPlayer.getPlayPosition(); + } + if (note.active&&diff<-LLSIG.BAD_TIMING_WINDOW) { note.active=false; + if (note.getNoteType()==NoteType.HOLD) { + note.active2=false; //Count as a double miss, since we missed the first part. + LLSIG.MISS_COUNT++; + } lastRating = TimingRating.MISS; lastNote = LLSIG.game.musicPlayer.getPlayPosition(); LLSIG.COMBO=0; diff --git a/LLSIG/src/main/java/LLSIG/Note.java b/LLSIG/src/main/java/LLSIG/Note.java index 04beafc..e165ddc 100644 --- a/LLSIG/src/main/java/LLSIG/Note.java +++ b/LLSIG/src/main/java/LLSIG/Note.java @@ -4,11 +4,15 @@ public class Note { NoteType type; double start,end; 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; public Note(NoteType type,double start,double end) { this.type=type; this.start=start; this.end=end; + if (type==NoteType.HOLD) { + this.active2=true; + } } public Note(NoteType type,double start) { this(type,start,-1);