Added support for default playfield image and an override option.

- Credits: https://osu.ppy.sh/forum/t/198483 (image by Xiaounlimited)

Other changes:
- Added "Unranked" text image, currently displayed for "Auto" mod plays only (image by XinCrin).
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2014-07-03 01:05:23 -04:00
parent 03be29307f
commit f195ffb861
5 changed files with 65 additions and 5 deletions

View File

@ -14,6 +14,7 @@ The images included in opsu! belong to their respective authors.
* Garygoh884 - "Skylanders 1.3b" * Garygoh884 - "Skylanders 1.3b"
* Misaki Louize - "Yukino II" * Misaki Louize - "Yukino II"
* Alic1a - "AL's IA -Blue-" * Alic1a - "AL's IA -Blue-"
* Xiaounlimited - "Nexus Ivory"
* pictuga - "osu! web" * pictuga - "osu! web"
* sherrie__fay * sherrie__fay
* kouyang * kouyang

BIN
res/play-unranked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
res/playfield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

View File

@ -198,6 +198,17 @@ public class Game extends BasicGameState {
*/ */
private float pausePulse; 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 // game-related variables
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
@ -251,6 +262,16 @@ public class Game extends BasicGameState {
// hit circle select // hit circle select
hitCircleSelect = new Image("hitcircleselect.png"); 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 // create the associated GameScore object
score = new GameScore(width, height); score = new GameScore(width, height);
} }
@ -263,7 +284,14 @@ public class Game extends BasicGameState {
// background // background
g.setBackground(Color.black); 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(); int trackPosition = MusicController.getPosition();
if (pauseTime > -1) // returning from pause screen if (pauseTime > -1) // returning from pause screen
@ -313,6 +341,8 @@ public class Game extends BasicGameState {
} }
} }
if (Options.isModActive(Options.MOD_AUTO))
unrankedImage.drawCentered(width / 2, height * 0.077f);
Utils.drawFPS(); Utils.drawFPS();
Utils.drawCursor(); Utils.drawCursor();
return; return;
@ -411,6 +441,9 @@ public class Game extends BasicGameState {
// draw OsuHitObjectResult objects // draw OsuHitObjectResult objects
score.drawHitResults(trackPosition); score.drawHitResults(trackPosition);
if (Options.isModActive(Options.MOD_AUTO))
unrankedImage.drawCentered(width / 2, height * 0.077f);
// returning from pause screen // returning from pause screen
if (pauseTime > -1 && pausedMouseX > -1 && pausedMouseY > -1) { if (pauseTime > -1 && pausedMouseX > -1 && pausedMouseY > -1) {
// darken the screen // darken the screen

View File

@ -128,7 +128,8 @@ public class Options extends BasicGameState {
NEW_CURSOR, NEW_CURSOR,
DYNAMIC_BACKGROUND, DYNAMIC_BACKGROUND,
SHOW_PERFECT_HIT, SHOW_PERFECT_HIT,
BACKGROUND_DIM; BACKGROUND_DIM,
FORCE_DEFAULT_PLAYFIELD;
}; };
/** /**
@ -187,6 +188,7 @@ public class Options extends BasicGameState {
*/ */
private static final GameOption[] gameplayOptions = { private static final GameOption[] gameplayOptions = {
GameOption.BACKGROUND_DIM, GameOption.BACKGROUND_DIM,
GameOption.FORCE_DEFAULT_PLAYFIELD,
GameOption.SHOW_HIT_LIGHTING, GameOption.SHOW_HIT_LIGHTING,
GameOption.SHOW_COMBO_BURSTS, GameOption.SHOW_COMBO_BURSTS,
GameOption.SHOW_PERFECT_HIT GameOption.SHOW_PERFECT_HIT
@ -304,6 +306,11 @@ public class Options extends BasicGameState {
*/ */
private static int backgroundDim = 30; 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). * Game option coordinate modifiers (for drawing).
*/ */
@ -535,6 +542,9 @@ public class Options extends BasicGameState {
case SHOW_PERFECT_HIT: case SHOW_PERFECT_HIT:
showPerfectHit = !showPerfectHit; showPerfectHit = !showPerfectHit;
break; break;
case FORCE_DEFAULT_PLAYFIELD:
forceDefaultPlayfield = !forceDefaultPlayfield;
break;
default: default:
break; break;
} }
@ -705,6 +715,12 @@ public class Options extends BasicGameState {
"Percentage to dim the background image during gameplay." "Percentage to dim the background image during gameplay."
); );
break; 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: case SHOW_HIT_LIGHTING:
drawOption(pos, "Show Hit Lighting", drawOption(pos, "Show Hit Lighting",
showHitLighting ? "Yes" : "No", showHitLighting ? "Yes" : "No",
@ -733,7 +749,7 @@ public class Options extends BasicGameState {
* @param pos the element position * @param pos the element position
* @param label the option name * @param label the option name
* @param value the option value * @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) { private void drawOption(int pos, String label, String value, String notes) {
int width = container.getWidth(); int width = container.getWidth();
@ -743,7 +759,6 @@ public class Options extends BasicGameState {
g.setColor(Color.white); g.setColor(Color.white);
g.drawString(label, width / 30, y); g.drawString(label, width / 30, y);
g.drawString(value, width / 2, 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.setColor(Utils.COLOR_WHITE_ALPHA);
g.drawLine(0, y + textHeight, width, y + textHeight); g.drawLine(0, y + textHeight, width, y + textHeight);
@ -899,6 +914,12 @@ public class Options extends BasicGameState {
*/ */
public static float getBackgroundDim() { return (100 - backgroundDim) / 100f; } 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. * Returns the current beatmap directory.
* If invalid, this will attempt to search for the directory, * If invalid, this will attempt to search for the directory,
@ -1020,6 +1041,9 @@ public class Options extends BasicGameState {
if (i >= 0 && i <= 100) if (i >= 0 && i <= 100)
backgroundDim = i; backgroundDim = i;
break; break;
case "ForceDefaultPlayfield":
forceDefaultPlayfield = Boolean.parseBoolean(value);
break;
case "HitLighting": case "HitLighting":
showHitLighting = Boolean.parseBoolean(value); showHitLighting = Boolean.parseBoolean(value);
break; break;
@ -1086,6 +1110,8 @@ public class Options extends BasicGameState {
writer.newLine(); writer.newLine();
writer.write(String.format("DimLevel = %d", backgroundDim)); writer.write(String.format("DimLevel = %d", backgroundDim));
writer.newLine(); writer.newLine();
writer.write(String.format("ForceDefaultPlayfield = %b", forceDefaultPlayfield));
writer.newLine();
writer.write(String.format("HitLighting = %b", showHitLighting)); writer.write(String.format("HitLighting = %b", showHitLighting));
writer.newLine(); writer.newLine();
writer.write(String.format("ComboBurst = %b", showComboBursts)); writer.write(String.format("ComboBurst = %b", showComboBursts));