public class MixedGenerator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MixedGenerator.CarverType |
Modifier and Type | Field and Description |
---|---|
protected EnumMap<MixedGenerator.CarverType,Integer> |
carvers |
static int |
CAVE_FLOOR
Constant for environment tiles that are floors for a cave.
|
static int |
CAVE_WALL
Constant for environment tiles that are walls near a cave.
|
static int |
CORRIDOR_FLOOR
Constant for environment tiles that are floors for a corridor.
|
static int |
CORRIDOR_WALL
Constant for environment tiles that are walls near a corridor.
|
protected char[][] |
dungeon |
protected int[][] |
environment |
protected boolean[][] |
fixedRooms |
protected boolean |
generated |
protected int |
height |
protected boolean[][] |
marked |
protected List<Long> |
points |
RNG |
rng |
static int |
ROOM_FLOOR
Constant for environment tiles that are floors for a room.
|
static int |
ROOM_WALL
Constant for environment tiles that are walls near a room.
|
protected float |
roomHeight |
protected float |
roomWidth |
protected int |
totalPoints |
static int |
UNTOUCHED
Constant for environment tiles that are not near a cave, room, or corridor.
|
protected boolean[][] |
walled |
protected int |
width |
Constructor and Description |
---|
MixedGenerator(int width,
int height,
RNG rng)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.
|
MixedGenerator(int width,
int height,
RNG rng,
LinkedHashMap<Coord,List<Coord>> connections)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.
|
MixedGenerator(int width,
int height,
RNG rng,
LinkedHashMap<Coord,List<Coord>> connections,
float roomSizeMultiplier)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.
|
MixedGenerator(int width,
int height,
RNG rng,
List<Coord> sequence)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.
|
Modifier and Type | Method and Description |
---|---|
protected static List<Coord> |
basicPoints(int width,
int height,
RNG rng)
Internal use.
|
char[][] |
generate()
Uses the added carvers (or just makes caves if none were added) to carve from point to point in sequence, if it
was provided by the constructor, or evenly-spaced randomized points if it was not.
|
int[][] |
getEnvironment() |
boolean[][] |
getFixedRooms() |
boolean |
hasGenerated() |
protected boolean |
mark(Coord pos)
Internal use.
|
protected boolean |
mark(int x,
int y)
Internal use.
|
protected void |
markEnvironment(int x,
int y,
int kind)
Internal use.
|
protected void |
markEnvironmentCave(int x,
int y)
Internal use.
|
protected void |
markEnvironmentCorridor(int x,
int y)
Internal use.
|
protected void |
markEnvironmentRoom(int x,
int y)
Internal use.
|
protected void |
markEnvironmentWalls()
Internal use.
|
protected void |
markPiercing(Coord pos)
Internal use.
|
protected void |
markPiercing(int x,
int y)
Internal use.
|
protected void |
markPiercingCave(Coord pos)
Internal use.
|
protected void |
markPiercingRoom(int x,
int y)
Internal use.
|
void |
putBoxRoomCarvers(int count)
Changes the number of "carvers" that will create right-angle corridors from one room to the next, create rooms
with a random size in a box shape at the start and end, and a small room at the corner if there is one.
|
void |
putCaveCarvers(int count)
Changes the number of "carvers" that will create caves from one room to the next.
|
void |
putRoundRoomCarvers(int count)
Changes the number of "carvers" that will create right-angle corridors from one room to the next, create rooms
with a random size in a circle shape at the start and end, and a small circular room at the corner if there is
one.
|
void |
putWalledBoxRoomCarvers(int count)
Changes the number of "carvers" that will create right-angle corridors from one room to the next, create rooms
with a random size in a box shape at the start and end, and a small room at the corner if there is one, enforcing
the presence of walls around the rooms even if another room is already there or would be placed there.
|
void |
putWalledRoundRoomCarvers(int count)
Changes the number of "carvers" that will create right-angle corridors from one room to the next, create rooms
with a random size in a circle shape at the start and end, and a small circular room at the corner if there is
one, enforcing the presence of walls around the rooms even if another room is already there or would be placed
there.
|
void |
setFixedRooms(boolean[][] fixedRooms) |
protected void |
store()
Internal use.
|
protected void |
wallOff(int x,
int y)
Internal use.
|
public static final int UNTOUCHED
public static final int ROOM_FLOOR
public static final int ROOM_WALL
public static final int CAVE_FLOOR
public static final int CAVE_WALL
public static final int CORRIDOR_FLOOR
public static final int CORRIDOR_WALL
protected EnumMap<MixedGenerator.CarverType,Integer> carvers
protected int width
protected int height
protected float roomWidth
protected float roomHeight
protected char[][] dungeon
protected boolean generated
protected int[][] environment
protected boolean[][] marked
protected boolean[][] walled
protected boolean[][] fixedRooms
protected int totalPoints
public MixedGenerator(int width, int height, RNG rng)
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.used to ensure spacing for the points.
public MixedGenerator(int width, int height, RNG rng, List<Coord> sequence)
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.sequence
- a List of Coord to connect in order; index 0 is the start, index size() - 1 is the end.a class that uses this technique
public MixedGenerator(int width, int height, RNG rng, LinkedHashMap<Coord,List<Coord>> connections)
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.connections
- a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both waysa class that uses this technique
public MixedGenerator(int width, int height, RNG rng, LinkedHashMap<Coord,List<Coord>> connections, float roomSizeMultiplier)
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.connections
- a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both waysroomSizeMultiplier
- a float multiplier that will be applied to each room's width and heighta class that uses this technique
protected static List<Coord> basicPoints(int width, int height, RNG rng)
width
- dungeon width in cellsheight
- dungeon height in cellsrng
- rng to useused to make the list
public void putCaveCarvers(int count)
count
- the number of carvers making caves between rooms; only matters in relation to other carverspublic void putBoxRoomCarvers(int count)
count
- the number of carvers making box-shaped rooms and corridors between them; only matters in relation
to other carverspublic void putRoundRoomCarvers(int count)
count
- the number of carvers making circular rooms and corridors between them; only matters in relation
to other carverspublic void putWalledBoxRoomCarvers(int count)
count
- the number of carvers making box-shaped rooms and corridors between them; only matters in relation
to other carverspublic void putWalledRoundRoomCarvers(int count)
count
- the number of carvers making circular rooms and corridors between them; only matters in relation
to other carverspublic char[][] generate()
public int[][] getEnvironment()
public boolean hasGenerated()
public boolean[][] getFixedRooms()
public void setFixedRooms(boolean[][] fixedRooms)
protected void store()
protected void markEnvironmentWalls()
protected boolean mark(int x, int y)
x
- x position to marky
- y position to markprotected void markPiercing(int x, int y)
x
- x position to marky
- y position to markprotected void markEnvironment(int x, int y, int kind)
x
- x position to marky
- y position to markkind
- an int that should be one of the constants in MixedGenerator for environment types.protected void markEnvironmentCorridor(int x, int y)
x
- x position to marky
- y position to markprotected void markEnvironmentRoom(int x, int y)
x
- x position to marky
- y position to markprotected void markEnvironmentCave(int x, int y)
x
- x position to marky
- y position to markprotected void wallOff(int x, int y)
x
- x position to marky
- y position to markprotected boolean mark(Coord pos)
pos
- position to markprotected void markPiercing(Coord pos)
pos
- position to markprotected void markPiercingCave(Coord pos)
pos
- position to markprotected void markPiercingRoom(int x, int y)
x
- x coordinate of position to marky
- y coordinate of position to markCopyright © 2012–2016. All rights reserved.