… | |
… | |
121 | 5 means northward |
121 | 5 means northward |
122 | 6 means southward |
122 | 6 means southward |
123 | */ |
123 | */ |
124 | |
124 | |
125 | void |
125 | void |
126 | place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms * RP) |
126 | place_exits (maptile *map, char **maze, char *exitstyle, int orientation, RMParms * RP) |
127 | { |
127 | { |
128 | char styledirname[256]; |
128 | char styledirname[256]; |
129 | mapstruct *style_map_down = 0; /* harder maze */ |
129 | maptile *style_map_down = 0; /* harder maze */ |
130 | mapstruct *style_map_up = 0; /* easier maze */ |
130 | maptile *style_map_up = 0; /* easier maze */ |
131 | object *the_exit_down; /* harder maze */ |
131 | object *the_exit_down; /* harder maze */ |
132 | object *the_exit_up; /* easier maze */ |
132 | object *the_exit_up; /* easier maze */ |
133 | object *random_sign; /* magic mouth saying this is a random map. */ |
133 | object *random_sign; /* magic mouth saying this is a random map. */ |
134 | char buf[512]; |
134 | char buf[512]; |
135 | int cx = -1, cy = -1; /* location of a map center */ |
135 | int cx = -1, cy = -1; /* location of a map center */ |
… | |
… | |
262 | |
262 | |
263 | insert_ob_in_map (the_exit_up, map, NULL, 0); |
263 | insert_ob_in_map (the_exit_up, map, NULL, 0); |
264 | maze[the_exit_up->x][the_exit_up->y] = '<'; |
264 | maze[the_exit_up->x][the_exit_up->y] = '<'; |
265 | |
265 | |
266 | /* set the starting x,y for this map */ |
266 | /* set the starting x,y for this map */ |
267 | MAP_ENTER_X (map) = the_exit_up->x; |
267 | map->enter_x = the_exit_up->x; |
268 | MAP_ENTER_Y (map) = the_exit_up->y; |
268 | map->enter_y = the_exit_up->y; |
269 | |
269 | |
270 | /* first, look for a '>' character */ |
270 | /* first, look for a '>' character */ |
271 | find_in_layout (0, '>', &downx, &downy, maze, RP); |
271 | find_in_layout (0, '>', &downx, &downy, maze, RP); |
272 | /* if no > is found use C */ |
272 | /* if no > is found use C */ |
273 | if (downx == -1) |
273 | if (downx == -1) |
… | |
… | |
314 | write_map_parameters_to_string (buf, RP); |
314 | write_map_parameters_to_string (buf, RP); |
315 | the_exit_down->msg = buf; |
315 | the_exit_down->msg = buf; |
316 | /* the identifier for making a random map. */ |
316 | /* the identifier for making a random map. */ |
317 | if (RP->dungeon_level >= RP->dungeon_depth && RP->final_map[0] != 0) |
317 | if (RP->dungeon_level >= RP->dungeon_depth && RP->final_map[0] != 0) |
318 | { |
318 | { |
319 | mapstruct *new_map; |
319 | maptile *new_map; |
320 | object *the_exit_back = arch_to_object (the_exit_up->arch), *tmp; |
320 | object *the_exit_back = arch_to_object (the_exit_up->arch), *tmp; |
321 | |
321 | |
322 | #if 0 |
322 | #if 0 |
323 | /* I'm not sure if there was any reason to change the path to the |
323 | /* I'm not sure if there was any reason to change the path to the |
324 | * map other than to maybe make it more descriptive in the 'maps' |
324 | * map other than to maybe make it more descriptive in the 'maps' |
… | |
… | |
337 | return; |
337 | return; |
338 | |
338 | |
339 | the_exit_down->slaying = RP->final_map; |
339 | the_exit_down->slaying = RP->final_map; |
340 | strcpy (new_map->path, RP->final_map); |
340 | strcpy (new_map->path, RP->final_map); |
341 | |
341 | |
342 | for (tmp = GET_MAP_OB (new_map, MAP_ENTER_X (new_map), MAP_ENTER_Y (new_map)); tmp; tmp = tmp->above) |
342 | for (tmp = GET_MAP_OB (new_map, new_map->enter_x, new_map->enter_y); tmp; tmp = tmp->above) |
343 | /* Remove exit back to previous random map. There should only be one |
343 | /* 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 |
344 | * 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 |
345 | * would require keeping a 'next' pointer, ad free_object kills tmp, which |
346 | * breaks the for loop. |
346 | * breaks the for loop. |
347 | */ |
347 | */ |
348 | if (tmp->type == EXIT && EXIT_PATH (tmp) && !strncmp (EXIT_PATH (tmp), "/random/", 8)) |
348 | if (tmp->type == EXIT && EXIT_PATH (tmp) && !strncmp (EXIT_PATH (tmp), "/random/", 8)) |
349 | { |
349 | { |
350 | remove_ob (tmp); |
350 | tmp->remove (); |
351 | free_object (tmp); |
351 | tmp->destroy (); |
352 | break; |
352 | break; |
353 | } |
353 | } |
354 | |
354 | |
355 | if (final_map_exit == 1) |
355 | if (final_map_exit == 1) |
356 | { |
356 | { |
357 | /* setup the exit back */ |
357 | /* setup the exit back */ |
358 | the_exit_back->slaying = map->path; |
358 | the_exit_back->slaying = map->path; |
359 | the_exit_back->stats.hp = the_exit_down->x; |
359 | the_exit_back->stats.hp = the_exit_down->x; |
360 | the_exit_back->stats.sp = the_exit_down->y; |
360 | the_exit_back->stats.sp = the_exit_down->y; |
361 | the_exit_back->x = MAP_ENTER_X (new_map); |
361 | the_exit_back->x = new_map->enter_x; |
362 | the_exit_back->y = MAP_ENTER_Y (new_map); |
362 | the_exit_back->y = new_map->enter_y; |
363 | |
363 | |
364 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
364 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
365 | } |
365 | } |
366 | |
366 | |
367 | set_map_timeout (new_map); /* So it gets swapped out */ |
367 | set_map_timeout (new_map); /* So it gets swapped out */ |
… | |
… | |
382 | |
382 | |
383 | /* this function unblocks the exits. We blocked them to |
383 | /* this function unblocks the exits. We blocked them to |
384 | keep things from being dumped on them during the other |
384 | keep things from being dumped on them during the other |
385 | phases of random map generation. */ |
385 | phases of random map generation. */ |
386 | void |
386 | void |
387 | unblock_exits (mapstruct *map, char **maze, RMParms * RP) |
387 | unblock_exits (maptile *map, char **maze, RMParms * RP) |
388 | { |
388 | { |
389 | int i = 0, j = 0; |
389 | int i = 0, j = 0; |
390 | object *walk; |
390 | object *walk; |
391 | |
391 | |
392 | for (i = 0; i < RP->Xsize; i++) |
392 | for (i = 0; i < RP->Xsize; i++) |
393 | for (j = 0; j < RP->Ysize; j++) |
393 | for (j = 0; j < RP->Ysize; j++) |
394 | if (maze[i][j] == '>' || maze[i][j] == '<') |
394 | if (maze[i][j] == '>' || maze[i][j] == '<') |
395 | { |
395 | { |
396 | for (walk = get_map_ob (map, i, j); walk != NULL; walk = walk->above) |
396 | for (walk = GET_MAP_OB (map, i, j); walk != NULL; walk = walk->above) |
397 | { |
397 | { |
398 | if (walk->move_block == MOVE_ALL && walk->type != LOCKED_DOOR) |
398 | if (walk->move_block == MOVE_ALL && walk->type != LOCKED_DOOR) |
399 | { |
399 | { |
400 | walk->move_block = MOVE_BLOCK_DEFAULT; |
400 | walk->move_block = MOVE_BLOCK_DEFAULT; |
401 | update_object (walk, UP_OBJ_CHANGE); |
401 | update_object (walk, UP_OBJ_CHANGE); |