v0.9.1: improved the caves painter, halls painter, and ruins room

This commit is contained in:
Evan Debenham 2020-10-23 21:17:36 -04:00
parent c37c25fd84
commit fafb887d3b
3 changed files with 65 additions and 39 deletions

View File

@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;
import com.watabou.utils.Random;
@ -42,9 +41,33 @@ public class CavesPainter extends RegularPainter {
int w = level.width();
int l = level.length();
int[] map = level.map;
for (Room r : rooms) {
if (r instanceof StandardRoom && ((StandardRoom) r).joinable) {
for (Room n : r.neigbours) {
if (n instanceof StandardRoom && ((StandardRoom) n).joinable && !r.connected.containsKey( n )) {
Rect i = r.intersect( n );
if (i.left == i.right && i.bottom - i.top >= 3) {
i.top++;
i.right++;
Painter.fill( level, i.left, i.top, 1, i.height(), Terrain.CHASM );
} else if (i.top == i.bottom && i.right - i.left >= 3) {
i.left++;
i.bottom++;
Painter.fill( level, i.left, i.top, i.width(), 1, Terrain.CHASM );
}
}
}
}
}
for (Room room : rooms) {
if (!(room instanceof EmptyRoom || room instanceof CaveRoom)) {
if (!(room instanceof StandardRoom)) {
continue;
}
@ -87,7 +110,10 @@ public class CavesPainter extends RegularPainter {
}
for (Room n : room.connected.keySet()) {
if ((n instanceof StandardRoom || n instanceof ConnectionRoom) && Random.Int( 3 ) == 0) {
if ((n instanceof StandardRoom || n instanceof ConnectionRoom) && Random.Int( 5 ) == 0) {
Painter.set( level, room.connected.get( n ), Terrain.EMPTY_DECO );
}
if (n instanceof CaveRoom && room instanceof CaveRoom){
Painter.set( level, room.connected.get( n ), Terrain.EMPTY_DECO );
}
}
@ -121,33 +147,6 @@ public class CavesPainter extends RegularPainter {
map[i] = Terrain.WALL_DECO;
}
}
for (Room r : rooms) {
if (r instanceof EmptyRoom) {
for (Room n : r.neigbours) {
if (n instanceof EmptyRoom && !r.connected.containsKey( n )) {
Rect i = r.intersect( n );
if (i.left == i.right && i.bottom - i.top >= 5) {
i.top += 2;
i.bottom -= 1;
i.right++;
Painter.fill( level, i.left, i.top, 1, i.height(), Terrain.CHASM );
} else if (i.top == i.bottom && i.right - i.left >= 5) {
i.left += 2;
i.right -= 1;
i.bottom++;
Painter.fill( level, i.left, i.top, i.width(), 1, Terrain.CHASM );
}
}
}
}
}
}
}

View File

@ -24,8 +24,10 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import com.watabou.utils.Rect;
import java.util.ArrayList;
@ -61,5 +63,30 @@ public class HallsPainter extends RegularPainter {
}
}
for (Room r : rooms) {
if (r instanceof StandardRoom && ((StandardRoom) r).joinable) {
for (Room n : r.neigbours) {
if (n instanceof StandardRoom && ((StandardRoom) n).joinable && !r.connected.containsKey( n )) {
Rect i = r.intersect( n );
if (i.left == i.right && i.bottom - i.top >= 3) {
i.top++;
i.right++;
Painter.fill( level, i.left, i.top, 1, i.height(), Terrain.CHASM );
} else if (i.top == i.bottom && i.right - i.left >= 3) {
i.left++;
i.bottom++;
Painter.fill( level, i.left, i.top, i.width(), 1, Terrain.CHASM );
}
}
}
}
}
}
}

View File

@ -29,7 +29,7 @@ public class RuinsRoom extends PatchRoom {
@Override
public float[] sizeCatProbs() {
return new float[]{9, 3, 1};
return new float[]{4, 2, 1};
}
@Override
@ -39,12 +39,12 @@ public class RuinsRoom extends PatchRoom {
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
}
//fill scales from ~10% at 4x4, to ~25% at 18x18
// normal ~20% to ~25%
// large ~25% to ~30%
// giant ~30% to ~35%
float fill = .2f + (width()*height())/2048f;
//fill scales from ~20% at 4x4, to ~50% at 18x18
// normal ~20% to ~30%
// large ~30% to ~40%
// giant ~40% to ~50%
float fill = 0.20f + (width()*height())/1024f;
setupPatch(level, fill, 0, true);
cleanDiagonalEdges();