aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2007-12-12 08:49:09 +0000
committerPaul Gilbert2007-12-12 08:49:09 +0000
commit2b9859f2ff74291eaffb641c7c9619b0ac5dfb3f (patch)
tree5f014af3c70b0521f9b4679a68be72734f120914
parent34102e197baf8247c25619a176d4c286886028e2 (diff)
downloadscummvm-rg350-2b9859f2ff74291eaffb641c7c9619b0ac5dfb3f.tar.gz
scummvm-rg350-2b9859f2ff74291eaffb641c7c9619b0ac5dfb3f.tar.bz2
scummvm-rg350-2b9859f2ff74291eaffb641c7c9619b0ac5dfb3f.zip
Redeveloped the processing of language item article prefixes to match how the original handles the various languages
svn-id: r29833
-rw-r--r--engines/lure/res_struct.h5
-rw-r--r--engines/lure/strings.cpp2
-rw-r--r--engines/lure/surface.cpp78
-rw-r--r--engines/lure/surface.h2
4 files changed, 81 insertions, 6 deletions
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index d0851d98c7..9870945289 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -791,8 +791,9 @@ extern const RoomTranslationRecord roomTranslations[];
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:
diff --git a/engines/lure/strings.cpp b/engines/lure/strings.cpp
index 294c48159b..35a246fed9 100644
--- a/engines/lure/strings.cpp
+++ b/engines/lure/strings.cpp
@@ -204,7 +204,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
// 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) {
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index a5ee93dd09..f9845cc58c 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -524,6 +524,78 @@ void Dialog::show(uint16 stringId) {
/*--------------------------------------------------------------------------*/
+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 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
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 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
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 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
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);
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index e8066de4a1..71a184be87 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -98,6 +98,8 @@ private:
uint16 _destCharacterId;
uint16 _activeItemId;
uint16 _descId;
+
+ int getArticle(uint16 msgId, uint16 objId);
public:
TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
~TalkDialog();