aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2013-01-06 20:51:50 +0100
committerJohannes Schickel2013-01-06 20:53:08 +0100
commit71304b6e77d22d6c642442d96a535ea3f286601c (patch)
tree32a0d77a155ace65460fceb8e37baa8f0d402931 /engines
parent98cfb57dd3602e96248e0fae47a8e9250dad7a08 (diff)
downloadscummvm-rg350-71304b6e77d22d6c642442d96a535ea3f286601c.tar.gz
scummvm-rg350-71304b6e77d22d6c642442d96a535ea3f286601c.tar.bz2
scummvm-rg350-71304b6e77d22d6c642442d96a535ea3f286601c.zip
GOB: Fix const away cast warning.
Thanks to DrMcCoy for looking over this.
Diffstat (limited to 'engines')
-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);
}