v0.9.1: tweaked room merging logic:
- entrance rooms can no longer merge - blacksmith room can now merge - burned and minefield rooms can no longer merge - added limits to how often rooms can merge
This commit is contained in:
parent
84450af30c
commit
3f5359146e
|
@ -39,6 +39,7 @@ import com.watabou.utils.Rect;
|
|||
import com.watabou.utils.Reflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class RegularPainter extends Painter {
|
||||
|
||||
|
@ -176,6 +177,8 @@ public abstract class RegularPainter extends Painter {
|
|||
hiddenDoorChance = (0.5f + hiddenDoorChance)/2f;
|
||||
}
|
||||
|
||||
roomMerges.clear();
|
||||
|
||||
for (Room r : rooms) {
|
||||
for (Room n : r.connected.keySet()) {
|
||||
|
||||
|
@ -233,14 +236,28 @@ public abstract class RegularPainter extends Painter {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<Room, Room> roomMerges = new HashMap<>();
|
||||
|
||||
protected boolean joinRooms( Level l, Room r, Room n ) {
|
||||
|
||||
//FIXME currently this joins rooms a bit too often! Need to think up some limitations
|
||||
if (!(r instanceof StandardRoom) || !((StandardRoom) r).joinable
|
||||
|| !(n instanceof StandardRoom) || !((StandardRoom) n).joinable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (roomMerges.get(r) == n) return true;
|
||||
if (roomMerges.get(n) == r) return true;
|
||||
|
||||
//normal sized rooms can be merged at most once. Large and Giant rooms can be merged many times
|
||||
if (roomMerges.containsKey(r) || roomMerges.containsValue(r)){
|
||||
if (((StandardRoom) r).sizeCat == StandardRoom.SizeCategory.NORMAL) return false;
|
||||
}
|
||||
if (roomMerges.containsKey(n) || roomMerges.containsValue(n)){
|
||||
if (((StandardRoom) n).sizeCat == StandardRoom.SizeCategory.NORMAL) return false;
|
||||
}
|
||||
|
||||
//TODO maybe more limitations here, such as limiting maximum width/height for normal sized rooms?
|
||||
|
||||
Rect w = r.intersect( n );
|
||||
if (w.left == w.right) {
|
||||
|
@ -265,6 +282,8 @@ public abstract class RegularPainter extends Painter {
|
|||
|
||||
Painter.fill( l, w.left, w.top, w.width(), 1, Terrain.EMPTY );
|
||||
}
|
||||
|
||||
roomMerges.put(r, n);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||
|
||||
public class SewerBossEntranceRoom extends EntranceRoom {
|
||||
|
||||
{
|
||||
joinable = false;
|
||||
}
|
||||
|
||||
public void paint(Level level ) {
|
||||
|
||||
|
|
|
@ -33,10 +33,6 @@ import com.watabou.noosa.Tilemap;
|
|||
import com.watabou.utils.Point;
|
||||
|
||||
public class SewerBossExitRoom extends ExitRoom {
|
||||
|
||||
{
|
||||
joinable = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
|
|
|
@ -31,10 +31,6 @@ import com.watabou.utils.Point;
|
|||
import com.watabou.utils.Random;
|
||||
|
||||
public class BlacksmithRoom extends StandardRoom {
|
||||
|
||||
{
|
||||
joinable = false; //TODO maybe joinable? Could be neat in terms of layout
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
|
|
|
@ -29,6 +29,10 @@ import com.watabou.utils.Point;
|
|||
import com.watabou.utils.Random;
|
||||
|
||||
public class BurnedRoom extends PatchRoom {
|
||||
|
||||
{
|
||||
joinable = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] sizeCatProbs() {
|
||||
|
|
|
@ -33,7 +33,9 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class EntranceRoom extends StandardRoom {
|
||||
|
||||
//TODO maybe not joinable? It's a little BS to spawn with enemies
|
||||
{
|
||||
joinable = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
|
|
|
@ -28,8 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
|||
import com.watabou.utils.Point;
|
||||
|
||||
public class ExitRoom extends StandardRoom {
|
||||
|
||||
//TODO maybe not joinable?
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
|
|
|
@ -30,6 +30,10 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class MinefieldRoom extends StandardRoom {
|
||||
|
||||
{
|
||||
joinable = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] sizeCatProbs() {
|
||||
return new float[]{4, 1, 0};
|
||||
|
|
Loading…
Reference in New Issue
Block a user