… | |
… | |
54 | #include <random_map.h> |
54 | #include <random_map.h> |
55 | |
55 | |
56 | #ifndef MIN |
56 | #ifndef MIN |
57 | # define MIN(x,y) (((x)<(y))? (x):(y)) |
57 | # define MIN(x,y) (((x)<(y))? (x):(y)) |
58 | #endif |
58 | #endif |
|
|
59 | |
59 | void centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
60 | static void centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
60 | void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
61 | static void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
61 | void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
62 | static void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); |
62 | |
63 | |
63 | void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); |
64 | static void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); |
64 | void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); |
65 | static void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); |
65 | |
66 | |
66 | void |
67 | void |
67 | map_gen_onion (Layout maze, int option, int layers) |
68 | map_gen_onion (Layout maze, int option, int layers) |
68 | { |
69 | { |
69 | int i, j; |
70 | int i, j; |
… | |
… | |
107 | bottom_centered_onion (maze, xsize, ysize, option, layers); |
108 | bottom_centered_onion (maze, xsize, ysize, option, layers); |
108 | else if (option & RMOPT_CENTERED) |
109 | else if (option & RMOPT_CENTERED) |
109 | centered_onion (maze, xsize, ysize, option, layers); |
110 | centered_onion (maze, xsize, ysize, option, layers); |
110 | } |
111 | } |
111 | |
112 | |
112 | void |
113 | static void |
113 | centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
114 | centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
114 | { |
115 | { |
115 | int i, maxlayers; |
116 | int i, maxlayers; |
116 | |
117 | |
117 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |
118 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |
… | |
… | |
179 | |
180 | |
180 | sfree (xlocations, 2 * layers); |
181 | sfree (xlocations, 2 * layers); |
181 | sfree (ylocations, 2 * layers); |
182 | sfree (ylocations, 2 * layers); |
182 | } |
183 | } |
183 | |
184 | |
184 | void |
185 | static void |
185 | bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
186 | bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
186 | { |
187 | { |
187 | int i, maxlayers; |
188 | int i, maxlayers; |
188 | |
189 | |
189 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |
190 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |
… | |
… | |
260 | |
261 | |
261 | sfree (xlocations, 2 * layers); |
262 | sfree (xlocations, 2 * layers); |
262 | sfree (ylocations, 2 * layers); |
263 | sfree (ylocations, 2 * layers); |
263 | } |
264 | } |
264 | |
265 | |
265 | /* draw_boxes: draws the lines in the maze defining the onion layers */ |
266 | /* draw_boxes: draws the lines in the maze defining the onion layers */ |
266 | void |
267 | static void |
267 | draw_onion (char **maze, float *xlocations, float *ylocations, int layers) |
268 | draw_onion (char **maze, float *xlocations, float *ylocations, int layers) |
268 | { |
269 | { |
269 | int i, j, l; |
270 | int i, j, l; |
270 | |
271 | |
271 | for (l = 0; l < layers; l++) |
272 | for (l = 0; l < layers; l++) |
… | |
… | |
407 | y1 = (int) (ylocations[l] + ylocations[2 * layers - l - 1]) / 2; |
408 | y1 = (int) (ylocations[l] + ylocations[2 * layers - l - 1]) / 2; |
408 | |
409 | |
409 | maze[x1][y1] = 'C'; |
410 | maze[x1][y1] = 'C'; |
410 | } |
411 | } |
411 | |
412 | |
412 | void |
413 | static void |
413 | bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
414 | bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
414 | { |
415 | { |
415 | int i, maxlayers; |
416 | int i, maxlayers; |
416 | |
417 | |
417 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |
418 | maxlayers = (MIN (xsize, ysize) - 2) / 5; |