Hold note display fixes and judgement on end notes

This commit is contained in:
Joshua Sigona 2021-10-14 23:04:57 +09:00
parent a1d251cf6f
commit 82c6f63538
3 changed files with 33 additions and 17 deletions

View File

@ -165,26 +165,36 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
if (n.active||n.active2) { if (n.active||n.active2) {
double PLAYTIME_RATIO = (1-(((double)n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition())/LLSIG.game.NOTE_SPEED)); double PLAYTIME_RATIO = (1-(((double)n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition())/LLSIG.game.NOTE_SPEED));
double PLAYTIME_END_RATIO = (1-(((double)n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition())/LLSIG.game.NOTE_SPEED)); double PLAYTIME_END_RATIO = (1-(((double)n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition())/LLSIG.game.NOTE_SPEED));
double CLAMPED_PLAYTIME_END_RATIO = Math.max(0,PLAYTIME_END_RATIO);
double CLAMPED_PLAYTIME_RATIO = Math.min(1,PLAYTIME_RATIO);
int START_NOTE_SIZE = (int)(Math.min(Math.min(1,PLAYTIME_RATIO/2+0.5),1)*NOTE_SIZE);
if (n.getNoteType()==NoteType.HOLD) { if (n.getNoteType()==NoteType.HOLD) {
if (n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()>=LLSIG.game.NOTE_SPEED) { if (n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()>=LLSIG.game.NOTE_SPEED) {
if (n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()<LLSIG.game.NOTE_SPEED) {
//Use the center to draw the connecting note. //Use the center to draw the connecting note.
g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(0*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(0*NOTE_DISTANCE)-NOTE_SIZE/2), g.fillOval((int)(MIDDLE_X-NOTE_SIZE/2),(int)(MIDDLE_Y-NOTE_SIZE/2),
(int)(Math.min(0/2+0.5,1)*NOTE_SIZE),(int)(Math.min(0/2+0.5,1)*NOTE_SIZE)); (int)(Math.min(0/2+0.5,1)*NOTE_SIZE),(int)(Math.min(0/2+0.5,1)*NOTE_SIZE));
}
} else { } else {
Color prevCol = g.getColor(); Color prevCol = g.getColor();
g.setColor(HOLD_NOTE_COLOR); g.setColor(HOLD_NOTE_COLOR);
Point CORNER1 = new Point((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(PLAYTIME_END_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(PLAYTIME_END_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2)); int END_NOTE_SIZE = (int)(Math.min(Math.max(PLAYTIME_END_RATIO/2+0.5,0.5),1)*NOTE_SIZE);
Point CORNER2 = new Point((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2)); Point CORNER1 = new Point((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_END_RATIO*NOTE_DISTANCE)-END_NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_END_RATIO*NOTE_DISTANCE)-END_NOTE_SIZE/2));
g.fillPolygon(new int[]{CORNER1.x,CORNER1.x+NOTE_SIZE,CORNER2.x+NOTE_SIZE,CORNER2.x}, new int[]{CORNER1.y+NOTE_SIZE/2,CORNER1.y+NOTE_SIZE/2,CORNER2.y+NOTE_SIZE/2,CORNER2.y+NOTE_SIZE/2}, 4); Point CORNER2 = new Point((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-START_NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-START_NOTE_SIZE/2));
g.fillPolygon(new int[]{CORNER1.x,CORNER1.x+END_NOTE_SIZE,CORNER2.x+START_NOTE_SIZE,CORNER2.x}, new int[]{CORNER1.y+END_NOTE_SIZE/2,CORNER1.y+END_NOTE_SIZE/2,CORNER2.y+START_NOTE_SIZE/2,CORNER2.y+START_NOTE_SIZE/2}, 4);
g.setColor(prevCol); g.setColor(prevCol);
g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(PLAYTIME_END_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(PLAYTIME_END_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2), g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_END_RATIO*NOTE_DISTANCE)-END_NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_END_RATIO*NOTE_DISTANCE)-END_NOTE_SIZE/2),
(int)(Math.min(PLAYTIME_END_RATIO/2+0.5,1)*NOTE_SIZE),(int)(Math.min(PLAYTIME_END_RATIO/2+0.5,1)*NOTE_SIZE)); END_NOTE_SIZE,END_NOTE_SIZE);
} }
} }
if (n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()<LLSIG.game.NOTE_SPEED) { if (n.active&&n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()<LLSIG.game.NOTE_SPEED) {
g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2), g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-START_NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(PLAYTIME_RATIO*NOTE_DISTANCE)-START_NOTE_SIZE/2),
(int)(Math.min(PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE),(int)(Math.min(PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE)); (int)(Math.min(PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE),(int)(Math.min(PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE));
} }
if (!n.active&&n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition()<LLSIG.game.NOTE_SPEED) {
g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))*(CLAMPED_PLAYTIME_RATIO*NOTE_DISTANCE)-NOTE_SIZE/2),
(int)(Math.min(CLAMPED_PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE),(int)(Math.min(CLAMPED_PLAYTIME_RATIO/2+0.5,1)*NOTE_SIZE));
}
} }
noteCounter++; noteCounter++;
} }

