Add judgement and handling of hold notes.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
61a59a7495
commit
657d380161
@ -161,9 +161,9 @@ public class LLSIG implements KeyListener{
|
|||||||
for (int i=0;i<9;i++) {
|
for (int i=0;i<9;i++) {
|
||||||
Lane l =lanes.get(i);
|
Lane l =lanes.get(i);
|
||||||
l.markMissedNotes();
|
l.markMissedNotes();
|
||||||
if (!EDITMODE) {
|
/*if (!EDITMODE) {
|
||||||
l.clearOutInactiveNotes();
|
l.clearOutInactiveNotes();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
window.repaint();
|
window.repaint();
|
||||||
long endTime = System.nanoTime();
|
long endTime = System.nanoTime();
|
||||||
@ -346,7 +346,23 @@ public class LLSIG implements KeyListener{
|
|||||||
if (l.noteExists()) {
|
if (l.noteExists()) {
|
||||||
Note n = l.getNote();
|
Note n = l.getNote();
|
||||||
double diff = n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition();
|
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)<=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)<=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)<=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;
|
COMBO=0;
|
||||||
}
|
}
|
||||||
l.lastNote=LLSIG.game.musicPlayer.getPlayPosition();
|
l.lastNote=LLSIG.game.musicPlayer.getPlayPosition();
|
||||||
n.active=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
keyState[lane]=true;
|
|
||||||
}
|
|
||||||
//System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,7 +14,7 @@ public class Lane{
|
|||||||
return currentNoteIndex==noteChart.size()-1;
|
return currentNoteIndex==noteChart.size()-1;
|
||||||
}
|
}
|
||||||
public void clearOutInactiveNotes() {
|
public void clearOutInactiveNotes() {
|
||||||
noteChart.removeIf(note->!note.active);
|
noteChart.removeIf(note->!note.active&&!note.active2);
|
||||||
}
|
}
|
||||||
public boolean noteExists() {
|
public boolean noteExists() {
|
||||||
return getNote()!=null;
|
return getNote()!=null;
|
||||||
@ -64,8 +64,21 @@ public class Lane{
|
|||||||
if (LLSIG.game.PLAYING) {
|
if (LLSIG.game.PLAYING) {
|
||||||
noteChart.forEach((note)->{
|
noteChart.forEach((note)->{
|
||||||
double diff = note.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition();
|
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;
|
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;
|
lastRating = TimingRating.MISS;
|
||||||
lastNote = LLSIG.game.musicPlayer.getPlayPosition();
|
lastNote = LLSIG.game.musicPlayer.getPlayPosition();
|
||||||
LLSIG.COMBO=0;
|
LLSIG.COMBO=0;
|
||||||
|
@ -4,11 +4,15 @@ public class Note {
|
|||||||
NoteType type;
|
NoteType type;
|
||||||
double start,end;
|
double start,end;
|
||||||
boolean active=true; //Set to false when the note has been scored.
|
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;
|
double beatSnapStart,beatSnapEnd = -1;
|
||||||
public Note(NoteType type,double start,double end) {
|
public Note(NoteType type,double start,double end) {
|
||||||
this.type=type;
|
this.type=type;
|
||||||
this.start=start;
|
this.start=start;
|
||||||
this.end=end;
|
this.end=end;
|
||||||
|
if (type==NoteType.HOLD) {
|
||||||
|
this.active2=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public Note(NoteType type,double start) {
|
public Note(NoteType type,double start) {
|
||||||
this(type,start,-1);
|
this(type,start,-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user