diff options
-rw-r--r-- | engines/bladerunner/subtitles.cpp | 79 | ||||
-rw-r--r-- | engines/bladerunner/subtitles.h | 14 |
2 files changed, 43 insertions, 50 deletions
diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp index 597f0d9c29..8edf27cec2 100644 --- a/engines/bladerunner/subtitles.cpp +++ b/engines/bladerunner/subtitles.cpp @@ -55,7 +55,41 @@ namespace BladeRunner { * DONE - OK - CHECK what happens in VQA when no corresponding TRE subs file? */ -// Note: Expected subtitles font file name int the SUBTITLES.MIX file is "SUBTLS_E.FON" (SUBTITLES_FONT_FILENAME_EXTERNAL) +const Common::String Subtitles::SUBTITLES_FONT_FILENAME_EXTERNAL = "SUBTLS_E.FON"; + +/* +* All entries need to have the language code appended (after a '_'). +* And all entries should get the suffix extension ".TRx"; the last letter in extension "TR*" should also be the language code +* If/When adding new Text Resources here --> Update kMaxTextResourceEntries and also update method getIdxForSubsTreName() +*/ +const Common::String Subtitles::SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries] = { + "INGQUO", // 0 // (in-game subtitles, not VQA subtitles) + "WSTLGO", // 1 // all game (language) versions have the English ('E') version of WSTLGO + "BRLOGO", // 2 // all game (language) versions have the English ('E') version of BRLOGO + "INTRO", // 3 + "MW_A", // 4 + "MW_B01", // 5 + "MW_B02", // 6 + "MW_B03", // 7 + "MW_B04", // 8 + "MW_B05", // 9 + "INTRGT", // 10 + "MW_C01", // 11 + "MW_C02", // 12 + "MW_C03", // 13 + "MW_D", // 14 + "END04A", // 15 + "END04B", // 16 + "END04C", // 17 + "END06", // 18 + "END01A", // 19 + "END01B", // 20 + "END01C", // 21 + "END01D", // 22 + "END01E", // 23 + "END01F", // 24 + "END03" // 25 +}; /** * Subtitles Constructor @@ -63,33 +97,6 @@ namespace BladeRunner { Subtitles::Subtitles(BladeRunnerEngine *vm) { _vm = vm; _subtitlesSystemInactive = false; - // - SUBTITLES_FILENAME_PREFIXES[0] = "INGQUO"; // 0 // (in-game subtitles, not VQA subtitles) - SUBTITLES_FILENAME_PREFIXES[1] = "WSTLGO"; // 1 // all game (language) versions have the English ('E') version of WSTLGO - SUBTITLES_FILENAME_PREFIXES[2] = "BRLOGO"; // 2 // all game (language) versions have the English ('E') version of BRLOGO - SUBTITLES_FILENAME_PREFIXES[3] = "INTRO"; // 3 - SUBTITLES_FILENAME_PREFIXES[4] = "MW_A"; // 4 - SUBTITLES_FILENAME_PREFIXES[5] = "MW_B01"; // 5 - SUBTITLES_FILENAME_PREFIXES[6] = "MW_B02"; // 6 - SUBTITLES_FILENAME_PREFIXES[7] = "MW_B03"; // 7 - SUBTITLES_FILENAME_PREFIXES[8] = "MW_B04"; // 8 - SUBTITLES_FILENAME_PREFIXES[9] = "MW_B05"; // 9 - SUBTITLES_FILENAME_PREFIXES[10] = "INTRGT"; // 10 - SUBTITLES_FILENAME_PREFIXES[11] = "MW_C01"; // 11 - SUBTITLES_FILENAME_PREFIXES[12] = "MW_C02"; // 12 - SUBTITLES_FILENAME_PREFIXES[13] = "MW_C03"; // 13 - SUBTITLES_FILENAME_PREFIXES[14] = "MW_D"; // 14 - SUBTITLES_FILENAME_PREFIXES[15] = "END04A"; // 15 - SUBTITLES_FILENAME_PREFIXES[16] = "END04B"; // 16 - SUBTITLES_FILENAME_PREFIXES[17] = "END04C"; // 17 - SUBTITLES_FILENAME_PREFIXES[18] = "END06"; // 18 - SUBTITLES_FILENAME_PREFIXES[19] = "END01A"; // 19 - SUBTITLES_FILENAME_PREFIXES[20] = "END01B"; // 20 - SUBTITLES_FILENAME_PREFIXES[21] = "END01C"; // 21 - SUBTITLES_FILENAME_PREFIXES[22] = "END01D"; // 22 - SUBTITLES_FILENAME_PREFIXES[23] = "END01E"; // 23 - SUBTITLES_FILENAME_PREFIXES[24] = "END01F"; // 24 - SUBTITLES_FILENAME_PREFIXES[25] = "END03"; // 25 // Initializing and reseting Subtitles for (int i = 0; i < kMaxTextResourceEntries; i++) { _vqaSubsTextResourceEntries[i] = nullptr; @@ -122,8 +129,6 @@ Subtitles::~Subtitles() { // Init is kept separated from constructor to allow not loading up resources if subtitles system is disabled // void Subtitles::init(void) { - const Common::String &SUBTITLES_FONT_FILENAME_EXTERNAL = "SUBTLS_E.FON"; - if (_subtitlesSystemInactive) { return; } @@ -132,12 +137,11 @@ void Subtitles::init(void) { for (int i = 0; i < kMaxTextResourceEntries; i++) { _vqaSubsTextResourceEntries[i] = new TextResource(_vm); Common::String tmpConstructedFileName = ""; - const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i]; - if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") { - tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist + if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") { + tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist } else { - tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode; + tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode; } if ( _vqaSubsTextResourceEntries[i]->open(tmpConstructedFileName)) { @@ -180,12 +184,11 @@ void Subtitles::setSubtitlesSystemInactive(bool flag) { int Subtitles::getIdxForSubsTreName(const Common::String &treName) const { Common::String tmpConstructedFileName = ""; for (int i = 0; i < kMaxTextResourceEntries; ++i) { - const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i]; - if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") { - tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist + if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") { + tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist } else { - tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode; + tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode; } if (tmpConstructedFileName == treName) { return i; diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h index b1fa5ec8c0..5daf5706d3 100644 --- a/engines/bladerunner/subtitles.h +++ b/engines/bladerunner/subtitles.h @@ -49,19 +49,9 @@ class Subtitles { static const int kMaxNumOfSubtitlesLines = 3; static const int kMaxWidthPerLineToAutoSplitThresholdPx = 610; static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (25) with spoken dialogue or translatable text! + static const Common::String SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries]; + static const Common::String SUBTITLES_FONT_FILENAME_EXTERNAL; - // 'static const' declaration for SUBTITLES_FILENAME_PREFIXES (and init in cpp) causes warning: - // "declaration requires a global destructor [-Wglobal-constructors]" - // So, we declare it as a plain member should be fine, since we only use one instance of Subtitles anyway. - /* - * All supported TRE entries that can be in the SUBTITLES.MIX files need to: - * 1. Have the language code appended (after an underscore delimiter '_'). - * 2. Have the suffix extension ".TRx"; the last letter in extension "TR*" should also be the language code - * - * Important Note: If/When adding new Text Resources here --> Update kMaxTextResourceEntries - * and also check if method getIdxForSubsTreName() needs updating. - */ - const char *SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries]; BladeRunnerEngine *_vm; |