aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2007-01-31 18:35:50 +0000
committerJohannes Schickel2007-01-31 18:35:50 +0000
commitd82c67b48cc25d44b27331cf82b4371ff6438d3c (patch)
tree3e044bb8a55aeb2ad26f19e8179f12a588dc9a37 /engines
parent9799b346d86c5151d66d93f034cf5d1a40dbb15b (diff)
downloadscummvm-rg350-d82c67b48cc25d44b27331cf82b4371ff6438d3c.tar.gz
scummvm-rg350-d82c67b48cc25d44b27331cf82b4371ff6438d3c.tar.bz2
scummvm-rg350-d82c67b48cc25d44b27331cf82b4371ff6438d3c.zip
Fix for bug #Fix for bug #1523200 ("KYRA1: Voice-only mode has no lips animation").
svn-id: r25313
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui.cpp41
-rw-r--r--engines/kyra/kyra.h6
-rw-r--r--engines/kyra/script_v1.cpp11
-rw-r--r--engines/kyra/sequences_v1.cpp78
-rw-r--r--engines/kyra/sound.cpp10
-rw-r--r--engines/kyra/text.cpp64
6 files changed, 79 insertions, 131 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 77498292b2..53a57ca8da 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -204,34 +204,19 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
return 1;
if (_itemInHand != -1) {
assert(_putDownFirst);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2000);
- }
- if (textEnabled())
- characterSays(_putDownFirst[0], 0, -2);
+ characterSays(2000, _putDownFirst[0], 0, -2);
return 1;
}
if (queryGameFlag(0xF1)) {
assert(_waitForAmulet);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2001);
- }
- if (textEnabled())
- characterSays(_waitForAmulet[0], 0, -2);
+ characterSays(2001, _waitForAmulet[0], 0, -2);
return 1;
}
if (!queryGameFlag(0x55+jewel)) {
assert(_blackJewel);
_animator->makeBrandonFaceMouse();
drawJewelPress(jewel, 1);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2002);
- }
- if (textEnabled())
- characterSays(_blackJewel[0], 0, -2);
+ characterSays(2002, _blackJewel[0], 0, -2);
return 1;
}
drawJewelPress(jewel, 0);
@@ -258,12 +243,7 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
} else if (_brandonStatusBit == 0) {
seq_brandonHealing();
assert(_healingTip);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2003);
- }
- if (textEnabled())
- characterSays(_healingTip[0], 0, -2);
+ characterSays(2003, _healingTip[0], 0, -2);
}
break;
@@ -274,12 +254,8 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
case 2:
if (_brandonStatusBit & 1) {
assert(_wispJewelStrings);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2004);
- }
if (textEnabled())
- characterSays(_wispJewelStrings[0], 0, -2);
+ characterSays(2004, _wispJewelStrings[0], 0, -2);
} else {
if (_brandonStatusBit & 2) {
// XXX
@@ -303,12 +279,7 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
case 3:
seq_dispelMagicAnimation();
assert(_magicJewelString);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2007);
- }
- if (textEnabled())
- characterSays(_magicJewelString[0], 0, -2);
+ characterSays(2007, _magicJewelString[0], 0, -2);
break;
default:
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index 5c54a34c41..6c287a2e04 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -289,6 +289,8 @@ public:
void snd_playTheme(int file, int track = 0);
void snd_playVoiceFile(int id);
void snd_voiceWaitForFinish(bool ingame = true);
+ bool snd_voiceIsPlaying();
+ void snd_stopVoice();
void snd_playSoundEffect(int track);
void snd_playWanderScoreViaMap(int command, int restart);
@@ -487,8 +489,8 @@ protected:
void backupChatPartnerAnimFrame(int8 charNum);
void restoreChatPartnerAnimFrame(int8 charNum);
void endCharacterChat(int8 charNum, int16 arg_4);
- void waitForChatToFinish(int16 chatDuration, const char *str, uint8 charNum);
- void characterSays(const char *chatStr, int8 charNum, int8 chatDuration);
+ void waitForChatToFinish(int vocFile, int16 chatDuration, const char *str, uint8 charNum);
+ void characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration);
void setCharactersPositions(int character);
int setGameFlag(int flag);
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index d82430ec57..e08eb5b439 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -45,15 +45,10 @@ int KyraEngine::o1_characterSays(ScriptState *script) {
_skipFlag = false;
if (_flags.isTalkie) {
debugC(3, kDebugLevelScriptFuncs, "o1_characterSays(%p) (%d, '%s', %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3));
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(stackPos(0));
- }
- if (textEnabled())
- characterSays(stackPosString(1), stackPos(2), stackPos(3));
+ characterSays(stackPos(0), stackPosString(1), stackPos(2), stackPos(3));
} else {
debugC(3, kDebugLevelScriptFuncs, "o1_characterSays(%p) ('%s', %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2));
- characterSays(stackPosString(0), stackPos(1), stackPos(2));
+ characterSays(-1, stackPosString(0), stackPos(1), stackPos(2));
}
return 0;
@@ -644,6 +639,8 @@ int KyraEngine::o1_customPrintTalkString(ScriptState *script) {
int KyraEngine::o1_restoreCustomPrintBackground(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o1_restoreCustomPrintBackground(%p) ()", (const void *)script);
+ snd_voiceWaitForFinish();
+ snd_stopVoice();
_text->restoreTalkTextMessageBkgd(2, 0);
return 0;
}
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index 541393889f..5a6d2bf04d 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -363,18 +363,8 @@ void KyraEngine::seq_brandonHealing2() {
freeShapes123();
_screen->showMouse();
assert(_poisonGone);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2010);
- }
- if (textEnabled())
- characterSays(_poisonGone[0], 0, -2);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2011);
- }
- if (textEnabled())
- characterSays(_poisonGone[1], 0, -2);
+ characterSays(2010, _poisonGone[0], 0, -2);
+ characterSays(2011, _poisonGone[1], 0, -2);
}
void KyraEngine::seq_poisonDeathNow(int now) {
@@ -387,34 +377,14 @@ void KyraEngine::seq_poisonDeathNow(int now) {
if (_poisonDeathCounter >= 2) {
snd_playWanderScoreViaMap(1, 1);
assert(_thePoison);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(7000);
- }
- if (textEnabled())
- characterSays(_thePoison[0], 0, -2);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(7001);
- }
- if (textEnabled())
- characterSays(_thePoison[1], 0, -2);
+ characterSays(7000, _thePoison[0], 0, -2);
+ characterSays(7001, _thePoison[1], 0, -2);
seq_poisonDeathNowAnim();
_deathHandler = 3;
} else {
assert(_thePoison);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(7002);
- }
- if (textEnabled())
- characterSays(_thePoison[2], 0, -2);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(7004);
- }
- if (textEnabled())
- characterSays(_thePoison[3], 0, -2);
+ characterSays(7002, _thePoison[2], 0, -2);
+ characterSays(7004, _thePoison[3], 0, -2);
}
}
@@ -506,20 +476,10 @@ void KyraEngine::seq_playFluteAnimation() {
if (soundType == 1) {
assert(_fluteString);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(1000);
- }
- if (textEnabled())
- characterSays(_fluteString[0], 0, -2);
+ characterSays(1000, _fluteString[0], 0, -2);
} else if (soundType == 2) {
assert(_fluteString);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(1001);
- }
- if (textEnabled())
- characterSays(_fluteString[1], 0, -2);
+ characterSays(1001, _fluteString[1], 0, -2);
}
}
@@ -790,12 +750,7 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
if (item >= 60 && item <= 77) {
assert(_flaskFull);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(8006);
- }
- if (textEnabled())
- characterSays(_flaskFull[0], 0, -2);
+ characterSays(8006, _flaskFull[0], 0, -2);
} else if (item == 78) {
assert(type >= 0 && type < ARRAYSIZE(flaskTable1));
newItem = flaskTable1[type];
@@ -813,16 +768,11 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
_itemInHand = newItem;
assert(_fullFlask);
assert(type < _fullFlask_Size && type >= 0);
- if (speechEnabled()) {
- snd_voiceWaitForFinish();
- static const uint16 voiceEntries[] = {
- 0x1F40, 0x1F41, 0x1F42, 0x1F45
- };
- assert(type < ARRAYSIZE(voiceEntries));
- snd_playVoiceFile(voiceEntries[type]);
- }
- if (textEnabled())
- characterSays(_fullFlask[type], 0, -2);
+ static const uint16 voiceEntries[] = {
+ 0x1F40, 0x1F41, 0x1F42, 0x1F45
+ };
+ assert(type < ARRAYSIZE(voiceEntries));
+ characterSays(voiceEntries[type], _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 2a5182d6d8..8547c34c7c 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -538,6 +538,16 @@ void KyraEngine::snd_voiceWaitForFinish(bool ingame) {
}
}
+void KyraEngine::snd_stopVoice() {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_stopVoice()");
+ _sound->voiceStop();
+}
+
+bool KyraEngine::snd_voiceIsPlaying() {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_voiceIsPlaying()");
+ return _sound->voiceIsPlaying();
+}
+
// static res
const Sound::SpeechCodecs Sound::_supportedCodes[] = {
diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp
index ef9337c47a..cd7332ebd8 100644
--- a/engines/kyra/text.cpp
+++ b/engines/kyra/text.cpp
@@ -32,10 +32,11 @@
namespace Kyra {
-void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, uint8 charNum) {
+void KyraEngine::waitForChatToFinish(int vocFile, int16 chatDuration, const char *chatStr, uint8 charNum) {
debugC(9, kDebugLevelMain, "KyraEngine::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum);
bool hasUpdatedNPCs = false;
bool runLoop = true;
+ bool drawText = textEnabled();
uint8 currPage;
OSystem::Event event;
@@ -61,6 +62,11 @@ void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, ui
if (chatDuration != -1)
chatDuration *= _tickLength;
+ if (vocFile != -1) {
+ snd_voiceWaitForFinish();
+ snd_playVoiceFile(vocFile);
+ }
+
disableTimer(14);
disableTimer(18);
disableTimer(19);
@@ -93,16 +99,18 @@ void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, ui
_animator->preserveAnyChangedBackgrounds();
_animator->prepDrawAllObjects();
- currPage = _screen->_curPage;
- _screen->_curPage = 2;
- _text->printCharacterText(chatStr, charNum, _characterList[charNum].x1);
- _animator->_updateScreen = true;
- _screen->_curPage = currPage;
+ if (drawText) {
+ currPage = _screen->_curPage;
+ _screen->_curPage = 2;
+ _text->printCharacterText(chatStr, charNum, _characterList[charNum].x1);
+ _animator->_updateScreen = true;
+ _screen->_curPage = currPage;
+ }
_animator->copyChangedObjectsForward(0);
updateTextFade();
- if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1)
+ if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1 && (!drawText || !snd_voiceIsPlaying()))
break;
uint32 nextTime = loopStart + _gameSpeed;
@@ -136,6 +144,9 @@ void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, ui
runLoop = false;
}
+ snd_voiceWaitForFinish();
+ snd_stopVoice();
+
enableTimer(14);
enableTimer(15);
enableTimer(18);
@@ -247,7 +258,7 @@ int KyraEngine::initCharacterChat(int8 charNum) {
return returnValue;
}
-void KyraEngine::characterSays(const char *chatStr, int8 charNum, int8 chatDuration) {
+void KyraEngine::characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration) {
debugC(9, kDebugLevelMain, "KyraEngine::characterSays('%s', %i, %d)", chatStr, charNum, chatDuration);
uint8 startAnimFrames[] = { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 };
@@ -287,32 +298,39 @@ void KyraEngine::characterSays(const char *chatStr, int8 charNum, int8 chatDurat
_text->_talkMessageY = yPos;
_text->_talkMessageH = lineNum * 10;
- _animator->restoreAllObjectBackgrounds();
+
+ if (textEnabled()) {
+ _animator->restoreAllObjectBackgrounds();
- _screen->copyRegion(12, _text->_talkMessageY, 12, 136, 296, _text->_talkMessageH, 2, 2);
- _screen->hideMouse();
+ _screen->copyRegion(12, _text->_talkMessageY, 12, 136, 296, _text->_talkMessageH, 2, 2);
+ _screen->hideMouse();
- _text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
- _screen->showMouse();
+ _text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
+ _screen->showMouse();
+ }
if (chatDuration == -2)
chatTicks = strlen(processedString) * 9;
else
chatTicks = chatDuration;
- waitForChatToFinish(chatTicks, chatStr, charNum);
+ if (!speechEnabled())
+ vocFile = -1;
+ waitForChatToFinish(vocFile, chatTicks, chatStr, charNum);
- _animator->restoreAllObjectBackgrounds();
+ if (textEnabled()) {
+ _animator->restoreAllObjectBackgrounds();
- _screen->copyRegion(12, 136, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 2);
- _animator->preserveAllBackgrounds();
- _animator->prepDrawAllObjects();
- _screen->hideMouse();
+ _screen->copyRegion(12, 136, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 2);
+ _animator->preserveAllBackgrounds();
+ _animator->prepDrawAllObjects();
+ _screen->hideMouse();
- _screen->copyRegion(12, _text->_talkMessageY, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 0);
- _screen->showMouse();
- _animator->flagAllObjectsForRefresh();
- _animator->copyChangedObjectsForward(0);
+ _screen->copyRegion(12, _text->_talkMessageY, 12, _text->_talkMessageY, 296, _text->_talkMessageH, 2, 0);
+ _screen->showMouse();
+ _animator->flagAllObjectsForRefresh();
+ _animator->copyChangedObjectsForward(0);
+ }
if (chatPartnerNum != -1 && chatPartnerNum < 5)
restoreChatPartnerAnimFrame(chatPartnerNum);