Add judgement and handling of hold notes.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago
parent 61a59a7495
commit 657d380161
  1. 29
      LLSIG/src/main/java/LLSIG/LLSIG.java
  2. 17
      LLSIG/src/main/java/LLSIG/Lane.java
  3. 4
      LLSIG/src/main/java/LLSIG/Note.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,7 +346,23 @@ 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) {
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;
}
}
}
keyState[lane]=true;
}
//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
@ -363,13 +379,6 @@ public class LLSIG implements KeyListener{
COMBO=0;
}
l.lastNote=LLSIG.game.musicPlayer.getPlayPosition();
n.active=false;
}
}
}
keyState[lane]=true;
}
//System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition());
}
@Override

@ -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&&note.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;

@ -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);

Loading…
Cancel
Save