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

vinterstum at users.sourceforge.net vinterstum at users.sourceforge.net
Sat May 27 23:09:00 CEST 2006


Revision: 22703
Author:   vinterstum
Date:     2006-05-27 23:07:54 -0700 (Sat, 27 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22703&view=rev

Log Message:
-----------
Added speechEnabled() and textEnabled() to simplify the text/speech config checks a bit, and added checks some more places

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/script_v1.cpp
    scummvm/trunk/engines/kyra/sequences_v1.cpp
    scummvm/trunk/engines/kyra/sound.cpp
Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2006-05-28 06:04:46 UTC (rev 22702)
+++ scummvm/trunk/engines/kyra/gui.cpp	2006-05-28 06:07:54 UTC (rev 22703)
@@ -111,21 +111,21 @@
 		return 1;
 	if (_itemInHand != -1) {
 		assert(_putDownFirst);
-		if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(2000);
 		}
-		if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+		if (textEnabled())	
 			characterSays(_putDownFirst[0], 0, -2);
 		return 1;
 	}
 	if (queryGameFlag(0xF1)) {
 		assert(_waitForAmulet);
-		if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(2001);
 		}
-		if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+		if (textEnabled())	
 			characterSays(_waitForAmulet[0], 0, -2);	
 		return 1;
 	}
@@ -133,11 +133,11 @@
 		assert(_blackJewel);
 		_animator->makeBrandonFaceMouse();
 		drawJewelPress(jewel, 1);
-		if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(2002);
 		}
-		if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+		if (textEnabled())	
 			characterSays(_blackJewel[0], 0, -2);
 		return 1;
 	}
@@ -165,11 +165,11 @@
 		} else if (_brandonStatusBit == 0) {
 			seq_brandonHealing();
 			assert(_healingTip);
-			if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+			if (speechEnabled()) {
 				snd_voiceWaitForFinish();
 				snd_playVoiceFile(2003);
 			}
-			if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+			if (textEnabled())	
 				characterSays(_healingTip[0], 0, -2);
 		}
 		break;
@@ -181,11 +181,11 @@
 	case 2:
 		if (_brandonStatusBit & 1) {
 			assert(_wispJewelStrings);
-			if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+			if (speechEnabled()) {
 				snd_voiceWaitForFinish();
 				snd_playVoiceFile(2004);
 			}
-			if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+			if (textEnabled())	
 				characterSays(_wispJewelStrings[0], 0, -2);
 		} else {
 			if (_brandonStatusBit & 2) {
@@ -210,11 +210,11 @@
 	case 3:
 		seq_dispelMagicAnimation();
 		assert(_magicJewelString);
-		if (_features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2)) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(2007);
 		}
-		if (_features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2))	
+		if (textEnabled())	
 			characterSays(_magicJewelString[0], 0, -2);
 		break;
 		

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2006-05-28 06:04:46 UTC (rev 22702)
+++ scummvm/trunk/engines/kyra/kyra.h	2006-05-28 06:07:54 UTC (rev 22703)
@@ -301,6 +301,9 @@
 	void snd_playSoundEffect(int track);
 	void snd_playWanderScoreViaMap(int command, int restart);
 
+	bool speechEnabled();
+	bool textEnabled();
+	
 	void drawSentenceCommand(const char *sentence, int unk1);
 	void updateSentenceCommand(const char *str1, const char *str2, int unk1);
 	void updateTextFade();

