ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/room_gen_onion.C
(Generate patch)

Comparing deliantra/server/random_maps/room_gen_onion.C (file contents):
Revision 1.17 by root, Mon Oct 12 14:00:58 2009 UTC vs.
Revision 1.18 by root, Fri Nov 6 12:49:19 2009 UTC

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
59void centered_onion (char **maze, int xsize, int ysize, int option, int layers); 60static void centered_onion (char **maze, int xsize, int ysize, int option, int layers);
60void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers); 61static void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers);
61void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); 62static void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers);
62 63
63void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); 64static void draw_onion (char **maze, float *xlocations, float *ylocations, int layers);
64void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); 65static void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options);
65 66
66void 67void
67map_gen_onion (Layout maze, int option, int layers) 68map_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
112void 113static void
113centered_onion (char **maze, int xsize, int ysize, int option, int layers) 114centered_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
184void 185static void
185bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers) 186bottom_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 */
266void 267static void
267draw_onion (char **maze, float *xlocations, float *ylocations, int layers) 268draw_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
412void 413static void
413bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers) 414bottom_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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines