Redeveloped the processing of language item article prefixes to match how the original handles the various languages
svn-id: r29833
This commit is contained in:
parent
34102e197b
commit
2b9859f2ff
4 changed files with 81 additions and 6 deletions
|
@ -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,
|
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_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_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_CONFIRM_YN = 40, S_YOU_ARE_CARRYING = 41, S_INV_NOTHING = 42, S_YOU_HAVE = 43,
|
||||||
S_YOU_ARE_CARRYING = 49, S_INV_NOTHING = 50, S_YOU_HAVE = 51, S_GROAT = 52, S_GROATS = 53};
|
S_GROAT = 44, S_GROATS = 45,
|
||||||
|
S_ARTICLE_LIST = 46};
|
||||||
|
|
||||||
class StringList {
|
class StringList {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -204,7 +204,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
|
||||||
// Copy over hotspot or action
|
// Copy over hotspot or action
|
||||||
ch = readCharacter();
|
ch = readCharacter();
|
||||||
const char *p = (ch == '1') ? hotspotName : characterName;
|
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 (p != NULL) {
|
||||||
if (article > 0) {
|
if (article > 0) {
|
||||||
|
|
|
@ -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) {
|
TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) {
|
||||||
debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d",
|
debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d",
|
||||||
characterId, destCharacterId, activeItemId, descId);
|
characterId, destCharacterId, activeItemId, descId);
|
||||||
|
@ -532,7 +604,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
|
||||||
char srcCharName[MAX_DESC_SIZE];
|
char srcCharName[MAX_DESC_SIZE];
|
||||||
char destCharName[MAX_DESC_SIZE];
|
char destCharName[MAX_DESC_SIZE];
|
||||||
char itemName[MAX_DESC_SIZE];
|
char itemName[MAX_DESC_SIZE];
|
||||||
int characterArticle, hotspotArticle = 3;
|
int characterArticle, hotspotArticle = 0;
|
||||||
|
|
||||||
_characterId = characterId;
|
_characterId = characterId;
|
||||||
_destCharacterId = destCharacterId;
|
_destCharacterId = destCharacterId;
|
||||||
|
@ -547,7 +619,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
|
||||||
assert(talkingChar);
|
assert(talkingChar);
|
||||||
|
|
||||||
strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
|
strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
|
||||||
characterArticle = (talkingChar->nameId >> 13) + 1;
|
characterArticle = getArticle(descId, talkingChar->nameId);
|
||||||
|
|
||||||
strcpy(destCharName, "");
|
strcpy(destCharName, "");
|
||||||
if (destCharacter != NULL)
|
if (destCharacter != NULL)
|
||||||
|
@ -555,7 +627,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
|
||||||
strcpy(itemName, "");
|
strcpy(itemName, "");
|
||||||
if (itemHotspot != NULL) {
|
if (itemHotspot != NULL) {
|
||||||
strings.getString(itemHotspot->nameId & 0x1fff, itemName);
|
strings.getString(itemHotspot->nameId & 0x1fff, itemName);
|
||||||
hotspotArticle = (itemHotspot->nameId >> 13) - 1;
|
hotspotArticle = getArticle(descId, itemHotspot->nameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);
|
strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);
|
||||||
|
|
|
@ -98,6 +98,8 @@ private:
|
||||||
uint16 _destCharacterId;
|
uint16 _destCharacterId;
|
||||||
uint16 _activeItemId;
|
uint16 _activeItemId;
|
||||||
uint16 _descId;
|
uint16 _descId;
|
||||||
|
|
||||||
|
int getArticle(uint16 msgId, uint16 objId);
|
||||||
public:
|
public:
|
||||||
TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
|
TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
|
||||||
~TalkDialog();
|
~TalkDialog();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue