[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,1.72,1.73 object.cpp,1.17,1.18 scumm.h,1.69,1.70 string.cpp,1.53,1.54 verbs.cpp,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Wed Dec 4 13:47:04 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv20384

Modified Files:
	gfx.cpp object.cpp scumm.h string.cpp verbs.cpp 
Log Message:
more cleanup

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- gfx.cpp	4 Dec 2002 14:32:40 -0000	1.72
+++ gfx.cpp	4 Dec 2002 21:45:42 -0000	1.73
@@ -1763,8 +1763,8 @@
 		charset._left = -1;
 	}
 
-	charset._xpos2 = _string[0].xpos;
-	charset._ypos2 = _string[0].ypos;
+	charset._nextLeft = _string[0].xpos;
+	charset._nextTop = _string[0].ypos;
 }
 
 void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor)
@@ -1783,10 +1783,6 @@
 
 	topline = vs->topline;
 	height = topline + vs->height;
-	if (vs->number == 0) {
-		left += _lastXstart - vs->xstart;
-		right += _lastXstart - vs->xstart;
-	}
 
 	right++;		// FIXME - why do we increment right here?!? (add comment)
 	if (left < 0)

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- object.cpp	11 Nov 2002 04:42:43 -0000	1.17
+++ object.cpp	4 Dec 2002 21:45:50 -0000	1.18
@@ -1214,8 +1214,6 @@
 
 	vs = &virtscr[0];
 
-	_lastXstart = vs->xstart;
-
 	checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d");
 
 	idx = _objs[getObjectIndex(eo->number)].fl_object_index;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- scumm.h	4 Dec 2002 15:00:35 -0000	1.69
+++ scumm.h	4 Dec 2002 21:45:55 -0000	1.70
@@ -178,8 +178,10 @@
 
 public:
 	Scumm *_vm;
+	int _strLeft, _strRight, _strTop, _strBottom;
+	int _nextLeft, _nextTop;
+
 	int _top;
-	int _drawTop;
 	int _left, _startLeft;
 	byte _center;
 	int _right;
@@ -187,13 +189,13 @@
 	bool _hasMask;
 	bool _blitAlso;
 	
-	int _strLeft, _strRight, _strTop, _strBottom;
-
-	int _xpos2, _ypos2;
-	
 	int _bufPos;
 	bool _firstChar;
 	bool _disableOffsX;
+
+	bool _ignoreCharsetMask;
+
+protected:
 	byte _bpp;
 	uint32 _charOffs;
 	byte *_charPtr;
@@ -202,12 +204,13 @@
 	int _bottom;
 	int _virtScreenHeight;
 
-	byte _ignoreCharsetMask;
 
+	void drawBits(byte *dst, byte *mask, int drawTop);
+
+public:
 	byte _colorMap[16];
 	byte _buffer[512];
 
-	void drawBits(byte *dst, byte *mask);
 	void printChar(int chr);
 	void printCharOld(int chr);
 	int getSpacing(byte chr, byte *charset);
@@ -844,7 +847,6 @@
 
 	byte _proc_special_palette[256];
 	int _palDirtyMin, _palDirtyMax;
-	uint16 _lastXstart;
 
 	byte _haveMsg;
 	bool _useTalkAnims;

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- string.cpp	4 Dec 2002 15:00:35 -0000	1.53
+++ string.cpp	4 Dec 2002 21:46:00 -0000	1.54
@@ -302,13 +302,13 @@
 	if (_top < _strTop)
 		_strTop = _top;
 
-	_drawTop = _top - vs->topline;
-	if (_drawTop < 0)
-		_drawTop = 0;
+	int drawTop = _top - vs->topline;
+	if (drawTop < 0)
+		drawTop = 0;
 
-	_bottom = _drawTop + _height + _offsY;
+	_bottom = drawTop + _height + _offsY;
 
-	_vm->updateDirtyRect(vs->number, _left, right, _drawTop, _bottom, 0);
+	_vm->updateDirtyRect(vs->number, _left, right, drawTop, _bottom, 0);
 
 	if (vs->number != 0)
 		_blitAlso = false;
@@ -319,20 +319,20 @@
 	_charPtr += 4;
 
 	byte *mask = _vm->getResourceAddress(rtBuffer, 9)
-		+ _drawTop * _vm->gdi._numStrips + _left / 8 + _vm->_screenStartStrip;
+		+ drawTop * _vm->gdi._numStrips + _left / 8 + _vm->_screenStartStrip;
 
-	byte *dst = vs->screenPtr + vs->xstart + _drawTop * _vm->_realWidth + _left;
+	byte *dst = vs->screenPtr + vs->xstart + drawTop * _vm->_realWidth + _left;
 
 	if (_blitAlso) {
 		byte *back = dst;
 		dst = _vm->getResourceAddress(rtBuffer, vs->number + 5)
-			+ vs->xstart + _drawTop * _vm->_realWidth + _left;
+			+ vs->xstart + drawTop * _vm->_realWidth + _left;
 
-		drawBits(dst, mask);
+		drawBits(dst, mask, drawTop);
 
 		_vm->blit(back, dst, _width, _height);
 	} else {
-		drawBits(dst, mask);
+		drawBits(dst, mask, drawTop);
 	}
 	
 	_left += _width;
