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

Comparing deliantra/server/random_maps/room_gen_spiral.C (file contents):
Revision 1.12 by root, Fri Apr 11 21:09:53 2008 UTC vs.
Revision 1.13 by root, Mon Apr 14 22:41:17 2008 UTC

49 49
50#define MAX_FINE .454545 50#define MAX_FINE .454545
51 51
52extern int surround_check (char **maze, int i, int j, int xsize, int ysize); 52extern int surround_check (char **maze, int i, int j, int xsize, int ysize);
53 53
54Maze 54void
55map_gen_spiral (int xsize, int ysize, int option) 55map_gen_spiral (Maze maze, int option)
56{ 56{
57 int i, j; 57 int i, j;
58 float parm = 0; 58 float parm = 0;
59 float x = 0, y = 0; 59 float x = 0, y = 0;
60 int ic, jc; 60 int ic, jc;
61 float SizeX, SizeY; 61 float SizeX, SizeY;
62 float xscale, yscale; 62 float xscale, yscale;
63 63
64 Maze maze (xsize, ysize);
65
66 /* slightly easier to fill and then cut */ 64 /* slightly easier to fill and then cut */
67 for (i = 0; i < xsize; i++) 65 maze->clear ('#');
68 for (j = 0; j < ysize; j++) 66
69 maze[i][j] = '#'; 67 int xsize = maze->w;
68 int ysize = maze->h;
70 69
71 ic = xsize / 2; 70 ic = xsize / 2;
72 jc = ysize / 2; 71 jc = ysize / 2;
73 SizeX = xsize / 2 - 2; 72 SizeX = xsize / 2 - 2;
74 SizeY = ysize / 2 - 2; 73 SizeY = ysize / 2 - 2;
120 { 119 {
121 x = parm * cos (parm) * xscale; 120 x = parm * cos (parm) * xscale;
122 y = parm * sin (parm) * yscale; 121 y = parm * sin (parm) * yscale;
123 maze[int (ic + x)][int (jc + y)] = '\0'; 122 maze[int (ic + x)][int (jc + y)] = '\0';
124 parm += 0.01; 123 parm += 0.01;
125 }; 124 }
126 125
127 maze[int (ic + x + 0.5)][int (jc + y + 0.5)] = '<'; 126 maze[int (ic + x + 0.5)][int (jc + y + 0.5)] = '<';
128 127
129 /* cut out the center in a 2x2 and place the center and downexit */ 128 /* cut out the center in a 2x2 and place the center and downexit */
130 maze[ic][jc + 1] = '>'; 129 maze[ic][jc + 1] = '>';
131 maze[ic][jc] = 'C'; 130 maze[ic][jc] = 'C';
132
133 return maze;
134} 131}
135 132
136/* the following function connects disjoint spirals which may 133/* the following function connects disjoint spirals which may
137 result from the symmetrization process. */ 134 result from the symmetrization process. */
138void 135void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines