Multi note marking fixed up for note additions

main
Joshua Sigona 3 years ago
parent 610cc44f11
commit 21c16a0520
  1. 2
      LLSIG/src/main/java/LLSIG/Canvas.java
  2. 36
      LLSIG/src/main/java/LLSIG/LLSIG.java
  3. 3
      LLSIG/src/main/java/LLSIG/Lane.java

@ -205,8 +205,10 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
public void drawNote(Graphics g,double x,double y,double xsize,double ysize,boolean multiple,boolean multiple_col) { public void drawNote(Graphics g,double x,double y,double xsize,double ysize,boolean multiple,boolean multiple_col) {
g.fillOval((int)x,(int)y,(int)(xsize*NOTE_SIZE),(int)(ysize*NOTE_SIZE)); g.fillOval((int)x,(int)y,(int)(xsize*NOTE_SIZE),(int)(ysize*NOTE_SIZE));
if (multiple) { if (multiple) {
Color drawCol = g.getColor();
g.setColor(multiple_col?Color.RED:Color.BLUE); g.setColor(multiple_col?Color.RED:Color.BLUE);
g.fillRoundRect((int)x,(int)(y+(ysize*NOTE_SIZE)/2),(int)(xsize*NOTE_SIZE), 4, 6, 2); g.fillRoundRect((int)x,(int)(y+(ysize*NOTE_SIZE)/2),(int)(xsize*NOTE_SIZE), 4, 6, 2);
g.setColor(drawCol);
} }
} }
@Override @Override

@ -8,7 +8,9 @@ import java.awt.event.MouseWheelListener;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -53,7 +55,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{
public boolean METRONOME = false; public boolean METRONOME = false;
public boolean BPM_MEASURE = false; public boolean BPM_MEASURE = false;
public boolean PLAYING = true; //Whether or not a song is loaded and playing. public boolean PLAYING = true; //Whether or not a song is loaded and playing.
public boolean EDITOR = false; //Whether or not we are in beatmap editing mode. public boolean EDITOR = true; //Whether or not we are in beatmap editing mode.
public boolean HOLDING_CTRL_KEY = false; public boolean HOLDING_CTRL_KEY = false;
public static double EDITOR_CURSOR_BEAT = 0; public static double EDITOR_CURSOR_BEAT = 0;
@ -148,6 +150,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{
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.clearOutDeletedNotes(); l.clearOutDeletedNotes();
l.addFromQueue();
} }
if (!musicPlayer.isPaused()) { if (!musicPlayer.isPaused()) {
EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay; EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay;
@ -457,6 +460,37 @@ public class LLSIG implements KeyListener,MouseWheelListener{
//System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition()); //System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition());
} }
public static void updateMultipleNoteMarkers() {
updateMultipleNoteMarkers(LLSIG.game);
}
public static void updateMultipleNoteMarkers(LLSIG game) {
lastHold=false;
TreeMap<Double,List<Note>> noteBeatMap = new TreeMap<Double,List<Note>>();
for (Lane l : game.lanes) {
for (Note n : l.noteChart) {
List<Note> map = noteBeatMap.getOrDefault(n.beatSnapStart, new ArrayList<Note>());
map.add(n);
noteBeatMap.putIfAbsent(n.beatSnapStart, map);
}
}
for (Double d : noteBeatMap.keySet()) {
List<Note> notes = noteBeatMap.get(d);
if (notes.size()>=2) {
for (Note n : notes) {
if (d==n.getBeatSnap()) {
n.multiple=true;
n.multiple_col=lastHold;
}
if (n.getNoteType()==NoteType.HOLD&&d==n.getBeatSnapEnd()) {
n.multiple2=true;
n.multiple2_col=lastHold;
}
}
lastHold=!lastHold;
}
}
}
private void judgeNote(Lane l, double diff, boolean allowMiss) { private void judgeNote(Lane l, double diff, boolean allowMiss) {
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

@ -111,6 +111,9 @@ public class Lane{
} }
System.out.println("Note added: "+n); System.out.println("Note added: "+n);
} }
if (addQueue.size()>0) {
LLSIG.updateMultipleNoteMarkers();
}
addQueue.clear(); addQueue.clear();
} }
public void markMissedNotes() { public void markMissedNotes() {

Loading…
Cancel
Save