@@ -345,7 +345,7 @@
 	_top -= _offsY;
 }
 
-void CharsetRenderer::drawBits(byte *dst, byte *mask)
+void CharsetRenderer::drawBits(byte *dst, byte *mask, int drawTop)
 {
 	bool usemask;
 	byte maskmask;
@@ -354,14 +354,14 @@
 	int color;
 	byte numbits, bits;
 
-	usemask = (_vm->_curVirtScreen->number == 0 && _ignoreCharsetMask == 0);
+	usemask = (_vm->_curVirtScreen->number == 0 && !_ignoreCharsetMask);
 
 	bits = *_charPtr++;
 	numbits = 8;
 
 	y = 0;
 
-	for (y = 0; y < _height && y + _drawTop < _virtScreenHeight;) {
+	for (y = 0; y < _height && y + drawTop < _virtScreenHeight;) {
 		maskmask = revBitMask[_left & 7];
 		maskpos = 0;
 
@@ -492,8 +492,7 @@
 	}
 
 	charset._top = _string[0].ypos;
-	charset._left = _string[0].xpos;
-	charset._startLeft = _string[0].xpos;
+	charset._startLeft = charset._left = _string[0].xpos;
 
 	if (a && a->charset)
 		charset.setCurID(a->charset);
@@ -555,19 +554,18 @@
 
 	t = charset._right - _string[0].xpos - 1;
 	if (charset._center) {
-		if (t > charset._xpos2)
-			t = charset._xpos2;
+		if (t > charset._nextLeft)
+			t = charset._nextLeft;
 		t <<= 1;
 	}
 
 	buffer = charset._buffer + charset._bufPos;
 	charset.addLinebreaks(0, buffer, 0, t);
 
-	_lastXstart = virtscr[0].xstart;
 	if (charset._center) {
-		charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
-		if (charset._xpos2 < 0)
-			charset._xpos2 = 0;
+		charset._nextLeft -= charset.getStringWidth(0, buffer, 0) >> 1;
+		if (charset._nextLeft < 0)
+			charset._nextLeft = 0;
 	}
 
 	charset._disableOffsX = charset._firstChar = !_keepText;
@@ -584,15 +582,15 @@
 		if (c == 13) {
 		newLine:;
 			if (_features & GF_OLD256) {
-				charset._ypos2 = 8;
-				charset._xpos2 = 0;
+				charset._nextTop = 8;
+				charset._nextLeft = 0;
 				continue;
 			} else {
-				charset._xpos2 = _string[0].xpos;
+				charset._nextLeft = _string[0].xpos;
 				if (charset._center) {
-					charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
+					charset._nextLeft -= charset.getStringWidth(0, buffer, 0) >> 1;
 				}
-				charset._ypos2 += charset.getFontPtr()[1];
+				charset._nextTop += charset.getFontPtr()[1];
 				charset._disableOffsX = true;
 				continue;
 			}
@@ -602,8 +600,8 @@
 			c = 0xFF;
 
 		if (c != 0xFF) {
-			charset._left = charset._xpos2;
-			charset._top = charset._ypos2;
+			charset._left = charset._nextLeft;
+			charset._top = charset._nextTop;
 			if (_features & GF_OLD256)
 				charset.printCharOld(c);
 			else if (!(_features & GF_AFTER_V6)) {
@@ -616,8 +614,8 @@
 					charset.printChar(c);
 			}
 
-			charset._xpos2 = charset._left;
-			charset._ypos2 = charset._top;
+			charset._nextLeft = charset._left;
+			charset._nextTop = charset._top;
 			_talkDelay += _vars[VAR_CHARINC];
 			continue;
 		}
@@ -669,7 +667,7 @@
 			buffer += 2;
 			for (i = 0; i < 4; i++)
 				charset._colorMap[i] = _charsetData[charset.getCurID()][i];
-			charset._ypos2 -= charset.getFontPtr()[1] - oldy;
+			charset._nextTop -= charset.getFontPtr()[1] - oldy;
 			break;
 			}
 		default:
@@ -704,30 +702,27 @@
 	byte *buffer;
 
 	buffer = charset._buffer;
-	charset._bufPos = 0;
 	_string[0].ypos = camera._cur.y + 88;
 	_string[0].xpos = (_realWidth / 2) - (charset.getStringWidth(0, buffer, 0) >> 1);
 	if (_string[0].xpos < 0)
 		_string[0].xpos = 0;
 
+	charset._bufPos = 0;
 	charset._top = _string[0].ypos;
-	charset._left = _string[0].xpos;
-	charset._startLeft = _string[0].xpos;
+	charset._startLeft = charset._left = _string[0].xpos;
 	charset._right = _realWidth - 1;
-	charset._xpos2 = _string[0].xpos;
-	charset._ypos2 = _string[0].ypos;
-	charset._disableOffsX = charset._firstChar = true;
-	charset.setCurID(3);
 	charset._center = false;
 	charset._color = 15;
+	charset._disableOffsX = charset._firstChar = true;
+	charset.setCurID(3);
+	charset._nextLeft = _string[0].xpos;
+	charset._nextTop = _string[0].ypos;
 	// FIXME: _talkdelay = 1 - display description, not correct ego actor talking,
 	// 0 - no display, correct ego actor talking
 	_talkDelay = 0;
 
 	restoreCharsetBg();
 
-	_lastXstart = virtscr[0].xstart;
-
 	do {
 		c = *buffer++;
 		if (c == 0) {
@@ -735,11 +730,11 @@
 			break;
 		}
 		if (c != 0xFF) {
-			charset._left = charset._xpos2;
-			charset._top = charset._ypos2;
+			charset._left = charset._nextLeft;
+			charset._top = charset._nextTop;
 			charset.printChar(c);
-			charset._xpos2 = charset._left;
-			charset._ypos2 = charset._top;
+			charset._nextLeft = charset._left;
+			charset._nextTop = charset._top;
 			continue;
 		}
 	} while (1);
@@ -759,21 +754,20 @@
 
 	charset._bufPos = 0;
 	charset._top = _string[0].ypos;
-	charset._left = _string[0].xpos;
-	charset._startLeft = _string[0].xpos;
+	charset._startLeft = charset._left = _string[0].xpos;
 	charset._right = _realWidth - 1;
-	charset._xpos2 = _string[0].xpos;
-	charset._ypos2 = _string[0].ypos;
-	charset.setCurID(_string[0].charset);
 	charset._center = _string[0].center;
 	charset._color = _string[0].color;
+	charset._disableOffsX = charset._firstChar = true;
+	charset.setCurID(_string[0].charset);
+	charset._nextLeft = _string[0].xpos;
+	charset._nextTop = _string[0].ypos;
 
 	// Center text
-	charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
-	if (charset._xpos2 < 0)
-		charset._xpos2 = 0;
+	charset._nextLeft -= charset.getStringWidth(0, buffer, 0) >> 1;
+	if (charset._nextLeft < 0)
+		charset._nextLeft = 0;
 
-	charset._disableOffsX = charset._firstChar = true;
 	_talkDelay = 1;
 
 	restoreCharsetBg();
@@ -785,11 +779,11 @@
 			break;
 		}
 		if (c != 0xFF) {
-			charset._left = charset._xpos2;
-			charset._top = charset._ypos2;
+			charset._left = charset._nextLeft;
+			charset._top = charset._nextTop;
 			charset.printChar(c);
-			charset._xpos2 = charset._left;
-			charset._ypos2 = charset._top;
+			charset._nextLeft = charset._left;
+			charset._nextTop = charset._top;
 			continue;
 		}
 	} while (1);
