Indy3 only uses the low 4 bits of a variable

svn-id: r5393
This commit is contained in:
James Brown 2002-11-03 15:12:39 +00:00
parent 4158976aaf
commit 512f80552e

View File

@ -330,6 +330,7 @@ int Scumm::readVar(uint var)
var = 518;
}
#endif
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
return _vars[var];
}
@ -362,7 +363,11 @@ int Scumm::readVar(uint var)
}
if (var & 0x4000) {
var &= 0xFFF;
if (_gameId == GID_INDY3_256) {
var &= 0xF;
} else {
var &= 0xFFF;
}
checkRange(0x10, 0, var, "Local variable %d out of range(r)");
return vm.localvar[_currentScript][var];
}
@ -422,7 +427,12 @@ void Scumm::writeVar(uint var, int value)
}
if (var & 0x4000) {
var &= 0xFFF;
if (_gameId == GID_INDY3_256) {
var &= 0xF;
} else {
var &= 0xFFF;
}
checkRange(0x10, 0, var, "Local variable %d out of range(w)");
vm.localvar[_currentScript][var] = value;
return;