aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-06-07 13:34:42 -0500
committerColin Snover2017-06-09 22:48:15 -0500
commit095226a614be5f1d4d3d8b9b5b03c4127fdb33e2 (patch)
tree345faa21281afa7293aad434cb941216e0d66b92
parentf0d00caf93b4d329fa39d66740906c317317780c (diff)
downloadscummvm-rg350-095226a614be5f1d4d3d8b9b5b03c4127fdb33e2.tar.gz
scummvm-rg350-095226a614be5f1d4d3d8b9b5b03c4127fdb33e2.tar.bz2
scummvm-rg350-095226a614be5f1d4d3d8b9b5b03c4127fdb33e2.zip
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.
-rw-r--r--engines/sci/engine/kscripts.cpp6
-rw-r--r--engines/sci/sound/soundcmd.h7
2 files changed, 12 insertions, 1 deletions
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