[Scummvm-cvs-logs] scummvm master -> 71304b6e77d22d6c642442d96a535ea3f286601c

lordhoto lordhoto at gmail.com
Sun Jan 6 20:54:22 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
71304b6e77 GOB: Fix const away cast warning.


Commit: 71304b6e77d22d6c642442d96a535ea3f286601c
    https://github.com/scummvm/scummvm/commit/71304b6e77d22d6c642442d96a535ea3f286601c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-01-06T11:53:08-08:00

Commit Message:
GOB: Fix const away cast warning.

Thanks to DrMcCoy for looking over this.

Changed paths:
    engines/gob/inter_v7.cpp



diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index 4d92386..1238c23 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);
 }
 






More information about the Scummvm-git-logs mailing list