[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.162,2.163 charset.h,2.50,2.51 string.cpp,1.315,1.316

Max Horn fingolfin at users.sourceforge.net
Mon Jan 9 16:29:00 CET 2006


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

Modified Files:
	charset.cpp charset.h string.cpp 
Log Message:
Refactoring to remove CharsetRenderer::_ignoreCharsetMask

Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.162
retrieving revision 2.163
diff -u -d -r2.162 -r2.163
--- charset.cpp	27 Nov 2005 10:32:20 -0000	2.162
+++ charset.cpp	10 Jan 2006 00:28:07 -0000	2.163
@@ -198,7 +198,6 @@
 	_center = false;
 	_hasMask = false;
 	_textScreenID = kMainVirtScreen;
-	_ignoreCharsetMask = false;
 	_blitAlso = false;
 	_firstChar = false;
 	_disableOffsX = false;
@@ -1206,7 +1205,7 @@
 }
 
 
-void CharsetRendererV3::printChar(int chr) {
+void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
 	// Indy3 / Zak256 / Loom
 	int width, height, origWidth, origHeight;
 	VirtScreen *vs;
@@ -1252,11 +1251,11 @@
 
 	_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height);
 
-	if (!_ignoreCharsetMask) {
+	if (!ignoreCharsetMask) {
 		_hasMask = true;
 		_textScreenID = vs->number;
 	}
-	if (_ignoreCharsetMask || !vs->hasTwoBuffers) {
+	if (ignoreCharsetMask || !vs->hasTwoBuffers) {
 		dst = vs->getPixels(_left, drawTop);
 		drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight);
 	} else {
@@ -1313,7 +1312,7 @@
 }
 
 
-void CharsetRendererClassic::printChar(int chr) {
+void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
 	int width, height, origWidth, origHeight;
 	int offsX, offsY;
 	VirtScreen *vs;
@@ -1404,14 +1403,14 @@
 	byte *dstPtr;
 	byte *back = NULL;
 
-	if (!_ignoreCharsetMask) {
+	if (!ignoreCharsetMask) {
 		_hasMask = true;
 		_textScreenID = vs->number;
 	}
 
 	if ((_vm->_heversion >= 71 && _bitDepth >= 8) || (_vm->_heversion >= 90 && _bitDepth == 0)) {
 #ifndef DISABLE_HE
-		if (_ignoreCharsetMask || !vs->hasTwoBuffers) {
+		if (ignoreCharsetMask || !vs->hasTwoBuffers) {
 			dstPtr = vs->getPixels(0, 0);
 		} else {
 			dstPtr = (byte *)_textSurface.pixels;
@@ -1439,7 +1438,7 @@
 	} else {
 		Graphics::Surface dstSurface;
 		Graphics::Surface backSurface;
-		if (_ignoreCharsetMask || !vs->hasTwoBuffers) {
+		if (ignoreCharsetMask || !vs->hasTwoBuffers) {
 			dstSurface = *vs;
 			dstPtr = vs->getPixels(_left, drawTop);
 		} else {
@@ -1454,7 +1453,7 @@
 			dstPtr = vs->getBackPixels(_left, drawTop);
 		}
 
-		if (!_ignoreCharsetMask && vs->hasTwoBuffers) {
+		if (!ignoreCharsetMask && vs->hasTwoBuffers) {
 			drawTop = _top - _vm->_screenTop;
 		}
 
@@ -1472,7 +1471,7 @@
 			// once to each of the two buffers. That should hypothetically yield
 			// identical results, though I didn't try it and right now I don't know
 			// any spots where I can test this...
-			if (!_ignoreCharsetMask)
+			if (!ignoreCharsetMask)
 				warning("This might be broken -- please report where you encountered this to Fingolfin");
 
 			// Perform some clipping
@@ -1648,7 +1647,7 @@
 	return _current->getCharHeight('|');
 }
 
-void CharsetRendererNut::printChar(int chr) {
+void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) {
 	Common::Rect shadow;
 
 	assert(_current);
@@ -1680,13 +1679,13 @@
 	shadow.bottom = _top + height + 2;
 
 	Graphics::Surface s;
-	if (!_ignoreCharsetMask) {
+	if (!ignoreCharsetMask) {
 		_hasMask = true;
 		_textScreenID = kMainVirtScreen;
 	}
 
 	int drawTop = _top;
-	if (_ignoreCharsetMask) {
+	if (ignoreCharsetMask) {
 		VirtScreen *vs = &_vm->virtscr[kMainVirtScreen];
 		s = *vs;
 		s.pixels = vs->getPixels(0, 0);
@@ -1711,7 +1710,7 @@
 }
 #endif
 
-void CharsetRendererNES::printChar(int chr) {
+void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) {
 	int width, height, origWidth, origHeight;
 	VirtScreen *vs;
 	byte *charPtr, *dst;
@@ -1749,12 +1748,12 @@
 
 	_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height);
 
-	if (!_ignoreCharsetMask) {
+	if (!ignoreCharsetMask) {
 		_hasMask = true;
 		_textScreenID = vs->number;
 	}
 
-	if (_ignoreCharsetMask || !vs->hasTwoBuffers) {
+	if (ignoreCharsetMask || !vs->hasTwoBuffers) {
 		dst = vs->getPixels(_left, drawTop);
 		drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight);
 	} else {

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.50
retrieving revision 2.51
diff -u -d -r2.50 -r2.51
--- charset.h	6 Nov 2005 08:56:50 -0000	2.50
+++ charset.h	10 Jan 2006 00:28:10 -0000	2.51
@@ -57,7 +57,6 @@
 	bool _hasMask;	// True if "removable" text is visible somewhere (should be called _hasText or so)
 	VirtScreenNumber _textScreenID;	// ID of the virtual screen on which the text is visible.
 
-	bool _ignoreCharsetMask;
 	bool _blitAlso;
 	bool _firstChar;
 	bool _disableOffsX;
@@ -80,7 +79,7 @@
 	void clearCharsetMask();
 	void clearTextSurface();
 
-	virtual void printChar(int chr) = 0;
+	virtual void printChar(int chr, bool ignoreCharsetMask) = 0;
 	virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}
 
 	int getStringWidth(int a, const byte *str);
@@ -130,7 +129,7 @@
 public:
 	CharsetRendererClassic(ScummEngine *vm) : CharsetRendererCommon(vm) {}
 
-	void printChar(int chr);
+	void printChar(int chr, bool ignoreCharsetMask);
 	void drawChar(int chr, const Graphics::Surface &s, int x, int y);
 
 	int getCharWidth(byte chr);
@@ -146,7 +145,7 @@
 	CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {}
 
 	void setCurID(byte id) {}
-	void printChar(int chr);
+	void printChar(int chr, bool ignoreCharsetMask);
 	void drawChar(int chr, const Graphics::Surface &s, int x, int y);
 
 	int getFontHeight() { return 8; }
@@ -160,7 +159,7 @@
 public:
 	CharsetRendererV3(ScummEngine *vm) : CharsetRendererCommon(vm) {}
 
-	void printChar(int chr);
+	void printChar(int chr, bool ignoreCharsetMask);
 	void drawChar(int chr, const Graphics::Surface &s, int x, int y);
 	void setCurID(byte id);
 	void setColor(byte color);
@@ -186,7 +185,7 @@
 	CharsetRendererNut(ScummEngine *vm);
 	~CharsetRendererNut();
 
-	void printChar(int chr);
+	void printChar(int chr, bool ignoreCharsetMask);
 
 	void setCurID(byte id);
 

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.315
retrieving revision 1.316
diff -u -d -r1.315 -r1.316
--- string.cpp	8 Jan 2006 18:37:35 -0000	1.315
+++ string.cpp	10 Jan 2006 00:28:10 -0000	1.316
@@ -469,7 +469,7 @@
 				}
 			}
 			if (_version <= 3) {
-				_charset->printChar(c);
+				_charset->printChar(c, false);
 			} else {
 				if (_features & GF_HE_NOSUBTITLES) {
 					// HE games which use sprites for subtitles
@@ -481,7 +481,7 @@
 					// Subtitles are turned off, and there is a voice version
 					// of this message -> don't print it.
 				} else {
-					_charset->printChar(c);
+					_charset->printChar(c, false);
 				}
 			}
 			_charset->_nextLeft = _charset->_left;
@@ -554,9 +554,7 @@
 		_charset->_left -= _charset->getStringWidth(a, buf) / 2;
 	}
 
-	if (_version < 7)
-		_charset->_ignoreCharsetMask = true;
-
+	const bool ignoreCharsetMask = (_version < 7);
 
 	if (!buf[0]) {
 		buf[0] = ' ';
@@ -635,7 +633,7 @@
 					}
 				}
 			}
-			_charset->printChar(c);
+			_charset->printChar(c, ignoreCharsetMask);
 			_charset->_blitAlso = false;
 
 			if (cmi_pos_hack) {
@@ -645,8 +643,6 @@
 		}
 	}
 
-	_charset->_ignoreCharsetMask = false;
-
 	if (a == 0) {
 		_charset->_nextLeft = _charset->_left;
 		_charset->_nextTop = _charset->_top;
@@ -864,7 +860,6 @@
 	int c;
 	int i;
 
-	_charset->_ignoreCharsetMask = true;
 	for (i = 0; i < _blastTextQueuePos; i++) {
 
 		buf = _blastTextQueue[i].text;
@@ -905,7 +900,7 @@
 							c += *buf++ * 256;
 						}
 					}
-					_charset->printChar(c);
+					_charset->printChar(c, true);
 				}
 			} while (c && c != '\n');
 
@@ -914,7 +909,6 @@
 
 		_blastTextQueue[i].rect = _charset->_str;
 	}
-	_charset->_ignoreCharsetMask = false;
 }
 
 void ScummEngine_v6::removeBlastTexts() {





More information about the Scummvm-git-logs mailing list