Ticket #8955: bs1_hardcoded_subtitle.patch

File bs1_hardcoded_subtitle.patch, 2.4 KB (added by criezy, 16 years ago)

Hard coded subtitle patch

  • engines/sword1/objectman.cpp

    diff -ruN scummvm-20090214-orig/engines/sword1/objectman.cpp scummvm-20090214/engines/sword1/objectman.cpp
    old new  
    108108        }
    109109        uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1)* 4);
    110110        if (offset == 0) {
     111                // Workaround bug for missing sentence in some langages in Syria (see bug #1977094).
     112                // We use the hardcoded text in this case.
     113                if (textId == 2950145)
     114                        return const_cast<char*>(_translationId2950145[lang]);
     115
    111116                warning("ObjectMan::lockText(%d): text number has no text lines", textId);
    112                 return _errorStr;
     117                return _missingSubTitleStr;
    113118        }
    114119        return addr + offset;
    115120}
     
    161166        memcpy(dest, _liveList, TOTAL_SECTIONS * sizeof(uint16));
    162167}
    163168
    164 char ObjectMan::_errorStr[] = "Error: Text not found.";
     169// String displayed when a subtitle sentence is missing in the cluster file.
     170// It happens with at least on sentence in Syria in some langages (see bug #1977094).
     171// Note: an empty string or a null pointer causes a crash.
     172char ObjectMan::_missingSubTitleStr[] = " ";
     173
     174// Missing translation for textId 2950145 (see bug #1977094).
     175// Currently text is missing for German, Spanish and Portuguese languages.
     176const char *ObjectMan::_translationId2950145[7] =
     177{
     178        "Oh?",    // English
     179        "Quoi?",  // French
     180        " ",      // German <= to replace with german sentence
     181        "Eh?",    // Italian
     182        " ",      // Spanish <= to replace with spanish sentence
     183        "Ano?",   // Czech
     184        " "       // Portuguese <= to replace with german sentence
     185};
     186
    165187
    166188} // End of namespace Sword1
  • engines/sword1/objectman.h

    diff -ruN scummvm-20090214-orig/engines/sword1/objectman.h scummvm-20090214/engines/sword1/objectman.h
    old new  
    6161        static const uint32 _textList[TOTAL_SECTIONS][7];       //a table of pointers to text files
    6262        uint16  _liveList[TOTAL_SECTIONS];                                      //which sections are active
    6363        uint8 *_cptData[TOTAL_SECTIONS];
    64         static char _errorStr[];
     64        static char _missingSubTitleStr[];
     65        static const char *_translationId2950145[7];            //translation for textId 2950145 (missing from cluster file for some langages)
    6566};
    6667
    6768} // End of namespace Sword1