diff --git a/core/src/main/assets/custom_tiles/prison_exit.png b/core/src/main/assets/custom_tiles/prison_exit.png index 85edb7395..a01d1bf05 100644 Binary files a/core/src/main/assets/custom_tiles/prison_exit.png and b/core/src/main/assets/custom_tiles/prison_exit.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 90eca4daa..73f8357ff 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -145,6 +145,7 @@ public abstract class Level implements Bundlable { public SparseArray plants; public SparseArray traps; public HashSet customTiles; + public HashSet customWalls; protected ArrayList itemsToSpawn = new ArrayList<>(); @@ -168,6 +169,7 @@ public abstract class Level implements Bundlable { private static final String PLANTS = "plants"; private static final String TRAPS = "traps"; private static final String CUSTOM_TILES= "customTiles"; + private static final String CUSTOM_WALLS= "customWalls"; private static final String MOBS = "mobs"; private static final String BLOBS = "blobs"; private static final String FEELING = "feeling"; @@ -269,6 +271,7 @@ public abstract class Level implements Bundlable { plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); + customWalls = new HashSet<>(); } while (!build()); decorate(); @@ -319,6 +322,7 @@ public abstract class Level implements Bundlable { plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); + customWalls = new HashSet<>(); map = bundle.getIntArray( MAP ); @@ -391,6 +395,12 @@ public abstract class Level implements Bundlable { customTiles.add(vis); } } + + collection = bundle.getCollection( CUSTOM_WALLS ); + for (Bundlable p : collection) { + CustomTiledVisual vis = (CustomTiledVisual)p; + customWalls.add(vis); + } collection = bundle.getCollection( MOBS ); for (Bundlable m : collection) { @@ -429,6 +439,7 @@ public abstract class Level implements Bundlable { bundle.put( PLANTS, plants.values() ); bundle.put( TRAPS, traps.values() ); bundle.put( CUSTOM_TILES, customTiles ); + bundle.put( CUSTOM_WALLS, customWalls ); bundle.put( MOBS, mobs ); bundle.put( BLOBS, blobs.values() ); bundle.put( FEELING, feeling ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index 8c3a3452e..8d28f63bf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -345,6 +345,11 @@ public class PrisonBossLevel extends Level { customTiles.add(vis); ((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis); + vis = new exitVisualWalls(); + vis.pos(11, 8); + customWalls.add(vis); + ((GameScene)ShatteredPixelDungeon.scene()).addCustomWall(vis); + Dungeon.hero.interrupt(); Dungeon.hero.pos = 5+27*32; Dungeon.hero.sprite.interruptMotion(); @@ -543,7 +548,6 @@ public class PrisonBossLevel extends Level { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; public exitVisual() { @@ -553,7 +557,7 @@ public class PrisonBossLevel extends Level { @Override public CustomTiledVisual create() { tileW = 12; - tileH = 15; + tileH = 14; mapSimpleImage(0, 0); return super.create(); } @@ -570,4 +574,40 @@ public class PrisonBossLevel extends Level { return render[pos] != 0; } } + + public static class exitVisualWalls extends CustomTiledVisual { + private static short[] render = new short[]{ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + + public exitVisualWalls() { + super(Assets.PRISON_EXIT); + } + + @Override + public CustomTiledVisual create() { + tileW = 12; + tileH = 14; + mapSimpleImage(4, 0); + return super.create(); + } + + @Override + protected boolean needsRender(int pos) { + return render[pos] != 0; + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 140958074..f124e6bd8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -133,6 +133,7 @@ public class GameScene extends PixelScene { private Group terrain; private Group customTiles; private Group levelVisuals; + private Group customWalls; private Group ripples; private Group plants; private Group traps; @@ -238,6 +239,13 @@ public class GameScene extends PixelScene { walls = new DungeonWallsTilemap(); add(walls); + customWalls = new Group(); + add(customWalls); + + for( CustomTiledVisual visual : Dungeon.level.customWalls){ + addCustomWall(visual); + } + wallBlocking = new WallBlockingTilemap(); add (wallBlocking); @@ -538,6 +546,10 @@ public class GameScene extends PixelScene { public void addCustomTile( CustomTiledVisual visual){ customTiles.add( visual.create() ); } + + public void addCustomWall( CustomTiledVisual visual){ + customWalls.add( visual.create() ); + } private void addHeapSprite( Heap heap ) { ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class );