[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,NONE,2.1 script_v8.cpp,NONE,2.1 module.mk,1.4,1.5 resource.cpp,1.31,1.32 resource_v2.cpp,1.7,1.8 resource_v3.cpp,1.4,1.5 resource_v4.cpp,1.3,1.4 saveload.cpp,1.34,1.35 script_v5.cpp,1.4,1.5 script_v6.cpp,1.9,1.10 scumm.h,1.89,1.90 scummvm.cpp,2.1,2.2 vars.cpp,1.6,1.7

Max Horn fingolfin at users.sourceforge.net
Sun Dec 22 13:59:02 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv2416

Modified Files:
	module.mk resource.cpp resource_v2.cpp resource_v3.cpp 
	resource_v4.cpp saveload.cpp script_v5.cpp script_v6.cpp 
	scumm.h scummvm.cpp vars.cpp 
Added Files:
	intern.h script_v8.cpp 
Log Message:
added some preliminary V8 work. Nope, it is not useful at all, and it doesn't mean we will have CMI support in this millenium, so don't hold your breath

--- NEW FILE: intern.h ---
/* 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.
 *
 * $Header: /cvsroot/scummvm/scummvm/scumm/intern.h,v 2.1 2002/12/22 21:58:15 fingolfin Exp $
 *
 */

#ifndef INTERN_H
#define INTERN_H

#include "scumm.h"


class Scumm_v5 : public Scumm
{
protected:
	typedef void (Scumm_v5::*OpcodeProcV5)();
	struct OpcodeEntryV5 {
		OpcodeProcV5 proc;
		const char *desc;
	};
	
	const OpcodeEntryV5 *_opcodesV5;
	
public:
	Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}

protected:
	virtual void setupOpcodes();
	virtual void executeOpcode(int i);
	virtual const char *getOpcodeDesc(int i);

	void decodeParseString();
	int getWordVararg(int16 *ptr);
	int getVarOrDirectWord(byte mask);
	int getVarOrDirectByte(byte mask);

	/* Version 5 script opcodes */
	void o5_actorFollowCamera();
	void o5_actorFromPos();
	void o5_actorSet();
	void o5_add();
	void o5_and();
	void o5_animateActor();
	void o5_badOpcode();
	void o5_breakHere();
	void o5_chainScript();
	void o5_cursorCommand();
	void o5_cutscene();
	void o5_debug();
	void o5_decrement();
	void o5_delay();
	void o5_delayVariable();
	void o5_divide();
	void o5_doSentence();
	void o5_drawBox();
	void o5_drawObject();
	void o5_dummy();
	void o5_endCutscene();
	void o5_equalZero();
	void o5_expression();
	void o5_faceActor();
	void o5_findInventory();
	void o5_findObject();
	void o5_freezeScripts();
	void o5_getActorCostume();
	void o5_getActorElevation();
	void o5_getActorFacing();
	void o5_getActorMoving();
	void o5_getActorRoom();
	void o5_getActorScale();
	void o5_getActorWalkBox();
	void o5_getActorWidth();
	void o5_getActorX();
	void o5_getActorY();
	void o5_getAnimCounter();
	void o5_getClosestObjActor();
	void o5_getDist();
	void o5_getInventoryCount();
	void o5_getObjectOwner();
	void o5_getObjectState();
	void o5_getRandomNr();
	void o5_isScriptRunning();
	void o5_getVerbEntrypoint();
	void o5_ifClassOfIs();
	void o5_increment();
	void o5_isActorInBox();
	void o5_isEqual();
	void o5_isGreater();
	void o5_isGreaterEqual();
	void o5_isLess();
	void o5_isNotEqual();
	void o5_ifState();
	void o5_ifNotState();
	void o5_isSoundRunning();
	void o5_jumpRelative();
	void o5_lessOrEqual();
	void o5_lights();
	void o5_loadRoom();
	void o5_loadRoomWithEgo();
	void o5_matrixOps();
	void o5_move();
	void o5_multiply();
	void o5_notEqualZero();
	void o5_or();
	void o5_overRide();
	void o5_panCameraTo();
	void o5_pickupObject();
	void o5_print();
	void o5_printEgo();
	void o5_pseudoRoom();
	void o5_putActor();
	void o5_putActorAtObject();
	void o5_putActorInRoom();
	void o5_quitPauseRestart();
	void o5_resourceRoutines();
	void o5_roomOps();
	void o5_saveRestoreVerbs();
	void o5_setCameraAt();
	void o5_setClass();
	void o5_setObjectName();
	void o5_setOwnerOf();
	void o5_setState();
	void o5_setVarRange();
	void o5_soundKludge();
	void o5_startMusic();
	void o5_startObject();
	void o5_startScript();
	void o5_startSound();
	void o5_stopMusic();
	void o5_stopObjectCode();
	void o5_stopObjectScript();
	void o5_stopScript();
	void o5_stopSound();
	void o5_stringOps();
	void o5_subtract();
	void o5_verbOps();
	void o5_wait();
	void o5_walkActorTo();
	void o5_walkActorToActor();
	void o5_walkActorToObject();
    void o5_oldRoomEffect();
	void o5_pickupObjectOld();
};

// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table
class Scumm_v2 : public Scumm_v5
{
public:
	Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}

	virtual void readIndexFile();
};

// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance 
// accordingly - that would be more logical I guess. However, if you do so, take care
// of preserving the right readIndexFile / loadCharset !!!
class Scumm_v3 : public Scumm_v5
{
public:
	Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}

	void readIndexFile();
	virtual void loadCharset(int no);
};

class Scumm_v4 : public Scumm_v3
{
public:
	Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}

	void loadCharset(int no);
};

class Scumm_v6 : public Scumm
{
protected:
	typedef void (Scumm_v6::*OpcodeProcV6)();
	struct OpcodeEntryV6 {
		OpcodeProcV6 proc;
		const char *desc;
	};
	
	const OpcodeEntryV6 *_opcodesV6;
	
public:
	Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}

protected:
	virtual void setupOpcodes();

	virtual void executeOpcode(int i);
	virtual const char *getOpcodeDesc(int i);

	int popRoomAndObj(int *room);

	void decodeParseString2(int a, int b);
	int getStackList(int16 *args, uint maxnum);

	/* Version 6 script opcodes */
	void o6_setBlastObjectWindow();
	void o6_pushByte();
	void o6_pushWord();
	void o6_pushByteVar();
	void o6_pushWordVar();
	void o6_invalid();
	void o6_byteArrayRead();
	void o6_wordArrayRead();
	void o6_byteArrayIndexedRead();
	void o6_wordArrayIndexedRead();
	void o6_dup();
	void o6_not();
	void o6_eq();
	void o6_neq();
	void o6_gt();
	void o6_lt();
	void o6_le();
	void o6_ge();
	void o6_add();
	void o6_sub();
	void o6_mul();
	void o6_div();
	void o6_land();
	void o6_lor();
	void o6_kill();
	void o6_writeByteVar();
	void o6_writeWordVar();
	void o6_byteArrayWrite();
	void o6_wordArrayWrite();
	void o6_byteArrayIndexedWrite();
	void o6_wordArrayIndexedWrite();
	void o6_byteVarInc();
	void o6_wordVarInc();
	void o6_byteArrayInc();
	void o6_wordArrayInc();
	void o6_byteVarDec();
	void o6_wordVarDec();
	void o6_byteArrayDec();
	void o6_wordArrayDec();
	void o6_jumpTrue();
	void o6_jumpFalse();
	void o6_jump();
	void o6_startScriptEx();
	void o6_startScript();
	void o6_startObject();
	void o6_setObjectState();
	void o6_setObjectXY();
	void o6_stopObjectCode();
	void o6_endCutscene();
	void o6_cutScene();
	void o6_stopMusic();
	void o6_freezeUnfreeze();
	void o6_cursorCommand();
	void o6_breakHere();
	void o6_ifClassOfIs();
	void o6_setClass();
	void o6_getState();
	void o6_setState();
	void o6_setOwner();
	void o6_getOwner();
	void o6_startSound();
	void o6_stopSound();
	void o6_startMusic();
	void o6_stopObjectScript();
	void o6_panCameraTo();
	void o6_actorFollowCamera();
	void o6_setCameraAt();
	void o6_loadRoom();
	void o6_stopScript();
	void o6_walkActorToObj();
	void o6_walkActorTo();
	void o6_putActorInRoom();
	void o6_putActorAtObject();
	void o6_faceActor();
	void o6_animateActor();
	void o6_doSentence();
	void o6_pickupObject();
	void o6_loadRoomWithEgo();
	void o6_getRandomNumber();
	void o6_getRandomNumberRange();
	void o6_getActorMoving();
	void o6_isScriptRunning();
	void o6_getActorRoom();
	void o6_getObjectX();
	void o6_getObjectY();
	void o6_getObjectOldDir();
	void o6_getObjectNewDir();
	void o6_getActorWalkBox();
	void o6_getActorCostume();
	void o6_findInventory();
	void o6_getInventoryCount();
	void o6_getVerbFromXY();
	void o6_beginOverride();
	void o6_endOverride();
	void o6_setObjectName();
	void o6_isSoundRunning();
	void o6_setBoxFlags();
	void o6_createBoxMatrix();
	void o6_resourceRoutines();
	void o6_roomOps();
	void o6_actorSet();
	void o6_verbOps();
	void o6_getActorFromXY();
	void o6_findObject();
	void o6_pseudoRoom();
	void o6_getActorElevation();
	void o6_getVerbEntrypoint();
	void o6_arrayOps();
	void o6_saveRestoreVerbs();
	void o6_drawBox();
	void o6_getActorWidth();
	void o6_wait();
	void o6_getActorScaleX();
	void o6_getActorAnimCounter1();
	void o6_soundKludge();
	void o6_isAnyOf();
	void o6_quitPauseRestart();
	void o6_isActorInBox();
	void o6_delay();
	void o6_delayLonger();
	void o6_delayVeryLong();
	void o6_stopSentence();
	void o6_print_0();
	void o6_print_1();
	void o6_print_2();
	void o6_print_3();
	void o6_printActor();
	void o6_printEgo();
	void o6_talkActor();
	void o6_talkEgo();
	void o6_dim();
	void o6_dummy();
	void o6_runVerbCodeQuick();
	void o6_runScriptQuick();
	void o6_dim2();
	void o6_abs();
	void o6_distObjectObject();
	void o6_distObjectPt();
	void o6_distPtPt();
	void o6_miscOps();
	void o6_delayFrames();
	void o6_pickOneOf();
	void o6_pickOneOfDefault();
	void o6_jumpToScript();
	void o6_isRoomScriptRunning();
	void o6_kernelFunction();
	void o6_getAnimateVariable();
	void o6_drawBlastObject();
	void o6_getActorPriority();
	void o6_unknownCD();
	void o6_bor();
	void o6_band();
};

