From 21c16a052061234621315f5c20a0fd77df08672c Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Tue, 19 Oct 2021 18:25:21 +0900 Subject: [PATCH] Multi note marking fixed up for note additions --- LLSIG/src/main/java/LLSIG/Canvas.java | 2 ++ LLSIG/src/main/java/LLSIG/LLSIG.java | 36 ++++++++++++++++++++++++++- LLSIG/src/main/java/LLSIG/Lane.java | 3 +++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/LLSIG/src/main/java/LLSIG/Canvas.java b/LLSIG/src/main/java/LLSIG/Canvas.java index 57c9f72..4b3bdbe 100644 --- a/LLSIG/src/main/java/LLSIG/Canvas.java +++ b/LLSIG/src/main/java/LLSIG/Canvas.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) { g.fillOval((int)x,(int)y,(int)(xsize*NOTE_SIZE),(int)(ysize*NOTE_SIZE)); 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), 4, 6, 2); + g.setColor(drawCol); } } @Override diff --git a/LLSIG/src/main/java/LLSIG/LLSIG.java b/LLSIG/src/main/java/LLSIG/LLSIG.java index 60d0baa..824558b 100644 --- a/LLSIG/src/main/java/LLSIG/LLSIG.java +++ b/LLSIG/src/main/java/LLSIG/LLSIG.java @@ -8,7 +8,9 @@ import java.awt.event.MouseWheelListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.TreeMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -53,7 +55,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{ public boolean METRONOME = false; public boolean BPM_MEASURE = false; 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 static double EDITOR_CURSOR_BEAT = 0; @@ -148,6 +150,7 @@ public class LLSIG implements KeyListener,MouseWheelListener{ for (int i=0;i<9;i++) { Lane l =lanes.get(i); l.clearOutDeletedNotes(); + l.addFromQueue(); } if (!musicPlayer.isPaused()) { EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay; @@ -456,6 +459,37 @@ public class LLSIG implements KeyListener,MouseWheelListener{ } //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> noteBeatMap = new TreeMap>(); + for (Lane l : game.lanes) { + for (Note n : l.noteChart) { + List map = noteBeatMap.getOrDefault(n.beatSnapStart, new ArrayList()); + map.add(n); + noteBeatMap.putIfAbsent(n.beatSnapStart, map); + } + } + for (Double d : noteBeatMap.keySet()) { + List 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) { if (Math.abs(diff)<=PERFECT_TIMING_WINDOW) {l.lastRating=TimingRating.PERFECT;COMBO++;PERFECT_COUNT++;LAST_PERFECT=LLSIG.game.musicPlayer.getPlayPosition();} else diff --git a/LLSIG/src/main/java/LLSIG/Lane.java b/LLSIG/src/main/java/LLSIG/Lane.java index 8393323..35e341a 100644 --- a/LLSIG/src/main/java/LLSIG/Lane.java +++ b/LLSIG/src/main/java/LLSIG/Lane.java @@ -111,6 +111,9 @@ public class Lane{ } System.out.println("Note added: "+n); } + if (addQueue.size()>0) { + LLSIG.updateMultipleNoteMarkers(); + } addQueue.clear(); } public void markMissedNotes() {