Fix editor navigation and testing and replacing notes. And previewing
This commit is contained in:
parent
39759fa789
commit
3205982791
BIN
LLSIG/se/clap.wav
Normal file
BIN
LLSIG/se/clap.wav
Normal file
Binary file not shown.
@ -91,9 +91,9 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
|||||||
if (n.getNoteType()==NoteType.HOLD) {
|
if (n.getNoteType()==NoteType.HOLD) {
|
||||||
Color prevCol = g.getColor();
|
Color prevCol = g.getColor();
|
||||||
g.setColor(HOLD_NOTE_COLOR);
|
g.setColor(HOLD_NOTE_COLOR);
|
||||||
g.fillOval(NOTE_X,END_Y,NOTE_SIZE,NOTE_SIZE);
|
g.fillRect(NOTE_X,START_Y+NOTE_SIZE/2,NOTE_SIZE,END_Y-START_Y);
|
||||||
g.setColor(prevCol);
|
g.setColor(prevCol);
|
||||||
g.fillRect(NOTE_X,START_Y,NOTE_SIZE,END_Y-START_Y);
|
g.fillOval(NOTE_X,END_Y,NOTE_SIZE,NOTE_SIZE);
|
||||||
}
|
}
|
||||||
g.fillOval(NOTE_X,START_Y,NOTE_SIZE,NOTE_SIZE);
|
g.fillOval(NOTE_X,START_Y,NOTE_SIZE,NOTE_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,11 @@ public class LLSIG implements KeyListener{
|
|||||||
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 static double EDITOR_CURSOR_BEAT = 0;
|
public static double EDITOR_CURSOR_BEAT = 0;
|
||||||
public static double PREVIOUS_CURSOR_BEAT = 0;
|
public static double PREVIOUS_CURSOR_BEAT = 0;
|
||||||
public static int EDITOR_BEAT_DIVISIONS = 4;
|
public static int EDITOR_BEAT_DIVISIONS = 4;
|
||||||
public static BeatTiming EDITOR_CURSOR_WINDOW;
|
|
||||||
|
|
||||||
public static int beatNumber = 0;
|
public static int beatNumber = 0;
|
||||||
|
|
||||||
@ -141,6 +140,10 @@ public class LLSIG implements KeyListener{
|
|||||||
frameCount++;
|
frameCount++;
|
||||||
canvas.update();
|
canvas.update();
|
||||||
if (PLAYING&&EDITOR) {
|
if (PLAYING&&EDITOR) {
|
||||||
|
for (int i=0;i<9;i++) {
|
||||||
|
Lane l =lanes.get(i);
|
||||||
|
l.clearOutDeletedNotes();
|
||||||
|
}
|
||||||
if (!musicPlayer.isPaused()) {
|
if (!musicPlayer.isPaused()) {
|
||||||
EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay;
|
EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay;
|
||||||
for (int i=0;i<9;i++) {
|
for (int i=0;i<9;i++) {
|
||||||
@ -152,7 +155,7 @@ public class LLSIG implements KeyListener{
|
|||||||
clap.start();
|
clap.start();
|
||||||
n.active2=false;
|
n.active2=false;
|
||||||
} else
|
} else
|
||||||
if (n.getBeatSnap()<=EDITOR_CURSOR_BEAT) {
|
if (n.active&&n.getBeatSnap()<=EDITOR_CURSOR_BEAT) {
|
||||||
clap.setFramePosition(0);
|
clap.setFramePosition(0);
|
||||||
clap.start();
|
clap.start();
|
||||||
n.active=false;
|
n.active=false;
|
||||||
@ -168,6 +171,7 @@ public class LLSIG implements KeyListener{
|
|||||||
/*if (!EDITMODE) {
|
/*if (!EDITMODE) {
|
||||||
l.clearOutInactiveNotes();
|
l.clearOutInactiveNotes();
|
||||||
}*/
|
}*/
|
||||||
|
l.clearOutDeletedNotes();
|
||||||
}
|
}
|
||||||
for (BeatTiming bt : timings) {
|
for (BeatTiming bt : timings) {
|
||||||
if (bt.active&&musicPlayer.getPlayPosition()>=bt.offset&&bt.offset>offset) {
|
if (bt.active&&musicPlayer.getPlayPosition()>=bt.offset&&bt.offset>offset) {
|
||||||
@ -323,7 +327,7 @@ public class LLSIG implements KeyListener{
|
|||||||
case KeyEvent.VK_L:{lane=7;}break;
|
case KeyEvent.VK_L:{lane=7;}break;
|
||||||
case KeyEvent.VK_SEMICOLON:{lane=8;}break;
|
case KeyEvent.VK_SEMICOLON:{lane=8;}break;
|
||||||
case KeyEvent.VK_P:{if (LLSIG.game.PLAYING&&musicPlayer.isPaused()) {
|
case KeyEvent.VK_P:{if (LLSIG.game.PLAYING&&musicPlayer.isPaused()) {
|
||||||
musicPlayer.seek((long)(Math.floor(EDITOR_CURSOR_BEAT*beatDelay)));
|
musicPlayer.seek((long)(Math.floor(EDITOR_CURSOR_BEAT*beatDelay)+offset));
|
||||||
PREVIOUS_CURSOR_BEAT=EDITOR_CURSOR_BEAT;
|
PREVIOUS_CURSOR_BEAT=EDITOR_CURSOR_BEAT;
|
||||||
LLSIG.game.lanes.forEach((l)->{
|
LLSIG.game.lanes.forEach((l)->{
|
||||||
l.noteChart.forEach((note)->{
|
l.noteChart.forEach((note)->{
|
||||||
@ -386,10 +390,10 @@ public class LLSIG implements KeyListener{
|
|||||||
if (lane!=-1) {
|
if (lane!=-1) {
|
||||||
if (EDITOR) {
|
if (EDITOR) {
|
||||||
Lane l = LLSIG.game.lanes.get(lane);
|
Lane l = LLSIG.game.lanes.get(lane);
|
||||||
List<Note> matchingNotes = l.noteChart.stream().filter((note)->note.getBeatSnap()==EDITOR_CURSOR_BEAT||(note.getNoteType()==NoteType.HOLD&¬e.getBeatSnap()>=EDITOR_CURSOR_BEAT&¬e.getBeatSnapEnd()<=EDITOR_CURSOR_BEAT)).collect(Collectors.toList());
|
List<Note> matchingNotes = l.noteChart.stream().filter((note)->note.getBeatSnap()==EDITOR_CURSOR_BEAT||(note.getNoteType()==NoteType.HOLD&¬e.getBeatSnap()<=EDITOR_CURSOR_BEAT&¬e.getBeatSnapEnd()>=EDITOR_CURSOR_BEAT)).collect(Collectors.toList());
|
||||||
boolean replace=true;
|
boolean replace=true;
|
||||||
for (Note n : matchingNotes) {
|
for (Note n : matchingNotes) {
|
||||||
if (n.getNoteType()==NoteType.HOLD) {replace=false;} //We don't replace the note if the position was exactly matching as we may have wanted to remove the note completely.
|
if (n.getNoteType()!=NoteType.HOLD) {replace=false;} //We don't replace the note if the position was exactly matching as we may have wanted to remove the note completely.
|
||||||
n.markForDeletion();
|
n.markForDeletion();
|
||||||
}
|
}
|
||||||
if (replace) {
|
if (replace) {
|
||||||
|
@ -18,6 +18,11 @@ public class Lane{
|
|||||||
public void clearOutInactiveNotes() {
|
public void clearOutInactiveNotes() {
|
||||||
noteChart.removeIf(note->note.deleted||(!note.active&&!note.active2));
|
noteChart.removeIf(note->note.deleted||(!note.active&&!note.active2));
|
||||||
}
|
}
|
||||||
|
public void clearOutDeletedNotes() {
|
||||||
|
if (noteChart.removeIf(note->note.deleted)) {
|
||||||
|
System.out.println("Deleted note from "+this);
|
||||||
|
}
|
||||||
|
}
|
||||||
public boolean noteExists() {
|
public boolean noteExists() {
|
||||||
return getNote()!=null;
|
return getNote()!=null;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class Player {
|
|||||||
jlpp.pause();
|
jlpp.pause();
|
||||||
}
|
}
|
||||||
public boolean isPaused() {
|
public boolean isPaused() {
|
||||||
return jlpp.getStatus()==Status.PAUSED;
|
return jlpp.getStatus()!=Status.PLAYING;
|
||||||
}
|
}
|
||||||
public void resume() {
|
public void resume() {
|
||||||
jlpp.play();
|
jlpp.play();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user