From b93f6d5c3b8ca401a4b32d41a83a0b0a47236445 Mon Sep 17 00:00:00 2001 From: bouillon Date: Sat, 6 Feb 2016 22:39:11 +0100 Subject: [PATCH] Fixed a bug, which prevented the game over sequence. Fixed a bug that caused Alite to crash if paused while an explosion was visible. --- .../opengl/ingame/DockingComputerAI.java | 1 - .../screens/opengl/ingame/FlightScreen.java | 8 ++- .../screens/opengl/objects/Billboard.java | 8 ++- .../opengl/objects/space/SpaceObjectAI.java | 54 ++++++++++--------- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/de/phbouillon/android/games/alite/screens/opengl/ingame/DockingComputerAI.java b/src/de/phbouillon/android/games/alite/screens/opengl/ingame/DockingComputerAI.java index fbb0c77..645c170 100644 --- a/src/de/phbouillon/android/games/alite/screens/opengl/ingame/DockingComputerAI.java +++ b/src/de/phbouillon/android/games/alite/screens/opengl/ingame/DockingComputerAI.java @@ -154,7 +154,6 @@ final void engage() { if (Settings.dockingComputerSpeed == 1) { alite.setTimeFactor(PlayerCobra.SPEED_UP_FACTOR); } - AliteLog.d("Time Warp", "Time Warp = " + alite.getTimeFactor()); if (Assets.danube == null) { Assets.danube = alite.getAudio().newMusic("music/blue_danube.ogg", Sound.SoundType.MUSIC); } diff --git a/src/de/phbouillon/android/games/alite/screens/opengl/ingame/FlightScreen.java b/src/de/phbouillon/android/games/alite/screens/opengl/ingame/FlightScreen.java index 8064404..59d7936 100644 --- a/src/de/phbouillon/android/games/alite/screens/opengl/ingame/FlightScreen.java +++ b/src/de/phbouillon/android/games/alite/screens/opengl/ingame/FlightScreen.java @@ -476,8 +476,12 @@ public void performUpdate(float deltaTime) { if (isDisposed || inGame == null) { return; } - int tf = ((Alite) game).getTimeFactor(); - while((--tf >= 0) && inGame.isPlayerAlive()) { + if (inGame.isPlayerAlive()) { + int tf = ((Alite) game).getTimeFactor(); + while (--tf >= 0 && inGame.isPlayerAlive()) { + inGame.performUpdate(deltaTime, allObjects); + } + } else { inGame.performUpdate(deltaTime, allObjects); } if (informationScreen != null) { diff --git a/src/de/phbouillon/android/games/alite/screens/opengl/objects/Billboard.java b/src/de/phbouillon/android/games/alite/screens/opengl/objects/Billboard.java index 7abff31..329aa27 100644 --- a/src/de/phbouillon/android/games/alite/screens/opengl/objects/Billboard.java +++ b/src/de/phbouillon/android/games/alite/screens/opengl/objects/Billboard.java @@ -140,7 +140,13 @@ private void readObject(ObjectInputStream in) throws IOException { } protected void updateTextureCoordinates(SpriteData sprite) { - texCoordBuffer.clear(); + if (sprite == null) { + // This can only happen if the player pauses the game when an + // explosion billboard is on the screen... We ignore it, it will + // be cleaned up in later frames anyway. + return; + } + texCoordBuffer.clear(); texCoordBuffer.put(sprite.x); texCoordBuffer.put(sprite.y); texCoordBuffer.put(sprite.x); diff --git a/src/de/phbouillon/android/games/alite/screens/opengl/objects/space/SpaceObjectAI.java b/src/de/phbouillon/android/games/alite/screens/opengl/objects/space/SpaceObjectAI.java index c219a2a..450490b 100644 --- a/src/de/phbouillon/android/games/alite/screens/opengl/objects/space/SpaceObjectAI.java +++ b/src/de/phbouillon/android/games/alite/screens/opengl/objects/space/SpaceObjectAI.java @@ -783,32 +783,34 @@ final void update(float deltaTime) { } so.updateSpeed(deltaTime); switch (currentState.peek()) { - case ATTACK: - attackObject(deltaTime); - break; - case BANK: - AliteLog.e("Updating bank state", "This should not happen..."); - break; - case EVADE: - updateEvade(deltaTime); - break; - case FLEE: - fleeObject(deltaTime); - break; - case FLY_STRAIGHT: - flyStraight(deltaTime); - break; - case FLY_PATH: - flyPath(deltaTime); - break; - case IDLE: - break; - case TRACK: - updateTrack(deltaTime); - break; - case FOLLOW_CURVE: - followCurve(deltaTime); - break; + case ATTACK: + attackObject(deltaTime); + break; + case BANK: + AliteLog.e("Updating bank state", "This should not happen..."); + break; + case EVADE: + updateEvade(deltaTime); + break; + case FLEE: + fleeObject(deltaTime); + break; + case FLY_STRAIGHT: + flyStraight(deltaTime); + break; + case FLY_PATH: + flyPath(deltaTime); + break; + case IDLE: + break; + case TRACK: + updateTrack(deltaTime); + break; + case FOLLOW_CURVE: + followCurve(deltaTime); + break; + default: + break; } if (Settings.VIS_DEBUG) { if (so instanceof CobraMkIII && ((CobraMkIII) so).isPlayerCobra()) {