diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/remap.cpp | 18 | ||||
-rw-r--r-- | engines/sci/graphics/remap.h | 21 | ||||
-rw-r--r-- | engines/sci/graphics/remap32.cpp | 28 | ||||
-rw-r--r-- | engines/sci/graphics/remap32.h | 15 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 1 |
5 files changed, 40 insertions, 43 deletions
diff --git a/engines/sci/graphics/remap.cpp b/engines/sci/graphics/remap.cpp index 7f5721b742..2abf03ea29 100644 --- a/engines/sci/graphics/remap.cpp +++ b/engines/sci/graphics/remap.cpp @@ -21,31 +21,23 @@ */ #include "sci/sci.h" -#include "sci/resource.h" #include "sci/graphics/palette.h" -#include "sci/graphics/palette32.h" #include "sci/graphics/remap.h" #include "sci/graphics/screen.h" namespace Sci { -#pragma mark - -#pragma mark SCI16 remapping (QFG4 demo) - GfxRemap::GfxRemap(GfxPalette *palette) : _palette(palette) { _remapOn = false; resetRemapping(); } -GfxRemap::~GfxRemap() { -} - byte GfxRemap::remapColor(byte remappedColor, byte screenColor) { assert(_remapOn); - if (_remappingType[remappedColor] == kRemappingByRange) + if (_remappingType[remappedColor] == kRemapByRange) return _remappingByRange[screenColor]; - else if (_remappingType[remappedColor] == kRemappingByPercent) + else if (_remappingType[remappedColor] == kRemapByPercent) return _remappingByPercent[screenColor]; else error("remapColor(): Color %d isn't remapped", remappedColor); @@ -58,7 +50,7 @@ void GfxRemap::resetRemapping() { _remappingPercentToSet = 0; for (int i = 0; i < 256; i++) { - _remappingType[i] = kRemappingNone; + _remappingType[i] = kRemapNone; _remappingByPercent[i] = i; _remappingByRange[i] = i; } @@ -80,7 +72,7 @@ void GfxRemap::setRemappingPercent(byte color, byte percent) { _remappingByPercent[i] = _palette->kernelFindColor(r, g, b); } - _remappingType[color] = kRemappingByPercent; + _remappingType[color] = kRemapByPercent; } void GfxRemap::setRemappingRange(byte color, byte from, byte to, byte base) { @@ -90,7 +82,7 @@ void GfxRemap::setRemappingRange(byte color, byte from, byte to, byte base) { _remappingByRange[i] = i + base; } - _remappingType[color] = kRemappingByRange; + _remappingType[color] = kRemapByRange; } void GfxRemap::updateRemapping() { diff --git a/engines/sci/graphics/remap.h b/engines/sci/graphics/remap.h index d758a97ab0..a9cd76ae7b 100644 --- a/engines/sci/graphics/remap.h +++ b/engines/sci/graphics/remap.h @@ -30,33 +30,30 @@ namespace Sci { class GfxScreen; -enum ColorRemappingType { - kRemappingNone = 0, - kRemappingByRange = 1, - kRemappingByPercent = 2, - kRemappingToGray = 3, - kRemappingToPercentGray = 4 -}; - /** - * Remap class, handles color remapping + * This class handles color remapping for the QFG4 demo. */ class GfxRemap { +private: + enum ColorRemappingType { + kRemapNone = 0, + kRemapByRange = 1, + kRemapByPercent = 2 + }; + public: GfxRemap(GfxPalette *_palette); - ~GfxRemap(); void resetRemapping(); void setRemappingPercent(byte color, byte percent); void setRemappingRange(byte color, byte from, byte to, byte base); bool isRemapped(byte color) const { - return _remapOn && (_remappingType[color] != kRemappingNone); + return _remapOn && (_remappingType[color] != kRemapNone); } byte remapColor(byte remappedColor, byte screenColor); void updateRemapping(); private: - GfxScreen *_screen; GfxPalette *_palette; bool _remapOn; diff --git a/engines/sci/graphics/remap32.cpp b/engines/sci/graphics/remap32.cpp index 5516d0e271..774c4ca6f8 100644 --- a/engines/sci/graphics/remap32.cpp +++ b/engines/sci/graphics/remap32.cpp @@ -28,7 +28,7 @@ namespace Sci { GfxRemap32::GfxRemap32(GfxPalette32 *palette) : _palette(palette) { for (int i = 0; i < REMAP_COLOR_COUNT; i++) - _remaps[i] = RemapParams(0, 0, 0, 0, 100, kRemappingNone); + _remaps[i] = RemapParams(0, 0, 0, 0, 100, kRemapNone); _noMapStart = _noMapCount = 0; _update = false; _remapCount = 0; @@ -41,13 +41,13 @@ GfxRemap32::GfxRemap32(GfxPalette32 *palette) : _palette(palette) { void GfxRemap32::remapOff(byte color) { if (!color) { for (int i = 0; i < REMAP_COLOR_COUNT; i++) - _remaps[i] = RemapParams(0, 0, 0, 0, 100, kRemappingNone); + _remaps[i] = RemapParams(0, 0, 0, 0, 100, kRemapNone); _remapCount = 0; } else { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); const byte index = _remapEndColor - color; - _remaps[index] = RemapParams(0, 0, 0, 0, 100, kRemappingNone); + _remaps[index] = RemapParams(0, 0, 0, 0, 100, kRemapNone); _remapCount--; } @@ -56,7 +56,7 @@ void GfxRemap32::remapOff(byte color) { void GfxRemap32::setRemappingRange(byte color, byte from, byte to, byte base) { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); - _remaps[_remapEndColor - color] = RemapParams(from, to, base, 0, 100, kRemappingByRange); + _remaps[_remapEndColor - color] = RemapParams(from, to, base, 0, 100, kRemapByRange); initColorArrays(_remapEndColor - color); _remapCount++; _update = true; @@ -64,7 +64,7 @@ void GfxRemap32::setRemappingRange(byte color, byte from, byte to, byte base) { void GfxRemap32::setRemappingPercent(byte color, byte percent) { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); - _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, 0, percent, kRemappingByPercent); + _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, 0, percent, kRemapByPercent); initColorArrays(_remapEndColor - color); _remapCount++; _update = true; @@ -72,7 +72,7 @@ void GfxRemap32::setRemappingPercent(byte color, byte percent) { void GfxRemap32::setRemappingToGray(byte color, byte gray) { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); - _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, gray, 100, kRemappingToGray); + _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, gray, 100, kRemapToGray); initColorArrays(_remapEndColor - color); _remapCount++; _update = true; @@ -80,7 +80,7 @@ void GfxRemap32::setRemappingToGray(byte color, byte gray) { void GfxRemap32::setRemappingToPercentGray(byte color, byte gray, byte percent) { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); - _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, gray, percent, kRemappingToPercentGray); + _remaps[_remapEndColor - color] = RemapParams(0, 0, 0, gray, percent, kRemapToPercentGray); initColorArrays(_remapEndColor - color); _remapCount++; _update = true; @@ -94,13 +94,13 @@ void GfxRemap32::setNoMatchRange(byte from, byte count) { bool GfxRemap32::remapEnabled(byte color) const { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); const byte index = _remapEndColor - color; - return (_remaps[index].type != kRemappingNone); + return (_remaps[index].type != kRemapNone); } byte GfxRemap32::remapColor(byte color, byte target) { assert(_remapEndColor - color >= 0 && _remapEndColor - color < REMAP_COLOR_COUNT); const byte index = _remapEndColor - color; - if (_remaps[index].type != kRemappingNone) + if (_remaps[index].type != kRemapNone) return _remaps[index].remap[target]; else return target; @@ -127,9 +127,9 @@ bool GfxRemap32::updateRemap(byte index, bool palChanged) { Common::fill(_targetChanged, _targetChanged + NON_REMAPPED_COLOR_COUNT, false); switch (curRemap->type) { - case kRemappingNone: + case kRemapNone: return false; - case kRemappingByRange: + case kRemapByRange: for (int i = 0; i < NON_REMAPPED_COLOR_COUNT; i++) { if (curRemap->from <= i && i <= curRemap->to) result = i + curRemap->base; @@ -144,7 +144,7 @@ bool GfxRemap32::updateRemap(byte index, bool palChanged) { curRemap->colorChanged[i] = true; } return changed; - case kRemappingByPercent: + case kRemapByPercent: for (int i = 1; i < NON_REMAPPED_COLOR_COUNT; i++) { // NOTE: This method uses nextPalette instead of curPalette Color color = nextPalette->colors[i]; @@ -172,7 +172,7 @@ bool GfxRemap32::updateRemap(byte index, bool palChanged) { Common::fill(curRemap->colorChanged, curRemap->colorChanged + NON_REMAPPED_COLOR_COUNT, false); curRemap->oldPercent = curRemap->percent; return changed; - case kRemappingToGray: + case kRemapToGray: for (int i = 1; i < NON_REMAPPED_COLOR_COUNT; i++) { Color color = curPalette->colors[i]; @@ -200,7 +200,7 @@ bool GfxRemap32::updateRemap(byte index, bool palChanged) { Common::fill(curRemap->colorChanged, curRemap->colorChanged + NON_REMAPPED_COLOR_COUNT, false); curRemap->oldGray = curRemap->gray; return changed; - case kRemappingToPercentGray: + case kRemapToPercentGray: for (int i = 1; i < NON_REMAPPED_COLOR_COUNT; i++) { Color color = curPalette->colors[i]; diff --git a/engines/sci/graphics/remap32.h b/engines/sci/graphics/remap32.h index ff871f62f3..3d5b67da37 100644 --- a/engines/sci/graphics/remap32.h +++ b/engines/sci/graphics/remap32.h @@ -24,13 +24,20 @@ #define SCI_GRAPHICS_REMAP32_H #include "common/array.h" -#include "sci/graphics/remap.h" namespace Sci { #define REMAP_COLOR_COUNT 9 #define NON_REMAPPED_COLOR_COUNT 236 +enum RemapType { + kRemapNone = 0, + kRemapByRange = 1, + kRemapByPercent = 2, + kRemapToGray = 3, + kRemapToPercentGray = 4 +}; + struct RemapParams { byte from; byte to; @@ -39,7 +46,7 @@ struct RemapParams { byte oldGray; byte percent; byte oldPercent; - ColorRemappingType type; + RemapType type; Color curColor[256]; Color targetColor[256]; byte distance[256]; @@ -48,7 +55,7 @@ struct RemapParams { RemapParams() { from = to = base = gray = oldGray = percent = oldPercent = 0; - type = kRemappingNone; + type = kRemapNone; // curColor and targetColor are initialized in GfxRemap32::initColorArrays memset(curColor, 0, 256 * sizeof(Color)); @@ -59,7 +66,7 @@ struct RemapParams { Common::fill(colorChanged, colorChanged + ARRAYSIZE(colorChanged), true); } - RemapParams(byte from_, byte to_, byte base_, byte gray_, byte percent_, ColorRemappingType type_) { + RemapParams(byte from_, byte to_, byte base_, byte gray_, byte percent_, RemapType type_) { from = from_; to = to_; base = base_; diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 91590208c1..96b48c0477 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -55,6 +55,7 @@ struct LoopInfo { class GfxScreen; class GfxPalette; +class Resource; /** * View class, handles loading of view resources and drawing contained cels to screen |