… | |
… | |
60 | void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
60 | void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
61 | |
61 | |
62 | void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); |
62 | void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); |
63 | void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); |
63 | void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); |
64 | |
64 | |
65 | Maze |
65 | void |
66 | map_gen_onion (int xsize, int ysize, int option, int layers) |
66 | map_gen_onion (Maze maze, int option, int layers) |
67 | { |
67 | { |
68 | int i, j; |
68 | int i, j; |
69 | |
69 | |
70 | Maze maze (xsize, ysize); |
70 | int xsize = maze->w; |
|
|
71 | int ysize = maze->h; |
|
|
72 | |
|
|
73 | maze->clear (); |
71 | |
74 | |
72 | /* pick some random options if option = 0 */ |
75 | /* pick some random options if option = 0 */ |
73 | if (option == 0) |
76 | if (option == 0) |
74 | { |
77 | { |
75 | switch (rndm (3)) |
78 | switch (rndm (3)) |
… | |
… | |
89 | if (rndm (2)) option |= RMOPT_IRR_SPACE; |
92 | if (rndm (2)) option |= RMOPT_IRR_SPACE; |
90 | } |
93 | } |
91 | |
94 | |
92 | /* write the outer walls, if appropriate. */ |
95 | /* write the outer walls, if appropriate. */ |
93 | if (!(option & RMOPT_WALL_OFF)) |
96 | if (!(option & RMOPT_WALL_OFF)) |
94 | { |
97 | maze->border (); |
95 | for (i = 0; i < xsize; i++) maze[i][0] = maze[i][ysize - 1] = '#'; |
|
|
96 | for (j = 0; j < ysize; j++) maze[0][j] = maze[xsize - 1][j] = '#'; |
|
|
97 | }; |
|
|
98 | |
98 | |
99 | if (option & RMOPT_WALLS_ONLY) |
99 | if (option & RMOPT_WALLS_ONLY) |
100 | return maze; |
100 | return; |
101 | |
101 | |
102 | /* pick off the mutually exclusive options */ |
102 | /* pick off the mutually exclusive options */ |
103 | if (option & RMOPT_BOTTOM_R) |
103 | if (option & RMOPT_BOTTOM_R) |
104 | bottom_right_centered_onion (maze, xsize, ysize, option, layers); |
104 | bottom_right_centered_onion (maze, xsize, ysize, option, layers); |
105 | else if (option & RMOPT_BOTTOM_C) |
105 | else if (option & RMOPT_BOTTOM_C) |
106 | bottom_centered_onion (maze, xsize, ysize, option, layers); |
106 | bottom_centered_onion (maze, xsize, ysize, option, layers); |
107 | else if (option & RMOPT_CENTERED) |
107 | else if (option & RMOPT_CENTERED) |
108 | centered_onion (maze, xsize, ysize, option, layers); |
108 | centered_onion (maze, xsize, ysize, option, layers); |
109 | |
|
|
110 | return maze; |
|
|
111 | } |
109 | } |
112 | |
110 | |
113 | void |
111 | void |
114 | centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
112 | centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
115 | { |
113 | { |