From 095226a614be5f1d4d3d8b9b5b03c4127fdb33e2 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 7 Jun 2017 13:34:42 -0500 Subject: SCI: Lock Audio resource types when digital SFX is enabled This seems to have been added in SCI1.1 and continued through SCI32; older games with digital SFX (like KQ5CD) did not convert the resource type in kLock. This is not known to fix any problem, but was a noted difference in the implementation between ScummVM and SSCI. --- engines/sci/engine/kscripts.cpp | 6 +++++- engines/sci/sound/soundcmd.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index c04de525f0..3dba4b127d 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -61,7 +61,11 @@ reg_t kUnLoad(EngineState *s, int argc, reg_t *argv) { reg_t kLock(EngineState *s, int argc, reg_t *argv) { int state = argc > 2 ? argv[2].toUint16() : 1; ResourceType type = g_sci->getResMan()->convertResType(argv[0].toUint16()); - ResourceId id = ResourceId(type, argv[1].toUint16()); + if (type == kResourceTypeSound && getSciVersion() >= SCI_VERSION_1_1) { + type = g_sci->_soundCmd->getSoundResourceType(argv[1].toUint16()); + } + + const ResourceId id(type, argv[1].toUint16()); Resource *which; diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index 928c9b1acb..cac3ff794b 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -72,6 +72,13 @@ public: MusicType getMusicType() const; + ResourceType getSoundResourceType(const uint16 resourceNo) const { + if (_useDigitalSFX && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceNo))) + return kResourceTypeAudio; + else + return kResourceTypeSound; + } + /** * Synchronizes the current state of the music list to the rest of the engine, so that * the changes that the sound thread makes to the music are registered with the engine -- cgit v1.2.3