aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2002-08-29 16:57:43 +0000
committerMax Horn2002-08-29 16:57:43 +0000
commitbbcae3efbec9d22266a80b8cd3403d477caa7f21 (patch)
tree5edb69fa78078091ca32c0acdbce5ce07aed4c57 /scumm
parent0cf920e0403408b3e01787ed8d3ac9a6dd7a5a9c (diff)
downloadscummvm-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
Diffstat (limited to 'scumm')
-rw-r--r--scumm/resource.cpp21
-rw-r--r--scumm/resource_v2.cpp76
-rw-r--r--scumm/scumm.h10
-rw-r--r--scumm/scummvm.cpp4
4 files changed, 107 insertions, 4 deletions
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;