From bd281928cb6e87cfb7175189cafd2b25991f3e01 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Jul 2012 03:53:44 +0300 Subject: SCI: Initial implementation of kRemapColors(kRemapByPercent) Fixes some graphics glitches in the QFG4 demo and the menus of QFG4, by implementing one of the transparency effects used mainly in SCI32. Many thanks to fuzzie for her debugging info on QFG4 demo and to wjp for his great help on the dissassembly --- engines/sci/graphics/palette.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index a9ea1c32de..5b9ae9e016 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -53,6 +53,11 @@ public: void getSys(Palette *pal); uint16 getTotalColorCount() const { return _totalScreenColors; } + void toggleRemap(bool remap) { _remapOn = remap; } + void setRemappingPercent(uint16 percent) { _remappingPercent = percent; } + bool isRemapColor(byte color); + byte remapColor(byte color); + void setOnScreen(); void copySysPaletteToScreen(); @@ -123,6 +128,10 @@ private: int _palVarySignal; uint16 _totalScreenColors; + bool _remapOn; + uint16 _remappingBaseR, _remappingBaseG, _remappingBaseB; + uint16 _remappingPercent; + void loadMacIconBarPalette(); byte *_macClut; -- cgit v1.2.3 From 3d395545cb1514ba4a07a785e58782462a3b1a94 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Jul 2012 04:07:08 +0300 Subject: SCI: Remove unused variables --- engines/sci/graphics/palette.h | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 5b9ae9e016..6774094810 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -129,7 +129,6 @@ private: uint16 _totalScreenColors; bool _remapOn; - uint16 _remappingBaseR, _remappingBaseG, _remappingBaseB; uint16 _remappingPercent; void loadMacIconBarPalette(); -- cgit v1.2.3 From 6f351302040be620aa039a7c605f3c23463b27db Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Jul 2012 22:34:03 +0300 Subject: SCI: More work on color remapping More transparency/color mapping effects are now working (e.g. the flashlight at the Gedde tomb in GK1, the rays of light at Schloss Ritter in GK1, the torch in the QFG4 demo and the shadows in QFG4, PQ4 and KQ7) --- engines/sci/graphics/palette.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 6774094810..372f3c7090 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -53,9 +53,11 @@ public: void getSys(Palette *pal); uint16 getTotalColorCount() const { return _totalScreenColors; } - void toggleRemap(bool remap) { _remapOn = remap; } - void setRemappingPercent(uint16 percent) { _remappingPercent = percent; } - bool isRemapColor(byte color); + void toggleRemapping(bool remap) { _remapOn = remap; } + void resetRemapping(); + void setRemappingPercent(byte color, byte percent); + void setRemappingRange(byte color, byte from, byte to, byte base); + bool isRemapMask(byte color); byte remapColor(byte color); void setOnScreen(); @@ -129,7 +131,9 @@ private: uint16 _totalScreenColors; bool _remapOn; - uint16 _remappingPercent; + byte _remappingTable[256]; + uint16 _remappingMaskFrom, _remappingMaskTo; + uint16 _remappingPercentToSet; void loadMacIconBarPalette(); byte *_macClut; -- cgit v1.2.3 From fe3fb1873c60e7ed21c573e09030bd6d0a5018cb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 24 Jul 2012 22:54:37 +0300 Subject: SCI: Cleanup of the palette remapping code --- engines/sci/graphics/palette.h | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 372f3c7090..134ade5e36 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -53,7 +53,6 @@ public: void getSys(Palette *pal); uint16 getTotalColorCount() const { return _totalScreenColors; } - void toggleRemapping(bool remap) { _remapOn = remap; } void resetRemapping(); void setRemappingPercent(byte color, byte percent); void setRemappingRange(byte color, byte from, byte to, byte base); -- cgit v1.2.3 From 537b1969bf896ee4e72e9d042e4b7f41c921d38c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 25 Jul 2012 00:58:16 +0300 Subject: SCI: Rewrite the color remapping code to support simultaneous effects Fixes the torch in the full version of QFG4 --- engines/sci/graphics/palette.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 134ade5e36..9898315897 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -31,6 +31,12 @@ namespace Sci { class ResourceManager; class GfxScreen; +enum ColorRemappingType { + kRemappingNone = 0, + kRemappingByRange = 1, + kRemappingByPercent = 2 +}; + /** * Palette class, handles palette operations like changing intensity, setting up the palette, merging different palettes */ @@ -56,8 +62,10 @@ public: void resetRemapping(); void setRemappingPercent(byte color, byte percent); void setRemappingRange(byte color, byte from, byte to, byte base); - bool isRemapMask(byte color); - byte remapColor(byte color); + bool isRemapped(byte color) const { + return _remapOn && (_remappingType[color] != kRemappingNone); + } + byte remapColor(byte remappedColor, byte screenColor); void setOnScreen(); void copySysPaletteToScreen(); @@ -130,8 +138,9 @@ private: uint16 _totalScreenColors; bool _remapOn; - byte _remappingTable[256]; - uint16 _remappingMaskFrom, _remappingMaskTo; + ColorRemappingType _remappingType[256]; + byte _remappingByPercent[256]; + byte _remappingByRange[256]; uint16 _remappingPercentToSet; void loadMacIconBarPalette(); -- cgit v1.2.3 From 7d436622a8e10437488f6dfa930e3ff15e254a55 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 21 Aug 2012 03:31:00 +0300 Subject: SCI: More work on kRemapColors This implements some more color remap-based palette effects, found in QFG4 --- engines/sci/graphics/palette.h | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/sci/graphics/palette.h') diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 9898315897..e974781d49 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -61,6 +61,7 @@ public: void resetRemapping(); void setRemappingPercent(byte color, byte percent); + void setRemappingPercentGray(byte color, byte percent); void setRemappingRange(byte color, byte from, byte to, byte base); bool isRemapped(byte color) const { return _remapOn && (_remappingType[color] != kRemappingNone); -- cgit v1.2.3