DungeonMaker
Interface
(how programmers can use the program)
The following public functions of class DungeonMaker can be called from your
program:
DungeonMaker( unsigned int dimX , unsigned int dimY , bool cY ,
bool gW , int maxCrawlers , unsigned int MCW , int SRW , int CDS ,
int JL , int JD );
This is the constructor you call to get a Dungeonmaker object. The
meaning of the variables is:
dimX , dimY are the dimensions of the dungeon;
cY means "columnsYes", set it false if you want no columns;
gW means "generationalWalls", set it false if you want plain walls;
maxCrawlers means you get no more Crawlers than this at any one time;
MCW is the smallest corridorWidth that is legal;
SRW is the smallest room width that is legal;
CDS is the changeDirOnStraight parameter;
JL is the maxAge of all Jumpers;
JD is joinDist.
The last six parameters are normally read in from the constants-file,
and are explained here.
unsigned int ShowDimX(); and
unsigned int ShowDimY();
give the dungeon dimensions - these are the same values you entered in the constructor,
so you don't really need these.
int Initialize( char* filename );
initializes parameters from the rooms-file, returns 1 for success, 0 for failure;
int InitializeStats( char* filename );
initializes the parameters from the stats-file, returns 1 for success, 0 for failure;
int MakeMap( );
constructs the dungeon.
int WriteMap( int number );
call this only if you want to output a .txt-file.
unsigned int GetMap( unsigned int x , unsigned int y );
returns the values at that grid square. This is the function you
should use to initialize your own map-object. The meaning
of the return values is as follows:
0 = open space
1 = wall
2 = high wall
3 = open space where we want no walls made
4 = column
5 = guaranteed open space, for keys, NPC's and other scripted things
6 = wall that cannot be joined by a Crawler wall
3 - 9 are reserved for things that block walls from being put close to there, but that cannot be connected to by a wall
10 + x = wall built by generation x wallCrawler
All the parameters of the DungeonMaker constructor are usually
read from files, except for cY and gW (which will probably only be
variable during the design phase). If you want to read them from files, you can
use two helper functions which are not members of class DungeonMaker:
int ReadConstantsFile( int &maxC , unsigned int &MCW , int &SRW , int &CDS , int &JL , int &JD );
This function does nothing but read
the last six parameters of the DungeonMaker constructor from the
constants-file.
int ReadRoomsFile( char* fileName , int &dX , int &dY );
reads the first two parameters of the constructor from the
rooms-file fileName.
Both helper functions return 1 for success, 0 for failure. You can inspect the
main()-function to see how the helper functions and the constructor
can be called.