class Scumm_v7 : public Scumm_v6
{
public:
	Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {}

protected:
	virtual void setupScummVars();
};

class Scumm_v8 : public Scumm
{
protected:
	typedef void (Scumm_v8::*OpcodeProcV8)();
	struct OpcodeEntryV8 {
		OpcodeProcV8 proc;
		const char *desc;
	};
	
	const OpcodeEntryV8 *_opcodesV8;
	
public:
	Scumm_v8(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}

protected:
	virtual void setupOpcodes();

	virtual void executeOpcode(int i);
	virtual const char *getOpcodeDesc(int i);

	/* Version 8 script opcodes */
	void o8_unknown();
	void o8_invalid();

	void o8_pushNumber();
	void o8_pushVariable();
	void o8_dup();
	void o8_pop();
	void o8_not();
	void o8_eq();
	void o8_neq();
	void o8_gt();
	void o8_lt();
	void o8_le();
	void o8_ge();
	void o8_add();
	void o8_sub();
	void o8_mul();
	void o8_div();
	void o8_land();
	void o8_lor();
	void o8_band();
	void o8_bor();
	void o8_mod();
	void o8_jump();
	void o8_breakHere();
	void o8_startScript();
	void o8_startObject();
};


#endif

--- NEW FILE: script_v8.cpp ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 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.
 *
 * $Header: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v 2.1 2002/12/22 21:58:15 fingolfin Exp $
 *
[...1001 lines suppressed...]
1EE SO_494
1EF SO_495
1F0 SO_496
1F1 SO_497
1F2 SO_498
1F3 SO_499
1F4 SO_500
1F5 SO_501
1F6 SO_502
1F7 SO_503
1F8 SO_504
1F9 SO_505
1FA SO_506
1FB SO_507
1FC SO_508
1FD SO_509
1FE SO_510
1FF SO_511

*/
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- module.mk	18 Dec 2002 13:41:22 -0000	1.4
+++ module.mk	22 Dec 2002 21:58:15 -0000	1.5
@@ -20,6 +20,7 @@
 	scumm/script.o \
 	scumm/script_v5.o \
 	scumm/script_v6.o \
+	scumm/script_v8.o \
 	scumm/scummvm.o \
 	scumm/sound.o \
 	scumm/string.o \

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- resource.cpp	21 Dec 2002 12:34:16 -0000	1.31
+++ resource.cpp	22 Dec 2002 21:58:15 -0000	1.32
@@ -31,7 +31,6 @@
 
 uint16 newTag2Old(uint32 oldTag);
 
