[Scummvm-cvs-logs] scummvm master -> eaa5d50c3f66865a76a5d20f257061b6b79a88f6

athrxx athrxx at scummvm.org
Fri Jan 6 14:50:58 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6e45741b17 KYRA: (EOB) - cleanup eob/lol version of delayUntil()
eaa5d50c3f KYRA: (EOB) - add basic distinction between music and sound effects


Commit: 6e45741b17ec17ec1c2081557df043d5d4f2ff73
    https://github.com/scummvm/scummvm/commit/6e45741b17ec17ec1c2081557df043d5d4f2ff73
Author: athrxx (athrxx at scummvm.org)
Date: 2012-01-06T05:44:34-08:00

Commit Message:
KYRA: (EOB) - cleanup eob/lol version of delayUntil()

Changed paths:
    engines/kyra/eobcommon.cpp
    engines/kyra/kyra_rpg.cpp
    engines/kyra/kyra_rpg.h



diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 4f169ac..c7d8ed5 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -347,7 +347,7 @@ void EoBCoreEngine::initKeymap() {
 		Common::Action *const act = new Common::Action(engineKeyMap, keyActionEntries[i].id, keyActionEntries[i].description, Common::kGenericActionType, Common::kActionKeyType);
 		act->addKeyEvent(keyActionEntries[i].ks);
 	}
-	
+
 	if (_flags.gameID == GI_EOB2) {
 		Common::Action *const act = new Common::Action(engineKeyMap, "SL6", _("Spell Level 6"), Common::kGenericActionType, Common::kActionKeyType);
 		act->addKeyEvent(Common::KeyState(Common::KEYCODE_6));
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index 4487290..b8d56b3 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -308,7 +308,7 @@ uint16 KyraRpgEngine::processDialogue() {
 	return res;
 }
 
-void KyraRpgEngine::delayUntil(uint32 time, bool doUpdate, bool isMainLoop, bool) {
+void KyraRpgEngine::delayUntil(uint32 time, bool, bool doUpdate, bool isMainLoop) {
 	uint32 curTime = _system->getMillis();
 	if (time > curTime)
 		delay(time - curTime, doUpdate, isMainLoop);
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 24c1910..a1b9b4c 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -331,7 +331,7 @@ protected:
 
 	// misc
 	virtual void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false) = 0;
-	void delayUntil(uint32 time, bool doUpdate = false, bool isMainLoop = false, bool unused = false);
+	void delayUntil(uint32 time, bool unused = false, bool doUpdate = false, bool isMainLoop = false);
 	int rollDice(int times, int pips, int inc = 0);
 
 	virtual Common::Error loadGameState(int slot) = 0;


Commit: eaa5d50c3f66865a76a5d20f257061b6b79a88f6
    https://github.com/scummvm/scummvm/commit/eaa5d50c3f66865a76a5d20f257061b6b79a88f6
Author: athrxx (athrxx at scummvm.org)
Date: 2012-01-06T05:45:38-08:00

Commit Message:
KYRA: (EOB) - add basic distinction between music and sound effects

(The original code of the DOS version does not distinguish here, but
we do it anyway so as to make more sense of the GMM volume settings)

Changed paths:
    engines/kyra/chargen.cpp
    engines/kyra/eobcommon.cpp
    engines/kyra/eobcommon.h
    engines/kyra/sequences_darkmoon.cpp
    engines/kyra/sequences_eob.cpp
    engines/kyra/sound_adlib.cpp



diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index 91a9040..ed761e5 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -171,7 +171,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
 	checkForCompleteParty();
 	initButtonsFromList(0, 5);
 
-	_vm->sound()->playTrack(_vm->game() == GI_EOB1 ? 20 : 13);
+	_vm->snd_playSong(_vm->game() == GI_EOB1 ? 20 : 13);
 	_activeBox = 0;
 
 	for (bool loop = true; loop && (!_vm->shouldQuit());) {
@@ -186,7 +186,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
 				_activeBox ^= 2;
 			} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE]) {
 				// Unlike the original we allow returning to the main menu
-				_vm->sound()->haltTrack();
+				_vm->snd_stopSound();
 				return false;
 			}
 			_vm->_gui->updateBoxFrameHighLight(-1);
