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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Oct 10 11:06:15 CEST 2007


Revision: 29183
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29183&view=rev
Author:   lordhoto
Date:     2007-10-10 02:06:15 -0700 (Wed, 10 Oct 2007)

Log Message:
-----------
- Made some sound functions a bit more generic for use with Kyra1 and Kyra2

HoF:
- Added sound support (sfx sound wrong currently though)
- Implemented opcodes:
  -> o2_loadMusicTrack
  -> o2_playWanderScoreViaMap
  -> o2_playSoundEffect
  -> o2t_playSoundEffect

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/items_v2.cpp
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/kyra_v1.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/scene_v2.cpp
    scummvm/trunk/engines/kyra/script_v2.cpp
    scummvm/trunk/engines/kyra/sequences_v1.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound_v1.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/items_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/items_v2.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/items_v2.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -98,7 +98,7 @@
 
 	bool success = processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2);
 	if (!success) {
-		//snd_playSfx(0x0d);
+		snd_playSoundEffect(0x0d);
 		if (countAllItems() >= 30)
 			showMessageFromCCode(5, 0x84, 0);
 	}
@@ -218,7 +218,7 @@
 	if (startX == dstX && startY == dstY) {
 		if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) {
 			updateCharFacing();
-			//snd_playSfx(0x2d);
+			snd_playSoundEffect(0x2d);
 			removeHandItem();
 			//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
 		} else {
@@ -226,7 +226,7 @@
 			_itemList[itemSlot].y = dstY;
 			_itemList[itemSlot].id = item;
 			_itemList[itemSlot].sceneId = _mainCharacter.sceneId;
-			//snd_playSfx(0x0c);
+			snd_playSoundEffect(0x0c);
 			addItemToAnimList(itemSlot);
 		}
 	} else {
@@ -256,7 +256,7 @@
 			}
 
 			if (dstX != dstY || (dstY - startY > 16)) {
-				//snd_playSfx(0x69);
+				snd_playSoundEffect(0x69);
 				speed = MAX(speed, 6);
 				int speedX = ((dstX - startX) << 4) / speed;
 				int origSpeed = speed;
@@ -300,7 +300,7 @@
 
 		if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) {
 			updateCharFacing();
-			//snd_playSfx(0x2d);
+			snd_playSoundEffect(0x2d);
 			removeHandItem();
 			_screen->showMouse();
 			//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
@@ -309,7 +309,7 @@
 			_itemList[itemSlot].y = dstY;
 			_itemList[itemSlot].id = item;
 			_itemList[itemSlot].sceneId = _mainCharacter.sceneId;
-			//snd_playSfx(0x0c);
+			snd_playSoundEffect(0x0c);
 			addItemToAnimList(itemSlot);
 			_screen->showMouse();
 		}
@@ -326,7 +326,7 @@
 	_itemInHand = itemId;
 
 	addItemToAnimList(itemPos);
-	//snd_playSfx(0x0b);
+	snd_playSoundEffect(0x0b);
 	setMouseCursor(_itemInHand);
 	int str2 = 7;
 		
@@ -352,7 +352,7 @@
 		deleteItemAnimEntry(itemPos);
 		int itemId = _itemList[itemPos].id;
 		_itemList[itemPos].id = 0xFFFF;
-		//snd_playSfx(0x0b);
+		snd_playSoundEffect(0x0b);
 		setMouseCursor(itemId);
 		int str2 = 7;
 		

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -57,6 +57,11 @@
 
 	_skipFlag = false;
 
+	_trackMap = 0;
+	_trackMapSize = 0;
+	_lastMusicCommand = -1;
+	_curSfxFile = _curMusicTheme = -1;
+
 	memset(_flagsTable, 0, sizeof(_flagsTable));
 
 	// sets up all engine specific debug levels

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra.h	2007-10-10 09:06:15 UTC (rev 29183)
@@ -112,6 +112,11 @@
 	int setGameFlag(int flag);
 	int queryGameFlag(int flag) const;
 	int resetGameFlag(int flag);
