aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/inter_v7.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index 4d92386c94..1238c23e3b 100644
--- a/engines/gob/inter_v7.cpp
+++ b/engines/gob/inter_v7.cpp
@@ -554,18 +554,27 @@ void Inter_v7::o7_loadIFFPalette() {
return;
}
- byte *palette = (byte *)decoder.getPalette();
- memset(palette , 0x00, 3);
- memset(palette + 765, 0xFF, 3);
- for (int i = 0; i < 768; i++)
- palette[i] >>= 2;
-
- int16 count = stopIndex - startIndex + 1;
+ const byte *palette = decoder.getPalette();
startIndex *= 3;
- count *= 3;
+ stopIndex *= 3;
+
+ byte *dst = (byte *)_vm->_draw->_vgaPalette + startIndex;
+ const byte *src = palette + startIndex;
+ for (int i = startIndex; i <= stopIndex + 2; ++i) {
+ *dst++ = *src++ >> 2;
+ }
+
+ if (startIndex == 0) {
+ dst = (byte *)_vm->_draw->_vgaPalette;
+ dst[0] = dst[1] = dst[2] = 0x00 >> 2;
+ }
+
+ if (stopIndex == 765) {
+ dst = (byte *)_vm->_draw->_vgaPalette + 765;
+ dst[0] = dst[1] = dst[2] = 0xFF >> 2;
+ }
- memcpy((char *)_vm->_draw->_vgaPalette + startIndex, palette + startIndex, count);
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
}