diff options
-rw-r--r-- | scumm/script_v5.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 30be92c18f..2eceedbfa5 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1526,16 +1526,21 @@ void Scumm_v5::o5_resourceRoutines() { _opcode = fetchScriptByte(); if (_opcode != 17) resid = getVarOrDirectByte(0x80); - if (_gameId == GID_ZAK256) - _opcode &= 0x3F; - else - _opcode &= 0x1F; + if (_gameId != GID_ZAK256) { + // FIXME - this probably can be removed eventually, I don't think the following + // check will ever be triggered, but then I could be wrong and it's better + // to play it safe. + if((_opcode & 0x3F) != (_opcode & 0x1F)) + error("Oops, this shouldn't happen: o5_resourceRoutines opcode %d", _opcode); + } - switch (_opcode) { + int op = _opcode & 0x3F; + + switch (_opcode & 0x3F) { case 1: // load script case 2: // load sound case 3: // load costume - ensureResourceLoaded(resType[_opcode-1], resid); + ensureResourceLoaded(resType[op-1], resid); break; case 4: // load room if (_features == GF_AFTER_V3) { @@ -1555,9 +1560,9 @@ void Scumm_v5::o5_resourceRoutines() { case 7: // nuke costume case 8: // nuke room if (_gameId == GID_ZAK256) - warning("o5_resourceRoutines %d should not occur in Zak256", _opcode); + warning("o5_resourceRoutines %d should not occur in Zak256", op); else - setResourceCounter(resType[_opcode-5], resid, 0x7F); + setResourceCounter(resType[op-5], resid, 0x7F); break; case 9: // lock script |