aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/background.cpp2
-rw-r--r--engines/cruise/cruise_main.cpp14
-rw-r--r--engines/cruise/function.cpp21
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;
}