Minor changes: fading game bg dim, initial flashlight radius fix.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
a6ece307ff
commit
18e57fdb96
|
@ -236,6 +236,14 @@ public class Game extends BasicGameState {
|
|||
throws SlickException {
|
||||
int width = container.getWidth();
|
||||
int height = container.getHeight();
|
||||
int trackPosition = MusicController.getPosition();
|
||||
if (pauseTime > -1) // returning from pause screen
|
||||
trackPosition = pauseTime;
|
||||
else if (deathTime > -1) // "Easy" mod: health bar increasing
|
||||
trackPosition = deathTime;
|
||||
int firstObjectTime = osu.objects[0].getTime();
|
||||
int timeDiff = firstObjectTime - trackPosition;
|
||||
|
||||
g.setBackground(Color.black);
|
||||
|
||||
// "flashlight" mod: initialize offscreen graphics
|
||||
|
@ -246,6 +254,12 @@ public class Game extends BasicGameState {
|
|||
|
||||
// background
|
||||
float dimLevel = Options.getBackgroundDim();
|
||||
if (trackPosition < firstObjectTime) {
|
||||
if (timeDiff < approachTime)
|
||||
dimLevel += (1f - dimLevel) * ((float) timeDiff / Math.min(approachTime, firstObjectTime));
|
||||
else
|
||||
dimLevel = 1f;
|
||||
}
|
||||
if (Options.isDefaultPlayfieldForced() || !osu.drawBG(width, height, dimLevel, false)) {
|
||||
Image playfield = GameImage.PLAYFIELD.getImage();
|
||||
playfield.setAlpha(dimLevel);
|
||||
|
@ -256,14 +270,6 @@ public class Game extends BasicGameState {
|
|||
if (GameMod.FLASHLIGHT.isActive())
|
||||
Graphics.setCurrent(g);
|
||||
|
||||
int trackPosition = MusicController.getPosition();
|
||||
if (pauseTime > -1) // returning from pause screen
|
||||
trackPosition = pauseTime;
|
||||
else if (deathTime > -1) // "Easy" mod: health bar increasing
|
||||
trackPosition = deathTime;
|
||||
int firstObjectTime = osu.objects[0].getTime();
|
||||
int timeDiff = firstObjectTime - trackPosition;
|
||||
|
||||
// "auto" and "autopilot" mods: move cursor automatically
|
||||
// TODO: this should really be in update(), not render()
|
||||
autoMouseX = width / 2;
|
||||
|
@ -280,7 +286,7 @@ public class Game extends BasicGameState {
|
|||
timeDiff = firstObjectTime - trackPosition;
|
||||
if (timeDiff < approachTime) {
|
||||
float[] xy = hitObjects[0].getPointAt(trackPosition);
|
||||
autoXY = getPointAt(autoMouseX, autoMouseY, xy[0], xy[1], 1f - ((float) timeDiff / approachTime));
|
||||
autoXY = getPointAt(autoMouseX, autoMouseY, xy[0], xy[1], 1f - ((float) timeDiff / Math.min(approachTime, firstObjectTime)));
|
||||
}
|
||||
} else if (objectIndex < osu.objects.length) {
|
||||
// normal object
|
||||
|
@ -1236,6 +1242,7 @@ public class Game extends BasicGameState {
|
|||
autoMouseX = 0;
|
||||
autoMouseY = 0;
|
||||
autoMousePressed = false;
|
||||
flashlightRadius = container.getHeight() * 2 / 3;
|
||||
|
||||
System.gc();
|
||||
}
|
||||
|
|
|
@ -63,6 +63,9 @@ public class MainMenu extends BasicGameState {
|
|||
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
||||
private static final short MOVE_DELAY = 5000;
|
||||
|
||||
/** Max alpha level of the menu background. */
|
||||
private static final float BG_MAX_ALPHA = 0.9f;
|
||||
|
||||
/** Logo button that reveals other buttons on click. */
|
||||
private MenuButton logo;
|
||||
|
||||
|
@ -319,10 +322,10 @@ public class MainMenu extends BasicGameState {
|
|||
MusicController.toggleTrackDimmed(0.33f);
|
||||
|
||||
// fade in background
|
||||
if (bgAlpha < 0.9f) {
|
||||
if (bgAlpha < BG_MAX_ALPHA) {
|
||||
bgAlpha += delta / 1000f;
|
||||
if (bgAlpha > 0.9f)
|
||||
bgAlpha = 0.9f;
|
||||
if (bgAlpha > BG_MAX_ALPHA)
|
||||
bgAlpha = BG_MAX_ALPHA;
|
||||
}
|
||||
|
||||
// buttons
|
||||
|
|
Loading…
Reference in New Issue
Block a user