aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2003-12-11 06:08:43 +0000
committerTravis Howell2003-12-11 06:08:43 +0000
commit3d6461d30f9ec9a1be822a426304360b372f650a (patch)
treeb5aeb0f17a3d3be9b8150438d0ae458a7c3306c5 /scumm
parent2ef887fd445b5226da99bf2a0e1917d02806325c (diff)
downloadscummvm-rg350-3d6461d30f9ec9a1be822a426304360b372f650a.tar.gz
scummvm-rg350-3d6461d30f9ec9a1be822a426304360b372f650a.tar.bz2
scummvm-rg350-3d6461d30f9ec9a1be822a426304360b372f650a.zip
Add option to enable copy protection in SCUMM games, which ScummVM disable it by default.
svn-id: r11571
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp30
-rw-r--r--scumm/script.cpp60
-rw-r--r--scumm/script_v2.cpp14
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp1
5 files changed, 52 insertions, 54 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 4b681770c0..a4abeb3121 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -124,26 +124,22 @@ void ScummEngine::putOwner(int obj, int owner) {
_objectOwnerTable[obj] = owner;
}
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
int ScummEngine::getState(int obj) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState");
-#if defined(BYPASS_COPY_PROT)
- // I knew LucasArts sold cracked copies of the original Maniac Mansion,
- // at least as part of Day of the Tentacle. Apparently they also sold
- // cracked versions of the enhanced version. At least in Germany.
- //
- // This will keep the security door open at all times. I can only
- // assume that 182 and 193 each correspond to one particular side of
- // the it. Fortunately it does not prevent frustrated players from
- // blowing up the mansion, should they feel the urge to.
-
- if (_gameId == GID_MANIAC && (obj == 182 || obj == 193))
- _objectStateTable[obj] |= 0x08;
-#endif
+ if (!_copyProtection) {
+ // I knew LucasArts sold cracked copies of the original Maniac Mansion,
+ // at least as part of Day of the Tentacle. Apparently they also sold
+ // cracked versions of the enhanced version. At least in Germany.
+ //
+ // This will keep the security door open at all times. I can only
+ // assume that 182 and 193 each correspond to one particular side of
+ // the it. Fortunately it does not prevent frustrated players from
+ // blowing up the mansion, should they feel the urge to.
+
+ if (_gameId == GID_MANIAC && (obj == 182 || obj == 193))
+ _objectStateTable[obj] |= 0x08;
+ }
return _objectStateTable[obj];
}
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 7293899ced..6cf7673d3e 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -116,10 +116,6 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b
runScriptNested(slot);
}
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
void ScummEngine::initializeLocals(int slot, int *vars) {
int i;
if (!vars) {
@@ -451,9 +447,11 @@ int ScummEngine::fetchScriptWordSigned() {
int ScummEngine::readVar(uint var) {
int a;
-#if defined(BYPASS_COPY_PROT)
- static byte copyprotbypassed = false;
-#endif
+ static byte copyprotbypassed;
+ if (!_copyProtection)
+ copyprotbypassed = false;
+ else
+ copyprotbypassed = true;
debug(9, "readvar(%d)", var);
@@ -467,15 +465,16 @@ int ScummEngine::readVar(uint var) {
}
if (!(var & 0xF000)) {
-#if defined(BYPASS_COPY_PROT)
- if (var == 490 && _gameId == GID_MONKEY2 && !copyprotbypassed) {
- copyprotbypassed = true;
- var = 518;
- } else if (var == 179 && (_gameId == GID_MONKEY_VGA || _gameId == GID_MONKEY_EGA) && !copyprotbypassed) {
- copyprotbypassed = true;
- var = 266;
+ if (!_copyProtection) {
+ if (var == 490 && _gameId == GID_MONKEY2 && !copyprotbypassed) {
+ copyprotbypassed = true;
+ var = 518;
+ } else if (var == 179 && (_gameId == GID_MONKEY_VGA || _gameId == GID_MONKEY_EGA) && !copyprotbypassed) {
+ copyprotbypassed = true;
+ var = 266;
+ }
}
-#endif
+
if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
return _noSubtitles;
}
@@ -490,27 +489,28 @@ int ScummEngine::readVar(uint var) {
int bit = var & 0xF;
var = (var >> 4) & 0xFF;
-#if defined(BYPASS_COPY_PROT)
- // INDY3, EGA Loom and, apparently, Zak256 check this
- // during the game...
- if (_gameId == GID_INDY3 && (_features & GF_OLD_BUNDLE) && var == 94 && bit == 4) {
- return 0;
-// } else if (_gameId == GID_LOOM && var == 221 && bit == 14) { // For Mac Loom
- } else if (_gameId == GID_LOOM && var == 214 && bit == 15) { // For PC Loom
- return 0;
- } else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
- return 0;
+ if (!_copyProtection) {
+ // INDY3, EGA Loom and, apparently, Zak256 check this
+ // during the game...
+ if (_gameId == GID_INDY3 && (_features & GF_OLD_BUNDLE) && var == 94 && bit == 4) {
+ return 0;
+// } else if (_gameId == GID_LOOM && var == 221 && bit == 14) { // For Mac Loom
+ } else if (_gameId == GID_LOOM && var == 214 && bit == 15) { // For PC Loom
+ return 0;
+ } else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
+ return 0;
+ }
}
-#endif
+
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(rzb)");
return (_scummVars[ var ] & ( 1 << bit ) ) ? 1 : 0;
} else {
var &= 0x7FFF;
-#if defined(BYPASS_COPY_PROT)
- if (_gameId == GID_INDY3 && (_features & GF_FMTOWNS) && var == 1508) {
- return 0;
+ if (!_copyProtection) {
+ if (_gameId == GID_INDY3 && (_features & GF_FMTOWNS) && var == 1508)
+ return 0;
}
-#endif
+
checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)");
return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0;
}
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 613b57ada9..0a064bdc69 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -1104,13 +1104,13 @@ void ScummEngine_v2::o2_putActor() {
void ScummEngine_v2::o2_startScript() {
int script = getVarOrDirectByte(PARAM_1);
-#if defined(BYPASS_COPY_PROT)
- // The enhanced version of Zak McKracken included in the
- // SelectWare Classic Collection bundle used CD check instead
- // of the usual key code check at airports.
- if ((_gameId == GID_ZAK) && (script == 15) && (_roomResource == 45))
- return;
-#endif
+ if (!_copyProtection) {
+ // The enhanced version of Zak McKracken included in the
+ // SelectWare Classic Collection bundle used CD check instead
+ // of the usual key code check at airports.
+ if ((_gameId == GID_ZAK) && (script == 15) && (_roomResource == 45))
+ return;
+ }
runScript(script, 0, 0, 0);
}
diff --git a/scumm/scumm.h b/scumm/scumm.h
index f67e0f1bb0..5e1765b731 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -967,6 +967,7 @@ protected:
int _saveSound;
bool _native_mt32;
int _midiDriver; // Use the MD_ values from mididrv.h
+ bool _copyProtection;
bool _demoMode;
bool _confirmExit;
public:
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 54c1a16ccc..24c765022b 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -629,6 +629,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_midiDriver = GameDetector::detectMusicDriver(gs.midi);
+ _copyProtection = ConfMan.getBool("copy_protection");
_demoMode = ConfMan.getBool("demo_mode");
_noSubtitles = ConfMan.getBool("subtitles");
_noSubtitles ^=1;