* General loader */
| 6451 | * General loader |
| 6452 | */ |
| 6453 | boolean |
| 6454 | load_special(const char *name) |
| 6455 | { |
| 6456 | boolean result = FALSE; |
| 6457 | nhl_sandbox_info sbi = {NHL_SB_SAFE, 1*1024*1024, 0, 1*1024*1024}; |
| 6458 | |
| 6459 | create_des_coder(); |
| 6460 | |
| 6461 | if (!load_lua(name, &sbi)) |
| 6462 | goto give_up; |
| 6463 | |
| 6464 | link_doors_rooms(); |
| 6465 | remove_boundary_syms(); |
| 6466 | |
| 6467 | /* TODO: ensure_way_out() needs rewrite */ |
| 6468 | if (gc.coder->check_inaccessibles) |
| 6469 | ensure_way_out(); |
| 6470 | |
| 6471 | map_cleanup(); |
| 6472 | |
| 6473 | /* FIXME: Ideally, we want this call to only cover areas of the map |
| 6474 | * which were not inserted directly by the special level file (see |
| 6475 | * the insect legs on Baalzebub's level, for instance). Since that |
| 6476 | * is currently not possible, we overload the corrmaze flag for this |
| 6477 | * purpose. |
| 6478 | */ |
| 6479 | if (!svl.level.flags.corrmaze) |
| 6480 | wallification(1, 0, COLNO - 1, ROWNO - 1); |
| 6481 | |
| 6482 | flip_level_rnd(gc.coder->allow_flips, FALSE); |
| 6483 | |
| 6484 | count_level_features(); |
| 6485 | |
| 6486 | if (gc.coder->solidify) |
| 6487 | solidify_map(); |
| 6488 | |
| 6489 | /* This must be done before premap_detect(), |
| 6490 | * otherwise branch stairs won't be premapped. */ |
| 6491 | fixup_special(); |
| 6492 | |
| 6493 | if (gc.coder->premapped) |
| 6494 | premap_detect(); |
| 6495 | |
| 6496 | result = TRUE; |
| 6497 | give_up: |
| 6498 | Free(gc.coder); |
| 6499 | gc.coder = NULL; |
| 6500 | |
| 6501 | return result; |
| 6502 | } |
| 6503 | |
| 6504 | /*sp_lev.c*/ |
no test coverage detected