merge branch 'issue-010' into master (close #10)

This commit is contained in:
yugecin 2016-11-12 19:05:11 +01:00
commit a3659d7a7d

View File

@ -308,6 +308,9 @@ public class Game extends BasicGameState {
int width = container.getWidth();
int height = container.getHeight();
int trackPosition = MusicController.getPosition();
if (isLeadIn()) {
trackPosition -= leadInTime;
}
if (pauseTime > -1) // returning from pause screen
trackPosition = pauseTime;
else if (deathTime > -1) // "Easy" mod: health bar increasing
@ -766,7 +769,13 @@ public class Game extends BasicGameState {
*/
private void updateGame(int mouseX, int mouseY, int delta, int trackPosition, int keys) {
// map complete!
if (objectIndex >= gameObjects.length || (MusicController.trackEnded() && objectIndex > 0)) {
boolean complete = objectIndex >= gameObjects.length;
if (GameMod.AUTO.isActive() && complete) {
if (gameObjects.length > 0) {
complete = trackPosition >= gameObjects[gameObjects.length - 1].getEndTime() + 5000;
}
}
if (complete || (MusicController.trackEnded() && objectIndex > 0)) {
// track ended before last object was processed: force a hit result
if (MusicController.trackEnded() && objectIndex < gameObjects.length)
gameObjects[objectIndex].update(true, delta, mouseX, mouseY, false, trackPosition);
@ -803,6 +812,10 @@ public class Game extends BasicGameState {
return;
}
if (objectIndex >= gameObjects.length) {
return;
}
GameObject g = gameObjects[objectIndex];
if ((g.isCircle() || g.isSlider()) && g.getTime() <= trackPosition) {
Cursor.lastObjColor = g.getColor();
@ -1347,6 +1360,12 @@ public class Game extends BasicGameState {
MusicController.setPitch(GameMod.getSpeedMultiplier());
MusicController.pause();
if (gameObjects.length > 0) {
int leadIntime = 2000 - gameObjects[0].getTime();
if (leadIntime > 0) {
this.leadInTime = Math.max(leadIntime, this.leadInTime);
}
}
SoundController.mute(false);
}