+
+	// sound
+	virtual void snd_playTheme(int file, int track = 0);
+	virtual void snd_playSoundEffect(int id);
+	virtual void snd_playWanderScoreViaMap(int command, int restart);
 	
 	// delay functionallity
 	virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
@@ -148,6 +153,14 @@
 	
 	// game flags
 	uint8 _flagsTable[100];	// TODO: check this value
+
+	// sound
+	int _curMusicTheme;
+	int _curSfxFile;
+	int16 _lastMusicCommand;
+
+	const int8 *_trackMap;
+	int _trackMapSize;
 	
 	// input	
 	Common::Point getMousePos() const;

Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -98,8 +98,6 @@
 	memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
 	_currHeadShape = 0;
 
-	_curSfxFile = _curMusicTheme = 0;
-
 	memset(&_itemBkgBackUp, 0, sizeof(_itemBkgBackUp));
 }
 
@@ -184,12 +182,16 @@
 		_sound->setSoundFileList(_soundFilesTowns, _soundFilesTownsCount);
 	else
 		_sound->setSoundFileList(_soundFiles, _soundFilesCount);
+
+	_trackMap = _dosTrackMap;
+	_trackMapSize = _dosTrackMapSize;
 	
 	if (!_sound->init())
 		error("Couldn't init sound");
 
 	_sound->setVolume(255);
-	_sound->loadSoundFile(0);
+	if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98)
+		_sound->loadSoundFile(9);
 
 	setupTimers();
 	setupButtonData();

Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2007-10-10 09:06:15 UTC (rev 29183)
@@ -275,7 +275,6 @@
 	void readSettings();
 	void writeSettings();
 
-	void snd_playTheme(int file, int track = 0);
 	void snd_playVoiceFile(int id);
 	void snd_voiceWaitForFinish(bool ingame = true);
 	bool snd_voiceIsPlaying();
@@ -602,10 +601,6 @@
 	bool _configSounds;
 	uint8 _configVoice;
 
-	int _curMusicTheme;
-	int _curSfxFile;
-	int16 _lastMusicCommand;
-
 	ScreenAnimator *_animator;
 	SeqPlayer *_seq;
 	Sprites *_sprites;
@@ -644,6 +639,9 @@
 		uint32 timerCount;
 	} _kyragemFadingState;
 
+	static const int8 _dosTrackMap[];
+	static const int _dosTrackMapSize;
+
 	// TODO: get rid of all variables having pointers to the static resources if possible
 	// i.e. let them directly use the _staticres functions
 	void initStaticResource();

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -182,6 +182,10 @@
 }
 
 void KyraEngine_v2::startup() {
+	_sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize);
+	_trackMap = _dosTrackMap;
+	_trackMapSize = _dosTrackMapSize;
+
 	_screen->_curPage = 0;
 	delete [] _mouseSHPBuf;
 	_mouseSHPBuf = 0;
@@ -273,6 +277,8 @@
 	loadNPCScript();
 	
 	// XXX
+	snd_playWanderScoreViaMap(52, 1);
+	// XXX
 	
 	enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
 	_screen->showMouse();
@@ -315,7 +321,7 @@
 		return;
 	
 	if (_unk3 == -2) {
-		//snd_playSfx(13);
+		snd_playSoundEffect(13);
 		return;
 	}
 	
@@ -1353,6 +1359,18 @@
 
 #pragma mark -
 
+void KyraEngine_v2::snd_loadSoundFile(int id) {
+	if (id < 0 || !_trackMap)
+		return;
+
+	assert(id < _trackMapSize);
+	int file = _trackMap[id*2];
+	_curSfxFile = _curMusicTheme = file;
+	_sound->loadSoundFile(file);
+}
+
+#pragma mark -
+
 typedef Functor1Mem<ScriptState*, int, KyraEngine_v2> OpcodeV2;
 #define Opcode(x) OpcodeV2(this, &KyraEngine_v2::x)
 #define OpcodeUnImpl() OpcodeV2(this, 0)
