Add hold note generation when recording.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago
parent 30ffb07e63
commit 2ad46ea580
  1. 36
      LLSIG/src/main/java/LLSIG/LLSIG.java
  2. 3
      LLSIG/src/main/java/LLSIG/Lane.java

@ -79,6 +79,8 @@ public class LLSIG implements KeyListener{
public static double LAST_LATE = 0; public static double LAST_LATE = 0;
public static double LAST_MISS = 0; public static double LAST_MISS = 0;
public static int COMBO = 0; public static int COMBO = 0;
public final static int NOTE_RECORD_BEAT_SNAP_MULTIPLE = 4; //How many beat divisions max we can snap to.
public final static long TIMEPERTICK = 16666667l; public final static long TIMEPERTICK = 16666667l;
public static double DRAWTIME=0; public static double DRAWTIME=0;
@ -337,9 +339,10 @@ public class LLSIG implements KeyListener{
if (PLAYING&&EDITMODE) { if (PLAYING&&EDITMODE) {
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)*4)/(double)4); //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)*4)/(double)4); 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;
} }
if (PLAYING&&!EDITMODE&&!EDITOR) { if (PLAYING&&!EDITMODE&&!EDITOR) {
Lane l = lanes.get(lane); Lane l = lanes.get(lane);
@ -391,14 +394,27 @@ 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) {
keyState[lane]=false; if (PLAYING&&EDITMODE) {
Lane l = lanes.get(lane); double noteBeat = Math.round(((musicPlayer.getPlayPosition()-offset)/beatDelay)*NOTE_RECORD_BEAT_SNAP_MULTIPLE)/(double)NOTE_RECORD_BEAT_SNAP_MULTIPLE;
if (l.noteExists()) { Note lastNote = LLSIG.game.lanes.get(lane).lastNoteAdded;
Note n = l.getNote(); if (lastNote!=null) {
double diff2 = n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition(); if (noteBeat-lastNote.getBeatSnap()>=1) {
if (n.getNoteType()==NoteType.HOLD&&n.active2&&!n.active&&diff2<=BAD_TIMING_WINDOW) { lastNote.setBeatSnapEnd(noteBeat);
judgeNote(l, diff2); lastNote.active2=false;
n.active2=false; LLSIG.game.lanes.get(lane).lastNoteAdded=null;
}
}
}
if (PLAYING&&!EDITMODE&&!EDITOR) {
keyState[lane]=false;
Lane l = lanes.get(lane);
if (l.noteExists()) {
Note n = l.getNote();
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;
}
} }
} }
} }

@ -6,6 +6,7 @@ public class Lane{
int currentNoteIndex = 0; int currentNoteIndex = 0;
TimingRating lastRating = TimingRating.MISS; TimingRating lastRating = TimingRating.MISS;
double lastNote = -1; double lastNote = -1;
Note lastNoteAdded;
public Lane(List<Note> noteChart) { public Lane(List<Note> noteChart) {
super(); super();
this.noteChart = noteChart; this.noteChart = noteChart;
@ -34,7 +35,7 @@ public class Lane{
for (int i=0;i<noteChart.size();i++) for (int i=0;i<noteChart.size();i++)
{ {
Note n = getNote(i); Note n = getNote(i);
if (n.active) {return n;} if (n.active||n.active2) {return n;}
} }
return null; return null;
} }

Loading…
Cancel
Save