diff options
author | Paweł Kołodziejski | 2003-04-27 07:52:26 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2003-04-27 07:52:26 +0000 |
commit | caf6d740952a05bc0aac1b0f2c331dbab99451e8 (patch) | |
tree | d1a7d8b92a5eb1bf4eec10662fac23d9773d4603 /scumm/script.cpp | |
parent | 5a687ff50f7882626e9cd0b809f2c25b662093c7 (diff) | |
download | scummvm-rg350-caf6d740952a05bc0aac1b0f2c331dbab99451e8.tar.gz scummvm-rg350-caf6d740952a05bc0aac1b0f2c331dbab99451e8.tar.bz2 scummvm-rg350-caf6d740952a05bc0aac1b0f2c331dbab99451e8.zip |
put some v2 code into share code
svn-id: r7148
Diffstat (limited to 'scumm/script.cpp')
-rw-r--r-- | scumm/script.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp index 94d59b9672..2423774954 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -330,6 +330,25 @@ int Scumm::fetchScriptWordSigned() { return (int16)fetchScriptWord(); } +int Scumm::getVarOrDirectByte(byte mask) { + if (_opcode & mask) + if (_features & GF_AFTER_V2) + return readVar(fetchScriptByte()); + else + return readVar(fetchScriptWord()); + + return fetchScriptByte(); +} + +int Scumm::getVarOrDirectWord(byte mask) { + if (_opcode & mask) + if (_features & GF_AFTER_V2) + return readVar(fetchScriptByte()); + else + return readVar(fetchScriptWord()); + return fetchScriptWord(); +} + #ifndef BYPASS_COPY_PROT #define BYPASS_COPY_PROT #endif @@ -352,7 +371,12 @@ int Scumm::readVar(uint var) { #endif checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)"); - return _vars[var]; + + if ((_features & GF_AFTER_V2) && (var >= 14) && (var <= 16)) { + return _vars[_vars[var]]; + } else { + return _vars[var]; + } } if (var & 0x2000 && !(_features & GF_NEW_OPCODES)) { @@ -470,9 +494,18 @@ void Scumm::writeVar(uint var, int value) { error("Illegal varbits (w)"); } +void Scumm::getResultPosDirect() { + _resultVarNumber = _vars[fetchScriptByte()]; +} + void Scumm::getResultPos() { int a; + if (_features & GF_AFTER_V2) { + _resultVarNumber = fetchScriptByte(); + return; + } + _resultVarNumber = fetchScriptWord(); if (_resultVarNumber & 0x2000) { a = fetchScriptWord(); |