[Scummvm-cvs-logs] SF.net SVN: scummvm: [30455] scummvm/trunk/engines/sword2

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Jan 12 21:18:42 CET 2008


Revision: 30455
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30455&view=rev
Author:   eriktorbjorn
Date:     2008-01-12 12:18:41 -0800 (Sat, 12 Jan 2008)

Log Message:
-----------
The dummy ("narration only") cutscene player misbehaved a bit if the cutscene
soundtrack was present. It should work better now.

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/animation.cpp
    scummvm/trunk/engines/sword2/animation.h

Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp	2008-01-12 18:01:56 UTC (rev 30454)
+++ scummvm/trunk/engines/sword2/animation.cpp	2008-01-12 20:18:41 UTC (rev 30455)
@@ -347,6 +347,32 @@
 	return false;
 }
 
+bool MoviePlayer::userInterrupt() {
+	Common::Event event;
+	bool terminate = false;
+
+	Common::EventManager *eventMan = _system->getEventManager();
+	while (eventMan->pollEvent(event)) {
+		switch (event.type) {
+		case Common::EVENT_SCREEN_CHANGED:
+			handleScreenChanged();
+			break;
+		case Common::EVENT_QUIT:
+			_vm->closeGame();
+			terminate = true;
+			break;
+		case Common::EVENT_KEYDOWN:
+			if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+				terminate = true;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return terminate;
+}
+
 void MoviePlayer::play(SequenceTextInfo *textList, uint32 numLines, int32 leadIn, int32 leadOut) {
 	bool terminate = false;
 	bool textVisible = false;
@@ -416,25 +442,8 @@
 			updateScreen();
 		}
 
-		Common::Event event;
-
-		Common::EventManager *eventMan = _system->getEventManager();
-		while (eventMan->pollEvent(event)) {
-			switch (event.type) {
-			case Common::EVENT_SCREEN_CHANGED:
-				handleScreenChanged();
-				break;
-			case Common::EVENT_QUIT:
-				_vm->closeGame();
-				terminate = true;
-				break;
-			case Common::EVENT_KEYDOWN:
-				if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
-					terminate = true;
-				break;
-			default:
-				break;
-			}
+		if (userInterrupt()) {
+			terminate = true;
 		}
 	}
 
@@ -462,6 +471,11 @@
 		// free the sound buffer while it's still in use.
 
 		while (_vm->_sound->amISpeaking() == RDSE_SPEAKING || _mixer->isSoundHandleActive(_bgSoundHandle)) {
+			if (userInterrupt()) {
+				terminate = true;
+				_vm->_sound->stopSpeech();
+				_mixer->stopHandle(_bgSoundHandle);
+			}
 			_system->delayMillis(100);
 		}
 	} else {
@@ -755,7 +769,7 @@
 }
 
 bool MoviePlayerDummy::decodeFrame() {
-	if (_currentFrame == 0 && _numSpeechLines > 0) {
+	if ((_currentFrame == 0 && _numSpeechLines > 0) || _mixer->isSoundHandleActive(_bgSoundHandle)) {
 		byte dummyPalette[] = {
 			  0,   0,   0, 0,
 			255, 255, 255, 0,
@@ -811,7 +825,11 @@
 
 	// If we have played the final voice-over, skip ahead to the lead out
 
-	if (_currentText >= _numSpeechLines && _vm->_sound->amISpeaking() == RDSE_QUIET && _leadOutFrame != (uint)-1 && _currentFrame < _leadOutFrame) {
+	if (!_mixer->isSoundHandleActive(_bgSoundHandle) &&
+	    _currentText >= _numSpeechLines &&
+	    _vm->_sound->amISpeaking() == RDSE_QUIET &&
+	    _leadOutFrame != (uint)-1 &&
+	    _currentFrame < _leadOutFrame) {
 		_currentFrame = _leadOutFrame - 1;
 	}
 
@@ -819,7 +837,7 @@
 }
 
 bool MoviePlayerDummy::syncFrame() {
-	if (_numSpeechLines == 0 || _currentFrame < _firstSpeechFrame) {
+	if ((_numSpeechLines == 0 || _currentFrame < _firstSpeechFrame) && !_mixer->isSoundHandleActive(_bgSoundHandle)) {
 		_ticks = _system->getMillis();
 		return false;
 	}

Modified: scummvm/trunk/engines/sword2/animation.h
===================================================================
--- scummvm/trunk/engines/sword2/animation.h	2008-01-12 18:01:56 UTC (rev 30454)
+++ scummvm/trunk/engines/sword2/animation.h	2008-01-12 20:18:41 UTC (rev 30455)
@@ -123,6 +123,7 @@
 
 	void updatePalette(byte *pal, bool packed = true);
 	virtual bool load();
+	bool userInterrupt();
 	void play(SequenceTextInfo *textList, uint32 numLines, int32 leadIn, int32 leadOut);
 };
 


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