Change level topology. Messes with vision tables and ignores things like * boulders in the name of a nice effect. Vision will get fixed up again * immediately after the effect is complete. */
| 45 | * immediately after the effect is complete. |
| 46 | */ |
| 47 | staticfn void |
| 48 | mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit) |
| 49 | { |
| 50 | struct rm *lev; |
| 51 | |
| 52 | if (!isok(x, y)) |
| 53 | return; |
| 54 | lev = &levl[x][y]; |
| 55 | |
| 56 | if (rockit) { |
| 57 | struct monst *mtmp; |
| 58 | |
| 59 | if (IS_OBSTRUCTED(lev->typ)) |
| 60 | return; |
| 61 | if (t_at(x, y)) |
| 62 | return; /* don't cover the portal */ |
| 63 | if ((mtmp = m_at(x, y)) != 0) /* make sure crucial monsters survive */ |
| 64 | if (!passes_walls(mtmp->data)) |
| 65 | (void) rloc(mtmp, RLOC_NOMSG); |
| 66 | } else if (lev->typ == ROOM) |
| 67 | return; |
| 68 | |
| 69 | unblock_point(x, y); /* make sure vision knows this location is open */ |
| 70 | |
| 71 | /* fake out saved state */ |
| 72 | lev->seenv = 0; |
| 73 | lev->doormask = 0; |
| 74 | if (dist < 3) |
| 75 | lev->lit = (rockit ? FALSE : TRUE); |
| 76 | if (waslit) |
| 77 | lev->waslit = (rockit ? FALSE : TRUE); |
| 78 | lev->horizontal = FALSE; |
| 79 | /* short-circuit vision recalc */ |
| 80 | gv.viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE; |
| 81 | lev->typ = (rockit ? STONE : ROOM); /* flags set via doormask above */ |
| 82 | if (dist >= 3) |
| 83 | impossible("mkcavepos called with dist %d", dist); |
| 84 | feel_newsym(x, y); |
| 85 | } |
| 86 | |
| 87 | staticfn void |
| 88 | mkcavearea(boolean rockit) |
no test coverage detected