@@ -1425,8 +1443,8 @@
 		OpcodeUnImpl(),
 		// 0x34
 		OpcodeUnImpl(),
+		Opcode(o2_playSoundEffect),
 		OpcodeUnImpl(),
-		OpcodeUnImpl(),
 		Opcode(o2_delay),
 		// 0x38
 		Opcode(o2_dummy),
@@ -1467,12 +1485,12 @@
 		OpcodeUnImpl(),
 		Opcode(o2_setLayerFlag),
 		Opcode(o2_setZanthiaPos),
-		OpcodeUnImpl(),
+		Opcode(o2_loadMusicTrack),
 		// 0x58
+		Opcode(o2_playWanderScoreViaMap),
+		Opcode(o2_playSoundEffect),
 		OpcodeUnImpl(),
 		OpcodeUnImpl(),
-		OpcodeUnImpl(),
-		OpcodeUnImpl(),
 		// 0x5c
 		OpcodeUnImpl(),
 		OpcodeUnImpl(),

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2007-10-10 09:06:15 UTC (rev 29183)
@@ -143,6 +143,11 @@
 	ActiveChat *_activeChat;
 	uint8 *_mouseSHPBuf;
 
+	static const char *_dosSoundFileList[];
+	static const int _dosSoundFileListSize;
+	static const int8 _dosTrackMap[];
+	static const int _dosTrackMapSize;
+
 	static const char *_introSoundList[];
 	static const int _introSoundListSize;
 	static const char *_introStrings[];
@@ -486,6 +491,9 @@
 
 	byte _messagePal[3];
 	int _msgUnk1;
+
+	// sound
+	void snd_loadSoundFile(int id);
 	
 	// timer
 	void timerFunc2(int);
@@ -519,6 +527,7 @@
 	int o2_hideMouse(ScriptState *script);
 	int o2_addSpecialExit(ScriptState *script);
 	int o2_showMouse(ScriptState *script);
+	//int o2_playSoundEffect(ScriptState *script);
 	int o2_delay(ScriptState *script);
 	int o2_setScaleTableItem(ScriptState *script);
 	int o2_setDrawLayerTableItem(ScriptState *script);
@@ -533,6 +542,9 @@
 	int o2_getShapeFlag1(ScriptState *script);
 	int o2_setLayerFlag(ScriptState *script);
 	int o2_setZanthiaPos(ScriptState *script);
+	int o2_loadMusicTrack(ScriptState *script);
+	int o2_playWanderScoreViaMap(ScriptState *script);
+	int o2_playSoundEffect(ScriptState *script);
 	int o2_getRand(ScriptState *script);
 	int o2_encodeShape(ScriptState *script);
 	int o2_defineRoomEntrance(ScriptState *script);
@@ -547,8 +559,10 @@
 	int o2_dummy(ScriptState *script);
 
 	// opcodes temporary
+	// TODO: rename it from temporary to something more appropriate
 	int o2t_defineNewShapes(ScriptState *script);
 	int o2t_setCurrentFrame(ScriptState *script);
+	int o2t_playSoundEffect(ScriptState *script);
 	int o2t_setShapeFlag(ScriptState *script);
 	
 	// script

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -25,6 +25,7 @@
  
 #include "kyra/kyra_v2.h"
 #include "kyra/screen_v2.h"
+#include "kyra/sound.h"
 #include "kyra/wsamovie.h"
 
 #include "common/func.h"
@@ -68,7 +69,12 @@
 		moveCharacter(facing, x, y);
 	}
 	
-	//XXX sound
+	bool newSoundFile = false;
+	if (_sceneList[newScene].sound != _lastMusicCommand) {
+		newSoundFile = true;
+		//XXX
+		_sound->beginFadeOut();
+	}
 	
 	_unkFlag1 = false;
 	
@@ -95,7 +101,10 @@
 	_sceneExit3 = scene.exit3;
 	_sceneExit4 = scene.exit4;
 	
-	//XXX sound
+	if (newSoundFile) {
+		//XXX while (snd_isPlaying()) ;
+		snd_loadSoundFile(_sceneList[newScene].sound);
+	}
 	
 	startSceneScript(unk3);
 	
