[Scummvm-cvs-logs] SF.net SVN: scummvm:[35181] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Nov 30 06:11:41 CET 2008


Revision: 35181
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35181&view=rev
Author:   lordhoto
Date:     2008-11-30 05:11:40 +0000 (Sun, 30 Nov 2008)

Log Message:
-----------
Added MIDI SFX Map, fixes SFX in HoF.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/kyra_hof.h
    scummvm/trunk/engines/kyra/sound_midi.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-11-30 04:42:30 UTC (rev 35180)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-11-30 05:11:40 UTC (rev 35181)
@@ -1583,16 +1583,23 @@
 	}
 
 	int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
-	if (vocIndex != -1)
+	if (vocIndex != -1) {
 		_sound->voicePlay(_ingameSoundList[vocIndex], true);
-	else if (_flags.platform == Common::kPlatformPC)
-		KyraEngine_v1::snd_playSoundEffect(track);
+	} else if (_flags.platform == Common::kPlatformPC) {
+		if (_sound->getSfxType() == Sound::kMidiMT32)
+			track = track < _mt32SfxMapSize ? _mt32SfxMap[track] - 1 : -1;
+		else if (_sound->getSfxType() == Sound::kMidiGM)
+			track = track < _gmSfxMapSize ? _gmSfxMap[track] - 1: -1;
 
+		if (track != -1)
+			KyraEngine_v1::snd_playSoundEffect(track);
+
 		// TODO ?? Maybe there is a way to let users select whether they want
 		// voc, midi or adl sfx (even though it makes no sense to choose anything but voc).
 		// The PC-98 version has support for non-pcm sound effects, but only for tracks 
 		// which also have voc files. The syntax would be:
 		// KyraEngine_v1::snd_playSoundEffect(vocIndex);
+	}
 }
 
 #pragma mark -

Modified: scummvm/trunk/engines/kyra/kyra_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.h	2008-11-30 04:42:30 UTC (rev 35180)
+++ scummvm/trunk/engines/kyra/kyra_hof.h	2008-11-30 05:11:40 UTC (rev 35181)
@@ -301,6 +301,10 @@
 
 	static const int8 _dosTrackMap[];
 	static const int _dosTrackMapSize;
+	static const int8 _mt32SfxMap[];
+	static const int _mt32SfxMapSize;
+	static const int8 _gmSfxMap[];
+	static const int _gmSfxMapSize;
 
 	AudioDataStruct _soundData[3];
 protected:

Modified: scummvm/trunk/engines/kyra/sound_midi.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_midi.cpp	2008-11-30 04:42:30 UTC (rev 35180)
+++ scummvm/trunk/engines/kyra/sound_midi.cpp	2008-11-30 05:11:40 UTC (rev 35181)
@@ -602,6 +602,8 @@
 }
 
 void SoundMidiPC::playTrack(uint8 track) {
+	haltTrack();
+
 	Common::StackLock lock(_mutex);
 
 	_fadeMusicOut = false;

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-11-30 04:42:30 UTC (rev 35180)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-11-30 05:11:40 UTC (rev 35181)
@@ -1716,6 +1716,70 @@
 
 const int KyraEngine_HoF::_dosTrackMapSize = ARRAYSIZE(KyraEngine_HoF::_dosTrackMap);
 
+const int8 KyraEngine_HoF::_mt32SfxMap[] = {
+	-1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+	-1,   -1,   -1,   49,   27,    5,   36,   13,
+	-1,   -1,   68,   55,   37,   73,   43,   61,
+	49,   -1,   56,   -1,   62,   38,   -1,   -1,
+	61,   -1,   -1,   31,   70,    2,   45,   -1,
+	45,   -1,   -1,   -1,   10,   14,   24,   25,
+	-1,   -1,   59,    9,   26,   -1,   71,   79,
+	12,    9,   -1,   -1,   61,   -1,   -1,   65,
+	66,   50,   27,   24,   29,   29,   15,   16,
+	17,   18,   19,   20,   21,   57,   -1,   -1,
+	34,    3,   -1,   56,   56,   -1,   -1,   50,
+	43,   68,   32,   33,   67,   25,   60,   40,
+	39,   11,   24,    2,   60,    3,   46,   54,
+	 1,    8,   -1,   -1,   41,   42,   37,   74,
+	69,   62,   58,   27,   -1,   -1,   -1,   -1,
+	48,    4,   -1,   25,   39,   40,   24,   58,
+	35,    4,    4,    4,   -1,   50,   -1,    6,
+	 8,   -1,   -1,   -1,   -1,   -1,   53,   52,
+	-1,   63,   47,   -1,   -1,   -1,   53,   -1,
+	29,   -1,   -1,   79,   -1,   41,   12,   -1,
+	-1,   -1,   26,   -1,    7,   27,   72,   51,
+	23,   51,   64,   -1,   -1,   -1,   27,   76,
+	77,   78,   28,   47,   -1,   -1,   53,   -1,
+	-1,   -1,   -1,   -1,    2,   22,   -1,   51,
+	58,   -1,   -1,   30,   -1,   79,   -1,   -1,
+	22,   36,    1,   -1,   12,    1,   -1,   -1,
+	41,   -1,   76,   77,   47
+};
+
+const int KyraEngine_HoF::_mt32SfxMapSize = ARRAYSIZE(KyraEngine_HoF::_mt32SfxMap);
+
+const int8 KyraEngine_HoF::_gmSfxMap[] = {
+	-1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+	-1,   -1,   -1,   31,   25,   19,   12,    4,
+	-1,   -1,   46,   18,   -1,   21,   15,   -1,
+	31,   -1,   -1,   -1,   -1,   -1,   47,   -1,
+	33,   -1,   36,   -1,   -1,   23,   48,   -1,
+	48,   -1,   -1,   49,   -1,   50,   22,   24,
+	51,   -1,   52,   20,   -1,   -1,   22,   53,
+	 3,   20,   47,   54,   33,   -1,   55,   56,
+	57,   33,   -1,   51,   58,   -1,    5,    6,
+	 7,    8,    9,   10,   11,   22,   -1,   -1,
+	-1,   24,   -1,   26,   17,   -1,   -1,   33,
+	15,   -1,   23,   23,   -1,   22,   -1,   23,
+	24,   21,   22,   -1,   -1,   24,   16,   -1,
+	 1,   48,   -1,   -1,   13,   14,   -1,   29,
+	64,   -1,   -1,   25,   -1,   -1,   -1,   -1,
+	-1,    2,   13,   24,   23,   23,   22,   -1,
+	60,    2,    2,    2,   -1,   33,   -1,   61,
+	48,   62,   -1,   39,   -1,   -1,   28,   63,
+	33,   -1,   17,   -1,   45,   45,   28,   55,
+	34,   -1,   -1,   34,   55,   13,   -1,   47,
+	54,   -1,   -1,   33,   44,   25,   -1,   -1,
+	-1,   32,   -1,   -1,   -1,   -1,   25,   37,
+	37,   37,   26,   43,   -1,   42,   24,   -1,
+	-1,   -1,   -1,   -1,   23,   32,   -1,   32,
+	-1,   -1,   -1,   27,   41,   34,   -1,   40,
+	32,   -1,   16,   40,   -1,   16,   38,   39,
+	13,   -1,   37,   28,   33
+};
+
+const int KyraEngine_HoF::_gmSfxMapSize = ARRAYSIZE(KyraEngine_HoF::_gmSfxMap);
+
 void KyraEngine_HoF::initInventoryButtonList() {
 	delete[] _inventoryButtons;
 


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