| 228 | } |
| 229 | |
| 230 | staticfn void |
| 231 | do_room_or_subroom(struct mkroom *croom, |
| 232 | coordxy lowx, coordxy lowy, coordxy hix, coordxy hiy, |
| 233 | boolean lit, schar rtype, boolean special, boolean is_room) |
| 234 | { |
| 235 | coordxy x, y; |
| 236 | struct rm *lev; |
| 237 | |
| 238 | /* locations might bump level edges in wall-less rooms */ |
| 239 | /* add/subtract 1 to allow for edge locations */ |
| 240 | if (!lowx) |
| 241 | lowx++; |
| 242 | if (!lowy) |
| 243 | lowy++; |
| 244 | if (hix >= COLNO - 1) |
| 245 | hix = COLNO - 2; |
| 246 | if (hiy >= ROWNO - 1) |
| 247 | hiy = ROWNO - 2; |
| 248 | |
| 249 | if (lit) { |
| 250 | for (x = lowx - 1; x <= hix + 1; x++) { |
| 251 | lev = &levl[x][max(lowy - 1, 0)]; |
| 252 | for (y = lowy - 1; y <= hiy + 1; y++) |
| 253 | lev++->lit = 1; |
| 254 | } |
| 255 | croom->rlit = 1; |
| 256 | } else |
| 257 | croom->rlit = 0; |
| 258 | |
| 259 | croom->roomnoidx = (croom - svr.rooms); |
| 260 | croom->lx = lowx; |
| 261 | croom->hx = hix; |
| 262 | croom->ly = lowy; |
| 263 | croom->hy = hiy; |
| 264 | croom->rtype = rtype; |
| 265 | croom->doorct = 0; |
| 266 | /* if we're not making a vault, gd.doorindex will still be 0 |
| 267 | * if we are, we'll have problems adding niches to the previous room |
| 268 | * unless fdoor is at least gd.doorindex |
| 269 | */ |
| 270 | croom->fdoor = gd.doorindex; |
| 271 | croom->irregular = FALSE; |
| 272 | |
| 273 | croom->nsubrooms = 0; |
| 274 | croom->sbrooms[0] = (struct mkroom *) 0; |
| 275 | if (!special) { |
| 276 | croom->needjoining = TRUE; |
| 277 | for (x = lowx - 1; x <= hix + 1; x++) |
| 278 | for (y = lowy - 1; y <= hiy + 1; y += (hiy - lowy + 2)) { |
| 279 | levl[x][y].typ = HWALL; |
| 280 | levl[x][y].horizontal = 1; /* For open/secret doors. */ |
| 281 | } |
| 282 | for (x = lowx - 1; x <= hix + 1; x += (hix - lowx + 2)) |
| 283 | for (y = lowy; y <= hiy; y++) { |
| 284 | levl[x][y].typ = VWALL; |
| 285 | levl[x][y].horizontal = 0; /* For open/secret doors. */ |
| 286 | } |
| 287 | for (x = lowx; x <= hix; x++) { |
no test coverage detected