diff options
| author | Max Horn | 2002-12-26 21:50:13 +0000 | 
|---|---|---|
| committer | Max Horn | 2002-12-26 21:50:13 +0000 | 
| commit | ad7fefd34eb81ab473293c4072432b36608d93aa (patch) | |
| tree | e510c3c891268394cf1659241bf8e079be017c98 | |
| parent | 966d435a19930ae357b333d731f6b70e91b5a351 (diff) | |
| download | scummvm-rg350-ad7fefd34eb81ab473293c4072432b36608d93aa.tar.gz scummvm-rg350-ad7fefd34eb81ab473293c4072432b36608d93aa.tar.bz2 scummvm-rg350-ad7fefd34eb81ab473293c4072432b36608d93aa.zip  | |
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')
svn-id: r6176
| -rw-r--r-- | scumm/intern.h | 11 | ||||
| -rw-r--r-- | scumm/object.cpp | 6 | ||||
| -rw-r--r-- | scumm/script_v6.cpp | 47 | ||||
| -rw-r--r-- | scumm/script_v8.cpp | 100 | ||||
| -rw-r--r-- | scumm/scumm.h | 4 | ||||
| -rw-r--r-- | scumm/sound.cpp | 14 | ||||
| -rw-r--r-- | scumm/vars.cpp | 2 | 
7 files changed, 59 insertions, 125 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index c1659105d8..f26b1fd936 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -209,7 +209,7 @@ protected:  	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 @@ protected:  	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 @@ protected:  	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(); @@ -419,9 +419,6 @@ protected:  	void o8_printSystem();  	void o8_blastText(); -	void o8_talkActor(); -	void o8_talkActorSimple(); -  	void o8_cursorCommand();  	void o8_resourceRoutines();  	void o8_roomOps(); diff --git a/scumm/object.cpp b/scumm/object.cpp index 8af39580f7..f784ccfe95 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -490,7 +490,8 @@ void Scumm::loadRoomObjectsSmall()  	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 @@ void Scumm::addObjectToInventory(uint obj, uint room)  	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); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 088277ccd5..dda2cec7da 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -264,8 +264,8 @@ void Scumm_v6::setupOpcodes()  		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_isActorInBox()  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 @@ void Scumm_v6::o6_talkActor()  	_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 @@ void Scumm_v6::o6_talkActor()  		// 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_talkActor()  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() diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 0284808b8a..2b1e39c6fb 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -175,10 +175,10 @@ void Scumm_v8::setupOpcodes()  		/* 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 @@ void Scumm_v8::setupOpcodes()  		/* 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 @@ void Scumm_v8::setupOpcodes()  		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 @@ void Scumm_v8::setupOpcodes()  		OPCODE(o8_system),  		/* B4 */  		OPCODE(o6_saveRestoreVerbs), -		OPCODE(o6_invalid), +		OPCODE(o6_setObjectName),  		OPCODE(o6_invalid),  		OPCODE(o6_drawBox),  		/* B8 */ @@ -293,7 +293,7 @@ void Scumm_v8::setupOpcodes()  		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 @@ void Scumm_v8::decodeParseString(int m, int n)  				_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 @@ void Scumm_v8::o8_wait()  		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_arrayOps()  	}  } -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_system()  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;  } diff --git a/scumm/scumm.h b/scumm/scumm.h index fd84740f36..50ee8aff45 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -510,7 +510,7 @@ public:  	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 @@ public:  	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); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 867d2095b2..78afbe5fa3 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1106,8 +1106,18 @@ void Sound::bundleMusicHandler(Scumm * scumm) {  int Sound::playBundleSound(char *sound) {  	byte * ptr; - -	if (_scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath()) == false) { +	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 (!result) {  		return -1;  	} diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 9c9c317149..5ad5719fb3 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -252,6 +252,8 @@ void Scumm_v8::setupScummVars()  	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  | 
