aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-25 14:22:09 +0000
committerFilippos Karapetis2010-11-25 14:22:09 +0000
commit2c2f3a97e69184c23342fe77185cc37e87ed7813 (patch)
tree0e7bfeb030e5e30408572e028fa55d146f6168ce /engines
parent394daa57044dc83e971041bcd62fbd12ee6b3174 (diff)
downloadscummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.tar.gz
scummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.tar.bz2
scummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.zip
SCI: Added support for the alternate Windows MIDI soundtracks of the CD versions of EcoQuest, Jones, KQ5 and SQ4
svn-id: r54476
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/features.cpp13
-rw-r--r--engines/sci/engine/features.h7
-rw-r--r--engines/sci/resource_audio.cpp4
-rw-r--r--engines/sci/sound/drivers/midi.cpp49
-rw-r--r--engines/sci/sound/soundcmd.cpp20
5 files changed, 65 insertions, 28 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index fbb18dab49..206624f87e 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -648,4 +648,17 @@ MoveCountType GameFeatures::detectMoveCountType() {
return _moveCountType;
}
+bool GameFeatures::useAltWinGMSound() {
+ if (g_sci && g_sci->getPlatform() == Common::kPlatformWindows && g_sci->isCD()) {
+ SciGameId id = g_sci->getGameId();
+ return (id == GID_ECOQUEST ||
+ id == GID_JONES ||
+ id == GID_KQ5 ||
+ //id == GID_FREDDYPHARKAS || // Has alternate tracks, but handles them differently
+ id == GID_SQ4);
+ } else {
+ return false;
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 83cb58aa2d..8237d43714 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -113,6 +113,13 @@ public:
bool usesCdTrack() { return _usesCdTrack; }
+ /**
+ * Checks if the alternative Windows GM MIDI soundtrack should be used. Such
+ * soundtracks are available for the Windows CD versions of EcoQuest, Jones,
+ * KQ5 and SQ4.
+ */
+ bool useAltWinGMSound();
+
private:
reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index f17bc75ef0..9949373852 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -562,10 +562,6 @@ bool ResourceManager::isGMTrackIncluded() {
}
SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVersion soundVersion) : _resMan(resMan), _soundVersion(soundVersion) {
- // Modify the resourceId for the Windows version of KQ5, like SSCI did.
- if (g_sci->getGameId() == GID_KQ5 && g_sci->getPlatform() == Common::kPlatformWindows)
- resourceNr += 1000;
-
Resource *resource = _resMan->findResource(ResourceId(kResourceTypeSound, resourceNr), true);
int trackNr, channelNr;
if (!resource)
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 7cc4e1922c..2b72310ad5 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -33,6 +33,7 @@
#include "sound/softsynth/emumidi.h"
#include "sci/resource.h"
+#include "sci/engine/features.h"
#include "sci/sound/drivers/gm_names.h"
#include "sci/sound/drivers/mididriver.h"
#include "sci/sound/drivers/map-mt32-to-gm.h"
@@ -58,7 +59,12 @@ public:
void sysEx(const byte *msg, uint16 length);
bool hasRhythmChannel() const { return true; }
byte getPlayId() const;
- int getPolyphony() const { return kVoices; }
+ int getPolyphony() const {
+ if (g_sci && g_sci->_features->useAltWinGMSound())
+ return 16;
+ else
+ return kVoices;
+ }
int getFirstChannel() const;
int getLastChannel() const;
void setVolume(byte volume);
@@ -840,14 +846,18 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) {
_percussionVelocityScale[i] = 127;
}
- // Don't do any mapping for the Windows version of KQ5CD
- if (g_sci && g_sci->getGameId() == GID_KQ5 && g_sci->getPlatform() == Common::kPlatformWindows) {
- _useMT32Track = false;
- return 0;
- }
-
Resource *res = NULL;
+ if (g_sci && g_sci->_features->useAltWinGMSound()) {
+ res = resMan->findResource(ResourceId(kResourceTypePatch, 4), 0);
+ if (!(res && isMt32GmPatch(res->data, res->size))) {
+ // Don't do any mapping when a Windows alternative track is selected
+ // and no MIDI patch is available
+ _useMT32Track = false;
+ return 0;
+ }
+ }
+
if (_isMt32) {
// MT-32
resetMt32();
@@ -872,17 +882,22 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) {
// There is a GM patch
readMt32GmPatch(res->data, res->size);
- // Detect the format of patch 1, so that we know what play mask to use
- res = resMan->findResource(ResourceId(kResourceTypePatch, 1), 0);
- if (!res)
+ if (g_sci && g_sci->_features->useAltWinGMSound()) {
+ // Always use the GM track if an alternative GM Windows soundtrack is selected
_useMT32Track = false;
- else
- _useMT32Track = !isMt32GmPatch(res->data, res->size);
-
- // Check if the songs themselves have a GM track
- if (!_useMT32Track) {
- if (!resMan->isGMTrackIncluded())
- _useMT32Track = true;
+ } else {
+ // Detect the format of patch 1, so that we know what play mask to use
+ res = resMan->findResource(ResourceId(kResourceTypePatch, 1), 0);
+ if (!res)
+ _useMT32Track = false;
+ else
+ _useMT32Track = !isMt32GmPatch(res->data, res->size);
+
+ // Check if the songs themselves have a GM track
+ if (!_useMT32Track) {
+ if (!resMan->isGMTrackIncluded())
+ _useMT32Track = true;
+ }
}
} else {
// No GM patch found, map instruments using MT-32 patch
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 1e918be30d..3592f736ea 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -28,6 +28,7 @@
#include "sci/sound/music.h"
#include "sci/sound/soundcmd.h"
+#include "sci/engine/features.h"
#include "sci/engine/kernel.h"
#include "sci/engine/object.h"
#include "sci/engine/selector.h"
@@ -53,6 +54,9 @@ reg_t SoundCommandParser::kDoSoundInit(int argc, reg_t *argv, reg_t acc) {
void SoundCommandParser::processInitSound(reg_t obj) {
int resourceId = readSelectorValue(_segMan, obj, SELECTOR(number));
+ // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did.
+ if (g_sci && g_sci->_features->useAltWinGMSound())
+ resourceId += 1000;
// Check if a track with the same sound object is already playing
MusicEntry *oldSound = _music->getSlot(obj);
@@ -122,6 +126,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) {
}
int resourceId = obj.segment ? readSelectorValue(_segMan, obj, SELECTOR(number)) : -1;
+ // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did.
+ if (g_sci && g_sci->_features->useAltWinGMSound())
+ resourceId += 1000;
if (musicSlot->resourceId != resourceId) { // another sound loaded into struct
processDisposeSound(obj);
@@ -349,12 +356,6 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
}
reg_t SoundCommandParser::kDoSoundGetPolyphony(int argc, reg_t *argv, reg_t acc) {
- // KQ5CD uses this to determine if it should play digital audio or not.
- // For Adlib cards, digital audio is played, whereas MIDI is played for GM cards.
- // Thus, tell it that we're using an Adlib in room 119 (Sierra logo screen),
- // so that the digital audio is always preferred.
- if (g_sci->getGameId() == GID_KQ5 && g_sci->getEngineState()->currentRoomNumber() == 119)
- return make_reg(0, 9); // Adlib, i.e. digital music
return make_reg(0, _music->soundGetVoices()); // Get the number of voices
}
@@ -593,8 +594,13 @@ reg_t SoundCommandParser::kDoSoundSetPriority(int argc, reg_t *argv, reg_t acc)
}
if (value == -1) {
+ uint16 resourceNr = musicSlot->resourceId;
+ // Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did.
+ if (g_sci && g_sci->_features->useAltWinGMSound())
+ resourceNr += 1000;
+
// Set priority from the song data
- Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, musicSlot->resourceId), 0);
+ Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, resourceNr), 0);
if (song->data[0] == 0xf0)
_music->soundSetPriority(musicSlot, song->data[1]);
else