aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorOystein Eftevaag2006-05-28 06:07:54 +0000
committerOystein Eftevaag2006-05-28 06:07:54 +0000
commitdbaf5206aeb2a958c4687577cddbdbffb016870a (patch)
treefeec2ce6bb0344a776fc8246f67eb15aaede6c02 /engines/kyra
parentea05e31330b336207cd2abc2d131cab049290126 (diff)
downloadscummvm-rg350-dbaf5206aeb2a958c4687577cddbdbffb016870a.tar.gz
scummvm-rg350-dbaf5206aeb2a958c4687577cddbdbffb016870a.tar.bz2
scummvm-rg350-dbaf5206aeb2a958c4687577cddbdbffb016870a.zip
Added speechEnabled() and textEnabled() to simplify the text/speech config checks a bit, and added checks some more places
svn-id: r22703
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui.cpp24
-rw-r--r--engines/kyra/kyra.h3
-rw-r--r--engines/kyra/script_v1.cpp8
-rw-r--r--engines/kyra/sequences_v1.cpp50
-rw-r--r--engines/kyra/sound.cpp9
5 files changed, 58 insertions, 36 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index f36d7c417f..4fd520e785 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -111,21 +111,21 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
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 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
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 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
} 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 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
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 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
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;
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index 2a1a8e6516..25e105ddc8 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -301,6 +301,9 @@ public:
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();
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index 946983d7c9..9ab89c28ea 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -45,11 +45,11 @@ int KyraEngine::cmd_characterSays(ScriptState *script) {
_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 @@ int KyraEngine::cmd_customPrintTalkString(ScriptState *script) {
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);
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index b0e143a2a7..f0d71884dd 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -337,16 +337,18 @@ void KyraEngine::seq_brandonHealing2() {
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 @@ void KyraEngine::seq_poisonDeathNow(int now) {
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 @@ void KyraEngine::seq_playFluteAnimation() {
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 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
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 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
_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 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
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) {
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 52a4c5c107..02208f9f5d 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -403,6 +403,15 @@ void SoundMidiPC::beginFadeOut() {
#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);