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

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 18 13:10:01 CET 2004


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

Modified Files:
	animation.cpp animation.h 
Log Message:
This should make subtitles work again in "overlay" cutscene mode.


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- animation.cpp	18 Jan 2004 19:50:59 -0000	1.11
+++ animation.cpp	18 Jan 2004 21:09:57 -0000	1.12
@@ -279,7 +279,35 @@
 		linepos += (2 * 640 - width);
 		ypos += width;
 	}
+}
+
+void AnimationState::drawTextObject(SpriteInfo *s, uint8 *src) {
+	NewGuiColor *dst = overlay + RENDERWIDE * (s->y - 40) + s->x;
+
+	// FIXME: These aren't the "right" colours, but look good to me.
 
+	NewGuiColor pen = _vm->_system->RGBToColor(255, 255, 255);
+	NewGuiColor border = _vm->_system->RGBToColor(0, 0, 0);
+
+	for (int y = 0; y < s->h; y++) {
+		for (int x = 0; x < s->w; x++) {
+			switch (src[x]) {
+			case 1:
+				dst[x] = border;
+				break;
+			case 255:
+				dst[x] = pen;
+				break;
+			default:
+				break;
+			}
+		}
+		dst += RENDERWIDE;
+		src += s->w;
+	}
+}
+
+void AnimationState::updateDisplay(void) {
 	_vm->_system->copy_rect_overlay(overlay, 640, 0, 40, 640, 400);
 }
 
@@ -380,9 +408,17 @@
 	}
 }
 
-void MoviePlayer::drawTextObject(MovieTextObject *obj) {
-	if (obj->textSprite && _textSurface)
+void MoviePlayer::drawTextObject(AnimationState *anim, MovieTextObject *obj) {
+	if (obj->textSprite && _textSurface) {
+#ifdef BACKEND_8BIT
 		_vm->_graphics->drawSurface(obj->textSprite, _textSurface);
+#else
+		if (anim)
+			anim->drawTextObject(obj->textSprite, _textSurface);
+		else
+			_vm->_graphics->drawSurface(obj->textSprite, _textSurface);
+#endif
+	}
 }
 
 /**
@@ -440,7 +476,7 @@
 				textVisible = false;
 			}
 			if (textVisible)
-				drawTextObject(text[textCounter]);
+				drawTextObject(anim, text[textCounter]);
 		}
 
 		frameCounter++;
@@ -448,6 +484,7 @@
 #ifdef BACKEND_8BIT
 		_vm->_graphics->updateDisplay(true);
 #else
+		anim->updateDisplay();
 		_vm->_graphics->updateDisplay(false);
 #endif
 
@@ -570,7 +607,7 @@
 			if (frameCounter == text[textCounter]->startFrame) {
 				_vm->_graphics->clearScene();
 				openTextObject(text[textCounter]);
-				drawTextObject(text[textCounter]);
+				drawTextObject(NULL, text[textCounter]);
 				if (text[textCounter]->speech) {
 					_vm->_mixer->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, flags);
 				}

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- animation.h	18 Jan 2004 05:52:04 -0000	1.12
+++ animation.h	18 Jan 2004 21:09:57 -0000	1.13
@@ -105,7 +105,7 @@
 	} palettes[50];
 #else
         static NewGuiColor lookup2[BITDEPTH * BITDEPTH * 256];
-        NewGuiColor * overlay;
+        NewGuiColor *overlay;
         static bool lookupInit;
 
 #endif
@@ -118,6 +118,11 @@
 	bool init(const char *name);
 	bool decodeFrame();
 
+#ifndef BACKEND_8BIT
+	void drawTextObject(SpriteInfo *s, uint8 *src);
+	void updateDisplay(void);
+#endif
+
 private:
 
 #ifdef BACKEND_8BIT
@@ -136,7 +141,7 @@
 
 	void openTextObject(MovieTextObject *obj);
 	void closeTextObject(MovieTextObject *obj);
-	void drawTextObject(MovieTextObject *obj);
+	void drawTextObject(AnimationState *anim, MovieTextObject *obj);
 
 	int32 playDummy(const char *filename, MovieTextObject *text[], uint8 *musicOut);
 





More information about the Scummvm-git-logs mailing list