| 1 |
#include <stdio.h> |
| 2 |
#include <global.h> |
| 3 |
#include <expand2x.h> |
| 4 |
|
| 5 |
/* this is a testing program for layouts. It's |
| 6 |
included here for convenience only. */ |
| 7 |
char **map_gen_spiral (int, int, int); |
| 8 |
char **roguelike_layout_gen (int xsize, int ysize, int options); |
| 9 |
char **make_snake_layout (int xsize, int ysize, int options); |
| 10 |
char **make_square_spiral_layout (int xsize, int ysize, int options); |
| 11 |
char **gen_corridor_rooms (int, int, int); |
| 12 |
|
| 13 |
void |
| 14 |
dump_layout (char **layout, int Xsize, int Ysize) |
| 15 |
{ |
| 16 |
int i, j; |
| 17 |
|
| 18 |
for (j = 0; j < Ysize; j++) |
| 19 |
{ |
| 20 |
for (i = 0; i < Xsize; i++) |
| 21 |
{ |
| 22 |
if (layout[i][j] == 0) |
| 23 |
layout[i][j] = ' '; |
| 24 |
printf ("%c", layout[i][j]); |
| 25 |
} |
| 26 |
printf ("\n"); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
main () |
| 31 |
{ |
| 32 |
int Xsize, Ysize; |
| 33 |
char **layout, **biglayout; |
| 34 |
|
| 35 |
SRANDOM (time (0)); |
| 36 |
|
| 37 |
Xsize = rndm (30) + 10; |
| 38 |
Ysize = rndm (20) + 10; |
| 39 |
|
| 40 |
|
| 41 |
/* put your layout here */ |
| 42 |
layout = roguelike_layout_gen (Xsize, Ysize, 0); |
| 43 |
/*layout = make_snake_layout(Xsize,Ysize,0); */ |
| 44 |
/*layout = make_square_spiral_layout(Xsize,Ysize,0); */ |
| 45 |
/*layout = gen_corridor_rooms(Xsize, Ysize, 1); */ |
| 46 |
/*layout = maze_gen(Xsize,Ysize,0); */ |
| 47 |
/*layout = map_gen_onion(Xsize,Ysize,0,0); */ |
| 48 |
|
| 49 |
dump_layout (layout, Xsize, Ysize); |
| 50 |
printf ("\nExpanding layout...\n"); |
| 51 |
|
| 52 |
biglayout = expand2x (layout, Xsize, Ysize); |
| 53 |
dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1); |
| 54 |
} |