@@ -204,9 +213,8 @@
 	_mainCharacter.y1 = _mainCharacter.y2 = y2;
 	initSceneAnims(unk2);
 	
-	if (!unk2) {
-		//XXX sound
-	}
+	if (!unk2)
+		snd_playWanderScoreViaMap(_sceneList[_mainCharacter.sceneId].sound, 0);
 	
 	if (unk1 && !unk2 && _mainCharacter.animFrame != 32)
 		moveCharacter(facing, x, y);

Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/script_v2.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -440,6 +440,24 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_loadMusicTrack(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "o2_loadMusicTrack(%p) (%d)", (const void *)script, stackPos(0));
+	snd_loadSoundFile(stackPos(0));
+	return 0;
+}
+
+int KyraEngine_v2::o2_playWanderScoreViaMap(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "o2_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+	snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
+	return 0;
+}
+
+int KyraEngine_v2::o2_playSoundEffect(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "o2_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
+	snd_playSoundEffect(stackPos(0));
+	return 0;
+}
+
 int KyraEngine_v2::o2_getRand(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
 	assert(stackPos(0) < stackPos(1));
@@ -607,6 +625,12 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2t_playSoundEffect(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "o2t_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
+	snd_playSoundEffect(stackPos(0));
+	return 0;
+}
+
 int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "o2t_setShapeFlag(%p) (%d)", (const void *)script, stackPos(0));
 	_newShapeFlag = stackPos(0);

Modified: scummvm/trunk/engines/kyra/sequences_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_v1.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/sequences_v1.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -43,7 +43,7 @@
 void KyraEngine_v1::seq_demo() {
 	debugC(9, kDebugLevelMain, "KyraEngine_v1::seq_demo()");
 
-	snd_playTheme(0, 2);
+	snd_playTheme(9, 2);
 
 	_screen->loadBitmap("START.CPS", 7, 7, _screen->_currentPalette);
 	_screen->copyRegion(0, 0, 0, 0, 320, 200, 6, 0);
@@ -114,7 +114,7 @@
 	_seq->setCopyViewOffs(true);
 	_screen->setFont(Screen::FID_8_FNT);
 	if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98)
-		snd_playTheme(0, 2);
+		snd_playTheme(9, 2);
 	_text->setTalkCoords(144);
 
 	for (int i = 0; i < ARRAYSIZE(introProcTable) && !seq_skipSequence(); ++i)

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/sound.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -434,6 +434,50 @@
 	_fadeStartTime = _vm->_system->getMillis();
 }
 
+void KyraEngine::snd_playTheme(int file, int track) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d)", file);
+	_curSfxFile = _curMusicTheme = file;
+	_sound->loadSoundFile(_curMusicTheme);
+	_sound->playTrack(track);
+}
+
+void KyraEngine::snd_playSoundEffect(int track) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playSoundEffect(%d)", track);
+	_sound->playSoundEffect(track);
+}
+
+void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart);
+	if (restart)
+		_lastMusicCommand = -1;
+
+	// no track mapping given
+	// so don't do anything here
+	if (!_trackMap || !_trackMapSize)
+		return;
+
+	//if (!_disableSound) {
+	//	XXX
+	//}
+	
+	assert(command*2+1 < _trackMapSize);
+	if (_curMusicTheme != _trackMap[command*2]) {
+		if (_trackMap[command*2] != -1 && _trackMap[command*2] != -2)
+			snd_playTheme(_trackMap[command*2]);
+	}
+
+	if (command != 1) {
+		if (_lastMusicCommand != command) {
+			_sound->haltTrack();
+			_sound->playTrack(_trackMap[command*2+1]);
+		}
+	} else {
+		_sound->beginFadeOut();
+	}
+
+	_lastMusicCommand = command;
+}
+
 // static res
 
 const Sound::SpeechCodecs Sound::_supportedCodes[] = {

Modified: scummvm/trunk/engines/kyra/sound_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_v1.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/sound_v1.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -36,20 +36,14 @@
 	return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
 }
 
