From 3c1c080c3a236ca9aac40d7f04f82b57ec879cbe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 6 Jun 2014 23:18:47 +0200 Subject: CRUISE: Fix some more CppCheck warnings --- engines/cruise/mainDraw.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index 0e39740822..31fafbb641 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -479,10 +479,7 @@ void buildSegment() { // swap again ? SWAP(X1, X2); - int patchAdd = 2; - int dy = Y2 - Y1; - if (dy == 0) { // hline int16* ptr = (Y1 - ydep) * 2 + XMIN_XMAX + 1; @@ -503,6 +500,8 @@ void buildSegment() { ptr[1] = SI; } } else { + int patchAdd = 2; + if (dy < 0) { dy = -dy; patchAdd = -2; @@ -721,7 +720,6 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char * int startX = 0; // first X in model int startY = 0; // first Y in model int x = 0; // current X - int y = 0; // current Y int offsetXinModel = 0; // offset of the X value in the model int offsetYinModel = 0; // offset of the Y value in the model unsigned char *dataPointer = (unsigned char *)dataPtr; @@ -761,9 +759,8 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char * startY >>= 1; } - if (m_flipLeftRight) { + if (m_flipLeftRight) startX = -startX; - } /* * NOTE: @@ -796,7 +793,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char * ptrPoly_1_Buf++; offsetXinModel = x; - y = *(dataPointer) - m_first_Y; + int y = *(dataPointer) - m_first_Y; dataPointer++; if (m_useSmallScale) { y >>= 1; @@ -881,7 +878,6 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX int startX = 0; // first X in model int startY = 0; // first Y in model int x = 0; // current X - int y = 0; // current Y int offsetXinModel = 0; // offset of the X value in the model int offsetYinModel = 0; // offset of the Y value in the model unsigned char *dataPointer = (unsigned char *)dataPtr; @@ -955,11 +951,11 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX ptrPoly_1_Buf++; offsetXinModel = x; - y = *(dataPointer) - m_first_Y; + int y = *(dataPointer) - m_first_Y; dataPointer++; - if (m_useSmallScale) { + if (m_useSmallScale) y >>= 1; - } + ptrPoly_1_Buf[0] = -(offsetYinModel - y); ptrPoly_1_Buf++; offsetYinModel = y; @@ -1150,10 +1146,6 @@ void drawMessage(const gfxEntryStruct *pGfxPtr, int globalX, int globalY, int wi // this is used for font only if (pGfxPtr) { - uint8 *initialOuput; - uint8 *output; - int xp, yp; - int x, y; const uint8 *ptr = pGfxPtr->imagePtr; int height = pGfxPtr->height; @@ -1172,14 +1164,14 @@ void drawMessage(const gfxEntryStruct *pGfxPtr, int globalX, int globalY, int wi gfxModuleData_addDirtyRect(Common::Rect(globalX, globalY, globalX + width, globalY + height)); - initialOuput = ouputPtr + (globalY * 320) + globalX; + uint8 *initialOuput = ouputPtr + (globalY * 320) + globalX; - for (yp = 0; yp < height; yp++) { - output = initialOuput + 320 * yp; - y = globalY + yp; + for (int yp = 0; yp < height; yp++) { + uint8 *output = initialOuput + 320 * yp; + int y = globalY + yp; - for (xp = 0; xp < pGfxPtr->width; xp++) { - x = globalX + xp; + for (int xp = 0; xp < pGfxPtr->width; xp++) { + int x = globalX + xp; uint8 color = *(ptr++); if (color) { -- cgit v1.2.3