diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/charset.cpp | 14 | ||||
-rw-r--r-- | engines/scumm/charset.h | 3 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/saveload.h | 2 |
4 files changed, 27 insertions, 5 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 654a7fd6c3..c6d751c870 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1311,6 +1311,20 @@ void CharsetRenderer::translateColor() { } } +void CharsetRenderer::saveLoadWithSerializer(Serializer *ser) { + static const SaveLoadEntry charsetRendererEntries[] = { + MKLINE(CharsetRenderer, _curId, sleByte, VER(73)), + MKLINE(CharsetRenderer, _color, sleByte, VER(73)), + MKEND() + }; + + ser->saveLoadEntries(this, charsetRendererEntries); + + if (ser->isLoading()) { + setCurID(_curId); + setColor(_color); + } +} void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { int width, height, origWidth, origHeight; diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index 5039d31573..de2dad06a2 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/rect.h" #include "scumm/gfx.h" +#include "scumm/saveload.h" namespace Scumm { @@ -84,6 +85,8 @@ public: virtual int getCharWidth(byte chr) = 0; virtual void setColor(byte color) { _color = color; translateColor(); } + + void saveLoadWithSerializer(Serializer *ser); }; class CharsetRendererCommon : public CharsetRenderer { diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 242b7c9f51..16f6b012fc 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1156,11 +1156,16 @@ void ScummEngine::saveOrLoad(Serializer *s) { // // Save/load the charset renderer state // - if (s->getVersion() >= VER(72)) { - if (s->isSaving()) { - s->saveByte(_charset->getCurID()); - } else { + if (s->getVersion() >= VER(73)) { + _charset->saveLoadWithSerializer(s); + } else if (s->isLoading()) { + if (s->getVersion() == VER(72)) { _charset->setCurID(s->loadByte()); + } else { + // Before V72, the charset id wasn't saved. This used to cause issues such + // as the one described in the bug report #1722153. For these savegames, + // we reinitialize the id using a, hopefully, sane value. + _charset->setCurID(_string[0]._default.charset); } } } diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index 0c4bc14001..f26ee3bb42 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -47,7 +47,7 @@ namespace Scumm { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 72 +#define CURRENT_VER 73 /** * An auxillary macro, used to specify savegame versions. We use this instead |