| 1248 | |
| 1249 | |
| 1250 | staticfn void |
| 1251 | makelevel(void) |
| 1252 | { |
| 1253 | struct mkroom *croom; |
| 1254 | branch *branchp; |
| 1255 | stairway *prevstairs; |
| 1256 | int room_threshold; |
| 1257 | s_level *slev; |
| 1258 | int i; |
| 1259 | |
| 1260 | if (wiz1_level.dlevel == 0) { |
| 1261 | impossible("makelevel() called when dungeon not yet initialized."); |
| 1262 | init_dungeons(); |
| 1263 | } |
| 1264 | oinit(); /* assign level dependent obj probabilities */ |
| 1265 | clear_level_structures(); |
| 1266 | |
| 1267 | slev = Is_special(&u.uz); |
| 1268 | /* check for special levels */ |
| 1269 | if (slev && !Is_rogue_level(&u.uz)) { |
| 1270 | makemaz(slev->proto); |
| 1271 | } else if (svd.dungeons[u.uz.dnum].proto[0]) { |
| 1272 | makemaz(""); |
| 1273 | } else if (svd.dungeons[u.uz.dnum].fill_lvl[0]) { |
| 1274 | makemaz(svd.dungeons[u.uz.dnum].fill_lvl); |
| 1275 | } else if (In_quest(&u.uz)) { |
| 1276 | char fillname[9]; |
| 1277 | s_level *loc_lev; |
| 1278 | |
| 1279 | Sprintf(fillname, "%s-loca", gu.urole.filecode); |
| 1280 | loc_lev = find_level(fillname); |
| 1281 | |
| 1282 | Sprintf(fillname, "%s-fil", gu.urole.filecode); |
| 1283 | Strcat(fillname, |
| 1284 | (u.uz.dlevel < loc_lev->dlevel.dlevel) ? "a" : "b"); |
| 1285 | makemaz(fillname); |
| 1286 | } else if (In_hell(&u.uz) |
| 1287 | || (rn2(5) && u.uz.dnum == medusa_level.dnum |
| 1288 | && depth(&u.uz) > depth(&medusa_level))) { |
| 1289 | makemaz(""); |
| 1290 | } else { |
| 1291 | /* otherwise, fall through - it's a "regular" level. */ |
| 1292 | int u_depth = depth(&u.uz); |
| 1293 | |
| 1294 | if (Is_rogue_level(&u.uz)) { |
| 1295 | makeroguerooms(); |
| 1296 | makerogueghost(); |
| 1297 | } else { |
| 1298 | makerooms(); |
| 1299 | } |
| 1300 | assert(svn.nroom > 0); |
| 1301 | sort_rooms(); |
| 1302 | |
| 1303 | generate_stairs(); /* up and down stairs */ |
| 1304 | |
| 1305 | branchp = Is_branchlev(&u.uz); /* possible dungeon branch */ |
| 1306 | room_threshold = branchp ? 4 : 3; /* minimum number of rooms needed |
| 1307 | to allow a random special room */ |
no test coverage detected