v0.9.1: fixed a bug with sewer pipe rooms and let them merge together
This commit is contained in:
parent
fafb887d3b
commit
81156427bb
|
@ -214,6 +214,9 @@ public abstract class RegularPainter extends Painter {
|
|||
case TUNNEL:
|
||||
l.map[door] = l.tunnelTile();
|
||||
break;
|
||||
case WATER:
|
||||
l.map[door] = Terrain.WATER;
|
||||
break;
|
||||
case UNLOCKED:
|
||||
l.map[door] = Terrain.DOOR;
|
||||
break;
|
||||
|
|
|
@ -387,7 +387,7 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
|
|||
public static class Door extends Point implements Bundlable {
|
||||
|
||||
public enum Type {
|
||||
EMPTY, TUNNEL, REGULAR, UNLOCKED, HIDDEN, BARRICADE, LOCKED
|
||||
EMPTY, TUNNEL, WATER, REGULAR, UNLOCKED, HIDDEN, BARRICADE, LOCKED
|
||||
}
|
||||
public Type type = Type.EMPTY;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||
import com.watabou.utils.GameMath;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Point;
|
||||
|
@ -157,8 +158,19 @@ public class SewerPipeRoom extends StandardRoom {
|
|||
}
|
||||
}
|
||||
|
||||
for (Door door : connected.values()) {
|
||||
door.set( Door.Type.REGULAR );
|
||||
for (Room r : connected.keySet()) {
|
||||
if (r instanceof SewerPipeRoom){
|
||||
Point door = connected.get(r);
|
||||
Painter.fill(level, door.x-1, door.y-1, 3, 3, Terrain.EMPTY);
|
||||
if (door.x == left || door.x == right){
|
||||
Painter.fill(level, door.x-1, door.y, 3, 1, Terrain.WATER);
|
||||
} else {
|
||||
Painter.fill(level, door.x, door.y-1, 1, 3, Terrain.WATER);
|
||||
}
|
||||
connected.get(r).set( Door.Type.WATER );
|
||||
} else {
|
||||
connected.get(r).set( Door.Type.REGULAR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +212,8 @@ public class SewerPipeRoom extends StandardRoom {
|
|||
//gets the path distance between two points
|
||||
private int distanceBetweenPoints(Point a, Point b){
|
||||
//on the same side
|
||||
if (a.y == b.y || a.x == b.x){
|
||||
if (((a.x == left || a.x == right) && a.y == b.y)
|
||||
|| ((a.y == top || a.y == bottom) && a.x == b.x)){
|
||||
return Math.max(spaceBetween(a.x, b.x), spaceBetween(a.y, b.y));
|
||||
}
|
||||
|
||||
|
@ -222,7 +235,8 @@ public class SewerPipeRoom extends StandardRoom {
|
|||
private void fillBetweenPoints(Level level, Point from, Point to, int floor){
|
||||
|
||||
//doors are along the same side
|
||||
if (from.y == to.y || from.x == to.x){
|
||||
if (((from.x == left+1 || from.x == right-1) && from.x == to.x)
|
||||
|| ((from.y == top+1 || from.y == bottom-1) && from.y == to.y)){
|
||||
Painter.fill(level,
|
||||
Math.min(from.x, to.x),
|
||||
Math.min(from.y, to.y),
|
||||
|
|
Loading…
Reference in New Issue
Block a user