… | |
… | |
109 | |
109 | |
110 | /* randomly returns one of the elements from the wall point list */ |
110 | /* randomly returns one of the elements from the wall point list */ |
111 | void |
111 | void |
112 | pop_wall_point (int *x, int *y) |
112 | pop_wall_point (int *x, int *y) |
113 | { |
113 | { |
114 | int index = rndm (wall_free_size); |
114 | int index = rmg_rndm (wall_free_size); |
115 | |
115 | |
116 | *x = wall_x_list[index]; |
116 | *x = wall_x_list[index]; |
117 | *y = wall_y_list[index]; |
117 | *y = wall_y_list[index]; |
118 | /* write the last array point here */ |
118 | /* write the last array point here */ |
119 | wall_x_list[index] = wall_x_list[wall_free_size - 1]; |
119 | wall_x_list[index] = wall_x_list[wall_free_size - 1]; |
… | |
… | |
191 | if (count == 0) |
191 | if (count == 0) |
192 | return -1; /* failed to find any clear points */ |
192 | return -1; /* failed to find any clear points */ |
193 | |
193 | |
194 | /* choose a random direction */ |
194 | /* choose a random direction */ |
195 | if (count > 1) |
195 | if (count > 1) |
196 | count = rndm (count); |
196 | count = rmg_rndm (count); |
197 | else |
197 | else |
198 | count = 0; |
198 | count = 0; |
199 | |
199 | |
200 | switch (dirlist[count]) |
200 | switch (dirlist[count]) |
201 | { |
201 | { |
… | |
… | |
239 | |
239 | |
240 | /* write a wall here */ |
240 | /* write a wall here */ |
241 | maze[x][y] = '#'; |
241 | maze[x][y] = '#'; |
242 | |
242 | |
243 | /* decide if we're going to pick from the wall_free_list */ |
243 | /* decide if we're going to pick from the wall_free_list */ |
244 | if (rndm (4) && wall_free_size > 0) |
244 | if (rmg_rndm (4) && wall_free_size > 0) |
245 | { |
245 | { |
246 | pop_wall_point (&xc, &yc); |
246 | pop_wall_point (&xc, &yc); |
247 | fill_maze_full (maze, xc, yc, xsize, ysize); |
247 | fill_maze_full (maze, xc, yc, xsize, ysize); |
248 | } |
248 | } |
249 | |
249 | |
… | |
… | |
263 | |
263 | |
264 | /* write a wall here */ |
264 | /* write a wall here */ |
265 | maze[x][y] = '#'; |
265 | maze[x][y] = '#'; |
266 | |
266 | |
267 | /* decide if we're going to pick from the wall_free_list */ |
267 | /* decide if we're going to pick from the wall_free_list */ |
268 | if (rndm (4) && wall_free_size > 0) |
268 | if (rmg_rndm (4) && wall_free_size > 0) |
269 | { |
269 | { |
270 | pop_wall_point (&xc, &yc); |
270 | pop_wall_point (&xc, &yc); |
271 | fill_maze_sparse (maze, xc, yc, xsize, ysize); |
271 | fill_maze_sparse (maze, xc, yc, xsize, ysize); |
272 | } |
272 | } |
273 | |
273 | |