| 85 | } |
| 86 | |
| 87 | staticfn void |
| 88 | mkcavearea(boolean rockit) |
| 89 | { |
| 90 | int dist; |
| 91 | coordxy xmin = u.ux, xmax = u.ux; |
| 92 | coordxy ymin = u.uy, ymax = u.uy; |
| 93 | coordxy i; |
| 94 | boolean waslit = rm_waslit(); |
| 95 | |
| 96 | if (rockit) { |
| 97 | Soundeffect(se_crashing_rock, 100); |
| 98 | pline("Crash! The ceiling collapses around you!"); |
| 99 | } else { |
| 100 | pline("A mysterious force %s cave around you!", |
| 101 | (levl[u.ux][u.uy].typ == CORR) ? "creates a" : "extends the"); |
| 102 | } |
| 103 | display_nhwindow(WIN_MESSAGE, TRUE); |
| 104 | |
| 105 | for (dist = 1; dist <= 2; dist++) { |
| 106 | xmin--; |
| 107 | xmax++; |
| 108 | |
| 109 | /* top and bottom */ |
| 110 | if (dist < 2) { /* the area is wider that it is high */ |
| 111 | ymin--; |
| 112 | ymax++; |
| 113 | for (i = xmin + 1; i < xmax; i++) { |
| 114 | mkcavepos(i, ymin, dist, waslit, rockit); |
| 115 | mkcavepos(i, ymax, dist, waslit, rockit); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /* left and right */ |
| 120 | for (i = ymin; i <= ymax; i++) { |
| 121 | mkcavepos(xmin, i, dist, waslit, rockit); |
| 122 | mkcavepos(xmax, i, dist, waslit, rockit); |
| 123 | } |
| 124 | |
| 125 | flush_screen(1); /* make sure the new glyphs shows up */ |
| 126 | nh_delay_output(); |
| 127 | } |
| 128 | |
| 129 | if (!rockit && levl[u.ux][u.uy].typ == CORR) { |
| 130 | levl[u.ux][u.uy].typ = ROOM; /* flags for CORR already 0 */ |
| 131 | if (waslit) |
| 132 | levl[u.ux][u.uy].waslit = TRUE; |
| 133 | newsym(u.ux, u.uy); /* in case player is invisible */ |
| 134 | } |
| 135 | |
| 136 | gv.vision_full_recalc = 1; /* everything changed */ |
| 137 | } |
| 138 | |
| 139 | /* called when attempting to break a statue or boulder with a pick */ |
| 140 | staticfn boolean |