aboutsummaryrefslogtreecommitdiff
path: root/scumm/script.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-06-16 06:18:30 +0000
committerTorbjörn Andersson2003-06-16 06:18:30 +0000
commit2d8bb4a6f6143075e8a47482226a43bd87c99955 (patch)
treedcb1fbff33eaf27e4ea608a91cd3f3814a6dea31 /scumm/script.cpp
parentdd5bd03dc99cf9cd540f7c6b107eb3469fb12c7e (diff)
downloadscummvm-rg350-2d8bb4a6f6143075e8a47482226a43bd87c99955.tar.gz
scummvm-rg350-2d8bb4a6f6143075e8a47482226a43bd87c99955.tar.bz2
scummvm-rg350-2d8bb4a6f6143075e8a47482226a43bd87c99955.zip
The code to bypass the EGA Loom copy protection (which is necessary since
LucasArts have been selling cracked copies themselves) turned out to be interfering with the ability to learn the fourth note under certain conditions. I've deviced an alternative bypass which should be a great deal safer, though it won't do anything to salvage older savegames. Ironically, Endy told me recently that he didn't like the idea of basing the copy protection bypasses on the value of _currentRoom, but in this case I really don't have any better idea. svn-id: r8513
Diffstat (limited to 'scumm/script.cpp')
-rw-r--r--scumm/script.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 0d12dbe129..cefaaca768 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -116,6 +116,10 @@ void Scumm::runObjectScript(int object, int entry, bool freezeResistant, bool re
runScriptNested(slot);
}
+#ifndef BYPASS_COPY_PROT
+#define BYPASS_COPY_PROT
+#endif
+
void Scumm::initializeLocals(int slot, int *vars) {
int i;
if (!vars) {
@@ -125,6 +129,26 @@ void Scumm::initializeLocals(int slot, int *vars) {
for (i = 0; i < 16; i++)
vm.localvar[slot][i] = vars[i];
}
+
+#if defined(BYPASS_COPY_PROT)
+ // Loom will set bit 15 of variable 214 to 1 if the user enters the
+ // wrong code. But this bit is also used later in the game to determine
+ // if the user has already learned the fourth note. Therefore any
+ // interfering directly with this variable is risky.
+ //
+ // Let's try an alternative solution instead. The correct code is
+ // stored in variables 82-85. Each time the user selects a symbol,
+ // its ID (0-11) is passed to room-69-203 as local variable 0. Variable
+ // 98 is 1, 2, 3 or 4 depending on how many symbols the player has
+ // selected yet.
+ //
+ // If the sum of variables 82-85 is 0, the "fail" bit will be set,
+ // regardless of the player's choice. I don't know why, but it does
+ // mean that it's safer to change local variable 0 than to change
+ // variables 82-85.
+ if (_gameId == GID_LOOM && _currentRoom == 69 && vm.slot[slot].number == 203)
+ vm.localvar[slot][0] = _scummVars[81 + _scummVars[98]];
+#endif
}
int Scumm::getVerbEntrypoint(int obj, int entry) {
@@ -444,10 +468,6 @@ int Scumm::fetchScriptWordSigned() {
return (int16)fetchScriptWord();
}
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
int Scumm::readVar(uint var) {
int a;
#if defined(BYPASS_COPY_PROT)
@@ -492,9 +512,6 @@ int Scumm::readVar(uint var) {
// INDY3 checks this during the game...
if (_gameId == GID_INDY3 && var == 94 && bit == 4) {
return 0;
- } else if (_gameId == GID_LOOM && var == 214 && bit == 15 && !copyprotbypassed) {
- copyprotbypassed = true;
- return 0;
} else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
return 0;
}