From ebde568fe292475245fe6ec865b3286d3e27c7e6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2009 09:30:14 +0000 Subject: 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 svn-id: r46272 --- engines/sci/gui/gui_picture.cpp | 64 ++++++++++++++++++++--------------------- engines/sci/gui/gui_picture.h | 2 +- engines/sci/gui/gui_view.cpp | 32 ++++++++++----------- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp index c59e36f303..9059bb5877 100644 --- a/engines/sci/gui/gui_picture.cpp +++ b/engines/sci/gui/gui_picture.cpp @@ -317,7 +317,7 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) { 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 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) { 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 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) { 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); } } diff --git a/engines/sci/gui/gui_picture.h b/engines/sci/gui/gui_picture.h index fc9791045b..e010deb9a1 100644 --- a/engines/sci/gui/gui_picture.h +++ b/engines/sci/gui/gui_picture.h @@ -46,7 +46,7 @@ private: 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); diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index ff60511008..10d2c0c0a0 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -262,15 +262,15 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt 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(runLength, pixelCount - pixelNo)); + pixel = *literalPtr++; + runLength = pixel >> 4; + memset(outPtr + pixelNo, pixel & 0x0F, MIN(runLength, pixelCount - pixelNo)); pixelNo += runLength; } return; @@ -281,15 +281,15 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt 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 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt } 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 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt // 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++; -- cgit v1.2.3