aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel_tables.h2
-rw-r--r--engines/sci/engine/kgraphics.cpp6
-rw-r--r--engines/sci/engine/savegame.cpp16
3 files changed, 18 insertions, 6 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index b684b17b02..ca4c8754a1 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -215,7 +215,7 @@ static const SciKernelMapSubEntry kPalette_subops[] = {
{ SIG_SCIALL, 5, MAP_CALL(PaletteFindColor), "iii", NULL },
{ SIG_SCIALL, 6, MAP_CALL(PaletteAnimate), "i*", NULL },
{ SIG_SCIALL, 7, MAP_CALL(PaletteSave), "", NULL },
- { SIG_SCIALL, 8, MAP_CALL(PaletteRestore), "i", NULL },
+ { SIG_SCIALL, 8, MAP_CALL(PaletteRestore), "[r0]", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 78fb78d42c..56518f10bf 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -616,16 +616,16 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) {
reg_t kPaletteSave(EngineState *s, int argc, reg_t *argv) {
if (g_sci->getResMan()->isVGA()) {
- warning("kPalette(7), save palette to heap STUB");
+ return g_sci->_gfxPalette->kernelSave();
}
return NULL_REG;
}
reg_t kPaletteRestore(EngineState *s, int argc, reg_t *argv) {
if (g_sci->getResMan()->isVGA()) {
- warning("kPalette(8), restore palette from heap STUB");
+ g_sci->_gfxPalette->kernelRestore(argv[0]);
}
- return s->r_acc;
+ return argv[0];
}
reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 3de555cad3..806c8893b4 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -563,6 +563,18 @@ void StringTable::saveLoadWithSerializer(Common::Serializer &ser) {
}
#endif
+void GfxPalette::palVarySaveLoadPalette(Common::Serializer &s, Palette *palette) {
+ s.syncBytes(palette->mapping, 256);
+ s.syncAsUint32LE(palette->timestamp);
+ for (int i = 0; i < 256; i++) {
+ s.syncAsByte(palette->colors[i].used);
+ s.syncAsByte(palette->colors[i].r);
+ s.syncAsByte(palette->colors[i].g);
+ s.syncAsByte(palette->colors[i].b);
+ }
+ s.syncBytes(palette->intensity, 256);
+}
+
void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
if (s.getVersion() < 24)
return;
@@ -572,8 +584,8 @@ void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(_palVaryResourceId);
if (_palVaryResourceId != -1) {
- _palVaryOriginPalette.saveLoadWithSerializer(s);
- _palVaryTargetPalette.saveLoadWithSerializer(s);
+ palVarySaveLoadPalette(s, &_palVaryOriginPalette);
+ palVarySaveLoadPalette(s, &_palVaryTargetPalette);
s.syncAsSint16LE(_palVaryStep);
s.syncAsSint16LE(_palVaryStepStop);
s.syncAsSint16LE(_palVaryDirection);