[Scummvm-cvs-logs] SF.net SVN: scummvm:[54476] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Nov 25 15:22:10 CET 2010
Revision: 54476
http://scummvm.svn.sourceforge.net/scummvm/?rev=54476&view=rev
Author: thebluegr
Date: 2010-11-25 14:22:09 +0000 (Thu, 25 Nov 2010)
Log Message:
-----------
SCI: Added support for the alternate Windows MIDI soundtracks of the CD versions of EcoQuest, Jones, KQ5 and SQ4
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/features.cpp
scummvm/trunk/engines/sci/engine/features.h
scummvm/trunk/engines/sci/resource_audio.cpp
scummvm/trunk/engines/sci/sound/drivers/midi.cpp
scummvm/trunk/engines/sci/sound/soundcmd.cpp
Modified: scummvm/trunk/engines/sci/engine/features.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/features.cpp 2010-11-25 14:19:02 UTC (rev 54475)
+++ scummvm/trunk/engines/sci/engine/features.cpp 2010-11-25 14:22:09 UTC (rev 54476)
@@ -648,4 +648,17 @@
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
Modified: scummvm/trunk/engines/sci/engine/features.h
===================================================================
--- scummvm/trunk/engines/sci/engine/features.h 2010-11-25 14:19:02 UTC (rev 54475)
+++ scummvm/trunk/engines/sci/engine/features.h 2010-11-25 14:22:09 UTC (rev 54476)
@@ -113,6 +113,13 @@
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);
Modified: scummvm/trunk/engines/sci/resource_audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource_audio.cpp 2010-11-25 14:19:02 UTC (rev 54475)
+++ scummvm/trunk/engines/sci/resource_audio.cpp 2010-11-25 14:22:09 UTC (rev 54476)
@@ -562,10 +562,6 @@
}
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)
Modified: scummvm/trunk/engines/sci/sound/drivers/midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/midi.cpp 2010-11-25 14:19:02 UTC (rev 54475)
+++ scummvm/trunk/engines/sci/sound/drivers/midi.cpp 2010-11-25 14:22:09 UTC (rev 54476)
@@ -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 @@
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 @@
_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;
+ }
}
- Resource *res = NULL;
-
if (_isMt32) {
// MT-32
resetMt32();
@@ -872,17 +882,22 @@
// 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);
+ } 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;
+ // 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
Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-11-25 14:19:02 UTC (rev 54475)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-11-25 14:22:09 UTC (rev 54476)
@@ -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 @@
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 @@
}
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::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 @@
}
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list