v0.5.0: Improved several things relating to new visuals:

- Bookshelves now have depth (like walls)
- Barricades now have depth
- Refined sewer visuals
This commit is contained in:
Evan Debenham 2016-12-16 05:35:47 -05:00
parent bdf2553c30
commit 9cb91026a6
12 changed files with 82 additions and 78 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -507,7 +507,7 @@ public abstract class RegularLevel extends Level {
secretDoors++;
break;
case BARRICADE:
map[door] = Random.Int( 3 ) == 0 ? Terrain.BOOKSHELF : Terrain.BARRICADE;
map[door] = Terrain.BARRICADE;
break;
case LOCKED:
map[door] = Terrain.LOCKED_DOOR;

View File

@ -204,7 +204,7 @@ public class SewerLevel extends RegularLevel {
this.pos = pos;
PointF p = DungeonTilemap.tileCenterToWorld( pos );
pos( p.x - 2, p.y + 1, 4, 0 );
pos( p.x - 2, p.y + 3, 4, 0 );
pour( factory, 0.1f );
}
@ -246,7 +246,7 @@ public class SewerLevel extends RegularLevel {
speed.set( Random.Float( -2, +2 ), 0 );
left = lifespan = 0.5f;
left = lifespan = 0.4f;
}
}
}

View File

