diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/score.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index a6de557098..98d25cf3f1 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -779,28 +779,28 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableSubReadStreamEn stream.seek(offset); } - uint16 count = stream.readUint16(); - offset += (count + 1) * 4 + 2; // positions info + uint16 count - uint32 startPos = stream.readUint32() + offset; + uint16 count = stream.readUint16() + 1; - for (uint16 i = 0; i < count; i++) { - Common::String entryString; - uint32 nextPos = stream.readUint32() + offset; - uint32 streamPos = stream.pos(); + uint32 *entries = (uint32 *)calloc(count, sizeof(uint32)); - stream.seek(startPos); + for (uint i = 0; i < count; i++) + entries[i] = stream.readUint32(); - while (startPos != nextPos) { - entryString += stream.readByte(); - ++startPos; - } + byte *data = (byte *)malloc(entries[count - 1]); + stream.read(data, entries[count - 1]); - strings.push_back(entryString); + for (uint i = 0; i < count - 1; i++) { + Common::String entryString; - stream.seek(streamPos); - startPos = nextPos; + for (uint j = entries[i]; j < entries[i + 1]; j++) + entryString += data[j]; + + strings.push_back(entryString); } + free(data); + free(entries); + return strings; } |