diff options
author | Max Horn | 2002-08-29 16:57:43 +0000 |
---|---|---|
committer | Max Horn | 2002-08-29 16:57:43 +0000 |
commit | bbcae3efbec9d22266a80b8cd3403d477caa7f21 (patch) | |
tree | 5edb69fa78078091ca32c0acdbce5ce07aed4c57 | |
parent | 0cf920e0403408b3e01787ed8d3ac9a6dd7a5a9c (diff) | |
download | scummvm-rg350-bbcae3efbec9d22266a80b8cd3403d477caa7f21.tar.gz scummvm-rg350-bbcae3efbec9d22266a80b8cd3403d477caa7f21.tar.bz2 scummvm-rg350-bbcae3efbec9d22266a80b8cd3403d477caa7f21.zip |
experimental support for the V2 resource format (patch #601560)
svn-id: r4864
-rw-r--r-- | Makefile.common | 2 | ||||
-rw-r--r-- | common/engine.cpp | 4 | ||||
-rw-r--r-- | common/gameDetector.cpp | 8 | ||||
-rw-r--r-- | scumm/resource.cpp | 21 | ||||
-rw-r--r-- | scumm/resource_v2.cpp | 76 | ||||
-rw-r--r-- | scumm/scumm.h | 10 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 4 |
7 files changed, 117 insertions, 8 deletions
diff --git a/Makefile.common b/Makefile.common index 4a6b896179..95eb818a7c 100644 --- a/Makefile.common +++ b/Makefile.common @@ -17,7 +17,7 @@ GUI_OBJS = gui/gui.o gui/newgui.o gui/widget.o gui/dialog.o gui/ListWidget.o \ SCUMM_OBJS = scumm/actor.o scumm/akos.o scumm/boxes.o scumm/bundle.o \ scumm/costume.o scumm/debug.o scumm/debugrl.o scumm/gfx.o scumm/imuse.o \ - scumm/object.o scumm/resource.o scumm/resource_v3.o \ + scumm/object.o scumm/resource.o scumm/resource_v2.o scumm/resource_v3.o \ scumm/resource_v4.o scumm/saveload.o scumm/script.o \ scumm/script_v1.o scumm/script_v2.o scumm/scummvm.o scumm/string.o \ scumm/sys.o scumm/vars.o scumm/verbs.o \ diff --git a/common/engine.cpp b/common/engine.cpp index bd416f5f70..9a53b69094 100644 --- a/common/engine.cpp +++ b/common/engine.cpp @@ -85,7 +85,9 @@ Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst) engine = new SimonState(detector, syst); } else { // Some kind of Scumm game - if (detector->_features & GF_OLD256) + if (detector->_features & GF_OLD_BUNDLE) + engine = new Scumm_v2(detector, syst); + else if (detector->_features & GF_OLD256) engine = new Scumm_v3(detector, syst); else if (detector->_features & GF_SMALL_HEADER) // this force loomCD as v4 engine = new Scumm_v4(detector, syst); diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 421dfd782e..581767c58d 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -350,8 +350,12 @@ static const VersionSettings version_settings[] = { // {"zak", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,}, /* Scumm Version 2 */ -// {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,}, -// {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0,}, +// {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0, +// GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | +// GF_NO_SCALLING}, +// {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0, +// GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | +// GF_NO_SCALLING}, // {"indy3", "Indiana Jones and the Last Crusade", GID_INDY3, 2, 0, 0,}, /* Scumm Version 3 */ diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 89e825481f..318bcce181 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -388,8 +388,10 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name) if (_features & GF_AFTER_V8) num = fileReadDwordLE(); - else + else if (!(_features & GF_OLD_BUNDLE)) num = fileReadWordLE(); + else + num = fileReadByte(); if (1 || _features & GF_AFTER_V6) { if (num != res.num[id]) { @@ -402,7 +404,18 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name) allocResTypeData(id, tag, num, name, 1); } - if (_features & GF_SMALL_HEADER) { + if (_features & GF_OLD_BUNDLE) { + if (id == rtRoom){ + for (i = 0; i < num; i++) + res.roomno[id][i] = i; + fileSeek(_fileHandle, num, SEEK_CUR); + } else { + for (i = 0; i < num; i++) + res.roomno[id][i] = fileReadByte(); + } + for (i = 0; i < num; i++) + res.roomoffs[id][i] = fileReadWordLE(); + } else if (_features & GF_SMALL_HEADER) { for (i = 0; i < num; i++) { res.roomno[id][i] = fileReadByte(); res.roomoffs[id][i] = fileReadDword(); @@ -530,7 +543,9 @@ int Scumm::loadResource(int type, int idx) fileSeek(_fileHandle, fileOffs + _fileOffset, SEEK_SET); - if (_features & GF_SMALL_HEADER) { + if (_features & GF_OLD_BUNDLE) { + size = fileReadWordLE(); + } else if (_features & GF_SMALL_HEADER) { if (!(_features & GF_SMALL_NAMES)) fileSeek(_fileHandle, 8, SEEK_CUR); size = fileReadDwordLE(); diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp new file mode 100644 index 0000000000..0b8cf47d57 --- /dev/null +++ b/scumm/resource_v2.cpp @@ -0,0 +1,76 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001 Ludvig Strigeus + * Copyright (C) 2001/2002 The ScummVM project + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "stdafx.h" +#include "scumm.h" +#include "resource.h" + + +void Scumm_v2::readIndexFile() +{ + debug(9, "readIndexFile()"); + + openRoom(-1); + openRoom(0); + + if (fileReadWordLE() != 0x0100) + warning("The magic id doesn't match\n"); + + _numGlobalObjects = fileReadWordLE(); + fileSeek(_fileHandle, _numGlobalObjects, SEEK_CUR); // Skip object flags + _numRooms = fileReadByte(); + fileSeek(_fileHandle, _numRooms * 3, SEEK_CUR); + _numCostumes = fileReadByte(); + fileSeek(_fileHandle, _numCostumes * 3, SEEK_CUR); + _numScripts = fileReadByte(); + fileSeek(_fileHandle, _numScripts * 3, SEEK_CUR); + _numSounds = fileReadByte(); + + clearFileReadFailed(_fileHandle); + fileSeek(_fileHandle, 0, SEEK_SET); + + // FIXME - I'm not sure for those values yet, they will have to be rechecked + + _numVariables = 800; /* 800 */ + _numBitVariables = 4096; /* 2048 */ + _numLocalObjects = 200; /* 200 */ + _numArray = 50; + _numVerbs = 100; + _numNewNames = 0; + _objectRoomTable = NULL; + _numCharsets = 9; /* 9 */ + _numInventory = 80; /* 80 */ + _numGlobalScripts = 200; + + _shadowPaletteSize = 256; + _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later + _numFlObject = 50; + allocateArrays(); + + fileReadWordLE(); /* version magic number */ + fileReadWordLE(); /* nb global objects */ + fileSeek(_fileHandle, _numGlobalObjects, SEEK_CUR); // Skip object flags + readResTypeList(rtRoom, MKID('ROOM'), "room"); + readResTypeList(rtCostume, MKID('COST'), "costume"); + readResTypeList(rtScript, MKID('SCRP'), "script"); + readResTypeList(rtSound, MKID('SOUN'), "sound"); + + openRoom(-1); +} diff --git a/scumm/scumm.h b/scumm/scumm.h index 613cde7945..0b0dfcf590 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -273,6 +273,8 @@ enum GameId { GID_DIG = 12, GID_MONKEY_VGA = 13, GID_CMI = 14, + //GID_MANIAC = 15; + //GID_ZAK = 16; /* Simon the Sorcerer */ GID_SIMON_FIRST = 20, @@ -1352,6 +1354,14 @@ public: void updatePalette(); }; +class Scumm_v2 : public Scumm +{ +public: + Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} + + virtual void readIndexFile(); +}; + class Scumm_v3 : public Scumm { public: diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 85f49d2270..bb6756d5d4 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -165,7 +165,9 @@ void Scumm::scummInit() tempMusic = 0; debug(9, "scummInit"); - if (_features & GF_SMALL_HEADER) + if (_features & GF_OLD_BUNDLE) + _resourceHeaderSize = 2; // FIXME - to be rechecked + else if (_features & GF_SMALL_HEADER) _resourceHeaderSize = 6; else _resourceHeaderSize = 8; |