| 727 | } |
| 728 | |
| 729 | void CGameItem::LoadMulti(bool dropAlpha) |
| 730 | { |
| 731 | ClearMultiItems(); |
| 732 | |
| 733 | if (Graphic >= MAX_MULTI_DATA_INDEX_COUNT) |
| 734 | { |
| 735 | return; |
| 736 | } |
| 737 | |
| 738 | WantUpdateMulti = false; |
| 739 | |
| 740 | CIndexMulti &index = g_Index.m_Multi[Graphic]; |
| 741 | |
| 742 | size_t address = index.Address; |
| 743 | int count = index.Count; |
| 744 | |
| 745 | int minX = 0; |
| 746 | int minY = 0; |
| 747 | int maxX = 0; |
| 748 | int maxY = 0; |
| 749 | |
| 750 | uint8_t alpha = 0; |
| 751 | if (!dropAlpha) |
| 752 | { |
| 753 | alpha = 0xFF; |
| 754 | } |
| 755 | |
| 756 | if (index.UopBlock != nullptr) |
| 757 | { |
| 758 | std::vector<uint8_t> data = g_FileManager.m_MultiCollection.GetData(index.UopBlock); |
| 759 | if (data.empty()) |
| 760 | { |
| 761 | return; |
| 762 | } |
| 763 | |
| 764 | CDataReader reader(&data[0], data.size()); |
| 765 | reader.Move(8); //ID + Count |
| 766 | for (int i = 0; i < count; i++) |
| 767 | { |
| 768 | const uint16_t graphic = reader.ReadUInt16LE(); |
| 769 | const int16_t x = reader.ReadInt16LE(); |
| 770 | const int16_t y = reader.ReadInt16LE(); |
| 771 | const int8_t z = (int8_t)reader.ReadInt16LE(); |
| 772 | const uint16_t flags = reader.ReadUInt16LE(); |
| 773 | const uint32_t clilocsCount = reader.ReadUInt32LE(); |
| 774 | if (clilocsCount != 0u) |
| 775 | { |
| 776 | reader.Move(clilocsCount * 4); |
| 777 | } |
| 778 | |
| 779 | if (flags == 0u) |
| 780 | { |
| 781 | auto mo = new CMultiObject(graphic, m_X + x, m_Y + y, m_Z + z, 1); |
| 782 | mo->m_DrawTextureColor[3] = alpha; |
| 783 | g_MapManager.AddRender(mo); |
| 784 | AddMultiObject(mo); |
| 785 | } |
| 786 | else if (i == 0) |
no test coverage detected