[Scummvm-cvs-logs] CVS: scummvm/kyra gui.cpp,1.2,1.3 kyra.cpp,1.116,1.117 kyra.h,1.65,1.66 saveload.cpp,1.4,1.5 script_v1.cpp,1.64,1.65 sound.cpp,1.11,1.12 sound.h,1.7,1.8 sprites.cpp,1.21,1.22 staticres.cpp,1.37,1.38

Johannes Schickel lordhoto at users.sourceforge.net
Thu Jan 12 05:17:25 CET 2006


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5990

Modified Files:
	gui.cpp kyra.cpp kyra.h saveload.cpp script_v1.cpp sound.cpp 
	sound.h sprites.cpp staticres.cpp 
Log Message:
Implemented 'ingame' sound handling, and named the unknown opcodes from the cd version
and 'implemented' them.


Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/gui.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gui.cpp	6 Jan 2006 10:45:41 -0000	1.2
+++ gui.cpp	12 Jan 2006 13:16:42 -0000	1.3
@@ -45,12 +45,12 @@
 	uint8 inventoryItem = _currentCharacter->inventoryItems[itemOffset];
 	if (_itemInHand == -1) {
 		if (inventoryItem == 0xFF) {
-			// snd_playSoundEffect(0x36);
+			snd_playSoundEffect(0x36);
 			return 0;
 		} else {
 			_screen->hideMouse();
 			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
-			// snd_playSoundEffect(0x35);
+			snd_playSoundEffect(0x35);
 			setMouseItem(inventoryItem);
 			updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179);
 			_itemInHand = inventoryItem;
@@ -59,7 +59,7 @@
 		}
 	} else {
 		if (inventoryItem != 0xFF) {
-			// snd_playSoundEffect(0x35);
+			snd_playSoundEffect(0x35);
 			_screen->hideMouse();
 			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
 			_screen->drawShape(0, _shapes[220+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
@@ -69,7 +69,7 @@
 			_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
 			_itemInHand = inventoryItem;
 		} else {
-			// snd_playSoundEffect(0x32);
+			snd_playSoundEffect(0x32);
 			_screen->hideMouse();
 			_screen->drawShape(0, _shapes[220+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
 			_screen->setMouseCursor(1, 1, _shapes[4]);
@@ -156,9 +156,9 @@
 					// do not check for item in hand again as in the original since some strings are missing
 					// in the cd version
 					if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
-						// XXX
+						snd_playWanderScoreViaMap(1, 0);
 						seq_makeBrandonWisp();
-						// XXX
+						snd_playWanderScoreViaMap(17, 0);
 					} else {
 						seq_makeBrandonWisp();
 					}

Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- kyra.cpp	10 Jan 2006 16:03:38 -0000	1.116
+++ kyra.cpp	12 Jan 2006 13:16:42 -0000	1.117
@@ -1012,7 +1012,7 @@
 		0x152, 0x157, 0x15C, 0x161, 0x166, 0xFFFF
 	};
 	if (!noSound)
-		// snd_playSoundEffect(0x5F)
+		snd_playSoundEffect(0x5F);
 	_screen->hideMouse();
 	if (!drawOnly) {
 		for (int i = 0; specialJewelTable[i] != 0xFFFF; ++i) {
@@ -1067,7 +1067,7 @@
 	assert(_healingShapeTable);
 	setupShapes123(_healingShapeTable, 22, 0);
 	setBrandonAnimSeqSize(3, 48);
-	// snd_playSoundEffect(0x53);
+	snd_playSoundEffect(0x53);
 	for (int i = 123; i <= 144; ++i) {
 		_currentCharacter->currentAnimFrame = i;
 		animRefreshNPC(0);
@@ -1093,7 +1093,7 @@
 	setupShapes123(_healingShape2Table, 30, 0);
 	resetBrandonPoisonFlags();
 	setBrandonAnimSeqSize(3, 48);
-	// snd_playSoundEffect(0x50);
+	snd_playSoundEffect(0x50);
 	for (int i = 123; i <= 152; ++i) {
 		_currentCharacter->currentAnimFrame = i;
 		animRefreshNPC(0);
@@ -1117,7 +1117,7 @@
 	if (now)
 		_poisonDeathCounter = 2;
 	if (_poisonDeathCounter >= 2) {
-		// XXX
+		snd_playWanderScoreViaMap(1, 1);
 		assert(_thePoison);
 		characterSays(_thePoison[0], 0, -2);
 		characterSays(_thePoison[1], 0, -2);
@@ -1185,15 +1185,15 @@
 	
 	int delayTime = 0, soundType = 0;
 	if (queryGameFlag(0x85)) {
-		// snd_playSoundEffect(0x63);
+		snd_playSoundEffect(0x63);
 		delayTime = 9;
 		soundType = 3;
 	} else if (queryGameFlag(0x86)) {
-		// snd_playSoundEffect(0x61);
+		snd_playSoundEffect(0x61);
 		delayTime = 2;
 		soundType = 1;
 	} else {
-		// snd_playSoundEffect(0x62);
+		snd_playSoundEffect(0x62);
 		delayTime = 2;
 		soundType = 2;
 	}
@@ -1241,7 +1241,7 @@
 	}
 	
 	freeShapes123();
-	// snd_playSoundEffect(0x20);
+	snd_playSoundEffect(0x20);
 	setupShapes123(_winterScroll1Table, 35, 0);
 	
 	for (int i = 123; i <= 146; ++i) {
@@ -1251,7 +1251,7 @@
 	}
 	
 	if (_currentCharacter->sceneId == 41 && !queryGameFlag(0xA2)) {
-		// snd_playSoundEffect(0x20);
+		snd_playSoundEffect(0x20);
 		_sprites->_anims[0].play = false;
 		_animator->sprites()[0].active = 0;
 		_sprites->_anims[1].play = true;
@@ -1337,7 +1337,7 @@
 	_brandonStatusBit |= 0x20;
 	setTimerCountdown(18, 2700);
 	_brandonStatusBit |= 0x40;
-	// snd_playSoundEffect(0x77);
+	snd_playSoundEffect(0x77);
 	_brandonInvFlag = 0;
 	while (_brandonInvFlag <= 0x100) {
 		animRefreshNPC(0);
@@ -1352,7 +1352,7 @@
 	debug(9, "seq_makeBrandonNormal()");
 	_screen->hideMouse();
 	_brandonStatusBit |= 0x40;
-	// snd_playSoundEffect(0x77);
+	snd_playSoundEffect(0x77);
 	_brandonInvFlag = 0x100;
 	while (_brandonInvFlag >= 0) {
 		animRefreshNPC(0);
@@ -1371,7 +1371,7 @@
 	setupShapes123(_brandonToWispTable, 26, 0);
 	setBrandonAnimSeqSize(5, 48);
 	_brandonStatusBit &= 0xFFFD;
-	// snd_playSoundEffect(0x6C);
+	snd_playSoundEffect(0x6C);
 	for (int i = 138; i >= 123; --i) {
 		_currentCharacter->currentAnimFrame = i;
 		animRefreshNPC(0);
@@ -1403,7 +1403,7 @@
 	assert(_brandonToWispTable);
 	setupShapes123(_brandonToWispTable, 26, 0);
 	setBrandonAnimSeqSize(5, 48);
-	// snd_playSoundEffect(0x6C);
+	snd_playSoundEffect(0x6C);
 	for (int i = 123; i <= 138; ++i) {
 		_currentCharacter->currentAnimFrame = i;
 		animRefreshNPC(0);
@@ -1450,7 +1450,7 @@
 	assert(_magicAnimationTable);
 	setupShapes123(_magicAnimationTable, 5, 0);
 	setBrandonAnimSeqSize(8, 49);
-	// snd_playSoundEffect(0x15);
+	snd_playSoundEffect(0x15);
 	for (int i = 123; i <= 127; ++i) {
 		_currentCharacter->currentAnimFrame = i;
 		animRefreshNPC(0);
@@ -1516,7 +1516,7 @@
 		animRefreshNPC(0);
 		delayWithTicks(5);
 	}	
-	// snd_playSoundEffect(0x34);
+	snd_playSoundEffect(0x34);
 	for (int i = 0; i < 2; ++i) {
 		_currentCharacter->currentAnimFrame = 130;
 		animRefreshNPC(0);
@@ -1553,7 +1553,7 @@
 	}
 	_screen->_curPage = 2;
 	if (_endSequenceNeedLoading) {
-		// XXX
+		snd_playWanderScoreViaMap(50, 1);
 		setupPanPages();
 		_finalA = new WSAMovieV1(this);
 		assert(_finalA);
@@ -1602,13 +1602,13 @@
 			_finalA->_x = _finalA->_y = 8;
 			_finalA->_drawPage = 0;
 			while (_system->getMillis() < nextTime) {}
-			// snd_playSoundEffect(0x40);
+			snd_playSoundEffect(0x40);
 			for (int i = 0; i < 22; ++i) {
 				while (_system->getMillis() < nextTime) {}
 				if (i == 4) {
-					// snd_playSoundEffect(0x3E);
+					snd_playSoundEffect(0x3E);
 				} else if (i == 20) {
-					// snd_playSoundEffect(0x0E);
+					snd_playSoundEffect(0x0E);
 				}
 				nextTime = _system->getMillis() + 8 * _tickLength;
 				_finalA->displayFrame(i);
@@ -1679,6 +1679,7 @@
 	_screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0);
 	_screen->setTextColorMap(colorMap);
 	_screen->_charWidth = -1;
+	snd_playWanderScoreViaMap(53, 1);
 	// delete
 	_screen->updateScreen();
 	// XXX
@@ -1701,9 +1702,9 @@
 	_midi->playTrack(track, false);
 }
 
-void KyraEngine::snd_playTrack(int track) {
-	debug(9, "KyraEngine::snd_playTrack(%d)", track);
-	_midi->playTrack(track, false);
+void KyraEngine::snd_playTrack(int track, bool looping) {
+	debug(9, "KyraEngine::snd_playTrack(%d, %d)", track, looping);
+	_midi->playTrack(track, looping);
 }
 
 void KyraEngine::snd_setSoundEffectFile(int file) {
@@ -1714,7 +1715,49 @@
 
 void KyraEngine::snd_playSoundEffect(int track) {
 	debug(9, "KyraEngine::snd_playSoundEffect(%d)", track);
-	_midi->playSoundEffect(track);
+	if (track == 49) {
+		snd_playWanderScoreViaMap(56, 1);
+	} else {
+		_midi->playSoundEffect(track);
+	}
+}
+
+void KyraEngine::snd_playWanderScoreViaMap(int unk1, int unk2) {
+	debug(9, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", unk1, unk2);
+	const static int8 soundTable[] = {
+		-1,   0,  -1,   1,   0,   3,   0,   2,
+		 0,   4,   1,   2,   1,   3,   1,   4,
+		 1, 0x5C,   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, 0x0B,   1, 0x0C,   1, 0x0E,   1, 0x0D,
+		 4,   9,   5, 0x0C,   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, 0x0B,   5, 0x0B
+	};
+	//if (!_disableSound) {
+	//	XXX
+	//}
+	assert(unk1*2+1 < ARRAYSIZE(soundTable));
+	if (_curMusicTheme != soundTable[unk1*2]+1) {
+		if (soundTable[unk1*2] != -1) {
+			snd_playTheme(soundTable[unk1*2]+1);
+		}
+	}
+	
+	if (unk1 != 1) {
+		snd_playTrack(soundTable[unk1*2+1], true);
+	} else {
+		_midi->beginFadeOut();
+		while (_midi->fadeOut()) {
+			_system->delayMillis(10);
+		}
+	}
 }
 
 void KyraEngine::snd_playVoiceFile(int id) {
@@ -1995,19 +2038,19 @@
 	_abortWalkFlag = false;
 	_abortWalkFlag2 = false;
 	if (_currentCharacter->sceneId == 7 && sceneId == 24) {
-		_newMusicTheme = 2;
-	} else if (_currentCharacter->sceneId == 25 && sceneId == 109) {
 		_newMusicTheme = 3;
-	} else if (_currentCharacter->sceneId == 120 && sceneId == 37) {
+	} else if (_currentCharacter->sceneId == 25 && sceneId == 109) {
 		_newMusicTheme = 4;
-	} else if (_currentCharacter->sceneId == 52 && sceneId == 199) {
+	} else if (_currentCharacter->sceneId == 120 && sceneId == 37) {
 		_newMusicTheme = 5;
+	} else if (_currentCharacter->sceneId == 52 && sceneId == 199) {
+		_newMusicTheme = 6;
 	} else if (_currentCharacter->sceneId == 37 && sceneId == 120) {
-		_newMusicTheme = 3;
+		_newMusicTheme = 4;
 	} else if (_currentCharacter->sceneId == 109 && sceneId == 25) {
-		_newMusicTheme = 2;
+		_newMusicTheme = 3;
 	} else if (_currentCharacter->sceneId == 24 && sceneId == 7) {
-		_newMusicTheme = 1;
+		_newMusicTheme = 2;
 	}
 	if (_newMusicTheme != _curMusicTheme) {
 		snd_playTheme(_newMusicTheme);
@@ -3643,7 +3686,7 @@
 	currentRoom->itemsTable[itemIndex] = _itemInHand;
 	_itemInHand = item;
 	_animator->animAddGameItem(itemIndex, sceneId);
-	// XXX snd_kyraPlaySound 53
+	snd_playSoundEffect(53);
 	
 	setMouseItem(_itemInHand);
 	assert(_itemList && _takenList);
@@ -3720,7 +3763,7 @@
 		currentRoom->itemsXPos[freeItem] = destX;
 		currentRoom->itemsYPos[freeItem] = destY;
 		currentRoom->itemsTable[freeItem] = item;
-		// call kyraPlaySound(0x32)
+		snd_playSoundEffect(0x32);
 		_animator->animAddGameItem(freeItem, _currentCharacter->sceneId);
 		return;
 	}
@@ -3759,7 +3802,7 @@
 		}
 		
 		if (!skip) {
-			// call kyraPlaySound(0x47)
+			snd_playSoundEffect(0x47);
 			if (addY < 6)
 				addY = 6;
 			
@@ -3801,7 +3844,7 @@
 	currentRoom->itemsXPos[freeItem] = destX;
 	currentRoom->itemsYPos[freeItem] = destY;
 	currentRoom->itemsTable[freeItem] = item;
-	// call kyraPlaySound(0x32)
+	snd_playSoundEffect(0x32);
 	_animator->animAddGameItem(freeItem, _currentCharacter->sceneId);
 	_screen->showMouse();
 }
@@ -3810,7 +3853,7 @@
 	debug(9, "KyraEngine::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2);
 	if (processItemDrop(_currentCharacter->sceneId, item, x, y, unk1, unk2))
 		return;
-	// call kyraPlaySound(54)
+	snd_playSoundEffect(54);
 	if (12 == countItemsInScene(_currentCharacter->sceneId)) {
 		assert(_noDropList);
 		drawSentenceCommand(_noDropList[0], 6);
@@ -3860,7 +3903,7 @@
 	int yAdd = (int8)(((16 - _itemTable[item].height) >> 1) & 0xFF);
 	backUpRect0(x, y);
 	if (item >= 80 && item <= 89) {
-		// snd_kyraPlaySound(55);
+		snd_playSoundEffect(55);
 	}
 	
 	for (int i = 201; i <= 205; ++i) {
@@ -3923,9 +3966,9 @@
 	}
 	
 	if (animIndex == 2) {
-		// snd_kyraPlaySound(0x5E);
+		snd_playSoundEffect(0x5E);
 	} else {
-		// snd_kyraPlaySound(0x37);
+		snd_playSoundEffect(0x37);
 	}
 	_screen->hideMouse();
 	backUpRect1(x, y);
@@ -4014,9 +4057,9 @@
 	_screen->hideMouse();
 	backUpRect1(x, y);
 	if (animIndex == 2) {
-		// snd_playSoundEffect(0x5E);
+		snd_playSoundEffect(0x5E);
 	} else {
-		// snd_playSoundEffect(0x37);
+		snd_playSoundEffect(0x37);
 	}
 	
 	for (int shape = _magicMouseItemStartFrame[animIndex]; shape <= _magicMouseItemEndFrame[animIndex]; ++shape) {
@@ -4234,7 +4277,7 @@
 	} else {
 		shape = jewel + 0x149;
 	}
-	// snd_playSoundEffect(0x45);
+	snd_playSoundEffect(0x45);
 	_screen->drawShape(0, _shapes[4+shape], _amuletX2[jewel], _amuletY2[jewel], 0, 0);
 	_screen->updateScreen();
 	delayWithTicks(2);
@@ -4696,8 +4739,8 @@
 			break;
 		
 		case 9:
-			// snd_playSoundEffect(12);
-			// snd_playSoundEffect(12);
+			snd_playSoundEffect(12);
+			snd_playSoundEffect(12);
 			_finalC->_x = 16;
 			_finalC->_y = 50;
 			_finalC->_drawPage = 0;
@@ -4707,7 +4750,7 @@
 				_screen->updateScreen();
 				while (_system->getMillis() < timer2) {}
 			}
-			// XXX
+			snd_playWanderScoreViaMap(51, 1);
 			waitTicks(60);
 			_malcolmFlag = 0;
 			return 1;
@@ -4845,7 +4888,7 @@
 					_unkEndSeqVar4 = 1;
 				}
 				if (_system->getMillis() > timer2 && _malcolmFlag == 7 && !_unkAmuletVar && !_text->printed()) {
-					// snd_playSoundEffect(0x0B);
+					snd_playSoundEffect(0x0B);
 					if (_currentCharacter->x1 > 233 && _currentCharacter->x1 < 305 && _currentCharacter->y1 > 85 && _currentCharacter->y1 < 105 &&
 						(_brandonStatusBit & 0x20)) {
 						beadState1.unk8 = 290;
@@ -4875,8 +4918,8 @@
 						_unkEndSeqVar5 = 2;
 						_beadStateVar = 6;
 					} else {
-						// XXX
-						// snd_playSoundEffect(0x0C);
+						snd_playWanderScoreViaMap(52, 1);
+						snd_playSoundEffect(0x0C);
 						_unkEndSeqVar5 = 1;
 						_beadStateVar = 0;
 					}
@@ -4912,7 +4955,7 @@
 							_screen->updateScreen();
 							while (_system->getMillis() < nextRun) {}
 						}
-						// snd_playSoundEffect(0x0D);
+						snd_playSoundEffect(0x0D);
 						for (int i = 7; i >= 0; --i) {
 							nextRun = _system->getMillis() + _tickLength;
 							_finalB->displayFrame(i);
@@ -5768,7 +5811,7 @@
 		if (_itemInHand == -1) {
 			_screen->hideMouse();
 			_animator->animRemoveGameItem(item);
-			// XXX call kyraPlaySound(53)
+			snd_playSoundEffect(53);
 			assert(_currentCharacter->sceneId < _roomTableSize);
 			Room *currentRoom = &_roomTable[_currentCharacter->sceneId];
 			int item2 = currentRoom->itemsTable[item];

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- kyra.h	7 Jan 2006 23:55:49 -0000	1.65
+++ kyra.h	12 Jan 2006 13:16:42 -0000	1.66
@@ -215,10 +215,11 @@
 	void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData);
 
 	void snd_playTheme(int file, int track = 0);
-	void snd_playTrack(int track);
+	void snd_playTrack(int track, bool looping = false);
 	void snd_playVoiceFile(int id);
 	bool snd_voicePlaying();
 	void snd_playSoundEffect(int track);
+	void snd_playWanderScoreViaMap(int unk1, int unk2);
 
 	void drawSentenceCommand(char *sentence, int unk1);
 	void updateSentenceCommand(char *str1, char *str2, int unk1);
@@ -400,6 +401,8 @@
 	int cmd_setPaletteChangeFlag(ScriptState *script);
 	int cmd_fillRect(ScriptState *script);
 	int cmd_dummy(ScriptState *script);
+	int cmd_vocUnload(ScriptState *script);
+	int cmd_vocLoad(ScriptState *script);
 
 protected:
 

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/saveload.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- saveload.cpp	10 Jan 2006 16:10:54 -0000	1.4
+++ saveload.cpp	12 Jan 2006 13:16:42 -0000	1.5
@@ -69,6 +69,9 @@
 	} else {
 		warning("Make sure your savefile was from this version! (too old savefile version to detect that)");
 	}
+	
+	snd_playSoundEffect(0x0A);
+	snd_playWanderScoreViaMap(0, 1);
 
 	// unload the current voice file should fix some problems with voices
 	if (_currentRoom != 0xFFFF && (_features & GF_TALKIE)) {

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- script_v1.cpp	11 Jan 2006 13:28:37 -0000	1.64
+++ script_v1.cpp	12 Jan 2006 13:16:42 -0000	1.65
@@ -264,12 +264,14 @@
 }
 
 int KyraEngine::cmd_playAdlibSound(ScriptState *script) {
-	warning("STUB: cmd_playAdlibSound");
+	debug(3, "cmd_playAdlibSound(0x%X) (%d)", script, stackPos(0));
+	snd_playSoundEffect(stackPos(0));
 	return 0;
 }
 
 int KyraEngine::cmd_playAdlibScore(ScriptState *script) {
-	warning("STUB: cmd_playAdlibScore");
+	debug(3, "cmd_playAdlibScore(0x%X) (%d, %d)", script, stackPos(0), stackPos(1));
+	snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
 	return 0;
 }
 
@@ -1234,22 +1236,22 @@
 	if (amulet.opened()) {
 		assert(_amuleteAnim);
 		_screen->hideMouse();
-		// snd_kyraPlaySound(0x70);
+		snd_playSoundEffect(0x70);
 		uint32 nextTime = 0;
 		for (int i = 0; _amuleteAnim[i] != 0xFF; ++i) {
 			nextTime = _system->getMillis() + 5 * _tickLength;
 			
 			uint8 code = _amuleteAnim[i];
 			if (code == 3 || code == 7) {
-				// snd_kyraPlaySound(0x71);
+				snd_playSoundEffect(0x71);
 			}
 			
 			if (code == 5) {
-				// snd_kyraPlaySound(0x72);
+				snd_playSoundEffect(0x72);
 			}
 			
 			if (code == 14) {
-				// snd_kyraPlaySound(0x73);
+				snd_playSoundEffect(0x73);
 			}
 			
 			
@@ -1697,6 +1699,18 @@
 	return 0;
 }
 
+int KyraEngine::cmd_vocUnload(ScriptState *script) {
+	debug(3, "cmd_vocUnload(0x%X) ()", script);
+	// this should unload all voc files (not needed)
+	return 0;
+}
+
+int KyraEngine::cmd_vocLoad(ScriptState *script) {
+	debug(3, "cmd_vocLoad(0x%X) (%d)", script, stackPos(0));
+	// this should load the specified voc file (not needed)
+	return 0;
+}
+
 int KyraEngine::cmd_dummy(ScriptState *script) {
 	debug(3, "cmd_dummy(0x%X) ()", script);
 	return 0;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/sound.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sound.cpp	13 Dec 2005 04:11:57 -0000	1.11
+++ sound.cpp	12 Jan 2006 13:16:42 -0000	1.12
@@ -110,7 +110,8 @@
 			_virChannel[channel] = channel + 16;
 			if (!_channel[_virChannel[channel]])
 				_channel[_virChannel[channel]] = _driver->allocateChannel();
-			_channel[_virChannel[channel]]->volume(_channelVolume[channel] * _volume / 255);
+			if (_channel[_virChannel[channel]])
+				_channel[_virChannel[channel]]->volume(_channelVolume[channel] * _volume / 255);
 		}
 		return;
 	}
@@ -132,7 +133,8 @@
 
 	if (!_channel[_virChannel[channel]]) {
 		_channel[_virChannel[channel]] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
-		_channel[_virChannel[channel]]->volume(_channelVolume[channel] * _volume / 255);
+		if (_channel[_virChannel[channel]])
+			_channel[_virChannel[channel]]->volume(_channelVolume[channel] * _volume / 255);
 	}
 	if (_channel[_virChannel[channel]])
 		_channel[_virChannel[channel]]->send(b);
@@ -259,6 +261,8 @@
 		music->setVolume(255);
 		music->_fadeStartTime = 0;
 		music->_fadeMusicOut = false;
+		music->_isLooping = false;
+		music->_isPlaying = false;
 	}
 
 	if (music->_isPlaying) {

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/sound.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sound.h	18 Oct 2005 01:30:18 -0000	1.7
+++ sound.h	12 Jan 2006 13:16:42 -0000	1.8
@@ -58,6 +58,7 @@
 	void playSoundEffect(uint8 track);
 
 	void beginFadeOut();
+	bool fadeOut() { return _fadeMusicOut; }
 
 	//MidiDriver interface implementation
 	int open();

Index: sprites.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/sprites.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- sprites.cpp	10 Jan 2006 02:43:30 -0000	1.21
+++ sprites.cpp	12 Jan 2006 13:16:42 -0000	1.22
@@ -347,7 +347,7 @@
 				data += 2;
 				debug(6, "func: Play sound");
 				debug(6, "Sound index %i", READ_LE_UINT16(data));
-				//_engine->snd_playSoundEffect(READ_LE_UINT16(data));
+				_engine->snd_playSoundEffect(READ_LE_UINT16(data));
 				data += 2;
 				break;
 			case 0xFFB1:
@@ -366,8 +366,8 @@
 				data += 2;
 				debug(6, "Percentage %i", READ_LE_UINT16(data));
 				rndNr = _rnd.getRandomNumber(100);
-				//if (rndNr <= READ_LE_UINT16(data))
-					//_engine->snd_playSoundEffect(sound);
+				if (rndNr <= READ_LE_UINT16(data))
+					_engine->snd_playSoundEffect(sound);
 				data += 2;
 				break;
 			case 0xFFA7:

Index: staticres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/staticres.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- staticres.cpp	11 Jan 2006 13:28:38 -0000	1.37
+++ staticres.cpp	12 Jan 2006 13:16:42 -0000	1.38
@@ -665,9 +665,8 @@
 	// 0x98
 	Opcode(cmd_setPaletteChangeFlag),
 	Opcode(cmd_fillRect),
-	Opcode(cmd_dummy),
-	Opcode(cmd_dummy),
-	Opcode(cmd_dummy),
+	Opcode(cmd_vocUnload),
+	Opcode(cmd_vocLoad),
 	Opcode(cmd_dummy)
 };
 #undef Opcode





More information about the Scummvm-git-logs mailing list