[Scummvm-cvs-logs] CVS: scummvm/sword2/driver animation.cpp,1.8,1.9 animation.h,1.11,1.12

James Brown ender at users.sourceforge.net
Sat Jan 17 21:53:01 CET 2004


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv22555/sword2/driver

Modified Files:
	animation.cpp animation.h 
Log Message:
BS1 cutscene support. Also bugfixes (don't crash if cutscene ogg unavailable)


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- animation.cpp	17 Jan 2004 14:20:32 -0000	1.8
+++ animation.cpp	18 Jan 2004 05:52:04 -0000	1.9
@@ -132,6 +132,7 @@
 
 	info = mpeg2_info(decoder);
 	framenum = 0;
+	ticks = _vm->_system->get_msecs();
 
 	/* Play audio - TODO: Sync with video?*/
 
@@ -316,12 +317,18 @@
 				 */
 
 #ifdef BACKEND_8BIT
-				if (checkPaletteSwitch() ||
-                                    (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){
+				if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
+					(bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){
+
 					_vm->_graphics->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
 
-					while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1);
-						_vm->_system->delay_msecs(10);
+					if (bgSoundStream) {
+						while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1);
+							_vm->_system->delay_msecs(10);
+					} else {
+						ticks += 83;
+						_vm->sleepUntil(ticks);
+					}
 
 					_vm->_graphics->setNeedFullRedraw();
 
@@ -332,11 +339,18 @@
 
 #else
 
-				if ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){
+				if ((bgSoundStream == NULL) ||
+					(bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){
+
 					plotYUV(lookup2, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
 
-					while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1);
-						_vm->_system->delay_msecs(10);
+					if (bgSoundStream) {
+						while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1);
+							_vm->_system->delay_msecs(10);
+					} else {
+						ticks += 83;
+						_vm->sleepUntil(ticks);
+					}
 
 				} else
 					printf("dropped frame %i\n", framenum);

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- animation.h	17 Jan 2004 14:20:32 -0000	1.11
+++ animation.h	18 Jan 2004 05:52:04 -0000	1.12
@@ -70,6 +70,7 @@
 	Sword2Engine *_vm;
 
 	int framenum;
+	int ticks;
 
 #ifdef USE_MPEG2
 	mpeg2dec_t *decoder;





More information about the Scummvm-git-logs mailing list