-
 /* Open a room */
 void Scumm::openRoom(int room)
 {
@@ -39,6 +38,7 @@
 	char buf[256];
 
 	debug(9, "openRoom(%d)", room);
+	assert(room >= 0);
 
 	/* Don't load the same room again */
 	if (_lastLoadedRoom == room)
@@ -125,7 +125,17 @@
 	} while (1);
 
 	deleteRoomOffsets();
-	_fileOffset = 0;							/* start of file */
+	_fileOffset = 0;		// start of file
+}
+
+void Scumm::closeRoom()
+{
+	if (_lastLoadedRoom != -1) {
+		_lastLoadedRoom = -1;
+		_encbyte = 0;
+		deleteRoomOffsets();
+		_fileHandle.close();
+	}
 }
 
 /* Delete the currently loaded room offsets */
@@ -202,7 +212,7 @@
 
 	debug(9, "readIndexFile()");
 
-	openRoom(-1);
+	closeRoom();
 	openRoom(0);
 
 	if (!(_features & GF_AFTER_V6)) {
@@ -330,12 +340,17 @@
 			break;
 
 		case MKID('AARY'):
+			debug(3, "Going to call readArrayFromIndexFile (pos = 0x%08x)", _fileHandle.pos());
 			readArrayFromIndexFile();
+			debug(3, "After readArrayFromIndexFile (pos = 0x%08x)", _fileHandle.pos());
 			break;
 
 		default:
-			error("Bad ID %c%c%c%c found in directory!", blocktype & 0xFF,
-						blocktype >> 8, blocktype >> 16, blocktype >> 24);
+			error("Bad ID %c%c%c%c found in directory!",
+						(byte)blocktype,
+						(byte)(blocktype >> 8),
+						(byte)(blocktype >> 16),
+						(byte)(blocktype >> 24));
 			return;
 		}
 	}
@@ -343,22 +358,42 @@
 //  if (numblock!=9)
 //    error("Not enough blocks read from directory");
 
-	openRoom(-1);
+	closeRoom();
 }
 
 void Scumm::readArrayFromIndexFile()
 {
 	int num;
-	int a, b, c;
+	int a, b, c, d;
 
-	while ((num = _fileHandle.readUint16LE()) != 0) {
-		a = _fileHandle.readUint16LE();
-		b = _fileHandle.readUint16LE();
-		c = _fileHandle.readUint16LE();
-		if (c == 1)
-			defineArray(num, 1, a, b);
-		else
-			defineArray(num, 5, a, b);
+	if (_features & GF_AFTER_V8) {
+		// FIXME - I am not quite sure how to interpret the AARY format of COMI.
+		// Each entry seems to be 12 bytes, while in V7 games it is only 8 bytes.
+		// 2 of the additional bytes seem to be used for num. But what about the
+		// other 2?. Either one of the three fields grew, too (but which). Or there
+		// is a new field, but then what does it mean? Endy or ludde probably know more :-)
+		while ((num = _fileHandle.readUint32LE()) != 0) {
+			a = _fileHandle.readUint16LE();
+			b = _fileHandle.readUint16LE();
+			c = _fileHandle.readUint16LE();
+			d = _fileHandle.readUint16LE();
+			
+			printf("Reading array (0x%08x,%d,%d,%d,%d) - (pos = 0x%08x)\n", num, a, b, c, d, _fileHandle.pos());
+			if (c == 1)
+				defineArray(num, 1, a, b);
+			else
+				defineArray(num, 5, a, b);
+		}
+	} else {
+		while ((num = _fileHandle.readUint16LE()) != 0) {
+			a = _fileHandle.readUint16LE();
+			b = _fileHandle.readUint16LE();
+			c = _fileHandle.readUint16LE();
+			if (c == 1)
+				defineArray(num, 1, a, b);
+			else
+				defineArray(num, 5, a, b);
+		}
 	}
 }
 
@@ -388,7 +423,7 @@
 	}
 
 	if (_features & GF_OLD_BUNDLE) {
-		if (id == rtRoom){
+		if (id == rtRoom) {
 			for (i = 0; i < num; i++)
 				res.roomno[id][i] = i;
 			_fileHandle.seek(num, SEEK_CUR);
@@ -1513,6 +1548,10 @@
 		_fileHandle.readUint32LE();
 		_fileHandle.readUint32LE();
 		_numArray = _fileHandle.readUint32LE();
+
+		// FIXME - uhm... COMI seems to have an ARRY with 143 entries, but
+		// indeed _numArray gets set to 50 ?!?
+		_numArray = 150;
 
 		_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);
 		_numGlobalScripts = 2000;

Index: resource_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v2.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- resource_v2.cpp	14 Dec 2002 18:51:34 -0000	1.7
+++ resource_v2.cpp	22 Dec 2002 21:58:15 -0000	1.8
@@ -21,6 +21,7 @@
 
 #include "stdafx.h"
 #include "scumm.h"
+#include "intern.h"
 #include "resource.h"
 
 
@@ -29,7 +30,7 @@
 	int magic = 0;
 	debug(9, "readIndexFile()");
 
-	openRoom(-1);
+	closeRoom();
 	openRoom(0);
 
 	magic = _fileHandle.readUint16LE();
@@ -81,5 +82,5 @@
 	readResTypeList(rtScript, MKID('SCRP'), "script");
 	readResTypeList(rtSound, MKID('SOUN'), "sound");
 
-	openRoom(-1);
+	closeRoom();
 }

Index: resource_v3.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v3.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- resource_v3.cpp	21 Oct 2002 13:23:24 -0000	1.4
+++ resource_v3.cpp	22 Dec 2002 21:58:15 -0000	1.5
@@ -22,6 +22,7 @@
 
 #include "stdafx.h"
 #include "scumm.h"
+#include "intern.h"
 #include "resource.h"
 
 
@@ -34,7 +35,7 @@
 
 	debug(9, "readIndexFile()");
 
-	openRoom(-1);
+	closeRoom();
 	openRoom(0);
 
 	while (!_fileHandle.eof()) {
@@ -147,7 +148,7 @@
 		}
 	}
 
