aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-06-17 20:46:22 +0200
committerBorja Lorente2016-08-14 18:28:45 +0200
commit0fc3e909749f3d1af3e617fbcbc83c3f7819c392 (patch)
tree10567db0a2fa62f107ad3bfb54c562e5969c275c
parentd7d03baba9534e1d94e7642c685addedbb9e2238 (diff)
downloadscummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.tar.gz
scummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.tar.bz2
scummvm-rg350-0fc3e909749f3d1af3e617fbcbc83c3f7819c392.zip
MACVENTURE: Small fixed
-rw-r--r--engines/macventure/image.h19
-rw-r--r--engines/macventure/macventure.cpp4
-rw-r--r--engines/macventure/macventure.h5
-rw-r--r--engines/macventure/script.h24
-rw-r--r--engines/macventure/text.cpp23
-rw-r--r--engines/macventure/text.h1
6 files changed, 61 insertions, 15 deletions
diff --git a/engines/macventure/image.h b/engines/macventure/image.h
index 5bf6ccf7ac..4cc40f1ed0 100644
--- a/engines/macventure/image.h
+++ b/engines/macventure/image.h
@@ -27,12 +27,23 @@
namespace MacVenture {
-class Image {
+class ImageAsset {
public:
- Image();
- ~Image();
+ ImageAsset(ObjID id, Container *container) {
+ _id = id;
+ _container = container;
+ }
+ ~ImageAsset() {
- void blit(Graphics::ManagedSurface *target);
+ }
+
+ void blit(Graphics::ManagedSurface *target) {
+ debug("Blitting image %x ", _id);
+ }
+
+private:
+ ObjID _id;
+ Container *_container;
};
} // End of namespace MacVenture
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 2054c5eab6..da192628fe 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -59,6 +59,9 @@ MacVentureEngine::~MacVentureEngine() {
if (_filenames)
delete _filenames;
+ if (_decodingArticles)
+ delete _decodingArticles;
+
if (_textHuffman)
delete _textHuffman;
}
@@ -84,6 +87,7 @@ Common::Error MacVentureEngine::run() {
_oldTextEncoding = !loadTextHuffman();
_filenames = new StringTable(this, _resourceManager, kFilenamesStringTableID);
+ _decodingArticles = new StringTable(this, _resourceManager, kCommonArticlesStringTableID);
// Big class instantiation
_gui = new Gui(this, _resourceManager);
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index 656aeaf2b6..a4340bf2bc 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -192,10 +192,13 @@ private: // Attributes
World *_world;
ScriptEngine *_scriptEngine;
+ // String tables
+ StringTable *_filenames;
+ StringTable *_decodingArticles;
+
// Engine state
GameState _gameState;
GlobalSettings _globalSettings;
- StringTable *_filenames;
HuffmanLists *_textHuffman;
bool _oldTextEncoding;
bool _paused, _halted, _cmdReady, _prepared;
diff --git a/engines/macventure/script.h b/engines/macventure/script.h
index 66376924b0..9814c01ad4 100644
--- a/engines/macventure/script.h
+++ b/engines/macventure/script.h
@@ -24,6 +24,7 @@
#define MACVENTURE_SCRIPT_H
#include "macventure/macventure.h"
+#include "macventure/container.h"
namespace MacVenture {
@@ -47,7 +48,28 @@ enum ControlAction {
};
typedef uint32 ObjID;
-
+
+class ScriptAsset {
+public:
+ ScriptAsset(ObjID id, Container *container, MacVentureEngine *engine) {
+ _id = id;
+ _container = container;
+ _engine = engine;
+ }
+ ~ScriptAsset() {
+
+ }
+
+ void execute() {
+ debug("SCRIPT: Executing script %x ", _id);
+ }
+
+private:
+ ObjID _id;
+ Container *_container;
+ MacVentureEngine *_engine;
+};
+
class ScriptEngine {
public:
ScriptEngine() {}
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
diff --git a/engines/macventure/text.h b/engines/macventure/text.h
index 3b3af926be..cfe76d6e11 100644
--- a/engines/macventure/text.h
+++ b/engines/macventure/text.h
@@ -46,6 +46,7 @@ private:
Container *_container;
ObjID _id;
const HuffmanLists *_huffman;
+ bool _isOld;
Common::String _decoded;