* @brief Loads items on the current dungeon floor * @param file interface to the save file * @param savedItemCount how many items to read from the save file */
| 1005 | * @param savedItemCount how many items to read from the save file |
| 1006 | */ |
| 1007 | void LoadDroppedItems(LoadHelper &file, size_t savedItemCount) |
| 1008 | { |
| 1009 | // Skip loading ActiveItems and AvailableItems, the indices are initialised below based on the number of valid items |
| 1010 | file.Skip<uint8_t>(MAXITEMS * 2); |
| 1011 | |
| 1012 | // Reset ActiveItems, the Items array will be populated from the start |
| 1013 | std::iota(ActiveItems, ActiveItems + MAXITEMS, 0); |
| 1014 | ActiveItemCount = 0; |
| 1015 | // Clear dItem so we can populate valid drop locations |
| 1016 | memset(dItem, 0, sizeof(dItem)); |
| 1017 | |
| 1018 | for (size_t i = 0; i < savedItemCount; i++) { |
| 1019 | Item &item = Items[ActiveItemCount]; |
| 1020 | LoadItem(file, item); |
| 1021 | |
| 1022 | if (!item.isEmpty()) { |
| 1023 | // Loaded a valid item |
| 1024 | ActiveItemCount++; |
| 1025 | // populate its location in the lookup table with the offset in the Items array + 1 (so 0 can be used for "no item") |
| 1026 | dItem[item.position.x][item.position.y] = ActiveItemCount; |
| 1027 | } |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | int getHellfireLevelType(int type) |
| 1032 | { |