Modified: scummvm/trunk/engines/kyra/script_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v1.cpp	2006-05-28 06:04:46 UTC (rev 22702)
+++ scummvm/trunk/engines/kyra/script_v1.cpp	2006-05-28 06:07:54 UTC (rev 22703)
@@ -45,11 +45,11 @@
 	_skipFlag = false;
 	if (_features & GF_TALKIE) {
 		debugC(3, kDebugLevelScriptFuncs, "cmd_characterSays(%p) (%d, '%s', %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3));
-		if (_configVoice == 1 || _configVoice == 2) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(stackPos(0));
 		}
-		if (_configVoice == 0 || _configVoice == 2)
+		if (textEnabled())
 			characterSays(stackPosString(1), stackPos(2), stackPos(3));
 	} else {
 		debugC(3, kDebugLevelScriptFuncs, "cmd_characterSays(%p) ('%s', %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2));
@@ -618,12 +618,12 @@
 	if (_features & GF_TALKIE) {
 		debugC(3, kDebugLevelScriptFuncs, "cmd_customPrintTalkString(%p) (%d, '%s', %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF);
 
-		if (_configVoice == 1 || _configVoice == 2) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(stackPos(0));
 		}
 		_skipFlag = false;
-		if (_configVoice == 0 || _configVoice == 2)
+		if (textEnabled())
 			_text->printTalkTextMessage(stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF, 0, 2);
 	} else {
 		debugC(3, kDebugLevelScriptFuncs, "cmd_customPrintTalkString(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3) & 0xFF);

Modified: scummvm/trunk/engines/kyra/sequences_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_v1.cpp	2006-05-28 06:04:46 UTC (rev 22702)
+++ scummvm/trunk/engines/kyra/sequences_v1.cpp	2006-05-28 06:07:54 UTC (rev 22703)
@@ -337,16 +337,18 @@
 	freeShapes123();
 	_screen->showMouse();
 	assert(_poisonGone);
-	if (_features & GF_TALKIE) {
+	if (speechEnabled()) {
 		snd_voiceWaitForFinish();
 		snd_playVoiceFile(2010);
 	}
-	characterSays(_poisonGone[0], 0, -2);
-	if (_features & GF_TALKIE) {
+	if (textEnabled())
+		characterSays(_poisonGone[0], 0, -2);
+	if (speechEnabled()) {
 		snd_voiceWaitForFinish();
 		snd_playVoiceFile(2011);
 	}
-	characterSays(_poisonGone[1], 0, -2);
+	if (textEnabled())
+		characterSays(_poisonGone[1], 0, -2);
 }
 
 void KyraEngine::seq_poisonDeathNow(int now) {
@@ -359,30 +361,34 @@
 	if (_poisonDeathCounter >= 2) {
 		snd_playWanderScoreViaMap(1, 1);
 		assert(_thePoison);
-		if (_features & GF_TALKIE) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(7000);
 		}
-		characterSays(_thePoison[0], 0, -2);
-		if (_features & GF_TALKIE) {
+		if (textEnabled())
+			characterSays(_thePoison[0], 0, -2);
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(7001);
 		}
-		characterSays(_thePoison[1], 0, -2);
+		if (textEnabled())
+			characterSays(_thePoison[1], 0, -2);
 		seq_poisonDeathNowAnim();
 		_deathHandler = 3;
 	} else {
 		assert(_thePoison);
-		if (_features & GF_TALKIE) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(7002);
 		}
-		characterSays(_thePoison[2], 0, -2);
-		if (_features & GF_TALKIE) {
+		if (textEnabled())
+			characterSays(_thePoison[2], 0, -2);
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(7004);
 		}
-		characterSays(_thePoison[3], 0, -2);
+		if (textEnabled())
+			characterSays(_thePoison[3], 0, -2);
 	}
 }
 
@@ -474,18 +480,20 @@
 	
 	if (soundType == 1) {
 		assert(_fluteString);
-		if (_features & GF_TALKIE) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(1000);
 		}
-		characterSays(_fluteString[0], 0, -2);
+		if (textEnabled())
+			characterSays(_fluteString[0], 0, -2);
 	} else if (soundType == 2) {
 		assert(_fluteString);
-		if (_features & GF_TALKIE) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(1001);
 		}
-		characterSays(_fluteString[1], 0, -2);
+		if (textEnabled())
+			characterSays(_fluteString[1], 0, -2);
 	}
 }
 
@@ -756,11 +764,12 @@
 	
 	if (item >= 60 && item <= 77) {
 		assert(_flaskFull);
-		if (_features & GF_TALKIE) {
+		if (speechEnabled()) {
 			snd_voiceWaitForFinish();
 			snd_playVoiceFile(8006);
 		}
-		characterSays(_flaskFull[0], 0, -2);
+		if (textEnabled())
+			characterSays(_flaskFull[0], 0, -2);
 	} else if (item == 78) {
 		assert(type >= 0 && type < ARRAYSIZE(flaskTable1));
 		newItem = flaskTable1[type];
@@ -778,7 +787,7 @@
 	_itemInHand = newItem;
 	assert(_fullFlask);
 	assert(type < _fullFlask_Size && type >= 0);
-	if (_features & GF_TALKIE) {
+	if (speechEnabled()) {
 		snd_voiceWaitForFinish();
 		static const uint16 voiceEntries[] = {
 			0x1F40, 0x1F41, 0x1F42, 0x1F45
@@ -786,7 +795,8 @@
 		assert(type < ARRAYSIZE(voiceEntries));
 		snd_playVoiceFile(voiceEntries[type]);
 	}
-	characterSays(_fullFlask[type], 0, -2);
+	if (textEnabled())
+		characterSays(_fullFlask[type], 0, -2);
 }
 
 void KyraEngine::seq_playDrinkPotionAnim(int item, int unk2, int flags) {

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2006-05-28 06:04:46 UTC (rev 22702)
+++ scummvm/trunk/engines/kyra/sound.cpp	2006-05-28 06:07:54 UTC (rev 22703)
@@ -403,6 +403,15 @@
 
 #pragma mark -
 
+
+bool KyraEngine::speechEnabled() {
+	return _features & GF_TALKIE && (_configVoice == 1 || _configVoice == 2);
+}
+
+bool KyraEngine::textEnabled() {
+	return _features & GF_FLOPPY || (_configVoice == 0 || _configVoice == 2);
+}
+
 void KyraEngine::snd_playTheme(int file, int track) {
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d)", file);
 	assert(file < _musicFilesCount);


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