@ -38,34 +38,15 @@ public class LibraryPainter extends Painter {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
fill( level, room, 1, Terrain.EMPTY_SP );
Room.Door entrance = room.entrance();
Point a = null;
Point b = null;
if (entrance.x == room.left) {
a = new Point( room.left+1, entrance.y-1 );
b = new Point( room.left+1, entrance.y+1 );
fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.BOOKSHELF );
} else if (entrance.x == room.right) {
a = new Point( room.right-1, entrance.y-1 );
b = new Point( room.right-1, entrance.y+1 );
fill( level, room.left+1, room.top + 1, 1, room.height() - 1 , Terrain.BOOKSHELF );
} else if (entrance.y == room.top) {
a = new Point( entrance.x+1, room.top+1 );
b = new Point( entrance.x-1, room.top+1 );
fill( level, room.left + 1, room.bottom-1, room.width() - 1, 1 , Terrain.BOOKSHELF );
} else if (entrance.y == room.bottom) {
a = new Point( entrance.x+1, room.bottom-1 );
b = new Point( entrance.x-1, room.bottom-1 );
fill( level, room.left + 1, room.top+1, room.width() - 1, 1 , Terrain.BOOKSHELF );
}
if (a != null && level.map[a.x + a.y * level.width()] == Terrain.EMPTY) {
set( level, a, Terrain.STATUE );
}
if (b != null && level.map[b.x + b.y * level.width()] == Terrain.EMPTY) {
set( level, b, Terrain.STATUE );
fill( level, room.left + 1, room.top+1, room.width() - 1, 1 , Terrain.BOOKSHELF );
if (entrance.y == room.top){
set( level, entrance.x, entrance.y + 1, Terrain.EMPTY_SP );
}
int n = Random.IntRange( 2, 3 );
@ -73,7 +54,7 @@ public class LibraryPainter extends Painter {
int pos;
do {
pos = level.pointToCell(room.random());
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null);
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null);
Item item;
if (i == 0)
item = Random.Int(2) == 0 ? new ScrollOfIdentify() : new ScrollOfRemoveCurse();

View File

@ -184,14 +184,14 @@ public class GameScene extends PixelScene {
};
terrain.add( water );
ripples = new Group();
terrain.add( ripples );
DungeonTileSheet.setupVariance(Dungeon.level.map.length, Dungeon.seedCurDepth());
tiles = new DungeonTerrainTilemap();
terrain.add( tiles );
ripples = new Group();
terrain.add( ripples );
customTiles = new Group();
terrain.add(customTiles);

View File

@ -38,7 +38,8 @@ public class DungeonTerrainTilemap extends DungeonTilemap {
if (!flat) {
if ((DungeonTileSheet.doorTiles.contains(tile))) {
return DungeonTileSheet.getRaisedDoorTile(tile, map[pos - mapWidth]);
} else if (tile == Terrain.WALL || tile == Terrain.WALL_DECO || tile == Terrain.SECRET_DOOR){
} else if (tile == Terrain.WALL || tile == Terrain.WALL_DECO
|| tile == Terrain.SECRET_DOOR || tile == Terrain.BOOKSHELF){
return DungeonTileSheet.getRaisedWallTile(
tile,
pos,
@ -46,8 +47,10 @@ public class DungeonTerrainTilemap extends DungeonTilemap {
pos + mapWidth < size ? map[pos + mapWidth] : -1,
pos % mapWidth != 0 ? map[pos - 1] : -1
);
} else if (tile == Terrain.BARRICADE) {
return DungeonTileSheet.RAISED_BARRICADE;
} else {
return -1;
return DungeonTileSheet.NULL_TILE;
}
} else {
return DungeonTileSheet.getVisualWithAlts(

View File

@ -72,10 +72,6 @@ public class DungeonTileSheet {
public static final int EMPTY_WELL = GROUND +22;
public static final int ALCHEMY_POT = GROUND +23;
public static final int PEDESTAL = GROUND +24;
public static final int BARRICADE = GROUND +25;
public static final int BOOKSHELF = GROUND +26;
public static final int BOOKSHELF_ALT = GROUND +28;
@ -152,43 +148,48 @@ public class DungeonTileSheet {
}
/**********************************************************************
Flat Wall Tiles
Flat Tiles
**********************************************************************/
private static final int FLAT_WALLS = xy(1, 5); //16 slots
public static final int FLAT_WALL = FLAT_WALLS+0;
public static final int FLAT_WALL_DECO = FLAT_WALLS+1;
public static final int FLAT_BOOKSHELF = FLAT_WALLS+2;
public static final int FLAT_WALL_ALT = FLAT_WALLS+3;
public static final int FLAT_WALL_DECO_ALT = FLAT_WALLS+4;
public static final int FLAT_WALL_ALT = FLAT_WALLS+4;
public static final int FLAT_WALL_DECO_ALT = FLAT_WALLS+5;
public static final int FLAT_BOOKSHELF_ALT = FLAT_WALLS+6;
private static final int FLAT_DOORS = xy(1,6); //16 slots
private static final int FLAT_DOORS = xy(1, 6); //16 slots
public static final int FLAT_DOOR = FLAT_DOORS+0;
public static final int FLAT_DOOR_OPEN = FLAT_DOORS+1;
public static final int FLAT_DOOR_LOCKED = FLAT_DOORS+2;
public static final int UNLOCKED_EXIT = FLAT_DOORS+3;
public static final int LOCKED_EXIT = FLAT_DOORS+4;
public static final int FLAT_BARRICADE = xy(1, 7);
/**********************************************************************
* Raised Wall Tiles, Lower Layer
* Raised Tiles, Lower Layer
**********************************************************************/
private static final int RAISED_WALLS = xy(1, 8); //32 slots
private static final int RAISED_WALLS = xy(1, 8); //32 slots
//+1 for open to the right, +2 for open to the left
public static final int RAISED_WALL = RAISED_WALLS+0;
public static final int RAISED_WALL_DECO = RAISED_WALLS+4;
public static final int RAISED_WALL = RAISED_WALLS+0;
public static final int RAISED_WALL_DECO = RAISED_WALLS+4;
//wall that appears behind a top/bottom doorway
public static final int RAISED_WALL_DOOR = RAISED_WALLS+8;
public static final int RAISED_WALL_DOOR = RAISED_WALLS+8;
public static final int RAISED_WALL_BOOKSHELF = RAISED_WALLS+12;
public static final int RAISED_WALL_ALT = RAISED_WALLS+16;
public static final int RAISED_WALL_DECO_ALT = RAISED_WALLS+20;
public static final int RAISED_WALL_ALT = RAISED_WALLS+16;
public static final int RAISED_WALL_DECO_ALT = RAISED_WALLS+20;
public static final int RAISED_WALL_BOOKSHELF_ALT = RAISED_WALLS+28;
//These tiles count as wall for the purposes of wall stitching
public static List wallStitcheable = Arrays.asList(
Terrain.WALL, Terrain.WALL_DECO, Terrain.SECRET_DOOR,
Terrain.LOCKED_EXIT, Terrain.UNLOCKED_EXIT, NULL_TILE
Terrain.LOCKED_EXIT, Terrain.UNLOCKED_EXIT, Terrain.BOOKSHELF, NULL_TILE
);
public static int getRaisedWallTile(int tile, int pos, int right, int below, int left){
@ -196,6 +197,7 @@ public class DungeonTileSheet {
if (doorTiles.contains(below)) result = RAISED_WALL_DOOR;
else if (tile == Terrain.WALL || tile == Terrain.SECRET_DOOR) result = RAISED_WALL;
else if (tile == Terrain.WALL_DECO) result = RAISED_WALL_DECO;
else if (tile == Terrain.BOOKSHELF) result = RAISED_WALL_BOOKSHELF;
else return -1;
result = getVisualWithAlts(result, pos);
@ -225,17 +227,25 @@ public class DungeonTileSheet {
Terrain.DOOR, Terrain.LOCKED_DOOR, Terrain.OPEN_DOOR
);
public static final int RAISED_BARRICADE = xy(1, 11);
/**********************************************************************
* Raised Wall Tiles, Upper Layer
* Raised Tiles, Upper Layer
**********************************************************************/
//+1 for open right, +2 for open right-below, +4 for open left-below, +8 for open left.
public static final int WALLS_INTERNAL = xy(1, 12); //16 slots
public static final int WALLS_INTERNAL = xy(1, 12); //32 slots
private static final int WALL_INTERNAL = WALLS_INTERNAL+0;
private static final int WALL_INTERNAL_WOODEN = WALLS_INTERNAL+16;
public static int stitchInternalWallTile(int tile, int right, int rightBelow, int leftBelow, int left){
int result;
if (tile == Terrain.BOOKSHELF) result = WALL_INTERNAL_WOODEN;
else result = WALL_INTERNAL;
public static int stitchInternalWallTile(int right, int rightBelow, int leftBelow, int left){
int result = WALLS_INTERNAL;
if (!wallStitcheable.contains(right)) result += 1;
if (!wallStitcheable.contains(rightBelow)) result += 2;
if (!wallStitcheable.contains(leftBelow)) result += 4;
@ -244,15 +254,17 @@ public class DungeonTileSheet {
}
//+1 for open to the down-right, +2 for open to the down-left
private static final int WALLS_OVERHANG = xy(1, 13); //16 slots
private static final int WALLS_OVERHANG = xy(1, 14); //32 slots
public static final int WALL_OVERHANG = WALLS_OVERHANG+0;
public static final int DOOR_SIDEWAYS_OVERHANG = WALL_OVERHANG+4;
public static final int DOOR_SIDEWAYS_OVERHANG_OPEN = WALL_OVERHANG+8;
public static final int DOOR_SIDEWAYS_OVERHANG = WALLS_OVERHANG+4;
public static final int DOOR_SIDEWAYS_OVERHANG_OPEN = WALLS_OVERHANG+8;
public static final int WALL_OVERHANG_WOODEN = WALLS_OVERHANG+12;
public static int stitchWallOverhangTile(int tile, int rightBelow, int leftBelow){
public static int stitchWallOverhangTile(int tile, int rightBelow, int below, int leftBelow){
int visual;
if (tile == Terrain.DOOR || tile == Terrain.LOCKED_DOOR) visual = DOOR_SIDEWAYS_OVERHANG;
else if (tile == Terrain.OPEN_DOOR) visual = DOOR_SIDEWAYS_OVERHANG_OPEN;
else if (below == Terrain.BOOKSHELF) visual = WALL_OVERHANG_WOODEN;
else visual = WALL_OVERHANG;
if (!wallStitcheable.contains(rightBelow)) visual += 1;
@ -262,10 +274,12 @@ public class DungeonTileSheet {
}
//no attachment to adjacent walls
public static final int DOOR_OVERHANG = WALL_OVERHANG+12;
public static final int DOOR_OVERHANG_OPEN = WALL_OVERHANG+13;
public static final int DOOR_SIDEWAYS = WALL_OVERHANG+14;
public static final int DOOR_SIDEWAYS_LOCKED = WALL_OVERHANG+15;
public static final int DOOR_OVERHANG = WALL_OVERHANG+16;
public static final int DOOR_OVERHANG_OPEN = WALL_OVERHANG+17;
public static final int DOOR_SIDEWAYS = WALL_OVERHANG+18;
public static final int DOOR_SIDEWAYS_LOCKED = WALL_OVERHANG+19;
public static final int BARRICADE_OVERHANG = WALL_OVERHANG+21;
/**********************************************************************
* Logic for the selection of tile visuals
@ -281,7 +295,6 @@ public class DungeonTileSheet {
directVisuals.put(Terrain.EXIT, EXIT);
directVisuals.put(Terrain.EMBERS, EMBERS);
directVisuals.put(Terrain.PEDESTAL, PEDESTAL);
directVisuals.put(Terrain.BARRICADE, BARRICADE);
directVisuals.put(Terrain.EMPTY_SP, FLOOR_SP);
directVisuals.put(Terrain.HIGH_GRASS, HIGH_GRASS);
@ -296,7 +309,6 @@ public class DungeonTileSheet {
directVisuals.put(Terrain.WELL, WELL);
directVisuals.put(Terrain.STATUE, STATUE);
directVisuals.put(Terrain.STATUE_SP, STATUE_SP);
directVisuals.put(Terrain.BOOKSHELF, BOOKSHELF);
directVisuals.put(Terrain.ALCHEMY, ALCHEMY_POT);
}
@ -309,6 +321,8 @@ public class DungeonTileSheet {
directFlatVisuals.put(Terrain.OPEN_DOOR, FLAT_DOOR_OPEN);
directFlatVisuals.put(Terrain.LOCKED_DOOR, FLAT_DOOR_LOCKED);
directFlatVisuals.put(Terrain.WALL_DECO, FLAT_WALL_DECO);
directFlatVisuals.put(Terrain.BOOKSHELF, FLAT_BOOKSHELF);
directFlatVisuals.put(Terrain.BARRICADE, FLAT_BARRICADE);
directFlatVisuals.put(Terrain.SECRET_DOOR, directFlatVisuals.get(Terrain.WALL));
}
@ -331,19 +345,19 @@ public class DungeonTileSheet {
//These alt visuals will trigger 50% of the time (45% of the time if a rare alt is also present)
public static SparseIntArray commonAltVisuals = new SparseIntArray(32);
static {
commonAltVisuals.put(FLOOR, FLOOR_ALT_1);
commonAltVisuals.put(GRASS, GRASS_ALT);
commonAltVisuals.put(FLAT_WALL, FLAT_WALL_ALT);
commonAltVisuals.put(EMBERS, EMBERS_ALT);
commonAltVisuals.put(FLAT_WALL_DECO, FLAT_WALL_DECO_ALT);
commonAltVisuals.put(FLOOR_SP, FLOOR_SP_ALT);
commonAltVisuals.put(HIGH_GRASS, HIGH_GRASS_ALT);
commonAltVisuals.put(FLOOR_DECO, FLOOR_DECO_ALT);
commonAltVisuals.put(FLOOR, FLOOR_ALT_1);
commonAltVisuals.put(GRASS, GRASS_ALT);
commonAltVisuals.put(FLAT_WALL, FLAT_WALL_ALT);
commonAltVisuals.put(EMBERS, EMBERS_ALT);
commonAltVisuals.put(FLAT_WALL_DECO, FLAT_WALL_DECO_ALT);
commonAltVisuals.put(FLOOR_SP, FLOOR_SP_ALT);
commonAltVisuals.put(HIGH_GRASS, HIGH_GRASS_ALT);
commonAltVisuals.put(FLOOR_DECO, FLOOR_DECO_ALT);
commonAltVisuals.put(FLAT_BOOKSHELF, FLAT_BOOKSHELF_ALT);
commonAltVisuals.put(BOOKSHELF, BOOKSHELF_ALT);
commonAltVisuals.put(RAISED_WALL, RAISED_WALL_ALT);
commonAltVisuals.put(RAISED_WALL_DECO, RAISED_WALL_DECO_ALT);
commonAltVisuals.put(RAISED_WALL, RAISED_WALL_ALT);
commonAltVisuals.put(RAISED_WALL_DECO, RAISED_WALL_DECO_ALT);
commonAltVisuals.put(RAISED_WALL_BOOKSHELF, RAISED_WALL_BOOKSHELF_ALT);
}
//These alt visuals trigger 5% of the time (and also override common alts when they show up)

View File

@ -50,12 +50,13 @@ public class DungeonWallsTilemap extends DungeonTilemap {
return DungeonTileSheet.DOOR_SIDEWAYS;
} else if (map[pos + mapWidth] == Terrain.LOCKED_DOOR){
return DungeonTileSheet.DOOR_SIDEWAYS_LOCKED;
} else {
return -1;
} else if (map[pos + mapWidth] == Terrain.OPEN_DOOR){
return DungeonTileSheet.NULL_TILE;
}
} else {
return DungeonTileSheet.stitchInternalWallTile(
tile,
(pos+1) % mapWidth != 0 ? map[pos + 1] : -1,
(pos+1) % mapWidth != 0 && pos + mapWidth < size ? map[pos + 1 + mapWidth] : -1,
pos % mapWidth != 0 && pos + mapWidth < size ? map[pos - 1 + mapWidth] : -1,
@ -63,11 +64,14 @@ public class DungeonWallsTilemap extends DungeonTilemap {
);
}
} else if (Dungeon.level.insideMap(pos) && DungeonTileSheet.wallStitcheable.contains(map[pos+mapWidth])) {
}
if (Dungeon.level.insideMap(pos) && DungeonTileSheet.wallStitcheable.contains(map[pos+mapWidth])) {
return DungeonTileSheet.stitchWallOverhangTile(
tile,
map[pos + 1 + mapWidth],
map[pos + mapWidth],
map[pos - 1 + mapWidth]
);
@ -75,6 +79,8 @@ public class DungeonWallsTilemap extends DungeonTilemap {
return DungeonTileSheet.DOOR_OVERHANG;
} else if (Dungeon.level.insideMap(pos) && map[pos+mapWidth] == Terrain.OPEN_DOOR ) {
return DungeonTileSheet.DOOR_OVERHANG_OPEN;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.BARRICADE){
return DungeonTileSheet.BARRICADE_OVERHANG;
}
return -1;