-void KyraEngine_v1::snd_playTheme(int file, int track) {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playTheme(%d)", file);
-	_curSfxFile = _curMusicTheme = file;
-	_sound->loadSoundFile(_curMusicTheme);
-	_sound->playTrack(track);
-}
-
 void KyraEngine_v1::snd_playSoundEffect(int track) {
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playSoundEffect(%d)", track);
 	if ((_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) && track == 49) {
 		snd_playWanderScoreViaMap(56, 1);
 		return;
 	}
-	_sound->playSoundEffect(track);
+
+	KyraEngine::snd_playSoundEffect(track);
 }
 
 void KyraEngine_v1::snd_playWanderScoreViaMap(int command, int restart) {
@@ -71,42 +65,8 @@
 			_sound->haltTrack();
 		}
 	} else {
-		static const int8 soundTable[] = {
-			-1,   0,  -1,   1,   0,   3,   0,   2,
-			 0,   4,   1,   2,   1,   3,   1,   4,
-			 1,  92,   1,   6,   1,   7,   2,   2,
-			 2,   3,   2,   4,   2,   5,   2,   6,
-			 2,   7,   3,   3,   3,   4,   1,   8,
-			 1,   9,   4,   2,   4,   3,   4,   4,
-			 4,   5,   4,   6,   4,   7,   4,   8,
-			 1,  11,   1,  12,   1,  14,   1,  13,
-			 4,   9,   5,  12,   6,   2,   6,   6,
-			 6,   7,   6,   8,   6,   9,   6,   3,
-			 6,   4,   6,   5,   7,   2,   7,   3,
-			 7,   4,   7,   5,   7,   6,   7,   7,
-			 7,   8,   7,   9,   8,   2,   8,   3,
-			 8,   4,   8,   5,   6,  11,   5,  11
-		};
-		//if (!_disableSound) {
-		//	XXX
-		//}
-		assert(command*2+1 < ARRAYSIZE(soundTable));
-		if (_curMusicTheme != soundTable[command*2]+1) {
-			if (soundTable[command*2] != -1)
-				snd_playTheme(soundTable[command*2]+1);
-		}
-	
-		if (command != 1) {
-			if (_lastMusicCommand != command) {
-				_sound->haltTrack();
-				_sound->playTrack(soundTable[command*2+1]);
-			}
-		} else {
-			_sound->beginFadeOut();
-		}
+		KyraEngine::snd_playWanderScoreViaMap(command, restart);
 	}
-
-	_lastMusicCommand = command;
 }
 
 void KyraEngine_v1::snd_playVoiceFile(int id) {

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2007-10-10 05:22:29 UTC (rev 29182)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2007-10-10 09:06:15 UTC (rev 29183)
@@ -905,7 +905,6 @@
 };
 
 const char *KyraEngine_v1::_soundFiles[] = {
-	"INTRO",
 	"KYRA1A",
 	"KYRA1B",
 	"KYRA2A",
@@ -914,7 +913,8 @@
 	"KYRA4B",
 	"KYRA5A",
 	"KYRA5B",
-	"KYRAMISC"
+	"KYRAMISC",
+	"INTRO"
 };
 
 const int KyraEngine_v1::_soundFilesCount = ARRAYSIZE(KyraEngine_v1::_soundFiles);
@@ -925,7 +925,7 @@
 	"TW_SCEN2.SFX",
 	"TW_SCEN3.SFX",
 	"TW_SCEN4.SFX",
-	"TW_SCEN5.SFX",
+	"TW_SCEN5.SFX"
 };
 
 const int KyraEngine_v1::_soundFilesTownsCount = ARRAYSIZE(KyraEngine_v1::_soundFilesTowns);
@@ -1115,6 +1115,25 @@
 const uint16 KyraEngine_v1::_amuletX2[] = { 0x000, 0x0FD, 0x0E7, 0x0FD, 0x113, 0x000 };
 const uint16 KyraEngine_v1::_amuletY2[] = { 0x000, 0x09F, 0x0AA, 0x0B5, 0x0AA, 0x000 };
 