@@ -811,13 +805,13 @@
 	_msgPtrToAdd = buf;
 	_messagePtr = addMessageToStack(_messagePtr);
 
-	charset._startLeft = charset._left = _string[a].xpos;
 	charset._top = _string[a].ypos;
-	charset.setCurID(_string[a].charset);
-	charset._center = _string[a].center;
+	charset._startLeft = charset._left = _string[a].xpos;
 	charset._right = _string[a].right;
+	charset._center = _string[a].center;
 	charset._color = _string[a].color;
 	charset._disableOffsX = charset._firstChar = true;
+	charset.setCurID(_string[a].charset);
 
 	if (!(_features & GF_OLD256)) {
 		for (i = 0; i < 4; i++)
@@ -828,7 +822,7 @@
 
 	_msgPtrToAdd = buf;
 
-	/* trim from the right */
+	// trim from the right
 	space = NULL;
 	while (*_msgPtrToAdd) {
 		if (*_msgPtrToAdd == ' ') {
@@ -846,7 +840,7 @@
 	}
 
 	if (!(_features & GF_AFTER_V7))
-		charset._ignoreCharsetMask = 1;
+		charset._ignoreCharsetMask = true;
 
 
 	// In Full Throttle (and other games?), verb text should always mask
@@ -904,11 +898,11 @@
 		}
 	}
 
-	charset._ignoreCharsetMask = 0;
+	charset._ignoreCharsetMask = false;
 
 	if (a == 0) {
-		charset._xpos2 = charset._left;
-		charset._ypos2 = charset._top;
+		charset._nextLeft = charset._left;
+		charset._nextTop = charset._top;
 	} 
 
 

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- verbs.cpp	29 Nov 2002 18:27:35 -0000	1.8
+++ verbs.cpp	4 Dec 2002 21:46:05 -0000	1.9
@@ -200,8 +200,6 @@
 	if ((vs = findVirtScreen(y)) == NULL)
 		return;
 
-	_lastXstart = virtscr[0].xstart;
-
 	gdi.disableZBuffer();
 
 	twobufs = vs->alloctwobuffers;





More information about the Scummvm-git-logs mailing list