From b9aaa43bfba4f37705c03b053536bd7cf064a795 Mon Sep 17 00:00:00 2001 From: Vincent Hamm Date: Thu, 20 Dec 2007 19:02:16 +0000 Subject: Fix palette manipulation code Add one missing opcode svn-id: r29928 --- engines/cruise/function.cpp | 16 ++++++++++++++-- engines/cruise/gfxModule.cpp | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 25899a56ed..38d5c966b2 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -571,12 +571,24 @@ int16 Op_WriteObject(void) { int16 param3 = popVar(); int16 param4 = popVar(); -getSingleObjectParam(param4, param3, param2, &returnParam); + getSingleObjectParam(param4, param3, param2, &returnParam); setObjectPosition(param4, param3, param2, param1); return returnParam; } +int16 Op_ReadObject(void) { + int16 returnParam; + + int member = popVar(); + int obj = popVar(); + int ovl = popVar(); + + getSingleObjectParam(ovl, obj, member, &returnParam); + + return returnParam; +} + int16 Op_FadeIn(void) { doFade = 1; return 0; @@ -1614,7 +1626,7 @@ opcodeFunction opcodeTablePtr[] = Op_FindObject, Op_FindProc, Op_WriteObject, - NULL, // Op_ReadObject + Op_ReadObject, Op_RemoveOverlay, Op_AddBackgroundIncrust, diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp index d7a2a9cbf8..dbb7614245 100644 --- a/engines/cruise/gfxModule.cpp +++ b/engines/cruise/gfxModule.cpp @@ -184,13 +184,13 @@ void flip() { //uint8* inPtr = globalScreen; if (palDirtyMax != -1) { - for (i = palDirtyMin; i < palDirtyMax; i++) { + 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); + g_system->setPalette(paletteRGBA+palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1); palDirtyMin = 256; palDirtyMax = -1; } -- cgit v1.2.3