aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
authorBorja Lorente2016-06-16 19:02:14 +0200
committerBorja Lorente2016-08-14 18:25:34 +0200
commitbc435b398e0c6ad0afb48f1d30721d3d4588d6c6 (patch)
treebe3e9356e4b238f03f565d618738b5fa4ec3abe9 /engines/macventure
parentb209c52ed980db3fed608b2743eec2556869c1bb (diff)
downloadscummvm-rg350-bc435b398e0c6ad0afb48f1d30721d3d4588d6c6.tar.gz
scummvm-rg350-bc435b398e0c6ad0afb48f1d30721d3d4588d6c6.tar.bz2
scummvm-rg350-bc435b398e0c6ad0afb48f1d30721d3d4588d6c6.zip
MACVENTURE: Add text huffman loading
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/image.h40
-rw-r--r--engines/macventure/macventure.cpp43
-rw-r--r--engines/macventure/macventure.h4
3 files changed, 83 insertions, 4 deletions
diff --git a/engines/macventure/image.h b/engines/macventure/image.h
new file mode 100644
index 0000000000..5bf6ccf7ac
--- /dev/null
+++ b/engines/macventure/image.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#ifndef MACVENTURE_IMAGE_H
+#define MACVENTURE_IMAGE_H
+
+#include "macventure/macventure.h"
+
+namespace MacVenture {
+
+class Image {
+public:
+ Image();
+ ~Image();
+
+ void blit(Graphics::ManagedSurface *target);
+};
+
+} // End of namespace MacVenture
+
+#endif
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 821a786924..0e3e5a5e5b 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -54,9 +54,11 @@ MacVentureEngine::~MacVentureEngine() {
delete _debugger;
delete _gui;
- if (_filenames) {
+ if (_filenames)
delete _filenames;
- }
+
+ if (_textHuffman)
+ delete _textHuffman;
}
Common::Error MacVentureEngine::run() {
@@ -73,12 +75,14 @@ Common::Error MacVentureEngine::run() {
if (!_resourceManager->open(getGameFileName()))
error("Could not open %s as a resource fork", getGameFileName());
+ // Engine-wide loading
if (!loadGlobalSettings())
error("Could not load the engine settings");
- // Engine-wide loading
+ _oldTextEncoding = !loadTextHuffman();
+
_filenames = new StringTable(this, _resourceManager, kFilenamesStringTableID);
-
+
// Big class instantiation
_gui = new Gui(this, _resourceManager);
_world = new World(this, _resourceManager);
@@ -192,5 +196,36 @@ bool MacVentureEngine::loadGlobalSettings() {
return false;
}
+bool MacVentureEngine::loadTextHuffman() {
+ Common::MacResIDArray resArray;
+ Common::SeekableReadStream *res;
+
+ if ((resArray = _resourceManager->getResIDArray(MKTAG('G', 'N', 'R', 'L'))).size() == 0)
+ return false;
+
+ res = _resourceManager->getResource(MKTAG('G', 'N', 'R', 'L'), kTextHuffmanTableID);
+ if (res) {
+ uint32 numEntries = res->readUint16BE();
+ res->readUint16BE(); // Skip
+
+ uint32 *masks = new uint32[numEntries];
+ for (uint i = 0; i < numEntries - 1; i++)
+ // For some reason there are one lass mask than entries
+ masks[i] = res->readUint16BE();
+
+ uint8 *lengths = new uint8[numEntries];
+ for (uint i = 0; i < numEntries; i++)
+ lengths[i] = res->readByte();
+
+ uint32 *values = new uint32[numEntries];
+ for (uint i = 0; i < numEntries; i++)
+ values[i] = res->readByte();
+
+ _textHuffman = new Common::Huffman(0, numEntries, masks, lengths, values);
+
+ return true;
+ }
+ return false;
+}
} // End of namespace MacVenture
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index d4f1a33fb9..8e11612870 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -27,6 +27,7 @@
#include "common/debug.h"
#include "common/random.h"
#include "common/macresman.h"
+#include "common/huffman.h"
#include "gui/debugger.h"
@@ -121,6 +122,7 @@ private:
// Data loading
bool loadGlobalSettings();
+ bool loadTextHuffman();
private: // Attributes
@@ -136,6 +138,8 @@ private: // Attributes
// Engine state
GlobalSettings _globalSettings;
StringTable *_filenames;
+ Common::Huffman *_textHuffman;
+ bool _oldTextEncoding;
bool _shouldQuit;
bool _paused;