@@ -232,7 +232,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
 	}
 
 	if (_vm->game() == GI_EOB2)
-		_vm->sound()->playTrack(15);
+		_vm->snd_fadeOut();
 
 	*faceShapes = _faceShapes;
 	return true;
@@ -372,7 +372,7 @@ void CharacterGenerator::toggleSpecialButton(int index, int bodyCustom, int page
 
 void CharacterGenerator::processSpecialButton(int index) {
 	toggleSpecialButton(index, 1, 0);
-	_vm->sound()->playSoundEffect(76);
+	_vm->snd_playSoundEffect(76);
 	_vm->_system->delayMillis(80);
 	toggleSpecialButton(index, 0, 0);
 }
@@ -598,13 +598,13 @@ int CharacterGenerator::alignmentMenu(int cClass) {
 int CharacterGenerator::getInput(Button *buttonList) {
 	if (_vm->game() == GI_EOB1 && _vm->sound()->checkTrigger()) {
 		_vm->sound()->resetTrigger();
-		_vm->sound()->playTrack(20);
+		_vm->snd_playSong(20);
 	} else if (_vm->game() == GI_EOB2 && !_vm->sound()->isPlaying()) {
 		// WORKAROUND for EOB II: The original implements the same sound trigger check as in EOB I.
 		// However, Westwood seems to have forgotten to set the trigger at the end of the AdLib song,
 		// so that the music will not loop. We simply check whether the sound driver is still playing.
 		_vm->delay(3 * _vm->_tickLength);
-		_vm->sound()->playTrack(13);
+		_vm->snd_playSong(13);
 	}
 	return _vm->checkInput(buttonList, false, 0);
 }
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index c7d8ed5..e45bad6 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -1403,7 +1403,7 @@ void EoBCoreEngine::restoreAfterDialogueSequence() {
 	_screen->setScreenDim(7);
 
 	if (_flags.gameID == GI_EOB2)
-		_sound->playTrack(2);
+		snd_playSoundEffect(2);
 
 	_sceneUpdateRequired = true;
 }
@@ -2377,15 +2377,24 @@ void EoBCoreEngine::explodeMonster(EoBMonsterInPlay *m) {
 	m->flags &= ~2;
 }
 
-void EoBCoreEngine::snd_playSoundEffect(int id, int volume) {
-	if ((id < 1) || (_flags.gameID == GI_EOB2 && id > 119) || shouldQuit())
+void EoBCoreEngine::snd_playSong(int track) {
+	_sound->playTrack(track);
+}
+
+void EoBCoreEngine::snd_playSoundEffect(int track, int volume) {
+	if ((track < 1) || (_flags.gameID == GI_EOB2 && track > 119) || shouldQuit())
 		return;
 
-	_sound->playSoundEffect(id, volume);
+	_sound->playSoundEffect(track, volume);
 }
 
 void EoBCoreEngine::snd_stopSound() {
-	_sound->playSoundEffect(0);
+	_sound->haltTrack();
+	_sound->stopAllSoundEffects();
+}
+
+void EoBCoreEngine::snd_fadeOut() {
+	_sound->beginFadeOut();
 }
 
 } // End of namespace Kyra
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index e7b3a73..851c520 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -1127,8 +1127,10 @@ protected:
 	const uint8 *_numSpellsMage;
 
 	// sound
+	void snd_playSong(int id);
 	void snd_playSoundEffect(int id, int volume=0xFF);
 	void snd_stopSound();
+	void snd_fadeOut();
 
 	// keymap
 	static const char *const kKeymapName;
diff --git a/engines/kyra/sequences_darkmoon.cpp b/engines/kyra/sequences_darkmoon.cpp
index c72bf58..516c71e 100644
--- a/engines/kyra/sequences_darkmoon.cpp
+++ b/engines/kyra/sequences_darkmoon.cpp
@@ -177,7 +177,7 @@ void DarkMoonEngine::seq_playIntro() {
 	sq.delay(1);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSong(12);
 
 	_screen->copyRegion(0, 0, 8, 8, 304, 128, 2, 0, Screen::CR_NO_P_CHECK);
 	sq.setPalette(9);
@@ -447,18 +447,17 @@ void DarkMoonEngine::seq_playIntro() {
 	sq.waitForSongNotifier(8, true);
 
 	if (skipFlag() || shouldQuit()) {
-		_sound->playTrack(15);
+		snd_fadeOut();
 	} else {
 		_screen->setScreenDim(17);
 		_screen->clearCurDim();
-		_sound->playTrack(14);
+		snd_playSoundEffect(14);
 		sq.fadePalette(10, 1);
 		_screen->setClearScreenDim(18);
 		sq.delay(6);
 		sq.fadePalette(9, 1);
 		_screen->clearCurPage();
 	}
-
 	sq.fadePalette(9, 10);
 }
 
@@ -479,7 +478,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.delay(18);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(1);
+		snd_playSong(1);
 	sq.update(2);
 
 	sq.loadScene(1, 2);
@@ -603,7 +602,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.waitForSongNotifier(3);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(7);
+		snd_playSoundEffect(7);
 	sq.delay(8);
 
 	sq.runSequence(10);
@@ -635,7 +634,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.waitForSongNotifier(4);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(7);
+		snd_playSoundEffect(7);
 	sq.delay(8);
 
 	sq.runSequence(10);
@@ -660,7 +659,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.delay(36);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 
 	sq.delay(54);
 	sq.fadeText();
@@ -669,7 +668,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.waitForSongNotifier(5);
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(6);
+		snd_playSoundEffect(6);
 
 	if (!skipFlag() && !shouldQuit())
 		_screen->crossFadeRegion(0, 0, 8, 8, 304, 128, 2, 0);
@@ -680,7 +679,7 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.runSequence(19);
 	sq.runSequence(19, 36);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSoundEffect(12);
 	sq.fadeText();
 
 	sq.printText(17, 15);           // Thank you
@@ -690,12 +689,12 @@ void DarkMoonEngine::seq_playFinale() {
 
 	sq.printText(18, 15);           // You have earned my deepest respect
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 	sq.runSequence(20);
 	sq.runSequence(19);
 	sq.runSequence(19);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 	sq.delay(36);
 	sq.fadeText();
 
@@ -703,37 +702,37 @@ void DarkMoonEngine::seq_playFinale() {
 	sq.runSequence(19);
 	sq.runSequence(19, 18);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 	sq.runSequence(20, 18);
 	sq.fadeText();
 
 	sq.delay(28);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSoundEffect(12);
 	sq.delay(3);
 
 	sq.loadScene(5, 2);
 	if (skipFlag() || shouldQuit()) {
 		_screen->copyRegion(0, 0, 8, 8, 304, 128, 2, 0, Screen::CR_NO_P_CHECK);
 	} else {
-		_sound->playTrack(6);
+		snd_playSoundEffect(6);
 		_screen->crossFadeRegion(0, 0, 8, 8, 304, 128, 2, 0);
 	}
 
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSoundEffect(12);
 	sq.delay(5);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 	sq.delay(11);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSoundEffect(12);
 	sq.delay(7);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(11);
+		snd_playSoundEffect(11);
 	sq.delay(12);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(12);
+		snd_playSoundEffect(12);
 
 	removeInputTop();
 	resetSkipFlag(true);
@@ -747,7 +746,7 @@ void DarkMoonEngine::seq_playFinale() {
 
 	sq.delay(18);
 	if (!skipFlag() && !shouldQuit())
-		_sound->playTrack(1);
+		snd_playSong(1);
 
 	seq_playCredits(&sq, _creditsData, 18, 2, 6, 2);
 
@@ -1121,7 +1120,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
 		case 6:
 			// play sound effect
 			if (s->obj != 0xff)
-				_vm->sound()->playSoundEffect(s->obj);
+				_vm->snd_playSoundEffect(s->obj);
 			break;
 
 		default:
diff --git a/engines/kyra/sequences_eob.cpp b/engines/kyra/sequences_eob.cpp
index dc479a8..9f54306 100644
--- a/engines/kyra/sequences_eob.cpp
+++ b/engines/kyra/sequences_eob.cpp
@@ -112,7 +112,7 @@ void EoBEngine::seq_playOpeningCredits() {
 	_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
 	_screen->updateScreen();
 
-	_sound->playTrack(1);
+	snd_playSong(1);
 	delay(_introOpeningFrmDelay[0] * _tickLength);
 
 	for (int i = 0; i < 4 && !shouldQuit() && !skipFlag(); i++) {
@@ -129,7 +129,7 @@ void EoBEngine::seq_playIntro() {
 	_allowSkip = true;
 
 	if (!shouldQuit() && !skipFlag()) {
-		_sound->playTrack(2);
+		snd_playSong(2);
 		_screen->loadBitmap("TITLE-V.CMP", 5, 3, 0);
 		_screen->crossFadeRegion(0, 0, 0, 0, 320, 200, 2, 0);
 		delay(120 * _tickLength);
@@ -295,7 +295,7 @@ void EoBEngine::seq_orb() {
 	_screen->copyPage(3, 4);
 	_screen->clearCurPage();
 
-	_sound->playTrack(6);
+	snd_playSoundEffect(6);
 
 	for (int i = -1; i < 4 && !shouldQuit() && !skipFlag(); i++) {
 		uint32 end = _system->getMillis() + 3 * _tickLength;
@@ -311,7 +311,7 @@ void EoBEngine::seq_orb() {
 	_screen->updateScreen();
 	delay(40 * _tickLength);
 
-	_sound->playTrack(6);
+	snd_playSoundEffect(6);
 
 	for (int i = 3; i > -2 && !shouldQuit() && !skipFlag(); i--) {
 		uint32 end = _system->getMillis() + 3 * _tickLength;
@@ -350,7 +350,7 @@ void EoBEngine::seq_waterdeepEntry() {
 
 	_screen->copyPage(3, 4);
 	_screen->fillRect(0, 168, 319, 199, 12, 0);
-	_sound->playTrack(6);
+	snd_playSoundEffect(6);
 
 	for (int i = 0; i < 4 && !shouldQuit() && !skipFlag(); i++) {
 		uint32 end = _system->getMillis() + 3 * _tickLength;
@@ -415,7 +415,7 @@ void EoBEngine::seq_waterdeepEntry() {
 		}
 
 		if (!(_rnd.getRandomNumber(255) & 7))
-			_sound->playTrack(_rnd.getRandomBit() ? 5 : 14);
+			snd_playSoundEffect(_rnd.getRandomBit() ? 5 : 14);
 
 		_screen->updateScreen();
 		delayUntil(end);
@@ -502,7 +502,7 @@ void EoBEngine::seq_king() {
 		}
 
 		if (!(_rnd.getRandomNumber(255) & 3))
-			_sound->playTrack(7);
+			snd_playSoundEffect(7);
 
 		_screen->updateScreen();
 		delayUntil(end);
@@ -534,7 +534,7 @@ void EoBEngine::seq_hands() {
 
 	_screen->updateScreen();
 	delay(15 * _tickLength);
-	_sound->playTrack(11);
+	snd_playSoundEffect(11);
 
 	for (int i = -22; i <= 20 && !shouldQuit() && !skipFlag(); i += 4) {
 		uint32 end = _system->getMillis() + _tickLength;
@@ -546,7 +546,7 @@ void EoBEngine::seq_hands() {
 		delayUntil(end);
 	}
 
-	_sound->playTrack(10);
+	snd_playSoundEffect(10);
 
 	delete[] shp1;
 	delete[] shp2;
@@ -574,7 +574,7 @@ void EoBEngine::seq_hands() {
 		delayUntil(end);
 	}
 
-	_sound->playTrack(12);
+	snd_playSoundEffect(12);
 	delay(5 * _tickLength);
 
 	for (int i = 0; i > -54 && !shouldQuit() && !skipFlag(); i -= 4) {
@@ -602,7 +602,7 @@ void EoBEngine::seq_hands() {
 	_screen->drawShape(2, shp2, 52, 49, 0);
 	boxMorphTransition(9, 6, 0, 0, 0, 0, 18, 12, 8, 11, 21, 10);
 	delay(15 * _tickLength);
-	_sound->playTrack(11);
+	snd_playSoundEffect(11);
 
 	for (int i = -56; i <= -8 && !shouldQuit() && !skipFlag(); i += 4) {
 		uint32 end = _system->getMillis() + _tickLength;
@@ -614,7 +614,7 @@ void EoBEngine::seq_hands() {
 		delayUntil(end);
 	}
 
-	_sound->playTrack(10);
+	snd_playSoundEffect(10);
 	delete[] shp1;
 	delete[] shp2;
 	delay(30 * _tickLength);
@@ -640,7 +640,7 @@ void EoBEngine::seq_hands() {
 		dy -= 5;
 	}
 
-	_sound->playTrack(13);
+	snd_playSoundEffect(13);
 
 	for (int i = -40; i <= 0 && !shouldQuit() && !skipFlag(); i += 4) {
 		uint32 end = _system->getMillis() + _tickLength;
@@ -701,7 +701,7 @@ void EoBEngine::seq_waterdeepExit() {
 		}
 
 		if (!(_rnd.getRandomNumber(255) & 7))
-			_sound->playTrack(_rnd.getRandomBit() ? 5 : 14);
+			snd_playSoundEffect(_rnd.getRandomBit() ? 5 : 14);
 
 		_screen->updateScreen();
 		delayUntil(end);
@@ -742,7 +742,7 @@ void EoBEngine::seq_waterdeepExit() {
 		delayUntil(end);
 	}
 
-	_sound->playTrack(3);
+	snd_playSong(3);
 	delay(60 * _tickLength);
 
 	for (int i = 0; i < 56 && !shouldQuit() && !skipFlag(); i++) {
@@ -787,11 +787,11 @@ void EoBEngine::seq_tunnel() {
 	for (int i = 0; i < 3 && !shouldQuit() && !skipFlag(); i++) {
 		uint32 end = _system->getMillis() + 8 * _tickLength;
 		_screen->copyRegion(0, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
-		_sound->playTrack(7);
+		snd_playSoundEffect(7);
 		_screen->updateScreen();
 		delayUntil(end);
 		_screen->copyRegion(0, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
-		_sound->playTrack(7);
+		snd_playSoundEffect(7);
 		end = _system->getMillis() + 8 * _tickLength;
 		_screen->updateScreen();
 		delayUntil(end);
@@ -820,11 +820,11 @@ void EoBEngine::seq_tunnel() {
 	delay(40 * _tickLength);
 
 	_screen->copyRegion(264, 0, 136, 56, 48, 48, 4, 0, Screen::CR_NO_P_CHECK);
-	_sound->playTrack(8);
+	snd_playSoundEffect(8);
 	_screen->copyRegion(0, 0, 0, 0, 320, 184, 0, 2, Screen::CR_NO_P_CHECK);
 	_screen->updateScreen();
 	delay(16 * _tickLength);
-	_sound->playTrack(4);
+	snd_playSoundEffect(4);
 
 	for (int i = 0; i < 30 && !shouldQuit() && !skipFlag(); i++) {
 		uint32 end = _system->getMillis() + _tickLength;
@@ -835,7 +835,7 @@ void EoBEngine::seq_tunnel() {
 		delayUntil(end);
 	}
 
-	_sound->playTrack(9);
+	snd_playSoundEffect(9);
 
 	for (int i = 0; i < 6 && !shouldQuit() && !skipFlag(); i++) {
 		uint32 end = _system->getMillis() + _tickLength;
@@ -853,7 +853,7 @@ void EoBEngine::seq_tunnel() {
 
 	_screen->loadBitmap(_introFilesTunnel[1], 5, 3, 0);
 	_screen->copyPage(3, 4);
-	_sound->playTrack(6);
+	snd_playSoundEffect(6);
 	_screen->copyRegion(0, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
 	_screen->updateScreen();
 	delay(2 * _tickLength);
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index cce18b5..668e662 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -2405,7 +2405,7 @@ void SoundAdLibPC::play(uint8 track, uint8 volume) {
 }
 
 void SoundAdLibPC::beginFadeOut() {
-	play(1, 0xff);
+	play(_version > 2 ? 1 : 15, 0xff);
 }
 
 int SoundAdLibPC::checkTrigger() {






More information about the Scummvm-git-logs mailing list