diff options
author | Colin Snover | 2017-02-24 12:15:57 -0600 |
---|---|---|
committer | Colin Snover | 2017-04-22 13:01:37 -0500 |
commit | e504efe4da62b3d2e32ffb895b935080be02aed4 (patch) | |
tree | eb8b452309c90ad667039599d743a80bd50cd2fd /engines/sci/engine | |
parent | 399551af09420e0b97ce4ee82d0bf368964e1333 (diff) | |
download | scummvm-rg350-e504efe4da62b3d2e32ffb895b935080be02aed4.tar.gz scummvm-rg350-e504efe4da62b3d2e32ffb895b935080be02aed4.tar.bz2 scummvm-rg350-e504efe4da62b3d2e32ffb895b935080be02aed4.zip |
SCI32: Add palette code for late SCI2.1mid+ games
Sometime during SCI2.1mid, the palette manager was changed to
save and restore the source palette, and to add in-game gamma
correction. Previously, only the vary start and target palettes
were saved, and gamma correction was only configurable in SSCI by
editing RESOURCE.CFG.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/features.h | 12 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 3 |
4 files changed, 25 insertions, 14 deletions
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h index 044111a43e..6d9460d61e 100644 --- a/engines/sci/engine/features.h +++ b/engines/sci/engine/features.h @@ -124,10 +124,20 @@ public: gid != GID_MOTHERGOOSEHIRES; } - inline bool hasNewPaletteCode() const { + inline bool hasMidPaletteCode() const { return getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7; } + inline bool hasLatePaletteCode() const { + return getSciVersion() > SCI_VERSION_2_1_MIDDLE || + g_sci->getGameId() == GID_GK2 || + g_sci->getGameId() == GID_PQSWAT || + // Guessing that Shivers has the late palette code because it has a + // brightness slider + g_sci->getGameId() == GID_SHIVERS || + g_sci->getGameId() == GID_TORIN; + } + inline bool VMDOpenStopsAudio() const { // Of the games that use VMDs: // Yes: Phant1, Shivers, Torin diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 07a63c73d9..ae84e6b8a5 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -934,16 +934,8 @@ reg_t kPaletteFindColor32(EngineState *s, int argc, reg_t *argv) { return make_reg(0, g_sci->_gfxPalette32->matchColor(r, g, b)); } -/* - * Used starting in Shivers 1. SCI3 contains 6 gamma look-up tables, with the - * first table (gamma = 0) being the default one. - */ reg_t kPaletteSetGamma(EngineState *s, int argc, reg_t *argv) { - const uint8 gamma = argv[0].toUint16(); - assert(gamma <= 6); - - warning("TODO: kPaletteSetGamma(%d)", gamma); - + g_sci->_gfxPalette32->setGamma(argv[0].toSint16()); return s->r_acc; } @@ -962,7 +954,7 @@ reg_t kPalVarySetVary(EngineState *s, int argc, reg_t *argv) { int16 fromColor; int16 toColor; - if (g_sci->_features->hasNewPaletteCode() && argc > 4) { + if (g_sci->_features->hasMidPaletteCode() && argc > 4) { fromColor = argv[3].toSint16(); toColor = argv[4].toSint16(); } else { diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index e6a6af7d17..04715d6034 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -865,10 +865,18 @@ void GfxPalette32::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsByte(_cycleMap[i]); } + if (g_sci->_features->hasLatePaletteCode() && s.getVersion() >= 41) { + s.syncAsSint16LE(_gammaLevel); + saveLoadPalette32(s, &_sourcePalette); + ++_version; + _needsUpdate = true; + _gammaChanged = true; + } + saveLoadOptionalPalette32(s, &_varyTargetPalette); saveLoadOptionalPalette32(s, &_varyStartPalette); - // NOTE: _sourcePalette and _nextPalette are not saved - // by SCI engine + + // _nextPalette is not saved by SSCI for (int i = 0; i < ARRAYSIZE(_cyclers); ++i) { PalCycler *cycler = nullptr; diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h index 274df25dc2..72982469e0 100644 --- a/engines/sci/engine/savegame.h +++ b/engines/sci/engine/savegame.h @@ -37,6 +37,7 @@ struct EngineState; * * Version - new/changed feature * ============================= + * 41 - palette support for newer SCI2.1 games * 40 - always store palvary variables * 39 - Accurate SCI32 arrays/strings, score metadata, avatar metadata * 38 - SCI32 cursor @@ -65,7 +66,7 @@ struct EngineState; */ enum { - CURRENT_SAVEGAME_VERSION = 40, + CURRENT_SAVEGAME_VERSION = 41, MINIMUM_SAVEGAME_VERSION = 14 }; |