[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.22,2.23 object.cpp,1.33,1.34 script_v6.cpp,1.24,1.25 script_v8.cpp,2.56,2.57 scumm.h,1.111,1.112 sound.cpp,1.55,1.56 vars.cpp,1.15,1.16

Max Horn fingolfin at users.sourceforge.net
Thu Dec 26 13:51:03 CET 2002


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

Modified Files:
	intern.h object.cpp script_v6.cpp script_v8.cpp scumm.h 
	sound.cpp vars.cpp 
Log Message:
map V8 talk opcodes to the right V6 opcodes; however, talking still locks up after the first sentence is uttered (looking into that now); various cleanup; added a guess at VAR_EGO (based on what cmidec says is the 'default_actor')

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- intern.h	26 Dec 2002 08:06:33 -0000	2.22
+++ intern.h	26 Dec 2002 21:50:13 -0000	2.23
@@ -209,7 +209,7 @@
 
 	int popRoomAndObj(int *room);
 
-	void decodeParseString(int a, int b);
+	virtual void decodeParseString(int a, int b);
 	int getStackList(int *args, uint maxnum);
 
 	/* Version 6 script opcodes */
@@ -332,8 +332,8 @@
 	void o6_quitPauseRestart();
 	void o6_isActorInBox();
 	void o6_delay();
-	void o6_delayLonger();
-	void o6_delayVeryLong();
+	void o6_delaySeconds();
+	void o6_delayMinutes();
 	void o6_stopSentence();
 	void o6_print_0();
 	void o6_print_1();
@@ -404,7 +404,7 @@
 	virtual int readVar(uint var);
 	virtual void writeVar(uint var, int value);
 
-	void decodeParseString(int m, int n);
+	virtual void decodeParseString(int m, int n);
 
 	/* Version 8 script opcodes */
 	void o8_mod();
@@ -418,9 +418,6 @@
 	void o8_printDebug();
 	void o8_printSystem();
 	void o8_blastText();
-
-	void o8_talkActor();
-	void o8_talkActorSimple();
 
 	void o8_cursorCommand();
 	void o8_resourceRoutines();

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- object.cpp	26 Dec 2002 20:37:48 -0000	1.33
+++ object.cpp	26 Dec 2002 21:50:13 -0000	1.34
@@ -490,7 +490,8 @@
 	byte *room, *searchptr;
 	RoomHeader *roomhdr;
 
-	CHECK_HEAP room = getResourceAddress(rtRoom, _roomResource);
+	CHECK_HEAP
+	room = getResourceAddress(rtRoom, _roomResource);
 	roomhdr = (RoomHeader *)findResourceData(MKID('RMHD'), room);
 
 	_numObjectsInRoom = READ_LE_UINT16(&(roomhdr->old.numObjects));
@@ -825,7 +826,8 @@
 
 	debug(1, "Adding object %d from room %d into inventory", obj, room);
 
-	CHECK_HEAP if (whereIsObject(obj) == WIO_FLOBJECT) {
+	CHECK_HEAP
+	if (whereIsObject(obj) == WIO_FLOBJECT) {
 		i = getObjectIndex(obj);
 		ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
 		size = READ_BE_UINT32_UNALIGNED(ptr + 4);

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- script_v6.cpp	26 Dec 2002 00:21:19 -0000	1.24
+++ script_v6.cpp	26 Dec 2002 21:50:13 -0000	1.25
@@ -264,8 +264,8 @@
 		OPCODE(o6_isActorInBox),
 		/* B0 */
 		OPCODE(o6_delay),
-		OPCODE(o6_delayLonger),
-		OPCODE(o6_delayVeryLong),
+		OPCODE(o6_delaySeconds),
+		OPCODE(o6_delayMinutes),
 		OPCODE(o6_stopSentence),
 		/* B4 */
 		OPCODE(o6_print_0),
@@ -2188,22 +2188,27 @@
 
 void Scumm_v6::o6_delay()
 {
+	// FIXME - what exactly are we measuring here? In order for the other two
+	// delay functions to be right, it should be 1/60th of a second. But for
+	// CMI it would seem this should delay for 1/10th of a second...
 	uint32 delay = (uint16)pop();
 	vm.slot[_currentScript].delay = delay;
 	vm.slot[_currentScript].status = 1;
 	o6_breakHere();
 }
 
-void Scumm_v6::o6_delayLonger()
+void Scumm_v6::o6_delaySeconds()
 {
+	// FIXME - are we really measuring minutes here?
 	uint32 delay = (uint16)pop() * 60;
 	vm.slot[_currentScript].delay = delay;
 	vm.slot[_currentScript].status = 1;
 	o6_breakHere();
 }
 
-void Scumm_v6::o6_delayVeryLong()
+void Scumm_v6::o6_delayMinutes()
 {
+	// FIXME - are we really measuring minutes here?
 	uint32 delay = (uint16)pop() * 3600;
 	vm.slot[_currentScript].delay = delay;
 	vm.slot[_currentScript].status = 1;
@@ -2254,7 +2259,7 @@
 	_actorToPrintStrFor = pop();
 	_messagePtr = _scriptPointer;
 
-	if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
+	if (((_gameId == GID_DIG) || (_features & GF_AFTER_V8)) && (_messagePtr[0] == '/')) {
 		char pointer[20];
 		int i, j;
 
@@ -2268,7 +2273,7 @@
 
 		// Stop any talking that's still going on
 		if (_sound->_talkChannel > -1)
-			_mixer->stop(_sound->_talkChannel);		
+			_mixer->stop(_sound->_talkChannel);
 
 		_sound->_talkChannel = _sound->playBundleSound(pointer);
 		_messagePtr = _transText;
@@ -2283,34 +2288,8 @@
 
 void Scumm_v6::o6_talkEgo()
 {
-	_actorToPrintStrFor = (unsigned char)_vars[VAR_EGO];
-	_messagePtr = _scriptPointer;
-
-	if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
-		char pointer[20];
-		int i, j;
-
-		_scriptPointer += resStrLen((char*)_scriptPointer) + 1;
-		translateText(_messagePtr, _transText);
-		for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
-			if (_messagePtr[i] != '/')
-				pointer[j++] = _messagePtr[i];
-		}
-		pointer[j] = 0;
-
-		// Stop any talking that's still going on
-		if (_sound->_talkChannel > -1)
-			_mixer->stop(_sound->_talkChannel);
-
-		_sound->_talkChannel = _sound->playBundleSound(pointer);
-		_messagePtr = _transText;
-		setStringVars(0);
-		actorTalk();
-	} else {
-		setStringVars(0);
-		actorTalk();
-		_scriptPointer = _messagePtr;
-	}
+	push(_vars[VAR_EGO]);
+	o6_talkActor();
 }
 
 void Scumm_v6::o6_dim()

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.56
retrieving revision 2.57
diff -u -d -r2.56 -r2.57
--- script_v8.cpp	26 Dec 2002 17:30:48 -0000	2.56
+++ script_v8.cpp	26 Dec 2002 21:50:13 -0000	2.57
@@ -175,10 +175,10 @@
 		/* 68 */
 		OPCODE(o6_delayFrames),
 		OPCODE(o8_wait),
-		OPCODE(o6_delay),			// FIXME - is the delay period right?
-		OPCODE(o6_delayLonger),		// FIXME - is the delay period right?
+		OPCODE(o6_delay),
+		OPCODE(o6_delaySeconds),
 		/* 6C */
-		OPCODE(o6_delayVeryLong),	// FIXME - is the delay period right?
+		OPCODE(o6_delayMinutes),
 		OPCODE(o6_writeWordVar),
 		OPCODE(o6_wordVarInc),
 		OPCODE(o6_wordVarDec),
@@ -200,7 +200,7 @@
 		/* 7C */
 		OPCODE(o6_stopScript),
 		OPCODE(o6_jumpToScript),		// FIXME - is this right? "O_CHAIN_SCRIPT"
-		OPCODE(o6_dummy),
+		OPCODE(o6_dummy),				// FIXME - O_RETURN ? WTF is this, why don't they use the stack?
 		OPCODE(o6_startObject),
 		/* 80 */
 		OPCODE(o6_stopObjectScript),	// FIXME - is this right?
@@ -221,11 +221,11 @@
 		OPCODE(o6_panCameraTo),
 		OPCODE(o6_actorFollowCamera),
 		OPCODE(o6_setCameraAt),
-		OPCODE(o8_talkActor),
+		OPCODE(o6_printActor),
 		/* 90 */
-		OPCODE(o6_invalid),
-		OPCODE(o8_talkActorSimple),
-		OPCODE(o6_invalid),
+		OPCODE(o6_printEgo),
+		OPCODE(o6_talkActor),
+		OPCODE(o6_talkEgo),
 		OPCODE(o8_printLine),
 		/* 94 */
 		OPCODE(o8_printCursor),
@@ -269,7 +269,7 @@
 		OPCODE(o8_system),
 		/* B4 */
 		OPCODE(o6_saveRestoreVerbs),
-		OPCODE(o6_invalid),
+		OPCODE(o6_setObjectName),
 		OPCODE(o6_invalid),
 		OPCODE(o6_drawBox),
 		/* B8 */
@@ -293,7 +293,7 @@
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
 		/* C8 */
-		OPCODE(o6_startScript),
+		OPCODE(o6_startScript),	// FIXME - this function returns something in V8 !
 		OPCODE(o6_startObject),
 		OPCODE(o6_pickOneOf),
 		OPCODE(o6_pickOneOfDefault),
@@ -592,7 +592,7 @@
 				_mixer->stop(_sound->_talkChannel);
 
 			// FIXME: no 'digvoice.bun' in COMI
-			// _sound->_talkChannel = _sound->playBundleSound(pointer);
+			_sound->_talkChannel = _sound->playBundleSound(pointer);
 
 			_messagePtr = _transText;
 			_msgPtrToAdd = (byte *)buffer;
@@ -693,8 +693,8 @@
 		error("o8_wait: default case %d", subOp);
 	}
 
-        _scriptPointer -= 2;
-        o6_breakHere();
+	_scriptPointer -= 2;
+	o6_breakHere();
 }
 
 void Scumm_v8::o8_dim()
@@ -790,62 +790,6 @@
 	}
 }
 
