diff options
| -rw-r--r-- | engines/gob/game.h | 7 | ||||
| -rw-r--r-- | engines/gob/game_v6.cpp | 76 | ||||
| -rw-r--r-- | engines/gob/inter.h | 1 | ||||
| -rw-r--r-- | engines/gob/inter_v6.cpp | 29 | ||||
| -rw-r--r-- | engines/gob/parse.cpp | 11 | 
5 files changed, 120 insertions, 4 deletions
diff --git a/engines/gob/game.h b/engines/gob/game.h index 2a4aae1190..421f7c1de5 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -111,8 +111,9 @@ public:  	int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0,  			int16 *pButtons = 0, char handleMouse = 0);  	void start(void); -	void totSub(int8 flags, const char *newTotFile); -	void switchTotSub(int16 index, int16 skipPlay); + +	virtual void totSub(int8 flags, const char *newTotFile); +	virtual void switchTotSub(int16 index, int16 skipPlay);  	void freeCollision(int16 id); @@ -300,6 +301,8 @@ protected:  class Game_v6 : public Game_v2 {  public: +	virtual void totSub(int8 flags, const char *newTotFile); +  	virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,  			uint16 right, uint16 bottom, int16 flags, int16 key,  			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index d6c5163eba..df5795fd20 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -39,6 +39,82 @@ Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) {  	_dword_63E44 = 0;  } +// flagbits: 5 = freeInterVariables, 6 = skipPlay +void Game_v6::totSub(int8 flags, const char *newTotFile) { +	int8 curBackupPos; + +	if ((flags == 16) || (flags == 17)) +		warning("Urban Stub: Game_v6::totSub(), flags == %d", flags); + +	if (_backupedCount >= 5) +		return; + +	_cursorHotspotXArray[_backupedCount] = _vm->_draw->_cursorHotspotXVar; +	_cursorHotspotYArray[_backupedCount] = _vm->_draw->_cursorHotspotYVar; +	_totTextDataArray[_backupedCount] = _totTextData; +	_totFileDataArray[_backupedCount] = _totFileData; +	_totResourceTableArray[_backupedCount] = _totResourceTable; +	_extTableArray[_backupedCount] = _extTable; +	_extHandleArray[_backupedCount] = _extHandle; +	_imFileDataArray[_backupedCount] = _imFileData; +	_variablesArray[_backupedCount] = _vm->_inter->_variables; +	strcpy(_curTotFileArray[_backupedCount], _curTotFile); + +	curBackupPos = _curBackupPos; +	_backupedCount++; +	_curBackupPos = _backupedCount; + +	_totTextData = 0; +	_totFileData = 0; +	_totResourceTable = 0; + +	if (flags & 0x80) +		warning("Urban Stub: Game_v6::totSub(), flags & 0x80"); + +	if (flags & 5) +		_vm->_inter->_variables = 0; + +	strncpy0(_curTotFile, newTotFile, 9); +	strcat(_curTotFile, ".TOT"); + +	if (_vm->_inter->_terminate != 0) +		return; + +	pushCollisions(0); + +	if (flags & 6) +		playTot(-1); +	else +		playTot(0); + +	if (_vm->_inter->_terminate < 2) +		_vm->_inter->_terminate = 0; + +	clearCollisions(); +	popCollisions(); + +	if ((flags & 5) && _vm->_inter->_variables) { +		_vm->_inter->delocateVars(); +	} + +	_backupedCount--; +	_curBackupPos = curBackupPos; + +	_vm->_draw->_cursorHotspotXVar = _cursorHotspotXArray[_backupedCount]; +	_vm->_draw->_cursorHotspotYVar = _cursorHotspotYArray[_backupedCount]; +	_totTextData = _totTextDataArray[_backupedCount]; +	_totFileData = _totFileDataArray[_backupedCount]; +	_totResourceTable = _totResourceTableArray[_backupedCount]; +	_extTable = _extTableArray[_backupedCount]; +	_extHandle = _extHandleArray[_backupedCount]; +	_imFileData = _imFileDataArray[_backupedCount]; +	_vm->_inter->_variables = _variablesArray[_backupedCount]; +	strcpy(_curTotFile, _curTotFileArray[_backupedCount]); +	strcpy(_curExtFile, _curTotFile); +	_curExtFile[strlen(_curExtFile) - 4] = '\0'; +	strcat(_curExtFile, ".EXT"); +} +  int16 Game_v6::addNewCollision(int16 id, uint16 left, uint16 top,  		uint16 right, uint16 bottom, int16 flags, int16 key,  		uint16 funcEnter, uint16 funcLeave, uint16 funcSub) { diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 6bfdb28f77..d6793a2fb3 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -624,6 +624,7 @@ protected:  	virtual const char *getOpcodeFuncDesc(byte i, byte j);  	virtual const char *getOpcodeGoblinDesc(int i); +	void o6_totSub();  	void o6_playVmdOrMusic();  	bool o6_loadCursor(OpFuncParams ¶ms); diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index fd8c6fcd4d..20186a165d 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -133,7 +133,7 @@ void Inter_v6::setupOpcodes() {  		{NULL, ""},  		{NULL, ""},  		/* 40 */ -		OPCODE(o2_totSub), +		OPCODE(o6_totSub),  		OPCODE(o2_switchTotSub),  		OPCODE(o2_copyVars),  		OPCODE(o2_pasteVars), @@ -653,6 +653,33 @@ const char *Inter_v6::getOpcodeGoblinDesc(int i) {  	return "";  } +void Inter_v6::o6_totSub() { +	char totFile[14]; +	byte length; +	int flags; +	int i; + +	length = *_vm->_global->_inter_execPtr++; +	if ((length & 0x7F) > 13) +		error("Length in o2_totSub is greater than 13 (%d)", length); + +	if (length & 0x80) { +		evalExpr(0); +		strcpy(totFile, _vm->_global->_inter_resStr); +	} else { +		for (i = 0; i < length; i++) +			totFile[i] = (char) *_vm->_global->_inter_execPtr++; +		totFile[i] = 0; +	} + +	flags = *_vm->_global->_inter_execPtr++; + +	if (flags & 0x40) +		warning("Urban Stub: o6_totSub(), flags & 0x40"); + +	_vm->_game->totSub(flags, totFile); +} +  void Inter_v6::o6_playVmdOrMusic() {  	char fileName[128];  	int16 x, y; diff --git a/engines/gob/parse.cpp b/engines/gob/parse.cpp index ad1f53bb6f..b3ce12ce9d 100644 --- a/engines/gob/parse.cpp +++ b/engines/gob/parse.cpp @@ -85,8 +85,14 @@ void Parse::skipExpr(char stopToken) {  	while (1) {  		operation = *_vm->_global->_inter_execPtr++; -		if ((operation >= 16) && (operation <= 29)) { +		if ((operation >= 14) && (operation <= 29)) {  			switch (operation) { +			case 14: +				_vm->_global->_inter_execPtr += 4; +				if (*_vm->_global->_inter_execPtr == 97) +					_vm->_global->_inter_execPtr++; +				break; +  			case 17:  			case 18:  			case 20: @@ -116,6 +122,9 @@ void Parse::skipExpr(char stopToken) {  				}  				break; +			case 15: +				_vm->_global->_inter_execPtr += 2; +  			case 16:  			case 26:  			case 27:  | 
