diff options
-rw-r--r-- | engines/tinsel/debugger.cpp | 3 | ||||
-rw-r--r-- | engines/tinsel/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/rince.cpp | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/engines/tinsel/debugger.cpp b/engines/tinsel/debugger.cpp index f422c88e94..5d8b22116d 100644 --- a/engines/tinsel/debugger.cpp +++ b/engines/tinsel/debugger.cpp @@ -57,7 +57,8 @@ int strToInt(const char *s) { // Hexadecimal string uint tmp; - sscanf(s, "%xh", &tmp); + if (!sscanf(s, "%xh", &tmp)) + tmp = 0; return (int)tmp; } diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 48270d94e3..aefc6e6144 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -66,8 +66,8 @@ uint8* psxPJCRLEUnwinder(uint16 imageWidth, uint16 imageHeight, uint8 *srcIdx) { return NULL; // Calculate needed index numbers, align width and height not next multiple of four - imageWidth = imageWidth % 4 ? ((imageWidth / 4) + 1) * 4 : imageWidth; - imageHeight = imageHeight % 4 ? ((imageHeight / 4) + 1) * 4 : imageHeight; + imageWidth = (imageWidth % 4) ? ((imageWidth / 4) + 1) * 4 : imageWidth; + imageHeight = (imageHeight % 4) ? ((imageHeight / 4) + 1) * 4 : imageHeight; destinationBuffer = (uint8*)malloc((imageWidth * imageHeight) / 8); dstIdx = destinationBuffer; remainingBlocks = (imageWidth * imageHeight) / 16; @@ -297,7 +297,7 @@ static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply } else { for (int xp = boxBounds.left; xp <= boxBounds.right; ++xp) { // Extract pixel value from byte - byte pixValue = (*(p + (xp / 2)) & (xp % 2 ? 0xf0 : 0x0f)) >> (xp % 2 ? 4 : 0); + byte pixValue = (*(p + (xp / 2)) & ((xp % 2) ? 0xf0 : 0x0f)) >> ((xp % 2) ? 4 : 0); if (pixValue || !transparency) *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + (xp - boxBounds.left)) = psxMapperTable[pixValue]; } diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp index cfffe88587..17b2bf4ddc 100644 --- a/engines/tinsel/rince.cpp +++ b/engines/tinsel/rince.cpp @@ -361,8 +361,8 @@ static void InitMover(PMOVER pMover) { pMover->Tline = 0; - if (pMover->direction != FORWARD || pMover->direction != AWAY - || pMover->direction != LEFTREEL || pMover->direction != RIGHTREEL) + if (pMover->direction != FORWARD && pMover->direction != AWAY + && pMover->direction != LEFTREEL && pMover->direction != RIGHTREEL) pMover->direction = FORWARD; if (pMover->scale < 0 || pMover->scale > TOTAL_SCALES) |