v0.9.1: fixed rare visual glitches in tilemaps

This commit is contained in:
Evan Debenham 2020-12-10 16:51:52 -05:00
parent 533447d2b2
commit 692a275a55
2 changed files with 7 additions and 7 deletions

View File

@ -50,24 +50,25 @@ public abstract class DungeonTilemap extends Tilemap {
@Override
public synchronized void updateMap() {
super.updateMap();
for (int i = 0; i < data.length; i++)
data[i] = getTileVisual(i ,map[i], false);
super.updateMap();
}
@Override
public synchronized void updateMapCell(int cell) {
//update in a 3x3 grid to account for neighbours which might also be affected
if (Dungeon.level.insideMap(cell)) {
for (int i : PathFinder.NEIGHBOURS9) {
data[cell + i] = getTileVisual(cell + i, map[cell + i], false);
}
super.updateMapCell(cell - mapWidth - 1);
super.updateMapCell(cell + mapWidth + 1);
for (int i : PathFinder.NEIGHBOURS9)
data[cell + i] = getTileVisual(cell + i, map[cell + i], false);
//unless we're at the level's edge, then just do the one tile.
} else {
super.updateMapCell(cell);
data[cell] = getTileVisual(cell, map[cell], false);
super.updateMapCell(cell);
}
}

View File

@ -46,9 +46,6 @@ public class WallBlockingTilemap extends Tilemap {
@Override
public synchronized void updateMap() {
super.updateMap();
data = new int[size]; //clears all values, including cleared tiles
for (int cell = 0; cell < data.length; cell++) {
//force all top/bottom row, and none-discoverable cells to cleared
if (!Dungeon.level.discoverable[cell]
@ -59,6 +56,8 @@ public class WallBlockingTilemap extends Tilemap {
updateMapCell(cell);
}
}
super.updateMap();
}
private int curr;