View File

@ -50,7 +50,7 @@ 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 = true; //Whether or not we are in beatmap editing mode. public boolean EDITOR = false; //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;
@ -415,7 +415,7 @@ public class LLSIG implements KeyListener{
Note n = l.getNote(); Note n = l.getNote();
double diff = n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition(); double diff = n.getStartFrame()-LLSIG.game.musicPlayer.getPlayPosition();
if (n.active&&diff<=BAD_TIMING_WINDOW) { if (n.active&&diff<=BAD_TIMING_WINDOW) {
judgeNote(l, diff); judgeNote(l, diff, false);
n.active=false; n.active=false;
} }
} }
@ -425,7 +425,7 @@ public class LLSIG implements KeyListener{
//System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition()); //System.out.println("Pressed "+e.getKeyChar()+" on frame "+musicPlayer.getPlayPosition());
} }
private void judgeNote(Lane l, double diff) { 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
if (Math.abs(diff)<=GREAT_TIMING_WINDOW) {l.lastRating=TimingRating.GREAT;COMBO++;GREAT_COUNT++;LAST_GREAT=LLSIG.game.musicPlayer.getPlayPosition();} else if (Math.abs(diff)<=GREAT_TIMING_WINDOW) {l.lastRating=TimingRating.GREAT;COMBO++;GREAT_COUNT++;LAST_GREAT=LLSIG.game.musicPlayer.getPlayPosition();} else
@ -440,6 +440,12 @@ public class LLSIG implements KeyListener{
LAST_LATE=LLSIG.game.musicPlayer.getPlayPosition(); LAST_LATE=LLSIG.game.musicPlayer.getPlayPosition();
} }
COMBO=0; COMBO=0;
} else
if (allowMiss) {
l.lastRating=TimingRating.MISS;
MISS_COUNT++;
LAST_MISS=LLSIG.game.musicPlayer.getPlayPosition();
COMBO=0;
} }
l.lastNote=LLSIG.game.musicPlayer.getPlayPosition(); l.lastNote=LLSIG.game.musicPlayer.getPlayPosition();
} }
@ -477,8 +483,8 @@ public class LLSIG implements KeyListener{
if (l.noteExists()) { if (l.noteExists()) {
Note n = l.getNote(); Note n = l.getNote();
double diff2 = n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition(); double diff2 = n.getEndFrame()-LLSIG.game.musicPlayer.getPlayPosition();
if (n.getNoteType()==NoteType.HOLD&&n.active2&&!n.active&&diff2<=BAD_TIMING_WINDOW) { if (n.getNoteType()==NoteType.HOLD&&n.active2&&!n.active) {
judgeNote(l, diff2); judgeNote(l, diff2, true);
n.active2=false; n.active2=false;
} }
} }

View File

@ -35,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||n.active2) {return n;} if (n!=null&&(n.active||n.active2)) {return n;}
} }
return null; return null;
} }