From 5a2fbd82fafc8b9eae03c5f24f6ed7b63dd09e7f Mon Sep 17 00:00:00 2001 From: fd Date: Sat, 14 Feb 2015 22:15:41 -0500 Subject: [PATCH] Removed Hit Error Bar during breaks Keep Hit Error Ticks inside bar Removed Miss Locations --- src/itdelatrisu/opsu/GameData.java | 115 +++++++++++++---------- src/itdelatrisu/opsu/objects/Circle.java | 2 +- src/itdelatrisu/opsu/objects/Slider.java | 2 +- src/itdelatrisu/opsu/states/Game.java | 9 +- 4 files changed, 67 insertions(+), 61 deletions(-) diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index f2f32960..04cf78c1 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -153,12 +153,14 @@ public class GameData { /** List of hit result objects associated with hit objects. */ private LinkedList hitResultList; - - class ErrorInfo { + /** + * class to store Hit Error information. + * @author fluddokt + */ + class HitErrorInfo { int time, x, y, timeDiff; - public ErrorInfo(int time, int x, int y, int timeDiff) { - super(); + public HitErrorInfo(int time, int x, int y, int timeDiff) { this.time = time; this.x = x; this.y = y; @@ -167,8 +169,10 @@ public class GameData { } - private LinkedList errorRateList = new LinkedList(); - private LinkedList mouseMissList = new LinkedList(); + /** + * List of stored Hit Error Info + */ + private LinkedList hitErrorList = new LinkedList(); /** * Hit result helper class. @@ -304,8 +308,7 @@ public class GameData { comboEnd = 0; comboBurstIndex = -1; scoreData = null; - errorRateList.clear(); - mouseMissList.clear(); + hitErrorList.clear(); } /** @@ -544,6 +547,50 @@ public class GameData { // combo count if (combo > 0) // 0 isn't a combo drawSymbolString(String.format("%dx", combo), 10, height - 10 - symbolHeight, 1.0f, false); + + //* + //Draw Hit Error bar + final int fadeDelay = 5000; + int hitErrorY = 30; + Iterator iter2 = hitErrorList.iterator(); + g.setColor(Color.black); + g.fillRect(width / 2f - 3 - hitResultOffset[HIT_50], + height - marginX - hitErrorY - 10, + hitResultOffset[HIT_50] * 2, + 20); + g.setColor(Utils.COLOR_LIGHT_ORANGE); + g.fillRect(width / 2f - 3 - hitResultOffset[HIT_50], + height - marginX - hitErrorY - 3, + hitResultOffset[HIT_50] * 2, + 6); + g.setColor(Utils.COLOR_LIGHT_GREEN); + g.fillRect(width / 2f - 3 - hitResultOffset[HIT_100], + height - marginX - hitErrorY - 3, + hitResultOffset[HIT_100] * 2, + 6); + g.setColor(Utils.COLOR_LIGHT_BLUE); + g.fillRect(width / 2f - 3 - hitResultOffset[HIT_300], + height- marginX - hitErrorY - 3, + hitResultOffset[HIT_300] * 2, + 6); + g.setColor(Color.white); + g.drawRect(width / 2f - 3, height - marginX - hitErrorY - 10, 6, 20); + while (iter2.hasNext()) { + HitErrorInfo info = iter2.next(); + int time = info.time; + if (Math.abs(info.timeDiff) < hitResultOffset[GameData.HIT_50] + && time + fadeDelay > trackPosition) { + float alpha = 1 - ((float) (trackPosition - time) / fadeDelay); + Color col = new Color(Color.white); + col.a = alpha; + g.setColor(col); + g.fillRect(width / 2 + info.timeDiff - 1, height - marginX + - hitErrorY - 10, 2, 20); + } else { + iter2.remove(); + } + } + //*/ } else { // grade Grade grade = getGrade(); @@ -557,45 +604,7 @@ public class GameData { } - //* - //Draw Error bar - final int fadeDelay = 5000; - int hitErrorY = 30; - Iterator iter2 = errorRateList.iterator(); - g.setColor(Color.black); - g.fillRect(width/2f-3-hitResultOffset[HIT_50], height-marginX-hitErrorY-10,hitResultOffset[HIT_50]*2,20); - g.setColor(Utils.COLOR_LIGHT_ORANGE); - g.fillRect(width/2f-3-hitResultOffset[HIT_50], height-marginX-hitErrorY-3,hitResultOffset[HIT_50]*2,6); - g.setColor(Utils.COLOR_LIGHT_GREEN); - g.fillRect(width/2f-3-hitResultOffset[HIT_100], height-marginX-hitErrorY-3,hitResultOffset[HIT_100]*2,6); - g.setColor(Utils.COLOR_LIGHT_BLUE); - g.fillRect(width/2f-3-hitResultOffset[HIT_300], height-marginX-hitErrorY-3,hitResultOffset[HIT_300]*2,6); - g.setColor(Color.white); - g.drawRect(width/2f-3, height-marginX-hitErrorY-10, 6, 20); - while (iter2.hasNext()) { - ErrorInfo info = iter2.next(); - int time = info.time; - if (time + fadeDelay > trackPosition) { - float alpha = 1 - ((float) (trackPosition - time) / fadeDelay); - g.setColor(Color.white.scaleCopy(alpha)); - g.fillRect(width/2 + info.timeDiff-1, height-marginX-hitErrorY-10, 2, 20); - }else{ - iter2.remove(); - } - } - iter2 = mouseMissList.iterator(); - while (iter2.hasNext()) { - ErrorInfo info = iter2.next(); - int time = info.time; - if (time + fadeDelay > trackPosition) { - //float alpha = 1 - ((float) (trackPosition - time) / fadeDelay); - //g.setColor(Color.green.scaleCopy(alpha)); - //g.fillRect(info.x-5, info.y-5, 10, 10); - }else{ - iter2.remove(); - } - }//*/ } /** @@ -1080,12 +1089,14 @@ public class GameData { */ public boolean isGameplay() { return gameplay; } - public void addMouseMissPoint(int time, int x, int y, int button) { - mouseMissList.add(new ErrorInfo(time, x, y, 0)); - } - - public void addErrorRate(int time, int x, int y, int timeDiff) { - errorRateList.add(new ErrorInfo(time, x, y, timeDiff)); + /** + * add a Hit Error Info to the list. + * @param time when it should have been hit + * @param x, y the location that it hit + * @param timeDiff the difference from the time from when it was actually hit + */ + public void addHitError(int time, int x, int y, int timeDiff) { + hitErrorList.add(new HitErrorInfo(time, x, y, timeDiff)); } } \ No newline at end of file diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index f7c0b850..d9bf1dcf 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -137,7 +137,7 @@ public class Circle implements HitObject { int result = hitResult(timeDiff); if (result > -1) { - data.addErrorRate(hitObject.getTime(), x, y, timeDiff); + data.addHitError(hitObject.getTime(), x, y, timeDiff); data.hitResult( hitObject.getTime(), result, hitObject.getX(), hitObject.getY(), diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 6c4029bc..f22822dd 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -289,7 +289,7 @@ public class Slider implements HitObject { //else not a hit if (result > -1) { - data.addErrorRate(hitObject.getTime(), x,y,trackPosition - hitObject.getTime()); + data.addHitError(hitObject.getTime(), x,y,trackPosition - hitObject.getTime()); sliderClicked = true; data.sliderTickResult(hitObject.getTime(), result, hitObject.getX(), hitObject.getY(), hitObject.getHitSoundType()); diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 57529a8f..1d5163b6 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -664,13 +664,8 @@ public class Game extends BasicGameState { objectIndex++; // circle hit // sliders - else if (hitObject.isSlider() && hitObjects[objectIndex].mousePressed(x, y)){ - - } - - //Nothing hit - else - data.addMouseMissPoint(MusicController.getPosition(), x,y,button); + else if (hitObject.isSlider()) + hitObjects[objectIndex].mousePressed(x, y); } @Override