diff options
Diffstat (limited to 'engines/composer/resource.cpp')
-rw-r--r-- | engines/composer/resource.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/engines/composer/resource.cpp b/engines/composer/resource.cpp index d867f734a9..fa1811c05a 100644 --- a/engines/composer/resource.cpp +++ b/engines/composer/resource.cpp @@ -248,10 +248,11 @@ bool ComposerArchive::openStream(Common::SeekableReadStream *stream) { return true; } -Pipe::Pipe(Common::SeekableReadStream *stream) { +Pipe::Pipe(Common::SeekableReadStream *stream, uint16 id) { _offset = 0; _stream = stream; _anim = NULL; + _pipeId = id; } Pipe::~Pipe() { @@ -312,8 +313,14 @@ Common::SeekableReadStream *Pipe::getResource(uint32 tag, uint16 id, bool buffer if (res.entries.size() == 1) { Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(_stream, res.entries[0].offset, res.entries[0].offset + res.entries[0].size); - if (buffering) + if (buffering) { _types[tag].erase(id); + bool found = false; + for (Common::List<uint16>::const_iterator i = _bufferedResources[tag].begin(); !found && (i != _bufferedResources[tag].end()); i++) + if ((*i) == id) found = true; + if (!found) + _bufferedResources[tag].push_back(id); + } return stream; } @@ -330,12 +337,18 @@ Common::SeekableReadStream *Pipe::getResource(uint32 tag, uint16 id, bool buffer _stream->read(buffer + offset, res.entries[i].size); offset += res.entries[i].size; } - if (buffering) + if (buffering) { _types[tag].erase(id); + bool found = false; + for (Common::List<uint16>::const_iterator i = _bufferedResources[tag].begin(); !found && (i != _bufferedResources[tag].end()); i++) + if ((*i) == id) found = true; + if (!found) + _bufferedResources[tag].push_back(id); + } return new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES); } -OldPipe::OldPipe(Common::SeekableReadStream *stream) : Pipe(stream), _currFrame(0) { +OldPipe::OldPipe(Common::SeekableReadStream *stream, uint16 pipeId) : Pipe(stream, pipeId), _currFrame(0) { uint32 tag = _stream->readUint32BE(); if (tag != ID_PIPE) error("invalid tag for pipe (%08x)", tag); |