| 2504 | } |
| 2505 | |
| 2506 | void InitItems() |
| 2507 | { |
| 2508 | ActiveItemCount = 0; |
| 2509 | memset(dItem, 0, sizeof(dItem)); |
| 2510 | |
| 2511 | for (auto &item : Items) { |
| 2512 | item.clear(); |
| 2513 | item.position = { 0, 0 }; |
| 2514 | item._iAnimFlag = false; |
| 2515 | item._iSelFlag = 0; |
| 2516 | item._iIdentified = false; |
| 2517 | item._iPostDraw = false; |
| 2518 | } |
| 2519 | |
| 2520 | for (uint8_t i = 0; i < MAXITEMS; i++) { |
| 2521 | ActiveItems[i] = i; |
| 2522 | } |
| 2523 | |
| 2524 | if (!setlevel) { |
| 2525 | DiscardRandomValues(1); |
| 2526 | if (Quests[Q_ROCK].IsAvailable()) |
| 2527 | SpawnRock(); |
| 2528 | if (Quests[Q_ANVIL].IsAvailable()) |
| 2529 | SpawnQuestItem(IDI_ANVIL, SetPiece.position.megaToWorld() + Displacement { 11, 11 }, 0, 1, false); |
| 2530 | if (sgGameInitInfo.bCowQuest != 0 && currlevel == 20) |
| 2531 | SpawnQuestItem(IDI_BROWNSUIT, { 25, 25 }, 3, 1, false); |
| 2532 | if (sgGameInitInfo.bCowQuest != 0 && currlevel == 19) |
| 2533 | SpawnQuestItem(IDI_GREYSUIT, { 25, 25 }, 3, 1, false); |
| 2534 | // In multiplayer items spawn during level generation to avoid desyncs |
| 2535 | if (gbIsMultiplayer) { |
| 2536 | if (Quests[Q_MUSHROOM].IsAvailable()) |
| 2537 | SpawnQuestItem(IDI_FUNGALTM, { 0, 0 }, 5, 1, false); |
| 2538 | if (currlevel == Quests[Q_VEIL]._qlevel + 1 && Quests[Q_VEIL]._qactive != QUEST_NOTAVAIL) |
| 2539 | SpawnQuestItem(IDI_GLDNELIX, { 0, 0 }, 5, 1, false); |
| 2540 | } |
| 2541 | if (currlevel > 0 && currlevel < 16) |
| 2542 | AddInitItems(); |
| 2543 | if (currlevel >= 21 && currlevel <= 23) |
| 2544 | SpawnNote(); |
| 2545 | } |
| 2546 | |
| 2547 | ShowUniqueItemInfoBox = false; |
| 2548 | |
| 2549 | initItemGetRecords(); |
| 2550 | } |
| 2551 | |
| 2552 | void CalcPlrItemVals(Player &player, bool loadgfx) |
| 2553 | { |
no test coverage detected