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