[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.28,2.29 charset.h,2.14,2.15 gfx.cpp,2.103,2.104 gfx.h,1.28,1.29 saveload.cpp,1.68,1.69 script_v8.cpp,2.156,2.157 scumm.h,1.191,1.192 string.cpp,1.111,1.112 verbs.cpp,1.37,1.38

Max Horn fingolfin at users.sourceforge.net
Thu May 15 15:31:11 CEST 2003


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

Modified Files:
	charset.cpp charset.h gfx.cpp gfx.h saveload.cpp script_v8.cpp 
	scumm.h string.cpp verbs.cpp 
Log Message:
Make use of ScummVM::Rect

Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -d -r2.28 -r2.29
--- charset.cpp	14 May 2003 16:38:55 -0000	2.28
+++ charset.cpp	15 May 2003 22:30:31 -0000	2.29
@@ -378,10 +378,10 @@
 		return;
 
 	if (_firstChar) {
-		_strLeft = _left;
-		_strTop = _top;
-		_strRight = _left;
-		_strBottom = _top;
+		_str.left = _left;
+		_str.top = _top;
+		_str.right = _left;
+		_str.bottom = _top;
 		_firstChar = false;
 	}
 
@@ -435,19 +435,19 @@
 		mask_ptr += _vm->gdi._numStrips;
 	}
 
-	if (_strLeft > _left)
-		_strLeft = _left;
+	if (_str.left > _left)
+		_str.left = _left;
 
 	_left += getCharWidth(chr);
 
-	if (_strRight < _left) {
-		_strRight = _left;
+	if (_str.right < _left) {
+		_str.right = _left;
 		if (_dropShadow)
-			_strRight++;
+			_str.right++;
 	}
 
-	if (_strBottom < _top + h)
-		_strBottom = _top + h;
+	if (_str.bottom < _top + h)
+		_str.bottom = _top + h;
 }
 
 void CharsetRendererClassic::printChar(int chr) {
@@ -479,10 +479,10 @@
 	width = _charPtr[0];
 	height = _charPtr[1];
 	if (_firstChar) {
-		_strLeft = 0;
-		_strTop = 0;
-		_strRight = 0;
-		_strBottom = 0;
+		_str.left = 0;
+		_str.top = 0;
+		_str.right = 0;
+		_str.bottom = 0;
 	}
 
 	if (_disableOffsX) {
@@ -511,18 +511,18 @@
 	_disableOffsX = false;
 
 	if (_firstChar) {
-		_strLeft = _left;
-		_strTop = _top;
-		_strRight = _left;
-		_strBottom = _top;
+		_str.left = _left;
+		_str.top = _top;
+		_str.right = _left;
+		_str.bottom = _top;
 		_firstChar = false;
 	}
 
-	if (_left < _strLeft)
-		_strLeft = _left;
+	if (_left < _str.left)
+		_str.left = _left;
 
-	if (_top < _strTop)
-		_strTop = _top;
+	if (_top < _str.top)
+		_str.top = _top;
 
 	int drawTop = _top - vs->topline;
 	if (drawTop < 0)
@@ -556,11 +556,11 @@
 	}
 	
 	_left += width;
-	if (_left > _strRight)
-		_strRight = _left;
+	if (_left > _str.right)
+		_str.right = _left;
 
-	if (_top + height > _strBottom)
-		_strBottom = _top + height;
+	if (_top + height > _str.bottom)
+		_str.bottom = _top + height;
 
 	_top -= offsY;
 }
@@ -656,10 +656,10 @@
 		return;
 
 	if (_firstChar) {
-		_strLeft = _left;
-		_strTop = _top;
-		_strRight = _left;
-		_strBottom = _top;
+		_str.left = _left;
+		_str.top = _top;
+		_str.right = _left;
+		_str.bottom = _top;
 		_firstChar = false;
 	}
 
@@ -671,10 +671,10 @@
 	_vm->updateDirtyRect(0, _left, _left + width, _top, _top + height, 0);
 
 	_left += width;
-	if (_left > _strRight)
-		_strRight = _left;
+	if (_left > _str.right)
+		_str.right = _left;
 
-	if (_top + height > _strBottom)
-		_strBottom = _top + height;
+	if (_top + height > _str.bottom)
+		_str.bottom = _top + height;
 }
 

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -d -r2.14 -r2.15
--- charset.h	14 May 2003 13:30:52 -0000	2.14
+++ charset.h	15 May 2003 22:30:31 -0000	2.15
@@ -21,6 +21,7 @@
 #ifndef CHARSET_H
 #define CHARSET_H
 
