[Scummvm-cvs-logs] CVS: scummvm/bs2/driver d_draw.cpp,1.10,1.11 sprite.cpp,1.15,1.16

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Mon Sep 8 18:40:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv17320/driver

Modified Files:
	d_draw.cpp sprite.cpp 
Log Message:
Added some code to display the subtitles for the Smacker movies, when
available, since they are separate from the Smacker files themselves.

Next step will be to play the voice-over sounds as well, and to make sure
subtitles settings etc. are taken into account (if they aren't already).


Index: d_draw.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/d_draw.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- d_draw.cpp	29 Aug 2003 06:42:34 -0000	1.10
+++ d_draw.cpp	8 Sep 2003 17:18:38 -0000	1.11
@@ -412,7 +412,8 @@
 }
 
 void DrawTextObject(_movieTextObject *obj) {
-	warning("stub DrawTextObject");
+	DrawSurface(obj->textSprite, textSurface);
+	
 /*
 	HRESULT				hr;
 	RECT				rd, rs;
@@ -529,9 +530,69 @@
 extern uint8 musicMuted;
 
 int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) {
-	warning("stub PlaySmacker %s", filename);
-	return(RD_OK);
+	warning("semi-stub PlaySmacker %s", filename);
+
+	// WORKAROUND: For now, we just do the voice-over parts of the
+	// movies, since they're separate from the actual smacker files.
+
+	// TODO: Play the voice-over sounds.
+
+	if (text) {
+		uint8 oldPal[1024];
+		uint8 tmpPal[1024];
+
+		EraseBackBuffer();
+
+		// In case the cutscene has a long lead-in, start just before
+		// the first line of text.
+
+		int frameCounter = text[0]->startFrame - 12;
+		int textCounter = 0;
+
+		// Fake a palette that will hopefully make the text visible.
+		// In the opening cutscene it seems to use colours 1 (black)
+		// and 255 (white).
+
+		memcpy(oldPal, palCopy, 1024);
+		memset(tmpPal, 0, 1024);
+		tmpPal[255 * 4 + 0] = 255;
+		tmpPal[255 * 4 + 1] = 255;
+		tmpPal[255 * 4 + 2] = 255;
+		BS2_SetPalette(0, 256, tmpPal, RDPAL_INSTANT);
 
+		while (1) {
+			if (frameCounter == text[textCounter]->startFrame) {
+				EraseBackBuffer();
+				OpenTextObject(text[textCounter]);
+				DrawTextObject(text[textCounter]);
+			}
+
+			if (frameCounter == text[textCounter]->endFrame) {
+				CloseTextObject(text[textCounter]);
+				EraseBackBuffer();
+				textCounter++;
+
+				if (text[textCounter] == NULL)
+					break;
+			}
+
+			frameCounter++;
+
+			ServiceWindows();
+
+			char key;
+
+			if (ReadKey(&key) == RD_OK && key == 27)
+				break;
+
+			// Simulate ~12 frames per second.
+			g_system->delay_msecs(80);
+		}
+
+		BS2_SetPalette(0, 256, oldPal, RDPAL_INSTANT);
+	}
+
+	return(RD_OK);
 }
 
 void GetDrawStatus(_drvDrawStatus *s)

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/sprite.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- sprite.cpp	8 Sep 2003 06:38:16 -0000	1.15
+++ sprite.cpp	8 Sep 2003 17:18:38 -0000	1.16
@@ -1249,8 +1249,14 @@
 
 	srcPitch = s->w;
 
-	rd.top = rs.top + s->y - scrolly;
-	rd.left = rs.left + s->x - scrollx;
+	if (s->type & RDSPR_DISPLAYALIGN) {
+		rd.top = s->y;
+		rd.left = s->x;
+	} else {
+		rd.top = s->y - scrolly;
+		rd.left = s->x - scrollx;
+	}
+
 	rd.right = rd.left + rs.right;
 	rd.bottom = rd.top + rs.bottom;
 





More information about the Scummvm-git-logs mailing list