+const int8 KyraEngine_v1::_dosTrackMap[] = {
+	-1,   0,  -1,   1,   0,   3,   0,   2,
+	 0,   4,   1,   2,   1,   3,   1,   4,
+	 1,  92,   1,   6,   1,   7,   2,   2,
+	 2,   3,   2,   4,   2,   5,   2,   6,
+	 2,   7,   3,   3,   3,   4,   1,   8,
+	 1,   9,   4,   2,   4,   3,   4,   4,
+	 4,   5,   4,   6,   4,   7,   4,   8,
+	 1,  11,   1,  12,   1,  14,   1,  13,
+	 4,   9,   5,  12,   6,   2,   6,   6,
+	 6,   7,   6,   8,   6,   9,   6,   3,
+	 6,   4,   6,   5,   7,   2,   7,   3,
+	 7,   4,   7,   5,   7,   6,   7,   7,
+	 7,   8,   7,   9,   8,   2,   8,   3,
+	 8,   4,   8,   5,   6,  11,   5,  11
+};
+
+const int KyraEngine_v1::_dosTrackMapSize = ARRAYSIZE(KyraEngine_v1::_dosTrackMap);
+
 // Kyra 2 and 3 main menu
 
 const char *KyraEngine_v2::_mainMenuStrings[] = {
@@ -1266,8 +1285,55 @@
 	0,    2,    0,    0,    0,    0,    0,    0
 };
 
+const char *KyraEngine_v2::_dosSoundFileList[] = {
+	"K2TEST1",
+	"K2TEST2",
+	"K2TEST3",
+	"K2TEST4",
+	"K2TEST5",
+	"K2TEST6",
+	"K2TEST7",
+	"K2TEST8",
+	"K2TEST9",
+	"K2TEST10",
+	"K2TEST11",
+	"K2TEST12",
+	"K2TEST13",
+	"K2TEST14",
+	"K2TEST15"
+};
+
+const int KyraEngine_v2::_dosSoundFileListSize = ARRAYSIZE(KyraEngine_v2::_dosSoundFileList);
+
 const int KyraEngine_v2::_itemStringMapSize = ARRAYSIZE(KyraEngine_v2::_itemStringMap);
 
+const int8 KyraEngine_v2::_dosTrackMap[] = {
+	-1,    0,   -1,    1,    9,    6,    5,    4,
+	 8,    3,   -2,    0,   -2,    0,    2,    3,
+	-2,    0,   -2,    0,   -2,    0,   -2,    0,
+	 0,    2,    0,    3,    1,    2,    1,    3,
+	 2,    2,    2,    0,    3,    2,    3,    3,
+	 3,    4,    4,    2,    5,    2,    5,    3,
+	 5,    4,    6,    2,    6,    3,    6,    4,
+	 6,    5,    6,    6,    6,    7,    6,    8,
+	 6,    0,    6,    9,    7,    2,    7,    3,
+	 7,    4,    7,    5,    8,    6,    7,    6,
+	 7,    7,    7,    8,    7,    9,    8,    2,
+	14,    2,    8,    4,    8,    7,    8,    8,
+	 8,    9,    9,    2,    9,    3,    9,    4,
+	 9,    5,    9,    7,    9,    8,    9,    9,
+	10,    2,   10,    3,   10,    4,   10,    5,
+	10,    6,   10,    7,   11,    2,   11,    3,
+	11,    4,   11,    5,   11,    6,   11,    7,
+	11,    8,   11,    9,   12,    2,   12,    3,
+	12,    4,   12,    5,   12,    6,   12,    7,
+	12,    8,   12,    9,   13,    2,    4,    7,
+	14,    3,   14,    4,   14,    5,    4,    2,
+	 4,    3,    4,    4,    4,    5,    4,    6
+};
+
+const int KyraEngine_v2::_dosTrackMapSize = ARRAYSIZE(KyraEngine_v2::_dosTrackMap);
+
 // kyra 3 static res
 
 const char *KyraEngine_v3::_soundList[] = {


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