diff options
Diffstat (limited to 'engines/adl/adl_v2.cpp')
-rw-r--r-- | engines/adl/adl_v2.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index e18f3339f8..979d794146 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -359,9 +359,83 @@ DataBlockPtr AdlEngine_v2::readDataBlockPtr(Common::ReadStream &f) const { if (track == 0 && sector == 0 && offset == 0 && size == 0) return DataBlockPtr(); + adjustDataBlockPtr(track, sector, offset, size); + return _disk->getDataBlock(track, sector, offset, size); } +void AdlEngine_v2::loadItems(Common::ReadStream &stream) { + byte id; + while ((id = stream.readByte()) != 0xff && !stream.eos() && !stream.err()) { + Item item = Item(); + item.id = id; + item.noun = stream.readByte(); + item.room = stream.readByte(); + item.picture = stream.readByte(); + item.isLineArt = stream.readByte(); // Disk number in later games + item.position.x = stream.readByte(); + item.position.y = stream.readByte(); + item.state = stream.readByte(); + item.description = stream.readByte(); + + stream.readByte(); // Struct size + + byte picListSize = stream.readByte(); + + // Flag to keep track of what has been drawn on the screen + stream.readByte(); + + for (uint i = 0; i < picListSize; ++i) + item.roomPictures.push_back(stream.readByte()); + + _state.items.push_back(item); + } + + if (stream.eos() || stream.err()) + error("Error loading items"); +} + +void AdlEngine_v2::loadRooms(Common::ReadStream &stream, byte count) { + for (uint i = 0; i < count; ++i) { + Room room; + + stream.readByte(); // number + for (uint j = 0; j < 6; ++j) + room.connections[j] = stream.readByte(); + room.data = readDataBlockPtr(stream); + room.picture = stream.readByte(); + room.curPicture = stream.readByte(); + room.isFirstTime = stream.readByte(); + + _state.rooms.push_back(room); + } + + if (stream.eos() || stream.err()) + error("Error loading rooms"); +} + +void AdlEngine_v2::loadMessages(Common::ReadStream &stream, byte count) { + for (uint i = 0; i < count; ++i) + _messages.push_back(readDataBlockPtr(stream)); +} + +void AdlEngine_v2::loadPictures(Common::ReadStream &stream) { + byte picNr; + while ((picNr = stream.readByte()) != 0xff) { + if (stream.eos() || stream.err()) + error("Error reading global pic list"); + + _pictures[picNr] = readDataBlockPtr(stream); + } +} + +void AdlEngine_v2::loadItemPictures(Common::ReadStream &stream, byte count) { + for (uint i = 0; i < count; ++i) { + stream.readByte(); // number + _itemPics.push_back(readDataBlockPtr(stream)); + } +} + int AdlEngine_v2::o2_isFirstTime(ScriptEnv &e) { OP_DEBUG_0("\t&& IS_FIRST_TIME()"); |