aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/palette.cpp
diff options
context:
space:
mode:
authorFabio Battaglia2009-05-25 07:57:38 +0000
committerFabio Battaglia2009-05-25 07:57:38 +0000
commit5ef58bdfbe443c19d2f185d924b5058f25cab962 (patch)
tree5efbb5403d6131e8e090c3a1c9e5f8214a1897c2 /engines/tinsel/palette.cpp
parent6143da7ceab4eb6e5b76ced0df02e94e5eb96238 (diff)
downloadscummvm-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/tinsel/palette.cpp')
-rw-r--r--engines/tinsel/palette.cpp6
1 files changed, 5 insertions, 1 deletions
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;
}
}