[Scummvm-cvs-logs] SF.net SVN: scummvm:[46272] scummvm/trunk/engines/sci/gui

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Dec 7 10:30:14 CET 2009


Revision: 46272
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46272&view=rev
Author:   thebluegr
Date:     2009-12-07 09:30:14 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
Stop using variables named "byte", as byte is a variable type in ScummVM, and it gets confusing. Also, this fixes an error when language extensions are defined in MSVC - refer to patch #2909854

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_picture.cpp
    scummvm/trunk/engines/sci/gui/gui_picture.h
    scummvm/trunk/engines/sci/gui/gui_view.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-12-07 00:16:28 UTC (rev 46271)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-12-07 09:30:14 UTC (rev 46272)
@@ -317,7 +317,7 @@
 	bool isEGA = false;
 	int curPos = 0;
 	uint16 size;
-	byte byte;
+	byte pixel;
 	int i;
 	GuiPalette palette;
 	int16 pattern_Code = 0, pattern_Texture = 0;
@@ -444,21 +444,21 @@
 				switch (pic_op = data[curPos++]) {
 				case PIC_OPX_EGA_SET_PALETTE_ENTRIES:
 					while (vectorIsNonOpcode(data[curPos])) {
-						byte = data[curPos++];
-						if (byte >= PIC_EGAPALETTE_TOTALSIZE) {
+						pixel = data[curPos++];
+						if (pixel >= PIC_EGAPALETTE_TOTALSIZE) {
 							error("picture trying to write to invalid EGA-palette");
 						}
-						EGApalettes[byte] = data[curPos++];
+						EGApalettes[pixel] = data[curPos++];
 					}
 					break;
 				case PIC_OPX_EGA_SET_PALETTE:
-					byte = data[curPos++];
-					if (byte >= PIC_EGAPALETTE_COUNT) {
-						error("picture trying to write to invalid palette %d", (int)byte);
+					pixel = data[curPos++];
+					if (pixel >= PIC_EGAPALETTE_COUNT) {
+						error("picture trying to write to invalid palette %d", (int)pixel);
 					}
-					byte *= PIC_EGAPALETTE_SIZE;
+					pixel *= PIC_EGAPALETTE_SIZE;
 					for (i = 0; i < PIC_EGAPALETTE_SIZE; i++) {
-						EGApalettes[byte + i] = data[curPos++];
+						EGApalettes[pixel + i] = data[curPos++];
 					}
 					break;
 				case PIC_OPX_EGA_MONO0:
@@ -539,51 +539,51 @@
 	error("picture vector data without terminator");
 }
 
-bool SciGuiPicture::vectorIsNonOpcode(byte byte) {
-	if (byte >= PIC_OP_FIRST)
+bool SciGuiPicture::vectorIsNonOpcode(byte pixel) {
+	if (pixel >= PIC_OP_FIRST)
 		return false;
 	return true;
 }
 
 void SciGuiPicture::vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y) {
-	byte byte = data[curPos++];
-	x = data[curPos++] + ((byte & 0xF0) << 4);
-	y = data[curPos++] + ((byte & 0x0F) << 8);
+	byte pixel = data[curPos++];
+	x = data[curPos++] + ((pixel & 0xF0) << 4);
+	y = data[curPos++] + ((pixel & 0x0F) << 8);
 	if (_mirroredFlag) x = 319 - x;
 }
 
 void SciGuiPicture::vectorGetAbsCoordsNoMirror(byte *data, int &curPos, int16 &x, int16 &y) {
-	byte byte = data[curPos++];
-	x = data[curPos++] + ((byte & 0xF0) << 4);
-	y = data[curPos++] + ((byte & 0x0F) << 8);
+	byte pixel = data[curPos++];
+	x = data[curPos++] + ((pixel & 0xF0) << 4);
+	y = data[curPos++] + ((pixel & 0x0F) << 8);
 }
 
 void SciGuiPicture::vectorGetRelCoords(byte *data, int &curPos, int16 &x, int16 &y) {
-	byte byte = data[curPos++];
-	if (byte & 0x80) {
-		x -= ((byte >> 4) & 7) * (_mirroredFlag ? -1 : 1);
+	byte pixel = data[curPos++];
+	if (pixel & 0x80) {
+		x -= ((pixel >> 4) & 7) * (_mirroredFlag ? -1 : 1);
 	} else {
-		x += (byte >> 4) * (_mirroredFlag ? -1 : 1);
+		x += (pixel >> 4) * (_mirroredFlag ? -1 : 1);
 	}
-	if (byte & 0x08) {
-		y -= (byte & 7);
+	if (pixel & 0x08) {
+		y -= (pixel & 7);
 	} else {
-		y += (byte & 7);
+		y += (pixel & 7);
 	}
 }
 
 void SciGuiPicture::vectorGetRelCoordsMed(byte *data, int &curPos, int16 &x, int16 &y) {
-	byte byte = data[curPos++];
-	if (byte & 0x80) {
-		y -= (byte & 0x7F);
+	byte pixel = data[curPos++];
+	if (pixel & 0x80) {
+		y -= (pixel & 0x7F);
 	} else {
-		y += byte;
+		y += pixel;
 	}
-	byte = data[curPos++];
-	if (byte & 0x80) {
-		x -= (128 - (byte & 0x7F)) * (_mirroredFlag ? -1 : 1);
+	pixel = data[curPos++];
+	if (pixel & 0x80) {
+		x -= (128 - (pixel & 0x7F)) * (_mirroredFlag ? -1 : 1);
 	} else {
-		x += byte * (_mirroredFlag ? -1 : 1);
+		x += pixel * (_mirroredFlag ? -1 : 1);
 	}
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui_picture.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.h	2009-12-07 00:16:28 UTC (rev 46271)
+++ scummvm/trunk/engines/sci/gui/gui_picture.h	2009-12-07 09:30:14 UTC (rev 46272)
@@ -46,7 +46,7 @@
 	void drawSci11Vga();
 	void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 callerX, int16 callerY);
 	void drawVectorData(byte *data, int size);
-	bool vectorIsNonOpcode(byte byte);
+	bool vectorIsNonOpcode(byte pixel);
 	void vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y);
 	void vectorGetAbsCoordsNoMirror(byte *data, int &curPos, int16 &x, int16 &y);
 	void vectorGetRelCoords(byte *data, int &curPos, int16 &x, int16 &y);

Modified: scummvm/trunk/engines/sci/gui/gui_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-12-07 00:16:28 UTC (rev 46271)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-12-07 09:30:14 UTC (rev 46272)
@@ -262,15 +262,15 @@
 	byte *rlePtr;
 	byte *literalPtr;
 	uint16 pixelNo = 0, runLength;
-	byte byte;
+	byte pixel;
 
 	if (celInfo->offsetEGA) {
 		// decompression for EGA views
 		literalPtr = _resourceData + _loop[loopNo].cel[celNo].offsetEGA;
 		while (pixelNo < pixelCount) {
-			byte = *literalPtr++;
-			runLength = byte >> 4;
-			memset(outPtr + pixelNo, byte & 0x0F, MIN<uint16>(runLength, pixelCount - pixelNo));
+			pixel = *literalPtr++;
+			runLength = pixel >> 4;
+			memset(outPtr + pixelNo, pixel & 0x0F, MIN<uint16>(runLength, pixelCount - pixelNo));
 			pixelNo += runLength;
 		}
 		return;
@@ -281,15 +281,15 @@
 		if (_resMan->getViewType() == kViewAmiga) {
 			// decompression for amiga views
 			while (pixelNo < pixelCount) {
-				byte = *rlePtr++;
-				if (byte & 0x07) { // fill with color
-					runLength = byte & 0x07;
-					byte = byte >> 3;
+				pixel = *rlePtr++;
+				if (pixel & 0x07) { // fill with color
+					runLength = pixel & 0x07;
+					pixel = pixel >> 3;
 					while (runLength-- && pixelNo < pixelCount) {
-						outPtr[pixelNo++] = byte;
+						outPtr[pixelNo++] = pixel;
 					}
 				} else { // fill with transparent
-					runLength = byte >> 3;
+					runLength = pixel >> 3;
 					pixelNo += runLength;
 				}
 			}
@@ -297,9 +297,9 @@
 		} else {
 			// decompression for data that has just one combined stream
 			while (pixelNo < pixelCount) {
-				byte = *rlePtr++;
-				runLength = byte & 0x3F;
-				switch (byte & 0xC0) {
+				pixel = *rlePtr++;
+				runLength = pixel & 0x3F;
+				switch (pixel & 0xC0) {
 				case 0: // copy bytes as-is
 					while (runLength-- && pixelNo < pixelCount)
 						outPtr[pixelNo++] = *rlePtr++;
@@ -319,9 +319,9 @@
 		// decompression for data that has separate rle and literal streams
 		literalPtr = _resourceData + celInfo->offsetLiteral;
 		while (pixelNo < pixelCount) {
-			byte = *rlePtr++;
-			runLength = byte & 0x3F;
-			switch (byte & 0xC0) {
+			pixel = *rlePtr++;
+			runLength = pixel & 0x3F;
+			switch (pixel & 0xC0) {
 			case 0: // copy bytes as-is
 				while (runLength-- && pixelNo < pixelCount)
 					outPtr[pixelNo++] = *literalPtr++;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list