Fixed issue where invisible/out of bounds tiles were rendering

This commit is contained in:
Collin Smith 2019-03-15 03:50:48 -07:00
parent f76534a051
commit 598e9887b5
2 changed files with 14 additions and 4 deletions

View File

@ -447,7 +447,7 @@ public class DS1 {
public int prop4() { return (value >>> 24) & 0xFF; }
public int prop3() { return (value >>> 16) & 0xFF; }
public int prop2() { return (value >>> 8) & 0xFF; }
public int prop1() { return (value >>> 0) & 0xFF; }
public int prop1() { return (value ) & 0xFF; }
void setOrientation(int orientation) {
this.orientation = (short) orientation;

View File

@ -971,6 +971,12 @@ public class Map implements Disposable {
orFlags(zone.flags, tx, ty, DT1.Tile.FLAG_BLOCK_WALK);
}
if ((cell.value & DS1.Cell.FLOOR_UNWALK_MASK) == 0) {
// TODO: Technically this might not be needed since the level can be assumed enclosed
orFlags(zone.flags, tx, ty, DT1.Tile.FLAG_BLOCK_WALK);
continue;
}
if ((cell.value & DS1.Cell.HIDDEN_MASK) != 0) {
continue;
}
@ -982,6 +988,7 @@ public class Map implements Disposable {
zone.tiles[layer][tx][ty] = null;
continue;
}
copyFlags(zone.flags, tx, ty, tile.tile);
if (NO_FLOOR) {
orFlags(zone.flags, tx, ty, DT1.Tile.FLAG_BLOCK_WALK);
@ -1000,7 +1007,6 @@ public class Map implements Disposable {
int ptr = l + (y * ds1.wallLine);
for (int x = 0; x < ds1.width; x++, tx++, ptr += ds1.numWalls) {
DS1.Cell cell = ds1.walls[ptr];
if (Orientation.isSpecial(cell.orientation)) {
Tile tile = zone.tiles[layer][tx][ty] = Tile.of(dt1s, cell);
if (ID.POPPADS.contains(cell.id)) {
@ -1017,6 +1023,10 @@ public class Map implements Disposable {
}
}
if ((cell.value & DS1.Cell.FLOOR_UNWALK_MASK) == 0) {
continue;
}
if ((cell.value & DS1.Cell.HIDDEN_MASK) != 0) {
// This seems like all the special tiles, null usually means marker tile (start pos),
// non null usually means stuff like side of river, used for ?weather? ?rain drops?
@ -1065,11 +1075,11 @@ public class Map implements Disposable {
int ptr = l + (y * ds1.shadowLine);
for (int x = 0; x < ds1.width; x++, tx++, ptr += ds1.numShadows) {
DS1.Cell cell = ds1.shadows[ptr];
if ((cell.value & DS1.Cell.HIDDEN_MASK) != 0) {
if ((cell.value & DS1.Cell.FLOOR_UNWALK_MASK) == 0) {
continue;
}
if ((cell.value & DS1.Cell.FLOOR_UNWALK_MASK) == 0) {
if ((cell.value & DS1.Cell.HIDDEN_MASK) != 0) {
continue;
}