aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-04-29 01:07:19 +0000
committerTorbjörn Andersson2007-04-29 01:07:19 +0000
commit3ca3f07cdd8d3f1ab7b9de309997316a2201226b (patch)
tree71c6f90d430bb50fabc3e715d63453c157f328c5 /engines/cruise
parent7143d08e71f85f11df43842544bbb3b4c6a5fbbc (diff)
downloadscummvm-rg350-3ca3f07cdd8d3f1ab7b9de309997316a2201226b.tar.gz
scummvm-rg350-3ca3f07cdd8d3f1ab7b9de309997316a2201226b.tar.bz2
scummvm-rg350-3ca3f07cdd8d3f1ab7b9de309997316a2201226b.zip
Only update the backend's palette when necessary, since doing this triggers a
full redraw. (We still do that by updating the entire screen every frame, but that could possibly change in the future.) As an added bonus, I can now see all the glitches of the English version's intro in full ScummTechniVMColor. :-) svn-id: r26672
Diffstat (limited to 'engines/cruise')
-rw-r--r--engines/cruise/function.cpp9
-rw-r--r--engines/cruise/gfxModule.cpp38
-rw-r--r--engines/cruise/gfxModule.h3
3 files changed, 35 insertions, 15 deletions
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 45aeb0e9f5..9ab3e3a835 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -879,14 +879,9 @@ int16 Op_SetColor(void) {
if (CVTLoaded) {
int colorIdx = cvtPalette[i];
-
- lpalette[colorIdx].R = R;
- lpalette[colorIdx].G = G;
- lpalette[colorIdx].B = B;
+ gfxModuleData_setPalColor(colorIdx, R, G, B);
} else {
- lpalette[i].R = R;
- lpalette[i].G = G;
- lpalette[i].B = B;
+ gfxModuleData_setPalColor(i, R, G, B);
}
}
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 2b5690466c..23d80a47b0 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -36,6 +36,9 @@ char screen[320 * 200];
palEntry lpalette[256];
short globalAtariScreen[320 * 200 / 4];
+int palDirtyMin = 256;
+int palDirtyMax = -1;
+
gfxModuleDataStruct gfxModuleData = {
0, // field_1
0, // use Tandy
@@ -533,6 +536,20 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
}*/
}
+void gfxModuleData_setDirtyColors(int min, int max) {
+ if (min < palDirtyMin)
+ palDirtyMin = min;
+ if (max > palDirtyMax)
+ palDirtyMax = max;
+}
+
+void gfxModuleData_setPalColor(int idx, int r, int g, int b) {
+ lpalette[idx].R = r;
+ lpalette[idx].G = g;
+ lpalette[idx].B = b;
+ gfxModuleData_setDirtyColors(idx, idx);
+}
+
void gfxModuleData_setPal256(int16 *ptr) {
int R;
int G;
@@ -549,6 +566,8 @@ void gfxModuleData_setPal256(int16 *ptr) {
lpalette[i].B = B;
lpalette[i].A = 255;
}
+
+ gfxModuleData_setDirtyColors(0, 255);
}
void gfxModuleData_setPal(uint8 *ptr) {
@@ -578,8 +597,9 @@ void gfxModuleData_setPal(uint8 *ptr) {
lpalette[i].G = G;
lpalette[i].B = B;
lpalette[i].A = 255;
-
}
+
+ gfxModuleData_setDirtyColors(0, 16);
}
void gfxModuleData_field_90(void) {
@@ -619,13 +639,17 @@ void flip() {
//uint8* outPtr = scaledScreen;
//uint8* inPtr = globalScreen;
- for (i = 0; i < 256; i++) {
- paletteRGBA[i * 4 + 0] = lpalette[i].R;
- paletteRGBA[i * 4 + 1] = lpalette[i].G;
- paletteRGBA[i * 4 + 2] = lpalette[i].B;
- paletteRGBA[i * 4 + 3] = 0xFF;
+ if (palDirtyMax != -1) {
+ for (i = palDirtyMin; i < palDirtyMax; i++) {
+ paletteRGBA[i * 4 + 0] = lpalette[i].R;
+ paletteRGBA[i * 4 + 1] = lpalette[i].G;
+ paletteRGBA[i * 4 + 2] = lpalette[i].B;
+ paletteRGBA[i * 4 + 3] = 0xFF;
+ }
+ g_system->setPalette(paletteRGBA, palDirtyMin, palDirtyMax - palDirtyMin + 1);
+ palDirtyMin = 256;
+ palDirtyMax = -1;
}
- g_system->setPalette(paletteRGBA, 0, 16);
g_system->copyRectToScreen(globalScreen, 320, 0, 0, 320, 200);
g_system->updateScreen();
diff --git a/engines/cruise/gfxModule.h b/engines/cruise/gfxModule.h
index a05fc02c33..86521d5641 100644
--- a/engines/cruise/gfxModule.h
+++ b/engines/cruise/gfxModule.h
@@ -48,10 +48,11 @@ typedef struct gfxModuleDataStruct gfxModuleDataStruct;
typedef struct palEntry palEntry;
extern gfxModuleDataStruct gfxModuleData;
-extern palEntry lpalette[256];
extern short globalAtariScreen[320 * 200 / 4];
void gfxModuleData_gfxClearFrameBuffer(uint8 * ptr);
+void gfxModuleData_setDirtyColors(int min, int max);
+void gfxModuleData_setPalColor(int idx, int r, int g, int b);
void gfxModuleData_setPal(uint8 * ptr);
void gfxModuleData_field_90(void);
void gfxModuleData_gfxWaitVSync(void);