aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/macventure.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-06-12 23:08:24 +0200
committerBorja Lorente2016-08-14 18:23:04 +0200
commitc676bb99237a1d2eeb9965aae4fe78503cea9b46 (patch)
tree2e05f53036d47651c1004822287bb9b5f95a85ff /engines/macventure/macventure.cpp
parent61134cf570b711b61bef8034db2b167a3a6f4ef3 (diff)
downloadscummvm-rg350-c676bb99237a1d2eeb9965aae4fe78503cea9b46.tar.gz
scummvm-rg350-c676bb99237a1d2eeb9965aae4fe78503cea9b46.tar.bz2
scummvm-rg350-c676bb99237a1d2eeb9965aae4fe78503cea9b46.zip
MACVENTURE: Load general settings
Diffstat (limited to 'engines/macventure/macventure.cpp')
-rw-r--r--engines/macventure/macventure.cpp57
1 files changed, 54 insertions, 3 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 19021278cb..6e2d7edaab 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -37,6 +37,12 @@ enum {
kMaxMenuTitleLength = 30
};
+enum {
+ kGlobalSettingsID = 0x80,
+ kDiplomaGeometryID = 0x81,
+ kTextHuffmanTableID = 0x83
+};
+
MacVentureEngine::MacVentureEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst) {
_gameDescription = gameDesc;
_rnd = new Common::RandomSource("macventure");
@@ -65,13 +71,13 @@ Common::Error MacVentureEngine::run() {
// Additional setup.
debug("MacVentureEngine::init");
- // Your main even loop should be (invoked from) here.
- debug("MacVentureEngine::go: Hello, World!");
-
_resourceManager = new Common::MacResManager();
if (!_resourceManager->open(getGameFileName()))
error("Could not open %s as a resource fork", getGameFileName());
+ if (!loadGlobalSettings())
+ error("Could not load the engine settings");
+
_gui = new Gui(this, _resourceManager);
_shouldQuit = false;
@@ -87,6 +93,51 @@ Common::Error MacVentureEngine::run() {
return Common::kNoError;
}
+bool MacVentureEngine::loadGlobalSettings() {
+ 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'), kGlobalSettingsID);
+ if (res) {
+ _globalSettings.numObjects = res->readUint16BE();
+ _globalSettings.numGlobals = res->readUint16BE();
+ _globalSettings.numCommands = res->readUint16BE();
+ _globalSettings.numAttributes = res->readUint16BE();
+ _globalSettings.numGroups = res->readUint16BE();
+ res->readUint16BE(); // unknown
+ _globalSettings.invTop = res->readUint16BE();
+ _globalSettings.invLeft = res->readUint16BE();
+ _globalSettings.invWidth = res->readUint16BE();
+ _globalSettings.invHeight = res->readUint16BE();
+ _globalSettings.invOffsetY = res->readUint16BE();
+ _globalSettings.invOffsetX = res->readSint16BE();
+ _globalSettings.defaultFont = res->readUint16BE();
+ _globalSettings.defaultSize = res->readUint16BE();
+
+ _globalSettings.attrIndices = new uint8[_globalSettings.numAttributes];
+ res->read(_globalSettings.attrIndices, _globalSettings.numAttributes);
+
+ _globalSettings.attrMasks = new uint16[_globalSettings.numAttributes];
+ for (int i = 0; i < _globalSettings.numAttributes; i++)
+ _globalSettings.attrMasks[i] = res->readUint16BE();
+
+ _globalSettings.attrShifts = new uint8[_globalSettings.numAttributes];
+ res->read(_globalSettings.attrShifts, _globalSettings.numAttributes);
+
+ _globalSettings.cmdArgCnts = new uint8[_globalSettings.numCommands];
+ res->read(_globalSettings.cmdArgCnts, _globalSettings.numCommands);
+
+
+
+ return true;
+ }
+
+ return false;
+}
+
void MacVentureEngine::requestQuit() {
_shouldQuit = true;
}