diff --git a/CREDITS.md b/CREDITS.md index be12ed80..a1d4e3b6 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -14,6 +14,7 @@ The images included in opsu! belong to their respective authors. * Garygoh884 - "Skylanders 1.3b" * Misaki Louize - "Yukino II" * Alic1a - "AL's IA -Blue-" +* Xiaounlimited - "Nexus Ivory" * pictuga - "osu! web" * sherrie__fay * kouyang diff --git a/res/play-unranked.png b/res/play-unranked.png new file mode 100644 index 00000000..fbbc9d9e Binary files /dev/null and b/res/play-unranked.png differ diff --git a/res/playfield.png b/res/playfield.png new file mode 100644 index 00000000..e7f45899 Binary files /dev/null and b/res/playfield.png differ diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index cc9000c7..a7575ffb 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -198,6 +198,17 @@ public class Game extends BasicGameState { */ private float pausePulse; + /** + * Default playfield background (optional). + * Overridden by song background unless "ForceDefaultPlayfield" option enabled. + */ + private Image playfield; + + /** + * Image displayed during unranked plays. + */ + private Image unrankedImage; + // game-related variables private GameContainer container; private StateBasedGame game; @@ -251,6 +262,16 @@ public void init(GameContainer container, StateBasedGame game) // hit circle select hitCircleSelect = new Image("hitcircleselect.png"); + // "unranked" image + unrankedImage = new Image("play-unranked.png"); + + // playfield background + try { + playfield = new Image("playfield.png").getScaledCopy(width, height); + } catch (Exception e) { + // optional + } + // create the associated GameScore object score = new GameScore(width, height); } @@ -263,7 +284,14 @@ public void render(GameContainer container, StateBasedGame game, Graphics g) // background g.setBackground(Color.black); - osu.drawBG(width, height, Options.getBackgroundDim()); + float dimLevel = Options.getBackgroundDim(); + if (Options.isDefaultPlayfieldForced() && playfield != null) { + playfield.setAlpha(dimLevel); + playfield.draw(); + } else if (!osu.drawBG(width, height, dimLevel) && playfield != null) { + playfield.setAlpha(dimLevel); + playfield.draw(); + } int trackPosition = MusicController.getPosition(); if (pauseTime > -1) // returning from pause screen @@ -313,6 +341,8 @@ public void render(GameContainer container, StateBasedGame game, Graphics g) } } + if (Options.isModActive(Options.MOD_AUTO)) + unrankedImage.drawCentered(width / 2, height * 0.077f); Utils.drawFPS(); Utils.drawCursor(); return; @@ -411,6 +441,9 @@ else if ((hitObject.type & OsuHitObject.TYPE_SPINNER) > 0) { // draw OsuHitObjectResult objects score.drawHitResults(trackPosition); + if (Options.isModActive(Options.MOD_AUTO)) + unrankedImage.drawCentered(width / 2, height * 0.077f); + // returning from pause screen if (pauseTime > -1 && pausedMouseX > -1 && pausedMouseY > -1) { // darken the screen diff --git a/src/itdelatrisu/opsu/states/Options.java b/src/itdelatrisu/opsu/states/Options.java index 3bc9b7c0..e06dc341 100644 --- a/src/itdelatrisu/opsu/states/Options.java +++ b/src/itdelatrisu/opsu/states/Options.java @@ -128,7 +128,8 @@ private enum GameOption { NEW_CURSOR, DYNAMIC_BACKGROUND, SHOW_PERFECT_HIT, - BACKGROUND_DIM; + BACKGROUND_DIM, + FORCE_DEFAULT_PLAYFIELD; }; /** @@ -187,6 +188,7 @@ private enum GameOption { */ private static final GameOption[] gameplayOptions = { GameOption.BACKGROUND_DIM, + GameOption.FORCE_DEFAULT_PLAYFIELD, GameOption.SHOW_HIT_LIGHTING, GameOption.SHOW_COMBO_BURSTS, GameOption.SHOW_PERFECT_HIT @@ -304,6 +306,11 @@ private enum GameOption { */ private static int backgroundDim = 30; + /** + * Whether or not to always display the default playfield background. + */ + private static boolean forceDefaultPlayfield = false; + /** * Game option coordinate modifiers (for drawing). */ @@ -535,6 +542,9 @@ public void mousePressed(int button, int x, int y) { case SHOW_PERFECT_HIT: showPerfectHit = !showPerfectHit; break; + case FORCE_DEFAULT_PLAYFIELD: + forceDefaultPlayfield = !forceDefaultPlayfield; + break; default: break; } @@ -705,6 +715,12 @@ private void drawOption(GameOption option, int pos) { "Percentage to dim the background image during gameplay." ); break; + case FORCE_DEFAULT_PLAYFIELD: + drawOption(pos, "Force Default Playfield", + forceDefaultPlayfield ? "Yes" : "No", + "Override the song background with the default playfield background." + ); + break; case SHOW_HIT_LIGHTING: drawOption(pos, "Show Hit Lighting", showHitLighting ? "Yes" : "No", @@ -733,7 +749,7 @@ private void drawOption(GameOption option, int pos) { * @param pos the element position * @param label the option name * @param value the option value - * @param notes additional notes (optional) + * @param notes additional notes */ private void drawOption(int pos, String label, String value, String notes) { int width = container.getWidth(); @@ -743,8 +759,7 @@ private void drawOption(int pos, String label, String value, String notes) { g.setColor(Color.white); g.drawString(label, width / 30, y); g.drawString(value, width / 2, y); - if (notes != null) - Utils.FONT_SMALL.drawString(width / 30, y + textHeight, notes); + Utils.FONT_SMALL.drawString(width / 30, y + textHeight, notes); g.setColor(Utils.COLOR_WHITE_ALPHA); g.drawLine(0, y + textHeight, width, y + textHeight); } @@ -899,6 +914,12 @@ private static void toggleMod(int mod) { */ public static float getBackgroundDim() { return (100 - backgroundDim) / 100f; } + /** + * Returns whether or not to override the song background with the default playfield background. + * @return true if forced + */ + public static boolean isDefaultPlayfieldForced() { return forceDefaultPlayfield; } + /** * Returns the current beatmap directory. * If invalid, this will attempt to search for the directory, @@ -1020,6 +1041,9 @@ public static void parseOptions() { if (i >= 0 && i <= 100) backgroundDim = i; break; + case "ForceDefaultPlayfield": + forceDefaultPlayfield = Boolean.parseBoolean(value); + break; case "HitLighting": showHitLighting = Boolean.parseBoolean(value); break; @@ -1086,6 +1110,8 @@ public static void saveOptions() { writer.newLine(); writer.write(String.format("DimLevel = %d", backgroundDim)); writer.newLine(); + writer.write(String.format("ForceDefaultPlayfield = %b", forceDefaultPlayfield)); + writer.newLine(); writer.write(String.format("HitLighting = %b", showHitLighting)); writer.newLine(); writer.write(String.format("ComboBurst = %b", showComboBursts));