v0.6.3: improved how the game handles chasm floors

This commit is contained in:
Evan Debenham 2017-12-21 23:51:15 -05:00
parent 608a09a92c
commit 43d0beb36d
2 changed files with 11 additions and 6 deletions

View File

@ -591,11 +591,15 @@ public abstract class Level implements Bundlable {
int lastRow = length() - width(); int lastRow = length() - width();
for (int i=0; i < width(); i++) { for (int i=0; i < width(); i++) {
passable[i] = avoid[i] = false; passable[i] = avoid[i] = false;
losBlocking[i] = true;
passable[lastRow + i] = avoid[lastRow + i] = false; passable[lastRow + i] = avoid[lastRow + i] = false;
losBlocking[lastRow + i] = true;
} }
for (int i=width(); i < lastRow; i += width()) { for (int i=width(); i < lastRow; i += width()) {
passable[i] = avoid[i] = false; passable[i] = avoid[i] = false;
losBlocking[i] = true;
passable[i + width()-1] = avoid[i + width()-1] = false; passable[i + width()-1] = avoid[i + width()-1] = false;
losBlocking[i + width()-1] = true;
} }
} }

View File

@ -73,6 +73,9 @@ public abstract class RegularPainter extends Painter {
//painter can be used without rooms //painter can be used without rooms
if (rooms != null) { if (rooms != null) {
int padding = level.feeling == Level.Feeling.CHASM ? 2 : 1;
int leftMost = Integer.MAX_VALUE, topMost = Integer.MAX_VALUE; int leftMost = Integer.MAX_VALUE, topMost = Integer.MAX_VALUE;
for (Room r : rooms) { for (Room r : rooms) {
@ -80,9 +83,8 @@ public abstract class RegularPainter extends Painter {
if (r.top < topMost) topMost = r.top; if (r.top < topMost) topMost = r.top;
} }
//subtract 1 for padding leftMost -= padding;
leftMost--; topMost -= padding;
topMost--;
int rightMost = 0, bottomMost = 0; int rightMost = 0, bottomMost = 0;
@ -92,9 +94,8 @@ public abstract class RegularPainter extends Painter {
if (r.bottom > bottomMost) bottomMost = r.bottom; if (r.bottom > bottomMost) bottomMost = r.bottom;
} }
//add 1 for padding rightMost += padding;
rightMost++; bottomMost += padding;
bottomMost++;
//add 1 to account for 0 values //add 1 to account for 0 values
level.setSize(rightMost + 1, bottomMost + 1); level.setSize(rightMost + 1, bottomMost + 1);