[Scummvm-git-logs] scummvm master -> 49e8b52a7edfe7a8fb0ca3ecd99063f1769a8dcc

sev- sev at scummvm.org
Tue Sep 1 17:23:59 UTC 2020


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

Summary:
49e8b52a7e SWORD1: Added detection and support for Spanish demo. Fixes #11397


Commit: 49e8b52a7edfe7a8fb0ca3ecd99063f1769a8dcc
    https://github.com/scummvm/scummvm/commit/49e8b52a7edfe7a8fb0ca3ecd99063f1769a8dcc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-09-01T19:22:27+02:00

Commit Message:
SWORD1: Added detection and support for Spanish demo. Fixes #11397

This demo uses normal interpreter with less differences than
the English demo.

Changed paths:
    engines/sword1/logic.cpp
    engines/sword1/sound.cpp
    engines/sword1/sword1.cpp
    engines/sword1/sword1.h
    engines/sword1/sworddefs.h


diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index a5d98ad150..6aee8ce333 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -522,7 +522,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
 		case IT_PUSHVARIABLE:
 			debug(9, "IT_PUSHVARIABLE: ScriptVar[%d] => %d", scriptCode[pc], _scriptVars[scriptCode[pc]]);
 			varNum = scriptCode[pc++];
-			if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows()) {
+			if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows() && !SwordEngine::_systemVars.isSpanishDemo) {
 				if (varNum >= 397) // BS1 Demo has different number of script variables
 					varNum++;
 				if (varNum >= 699)
@@ -613,7 +613,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
 		case IT_POPVAR:         // pop a variable
 			debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx - 1]);
 			varNum = scriptCode[pc++];
-			if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows()) {
+			if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows() && !SwordEngine::_systemVars.isSpanishDemo) {
 				if (varNum >= 397) // BS1 Demo has different number of script variables
 					varNum++;
 				if (varNum >= 699)
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 3b6a5730c7..30e0ce239d 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -68,7 +68,7 @@ Sound::~Sound() {
 uint32 Sound::getSampleId(int32 fxNo) {
 	byte cluster = _fxList[fxNo].sampleId.cluster;
 	byte id;
-	if (SwordEngine::_systemVars.isDemo && SwordEngine::_systemVars.platform == Common::kPlatformWindows) {
+	if (SwordEngine::_systemVars.isDemo && SwordEngine::_systemVars.platform == Common::kPlatformWindows && !SwordEngine::_systemVars.isSpanishDemo) {
 		id = _fxList[fxNo].sampleId.idWinDemo;
 	} else {
 		id = _fxList[fxNo].sampleId.idStd;
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 5ba0de96f6..00e3240c05 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -291,7 +291,8 @@ const CdFile SwordEngine::_pcCdFileList[] = {
 	{ "text.clu", FLAG_CD1 | FLAG_DEMO },
 	{ "1m14a.wav", FLAG_DEMO },
 	{ "speech1.clu", FLAG_SPEECH1 },
-	{ "speech2.clu", FLAG_SPEECH2 }
+	{ "speech2.clu", FLAG_SPEECH2 },
+	{ "speech.clu", FLAG_SPEECH | FLAG_DEMO } // Spanish Demo
 #ifdef USE_FLAC
 	, { "speech1.clf", FLAG_SPEECH1 },
 	{ "speech2.clf", FLAG_SPEECH2 }
@@ -440,8 +441,8 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
 void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or what...
 	bool fileExists[30];
 	bool isFullVersion = false; // default to demo version
-	bool missingTypes[8] = { false, false, false, false, false, false, false, false };
-	bool foundTypes[8] = { false, false, false, false, false, false, false, false };
+	bool missingTypes[9] = { false, false, false, false, false, false, false, false, false };
+	bool foundTypes[9] = { false, false, false, false, false, false, false, false, false };
 	bool cd2FilesFound = false;
 	_systemVars.runningFromCd = false;
 	_systemVars.playSpeech = true;
@@ -571,6 +572,9 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha
 	*/
 	// make the demo flag depend on the Gamesettings for now, and not on what the datafiles look like
 	_systemVars.isDemo = (_features & GF_DEMO) != 0;
+
+	// Spanish demo has proper speech.clu and uses normal sound and var mapping
+	_systemVars.isSpanishDemo = (_systemVars.isDemo && foundTypes[TYPE_SPEECH]) != 0;
 }
 
 Common::Error SwordEngine::go() {
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index a4e76e0d80..3466ee68e7 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -74,6 +74,7 @@ struct SystemVars {
 	bool   showText;
 	uint8   language;
 	bool    isDemo;
+	bool    isSpanishDemo;
 	Common::Platform platform;
 	Common::Language realLanguage;
 };
diff --git a/engines/sword1/sworddefs.h b/engines/sword1/sworddefs.h
index 643b17d3e2..c2591ef5cc 100644
--- a/engines/sword1/sworddefs.h
+++ b/engines/sword1/sworddefs.h
@@ -140,7 +140,8 @@ enum fileTypes {
 	TYPE_DEMO,
 	TYPE_IMMED,
 	TYPE_SPEECH1,
-	TYPE_SPEECH2
+	TYPE_SPEECH2,
+	TYPE_SPEECH
 };
 
 enum fileFlags {
@@ -149,7 +150,8 @@ enum fileFlags {
 	FLAG_DEMO    = (1 << TYPE_DEMO),        // file for the demo version
 	FLAG_IMMED   = (1 << TYPE_IMMED),       // this file is needed immediately, game won't start without it
 	FLAG_SPEECH1 = (1 << TYPE_SPEECH1),
-	FLAG_SPEECH2 = (1 << TYPE_SPEECH2)
+	FLAG_SPEECH2 = (1 << TYPE_SPEECH2),
+	FLAG_SPEECH  = (1 << TYPE_SPEECH)
 };
 
 struct CdFile {




More information about the Scummvm-git-logs mailing list