* Major level transmutation: add a set of stairs (to the Sanctum) after * an earthquake that leaves behind a new topology, centered at inv_pos. * Assumes there are no rooms within the invocation area and that svi.inv_pos * is not too close to the edge of the map. Also assume the hero can see, * which is guaranteed for normal play due to the fact that sight is needed * to read the Book of th
| 2407 | * attempted while blind (in order to make blind-from-birth conduct viable).] |
| 2408 | */ |
| 2409 | void |
| 2410 | mkinvokearea(void) |
| 2411 | { |
| 2412 | int dist, wallct; |
| 2413 | coordxy xmin, xmax, ymin, ymax; |
| 2414 | coordxy i; |
| 2415 | |
| 2416 | /* slightly odd if levitating, but not wrong */ |
| 2417 | pline_The("floor shakes violently under you!"); |
| 2418 | /* decide whether to issue the crumbling walls message */ |
| 2419 | { |
| 2420 | xmin = xmax = svi.inv_pos.x; |
| 2421 | ymin = ymax = svi.inv_pos.y; |
| 2422 | wallct = mkinvk_check_wall(xmin, ymin); |
| 2423 | /* this replicates the somewhat convoluted loop below, working |
| 2424 | out from the stair position, except for stopping early when |
| 2425 | walls are found */ |
| 2426 | for (dist = 1; !wallct && dist < 7; ++dist) { |
| 2427 | xmin--, xmax++; |
| 2428 | /* top and bottom */ |
| 2429 | if (dist != 3) { /* the area is wider that it is high */ |
| 2430 | ymin--, ymax++; |
| 2431 | for (i = xmin + 1; i < xmax; i++) { |
| 2432 | if (mkinvk_check_wall(i, ymin)) |
| 2433 | ++wallct; /* we could break after finding first wall |
| 2434 | * but it isn't a significant optimization |
| 2435 | * for code which only executes once */ |
| 2436 | if (mkinvk_check_wall(i, ymax)) |
| 2437 | ++wallct; |
| 2438 | } |
| 2439 | } |
| 2440 | /* left and right */ |
| 2441 | if (!wallct) { /* skip y loop if x loop found any walls */ |
| 2442 | for (i = ymin; i <= ymax; i++) { |
| 2443 | if (mkinvk_check_wall(xmin, i)) |
| 2444 | ++wallct; |
| 2445 | if (mkinvk_check_wall(xmax, i)) |
| 2446 | ++wallct; |
| 2447 | } |
| 2448 | } |
| 2449 | } |
| 2450 | /* message won't appear if the maze 'walls' on this level are lava |
| 2451 | or if all the walls within range have been dug away; when it does |
| 2452 | appear, it will describe iron bars as "walls" (which is ok) */ |
| 2453 | if (wallct) |
| 2454 | pline_The("walls around you begin to bend and crumble!"); |
| 2455 | } |
| 2456 | display_nhwindow(WIN_MESSAGE, TRUE); |
| 2457 | |
| 2458 | /* any trap hero is stuck in will be going away now */ |
| 2459 | if (u.utrap) { |
| 2460 | if (u.utraptype == TT_BURIEDBALL) |
| 2461 | buried_ball_to_punishment(); |
| 2462 | reset_utrap(FALSE); |
| 2463 | } |
| 2464 | |
| 2465 | xmin = xmax = svi.inv_pos.x; /* reset after the check for walls */ |
| 2466 | ymin = ymax = svi.inv_pos.y; |
no test coverage detected