Added description for game mods.

These will appear on the bottom of the screen when hovering over the buttons in the options menu.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-01-30 03:45:06 -05:00
parent 84e463e8fb
commit cb5a7d6a4b
2 changed files with 48 additions and 15 deletions

View File

@ -28,16 +28,26 @@ import org.newdawn.slick.Input;
* Game mods. * Game mods.
*/ */
public enum GameMod { public enum GameMod {
EASY (0, GameImage.MOD_EASY, "EZ", 2, Input.KEY_Q, 0.5f), EASY (0, GameImage.MOD_EASY, "EZ", 2, Input.KEY_Q, 0.5f,
NO_FAIL (1, GameImage.MOD_NO_FAIL, "NF", 1, Input.KEY_W, 0.5f), "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."),
HARD_ROCK (2, GameImage.MOD_HARD_ROCK, "HR", 16, Input.KEY_A, 1.06f), NO_FAIL (1, GameImage.MOD_NO_FAIL, "NF", 1, Input.KEY_W, 0.5f,
SUDDEN_DEATH (3, GameImage.MOD_SUDDEN_DEATH, "SD", 32, Input.KEY_S), "You can't fail. No matter what."),
SPUN_OUT (4, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_V, 0.9f), HARD_ROCK (2, GameImage.MOD_HARD_ROCK, "HR", 16, Input.KEY_A, 1.06f,
AUTO (5, GameImage.MOD_AUTO, "", 2048, Input.KEY_B); "Everything just got a bit harder..."),
// HALF_TIME (, GameImage.MOD_HALF_TIME, "HT", 256, Input.KEY_E, 0.3f), SUDDEN_DEATH (3, GameImage.MOD_SUDDEN_DEATH, "SD", 32, Input.KEY_S,
// DOUBLE_TIME (, GameImage.MOD_DOUBLE_TIME, "DT", 64, Input.KEY_D, 1.12f), "Miss a note and fail."),
// HIDDEN (, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f), SPUN_OUT (4, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_V, 0.9f,
// FLASHLIGHT (, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f); "Spinners will be automatically completed."),
AUTO (5, GameImage.MOD_AUTO, "", 2048, Input.KEY_B,
"Watch a perfect automated play through the song.");
// HALF_TIME (6, GameImage.MOD_HALF_TIME, "HT", 256, Input.KEY_E, 0.3f,
// "Less zoom."),
// DOUBLE_TIME (7, GameImage.MOD_DOUBLE_TIME, "DT", 64, Input.KEY_D, 1.12f,
// "Zoooooooooom."),
// HIDDEN (8, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f,
// "Play with no approach circles and fading notes for a slight score advantage."),
// FLASHLIGHT (9, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f,
// "Restricted view area.");
/** The ID of the mod (used for positioning). */ /** The ID of the mod (used for positioning). */
private int id; private int id;
@ -60,6 +70,9 @@ public enum GameMod {
/** The score multiplier. */ /** The score multiplier. */
private float multiplier; private float multiplier;
/** The description of the mod. */
private String description;
/** Whether or not this mod is active. */ /** Whether or not this mod is active. */
private boolean active = false; private boolean active = false;
@ -83,14 +96,16 @@ public enum GameMod {
* @param abbrev the two-letter abbreviation * @param abbrev the two-letter abbreviation
* @param bit the bit * @param bit the bit
* @param key the shortcut key * @param key the shortcut key
* @param description the description
*/ */
GameMod(int id, GameImage image, String abbrev, int bit, int key) { GameMod(int id, GameImage image, String abbrev, int bit, int key, String description) {
this.id = id; this.id = id;
this.image = image; this.image = image;
this.abbrev = abbrev; this.abbrev = abbrev;
this.bit = bit; this.bit = bit;
this.key = key; this.key = key;
this.multiplier = 1f; this.multiplier = 1f;
this.description = description;
} }
/** /**
@ -101,14 +116,16 @@ public enum GameMod {
* @param bit the bit * @param bit the bit
* @param key the shortcut key * @param key the shortcut key
* @param multiplier the score multiplier * @param multiplier the score multiplier
* @param description the description
*/ */
GameMod(int id, GameImage image, String abbrev, int bit, int key, float multiplier) { GameMod(int id, GameImage image, String abbrev, int bit, int key, float multiplier, String description) {
this.id = id; this.id = id;
this.image = image; this.image = image;
this.abbrev = abbrev; this.abbrev = abbrev;
this.bit = bit; this.bit = bit;
this.key = key; this.key = key;
this.multiplier = multiplier; this.multiplier = multiplier;
this.description = description;
} }
/** /**
@ -157,6 +174,12 @@ public enum GameMod {
*/ */
public float getMultiplier() { return multiplier; } public float getMultiplier() { return multiplier; }
/**
* Returns a description of the mod.
* @return the description
*/
public String getDescription() { return description; }
/** /**
* Toggles the active status of the mod. * Toggles the active status of the mod.
* @param checkInverse if true, perform checks for mutual exclusivity * @param checkInverse if true, perform checks for mutual exclusivity

View File

@ -196,11 +196,11 @@ public class OptionsMenu extends BasicGameState {
// title // title
Utils.FONT_XLARGE.drawString( Utils.FONT_XLARGE.drawString(
(width / 2) - (Utils.FONT_XLARGE.getWidth("GAME OPTIONS") / 2), 10, (width - Utils.FONT_XLARGE.getWidth("GAME OPTIONS")) / 2, 10,
"GAME OPTIONS", Color.white "GAME OPTIONS", Color.white
); );
Utils.FONT_DEFAULT.drawString( Utils.FONT_DEFAULT.drawString(
(width / 2) - (Utils.FONT_DEFAULT.getWidth("Click or drag an option to change it.") / 2), (width - Utils.FONT_DEFAULT.getWidth("Click or drag an option to change it.")) / 2,
10 + Utils.FONT_XLARGE.getLineHeight(), 10 + Utils.FONT_XLARGE.getLineHeight(),
"Click or drag an option to change it.", Color.white "Click or drag an option to change it.", Color.white
); );
@ -233,8 +233,18 @@ public class OptionsMenu extends BasicGameState {
// game mods // game mods
Utils.FONT_LARGE.drawString(width / 30, height * 0.8f, "Game Mods:", Color.white); Utils.FONT_LARGE.drawString(width / 30, height * 0.8f, "Game Mods:", Color.white);
for (GameMod mod : GameMod.values()) boolean descDrawn = false;
for (GameMod mod : GameMod.values()) {
mod.draw(); mod.draw();
if (!descDrawn && mod.contains(mouseX, mouseY)) {
Utils.FONT_DEFAULT.drawString(
(width - Utils.FONT_DEFAULT.getWidth(mod.getDescription())) / 2,
height * 0.975f - Utils.FONT_DEFAULT.getLineHeight(),
mod.getDescription(), Color.white
);
descDrawn = true;
}
}
Utils.getBackButton().draw(); Utils.getBackButton().draw();