diff --git a/build.gradle b/build.gradle index 3eb825a0c..3d5ba798f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.2' + classpath 'com.android.tools.build:gradle:2.2.3' } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonWallsTilemap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonWallsTilemap.java index 773b122c1..6aa7e3bf9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonWallsTilemap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonWallsTilemap.java @@ -66,13 +66,13 @@ public class DungeonWallsTilemap extends DungeonTilemap { } - if (Dungeon.level.insideMap(pos) && DungeonTileSheet.wallStitcheable.contains(map[pos+mapWidth])) { + if (pos + mapWidth < size && DungeonTileSheet.wallStitcheable.contains(map[pos+mapWidth])) { return DungeonTileSheet.stitchWallOverhangTile( tile, - map[pos + 1 + mapWidth], - map[pos + mapWidth], - map[pos - 1 + mapWidth] + (pos+1) % mapWidth != 0 ? map[pos + 1 + mapWidth] : -1, + map[pos + mapWidth], + pos % mapWidth != 0 ? map[pos - 1 + mapWidth] : -1 ); } else if (Dungeon.level.insideMap(pos) && (map[pos+mapWidth] == Terrain.DOOR || map[pos+mapWidth] == Terrain.LOCKED_DOOR) ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java index 9a29ccd34..241d5daba 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java @@ -167,12 +167,17 @@ public class FogOfWar extends Image { if (cell + mapWidth < mapLength){ if (!DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell + mapWidth]) - && getColorIndexForCell(cell + mapWidth) > cellIndex) { - cellIndex = getColorIndexForCell(cell + mapWidth); + && !DungeonTileSheet.doorTiles.contains(Dungeon.level.map[cell + mapWidth])){ + if (getColorIndexForCell(cell + mapWidth) > cellIndex) + cellIndex = getColorIndexForCell(cell + mapWidth); + fillCell(j, i, FOG_COLORS[cellIndex][brightness]); + cell++; + continue; } if (cell % mapWidth != 0){ - if (DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell - 1])){ + if (DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell - 1]) + || DungeonTileSheet.doorTiles.contains(Dungeon.level.map[cell - 1])){ if (getColorIndexForCell(cell - 1 + mapWidth) > cellIndex) colorArray[0] = colorArray[2] = FOG_COLORS[getColorIndexForCell(cell - 1 + mapWidth)][brightness]; else @@ -188,7 +193,8 @@ public class FogOfWar extends Image { } if ((cell+1) % mapWidth != 0){ - if (DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell + 1])){ + if (DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell + 1]) + || DungeonTileSheet.doorTiles.contains(Dungeon.level.map[cell + 1])){ if (getColorIndexForCell(cell + 1 + mapWidth) > cellIndex) colorArray[1] = colorArray[3] = FOG_COLORS[getColorIndexForCell(cell + 1 + mapWidth)][brightness]; else @@ -218,6 +224,12 @@ public class FogOfWar extends Image { } fillCell(j, i, colorArray); + } else if (DungeonTileSheet.doorTiles.contains(Dungeon.level.map[cell])) { + + colorArray[0] = colorArray[1] = FOG_COLORS[getColorIndexForCell(cell)][brightness]; + colorArray[2] = colorArray[3] = FOG_COLORS[getColorIndexForCell(cell + mapWidth)][brightness]; + fillCell(j, i, colorArray); + } else { fillCell(j, i, FOG_COLORS[getColorIndexForCell(cell)][brightness]); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/WallBlockingTilemap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/WallBlockingTilemap.java index e68fe31ca..f22e6df4d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/WallBlockingTilemap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/WallBlockingTilemap.java @@ -55,20 +55,26 @@ public class WallBlockingTilemap extends Tilemap { if (fogHidden(cell) && fogHidden(cell - mapWidth)){ curr = BLOCK_NONE; - } else if (DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell])) { + } else if (wall(cell)) { if (cell + mapWidth < Dungeon.level.map.length) { - if (!DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell + mapWidth])) { - if (fogHidden(cell + mapWidth)) { - curr = BLOCK_ALL; - } else { + if (!wall(cell + mapWidth)) { + if (!fogHidden(cell + mapWidth)){ curr = BLOCK_NONE; + } else if ((cell + 1) % mapWidth != 0 && !fogHidden(cell + 1) + && !door(cell + 1) && !(wall(cell + 1) && wall(cell + 1 + mapWidth))){ + curr = BLOCK_NONE; + } else if (cell % mapWidth != 0 && !fogHidden(cell - 1) + && !door(cell - 1) && !(wall(cell - 1) && wall(cell - 1 + mapWidth))){ + curr = BLOCK_NONE; + } else { + curr = BLOCK_ALL; } } else { curr = BLOCK_NONE; if ((cell + 1) % mapWidth != 0) { - if (!DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell + 1])){ + if (!wall(cell + 1) && !door(cell + 1)){ if (fogHidden(cell + 1)) { curr += 1; } @@ -82,7 +88,7 @@ public class WallBlockingTilemap extends Tilemap { if (cell % mapWidth != 0) { - if (!DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell - 1])){ + if (!wall(cell - 1) && !door(cell - 1)){ if (fogHidden(cell - 1)) { curr += 2; } @@ -120,7 +126,20 @@ public class WallBlockingTilemap extends Tilemap { private boolean fogHidden(int cell){ if (cell < 0 || cell >= Dungeon.level.length()) return false; - return (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell]); + if (wall(cell) && cell + mapWidth < Dungeon.level.length() && !wall(cell + mapWidth)){ + return (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell]) + || (!Dungeon.level.visited[cell + mapWidth] && !Dungeon.level.mapped[cell + mapWidth]); + } else { + return (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell]); + } + } + + private boolean wall(int cell){ + return DungeonTileSheet.wallStitcheable.contains(Dungeon.level.map[cell]); + } + + private boolean door(int cell ) { + return DungeonTileSheet.doorTiles.contains(Dungeon.level.map[cell]); } public synchronized void updateArea(int x, int y, int w, int h) {