-void Scumm_v8::o8_talkActor() {
-	int _actorToPrintStrFor = pop();
-
-	_messagePtr = _scriptPointer;
-	if (_messagePtr[0] == '/') {
-		char pointer[20];
-		int i, j;
-
-		_scriptPointer += resStrLen((char*)_scriptPointer)+ 1;
-		translateText(_messagePtr, _transText);
-		for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
-			if (_messagePtr[i] != '/')
-				pointer[j++] = _messagePtr[i];
-       		}
-		pointer[j] = 0;
-
-		_messagePtr = _transText;
-                //setStringVars(0);
-                //actorTalk(); // FIXME - This crashes
-        } else {
-                //setStringVars(0);
-                //actorTalk(); // FIXME - This crashes
-                _scriptPointer = _messagePtr;
-        }
-
-	printf("o8_talkActor(%d, %s)\n", _actorToPrintStrFor, _messagePtr);
-}
-
-void Scumm_v8::o8_talkActorSimple() {
-	int _actorToPrintStrFor = pop();
-
-	_messagePtr = _scriptPointer;
-	if (_messagePtr[0] == '/') {
-		char pointer[20];
-		int i, j;
-
-		_scriptPointer += resStrLen((char*)_scriptPointer)+ 1;
-		translateText(_messagePtr, _transText);
-		for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
-			if (_messagePtr[i] != '/')
-				pointer[j++] = _messagePtr[i];
-       		}
-		pointer[j] = 0;
-
-		_messagePtr = _transText;
-                //setStringVars(0);
-                //actorTalk(); // FIXME - This crashes
-        } else {
-                //setStringVars(0);
-                //actorTalk(); // FIXME - This crashes
-                _scriptPointer = _messagePtr;
-        }
-
-	printf("o8_talkActorSimple(%d, %s)\n", _actorToPrintStrFor, _messagePtr);
-}
-
 void Scumm_v8::o8_printLine()
 {
 	// FIXME
@@ -1336,16 +1280,16 @@
 
 void Scumm_v8::o8_startVideo()
 {
-        char dirName[255];
+	char dirName[255];
 	int len = resStrLen((char*)_scriptPointer);
-
-        sprintf(dirName, "%s/resource/", getGameDataPath());
-        warning("o8_startVideo(%s/%s)\n", dirName, (char*)_scriptPointer);
-
-        ScummRenderer * sr = new ScummRenderer(this, 1000/14);
-        SmushPlayer * sp = new SmushPlayer(sr);
-        //sp->play((char*)_scriptPointer, dirName);
-
+	
+	sprintf(dirName, "%s/resource/", getGameDataPath());
+	warning("o8_startVideo(%s/%s)\n", dirName, (char*)_scriptPointer);
+	
+	//ScummRenderer * sr = new ScummRenderer(this, 1000/14);
+	//SmushPlayer * sp = new SmushPlayer(sr);
+	//sp->play((char*)_scriptPointer, dirName);
+	
 	_scriptPointer += len + 1;
 }
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- scumm.h	26 Dec 2002 20:37:49 -0000	1.111
+++ scumm.h	26 Dec 2002 21:50:13 -0000	1.112
@@ -510,7 +510,7 @@
 	bool isResourceLoaded(int type, int index);
 	void initRoomSubBlocks();
 	void loadRoomObjects();
-    void loadRoomObjectsSmall();
+	void loadRoomObjectsSmall();
 	void readArrayFromIndexFile();
 	void readMAXS();
 	bool isGlobInMemory(int type, int index);
@@ -783,7 +783,7 @@
 	BlastObject _enqueuedObjects[128];
 
 	void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
-                       int objectHeight, int scaleX, int scaleY, int image, int mode);
+	                   int objectHeight, int scaleX, int scaleY, int image, int mode);
 	void clearEnqueue() { _enqueuePos = 0; }
 	void drawBlastObjects();
 	void drawBlastObject(BlastObject *eo);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- sound.cpp	25 Dec 2002 14:46:39 -0000	1.55