-	openRoom(-1);
+	closeRoom();
 }
 
 void Scumm_v3::loadCharset(int no)
@@ -156,12 +157,12 @@
 	memset(_charsetData, 0, sizeof(_charsetData));
 
 	checkRange(4, 0, no, "Loading illegal charset %d");
-	openRoom(-1);
+	closeRoom();
 
 	openRoom(98 + no);
 
 	size = _fileHandle.readUint16LE();
 
 	_fileHandle.read(createResource(6, no, size), size);
-	openRoom(-1);
+	closeRoom();
 }

Index: resource_v4.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v4.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- resource_v4.cpp	21 Oct 2002 13:23:24 -0000	1.3
+++ resource_v4.cpp	22 Dec 2002 21:58:15 -0000	1.4
@@ -22,6 +22,7 @@
 
 #include "stdafx.h"
 #include "scumm.h"
+#include "intern.h"
 
 void Scumm_v4::loadCharset(int no)
 {
@@ -29,12 +30,12 @@
 	memset(_charsetData, 0, sizeof(_charsetData));
 
 	checkRange(4, 0, no, "Loading illegal charset %d");
-	openRoom(-1);
+	closeRoom();
 
 	openRoom(900 + no);
 
 	size = _fileHandle.readUint32LE() + 11;
 
 	_fileHandle.read(createResource(6, no, size), size);
-	openRoom(-1);
+	closeRoom();
 }

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- saveload.cpp	17 Dec 2002 01:15:13 -0000	1.34
+++ saveload.cpp	22 Dec 2002 21:58:15 -0000	1.35
@@ -111,7 +111,8 @@
 	_sound->stopCD();
 	_sound->pauseSounds(true);
 
-	CHECK_HEAP openRoom(-1);
+	CHECK_HEAP
+	closeRoom();
 	memset(_inventory, 0, sizeof(_inventory[0]) * _numInventory);
 
 	/* Nuke all resources */

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- script_v5.cpp	22 Dec 2002 19:14:53 -0000	1.4
+++ script_v5.cpp	22 Dec 2002 21:58:15 -0000	1.5
@@ -23,8 +23,9 @@
 #include "stdafx.h"
 #include "scumm.h"
 #include "actor.h"
+#include "intern.h"
+#include "sound.h"
 #include "verbs.h"
-#include "scumm/sound.h"
 
 #define OPCODE(x)	{ &Scumm_v5::x, #x }
 

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- script_v6.cpp	22 Dec 2002 19:14:53 -0000	1.9
+++ script_v6.cpp	22 Dec 2002 21:58:15 -0000	1.10
@@ -24,13 +24,14 @@
 #include "stdafx.h"
 #include "scumm.h"
 #include "actor.h"
