[Scummvm-cvs-logs] SF.net SVN: scummvm: [29833] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed Dec 12 09:49:10 CET 2007


Revision: 29833
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29833&view=rev
Author:   dreammaster
Date:     2007-12-12 00:49:09 -0800 (Wed, 12 Dec 2007)

Log Message:
-----------
Redeveloped the processing of language item article prefixes to match how the original handles the various languages

Modified Paths:
--------------
    scummvm/trunk/engines/lure/res_struct.h
    scummvm/trunk/engines/lure/strings.cpp
    scummvm/trunk/engines/lure/surface.cpp
    scummvm/trunk/engines/lure/surface.h

Modified: scummvm/trunk/engines/lure/res_struct.h
===================================================================
--- scummvm/trunk/engines/lure/res_struct.h	2007-12-12 08:47:10 UTC (rev 29832)
+++ scummvm/trunk/engines/lure/res_struct.h	2007-12-12 08:49:09 UTC (rev 29833)
@@ -791,8 +791,9 @@
 enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28, 
 	S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33, 
 	S_ACTION_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38, S_FINISH = 39, 
-	S_CONFIRM_YN = 40, S_ARTICLE_LIST = 41, 
-	S_YOU_ARE_CARRYING = 49, S_INV_NOTHING = 50, S_YOU_HAVE = 51, S_GROAT = 52, S_GROATS = 53};
+	S_CONFIRM_YN = 40, S_YOU_ARE_CARRYING = 41, S_INV_NOTHING = 42, S_YOU_HAVE = 43, 
+	S_GROAT = 44, S_GROATS = 45,
+	S_ARTICLE_LIST = 46}; 
 
 class StringList {
 private:

Modified: scummvm/trunk/engines/lure/strings.cpp
===================================================================
--- scummvm/trunk/engines/lure/strings.cpp	2007-12-12 08:47:10 UTC (rev 29832)
+++ scummvm/trunk/engines/lure/strings.cpp	2007-12-12 08:49:09 UTC (rev 29833)
@@ -204,7 +204,7 @@
 			// Copy over hotspot or action 
 			ch = readCharacter();
 			const char *p = (ch == '1') ? hotspotName : characterName;
-			int article = !includeArticles ? 0 : ((ch == 1) ? hotspotArticle : characterArticle);
+			int article = !includeArticles ? 0 : ((ch == '1') ? hotspotArticle : characterArticle);
 
 			if (p != NULL) {
 				if (article > 0) {

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2007-12-12 08:47:10 UTC (rev 29832)
+++ scummvm/trunk/engines/lure/surface.cpp	2007-12-12 08:49:09 UTC (rev 29833)
@@ -524,6 +524,78 @@
 
 /*--------------------------------------------------------------------------*/
 
+const uint16 spanish_pre_e1_type_tl[] = {0x8000, 4, 0x4000, 5, 0x2000, 6, 0xc000, 7, 0, 0};
+const uint16 spanish_others_tl[]      = {0x8000, 0, 0x4000, 1, 0x2000, 2, 0xc000, 3, 0, 0};
+
+const uint16 german_pre_k_type[]    = {106, 0};
+const uint16 german_pre_k_type_tl[] = {0x8000, 0, 0xc000, 0, 0x4000, 1, 0xa000, 1, 0x2000, 2, 0, 0};
+const uint16 german_pre_d[]         = {128, 0};
+const uint16 german_pre_d_tl[]		= {0x8000, 6, 0x4000, 4, 0xa000, 4, 0x2000, 5, 0xc000, 6, 0, 0};
+const uint16 german_pre_d_type[]    = {158, 236, 161, 266, 280, 287, 286, 294, 264, 0};
+const uint16 german_pre_d_type_tl[] = {0x8000, 3, 0x4000, 4, 0xa000, 4, 0x2000, 5, 0xc000, 6, 0, 0};
+const uint16 german_pre_e_type[]    = {160, 0};
+const uint16 german_pre_e_type_tl[] = {0x8000, 7, 0xc000, 7, 0x4000, 8, 0xa000, 8, 0x2000, 9, 0, 0};
+
+struct GermanLanguageArticle {
+	const uint16 *messageList;
+	const uint16 *translations;
+};
+
+const GermanLanguageArticle germanArticles[] = {
+	{&german_pre_k_type[0], &german_pre_k_type_tl[0]}, 
+	{&german_pre_d[0], &german_pre_d_tl[0]},
+	{&german_pre_d_type[0], &german_pre_d_type_tl[0]}, 
+	{&german_pre_e_type[0], &german_pre_e_type_tl[0]}
+};
+
+
+int TalkDialog::getArticle(uint16 msgId, uint16 objId) {
+	Common::Language language = LureEngine::getReference().getLanguage();
+	int id = objId & 0xe000;
+
+	if (language == DE_DEU) {
+		// Special handling for German language
+
+		for (int sectionIndex = 0; sectionIndex < 4; ++sectionIndex) {
+			// Scan through the list of messages for this section
+			bool msgFound = false;
+			for (const uint16 *msgPtr = germanArticles[sectionIndex].messageList; *msgPtr != 0; ++msgPtr) {
+				msgFound = *msgPtr == msgId;
+				if (msgFound) break;
+			}
+
+			if (msgFound) {
+				// Scan against possible bit combinations
+				for (const uint16 *p = germanArticles[sectionIndex].translations; *p != 0; p += 2) {
+					if (*p == id) 
+						// Return the article index to use
+						return *++p;
+				}
+
+				return 0;
+			}
+		}
+		
+
+		return 0;
+
+	} else if (language == ES_ESP) {
+		// Special handling for Spanish langugae
+		const uint16 *tlData = (msgId == 158) ? spanish_pre_e1_type_tl : spanish_others_tl;
+		
+		// Scan through the list of article bitflag mappings
+		for (const uint16 *p = tlData; *p != 0; p += 2) {
+			if (*p == id) 
+				// Return the article index to use
+				return *++p;
+		}
+
+		return 0;
+	}
+
+	return (id >> 13) + 1;
+}
+
 TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) {
 	debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d", 
 		characterId, destCharacterId, activeItemId, descId);
@@ -532,7 +604,7 @@
 	char srcCharName[MAX_DESC_SIZE];
 	char destCharName[MAX_DESC_SIZE];
 	char itemName[MAX_DESC_SIZE];
-	int characterArticle, hotspotArticle = 3;
+	int characterArticle, hotspotArticle = 0;
 
 	_characterId = characterId;
 	_destCharacterId = destCharacterId;
@@ -547,7 +619,7 @@
 	assert(talkingChar);
 
 	strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
-	characterArticle = (talkingChar->nameId >> 13) + 1;
+	characterArticle = getArticle(descId, talkingChar->nameId);
 
 	strcpy(destCharName, "");
 	if (destCharacter != NULL)
@@ -555,7 +627,7 @@
 	strcpy(itemName, "");
 	if (itemHotspot != NULL) {
 		strings.getString(itemHotspot->nameId & 0x1fff, itemName);
-		hotspotArticle = (itemHotspot->nameId >> 13) - 1;
+		hotspotArticle = getArticle(descId, itemHotspot->nameId);
 	}
 
 	strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);

Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h	2007-12-12 08:47:10 UTC (rev 29832)
+++ scummvm/trunk/engines/lure/surface.h	2007-12-12 08:49:09 UTC (rev 29833)
@@ -98,6 +98,8 @@
 	uint16 _destCharacterId;
 	uint16 _activeItemId;
 	uint16 _descId;
+
+	int getArticle(uint16 msgId, uint16 objId);
 public:
 	TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
 	~TalkDialog();


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