From dcbc6e7e695dcf35a36fc436c9318fd2648b1099 Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Wed, 3 Jun 2009 14:03:05 +0000 Subject: tinsel: removed some warnings related to psx code and cleanup of psx palette remapper function svn-id: r41138 --- engines/tinsel/graphics.cpp | 4 ++-- engines/tinsel/palette.cpp | 4 +--- engines/tinsel/palette.h | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'engines/tinsel') diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 42e117aa8f..cb334d96b0 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -724,9 +724,9 @@ void DrawObject(DRAWOBJECT *pObj) { uint8 *destPtr; byte psxMapperTable[16]; - bool psxFourBitClut; // Used by Tinsel PSX, true if an image using a 4bit CLUT is rendered + bool psxFourBitClut = false; // Used by Tinsel PSX, true if an image using a 4bit CLUT is rendered bool psxRLEindex = false; // Used by Tinsel PSX, true if an image is using PJCRLE compressed indexes - uint32 psxSkipBytes; // Used by Tinsel PSX, number of bytes to skip before counting indexes for image tiles + uint32 psxSkipBytes = 0; // Used by Tinsel PSX, number of bytes to skip before counting indexes for image tiles if ((pObj->width <= 0) || (pObj->height <= 0)) // Empty image, so return immediately diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 17449f518e..1a384ea6c5 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -112,9 +112,7 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { // Check for correspondent color for (int i = 0; (i < pal->numColours) && !colorFound; i++) { // get R G B values in the same way as psx format converters - uint16 psxEquivalent = (uint16)((uint32)(PSXGetRValue(pal->palRGB[i]) >> 3) | - ((PSXGetGValue(pal->palRGB[i]) >> 3) << 5) | - ((PSXGetBValue(pal->palRGB[i]) >> 3) << 10)); + uint16 psxEquivalent = TINSEL_PSX_RGB(TINSEL_GetRValue(pal->palRGB[i]) >> 3, TINSEL_GetGValue(pal->palRGB[i]) >> 3, TINSEL_GetBValue(pal->palRGB[i]) >> 3); if (psxEquivalent == clutEntry) { mapperTable[j] = i + 1; diff --git a/engines/tinsel/palette.h b/engines/tinsel/palette.h index c887220840..bfeb2dd658 100644 --- a/engines/tinsel/palette.h +++ b/engines/tinsel/palette.h @@ -36,12 +36,10 @@ typedef uint32 COLORREF; #define TINSEL_RGB(r,g,b) ((COLORREF)TO_LE_32(((uint8)(r)|((uint16)(g)<<8))|(((uint32)(uint8)(b))<<16))) #define TINSEL_GetRValue(rgb) ((uint8)(FROM_LE_32(rgb))) -#define TINSEL_GetGValue(rgb) ((uint8)(((uint16)(FROM_LE_32(rgb))) >> 8)) +#define TINSEL_GetGValue(rgb) ((uint8)(((uint16)(FROM_LE_32(rgb)))>>8)) #define TINSEL_GetBValue(rgb) ((uint8)((FROM_LE_32(rgb))>>16)) -#define PSXGetRValue(rgb) ((uint8)(FROM_LE_32(rgb) & 0x000000f8)) -#define PSXGetGValue(rgb) ((uint8)(FROM_LE_32((rgb) >> 8) & 0x000000f8)) -#define PSXGetBValue(rgb) ((uint8)(FROM_LE_32((rgb) >> 16) & 0x000000f8)) +#define TINSEL_PSX_RGB(r,g,b) ((uint16)TO_LE_16(((uint8)(r))|((uint16)(g)<<5)|(((uint16)(b))<<10))) enum { MAX_COLOURS = 256, //!< maximum number of colours - for VGA 256 -- cgit v1.2.3