From 63e448240577d71e7c84c37dbaf084272ecb0396 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 29 Mar 2020 20:28:50 -0400 Subject: [PATCH] v0.8.0: fixed the following bugs: - various screen layout + orientation errors with power saver mode on - DM-300s sprite exploding many times if it is stunned as it dies --- .../android/AndroidPlatformSupport.java | 10 +++++++--- .../shatteredpixeldungeon/sprites/DM300Sprite.java | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java index aa16353df..1f7f1f243 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java @@ -59,8 +59,12 @@ public class AndroidPlatformSupport extends PlatformSupport { Game.dispWidth = AndroidGame.view.getMeasuredWidth(); Game.dispHeight = AndroidGame.view.getMeasuredHeight(); - - if ((Game.dispWidth >= Game.dispHeight) != PixelScene.landscape()){ + + boolean fullscreen = Build.VERSION.SDK_INT < Build.VERSION_CODES.N + || !AndroidGame.instance.isInMultiWindowMode(); + + if (fullscreen && SPDSettings.landscape() != null + && (Game.dispWidth >= Game.dispHeight) != SPDSettings.landscape()){ int tmp = Game.dispWidth; Game.dispWidth = Game.dispHeight; Game.dispHeight = tmp; @@ -75,7 +79,7 @@ public class AndroidPlatformSupport extends PlatformSupport { if (Game.dispWidth < renderWidth*2 || Game.dispHeight < renderHeight*2) SPDSettings.put( SPDSettings.KEY_POWER_SAVER, true ); - if (SPDSettings.powerSaver()){ + if (SPDSettings.powerSaver() && fullscreen){ int maxZoom = (int)Math.min(Game.dispWidth/renderWidth, Game.dispHeight/renderHeight); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java index 9face8fdc..d00ea5c0a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java @@ -89,7 +89,9 @@ public class DM300Sprite extends MobSprite { Sample.INSTANCE.play( Assets.SND_ROCKS ); Camera.main.shake( 3, 0.7f ); } - + + private boolean exploded = false; + @Override public void onComplete( Animation anim ) { @@ -103,7 +105,8 @@ public class DM300Sprite extends MobSprite { super.onComplete( anim ); - if (anim == die) { + if (anim == die && !exploded) { + exploded = true; Sample.INSTANCE.play(Assets.SND_BLAST); emitter().burst( BlastParticle.FACTORY, 25 ); }