[Scummvm-cvs-logs] SF.net SVN: scummvm: [25525] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Feb 12 15:37:28 CET 2007


Revision: 25525
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25525&view=rev
Author:   drmccoy
Date:     2007-02-12 06:37:27 -0800 (Mon, 12 Feb 2007)

Log Message:
-----------
Changed language finding again

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/game.cpp
    scummvm/trunk/engines/gob/game.h
    scummvm/trunk/engines/gob/game_v2.cpp
    scummvm/trunk/engines/gob/global.cpp
    scummvm/trunk/engines/gob/global.h
    scummvm/trunk/engines/gob/gob.cpp

Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2007-02-12 14:37:27 UTC (rev 25525)
@@ -79,6 +79,12 @@
 	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 @@
 		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++) {

Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/game.cpp	2007-02-12 14:37:27 UTC (rev 25525)
@@ -54,6 +54,8 @@
 	_extHandle = 0;
 	_collisionAreas = 0;
 	_shouldPushColls = 0;
+
+	_foundTotLoc = false;
 	_totTextData = 0;
 
 	// Collisions stack
@@ -690,28 +692,29 @@
 }
 
 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);
 	}

Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/game.h	2007-02-12 14:37:27 UTC (rev 25525)
@@ -137,6 +137,7 @@
 	Collision *_collisionAreas;
 	Collision *_collStack[5];
 
+	bool _foundTotLoc;
 	TotTextTable *_totTextData;
 
 	char _curTotFile[14];

Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/game_v2.cpp	2007-02-12 14:37:27 UTC (rev 25525)
@@ -141,8 +141,10 @@
 				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) {

Modified: scummvm/trunk/engines/gob/global.cpp
===================================================================
--- scummvm/trunk/engines/gob/global.cpp	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/global.cpp	2007-02-12 14:37:27 UTC (rev 25525)
@@ -54,6 +54,7 @@
 	/* Language */
 	_disableLangCfg = 0x8000;
 	_language = 0x8000;
+	_languageWanted = 0x8000;
 
 	/* Timer variables */
 	_startTime = 0;

Modified: scummvm/trunk/engines/gob/global.h
===================================================================
--- scummvm/trunk/engines/gob/global.h	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/global.h	2007-02-12 14:37:27 UTC (rev 25525)
@@ -87,6 +87,7 @@
 
 	uint16 _disableLangCfg;
 	uint16 _language;
+	uint16 _languageWanted;
 
 	// Timer variables
 	int32 _startTime;

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2007-02-12 13:37:04 UTC (rev 25524)
+++ scummvm/trunk/engines/gob/gob.cpp	2007-02-12 14:37:27 UTC (rev 25525)
@@ -694,6 +694,7 @@
 		_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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list