diff options
| -rw-r--r-- | engines/gob/draw_v2.cpp | 12 | ||||
| -rw-r--r-- | engines/gob/game.cpp | 15 | ||||
| -rw-r--r-- | engines/gob/game.h | 1 | ||||
| -rw-r--r-- | engines/gob/game_v2.cpp | 4 | ||||
| -rw-r--r-- | engines/gob/global.cpp | 1 | ||||
| -rw-r--r-- | engines/gob/global.h | 1 | ||||
| -rw-r--r-- | engines/gob/gob.cpp | 1 | 
7 files changed, 28 insertions, 7 deletions
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index c703888e0d..49069c2861 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -79,6 +79,12 @@ void Draw_v2::printText(void) {  	if ((_vm->_game->_totTextData == 0) || (_vm->_game->_totTextData->dataPtr == 0))  		return; +	if (_vm->_global->_languageWanted != _vm->_global->_language) { +		warning("Your game version doesn't support the requested language, " +				"using the first one available (%d)", _vm->_global->_language); +		_vm->_global->_languageWanted = _vm->_global->_language; +	} +  	size = _vm->_game->_totTextData->items[index].size;  	dataPtr = _vm->_game->_totTextData->dataPtr + _vm->_game->_totTextData->items[index].offset;  	ptr = dataPtr; @@ -652,6 +658,12 @@ void Draw_v2::spriteOperation(int16 operation) {  		if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) {  			if (_fonts[_fontIndex]->extraData == 0) {  				if (((int8) _textToPrint[0]) == -1) { +					if (_vm->_global->_languageWanted != _vm->_global->_language) { +						warning("Your game version doesn't support the requested language, " +								"using the first one available (%d)", +								_vm->_global->_language); +						_vm->_global->_languageWanted = _vm->_global->_language; +					}  					dataBuf = _vm->_game->_totTextData->dataPtr + _textToPrint[1] + 1;  					len = *dataBuf++;  					for (i = 0; i < len; i++) { diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 1e9354f2fd..8549081297 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -54,6 +54,8 @@ Game::Game(GobEngine *vm) : _vm(vm) {  	_extHandle = 0;  	_collisionAreas = 0;  	_shouldPushColls = 0; + +	_foundTotLoc = false;  	_totTextData = 0;  	// Collisions stack @@ -690,28 +692,29 @@ int16 Game::openLocTextFile(char *locTextFile, int language) {  }  char *Game::loadLocTexts(void) { -	static bool found = false;  	char locTextFile[20];  	int16 handle;  	int i;  	strcpy(locTextFile, _curTotFile); -	handle = openLocTextFile(locTextFile, _vm->_global->_language); -	if ((handle < 0) && !found) { +	handle = openLocTextFile(locTextFile, _vm->_global->_languageWanted); +	if (handle >= 0) { +		_foundTotLoc = true; +		_vm->_global->_language = _vm->_global->_languageWanted; +	} +	else if (!_foundTotLoc) {  		for (i = 0; i < 10; i++) {  			handle = openLocTextFile(locTextFile, i);  			if (handle >= 0) { -				warning("Your game version doesn't support the requested language, using the first one available (%d)", i);  				_vm->_global->_language = i; -				found = true;  				break;  			}  		}  	} +	debugC(1, kDebugFileIO, "Using language %d for %s", _vm->_global->_language, _curTotFile);  	if (handle >= 0) { -		found = true;  		_vm->_dataio->closeData(handle);  		return _vm->_dataio->getData(locTextFile);  	} diff --git a/engines/gob/game.h b/engines/gob/game.h index 3bc60fc818..99001c1a36 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -137,6 +137,7 @@ public:  	Collision *_collisionAreas;  	Collision *_collStack[5]; +	bool _foundTotLoc;  	TotTextTable *_totTextData;  	char _curTotFile[14]; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 41cf82fae7..ab9a446ab2 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -141,8 +141,10 @@ void Game_v2::playTot(int16 skipPlay) {  				if (READ_LE_UINT32(filePtr) == 0) {  					_totTextData->dataPtr = loadLocTexts();  					totTextLoc = true; -				} else +				} else {  					_totTextData->dataPtr = (_totFileData + READ_LE_UINT32((char *)_totFileData + 0x30)); +					_vm->_global->_language = _vm->_global->_languageWanted; +				}  				_totTextData->items = 0;  				if (_totTextData->dataPtr != 0) { diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 9fe972b811..5951f65489 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -54,6 +54,7 @@ Global::Global(GobEngine *vm) : _vm(vm) {  	/* Language */  	_disableLangCfg = 0x8000;  	_language = 0x8000; +	_languageWanted = 0x8000;  	/* Timer variables */  	_startTime = 0; diff --git a/engines/gob/global.h b/engines/gob/global.h index 1d567ce48f..742863e705 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -87,6 +87,7 @@ public:  	uint16 _disableLangCfg;  	uint16 _language; +	uint16 _languageWanted;  	// Timer variables  	int32 _startTime; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 59666dc146..e278217b87 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -694,6 +694,7 @@ int GobEngine::init() {  		_global->_language = 2;  		break;  	} +	_global->_languageWanted = _global->_language;  	// FIXME: This is the ugly way of reducing redraw overhead. It works  	//        well for 320x200 but it's unclear how well it will work for  | 
