diff options
author | Max Horn | 2003-05-08 14:14:37 +0000 |
---|---|---|
committer | Max Horn | 2003-05-08 14:14:37 +0000 |
commit | 07bbeb31e962aa8ab8c69683fccd14e21f7f38f3 (patch) | |
tree | 6ad05f4102b7a81d1937127f6c5f909c5d4c1ff7 /scumm | |
parent | 86e28c807e1375d6e9b5a1b6995a870200fb2913 (diff) | |
download | scummvm-rg350-07bbeb31e962aa8ab8c69683fccd14e21f7f38f3.tar.gz scummvm-rg350-07bbeb31e962aa8ab8c69683fccd14e21f7f38f3.tar.bz2 scummvm-rg350-07bbeb31e962aa8ab8c69683fccd14e21f7f38f3.zip |
fixed o2_resourceRoutines
svn-id: r7391
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script_v2.cpp | 78 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 3 |
2 files changed, 29 insertions, 52 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index d65ddd987f..c5ad383732 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -689,63 +689,39 @@ void Scumm_v2::o2_drawObject() { } void Scumm_v2::o2_resourceRoutines() { + const ResTypes resTypes[] = { + rtNumTypes, // Unknown / invalid + rtNumTypes, // Unknown / invalid + rtCostume, + rtRoom, + rtNumTypes, // Unknown / invalid + rtScript, + rtSound + }; int resid = getVarOrDirectByte(0x80); int opcode = fetchScriptByte(); + ResTypes type = rtNumTypes; + if (0 <= (opcode >> 4) && (opcode >> 4) < (int)ARRAYSIZE(resTypes)) + type = resTypes[opcode >> 4]; + + if (type == rtNumTypes) { + warning("o2_resourceRoutines: unknown restype %d", (opcode >> 4)); + return; + } + if (((opcode & 0x0f) == 0) || ((opcode & 0x0f) == 1)) { - switch (opcode & 0xf1) { - case 96: - lock(rtSound, resid); - return; - case 97: - unlock(rtSound, resid); - return; - case 80: - lock(rtScript, resid); - return; - case 81: - unlock(rtScript, resid); - return; - case 32: - lock(rtCostume, resid); - return; - case 33: - unlock(rtCostume, resid); - return; - case 48: - lock(rtRoom, resid); - return; - case 49: - unlock(rtRoom, resid); - return; - default: - error("o2_resourceRoutines: unknown lock/unlock opcode %d", (opcode & 0xF1)); + if (opcode & 1) { + ensureResourceLoaded(type, resid); + } else { + // Seems the nuke opcodes do nothing? + warning("o2_resourceRoutines: nuking resType %d, id %d does nothing", type, resid); } } else { - switch (opcode & 0xf1) { - // FIXME why is this case happening? - case 0: - warning("o2_resourceRoutines: unknown lock/unlock opcode 0"); - return; - case 96: - case 80: - case 32: - case 48: - return; - case 97: - ensureResourceLoaded(rtSound, resid); - return; - case 81: - ensureResourceLoaded(rtScript, resid); - return; - case 33: - ensureResourceLoaded(rtCostume, resid); - return; - case 49: - ensureResourceLoaded(rtRoom, resid); - return; - default: - error("o2_resourceRoutines: unknown load/nuke opcode %d", (opcode & 0xF1)); + if (opcode & 1) { + lock(type, resid); + } else { + unlock(type, resid); } } } diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index bdcb3ca689..e68991da45 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -695,7 +695,8 @@ void Scumm_v5::o5_endCutscene() { } void Scumm_v5::o5_debug() { - getVarOrDirectWord(0x80); + int a = getVarOrDirectWord(0x80); + debug(1, "o5_debug(%d)", a); } void Scumm_v5::o5_decrement() { |