[Scummvm-git-logs] scummvm master -> e9b585df4ece670874ff8881518a49de8c16e936
sev-
sev at scummvm.org
Fri Sep 4 08:31:37 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:
e9b585df4e CINE: OS: Fix MT-32/AdLib SFX & loading savegames
Commit: e9b585df4ece670874ff8881518a49de8c16e936
https://github.com/scummvm/scummvm/commit/e9b585df4ece670874ff8881518a49de8c16e936
Author: Kari Salminen (kari.salminen at gmail.com)
Date: 2020-09-04T10:31:33+02:00
Commit Message:
CINE: OS: Fix MT-32/AdLib SFX & loading savegames
In Operation Stealth DOS and Atari ST versions, but not Amiga or
demo versions, sound effects are loaded in AUTO00.PRC using a
combination of o2_loadAbs and o2_playSample(1, ...) before
o1_freePartRange(0, 200). This is a better heuristic for ending the
script at the correct position than checking whether global variable
255 is compared to 0. In the original game AUTO00.PRC was run when
starting or restarting the game and one could not load a savegame
before passing the copy protection. Thus, we try to emulate that
behaviour by running at least part of AUTO00.PRC before loading a
savegame.
Changed paths:
engines/cine/cine.cpp
engines/cine/script_fw.cpp
engines/cine/sound.cpp
engines/cine/various.cpp
engines/cine/various.h
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index cbbb77e7be..9c3a4cfbae 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -256,15 +256,19 @@ void CineEngine::initialize() {
// Used for making sound effects work using Roland MT-32 and AdLib in
// Operation Stealth after loading a savegame. The sound effects are loaded
// in AUTO00.PRC using a combination of o2_loadAbs and o2_playSample(1, ...)
- // before checking if _globalVars[255] == 0. In the original game AUTO00.PRC
+ // before o1_freePartRange(0, 200). In the original game AUTO00.PRC
// was run when starting or restarting the game and one could not load a savegame
// before passing the copy protection. Thus, we try to emulate that behaviour by
// running at least part of AUTO00.PRC before loading a savegame.
- if (getGameType() == Cine::GType_OS && !(getFeatures() & GF_DEMO)) {
+ //
+ // Confirmed that DOS and Atari ST versions do have these commands in their AUTO00.PRC files.
+ // Confirmed that Amiga and demo versions do not have these commands in their AUTO00.PRC files.
+ if (getGameType() == Cine::GType_OS && !(getFeatures() & GF_DEMO) &&
+ (getPlatform() == Common::kPlatformDOS || getPlatform() == Common::kPlatformAtariST)) {
loadPrc(BOOT_PRC_NAME);
strcpy(currentPrcName, BOOT_PRC_NAME);
addScriptToGlobalScripts(BOOT_SCRIPT_INDEX);
- runOnlyUntilCopyProtectionCheck = true;
+ runOnlyUntilFreePartRangeFirst200 = true;
executeGlobalScripts();
}
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index 2ed3e96ebd..f5833e4661 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -1555,8 +1555,10 @@ int FWScript::o1_break() {
return 0;
}
- // Jump over breaks when running only until copy protection check
- if (runOnlyUntilCopyProtectionCheck) {
+ // Jump over breaks when running only until o1_freePartRange(0, 200) in AUTO00.PRC.
+ // This is used for making sound effects work with Roland MT-32 and AdLib
+ // when loading savegames.
+ if (runOnlyUntilFreePartRangeFirst200) {
return 0;
}
@@ -1640,16 +1642,6 @@ int FWScript::o1_compareGlobalVar() {
_compare = kCmpEQ;
} else {
_compare = compareVars(_globalVars[varIdx], value);
-
- // Used for bailing out early from AUTO00.PRC before loading a savegame.
- // Used for making sound effects work using Roland MT-32 and AdLib in
- // Operation Stealth after loading a savegame. The sound effects are loaded
- // in AUTO00.PRC using a combination of o2_loadAbs and o2_playSample(1, ...)
- // before checking if _globalVars[255] == 0.
- if (varIdx == 255 && value == 0 && runOnlyUntilCopyProtectionCheck) {
- runOnlyUntilCopyProtectionCheck = false;
- return o1_endScript();
- }
}
}
@@ -1671,6 +1663,17 @@ int FWScript::o1_freePartRange() {
debugC(5, kCineDebugScript, "Line: %d: freePartRange(%d,%d)", _line, startIdx, numIdx);
freeAnimDataRange(startIdx, numIdx);
+
+ // Used for bailing out early from AUTO00.PRC before loading a savegame.
+ // Used for making sound effects work using Roland MT-32 and AdLib in
+ // Operation Stealth after loading a savegame. The sound effects are loaded
+ // in AUTO00.PRC using a combination of o2_loadAbs and o2_playSample(1, ...)
+ // before o1_freePartRange(0, 200).
+ if (runOnlyUntilFreePartRangeFirst200 && startIdx == 0 && numIdx == 200) {
+ runOnlyUntilFreePartRangeFirst200 = false;
+ return o1_endScript();
+ }
+
return 0;
}
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 135dda55f6..9c9ccbf6f7 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -751,7 +751,7 @@ void MidiSoundDriverH32::playSample(int mode, int channel, int param3, int param
break;
case 4: // show text in Roland MT-32 LCD display
// Don't display text in Roland MT-32 LCD display when loading a savegame
- if (!runOnlyUntilCopyProtectionCheck) {
+ if (!runOnlyUntilFreePartRangeFirst200) {
selectInstrument5(channel);
}
break;
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index ac10c6af60..7f925deff3 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -42,7 +42,7 @@ namespace Cine {
int16 disableSystemMenu = 0;
bool inMenu;
-bool runOnlyUntilCopyProtectionCheck = false;
+bool runOnlyUntilFreePartRangeFirst200 = false;
int16 commandVar3[4];
int16 commandVar1;
diff --git a/engines/cine/various.h b/engines/cine/various.h
index ef1064efda..09d9a1f4be 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -49,7 +49,7 @@ void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4);
extern int16 disableSystemMenu;
extern bool inMenu;
-extern bool runOnlyUntilCopyProtectionCheck;
+extern bool runOnlyUntilFreePartRangeFirst200;
extern CommandeType currentSaveName[kMaxSavegames];
More information about the Scummvm-git-logs
mailing list