From 130f9bf445dadb483f97b9e2e61e789ce5d56975 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Thu, 20 Aug 2015 22:06:27 -0500 Subject: [PATCH] Game ranking screen fixes. - Show retry button only when appropriate (e.g. not when viewing replays or when playing with "Auto" enabled). - Watching a (fake) "replay" with "Auto" enabled will actually just call the "retry" code now. Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/GameData.java | 14 ++++++++++---- src/itdelatrisu/opsu/states/Game.java | 3 +++ src/itdelatrisu/opsu/states/GameRanking.java | 12 ++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index b72810c2..0b67bb71 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -324,7 +324,7 @@ public class GameData { private Replay replay; /** Whether this object is used for gameplay (true) or score viewing (false). */ - private boolean gameplay; + private boolean isGameplay; /** Container dimensions. */ private int width, height; @@ -337,7 +337,7 @@ public class GameData { public GameData(int width, int height) { this.width = width; this.height = height; - this.gameplay = true; + this.isGameplay = true; clear(); } @@ -353,7 +353,7 @@ public class GameData { public GameData(ScoreData s, int width, int height) { this.width = width; this.height = height; - this.gameplay = false; + this.isGameplay = false; this.scoreData = s; this.score = s.score; @@ -1468,7 +1468,13 @@ public class GameData { * Returns whether or not this object is used for gameplay. * @return true if gameplay, false if score viewing */ - public boolean isGameplay() { return gameplay; } + public boolean isGameplay() { return isGameplay; } + + /** + * Sets whether or not this object is used for gameplay. + * @return true if gameplay, false if score viewing + */ + public void setGameplay(boolean gameplay) { this.isGameplay = gameplay; } /** * Adds the hit into the list of hit error information. diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 51c5780c..5d44d7a2 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -738,6 +738,7 @@ public class Game extends BasicGameState { r.save(); } ScoreData score = data.getScoreData(beatmap); + data.setGameplay(!isReplay); // add score to database if (!unranked && !isReplay) @@ -1111,6 +1112,8 @@ public class Game extends BasicGameState { GameMod.loadModState(replay.mods); } + data.setGameplay(true); + // check restart state if (restart == Restart.NEW) { // new game diff --git a/src/itdelatrisu/opsu/states/GameRanking.java b/src/itdelatrisu/opsu/states/GameRanking.java index 14afd314..b344bbd2 100644 --- a/src/itdelatrisu/opsu/states/GameRanking.java +++ b/src/itdelatrisu/opsu/states/GameRanking.java @@ -20,6 +20,7 @@ package itdelatrisu.opsu.states; import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.GameImage; +import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.Opsu; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; @@ -113,7 +114,7 @@ public class GameRanking extends BasicGameState { // buttons replayButton.draw(); - if (data.isGameplay()) + if (data.isGameplay() && !GameMod.AUTO.isActive()) retryButton.draw(); UI.getBackButton().draw(); @@ -175,7 +176,8 @@ public class GameRanking extends BasicGameState { // replay Game gameState = (Game) game.getState(Opsu.STATE_GAME); boolean returnToGame = false; - if (replayButton.contains(x, y)) { + boolean replayButtonPressed = replayButton.contains(x, y); + if (replayButtonPressed && !(data.isGameplay() && GameMod.AUTO.isActive())) { Replay r = data.getReplay(null, null); if (r != null) { try { @@ -194,7 +196,9 @@ public class GameRanking extends BasicGameState { } // retry - else if (data.isGameplay() && retryButton.contains(x, y)) { + else if (data.isGameplay() && + (!GameMod.AUTO.isActive() && retryButton.contains(x, y)) || + (GameMod.AUTO.isActive() && replayButtonPressed)) { gameState.setReplay(null); gameState.setRestart(Game.Restart.MANUAL); returnToGame = true; @@ -221,7 +225,7 @@ public class GameRanking extends BasicGameState { } else { SoundController.playSound(SoundEffect.APPLAUSE); retryButton.resetHover(); - replayButton.setY(replayY); + replayButton.setY(!GameMod.AUTO.isActive() ? replayY : retryY); } replayButton.resetHover(); }