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

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.20 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.21 by root, Thu Jan 18 19:42:10 2007 UTC

76 } 76 }
77 else 77 else
78 RP->difficulty_given = 1; 78 RP->difficulty_given = 1;
79 79
80 if (RP->Xsize < MIN_RANDOM_MAP_SIZE) 80 if (RP->Xsize < MIN_RANDOM_MAP_SIZE)
81 RP->Xsize = MIN_RANDOM_MAP_SIZE + RANDOM () % 25 + 5; 81 RP->Xsize = MIN_RANDOM_MAP_SIZE + rndm (25) + 5;
82 82
83 if (RP->Ysize < MIN_RANDOM_MAP_SIZE) 83 if (RP->Ysize < MIN_RANDOM_MAP_SIZE)
84 RP->Ysize = MIN_RANDOM_MAP_SIZE + RANDOM () % 25 + 5; 84 RP->Ysize = MIN_RANDOM_MAP_SIZE + rndm (25) + 5;
85 85
86 if (RP->expand2x > 0) 86 if (RP->expand2x > 0)
87 { 87 {
88 RP->Xsize /= 2; 88 RP->Xsize /= 2;
89 RP->Ysize /= 2; 89 RP->Ysize /= 2;
99 RP->dungeon_level += 1; 99 RP->dungeon_level += 1;
100 /* allow constant-difficulty maps. */ 100 /* allow constant-difficulty maps. */
101 /* difficulty+=1; */ 101 /* difficulty+=1; */
102 102
103 /* rotate the layout randomly */ 103 /* rotate the layout randomly */
104 layout = rotate_layout (layout, RANDOM () % 4, RP); 104 layout = rotate_layout (layout, rndm (4), RP);
105#ifdef RMAP_DEBUG 105#ifdef RMAP_DEBUG
106 dump_layout (layout, RP); 106 dump_layout (layout, RP);
107#endif 107#endif
108 108
109 /* allocate the map and set the floor */ 109 /* allocate the map and set the floor */
195 RP->Ysize = RP->Ysize / 2 + 1; 195 RP->Ysize = RP->Ysize / 2 + 1;
196 if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) 196 if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY)
197 RP->Xsize = RP->Xsize / 2 + 1; 197 RP->Xsize = RP->Xsize / 2 + 1;
198 198
199 if (RP->Xsize < MIN_RANDOM_MAP_SIZE) 199 if (RP->Xsize < MIN_RANDOM_MAP_SIZE)
200 RP->Xsize = MIN_RANDOM_MAP_SIZE + RANDOM () % 5; 200 RP->Xsize = MIN_RANDOM_MAP_SIZE + rndm (5);
201 if (RP->Ysize < MIN_RANDOM_MAP_SIZE) 201 if (RP->Ysize < MIN_RANDOM_MAP_SIZE)
202 RP->Ysize = MIN_RANDOM_MAP_SIZE + RANDOM () % 5; 202 RP->Ysize = MIN_RANDOM_MAP_SIZE + rndm (5);
203 RP->map_layout_style = 0; 203 RP->map_layout_style = 0;
204 204
205 /* Redo this - there was a lot of redundant code of checking for preset 205 /* Redo this - there was a lot of redundant code of checking for preset
206 * layout style and then random layout style. Instead, figure out 206 * layout style and then random layout style. Instead, figure out
207 * the numeric layoutstyle, so there is only one area that actually 207 * the numeric layoutstyle, so there is only one area that actually
231 231
232 switch (RP->map_layout_style) 232 switch (RP->map_layout_style)
233 { 233 {
234 case LAYOUT_ONION: 234 case LAYOUT_ONION:
235 maze = map_gen_onion (RP->Xsize, RP->Ysize, RP->layoutoptions1, RP->layoutoptions2); 235 maze = map_gen_onion (RP->Xsize, RP->Ysize, RP->layoutoptions1, RP->layoutoptions2);
236 if (!(RANDOM () % 3) && !(RP->layoutoptions1 & RMOPT_WALLS_ONLY)) 236 if (!(rndm (3)) && !(RP->layoutoptions1 & RMOPT_WALLS_ONLY))
237 roomify_layout (maze, RP); 237 roomify_layout (maze, RP);
238 break; 238 break;
239 239
240 case LAYOUT_MAZE: 240 case LAYOUT_MAZE:
241 maze = maze_gen (RP->Xsize, RP->Ysize, RANDOM () % 2); 241 maze = maze_gen (RP->Xsize, RP->Ysize, rndm (2));
242 if (!(RANDOM () % 2)) 242 if (!(rndm (2)))
243 doorify_layout (maze, RP); 243 doorify_layout (maze, RP);
244 break; 244 break;
245 245
246 case LAYOUT_SPIRAL: 246 case LAYOUT_SPIRAL:
247 maze = map_gen_spiral (RP->Xsize, RP->Ysize, RP->layoutoptions1); 247 maze = map_gen_spiral (RP->Xsize, RP->Ysize, RP->layoutoptions1);
248 if (!(RANDOM () % 2)) 248 if (!(rndm (2)))
249 doorify_layout (maze, RP); 249 doorify_layout (maze, RP);
250 break; 250 break;
251 251
252 case LAYOUT_ROGUELIKE: 252 case LAYOUT_ROGUELIKE:
253 /* Don't put symmetry in rogue maps. There isn't much reason to 253 /* Don't put symmetry in rogue maps. There isn't much reason to
264 /* no doorifying... done already */ 264 /* no doorifying... done already */
265 break; 265 break;
266 266
267 case LAYOUT_SNAKE: 267 case LAYOUT_SNAKE:
268 maze = make_snake_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1); 268 maze = make_snake_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1);
269 if (RANDOM () % 2) 269 if (rndm (2))
270 roomify_layout (maze, RP); 270 roomify_layout (maze, RP);
271 break; 271 break;
272 272
273 case LAYOUT_SQUARE_SPIRAL: 273 case LAYOUT_SQUARE_SPIRAL:
274 maze = make_square_spiral_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1); 274 maze = make_square_spiral_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1);
275 if (RANDOM () % 2) 275 if (rndm (2))
276 roomify_layout (maze, RP); 276 roomify_layout (maze, RP);
277 break; 277 break;
278 } 278 }
279 279
280 maze = symmetrize_layout (maze, RP->symmetry_used, RP); 280 maze = symmetrize_layout (maze, RP->symmetry_used, RP);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines