| 1 |
elmex |
1.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 |
root |
1.6 |
Layout map_gen_spiral (int, int, int); |
| 8 |
|
|
Layout roguelike_layout_gen (int xsize, int ysize, int options); |
| 9 |
|
|
Layout make_snake_layout (int xsize, int ysize, int options); |
| 10 |
|
|
Layout make_square_spiral_layout (int xsize, int ysize, int options); |
| 11 |
|
|
Layout gen_corridor_rooms (int, int, int); |
| 12 |
root |
1.2 |
|
| 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 |
elmex |
1.1 |
} |
| 28 |
|
|
} |
| 29 |
|
|
|
| 30 |
root |
1.2 |
main () |
| 31 |
|
|
{ |
| 32 |
elmex |
1.1 |
int Xsize, Ysize; |
| 33 |
|
|
char **layout, **biglayout; |
| 34 |
|
|
|
| 35 |
root |
1.2 |
SRANDOM (time (0)); |
| 36 |
|
|
|
| 37 |
root |
1.7 |
Xsize = rmg_rndm (30) + 10; |
| 38 |
|
|
Ysize = rmg_rndm (20) + 10; |
| 39 |
elmex |
1.1 |
|
| 40 |
|
|
|
| 41 |
|
|
/* put your layout here */ |
| 42 |
root |
1.2 |
layout = roguelike_layout_gen (Xsize, Ysize, 0); |
| 43 |
elmex |
1.1 |
/*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 |
root |
1.2 |
/*layout = map_gen_onion(Xsize,Ysize,0,0); */ |
| 48 |
elmex |
1.1 |
|
| 49 |
root |
1.2 |
dump_layout (layout, Xsize, Ysize); |
| 50 |
|
|
printf ("\nExpanding layout...\n"); |
| 51 |
elmex |
1.1 |
|
| 52 |
root |
1.2 |
biglayout = expand2x (layout, Xsize, Ysize); |
| 53 |
|
|
dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1); |
| 54 |
elmex |
1.1 |
} |