| 390 | } |
| 391 | |
| 392 | void InitThemes() |
| 393 | { |
| 394 | int i, j; |
| 395 | |
| 396 | zharlib = -1; |
| 397 | numthemes = 0; |
| 398 | armorFlag = TRUE; |
| 399 | bFountainFlag = TRUE; |
| 400 | cauldronFlag = TRUE; |
| 401 | mFountainFlag = TRUE; |
| 402 | pFountainFlag = TRUE; |
| 403 | tFountainFlag = TRUE; |
| 404 | treasureFlag = TRUE; |
| 405 | bCrossFlag = FALSE; |
| 406 | weaponFlag = TRUE; |
| 407 | |
| 408 | if (currlevel == 16) |
| 409 | return; |
| 410 | |
| 411 | if (leveltype == DTYPE_CATHEDRAL) { |
| 412 | for (i = 0; i < sizeof(ThemeGoodIn) / sizeof(ThemeGoodIn[0]); i++) |
| 413 | ThemeGoodIn[i] = FALSE; |
| 414 | |
| 415 | for (i = 0; i < 256 && numthemes < MAXTHEMES; i++) { |
| 416 | if (CheckThemeRoom(i)) { |
| 417 | themes[numthemes].ttval = i; |
| 418 | for (j = ThemeGood[random_(0, 4)];; j = random_(0, 17)) { |
| 419 | if (SpecialThemeFit(numthemes, j)) { |
| 420 | break; |
| 421 | } |
| 422 | } |
| 423 | themes[numthemes].ttype = j; |
| 424 | numthemes++; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | if (leveltype == DTYPE_CATACOMBS || leveltype == DTYPE_CAVES || leveltype == DTYPE_HELL) { |
| 429 | for (i = 0; i < themeCount; i++) |
| 430 | themes[i].ttype = THEME_NONE; |
| 431 | if (QuestStatus(QTYPE_ZHAR)) { |
| 432 | for (j = 0; j < themeCount; j++) { |
| 433 | themes[j].ttval = themeLoc[j].ttval; |
| 434 | if (SpecialThemeFit(j, THEME_LIBRARY)) { |
| 435 | themes[j].ttype = THEME_LIBRARY; |
| 436 | zharlib = j; |
| 437 | break; |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | for (i = 0; i < themeCount; i++) { |
| 442 | if (themes[i].ttype == THEME_NONE) { |
| 443 | themes[i].ttval = themeLoc[i].ttval; |
| 444 | for (j = ThemeGood[random_(0, 4)];; j = random_(0, 17)) { |
| 445 | if (SpecialThemeFit(i, j)) { |
| 446 | break; |
| 447 | } |
| 448 | } |
| 449 | themes[i].ttype = j; |
no test coverage detected