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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri May 29 19:12:45 CEST 2009


Revision: 41008
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41008&view=rev
Author:   lordhoto
Date:     2009-05-29 17:12:45 +0000 (Fri, 29 May 2009)

Log Message:
-----------
- Add new method "isVoicePresent" to "Sound".
- Change LoL character selection to use it.
- Allow quitting ScummVM in LoL character selection.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sequences_lol.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound.h

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-05-29 15:07:38 UTC (rev 41007)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-05-29 17:12:45 UTC (rev 41008)
@@ -547,7 +547,7 @@
 
 	selectionCharInfoIntro(vocFilename);
 	if (_charSelectionInfoResult == -1) {
-		while (_charSelectionInfoResult == -1) {
+		while (_charSelectionInfoResult == -1 && !shouldQuit()) {
 			_charSelectionInfoResult = selectionCharAccept();
 			_system->delayMillis(10);
 		}
@@ -581,16 +581,18 @@
 	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);
 			}

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2009-05-29 15:07:38 UTC (rev 41007)
+++ scummvm/trunk/engines/kyra/sound.cpp	2009-05-29 17:12:45 UTC (rev 41008)
@@ -59,11 +59,24 @@
 	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 @@
 		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) {

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2009-05-29 15:07:38 UTC (rev 41007)
+++ scummvm/trunk/engines/kyra/sound.h	2009-05-29 17:12:45 UTC (rev 41008)
@@ -178,6 +178,14 @@
 	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


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