diff options
author | Fabio Battaglia | 2009-05-25 07:57:38 +0000 |
---|---|---|
committer | Fabio Battaglia | 2009-05-25 07:57:38 +0000 |
commit | 5ef58bdfbe443c19d2f185d924b5058f25cab962 (patch) | |
tree | 5efbb5403d6131e8e090c3a1c9e5f8214a1897c2 /engines | |
parent | 6143da7ceab4eb6e5b76ced0df02e94e5eb96238 (diff) | |
download | scummvm-rg350-5ef58bdfbe443c19d2f185d924b5058f25cab962.tar.gz scummvm-rg350-5ef58bdfbe443c19d2f185d924b5058f25cab962.tar.bz2 scummvm-rg350-5ef58bdfbe443c19d2f185d924b5058f25cab962.zip |
tinsel: avoid unnecessary iterations in Discworld PSX palette remapper
svn-id: r40879
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/graphics.cpp | 1 | ||||
-rw-r--r-- | engines/tinsel/palette.cpp | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index f66c57590b..42e117aa8f 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -769,7 +769,6 @@ void DrawObject(DRAWOBJECT *pObj) { } break; case 0x44: // PSX 4-bit CLUT - memset(psxMapperTable, 0, 16); psxPaletteMapper(pObj->pPal, srcPtr + sizeof(uint16), psxMapperTable); psxFourBitClut = true; diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 6f7b5e5f6b..d090cfa690 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -99,6 +99,8 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { bool colorFound = false; uint16 clutEntry = 0; + memset(mapperTable, 0, 16); + for (int j = 0; j < 16; j++) { clutEntry = READ_LE_UINT16(psxClut + (sizeof(uint16) * j)); if(clutEntry) { @@ -117,7 +119,9 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { // black, i still have to find the correct fix for this. if(clutEntry == 0x7EC0 && !colorFound) mapperTable[j] = 197; colorFound = false; - } else { + } else if (!clutEntry && j) { // The rest of the colours are zeroes + return; + } else { // Skip first entry mapperTable[j] = 0; } } |