+++ sound.cpp	26 Dec 2002 21:50:13 -0000	1.56
@@ -1106,8 +1106,18 @@
 
 int Sound::playBundleSound(char *sound) {
 	byte * ptr;
+	bool result;
+	
+	if (_scumm->_gameId == GID_CMI)
+		// FIXME: HACK! There are actually two voice files in COMI... I dunno how to do this
+		// right, though :-/
+		result = _scumm->_bundle->openVoiceFile("voxdisk1.bun", _scumm->getGameDataPath());
+	else if (_scumm->_gameId == GID_DIG)
+		result = _scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath());
+	else
+		error("Don't know which bundle file to load");
 
-	if (_scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath()) == false) {
+	if (!result) {
 		return -1;
 	}
 

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- vars.cpp	26 Dec 2002 10:47:57 -0000	1.15
+++ vars.cpp	26 Dec 2002 21:50:13 -0000	1.16
@@ -252,6 +252,8 @@
 	VAR_CAMERA_ACCEL_X = 109;
 	VAR_CAMERA_ACCEL_Y = 110;
 
+	VAR_EGO = 126;
+
 	VAR_DEBUGMODE = 130;
 	
 	// var 266, 290 and 301 have something to do with cursor images, since various scripts





More information about the Scummvm-git-logs mailing list