[Scummvm-git-logs] scummvm master -> 390b243ef2b8e21d429eada07a88adf3e6142a01

sev- sev at scummvm.org
Mon Feb 25 09:23:06 CET 2019


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d0a88a4b5c Revert "BLADERUNNER: Possible fix for broken build"
390b243ef2 BLADERUNNER: Avoid using global objects in subtitle code


Commit: d0a88a4b5cf39d71f1adb46d8f240a0163d981c0
    https://github.com/scummvm/scummvm/commit/d0a88a4b5cf39d71f1adb46d8f240a0163d981c0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-02-25T09:19:25+01:00

Commit Message:
Revert "BLADERUNNER: Possible fix for broken build"

This reverts commit 727e583b94b80e299a2b6c52e67a7b99ec3558b8.

Revert "BLADERUNNER: Possible fix for clang warning for subtitles"

This reverts commit 78b14649beb833ecbc9c573e04078b626558ddc1.

Changed paths:
    engines/bladerunner/subtitles.cpp
    engines/bladerunner/subtitles.h


diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp
index 597f0d9..8edf27c 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 b1fa5ec..5daf570 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;
 


Commit: 390b243ef2b8e21d429eada07a88adf3e6142a01
    https://github.com/scummvm/scummvm/commit/390b243ef2b8e21d429eada07a88adf3e6142a01
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-02-25T09:22:39+01:00

Commit Message:
BLADERUNNER: Avoid using global objects in subtitle code

Changed paths:
    engines/bladerunner/subtitles.cpp
    engines/bladerunner/subtitles.h


diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp
index 8edf27c..1ef22cb 100644
--- a/engines/bladerunner/subtitles.cpp
+++ b/engines/bladerunner/subtitles.cpp
@@ -55,14 +55,14 @@ 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";
+const char *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] = {
+const char *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
@@ -137,11 +137,11 @@ 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
+		if (!strcmp(SUBTITLES_FILENAME_PREFIXES[i], "WSTLGO") || !strcmp(SUBTITLES_FILENAME_PREFIXES[i], "BRLOGO")) {
+			tmpConstructedFileName = Common::String(SUBTITLES_FILENAME_PREFIXES[i]) + "_E"; // Only English versions of these exist
 		}
 		else {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+			tmpConstructedFileName = Common::String(SUBTITLES_FILENAME_PREFIXES[i]) + "_" + _vm->_languageCode;
 		}
 
 		if ( _vqaSubsTextResourceEntries[i]->open(tmpConstructedFileName)) {
@@ -184,11 +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) {
-		if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist
+		if (!strcmp(SUBTITLES_FILENAME_PREFIXES[i], "WSTLGO") || !strcmp(SUBTITLES_FILENAME_PREFIXES[i], "BRLOGO")) {
+			tmpConstructedFileName = Common::String(SUBTITLES_FILENAME_PREFIXES[i]) + "_E"; // Only English versions of these exist
 		}
 		else {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+			tmpConstructedFileName = Common::String(SUBTITLES_FILENAME_PREFIXES[i]) + "_" + _vm->_languageCode;
 		}
 		if (tmpConstructedFileName == treName) {
 			return i;
@@ -546,4 +546,3 @@ void Subtitles::reset() {
 }
 
 } // End of namespace BladeRunner
-
diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h
index 5daf570..208a8f3 100644
--- a/engines/bladerunner/subtitles.h
+++ b/engines/bladerunner/subtitles.h
@@ -49,8 +49,8 @@ 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 char *SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries];
+	static const char *SUBTITLES_FONT_FILENAME_EXTERNAL;
 
 
 	BladeRunnerEngine *_vm;





More information about the Scummvm-git-logs mailing list