v0.6.3: small fixes to fog update & performance improvement to terrain

This commit is contained in:
Evan Debenham 2017-12-27 02:57:40 -05:00
parent e828148ebc
commit 7afd8b8889
3 changed files with 9 additions and 13 deletions

View File

@ -755,17 +755,17 @@ public class Dungeon {
int t = Math.max( 0, y - dist ); int t = Math.max( 0, y - dist );
int b = Math.min( y + dist, level.height() - 1 ); int b = Math.min( y + dist, level.height() - 1 );
int length = r - l + 1; int width = r - l + 1;
int width = t - b + 1; int height = b - t + 1;
int pos = l + t * level.width(); int pos = l + t * level.width();
for (int i = t; i <= b; i++) { for (int i = t; i <= b; i++) {
BArray.or( level.visited, level.heroFOV, pos, length, level.visited ); BArray.or( level.visited, level.heroFOV, pos, width, level.visited );
pos+=level.width(); pos+=level.width();
} }
GameScene.updateFog(l, t, length, width); GameScene.updateFog(l, t, width, height);
if (hero.buff(MindVision.class) != null){ if (hero.buff(MindVision.class) != null){
for (Mob m : level.mobs.toArray(new Mob[0])){ for (Mob m : level.mobs.toArray(new Mob[0])){

View File

@ -58,8 +58,7 @@ public class DungeonTerrainTilemap extends DungeonTilemap {
if (!flat) { if (!flat) {
if ((DungeonTileSheet.doorTile(tile))) { if ((DungeonTileSheet.doorTile(tile))) {
return DungeonTileSheet.getRaisedDoorTile(tile, map[pos - mapWidth]); return DungeonTileSheet.getRaisedDoorTile(tile, map[pos - mapWidth]);
} else if (tile == Terrain.WALL || tile == Terrain.WALL_DECO } else if (DungeonTileSheet.wallStitcheable(tile)){
|| tile == Terrain.SECRET_DOOR || tile == Terrain.BOOKSHELF){
return DungeonTileSheet.getRaisedWallTile( return DungeonTileSheet.getRaisedWallTile(
tile, tile,
pos, pos,
@ -100,11 +99,6 @@ public class DungeonTerrainTilemap extends DungeonTilemap {
@Override @Override
protected boolean needsRender(int pos) { protected boolean needsRender(int pos) {
return data[pos] != DungeonTileSheet.WATER || return data[pos] >= 0 && data[pos] != DungeonTileSheet.WATER;
(
pos + mapWidth < size &&
DungeonTileSheet.wallStitcheable(map[pos]) &&
DungeonTileSheet.wallStitcheable(map[pos + mapWidth])
);
} }
} }

View File

@ -219,7 +219,9 @@ public class DungeonTileSheet {
public static int getRaisedWallTile(int tile, int pos, int right, int below, int left){ public static int getRaisedWallTile(int tile, int pos, int right, int below, int left){
int result; int result;
if (doorTile(below)) result = RAISED_WALL_DOOR;
if (below == -1 || wallStitcheable(below)) return -1;
else if (doorTile(below)) result = RAISED_WALL_DOOR;
else if (tile == Terrain.WALL || tile == Terrain.SECRET_DOOR) result = RAISED_WALL; else if (tile == Terrain.WALL || tile == Terrain.SECRET_DOOR) result = RAISED_WALL;
else if (tile == Terrain.WALL_DECO) result = RAISED_WALL_DECO; else if (tile == Terrain.WALL_DECO) result = RAISED_WALL_DECO;
else if (tile == Terrain.BOOKSHELF) result = RAISED_WALL_BOOKSHELF; else if (tile == Terrain.BOOKSHELF) result = RAISED_WALL_BOOKSHELF;