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"
* Misaki Louize - "Yukino II"
* Alic1a - "AL's IA -Blue-"
* Xiaounlimited - "Nexus Ivory"
* pictuga - "osu! web"
* sherrie__fay
* 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;
/**
* 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 class Game extends BasicGameState {
// 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 class Game extends BasicGameState {
// 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 class Game extends BasicGameState {
}
}
if (Options.isModActive(Options.MOD_AUTO))
unrankedImage.drawCentered(width / 2, height * 0.077f);
Utils.drawFPS();
Utils.drawCursor();
return;
@ -411,6 +441,9 @@ public class Game extends BasicGameState {
// 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

View File

@ -128,7 +128,8 @@ public class Options extends BasicGameState {
NEW_CURSOR,
DYNAMIC_BACKGROUND,
SHOW_PERFECT_HIT,
BACKGROUND_DIM;
BACKGROUND_DIM,
FORCE_DEFAULT_PLAYFIELD;
};
/**
@ -187,6 +188,7 @@ public class Options extends BasicGameState {
*/
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 @@ public class Options extends BasicGameState {
*/
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 class Options extends BasicGameState {
case SHOW_PERFECT_HIT:
showPerfectHit = !showPerfectHit;
break;
case FORCE_DEFAULT_PLAYFIELD:
forceDefaultPlayfield = !forceDefaultPlayfield;
break;
default:
break;
}
@ -705,6 +715,12 @@ public class Options extends BasicGameState {
"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 @@ public class Options extends BasicGameState {
* @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 @@ public class Options extends BasicGameState {
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 @@ public class Options extends BasicGameState {
*/
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 class Options extends BasicGameState {
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 class Options extends BasicGameState {
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));