aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/text.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-06-17 20:46:22 +0200
committerBorja Lorente2016-08-14 18:28:45 +0200
commit0fc3e909749f3d1af3e617fbcbc83c3f7819c392 (patch)
tree10567db0a2fa62f107ad3bfb54c562e5969c275c /engines/macventure/text.cpp
parentd7d03baba9534e1d94e7642c685addedbb9e2238 (diff)
downloadscummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.tar.gz
scummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.tar.bz2
scummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.zip
MACVENTURE: Small fixed
Diffstat (limited to 'engines/macventure/text.cpp')
-rw-r--r--engines/macventure/text.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp
index adac94bdd2..49df7ed9a0 100644
--- a/engines/macventure/text.cpp
+++ b/engines/macventure/text.cpp
@@ -27,8 +27,9 @@ TextAsset::TextAsset(ObjID objid, Container *container, bool isOld, const Huffma
_id = objid;
_container = container;
_huffman = huffman;
+ _isOld = isOld;
- if (isOld) {
+ if (_isOld) {
decodeOld();
}
else {
@@ -99,7 +100,7 @@ void TextAsset::decodeOld() {
}
void TextAsset::decodeHuffman() {
- _decoded = Common::String("Huffman string");
+ _decoded = Common::String("");
Common::SeekableReadStream *res = _container->getItem(_id);
Common::BitStream32BEMSB stream(res);
uint16 strLen = 0;
@@ -110,7 +111,6 @@ void TextAsset::decodeHuffman() {
strLen = stream.getBits(7);
}
- char* str = new char[strLen + 1];
uint32 mask = 0;
uint32 symbol = 0;
char c;
@@ -130,17 +130,22 @@ void TextAsset::decodeHuffman() {
c = stream.getBits(7);
}
else if (symbol == 2) { // Composite
- warning("Composite huffman strings not implemented");
+ warning("Composite huffman strings not tested");
+ if (stream.getBit()) { // TextID
+ ObjID embedId = stream.getBits(15);
+ TextAsset embedded(embedId, _container, _isOld, _huffman);
+ _decoded += *embedded.decode();
+ } else { //Composite obj string
+ _decoded += Common::String("Unimplemented");
+ }
}
else { // Plain ascii
c = symbol & 0xFF;
}
- str[i] = c;
+ _decoded += c;
}
-
- str[strLen] = '\0';
- debug(7, "Decoded %d'th string (new): %s", _id, str);
- _decoded = Common::String(str);
+ _decoded += '\0';
+ debug(7, "Decoded %d'th string (new): %s", _id, _decoded.c_str());
}
} // End of namespace MacVenture \ No newline at end of file