Removed the ugly saveOrLoadCursorImages hack and instead properly overload ScummEngine::saveOrLoad; did the same for the V7 IMuseDigital save/load code

svn-id: r17818
This commit is contained in:
Max Horn 2005-04-26 13:33:17 +00:00
parent 9421c2a9b9
commit c9cdee2d97
4 changed files with 22 additions and 17 deletions

View File

@ -494,14 +494,4 @@ void ScummEngine_v5::setBuiltinCursor(int idx) {
updateCursor();
}
void ScummEngine_v5::saveOrLoadCursorImages(Serializer *s) {
const SaveLoadEntry cursorEntries[] = {
MKARRAY2(ScummEngine_v5, _cursorImages[0][0], sleUint16, 16, 4, (byte*)_cursorImages[1] - (byte*)_cursorImages[0], VER(44)),
MKARRAY(ScummEngine_v5, _cursorHotspots[0], sleByte, 8, VER(44)),
MKEND()
};
s->saveLoadEntries(this, cursorEntries);
}
} // End of namespace Scumm

View File

@ -64,6 +64,8 @@ protected:
virtual void initScummVars();
virtual void decodeParseString();
virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
virtual void readMAXS(int blockSize);
int getWordVararg(int *ptr);
@ -79,7 +81,6 @@ protected:
void setBuiltinCursor(int index);
void redefineBuiltinCursorFromChar(int index, int chr);
void redefineBuiltinCursorHotspot(int index, int x, int y);
void saveOrLoadCursorImages(Serializer *s);
/* Version 5 script opcodes */
void o5_actorFollowCamera();
@ -1243,6 +1244,8 @@ protected:
virtual void setupScummVars();
virtual void initScummVars();
virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
virtual void readMAXS(int blockSize);
virtual void readGlobalObjects();
virtual void readIndexBlock(uint32 blocktype, uint32 itemsize);

View File

@ -909,13 +909,26 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
if (_imuse && (_saveSound || !_saveTemporaryState)) {
_imuse->save_or_load(s, this);
}
}
if (_imuseDigital) {
_imuseDigital->saveOrLoad(s);
}
void ScummEngine_v5::saveOrLoad(Serializer *s, uint32 savegameVersion) {
ScummEngine::saveOrLoad(s, savegameVersion);
const SaveLoadEntry cursorEntries[] = {
MKARRAY2(ScummEngine_v5, _cursorImages[0][0], sleUint16, 16, 4, (byte*)_cursorImages[1] - (byte*)_cursorImages[0], VER(44)),
MKARRAY(ScummEngine_v5, _cursorHotspots[0], sleByte, 8, VER(44)),
MKEND()
};
// This is probably only needed for Loom.
saveOrLoadCursorImages(s);
s->saveLoadEntries(this, cursorEntries);
}
void ScummEngine_v7::saveOrLoad(Serializer *s, uint32 savegameVersion) {
ScummEngine::saveOrLoad(s, savegameVersion);
assert(_imuseDigital);
_imuseDigital->saveOrLoad(s);
}
void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) {

View File

@ -427,7 +427,6 @@ public:
void updateCursor();
virtual void animateCursor() {}
virtual void updatePalette();
virtual void saveOrLoadCursorImages(Serializer *s) {}
/**
* Flag which signals that the SMUSH video playback should end now
@ -564,7 +563,7 @@ protected:
bool saveState(int slot, bool compat);
bool loadState(int slot, bool compat);
void saveOrLoad(Serializer *s, uint32 savegameVersion);
virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
void saveLoadResource(Serializer *ser, int type, int index); // "Obsolete"
void saveResource(Serializer *ser, int type, int index);
void loadResource(Serializer *ser, int type, int index);