Performance optimizing for chart reading and playing of larger note charts
This commit is contained in:
parent
4938f4a016
commit
c131aade15
@ -159,7 +159,8 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
}
|
||||
}
|
||||
g.setColor(NOTE_COLOR);
|
||||
int noteCounter = 0;
|
||||
int noteCounter = LLSIG.noteCounter[i];
|
||||
//System.out.println("Starting from "+noteCounter);
|
||||
while (lane.noteExists(noteCounter)) {
|
||||
Note n = lane.getNote(noteCounter);
|
||||
if (n.active||n.active2) {
|
||||
@ -189,10 +190,8 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
drawNote(g,MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2,MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2,Math.min(CLAMPED_PLAYTIME_RATIO/2+0.5,1),Math.min(CLAMPED_PLAYTIME_RATIO/2+0.5,1),false);
|
||||
}
|
||||
}
|
||||
if ((n.active2)&&n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition()>LLSIG.game.NOTE_SPEED) {
|
||||
break;
|
||||
} else
|
||||
if ((n.active)&&n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()>LLSIG.game.NOTE_SPEED) {
|
||||
if ((n.active||n.active2)&&n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()>LLSIG.game.NOTE_SPEED) {
|
||||
//System.out.println("Lane "+i+": Stopping at note "+noteCounter);
|
||||
break;
|
||||
}
|
||||
noteCounter++;
|
||||
@ -210,7 +209,7 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
if (multiple) {
|
||||
Color drawCol = g.getColor();
|
||||
g.setColor(multiple_col?Color.RED:Color.BLUE);
|
||||
g.fillRoundRect((int)x,(int)(y+(ysize*NOTE_SIZE)/2),(int)(xsize*NOTE_SIZE), 8, 4, 24);
|
||||
g.fillRect((int)x,(int)(y+(ysize*NOTE_SIZE)/2),(int)(xsize*NOTE_SIZE), 8);
|
||||
g.setColor(drawCol);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@ public class LLSIG implements KeyListener,MouseWheelListener{
|
||||
public static double beatDelay = ((1/((double)bpm/60))*1000);
|
||||
public static boolean lastHold = false; //A toggle. Decides primary/secondary color marking.
|
||||
|
||||
|
||||
public static int[] noteCounter = new int[9];
|
||||
|
||||
public static List<Long> beats = new ArrayList<Long>();
|
||||
|
||||
int NOTE_SPEED = 750; //The note speed determines how early you see the note. So lowering this number increases the speed.
|
||||
@ -175,7 +178,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{
|
||||
if (PLAYING) {
|
||||
for (int i=0;i<9;i++) {
|
||||
Lane l =lanes.get(i);
|
||||
l.markMissedNotes();
|
||||
l.markMissedNotes(i);
|
||||
/*if (!EDITMODE) {
|
||||
l.clearOutInactiveNotes();
|
||||
}*/
|
||||
@ -476,15 +479,21 @@ public class LLSIG implements KeyListener,MouseWheelListener{
|
||||
} else
|
||||
if (PLAYING&&!EDITMODE&&!EDITOR) {
|
||||
Lane l = lanes.get(lane);
|
||||
if (!l.keyPressed) {
|
||||
if (l.noteExists()) {
|
||||
Note n = l.getNote();
|
||||
double diff = n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition();
|
||||
if (n.active&&diff<=BAD_TIMING_WINDOW) {
|
||||
judgeNote(l, diff, false);
|
||||
n.active=false;
|
||||
if (n.getNoteType()!=NoteType.HOLD) {
|
||||
noteCounter[lane]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
l.keyPressed=true;
|
||||
}
|
||||
}
|
||||
keyState[lane]=true;
|
||||
}
|
||||
//System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition());
|
||||
@ -619,8 +628,10 @@ public class LLSIG implements KeyListener,MouseWheelListener{
|
||||
if (n.getNoteType()==NoteType.HOLD&&n.active2&&!n.active) {
|
||||
judgeNote(l, diff2, true);
|
||||
n.active2=false;
|
||||
LLSIG.noteCounter[lane]++;
|
||||
}
|
||||
}
|
||||
l.keyPressed=false;
|
||||
}
|
||||
keyState[lane]=false;
|
||||
}
|
||||
|
||||
@ -117,14 +117,15 @@ public class Lane{
|
||||
}
|
||||
addQueue.clear();
|
||||
}
|
||||
public void markMissedNotes() {
|
||||
public void markMissedNotes(int laneNumber) {
|
||||
if (LLSIG.game.PLAYING) {
|
||||
int noteCounter=0;
|
||||
int noteCounter=LLSIG.noteCounter[laneNumber];
|
||||
while (noteExists(noteCounter)) {
|
||||
Note note = getNote(noteCounter);
|
||||
double diff = note.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition();
|
||||
double diff2 = note.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition();
|
||||
if (note.getNoteType()==NoteType.HOLD&¬e.active2&&!note.active&&diff2<-LLSIG.BAD_TIMING_WINDOW) {
|
||||
LLSIG.noteCounter[laneNumber]++;
|
||||
note.active2=false;
|
||||
lastRating = TimingRating.MISS;
|
||||
lastNote = LLSIG.game.musicPlayer.getPlayPosition();
|
||||
@ -133,6 +134,7 @@ public class Lane{
|
||||
LLSIG.LAST_MISS=LLSIG.game.musicPlayer.getPlayPosition();
|
||||
}
|
||||
if (note.active&&diff<-LLSIG.BAD_TIMING_WINDOW) {
|
||||
LLSIG.noteCounter[laneNumber]++;
|
||||
note.active=false;
|
||||
if (note.getNoteType()==NoteType.HOLD) {
|
||||
note.active2=false; //Count as a double miss, since we missed the first part.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user