… | |
… | |
28 | |
28 | |
29 | |
29 | |
30 | /* find a character in the layout. fx and fy are pointers to |
30 | /* find a character in the layout. fx and fy are pointers to |
31 | where to find the char. fx,fy = -1 if not found. */ |
31 | where to find the char. fx,fy = -1 if not found. */ |
32 | void |
32 | void |
33 | find_in_layout (int mode, char target, int *fx, int *fy, char **layout, RMParms * RP) |
33 | find_in_layout (int mode, char target, int *fx, int *fy, char **layout, random_map_params * RP) |
34 | { |
34 | { |
35 | int M; |
35 | int M; |
36 | int i, j; |
36 | int i, j; |
37 | |
37 | |
38 | *fx = -1; |
38 | *fx = -1; |
… | |
… | |
106 | break; |
106 | break; |
107 | } |
107 | } |
108 | } |
108 | } |
109 | } |
109 | } |
110 | |
110 | |
111 | |
|
|
112 | |
|
|
113 | |
|
|
114 | |
|
|
115 | |
|
|
116 | /* orientation: 0 means random, |
111 | /* orientation: 0 means random, |
117 | 1 means descending dungeon |
112 | 1 means descending dungeon |
118 | 2 means ascending dungeon |
113 | 2 means ascending dungeon |
119 | 3 means rightward |
114 | 3 means rightward |
120 | 4 means leftward |
115 | 4 means leftward |
121 | 5 means northward |
116 | 5 means northward |
122 | 6 means southward |
117 | 6 means southward |
123 | */ |
118 | */ |
124 | |
|
|
125 | void |
119 | void |
126 | place_exits (maptile *map, char **maze, char *exitstyle, int orientation, RMParms * RP) |
120 | place_exits (maptile *map, char **maze, char *exitstyle, int orientation, random_map_params *RP) |
127 | { |
121 | { |
128 | char styledirname[256]; |
122 | char styledirname[256]; |
129 | maptile *style_map_down = 0; /* harder maze */ |
123 | maptile *style_map_down = 0; /* harder maze */ |
130 | maptile *style_map_up = 0; /* easier maze */ |
124 | maptile *style_map_up = 0; /* easier maze */ |
131 | object *the_exit_down; /* harder maze */ |
125 | object *the_exit_down; /* harder maze */ |
… | |
… | |
331 | /* give the final map a name */ |
325 | /* give the final map a name */ |
332 | sprintf (new_map_name, "%sfinal_map", RP->final_map); |
326 | sprintf (new_map_name, "%sfinal_map", RP->final_map); |
333 | /* set the exit down. */ |
327 | /* set the exit down. */ |
334 | #endif |
328 | #endif |
335 | /* load it */ |
329 | /* load it */ |
336 | if ((new_map = ready_map_name (RP->final_map, 0)) == NULL) |
330 | if (!(new_map = maptile::find_map (RP->final_map, 0))) |
337 | return; |
331 | return; |
338 | |
332 | |
|
|
333 | new_map->load (); |
|
|
334 | |
339 | the_exit_down->slaying = RP->final_map; |
335 | the_exit_down->slaying = RP->final_map; |
340 | strcpy (new_map->path, RP->final_map); |
|
|
341 | |
336 | |
342 | for (tmp = GET_MAP_OB (new_map, new_map->enter_x, new_map->enter_y); tmp; tmp = tmp->above) |
337 | for (tmp = new_map->at (new_map->enter_x, new_map->enter_y).bot; tmp; tmp = tmp->above) |
343 | /* Remove exit back to previous random map. There should only be one |
338 | /* Remove exit back to previous random map. There should only be one |
344 | * which is why we break out. To try to process more than one |
339 | * which is why we break out. To try to process more than one |
345 | * would require keeping a 'next' pointer, ad free_object kills tmp, which |
340 | * would require keeping a 'next' pointer, ad free_object kills tmp, which |
346 | * breaks the for loop. |
341 | * breaks the for loop. |
347 | */ |
342 | */ |
348 | if (tmp->type == EXIT && EXIT_PATH (tmp) && !strncmp (EXIT_PATH (tmp), "/random/", 8)) |
343 | if (tmp->type == EXIT && EXIT_PATH (tmp) && !strncmp (EXIT_PATH (tmp), "/random/", 8)) |
349 | { |
344 | { |
350 | tmp->remove (); |
|
|
351 | tmp->destroy (); |
345 | tmp->destroy (); |
352 | break; |
346 | break; |
353 | } |
347 | } |
354 | |
348 | |
355 | if (final_map_exit == 1) |
349 | if (final_map_exit == 1) |
… | |
… | |
361 | the_exit_back->x = new_map->enter_x; |
355 | the_exit_back->x = new_map->enter_x; |
362 | the_exit_back->y = new_map->enter_y; |
356 | the_exit_back->y = new_map->enter_y; |
363 | |
357 | |
364 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
358 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
365 | } |
359 | } |
366 | |
|
|
367 | set_map_timeout (new_map); /* So it gets swapped out */ |
|
|
368 | } |
360 | } |
369 | else |
361 | else |
370 | the_exit_down->slaying = "/!"; |
362 | the_exit_down->slaying = "/!"; |
371 | |
363 | |
372 | /* Block the exit so things don't get dumped on top of it. */ |
364 | /* Block the exit so things don't get dumped on top of it. */ |
… | |
… | |
376 | } |
368 | } |
377 | } |
369 | } |
378 | |
370 | |
379 | } |
371 | } |
380 | |
372 | |
381 | |
|
|
382 | |
|
|
383 | /* this function unblocks the exits. We blocked them to |
373 | /* this function unblocks the exits. We blocked them to |
384 | keep things from being dumped on them during the other |
374 | keep things from being dumped on them during the other |
385 | phases of random map generation. */ |
375 | phases of random map generation. */ |
386 | void |
376 | void |
387 | unblock_exits (maptile *map, char **maze, RMParms * RP) |
377 | unblock_exits (maptile *map, char **maze, random_map_params * RP) |
388 | { |
378 | { |
389 | int i = 0, j = 0; |
379 | int i = 0, j = 0; |
390 | object *walk; |
380 | object *walk; |
391 | |
381 | |
392 | for (i = 0; i < RP->Xsize; i++) |
382 | for (i = 0; i < RP->Xsize; i++) |