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