[Scummvm-cvs-logs] CVS: scummvm/sword2/driver animation.cpp,1.3,1.4 animation.h,1.5,1.6

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Jan 13 05:13:01 CET 2004


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

Modified Files:
	animation.cpp animation.h 
Log Message:
Some more formatting cleanups. Made the Ogg file handle part of the
animation state so that it can be deleted in doneAnimation().


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- animation.cpp	13 Jan 2004 10:09:53 -0000	1.3
+++ animation.cpp	13 Jan 2004 13:12:40 -0000	1.4
@@ -118,14 +118,12 @@
 	}
 
 	_vm->_graphics->clearScene();
-	memset(_vm->_graphics->_buffer, 0, _vm->_graphics->_screenWide * MENUDEEP);
 
 #ifndef SCUMM_BIG_ENDIAN
 	flags |= SoundMixer::FLAG_LITTLE_ENDIAN;
 #endif
 
-	while (1) {
-		if (!decodeFrame(anim)) break;
+	while (decodeFrame(anim)) {
 		_vm->_graphics->setNeedFullRedraw();
 
 		if (text && text[textCounter]) {                      
@@ -262,9 +260,6 @@
 		// Fake a palette that will hopefully make the text visible.
 		// In the opening cutscene it seems to use colours 1 (black?)
 		// and 255 (white?).
-		//
-		// The text should probably be colored the same as the rest of
-		// the in-game text.
 
 		memcpy(oldPal, _vm->_graphics->_palCopy, 1024);
 		memset(tmpPal, 0, 1024);
@@ -370,7 +365,7 @@
 		unsigned char *l = st->lut2;
 		st->palnum++;
 		_vm->_graphics->setPalette(0, 256, st->palettes[st->palnum].pal, RDPAL_INSTANT);
-		st->lutcalcnum =  (BITDEPTH + st->palettes[st->palnum].end - (st->framenum + 1) + 2) / (st->palettes[st->palnum].end - (st->framenum + 1) + 2);
+		st->lutcalcnum = (BITDEPTH + st->palettes[st->palnum].end - (st->framenum + 1) + 2) / (st->palettes[st->palnum].end - (st->framenum + 1) + 2);
 		st->lut2 = st->lut;
 		st->lut = l;
 	}
@@ -480,26 +475,24 @@
 	/* Play audio - TODO: Sync with video?*/
 
 #ifdef USE_VORBIS
-	// Another TODO: There is no reason that this only allows OGG, and not MP3, or any other format
-	// the mixer might support one day... is there?
-	File *sndFile = new File;
+	// Another TODO: There is no reason that this only allows OGG, and not
+	// MP3, or any other format the mixer might support one day... is
+	// there?
+	st->sndfile = new File;
 	sprintf(tempFile, "%s.ogg", basename);
-	if (sndFile->open(tempFile))
-		_vm->_mixer->playVorbis(&st->bgSound, sndFile, 100000000);
+	if (st->sndfile->open(tempFile))
+		_vm->_mixer->playVorbis(&st->bgSound, st->sndfile, 100000000);
 #endif
 
-	// FIXME: This leaks (sndFile will never be deleted)
-
 	return st;
 }
 
 void MoviePlayer::doneAnimation(AnimationState *st) {
-	if (st->bgSound.isActive())
-		_vm->_mixer->stopHandle(st->bgSound);
-
-	mpeg2_close (st->decoder);
+	_vm->_mixer->stopHandle(st->bgSound);
+	mpeg2_close(st->decoder);
 	st->mpgfile->close();
 	delete st->mpgfile;
+	delete st->sndfile;
 	delete st;
 }
 

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- animation.h	13 Jan 2004 10:09:53 -0000	1.5
+++ animation.h	13 Jan 2004 13:12:40 -0000	1.6
@@ -58,6 +58,7 @@
 #endif
 
 	File *mpgfile;
+	File *sndfile;
 
 	int curpal;
 	int cr;
@@ -86,11 +87,11 @@
 	void closeTextObject(MovieTextObject *obj);
 	void drawTextObject(MovieTextObject *obj);
 
-	void checkPaletteSwitch(AnimationState * st);
+	void checkPaletteSwitch(AnimationState *st);
 
-	AnimationState * initAnimation(const char *name);
-	void doneAnimation(AnimationState * st);
-	bool decodeFrame(AnimationState * st);
+	AnimationState *initAnimation(const char *name);
+	void doneAnimation(AnimationState *st);
+	bool decodeFrame(AnimationState *st);
 
 public:
 	MoviePlayer(Sword2Engine *vm) : _vm(vm), _textSurface(NULL) {}





More information about the Scummvm-git-logs mailing list