Minor graphical updates and code cleaning.

- Padded game score display, and always display 2 digits in front of the decimal (e.g. 00.00% instead of 0.00%).
- Keep map progress circle at a fixed location instead of basing it off the score length.
- Moved some track resets (pause + restart at preview) to trigger upon loading the song menu.  Fixes weird behaviors when leaving the game state.
- Cleaned up trailing whitespace and added missing overrides.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-16 15:44:13 -05:00
parent be1ec64f28
commit 31a97fbc5d
19 changed files with 95 additions and 60 deletions

View File

@@ -90,6 +90,7 @@ public class Circle implements HitObject {
this.comboEnd = comboEnd;
}
@Override
public void draw(int trackPosition, boolean currentObject, Graphics g) {
int timeDiff = hitObject.getTime() - trackPosition;
@@ -133,6 +134,7 @@ public class Circle implements HitObject {
return result;
}
@Override
public boolean mousePressed(int x, int y) {
double distance = Math.hypot(hitObject.getX() - x, hitObject.getY() - y);
int circleRadius = GameImage.HITCIRCLE.getImage().getWidth() / 2;
@@ -150,6 +152,7 @@ public class Circle implements HitObject {
return false;
}
@Override
public boolean update(boolean overlap, int delta, int mouseX, int mouseY) {
int time = hitObject.getTime();
float x = hitObject.getX(), y = hitObject.getY();
@@ -162,7 +165,7 @@ public class Circle implements HitObject {
if (overlap || trackPosition > time + hitResultOffset[GameScore.HIT_50]) {
if (isAutoMod) // "auto" mod: catch any missed notes due to lag
score.hitResult(time, GameScore.HIT_300, x, y, color, comboEnd, hitSound);
else // no more points can be scored, so send a miss
score.hitResult(time, GameScore.HIT_MISS, x, y, null, comboEnd, hitSound);
return true;

View File

@@ -84,7 +84,7 @@ public class Slider implements HitObject {
* The time duration of the slider, in milliseconds.
*/
private float sliderTime = 0f;
/**
* The time duration of the slider including repeats, in milliseconds.
*/
@@ -99,7 +99,7 @@ public class Slider implements HitObject {
* Whether or not to show the follow circle.
*/
private boolean followCircleActive = false;
/**
* Whether or not the slider result ends the combo streak.
*/
@@ -114,12 +114,12 @@ public class Slider implements HitObject {
* The t values of the slider ticks.
*/
private float[] ticksT;
/**
* The tick index in the ticksT[] array.
*/
private int tickIndex = 0;
/**
* Number of ticks hit and tick intervals so far.
*/
@@ -201,7 +201,7 @@ public class Slider implements HitObject {
* Returns the angle of the first control point.
*/
private float getStartAngle() { return startAngle; }
/**
* Returns the angle of the last control point.
*/
@@ -336,6 +336,7 @@ public class Slider implements HitObject {
this.bezier = new Bezier();
}
@Override
public void draw(int trackPosition, boolean currentObject, Graphics g) {
float x = hitObject.getX(), y = hitObject.getY();
float[] sliderX = hitObject.getSliderX(), sliderY = hitObject.getSliderY();
@@ -438,6 +439,7 @@ public class Slider implements HitObject {
return result;
}
@Override
public boolean mousePressed(int x, int y) {
if (sliderClicked) // first circle already processed
return false;
@@ -448,7 +450,7 @@ public class Slider implements HitObject {
int trackPosition = MusicController.getPosition();
int timeDiff = Math.abs(trackPosition - hitObject.getTime());
int[] hitResultOffset = game.getHitResultOffsets();
int result = -1;
if (timeDiff < hitResultOffset[GameScore.HIT_50]) {
result = GameScore.HIT_SLIDER30;
@@ -467,6 +469,7 @@ public class Slider implements HitObject {
return false;
}
@Override
public boolean update(boolean overlap, int delta, int mouseX, int mouseY) {
int repeatCount = hitObject.getRepeatCount();
@@ -490,7 +493,7 @@ public class Slider implements HitObject {
byte hitSound = hitObject.getHitSoundType();
int trackPosition = MusicController.getPosition();
int[] hitResultOffset = game.getHitResultOffsets();
int[] hitResultOffset = game.getHitResultOffsets();
int lastIndex = hitObject.getSliderX().length - 1;
boolean isAutoMod = GameMod.AUTO.isActive();

View File

@@ -71,7 +71,7 @@ public class Spinner implements HitObject {
/**
* Initializes the Spinner data type with images and dimensions.
* @param container the game container
* @throws SlickException
* @throws SlickException
*/
public static void init(GameContainer container) throws SlickException {
width = container.getWidth();
@@ -99,6 +99,7 @@ public class Spinner implements HitObject {
rotationsNeeded = spinsPerMinute * (hitObject.getEndTime() - hitObject.getTime()) / 60000f;
}
@Override
public void draw(int trackPosition, boolean currentObject, Graphics g) {
// only draw spinners if current object
if (!currentObject)
@@ -139,7 +140,7 @@ public class Spinner implements HitObject {
score.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1.0f);
}
}
/**
* Calculates and sends the spinner hit result.
* @return the hit result (GameScore.HIT_* constants)
@@ -165,9 +166,10 @@ public class Spinner implements HitObject {
return result;
}
// not used
public boolean mousePressed(int x, int y) { return false; }
@Override
public boolean mousePressed(int x, int y) { return false; } // not used
@Override
public boolean update(boolean overlap, int delta, int mouseX, int mouseY) {
int trackPosition = MusicController.getPosition();
if (overlap)