visit every object when multiple objects end during the same update (close #72)

This commit is contained in:
yugecin
2016-12-10 16:20:50 +01:00
parent 3a137b0ff0
commit a40c8b5d31
2 changed files with 48 additions and 30 deletions

View File

@@ -1018,13 +1018,20 @@ public class Game extends BasicGameState {
if (restart != Restart.LOSE) {
// update objects (loop in unlikely event of any skipped indexes)
boolean keyPressed = keys != ReplayFrame.KEY_NONE;
boolean skippedObject = false;
while (objectIndex < gameObjects.length && trackPosition > beatmap.objects[objectIndex].getTime()) {
// check if we've already passed the next object's start time
boolean overlap = (objectIndex + 1 < gameObjects.length &&
trackPosition > beatmap.objects[objectIndex + 1].getTime() - hitResultOffset[GameData.HIT_50]);
if (skippedObject && (GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive())) {
Vec2f start = gameObjects[objectIndex - 1].start;
UI.getCursor().setCursorPosition((int) start.x, (int) start.y);
}
// update hit object and check completion status
if (gameObjects[objectIndex].update(overlap, delta, mouseX, mouseY, keyPressed, trackPosition)) {
skippedObject = true;
objectIndex++; // done, so increment object index
sbOverlay.updateIndex(objectIndex);
if (objectIndex >= mirrorTo) {