+#include "common/rect.h"
 #include "common/scummsys.h"
 
 class Scumm;
@@ -29,7 +30,7 @@
 
 class CharsetRenderer {
 public:
-	int _strLeft, _strRight, _strTop, _strBottom;
+	ScummVM::Rect _str;
 	int _nextLeft, _nextTop;
 
 	int _top;

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.103
retrieving revision 2.104
diff -u -d -r2.103 -r2.104
--- gfx.cpp	15 May 2003 21:57:38 -0000	2.103
+++ gfx.cpp	15 May 2003 22:30:31 -0000	2.104
@@ -727,11 +727,11 @@
 }
 
 void Scumm::restoreCharsetBg() {
-	if (gdi._mask_left != -1) {
-		restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
+	if (gdi._mask.left != -1) {
+		restoreBG(gdi._mask);
 		_charset->_hasMask = false;
-		gdi._mask_left = -1;
-		_charset->_strLeft = -1;
+		gdi._mask.left = -1;
+		_charset->_str.left = -1;
 		_charset->_left = -1;
 	}
 
@@ -739,42 +739,42 @@
 	_charset->_nextTop = _string[0].ypos;
 }
 
-void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor) {
+void Scumm::restoreBG(ScummVM::Rect rect, byte backColor) {
 	VirtScreen *vs;
 	int topline, height, width;
 	byte *backbuff, *bgbak;
 	bool lightsOn;
 
-	if (left == right || top == bottom)
+	if (rect.left == rect.right || rect.top == rect.bottom)
 		return;
-	if (top < 0)
-		top = 0;
+	if (rect.top < 0)
+		rect.top = 0;
 
-	if ((vs = findVirtScreen(top)) == NULL)
+	if ((vs = findVirtScreen(rect.top)) == NULL)
 		return;
 
 	topline = vs->topline;
 	height = topline + vs->height;
 
-	if (left < 0)
-		left = 0;
-	if (right < 0)
-		right = 0;
-	if (left > _screenWidth)
+	if (rect.left < 0)
+		rect.left = 0;
+	if (rect.right < 0)
+		rect.right = 0;
+	if (rect.left > _screenWidth)
 		return;
-	if (right > _screenWidth)
-		right = _screenWidth;
-	if (bottom >= height)
-		bottom = height;
+	if (rect.right > _screenWidth)
+		rect.right = _screenWidth;
+	if (rect.bottom >= height)
+		rect.bottom = height;
 
-	updateDirtyRect(vs->number, left, right, top - topline, bottom - topline, USAGE_BIT_RESTORED);
+	updateDirtyRect(vs->number, rect.left, rect.right, rect.top - topline, rect.bottom - topline, USAGE_BIT_RESTORED);
 
-	int offset = (top - topline) * _screenWidth + vs->xstart + left;
+	int offset = (rect.top - topline) * _screenWidth + vs->xstart + rect.left;
 	backbuff = vs->screenPtr + offset;
 	bgbak = getResourceAddress(rtBuffer, vs->number + 5) + offset;
 
-	height = bottom - top;
-	width = right - left;
+	height = rect.height();
+	width = rect.width();
 
 	// Check whether lights are turned on or not
 	lightsOn = (_features & GF_AFTER_V6) || (vs->number != 0) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
@@ -788,7 +788,7 @@
 			if (width & 0x07)
 				mask_width++;
 
-			mask = getResourceAddress(rtBuffer, 9) + top * gdi._numStrips + (left >> 3) + _screenStartStrip;
+			mask = getResourceAddress(rtBuffer, 9) + rect.top * gdi._numStrips + (rect.left >> 3) + _screenStartStrip;
 			if (vs->number == 0)
 				mask += vs->topline * gdi._numStrips;
 
@@ -813,10 +813,10 @@
 	// would mean that the rects are touching on their borders, but not
 	// actually overlapping.
 	return _charset->_hasMask
-			&& top <= gdi._mask_bottom
-			&& left <= gdi._mask_right
-			&& bottom >= gdi._mask_top
-			&& right >= gdi._mask_left;
+			&& top <= gdi._mask.bottom
+			&& left <= gdi._mask.right
+			&& bottom >= gdi._mask.top
+			&& right >= gdi._mask.left;
 /*
 	if (!_charset->_hasMask || top > gdi._mask_bottom || left > gdi._mask_right ||
 			bottom < gdi._mask_top || right < gdi._mask_left)

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gfx.h	15 May 2003 21:57:38 -0000	1.28
+++ gfx.h	15 May 2003 22:30:31 -0000	1.29
@@ -117,7 +117,7 @@
 	int _numZBuffer;
 	int _imgBufOffs[8];
 	int32 _numStrips;
-	int16 _mask_top, _mask_bottom, _mask_right, _mask_left;
+	ScummVM::Rect _mask;
 
 protected:
 	byte *_readPtr;

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- saveload.cpp	15 May 2003 21:55:13 -0000	1.68
+++ saveload.cpp	15 May 2003 22:30:31 -0000	1.69
@@ -161,7 +161,7 @@
 	sb = _screenB;
 	sh = _screenH;
 
-	gdi._mask_left = -1;
+	gdi._mask.left = -1;
 
 	initScreens(0, 0, _screenWidth, _screenHeight);
 

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.156
retrieving revision 2.157
diff -u -d -r2.156 -r2.157
--- script_v8.cpp	14 May 2003 20:37:53 -0000	2.156
+++ script_v8.cpp	15 May 2003 22:30:31 -0000	2.157
@@ -611,10 +611,7 @@
 			}
 		} while (c);
 
-		_blastTextQueue[i].left = _charset->_strLeft;
-		_blastTextQueue[i].right = _charset->_strRight;
-		_blastTextQueue[i].top = _charset->_strTop;
-		_blastTextQueue[i].bottom = _charset->_strBottom;
+		_blastTextQueue[i].rect = _charset->_str;
 	}
 	_charset->_ignoreCharsetMask = false;
 }
@@ -623,7 +620,7 @@
 	int i;
 
 	for (i = 0; i < _blastTextQueuePos; i++) {
-		restoreBG(_blastTextQueue[i].left, _blastTextQueue[i].top, _blastTextQueue[i].right, _blastTextQueue[i].bottom);
+		restoreBG(_blastTextQueue[i].rect);
 	}
 	_blastTextQueuePos = 0;
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- scumm.h	15 May 2003 21:57:38 -0000	1.191
+++ scumm.h	15 May 2003 22:30:32 -0000	1.192
@@ -105,7 +105,7 @@
 
 struct BlastText {
 	int16 xpos, ypos;
-	int16 left, right, top, bottom;
+	ScummVM::Rect rect;
 	byte color;
 	byte charset;
 	bool center;
@@ -789,7 +789,7 @@
 	void drawRoomObject(int i, int arg);
 	void drawBox(int x, int y, int x2, int y2, int color);
 
-	void restoreBG(int left, int top, int right, int bottom, byte backColor = 0);
+	void restoreBG(ScummVM::Rect rect, byte backColor = 0);
 	void redrawBGStrip(int start, int num);	
 	void redrawBGAreas();	
 	

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- string.cpp	14 May 2003 13:50:28 -0000	1.111
+++ string.cpp	15 May 2003 22:30:32 -0000	1.112
@@ -146,10 +146,7 @@
 			_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
 
 	if (_keepText) {
-		_charset->_strLeft = gdi._mask_left;
-		_charset->_strRight = gdi._mask_right;
-		_charset->_strTop = gdi._mask_top;
-		_charset->_strBottom = gdi._mask_bottom;
+		_charset->_str = gdi._mask;
 	}
 
 	if (_talkDelay)
@@ -185,12 +182,12 @@
 
 	if (!_keepText) {
 		if ((_features & GF_AFTER_V2 || _features & GF_AFTER_V3) && _gameId != GID_LOOM) {
-			gdi._mask_left = _string[0].xpos;
-			gdi._mask_top = _string[0].ypos;
-			gdi._mask_bottom = _string[0].ypos + 8;
-			gdi._mask_right = _screenWidth;
+			gdi._mask.left = _string[0].xpos;
+			gdi._mask.top = _string[0].ypos;
+			gdi._mask.bottom = _string[0].ypos + 8;
+			gdi._mask.right = _screenWidth;
 			if (_string[0].ypos <= 16)	// If we are cleaning the text line, clean 2 lines.
-				gdi._mask_bottom = 16;
+				gdi._mask.bottom = 16;
 		}
 		restoreCharsetBg();
 	}
@@ -333,10 +330,7 @@
 
 	_charsetBufPos = buffer - _charsetBuffer;
 
-	gdi._mask_left = _charset->_strLeft;
-	gdi._mask_right = _charset->_strRight;
-	gdi._mask_top = _charset->_strTop;
-	gdi._mask_bottom = _charset->_strBottom;
+	gdi._mask = _charset->_str;
 }
 
 void Scumm::drawDescString(byte *msg) {
@@ -366,7 +360,7 @@
 	_talkDelay = 1;
 
 	if (_string[0].ypos + _charset->getFontHeight() > 0)
-		restoreBG(0, _string[0].ypos, _screenWidth - 1, _string[0].ypos + _charset->getFontHeight());
+		restoreBG(ScummVM::Rect(0, _string[0].ypos, _screenWidth - 1, _string[0].ypos + _charset->getFontHeight()));
 
 	_charset->_nextLeft = _string[0].xpos;
 	_charset->_nextTop = _string[0].ypos;
@@ -385,10 +379,8 @@
 
 	// hack: more 8 pixels at width and height while redraw
 	// for proper description redraw while scrolling room
-	gdi._mask_left = _charset->_strLeft - 8;
-	gdi._mask_right = _charset->_strRight + 8;
-	gdi._mask_top = _charset->_strTop - 8;
-	gdi._mask_bottom = _charset->_strBottom + 8;
+	gdi._mask = _charset->_str;
+	gdi._mask.grow(8);
 }
 
 void Scumm::drawString(int a) {
@@ -497,7 +489,7 @@
 	} 
 
 
-	_string[a].xpos = _charset->_strRight + 8;	// Indy3: Fixes Grail Diary text positioning
+	_string[a].xpos = _charset->_str.right + 8;	// Indy3: Fixes Grail Diary text positioning
 
 	if (_features & GF_AFTER_V7) {
 		_charset->_hasMask = true;
@@ -505,14 +497,14 @@
 		// to -1 to mark it as invalid. Hence this comparision will always leave it at -1,
 		// which implies that if the mask was marked invalid, it will always stay so. 
 		// That seems odd and not at all to be the intended thing... or is it?
-		if (_charset->_strLeft < gdi._mask_left)
-			gdi._mask_left = _charset->_strLeft;
-		if (_charset->_strRight > gdi._mask_right)
-			gdi._mask_right = _charset->_strRight;
-		if (_charset->_strTop < gdi._mask_top)
-			gdi._mask_top = _charset->_strTop;
-		if (_charset->_strBottom > gdi._mask_bottom)
-			gdi._mask_bottom = _charset->_strBottom;
+		if (_charset->_str.left < gdi._mask.left)
+			gdi._mask.left = _charset->_str.left;
+		if (_charset->_str.right > gdi._mask.right)
+			gdi._mask.right = _charset->_str.right;
+		if (_charset->_str.top < gdi._mask.top)
+			gdi._mask.top = _charset->_str.top;
+		if (_charset->_str.bottom > gdi._mask.bottom)
+			gdi._mask.bottom = _charset->_str.bottom;
 	} 
 }
 

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- verbs.cpp	12 May 2003 16:57:04 -0000	1.37
+++ verbs.cpp	15 May 2003 22:30:32 -0000	1.38
@@ -184,13 +184,13 @@
 		drawString(4);
 		_charset->_center = tmp;
 
-		vs->right = _charset->_strRight;
-		vs->bottom = _charset->_strBottom;
-		vs->oldleft = _charset->_strLeft;
-		vs->oldright = _charset->_strRight;
-		vs->oldtop = _charset->_strTop;
-		vs->oldbottom = _charset->_strBottom;
-		_charset->_strLeft = _charset->_strRight;
+		vs->right = _charset->_str.right;
+		vs->bottom = _charset->_str.bottom;
+		vs->oldleft = _charset->_str.left;
+		vs->oldright = _charset->_str.right;
+		vs->oldtop = _charset->_str.top;
+		vs->oldbottom = _charset->_str.bottom;
+		_charset->_str.left = _charset->_str.right;
 	} else {
 		restoreVerbBG(verb);
 	}
@@ -202,7 +202,7 @@
 	vs = &_verbs[verb];
 
 	if (vs->oldleft != -1) {
-		restoreBG(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom, vs->bkcolor);
+		restoreBG(ScummVM::Rect(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom), vs->bkcolor);
 		vs->oldleft = -1;
 	}
 }





More information about the Scummvm-git-logs mailing list