+#include "imuse.h"
+#include "intern.h"
+#include "sound.h"
 #include "verbs.h"
 #include "smush/player.h"
 #include "smush/scumm_renderer.h"
 
 #include "sound/mididrv.h"
-#include "scumm/sound.h"
-#include "scumm/imuse.h"
 
 #include "dialogs.h"		// FIXME: This is just for the FT-INSANE warning. 
 				// Remove when INSANE is implemented

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- scumm.h	22 Dec 2002 19:14:53 -0000	1.89
+++ scumm.h	22 Dec 2002 21:58:15 -0000	1.90
@@ -48,7 +48,6 @@
 
 /* System Wide Constants */
 enum {
-	NUM_MIXER = 4,
 	NUM_SCRIPT_SLOT = 40,
 	NUM_LOCALSCRIPT = 60,
 	NUM_SHADOW_PALETTE = 8,
@@ -528,6 +527,7 @@
 
 	void allocateArrays();
 	void openRoom(int room);
+	void closeRoom();
 	void deleteRoomOffsets();
 	void readRoomsOffsets();
 	void askForDisk(const char *filename);
@@ -1061,356 +1061,6 @@
 	void updateCursor();
 	void animateCursor();
 	void updatePalette();
-};
-
-class Scumm_v5 : public Scumm
-{
-protected:
-	typedef void (Scumm_v5::*OpcodeProcV5)();
-	struct OpcodeEntryV5 {
-		OpcodeProcV5 proc;
-		const char *desc;
-	};
-	
-	const OpcodeEntryV5 *_opcodesV5;
-	
-public:
-	Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
-
-protected:
-	virtual void setupOpcodes();
-	virtual void executeOpcode(int i);
-	virtual const char *getOpcodeDesc(int i);
-
-	void decodeParseString();
-	int getWordVararg(int16 *ptr);
-	int getVarOrDirectWord(byte mask);
-	int getVarOrDirectByte(byte mask);
-
-	/* Version 5 script opcodes */
-	void o5_actorFollowCamera();
-	void o5_actorFromPos();
-	void o5_actorSet();
-	void o5_add();
-	void o5_and();
-	void o5_animateActor();
-	void o5_badOpcode();
-	void o5_breakHere();
-	void o5_chainScript();
-	void o5_cursorCommand();
-	void o5_cutscene();
-	void o5_debug();
-	void o5_decrement();
-	void o5_delay();
-	void o5_delayVariable();
-	void o5_divide();
-	void o5_doSentence();
-	void o5_drawBox();
-	void o5_drawObject();
-	void o5_dummy();
-	void o5_endCutscene();
-	void o5_equalZero();
-	void o5_expression();
-	void o5_faceActor();
-	void o5_findInventory();
-	void o5_findObject();
-	void o5_freezeScripts();
-	void o5_getActorCostume();
-	void o5_getActorElevation();
-	void o5_getActorFacing();
-	void o5_getActorMoving();
-	void o5_getActorRoom();
-	void o5_getActorScale();
-	void o5_getActorWalkBox();
-	void o5_getActorWidth();
-	void o5_getActorX();
-	void o5_getActorY();
-	void o5_getAnimCounter();
-	void o5_getClosestObjActor();
-	void o5_getDist();
-	void o5_getInventoryCount();
-	void o5_getObjectOwner();
-	void o5_getObjectState();
-	void o5_getRandomNr();
-	void o5_isScriptRunning();
-	void o5_getVerbEntrypoint();
-	void o5_ifClassOfIs();
-	void o5_increment();
-	void o5_isActorInBox();
-	void o5_isEqual();
-	void o5_isGreater();
-	void o5_isGreaterEqual();
-	void o5_isLess();
-	void o5_isNotEqual();
-	void o5_ifState();
-	void o5_ifNotState();
-	void o5_isSoundRunning();
-	void o5_jumpRelative();
-	void o5_lessOrEqual();
-	void o5_lights();
-	void o5_loadRoom();
-	void o5_loadRoomWithEgo();
-	void o5_matrixOps();
-	void o5_move();
-	void o5_multiply();
-	void o5_notEqualZero();
-	void o5_or();
-	void o5_overRide();
-	void o5_panCameraTo();
-	void o5_pickupObject();
-	void o5_print();
-	void o5_printEgo();
-	void o5_pseudoRoom();
-	void o5_putActor();
-	void o5_putActorAtObject();
-	void o5_putActorInRoom();
-	void o5_quitPauseRestart();
-	void o5_resourceRoutines();
-	void o5_roomOps();
-	void o5_saveRestoreVerbs();
-	void o5_setCameraAt();
-	void o5_setClass();
-	void o5_setObjectName();
-	void o5_setOwnerOf();
-	void o5_setState();
-	void o5_setVarRange();
-	void o5_soundKludge();
-	void o5_startMusic();
-	void o5_startObject();
-	void o5_startScript();
-	void o5_startSound();
-	void o5_stopMusic();
-	void o5_stopObjectCode();
-	void o5_stopObjectScript();
-	void o5_stopScript();
-	void o5_stopSound();
-	void o5_stringOps();
-	void o5_subtract();
-	void o5_verbOps();
-	void o5_wait();
-	void o5_walkActorTo();
-	void o5_walkActorToActor();
-	void o5_walkActorToObject();
-    void o5_oldRoomEffect();
-	void o5_pickupObjectOld();
-};
-
-// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table
-class Scumm_v2 : public Scumm_v5
-{
-public:
-	Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
-
-	virtual void readIndexFile();
-};
-
-// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance 
-// accordingly - that would be more logical I guess. However, if you do so, take care
-// of preserving the right readIndexFile / loadCharset !!!
-class Scumm_v3 : public Scumm_v5
-{
-public:
-	Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
-
-	void readIndexFile();
-	virtual void loadCharset(int no);
-};
-
-class Scumm_v4 : public Scumm_v3
-{
-public:
-	Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}
-
-	void loadCharset(int no);
-};
-
-class Scumm_v6 : public Scumm
-{
-protected:
-	typedef void (Scumm_v6::*OpcodeProcV6)();
-	struct OpcodeEntryV6 {
-		OpcodeProcV6 proc;
-		const char *desc;
-	};
-	
-	const OpcodeEntryV6 *_opcodesV6;
-	
-public:
-	Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
-
-protected:
-	virtual void setupOpcodes();
-
-	virtual void executeOpcode(int i);
-	virtual const char *getOpcodeDesc(int i);
-
-	int popRoomAndObj(int *room);
-
-	void decodeParseString2(int a, int b);
-	int getStackList(int16 *args, uint maxnum);
-
-	/* Version 6 script opcodes */
-	void o6_setBlastObjectWindow();
-	void o6_pushByte();
-	void o6_pushWord();
-	void o6_pushByteVar();
-	void o6_pushWordVar();
-	void o6_invalid();
-	void o6_byteArrayRead();
-	void o6_wordArrayRead();
-	void o6_byteArrayIndexedRead();
-	void o6_wordArrayIndexedRead();
-	void o6_dup();
-	void o6_not();
-	void o6_eq();
-	void o6_neq();
-	void o6_gt();
-	void o6_lt();
-	void o6_le();
-	void o6_ge();
-	void o6_add();
-	void o6_sub();
-	void o6_mul();
-	void o6_div();
-	void o6_land();
-	void o6_lor();
-	void o6_kill();
-	void o6_writeByteVar();
-	void o6_writeWordVar();
-	void o6_byteArrayWrite();
-	void o6_wordArrayWrite();
-	void o6_byteArrayIndexedWrite();
-	void o6_wordArrayIndexedWrite();
-	void o6_byteVarInc();
-	void o6_wordVarInc();
-	void o6_byteArrayInc();
-	void o6_wordArrayInc();
-	void o6_byteVarDec();
-	void o6_wordVarDec();
-	void o6_byteArrayDec();
-	void o6_wordArrayDec();
-	void o6_jumpTrue();
-	void o6_jumpFalse();
-	void o6_jump();
-	void o6_startScriptEx();
-	void o6_startScript();
-	void o6_startObject();
-	void o6_setObjectState();
-	void o6_setObjectXY();
-	void o6_stopObjectCode();
-	void o6_endCutscene();
-	void o6_cutScene();
-	void o6_stopMusic();
-	void o6_freezeUnfreeze();
-	void o6_cursorCommand();
-	void o6_breakHere();
-	void o6_ifClassOfIs();
-	void o6_setClass();
-	void o6_getState();
-	void o6_setState();
-	void o6_setOwner();
-	void o6_getOwner();
-	void o6_startSound();
-	void o6_stopSound();
-	void o6_startMusic();
-	void o6_stopObjectScript();
-	void o6_panCameraTo();
-	void o6_actorFollowCamera();
-	void o6_setCameraAt();
-	void o6_loadRoom();
-	void o6_stopScript();
-	void o6_walkActorToObj();
-	void o6_walkActorTo();
-	void o6_putActorInRoom();
-	void o6_putActorAtObject();
-	void o6_faceActor();
-	void o6_animateActor();
-	void o6_doSentence();
-	void o6_pickupObject();
-	void o6_loadRoomWithEgo();
-	void o6_getRandomNumber();
-	void o6_getRandomNumberRange();
-	void o6_getActorMoving();
-	void o6_isScriptRunning();
-	void o6_getActorRoom();
-	void o6_getObjectX();
-	void o6_getObjectY();
-	void o6_getObjectOldDir();
-	void o6_getObjectNewDir();
-	void o6_getActorWalkBox();
-	void o6_getActorCostume();
-	void o6_findInventory();
-	void o6_getInventoryCount();
-	void o6_getVerbFromXY();
-	void o6_beginOverride();
-	void o6_endOverride();
-	void o6_setObjectName();
-	void o6_isSoundRunning();
-	void o6_setBoxFlags();
-	void o6_createBoxMatrix();
-	void o6_resourceRoutines();
-	void o6_roomOps();
-	void o6_actorSet();
-	void o6_verbOps();
-	void o6_getActorFromXY();
-	void o6_findObject();
-	void o6_pseudoRoom();
-	void o6_getActorElevation();
-	void o6_getVerbEntrypoint();
-	void o6_arrayOps();
-	void o6_saveRestoreVerbs();
-	void o6_drawBox();
-	void o6_getActorWidth();
-	void o6_wait();
-	void o6_getActorScaleX();
-	void o6_getActorAnimCounter1();
-	void o6_soundKludge();
-	void o6_isAnyOf();
-	void o6_quitPauseRestart();
-	void o6_isActorInBox();
-	void o6_delay();
-	void o6_delayLonger();
-	void o6_delayVeryLong();
-	void o6_stopSentence();
-	void o6_print_0();
-	void o6_print_1();
-	void o6_print_2();
-	void o6_print_3();
-	void o6_printActor();
-	void o6_printEgo();
-	void o6_talkActor();
-	void o6_talkEgo();
-	void o6_dim();
-	void o6_dummy();
-	void o6_runVerbCodeQuick();
-	void o6_runScriptQuick();
-	void o6_dim2();
-	void o6_abs();
-	void o6_distObjectObject();
-	void o6_distObjectPt();
-	void o6_distPtPt();
-	void o6_miscOps();
-	void o6_delayFrames();
-	void o6_pickOneOf();
-	void o6_pickOneOfDefault();
-	void o6_jumpToScript();
-	void o6_isRoomScriptRunning();
-	void o6_kernelFunction();
-	void o6_getAnimateVariable();
-	void o6_drawBlastObject();
-	void o6_getActorPriority();
-	void o6_unknownCD();
-	void o6_bor();
-	void o6_band();
-};
-
-class Scumm_v7 : public Scumm_v6
-{
-public:
-	Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {}
-
-protected:
-	virtual void setupScummVars();
 };
 
 // This is a constant lookup table of reverse bit masks

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.1
retrieving revision 2.2
diff -u -d -r2.1 -r2.2
--- scummvm.cpp	21 Dec 2002 23:27:46 -0000	2.1
+++ scummvm.cpp	22 Dec 2002 21:58:15 -0000	2.2
@@ -27,6 +27,7 @@
 #include "debugger.h"
 #include "dialogs.h"
 #include "imuse.h"
+#include "intern.h"
 #include "object.h"
 #include "resource.h"
 #include "sound.h"
@@ -61,6 +62,8 @@
 		engine = new Scumm_v3(detector, syst);
 	else if (detector->_features & GF_SMALL_HEADER)	// this forces loomCD as v4
 		engine = new Scumm_v4(detector, syst);
+	else if (detector->_features & GF_AFTER_V8)
+		engine = new Scumm_v8(detector, syst);
 	else if (detector->_features & GF_AFTER_V7)
 		engine = new Scumm_v7(detector, syst);
 	else if (detector->_features & GF_AFTER_V6)	// this forces SamnmaxCD as v6

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- vars.cpp	21 Dec 2002 12:34:17 -0000	1.6
+++ vars.cpp	22 Dec 2002 21:58:16 -0000	1.7
@@ -23,6 +23,7 @@
 
 #include "stdafx.h"
 #include "scumm.h"
+#include "intern.h"
 
 void Scumm::setupScummVars()
 {





More information about the Scummvm-git-logs mailing list