aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-02-24 23:38:43 +0200
committerThanasis Antoniou2019-02-24 23:39:52 +0200
commit78b14649beb833ecbc9c573e04078b626558ddc1 (patch)
treefae0eb10fcf18379ac4a4f3b5d80b17b47f31bba
parent096e870b7bc15710a6650635cfea1b774303220b (diff)
downloadscummvm-rg350-78b14649beb833ecbc9c573e04078b626558ddc1.tar.gz
scummvm-rg350-78b14649beb833ecbc9c573e04078b626558ddc1.tar.bz2
scummvm-rg350-78b14649beb833ecbc9c573e04078b626558ddc1.zip
BLADERUNNER: Possible fix for clang warning for subtitles
-rw-r--r--engines/bladerunner/subtitles.cpp52
-rw-r--r--engines/bladerunner/subtitles.h41
2 files changed, 50 insertions, 43 deletions
diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp
index 8edf27cec2..3a21625080 100644
--- a/engines/bladerunner/subtitles.cpp
+++ b/engines/bladerunner/subtitles.cpp
@@ -55,41 +55,7 @@ namespace BladeRunner {
* DONE - OK - CHECK what happens in VQA when no corresponding TRE subs file?
*/
-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
-};
+// Note: Expected subtitles font file name int the SUBTITLES.MIX file is "SUBTLS_E.FON" (SUBTITLES_FONT_FILENAME_EXTERNAL)
/**
* Subtitles Constructor
@@ -129,6 +95,8 @@ 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;
}
@@ -137,11 +105,12 @@ void Subtitles::init(void) {
for (int i = 0; i < kMaxTextResourceEntries; i++) {
_vqaSubsTextResourceEntries[i] = new TextResource(_vm);
Common::String tmpConstructedFileName = "";
- if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") {
- tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist
+ const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i];
+ if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") {
+ tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist
}
else {
- tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+ tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode;
}
if ( _vqaSubsTextResourceEntries[i]->open(tmpConstructedFileName)) {
@@ -184,11 +153,12 @@ void Subtitles::setSubtitlesSystemInactive(bool flag) {
int Subtitles::getIdxForSubsTreName(const Common::String &treName) const {
Common::String tmpConstructedFileName = "";
for (int i = 0; i < kMaxTextResourceEntries; ++i) {
- if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") {
- tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist
+ const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i];
+ if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") {
+ tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist
}
else {
- tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+ tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode;
}
if (tmpConstructedFileName == treName) {
return i;
diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h
index 5daf5706d3..f43d688c18 100644
--- a/engines/bladerunner/subtitles.h
+++ b/engines/bladerunner/subtitles.h
@@ -49,9 +49,46 @@ 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]{
+ "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
+ };
BladeRunnerEngine *_vm;