add epilepsy warning img

This commit is contained in:
yugecin 2016-11-17 00:12:44 +01:00
parent 0d0cf47995
commit a1a9dde5ae
5 changed files with 44 additions and 0 deletions

BIN
res/epiwarning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -41,6 +41,7 @@ public enum GameImage {
CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false), // custom
// Game
EPILEPSY_WARNING ("epiwarning", "png"),
SECTION_PASS ("section-pass", "png"),
SECTION_FAIL ("section-fail", "png"),
WARNINGARROW ("play-warningarrow", "png"),

View File

@ -515,6 +515,15 @@ public class Options {
return String.valueOf(val * 100);
}
},
EPILEPSY_WARNING ("Epilepsy warning image", "EpiWarn", "Show a little warning for flashing colours in the beginning", 20, 0, 20) {
@Override
public String getValueString() {
if (val == 0) {
return "Disabled";
}
return String.valueOf(val * 100);
}
},
LOAD_HD_IMAGES ("Load HD Images", "LoadHDImages", String.format("Loads HD (%s) images when available. Increases memory usage and loading times.", GameImage.HD_SUFFIX), true),
FIXED_CS ("Fixed Circle Size (CS)", "FixedCS", "Determines the size of circles and sliders.", 0, 0, 100) {
@Override
@ -1710,6 +1719,7 @@ public class Options {
public static int getMapStartDelay() { return GameOption.MAP_START_DELAY.getIntegerValue() * 100; }
public static int getMapEndDelay() { return GameOption.MAP_END_DELAY.getIntegerValue() * 100; }
public static int getEpilepsyWarningLength() { return GameOption.EPILEPSY_WARNING.getIntegerValue() * 100; }
/**
* Returns whether or not to load HD (@2x) images.

View File

@ -259,6 +259,11 @@ public class Game extends BasicGameState {
private int mirrorFrom;
private int mirrorTo;
private Image epiImg;
private float epiImgX;
private float epiImgY;
private int epiImgTime;
/** Music position bar background colors. */
private static final Color
MUSICBAR_NORMAL = new Color(12, 9, 10, 0.25f),
@ -395,6 +400,18 @@ public class Game extends BasicGameState {
}
}
// epilepsy warning
if (epiImgTime > 0) {
if (epiImgTime < 200) {
// fade out
Color c = new Color(Color.white);
c.a = epiImgTime / 200f;
epiImg.draw(epiImgX, epiImgY, c);
} else {
epiImg.draw(epiImgX, epiImgY);
}
}
if (GameMod.FLASHLIGHT.isActive())
Graphics.setCurrent(g);
@ -699,6 +716,9 @@ public class Game extends BasicGameState {
throws SlickException {
UI.update(delta);
Pippi.update(delta);
if (epiImgTime > 0) {
epiImgTime -= delta;
}
yugecin.opsudance.spinners.Spinner.update(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
sbOverlay.update(mouseX, mouseY);
@ -1307,6 +1327,17 @@ public class Game extends BasicGameState {
// restart the game
if (restart != Restart.FALSE) {
// load epilepsy warning img
epiImgTime = Options.getEpilepsyWarningLength();
if (epiImgTime > 0) {
epiImg = GameImage.EPILEPSY_WARNING.getImage();
float desWidth = container.getWidth() / 2;
epiImg = epiImg.getScaledCopy(desWidth / epiImg.getWidth());
epiImgX = (container.getWidth() - epiImg.getWidth()) / 2;
epiImgY = (container.getHeight() - epiImg.getHeight()) / 2;
}
// load mods
if (isReplay) {
previousMods = GameMod.getModState();
@ -1443,6 +1474,7 @@ public class Game extends BasicGameState {
this.leadInTime = Math.max(leadIntime, this.leadInTime);
}
}
this.leadInTime += epiImgTime;
SoundController.mute(false);
}

View File

@ -90,6 +90,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.SHOW_HIT_ERROR_BAR,
GameOption.MAP_START_DELAY,
GameOption.MAP_END_DELAY,
GameOption.EPILEPSY_WARNING,
}),
INPUT ("Input", new GameOption[] {
GameOption.KEY_LEFT,