[Scummvm-cvs-logs] CVS: scummvm/scumm camera.cpp,2.23,2.24 charset.h,2.25,2.26 gfx.cpp,2.270,2.271 saveload.cpp,1.150,1.151 string.cpp,1.212,1.213

Max Horn fingolfin at users.sourceforge.net
Sun Apr 4 13:33:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8551

Modified Files:
	camera.cpp charset.h gfx.cpp saveload.cpp string.cpp 
Log Message:
Removed CharsetRenderer::_mask (this was used to optimize charset mask handling). This shouldn't cause any noticable slowdowns, but allows us to get rid of two nasty hacks, and fixes bug #895355 (DIG: Subtitles sometimes stay on the screen), maybe also others

Index: camera.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/camera.cpp,v
retrieving revision 2.23
retrieving revision 2.24
diff -u -d -r2.23 -r2.24
--- camera.cpp	8 Jan 2004 21:21:40 -0000	2.23
+++ camera.cpp	4 Apr 2004 20:20:08 -0000	2.24
@@ -338,23 +338,6 @@
 #else
 	virtscr[0].xstart = _screenStartStrip * 8;
 #endif
-
-	if (_charset->_hasMask && _version > 3) {
-		int dx = camera._cur.x - camera._last.x;
-		int dy = camera._cur.y - camera._last.y;
-
-		// Fixes subtitle glitches during room scrolling in two cut scenes
-		// When talking to Rusty for first time
-		// When sleeping in straw at Blacksmith's Guild.
-		if ((_gameId == GID_LOOM256 || _gameId == GID_PASS) && dx)
-			_charset->_mask.left -= 8;
-		else if (dx || dy) {
-			_charset->_mask.left -= dx;
-			_charset->_mask.right -= dx;
-			_charset->_mask.top -= dy;
-			_charset->_mask.bottom -= dy;
-		}
-	}
 }
 
 void ScummEngine::panCameraTo(int x, int y) {

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.25
retrieving revision 2.26
diff -u -d -r2.25 -r2.26
--- charset.h	8 Jan 2004 21:21:40 -0000	2.25
+++ charset.h	4 Apr 2004 20:20:08 -0000	2.26
@@ -33,12 +33,6 @@
 class CharsetRenderer {
 public:
 	
-	/**
-	 * Charset mask - rectangle covering the parts of the screen which are 
-	 * currently (partially) masked.
-	 */
-	Common::Rect _mask;
-
 	Common::Rect _str;
 	int _nextLeft, _nextTop;
 

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.270
retrieving revision 2.271
diff -u -d -r2.270 -r2.271
--- gfx.cpp	28 Mar 2004 16:30:48 -0000	2.270
+++ gfx.cpp	4 Apr 2004 20:20:08 -0000	2.271
@@ -608,10 +608,20 @@
 
 void CharsetRenderer::restoreCharsetBg() {
 	if (_hasMask) {
-		_vm->restoreBG(_mask);
+		// Restore background on the whole text area. To do this, we simply
+		// pass a large rect to restoreBG, and then rely on it clipping that
+		// rect. Also, restoreBG() will use findVirtScreen(rect.top) to
+		// determine the virtual screen on which to operate. This is fine
+		// for us, since we pass in rect.top, so in older games, the text
+		// display area is used; in newer games, the main virtscreen gets
+		// restored. That's exactly what we need.
+		//
+		// Of course this will break down if one of the older games (with
+		// multiple virtual screens in use) draw text outside the text virtual
+		// screen (verbs are excluded, they are handled in a special fashion).
+		// But I have no indication that this does ever happen.
+		_vm->restoreBG(Common::Rect(5000, 5000));
 		_hasMask = false;
-		_mask.top = _mask.left = 32767;
-		_mask.right = _mask.bottom = 0;
 		_str.left = -1;
 		_left = -1;
 	}
@@ -622,14 +632,10 @@
 
 void CharsetRenderer::clearCharsetMask() {
 	memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]);
-	_mask.top = _mask.left = 32767;
-	_mask.right = _mask.bottom = 0;
 }
 
 bool CharsetRenderer::hasCharsetMask(int left, int top, int right, int bottom) {
-	Common::Rect rect(left, top, right, bottom);
-	
-	return _hasMask && rect.intersects(_mask);
+	return _hasMask;
 }
 
 byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
@@ -1652,6 +1658,7 @@
 		src += _vm->_screenWidth;
 	} while (--height);
 }
+
 void Gdi::clear8Col(byte *dst, int height)
 {
 	do {

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- saveload.cpp	3 Apr 2004 19:41:30 -0000	1.150
+++ saveload.cpp	4 Apr 2004 20:20:09 -0000	1.151
@@ -265,8 +265,6 @@
 	_completeScreenRedraw = true;
 
 	// Reset charset mask
-	_charset->_mask.top = _charset->_mask.left = 32767;
-	_charset->_mask.right = _charset->_mask.bottom = 0;
 	_charset->_hasMask = false;
 
 	// With version 22, we replaced the scale items with scale slots. So when

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- string.cpp	4 Apr 2004 00:29:13 -0000	1.212
+++ string.cpp	4 Apr 2004 20:20:09 -0000	1.213
@@ -142,10 +142,6 @@
 		for (i = 0; i < 4; i++)
 			_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
 
-	if (_keepText) {
-		_charset->_str = _charset->_mask;
-	}
-
 	if (_talkDelay)
 		return;
 
@@ -166,12 +162,6 @@
 	if (!_keepText) {
 		if (_version <= 3 && _gameId != GID_LOOM) {
 			_charset->_hasMask = true;
-			_charset->_mask.left = _string[0].xpos;
-			_charset->_mask.top = _string[0].ypos;
-			_charset->_mask.bottom = _string[0].ypos + 8;
-			_charset->_mask.right = _screenWidth;
-			if (_string[0].ypos <= 16)	// If we are cleaning the text line, clean 2 lines.
-				_charset->_mask.bottom = 16;
 		}
 		_charset->restoreCharsetBg();
 	}
@@ -321,9 +311,9 @@
 	_charsetBufPos = buffer - _charsetBuffer;
 
 	_charset->_hasMask = (_charset->_str.left != -1);
-	_charset->_mask = _charset->_str;
 }
 
+
 void ScummEngine::drawString(int a, const byte *msg) {
 	byte buf[256];
 	byte *space;
@@ -450,7 +440,6 @@
 
 	if (_version >= 7) {
 		_charset->_hasMask = true;
-		_charset->_mask.extend(_charset->_str);
 	}
 }
 





More information about the Scummvm-git-logs mailing list