[Scummvm-cvs-logs] CVS: scummvm/scumm resource_v2.cpp,NONE,1.1 resource.cpp,1.1.1.1,1.2 scumm.h,1.5,1.6 scummvm.cpp,1.4,1.5

Max Horn fingolfin at users.sourceforge.net
Thu Aug 29 09:58:55 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv16261/scumm

Modified Files:
	resource.cpp scumm.h scummvm.cpp 
Added Files:
	resource_v2.cpp 
Log Message:
experimental support for the V2 resource format (patch #601560)

--- NEW FILE: resource_v2.cpp ---
/* 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);
}

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- resource.cpp	21 Aug 2002 16:07:32 -0000	1.1.1.1
+++ resource.cpp	29 Aug 2002 16:57:43 -0000	1.2
@@ -388,8 +388,10 @@
 
 	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 @@
 		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 @@
 
 			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();

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- scumm.h	25 Aug 2002 18:40:23 -0000	1.5
+++ scumm.h	29 Aug 2002 16:57:43 -0000	1.6
@@ -273,6 +273,8 @@
 	GID_DIG = 12,
 	GID_MONKEY_VGA = 13,
 	GID_CMI = 14,
+	//GID_MANIAC = 15;
+	//GID_ZAK = 16;
 
 	/* Simon the Sorcerer */
 	GID_SIMON_FIRST = 20,
@@ -1350,6 +1352,14 @@
 	void updateCursor();
 	void animateCursor();
 	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

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- scummvm.cpp	24 Aug 2002 15:58:08 -0000	1.4
+++ scummvm.cpp	29 Aug 2002 16:57:43 -0000	1.5
@@ -165,7 +165,9 @@
 	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;





More information about the Scummvm-git-logs mailing list