version 1.30 | | version 1.31 |
---|
| | |
/* | | /* |
* static char *rcsid_random_map_c = | | * static char *rcsid_random_map_c = |
* "$Id: random_map.c,v 1.30 2003/02/21 03:55:38 mwedel Exp $"; | | * "$Id: random_map.c,v 1.31 2003/03/03 05:13:08 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
layout = layoutgen(RP); | | layout = layoutgen(RP); |
| | |
| | #ifdef RMAP_DEBUG |
| | dump_layout(layout,RP); |
| | #endif |
| | |
/* increment these for the current map */ | | /* increment these for the current map */ |
RP->dungeon_level+=1; | | RP->dungeon_level+=1; |
/* allow constant-difficulty maps. */ | | /* allow constant-difficulty maps. */ |
| | |
if(RP->Xsize<15) RP->Xsize = 15 + RANDOM()%25; | | if(RP->Xsize<15) RP->Xsize = 15 + RANDOM()%25; |
if(RP->Ysize<15) RP->Ysize = 15 + RANDOM()%25; | | if(RP->Ysize<15) RP->Ysize = 15 + RANDOM()%25; |
} | | } |
else | | else { |
{ | | /* Has to be at least 10 for square spirals to work */ |
/* Has to be at least 7 for square spirals to work */ | | if(RP->Xsize<10) RP->Xsize = 10 + RANDOM()%25; |
if(RP->Xsize<7) RP->Xsize = 15 + RANDOM()%25; | | if(RP->Ysize<10) RP->Ysize = 10 + RANDOM()%25; |
if(RP->Ysize<7) RP->Ysize = 15 + RANDOM()%25; | | |
} | | } |
| | |
if(RP->symmetry == RANDOM_SYM) { | | if(RP->symmetry == RANDOM_SYM) { |
| | |
maze = make_snake_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = make_snake_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = SNAKE_LAYOUT; | | RP->map_layout_style = SNAKE_LAYOUT; |
if(RANDOM()%2) roomify_layout(maze,RP); | | if(RANDOM()%2) roomify_layout(maze,RP); |
| | |
} | | } |
| | |
if(strstr(RP->layoutstyle,"squarespiral")) { | | if(strstr(RP->layoutstyle,"squarespiral")) { |
maze = make_square_spiral_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = make_square_spiral_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = SQUARE_SPIRAL_LAYOUT; | | RP->map_layout_style = SQUARE_SPIRAL_LAYOUT; |
if(RANDOM()%2) roomify_layout(maze,RP); | | if(RANDOM()%2) roomify_layout(maze,RP); |
| | |
} | | } |
| | |
if(maze == 0) /* unknown or unspecified layout type, pick one at random */ | | /* unknown or unspecified layout type, pick one at random */ |
| | if(maze == 0) |
switch(RANDOM()%NROFLAYOUTS) { | | switch(RANDOM()%NROFLAYOUTS) { |
case 0: | | case 0: |
maze = maze_gen(RP->Xsize,RP->Ysize,RANDOM()%2); | | maze = maze_gen(RP->Xsize,RP->Ysize,RANDOM()%2); |
RP->map_layout_style = MAZE_LAYOUT; | | RP->map_layout_style = MAZE_LAYOUT; |
if(!(RANDOM()%2)) doorify_layout(maze,RP); | | if(!(RANDOM()%2)) doorify_layout(maze,RP); |
break; | | break; |
| | |
case 1: | | case 1: |
maze = map_gen_onion(RP->Xsize,RP->Ysize,RP->layoutoptions1,RP->layoutoptions2); | | maze = map_gen_onion(RP->Xsize,RP->Ysize,RP->layoutoptions1,RP->layoutoptions2); |
RP->map_layout_style = ONION_LAYOUT; | | RP->map_layout_style = ONION_LAYOUT; |
if(!(RANDOM()%3)&& !(RP->layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze,RP); | | if(!(RANDOM()%3)&& !(RP->layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze,RP); |
break; | | break; |
| | |
case 2: | | case 2: |
maze = map_gen_spiral(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = map_gen_spiral(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = SPIRAL_LAYOUT; | | RP->map_layout_style = SPIRAL_LAYOUT; |
if(!(RANDOM()%2)) doorify_layout(maze,RP); | | if(!(RANDOM()%2)) doorify_layout(maze,RP); |
break; | | break; |
| | |
case 3: | | case 3: |
maze = roguelike_layout_gen(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = roguelike_layout_gen(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = ROGUELIKE_LAYOUT; | | RP->map_layout_style = ROGUELIKE_LAYOUT; |
/* no doorifying... done already */ | | /* no doorifying... done already */ |
break; | | break; |
| | |
case 4: | | case 4: |
maze = make_snake_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = make_snake_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = SNAKE_LAYOUT; | | RP->map_layout_style = SNAKE_LAYOUT; |
if(RANDOM()%2) roomify_layout(maze,RP); | | if(RANDOM()%2) roomify_layout(maze,RP); |
break; | | break; |
| | |
case 5: | | case 5: |
maze = make_square_spiral_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); | | maze = make_square_spiral_layout(RP->Xsize,RP->Ysize,RP->layoutoptions1); |
RP->map_layout_style = SQUARE_SPIRAL_LAYOUT; | | RP->map_layout_style = SQUARE_SPIRAL_LAYOUT; |
| | |
break; | | break; |
} | | } |
| | |
| | |
| | |
| | |
maze = symmetrize_layout(maze, RP->symmetry_used,RP); | | maze = symmetrize_layout(maze, RP->symmetry_used,RP); |
#ifdef RMAP_DEBUG | | #ifdef RMAP_DEBUG |
dump_layout(maze,RP); | | dump_layout(maze,RP); |