diff options
author | Vincent Hamm | 2007-12-25 20:16:59 +0000 |
---|---|---|
committer | Vincent Hamm | 2007-12-25 20:16:59 +0000 |
commit | b2ab69f455978a4dffc4fcb8cd6148edbb886327 (patch) | |
tree | 46cb912f296bbe687f13343af8e692fe35aeaab8 /engines/cruise | |
parent | a3f1767009a692d1edaa3d1f0fd29c0de455a95c (diff) | |
download | scummvm-rg350-b2ab69f455978a4dffc4fcb8cd6148edbb886327.tar.gz scummvm-rg350-b2ab69f455978a4dffc4fcb8cd6148edbb886327.tar.bz2 scummvm-rg350-b2ab69f455978a4dffc4fcb8cd6148edbb886327.zip |
Fix palette issues
svn-id: r29989
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/background.cpp | 2 | ||||
-rw-r--r-- | engines/cruise/cruise_main.cpp | 14 | ||||
-rw-r--r-- | engines/cruise/function.cpp | 21 |
3 files changed, 21 insertions, 16 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp index d52ca19783..9d1bf61267 100644 --- a/engines/cruise/background.cpp +++ b/engines/cruise/background.cpp @@ -202,7 +202,7 @@ int loadBackground(const char *name, int idx) { break; case 8: memcpy(backgroundPtrtable[idx], ptr2, 320 * 200); - ptr2 += 32000; + ptr2 += 320*200; break; } diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 61bfa3f2e0..4f7f11fd2e 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1174,8 +1174,18 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { } int findHighColor() { - printf("Unimplemented findHighColor\n"); - return 1; + int bestColorResult = -1; + int bestColorIdx = -1; + + for(unsigned long int i=0; i<256; i++) { + int colorResult = (workpal[i*3+0] + workpal[i*3+1] + workpal[i*3+2]) / 256; + + if(colorResult > bestColorResult) { + bestColorIdx = i; + bestColorResult = colorResult; + } + } + return bestColorIdx; } void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index d620092732..e8322d1edd 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -903,30 +903,25 @@ int16 Op_SetColor(void) { int i; - int R,G,B; - #define convertRatio 36.571428571428571428571428571429 for (i=startIdx; i<=endIdx; i++) { - R = (int)(colorR*convertRatio); - G = (int)(colorG*convertRatio); - B = (int)(colorB*convertRatio); + int offsetTable[3]; - if (R > 0xFF) - R = 0xFF; - if (G > 0xFF) - G = 0xFF; - if (B > 0xFF) - B = 0xFF; + offsetTable[0] = (int)(colorR*convertRatio); + offsetTable[1] = (int)(colorG*convertRatio); + offsetTable[2] = (int)(colorB*convertRatio); if (CVTLoaded) { int colorIdx = cvtPalette[i]; - gfxModuleData_setPalColor(colorIdx, R, G, B); + calcRGB(&palScreen[masterScreen][3*colorIdx], &workpal[3*colorIdx], offsetTable); } else { - gfxModuleData_setPalColor(i, R, G, B); + calcRGB(&palScreen[masterScreen][3*i], &workpal[3*i], offsetTable); } } + gfxModuleData_setPal256(workpal); + return 0; } |