Many quick bug fixes.

- Fixed bug when having "Sudden Death" and Easy "mods" enabled at the same time.  Additional "lives" are no longer granted.
- Fixed bug where GameMod active states weren't being reset upon restart.
- Fixed bug where GameMods were drawn as if inactive when viewing scores.  Alpha levels are now only set when drawing the button (i.e. calling GameMod.draw()).
- Moved large grade scaling into GameImage, and slightly padded the right side when drawing.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-01-29 01:50:26 -05:00
parent 1ddeb3461d
commit 0165abde56
4 changed files with 60 additions and 18 deletions

View File

@ -538,12 +538,8 @@ public class GameData {
public void drawRankingElements(Graphics g, OsuFile osu) { public void drawRankingElements(Graphics g, OsuFile osu) {
// grade // grade
Grade grade = getGrade(); Grade grade = getGrade();
if (grade != Grade.NULL) { if (grade != Grade.NULL)
Image gradeImage = grade.getLargeImage(); grade.getLargeImage().draw(width * 0.985f - grade.getLargeImage().getWidth(), height * 0.09f);
float gradeScale = (height * 0.5f) / gradeImage.getHeight();
gradeImage = gradeImage.getScaledCopy(gradeScale);
gradeImage.draw(width - gradeImage.getWidth(), height * 0.09f);
}
// header & "Ranking" text // header & "Ranking" text
Image rankingTitle = GameImage.RANKING_TITLE.getImage(); Image rankingTitle = GameImage.RANKING_TITLE.getImage();

View File

@ -190,21 +190,61 @@ public enum GameImage {
HIT_300G ("hit300g", "png"), HIT_300G ("hit300g", "png"),
HIT_SLIDER10 ("sliderpoint10", "png"), HIT_SLIDER10 ("sliderpoint10", "png"),
HIT_SLIDER30 ("sliderpoint30", "png"), HIT_SLIDER30 ("sliderpoint30", "png"),
RANKING_SS ("ranking-X", "png"), RANKING_SS ("ranking-X", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_SS_SMALL ("ranking-X-small", "png"), RANKING_SS_SMALL ("ranking-X-small", "png"),
RANKING_SSH ("ranking-XH", "png"), RANKING_SSH ("ranking-XH", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_SSH_SMALL ("ranking-XH-small", "png"), RANKING_SSH_SMALL ("ranking-XH-small", "png"),
RANKING_S ("ranking-S", "png"), RANKING_S ("ranking-S", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_S_SMALL ("ranking-S-small", "png"), RANKING_S_SMALL ("ranking-S-small", "png"),
RANKING_SH ("ranking-SH", "png"), RANKING_SH ("ranking-SH", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_SH_SMALL ("ranking-SH-small", "png"), RANKING_SH_SMALL ("ranking-SH-small", "png"),
RANKING_A ("ranking-A", "png"), RANKING_A ("ranking-A", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_A_SMALL ("ranking-A-small", "png"), RANKING_A_SMALL ("ranking-A-small", "png"),
RANKING_B ("ranking-B", "png"), RANKING_B ("ranking-B", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_B_SMALL ("ranking-B-small", "png"), RANKING_B_SMALL ("ranking-B-small", "png"),
RANKING_C ("ranking-C", "png"), RANKING_C ("ranking-C", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_C_SMALL ("ranking-C-small", "png"), RANKING_C_SMALL ("ranking-C-small", "png"),
RANKING_D ("ranking-D", "png"), RANKING_D ("ranking-D", "png") {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 2f) / img.getHeight());
}
},
RANKING_D_SMALL ("ranking-D-small", "png"), RANKING_D_SMALL ("ranking-D-small", "png"),
RANKING_PANEL ("ranking-panel", "png") { RANKING_PANEL ("ranking-panel", "png") {
@Override @Override

View File

@ -125,9 +125,11 @@ public enum GameMod {
float y = (height * 0.8f) + (img.getHeight() / 2); float y = (height * 0.8f) + (img.getHeight() / 2);
// create button // create button
img.setAlpha(0.5f);
this.button = new MenuButton(img, x + (offsetX * id), y); this.button = new MenuButton(img, x + (offsetX * id), y);
this.button.setHoverScale(1.15f); this.button.setHoverScale(1.15f);
// reset state
this.active = false;
} }
/** /**
@ -160,7 +162,6 @@ public enum GameMod {
* @param checkInverse if true, perform checks for mutual exclusivity * @param checkInverse if true, perform checks for mutual exclusivity
*/ */
public void toggle(boolean checkInverse) { public void toggle(boolean checkInverse) {
button.getImage().setAlpha(active ? 0.5f : 1.0f);
active = !active; active = !active;
if (checkInverse) { if (checkInverse) {
@ -205,7 +206,12 @@ public enum GameMod {
/** /**
* Draws the game mod. * Draws the game mod.
*/ */
public void draw() { button.draw(); } public void draw() {
if (!active)
button.getImage().setAlpha(0.5f);
button.draw();
button.getImage().setAlpha(1.0f);
}
/** /**
* Checks if the coordinates are within the image bounds. * Checks if the coordinates are within the image bounds.

View File

@ -484,7 +484,7 @@ public class Game extends BasicGameState {
data.changeHealth(delta * -1 * GameData.HP_DRAIN_MULTIPLIER); data.changeHealth(delta * -1 * GameData.HP_DRAIN_MULTIPLIER);
if (!data.isAlive()) { if (!data.isAlive()) {
// "Easy" mod // "Easy" mod
if (GameMod.EASY.isActive()) { if (GameMod.EASY.isActive() && !GameMod.SUDDEN_DEATH.isActive()) {
deaths++; deaths++;
if (deaths < 3) { if (deaths < 3) {
deathTime = trackPosition; deathTime = trackPosition;