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

This demo uses normal interpreter with less differences than
the English demo.
This commit is contained in:
Eugene Sandulenko 2020-09-01 16:53:27 +02:00
parent 6f0ead6753
commit 7a1ca2821a
5 changed files with 15 additions and 8 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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() {

View file

@ -74,6 +74,7 @@ struct SystemVars {
bool showText;
uint8 language;
bool isDemo;
bool isSpanishDemo;
Common::Platform platform;
Common::Language realLanguage;
};

View file

@ -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 {