aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2009-05-29 17:12:45 +0000
committerJohannes Schickel2009-05-29 17:12:45 +0000
commit95d11e6e37e423ace2c382636e2cd2d4c8d1c725 (patch)
tree23d4723a63b53bf2e705c2f80aac174de1139dab /engines/kyra
parente2641cbd251579e58fa3918bbd8966db2a97d09c (diff)
downloadscummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.tar.gz
scummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.tar.bz2
scummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.zip
- Add new method "isVoicePresent" to "Sound".
- Change LoL character selection to use it. - Allow quitting ScummVM in LoL character selection. svn-id: r41008
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/sequences_lol.cpp8
-rw-r--r--engines/kyra/sound.cpp23
-rw-r--r--engines/kyra/sound.h8
3 files changed, 34 insertions, 5 deletions
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index 95d218ab10..98479492c6 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -547,7 +547,7 @@ int LoLEngine::selectionCharInfo(int character) {
selectionCharInfoIntro(vocFilename);
if (_charSelectionInfoResult == -1) {
- while (_charSelectionInfoResult == -1) {
+ while (_charSelectionInfoResult == -1 && !shouldQuit()) {
_charSelectionInfoResult = selectionCharAccept();
_system->delayMillis(10);
}
@@ -581,16 +581,18 @@ void LoLEngine::selectionCharInfoIntro(char *file) {
file[4] = '0';
while (_charSelectionInfoResult == -1 && !shouldQuit()) {
- if (!_sound->voicePlay(file, &_speechHandle))
+ if (!_sound->isVoicePresent(file))
break;
+ _sound->voicePlay(file, &_speechHandle);
+
int i = 0;
while (_sound->voiceIsPlaying(&_speechHandle) && _charSelectionInfoResult == -1 && !shouldQuit()) {
_screen->drawShape(0, _screen->getPtrToShape(_screen->getCPagePtr(9), _charInfoFrameTable[i]), 11, 130, 0, 0);
_screen->updateScreen();
uint32 nextFrame = _system->getMillis() + 8 * _tickLength;
- while (nextFrame > _system->getMillis() && _charSelectionInfoResult == -1) {
+ while (nextFrame > _system->getMillis() && _charSelectionInfoResult == -1 && !shouldQuit()) {
_charSelectionInfoResult = selectionCharAccept();
_system->delayMillis(10);
}
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 4c9d730c43..4d42b1efb7 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -59,11 +59,24 @@ bool Sound::voiceFileIsPresent(const char *file) {
return false;
}
+bool Sound::isVoicePresent(const char *file) {
+ char filenamebuffer[25];
+
+ for (int i = 0; _supportedCodecs[i].fileext; ++i) {
+ strcpy(filenamebuffer, file);
+ strcat(filenamebuffer, _supportedCodecs[i].fileext);
+
+ if (_vm->resource()->exists(filenamebuffer))
+ return true;
+ }
+
+ return false;
+}
+
int32 Sound::voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) {
Audio::AudioStream *audioStream = getVoiceStream(file);
if (!audioStream) {
- warning("Couldn't load sound file '%s'", file);
return 0;
}
@@ -83,11 +96,17 @@ Audio::AudioStream *Sound::getVoiceStream(const char *file) {
Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filenamebuffer);
if (!stream)
continue;
+
audioStream = _supportedCodecs[i].streamFunc(stream, true, 0, 0, 1);
break;
}
- return audioStream;
+ if (!audioStream) {
+ warning("Couldn't load sound file '%s'", file);
+ return 0;
+ } else {
+ return audioStream;
+ }
}
bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *handle, uint8 volume, bool isSfx) {
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index eb40e40ab9..2c9b0a4076 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -178,6 +178,14 @@ public:
virtual bool voiceFileIsPresent(const char *file);
/**
+ * Checks whether a voice file with the given name is present
+ *
+ * @param file file name
+ * @return true if available, false otherwise
+ */
+ bool isVoicePresent(const char *file);
+
+ /**
* Plays the specified voice file.
*
* Also before starting to play the