aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2012-06-07 01:46:32 +0100
committerThierry Crozat2012-06-24 18:00:20 +0100
commit54fba983476987436a1cea3dda7e2e4b004d8fe2 (patch)
treeeb5b81bdd925e5460f17384502ad2e9a581f2484
parent99de89c974fc24bf58b034842750e522d7d441d4 (diff)
downloadscummvm-rg350-54fba983476987436a1cea3dda7e2e4b004d8fe2.tar.gz
scummvm-rg350-54fba983476987436a1cea3dda7e2e4b004d8fe2.tar.bz2
scummvm-rg350-54fba983476987436a1cea3dda7e2e4b004d8fe2.zip
SWORD1: Add warning for untranslated subtitles
This should help adding workarounds for those by providing all the needed information (textId and english text).
-rw-r--r--engines/sword1/objectman.cpp26
-rw-r--r--engines/sword1/objectman.h3
2 files changed, 25 insertions, 4 deletions
diff --git a/engines/sword1/objectman.cpp b/engines/sword1/objectman.cpp
index d0803590a7..d3890cc1fc 100644
--- a/engines/sword1/objectman.cpp
+++ b/engines/sword1/objectman.cpp
@@ -99,13 +99,27 @@ uint8 ObjectMan::fnCheckForTextLine(uint32 textId) {
char *ObjectMan::lockText(uint32 textId) {
uint8 lang = SwordEngine::_systemVars.language;
+ char *text = lockText(textId, lang);
+ if (text == 0) {
+ if (lang != BS1_ENGLISH) {
+ text = lockText(textId, BS1_ENGLISH);
+ if (text != 0)
+ warning("Missing translation for textId %u (\"%s\")", textId, text);
+ unlockText(textId, BS1_ENGLISH);
+ }
+ return _missingSubTitleStr;
+ }
+ return text;
+}
+
+char *ObjectMan::lockText(uint32 textId, uint8 lang) {
char *addr = (char *)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]);
if (addr == 0)
- return _missingSubTitleStr;
+ return NULL;
addr += sizeof(Header);
if ((textId & ITM_ID) >= _resMan->readUint32(addr)) {
warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, _resMan->readUint32(addr));
- return _missingSubTitleStr;
+ return NULL;
}
uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1) * 4);
if (offset == 0) {
@@ -115,13 +129,17 @@ char *ObjectMan::lockText(uint32 textId) {
return const_cast<char *>(_translationId2950145[lang]);
warning("ObjectMan::lockText(%d): text number has no text lines", textId);
- return _missingSubTitleStr;
+ return NULL;
}
return addr + offset;
}
void ObjectMan::unlockText(uint32 textId) {
- _resMan->resClose(_textList[textId / ITM_PER_SEC][SwordEngine::_systemVars.language]);
+ unlockText(textId, SwordEngine::_systemVars.language);
+}
+
+void ObjectMan::unlockText(uint32 textId, uint8 lang) {
+ _resMan->resClose(_textList[textId / ITM_PER_SEC][lang]);
}
uint32 ObjectMan::lastTextNumber(int section) {
diff --git a/engines/sword1/objectman.h b/engines/sword1/objectman.h
index ca3c7c1526..cce360573a 100644
--- a/engines/sword1/objectman.h
+++ b/engines/sword1/objectman.h
@@ -53,6 +53,9 @@ public:
void saveLiveList(uint16 *dest); // for loading/saving
void loadLiveList(uint16 *src);
private:
+ char *lockText(uint32 textId, uint8 language);
+ void unlockText(uint32 textId, uint8 language);
+
ResMan *_resMan;
static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files